My Project
Data Structures | Macros | Typedefs | Functions | Variables
iparith.cc File Reference
#include "kernel/mod2.h"
#include "factory/factory.h"
#include "coeffs/bigintmat.h"
#include "coeffs/coeffs.h"
#include "coeffs/numbers.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "misc/sirandom.h"
#include "misc/prime.h"
#include "polys/matpol.h"
#include "polys/monomials/maps.h"
#include "polys/sparsmat.h"
#include "polys/weight.h"
#include "polys/ext_fields/transext.h"
#include "polys/clapsing.h"
#include "polys/flintconv.h"
#include "kernel/combinatorics/stairc.h"
#include "kernel/combinatorics/hilb.h"
#include "kernel/linear_algebra/interpolation.h"
#include "kernel/linear_algebra/linearAlgebra.h"
#include "kernel/linear_algebra/MinorInterface.h"
#include "kernel/GBEngine/kChinese.h"
#include "kernel/spectrum/GMPrat.h"
#include "kernel/groebner_walk/walkProc.h"
#include "kernel/oswrapper/timer.h"
#include "kernel/fglm/fglm.h"
#include "kernel/GBEngine/kstdfac.h"
#include "kernel/GBEngine/syz.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/units.h"
#include "kernel/GBEngine/tgb.h"
#include "kernel/preimage.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "Singular/mod_lib.h"
#include "Singular/fevoices.h"
#include "Singular/tok.h"
#include "Singular/ipid.h"
#include "Singular/sdb.h"
#include "Singular/subexpr.h"
#include "Singular/lists.h"
#include "Singular/maps_ip.h"
#include "Singular/feOpt.h"
#include "Singular/ipconv.h"
#include "Singular/ipprint.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/misc_ip.h"
#include "Singular/linearAlgebra_ip.h"
#include "Singular/number2.h"
#include "Singular/fglm.h"
#include "Singular/blackbox.h"
#include "Singular/newstruct.h"
#include "Singular/ipshell.h"
#include "reporter/si_signals.h"
#include <ctype.h>
#include "kernel/GBEngine/ratgring.h"
#include "kernel/GBEngine/nc.h"
#include "polys/nc/nc.h"
#include "polys/nc/sca.h"
#include "table.h"
#include "iparith.inc"

Go to the source code of this file.

Data Structures

struct  sValCmdTab
 
struct  cmdnames
 
struct  sValCmd1
 
struct  sValCmd2
 
struct  sValCmd3
 
struct  sValCmdM
 
struct  SArithBase
 

Macros

#define NC_MASK   (3+64)
 
#define RING_MASK   4
 
#define ZERODIVISOR_MASK   8
 
#define ALLOW_PLURAL   1
 
#define NO_NC   0
 
#define COMM_PLURAL   2
 
#define ALLOW_RING   4
 
#define NO_RING   0
 
#define NO_ZERODIVISOR   8
 
#define ALLOW_ZERODIVISOR   0
 
#define ALLOW_LP   64
 
#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL
 
#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)
 
#define WARN_RING   16
 
#define NO_CONVERSION   32
 
#define ii_div_by_0   "div. by 0"
 
#define SIMPL_NORMALIZE   64
 
#define SIMPL_LMDIV   32
 
#define SIMPL_LMEQ   16
 
#define SIMPL_MULT   8
 
#define SIMPL_EQU   4
 
#define SIMPL_NULL   2
 
#define SIMPL_NORM   1
 
#define jjWRONG2   (proc2)jjWRONG
 
#define jjWRONG3   (proc3)jjWRONG
 
#define D(A)   (A)
 
#define NULL_VAL   NULL
 
#define IPARITH
 

Typedefs

typedef sValCmdTab jjValCmdTab[]
 
typedef BOOLEAN(* proc2) (leftv, leftv, leftv)
 
typedef BOOLEAN(* proc3) (leftv, leftv, leftv, leftv)
 
typedef char si_char_2[2]
 

Functions

static BOOLEAN check_valid (const int p, const int op)
 
static int _gentable_sort_cmds (const void *a, const void *b)
 compares to entry of cmdsname-list More...
 
int iiArithRemoveCmd (char *szName)
 
int iiArithAddCmd (const char *szName, short nAlias, short nTokval, short nToktype, short nPos=-1)
 
static int iiTabIndex (const jjValCmdTab dArithTab, const int len, const int op)
 
static Subexpr jjMakeSub (leftv e)
 
static int iin_Int (number &n, coeffs cf)
 
poly pHeadProc (poly p)
 
int iiTokType (int op)
 
static BOOLEAN jjOP_BIM_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_BIM_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_BI_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_IV_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_IM_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_IM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOLON (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDOTDOT (leftv res, leftv u, leftv v)
 
static void jjEQUAL_REST (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_IV_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_REST (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUSMINUS_Gen (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOLCOL (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_B (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_B_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_MA_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_P_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_B_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_B (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_BI1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_BI2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_P1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_P2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_N1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_N2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_I1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_I2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIVMOD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_R (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjAND_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOR_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_PBu (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_P_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_V_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER_rest (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER_IV (leftv res, leftv u, leftv v)
 
BOOLEAN jjPROC (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMAP (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRING_1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCHINREM_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjALIGN_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjALIGN_M (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCHINREM_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEF (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEF_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEFFS_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEFFS2_KB (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCONTRACT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDEG_M_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDEG_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDelete_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDelete_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDET2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDET2_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_ID_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIM2 (leftv res, leftv v, leftv w)
 
static BOOLEAN jjDIVISION (leftv res, leftv u, leftv v)
 
static BOOLEAN jjELIMIN (leftv res, leftv u, leftv v)
 
static BOOLEAN jjELIMIN_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXPORTTO (leftv, leftv u, leftv v)
 
static BOOLEAN jjERROR (leftv, leftv u)
 
static BOOLEAN jjEXTGCD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXTGCD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXTGCD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAC_P2 (leftv res, leftv u, leftv dummy)
 
static BOOLEAN jjFACSTD2 (leftv res, leftv v, leftv w)
 
static BOOLEAN jjFAREY_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAREY_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAREY_LI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFETCH (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFIND2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFRES3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFRES (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFWALK (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHILBERT2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG1_W (leftv res, leftv v, leftv u)
 
static BOOLEAN jjINDEPSET2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINTERSECT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINTERPOLATION (leftv res, leftv l, leftv v)
 
static BOOLEAN jjJanetBasis2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJanetBasis (leftv res, leftv v)
 
static BOOLEAN jjJET_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJET_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKBASE2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPREIMAGE (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjKERNEL (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKoszul (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKoszul_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLIFT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLIFTSTD (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLOAD2 (leftv, leftv, leftv v)
 
static BOOLEAN jjLOAD_E (leftv, leftv v, leftv u)
 
static BOOLEAN jjMODULO (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMONITOR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMONITOR1 (leftv res, leftv v)
 
static BOOLEAN jjMONOM (leftv res, leftv v)
 
static BOOLEAN jjNEWSTRUCT2 (leftv, leftv u, leftv v)
 
static BOOLEAN jjPARSTR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPlural_num_poly (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_num_mat (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_mat_poly (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_mat_mat (leftv res, leftv a, leftv b)
 
static BOOLEAN jjBRACKET (leftv res, leftv a, leftv b)
 
static BOOLEAN jjBRACKET_REC (leftv res, leftv a, leftv b, leftv c)
 
static BOOLEAN jjOPPOSE (leftv res, leftv a, leftv b)
 
static BOOLEAN jjQUOT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRANDOM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRANK2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREAD2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREDUCE_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREDUCE_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRES (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPFAC2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRMINUS (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRPLUS (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRSUM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSIMPL_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSQR_FREE2 (leftv res, leftv u, leftv dummy)
 
static BOOLEAN jjSTATUS2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTATUS2L (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSIMPL_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTD_HILB (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTD_1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSYZ_2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTENSOR (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTENSOR_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjVARSTR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAIT1ST2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAITALL2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWEDGE (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWRONG (leftv, leftv)
 
static BOOLEAN jjDUMMY (leftv res, leftv u)
 
static BOOLEAN jjNULL (leftv, leftv)
 
static BOOLEAN jjPLUSPLUS (leftv, leftv u)
 
static BOOLEAN jjUMINUS_BI (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_I (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_N (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_P (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_MA (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_IV (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_BIM (leftv res, leftv u)
 
static BOOLEAN jjSetRing (leftv, leftv u)
 
static BOOLEAN jjPROC1 (leftv res, leftv u)
 
static BOOLEAN jjBAREISS (leftv res, leftv v)
 
static BOOLEAN jjBAREISS_BIM (leftv res, leftv v)
 
static BOOLEAN jjBI2N (leftv res, leftv u)
 
static BOOLEAN jjBI2IM (leftv res, leftv u)
 
static BOOLEAN jjBI2P (leftv res, leftv u)
 
static BOOLEAN jjCALL1MANY (leftv res, leftv u)
 
static BOOLEAN jjCHAR (leftv res, leftv v)
 
static BOOLEAN jjCOLS (leftv res, leftv v)
 
static BOOLEAN jjCOLS_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOLS_IV (leftv res, leftv v)
 
static BOOLEAN jjCONTENT (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BI (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_N (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_L (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_M (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_IV (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RG (leftv res, leftv v)
 
static BOOLEAN jjDEG (leftv res, leftv v)
 
static BOOLEAN jjDEG_M (leftv res, leftv u)
 
static BOOLEAN jjDEGREE (leftv res, leftv v)
 
static BOOLEAN jjDEFINED (leftv res, leftv v)
 
static BOOLEAN jjDENOMINATOR (leftv res, leftv v)
 Return the denominator of the input number. More...
 
static BOOLEAN jjNUMERATOR (leftv res, leftv v)
 Return the numerator of the input number. More...
 
static BOOLEAN jjDET (leftv res, leftv v)
 
static BOOLEAN jjDET_BI (leftv res, leftv v)
 
static BOOLEAN jjDET_I (leftv res, leftv v)
 
static BOOLEAN jjDET_S (leftv res, leftv v)
 
static BOOLEAN jjDIM (leftv res, leftv v)
 
static BOOLEAN jjDUMP (leftv, leftv v)
 
static BOOLEAN jjE (leftv res, leftv v)
 
static BOOLEAN jjEXECUTE (leftv, leftv v)
 
static BOOLEAN jjFACSTD (leftv res, leftv v)
 
static BOOLEAN jjFAC_P (leftv res, leftv u)
 
static BOOLEAN jjGETDUMP (leftv, leftv v)
 
static BOOLEAN jjHIGHCORNER (leftv res, leftv v)
 
static BOOLEAN jjHIGHCORNER_M (leftv res, leftv v)
 
static BOOLEAN jjHILBERT (leftv, leftv v)
 
static BOOLEAN jjHILBERT_IV (leftv res, leftv v)
 
static BOOLEAN jjHOMOG1 (leftv res, leftv v)
 
static BOOLEAN jjidMaxIdeal (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Ma (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Map (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_R (leftv res, leftv v)
 
static BOOLEAN jjIm2Iv (leftv res, leftv v)
 
static BOOLEAN jjIMPART (leftv res, leftv v)
 
static BOOLEAN jjINDEPSET (leftv res, leftv v)
 
static BOOLEAN jjINTERRED (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_P (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_S (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR0 (leftv res, leftv)
 
static BOOLEAN jjJACOB_P (leftv res, leftv v)
 
static BOOLEAN jjDIFF_COEF (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJACOB_M (leftv res, leftv a)
 
static BOOLEAN jjKERNEL_M (leftv res, leftv v)
 
static BOOLEAN jjKERNEL_SM (leftv res, leftv v)
 
static BOOLEAN jjKBASE (leftv res, leftv v)
 
static BOOLEAN jjL2R (leftv res, leftv v)
 
static BOOLEAN jjLEADCOEF (leftv res, leftv v)
 
static BOOLEAN jjLEADEXP (leftv res, leftv v)
 
static BOOLEAN jjLEADMONOM (leftv res, leftv v)
 
static BOOLEAN jjLOAD1 (leftv, leftv v)
 
static BOOLEAN jjLISTRING (leftv res, leftv v)
 
static BOOLEAN jjPFAC1 (leftv res, leftv v)
 
static BOOLEAN jjLagSolve (leftv res, leftv v)
 
static BOOLEAN jjLU_DECOMP (leftv res, leftv v)
 
static BOOLEAN jjMEMORY (leftv res, leftv v)
 
static BOOLEAN jjMSTD (leftv res, leftv v)
 
static BOOLEAN jjMULT (leftv res, leftv v)
 
static BOOLEAN jjMINRES_R (leftv res, leftv v)
 
static BOOLEAN jjN2BI (leftv res, leftv v)
 
static BOOLEAN jjNAMEOF (leftv res, leftv v)
 
static BOOLEAN jjNAMES (leftv res, leftv v)
 
static BOOLEAN jjNAMES_I (leftv res, leftv v)
 
static BOOLEAN jjNOT (leftv res, leftv v)
 
static BOOLEAN jjNVARS (leftv res, leftv v)
 
static BOOLEAN jjOpenClose (leftv, leftv v)
 
static BOOLEAN jjORD (leftv res, leftv v)
 
static BOOLEAN jjPAR1 (leftv res, leftv v)
 
static BOOLEAN jjPARDEG (leftv res, leftv v)
 
static BOOLEAN jjPARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjP2BI (leftv res, leftv v)
 
static BOOLEAN jjP2I (leftv res, leftv v)
 
static BOOLEAN jjPREIMAGE_R (leftv res, leftv v)
 
static BOOLEAN jjPRIME (leftv res, leftv v)
 
static BOOLEAN jjPRUNE (leftv res, leftv v)
 
static BOOLEAN jjP2N (leftv res, leftv v)
 
static BOOLEAN jjRESERVEDNAME (leftv res, leftv v)
 
static BOOLEAN jjRANK1 (leftv res, leftv v)
 
static BOOLEAN jjREAD (leftv res, leftv v)
 
static BOOLEAN jjREGULARITY (leftv res, leftv v)
 
static BOOLEAN jjREPART (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST_C (leftv res, leftv v)
 
static BOOLEAN jjRING_LIST (leftv res, leftv v)
 
static BOOLEAN jjROWS (leftv res, leftv v)
 
static BOOLEAN jjROWS_BIM (leftv res, leftv v)
 
static BOOLEAN jjROWS_IV (leftv res, leftv v)
 
static BOOLEAN jjRPAR (leftv res, leftv v)
 
static BOOLEAN jjS2I (leftv res, leftv v)
 
static BOOLEAN jjSLIM_GB (leftv res, leftv u)
 
static BOOLEAN jjSBA (leftv res, leftv v)
 
static BOOLEAN jjSBA_1 (leftv res, leftv v, leftv u)
 
static BOOLEAN jjSBA_2 (leftv res, leftv v, leftv u, leftv t)
 
static BOOLEAN jjSTD (leftv res, leftv v)
 
static BOOLEAN jjSort_Id (leftv res, leftv v)
 
static BOOLEAN jjSQR_FREE (leftv res, leftv u)
 
static BOOLEAN jjSYZYGY (leftv res, leftv v)
 
static BOOLEAN jjTRACE_IV (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_BIM (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_IV (leftv res, leftv v)
 
static BOOLEAN jjOPPOSITE (leftv res, leftv a)
 
static BOOLEAN jjENVELOPE (leftv res, leftv a)
 
static BOOLEAN jjTWOSTD (leftv res, leftv a)
 
static BOOLEAN jjRIGHTSTD (leftv res, leftv v)
 
static BOOLEAN jjTYPEOF (leftv res, leftv v)
 
static BOOLEAN jjUNIVARIATE (leftv res, leftv v)
 
static BOOLEAN jjVAR1 (leftv res, leftv v)
 
static BOOLEAN jjVARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjVDIM (leftv res, leftv v)
 
BOOLEAN jjWAIT1ST1 (leftv res, leftv u)
 
BOOLEAN jjWAITALL1 (leftv res, leftv u)
 
BOOLEAN jjLOAD (const char *s, BOOLEAN autoexport)
 load lib/module given in v More...
 
static void WerrorS_dummy (const char *)
 
BOOLEAN jjLOAD_TRY (const char *s)
 
static BOOLEAN jjstrlen (leftv res, leftv v)
 
static BOOLEAN jjpLength (leftv res, leftv v)
 
static BOOLEAN jjidElem (leftv res, leftv v)
 
static BOOLEAN jjidFreeModule (leftv res, leftv v)
 
static BOOLEAN jjidVec2Ideal (leftv res, leftv v)
 
static BOOLEAN jjrCharStr (leftv res, leftv v)
 
static BOOLEAN jjpHead (leftv res, leftv v)
 
static BOOLEAN jjidHead (leftv res, leftv v)
 
static BOOLEAN jjidMinBase (leftv res, leftv v)
 
static BOOLEAN jjpMaxComp (leftv res, leftv v)
 
static BOOLEAN jjmpTrace (leftv res, leftv v)
 
static BOOLEAN jjmpTransp (leftv res, leftv v)
 
static BOOLEAN jjrOrdStr (leftv res, leftv v)
 
static BOOLEAN jjrVarStr (leftv res, leftv v)
 
static BOOLEAN jjrParStr (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RES (leftv res, leftv v)
 
static BOOLEAN jjDIM_R (leftv res, leftv v)
 
static BOOLEAN jjidTransp (leftv res, leftv v)
 
static BOOLEAN jjnInt (leftv res, leftv u)
 
static BOOLEAN jjnlInt (leftv res, leftv u)
 
static BOOLEAN jjBRACK_S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Bim (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_SM (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_I_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjPROC3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING_2 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBAREISS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_KB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_ALG (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_HILB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFIND3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFWALK3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjHILBERT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjHOMOG_ID_W (leftv res, leftv u, leftv v, leftv)
 
static BOOLEAN jjHOMOG_P_W (leftv res, leftv u, leftv v, leftv)
 
static BOOLEAN jjINTMAT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjINTERSECT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjINTERSEC3S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_P_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_P_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_ID_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_ID_M (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMINOR_M (leftv res, leftv v)
 
static BOOLEAN jjNEWSTRUCT3 (leftv, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRANDOM_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Test (leftv v, leftv w, int &ringvar, poly &monomexpr)
 
static BOOLEAN jjSUBST_Bu (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_X (leftv res, leftv u, leftv v, leftv w, int input_type)
 
static BOOLEAN jjSUBST_Id_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_N (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMODULO3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMODULO3S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD_SYZ (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD_ALG (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CP (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_ID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRES3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTATUS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTD_HILB_W (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBREAK0 (leftv, leftv)
 
static BOOLEAN jjBREAK1 (leftv, leftv v)
 
static BOOLEAN jjCALL1ARG (leftv res, leftv v)
 
static BOOLEAN jjCALL2ARG (leftv res, leftv u)
 
static BOOLEAN jjCALL3ARG (leftv res, leftv u)
 
static BOOLEAN jjCOEF_M (leftv, leftv v)
 
static BOOLEAN jjDIVISION4 (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_PL (leftv res, leftv v)
 
static BOOLEAN jjFETCH_M (leftv res, leftv u)
 
static BOOLEAN jjINTERSECT_PL (leftv res, leftv v)
 
static BOOLEAN jjLU_INVERSE (leftv res, leftv v)
 
static BOOLEAN jjLU_SOLVE (leftv res, leftv v)
 
static BOOLEAN jjINTVEC_PL (leftv res, leftv v)
 
static BOOLEAN jjJET4 (leftv res, leftv u)
 
static BOOLEAN jjKLAMMER_PL (leftv res, leftv u)
 
static BOOLEAN jjLIFT_4 (leftv res, leftv U)
 
static BOOLEAN jjLIFTSTD_M (leftv res, leftv U)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
static BOOLEAN jjMODULO4 (leftv res, leftv u)
 
static BOOLEAN jjNAMES0 (leftv res, leftv)
 
static BOOLEAN jjOPTION_PL (leftv res, leftv v)
 
static BOOLEAN jjREDUCE4 (leftv res, leftv u)
 
static BOOLEAN jjREDUCE5 (leftv res, leftv u)
 
static BOOLEAN jjRESERVED0 (leftv, leftv)
 
static BOOLEAN jjRESERVEDLIST0 (leftv res, leftv)
 
static BOOLEAN jjSTRING_PL (leftv res, leftv v)
 
static BOOLEAN jjTEST (leftv, leftv v)
 
static BOOLEAN jjFactModD_M (leftv res, leftv v)
 
static BOOLEAN jjSTATUS_M (leftv res, leftv v)
 
static BOOLEAN jjSUBST_M (leftv res, leftv u)
 
static BOOLEAN jjQRDS (leftv res, leftv INPUT)
 
static BOOLEAN jjSTD_HILB_WP (leftv res, leftv INPUT)
 
static BOOLEAN jjRING_PL (leftv res, leftv a)
 
static BOOLEAN jjRESTART (leftv, leftv u)
 
static BOOLEAN iiExprArith2TabIntern (leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a and a->next return TRUE on failure More...
 
BOOLEAN iiExprArith2 (leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
 
BOOLEAN iiExprArith1Tab (leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith1 (leftv res, leftv a, int op)
 
static BOOLEAN iiExprArith3TabIntern (leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith3 (leftv res, int op, leftv a, leftv b, leftv c)
 
BOOLEAN iiExprArith3Tab (leftv res, leftv a, int op, const struct sValCmd3 *dA3, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure More...
 
BOOLEAN iiExprArithM (leftv res, leftv a, int op)
 
int IsCmd (const char *n, int &tok)
 
const char * Tok2Cmdname (int tok)
 
int iiInitArithmetic ()
 initialisation of arithmetic structured data More...
 
int iiArithFindCmd (const char *szName)
 
char * iiArithGetCmd (int nPos)
 
int iiArithRemoveCmd (const char *szName)
 
static int jjCOMPARE_ALL (const void *aa, const void *bb)
 
BOOLEAN jjSORTLIST (leftv, leftv arg)
 
BOOLEAN jjUNIQLIST (leftv, leftv arg)
 

Variables

long all_farey =0L
 
long farey_cnt =0L
 
STATIC_VAR SArithBase sArithBase
 Base entry for arithmetic. More...
 
EXTERN_VAR int cmdtok
 
EXTERN_VAR BOOLEAN expected_parms
 
VAR int iiOp
 
EXTERN_VAR int singclap_factorize_retry
 
STATIC_VAR int WerrorS_dummy_cnt =0
 
STATIC_VAR si_char_2 Tok2Cmdname_buf =" "
 

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 125 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 59 of file gentable.cc.

Data Fields
short alias
const char * name
char * name
short toktype
short tokval

◆ sValCmd1

struct sValCmd1

Definition at line 78 of file gentable.cc.

Data Fields
short arg
short cmd
int p
proc1 p
short res
short valid_for

◆ sValCmd2

struct sValCmd2

Definition at line 69 of file gentable.cc.

Data Fields
short arg1
short arg2
short cmd
int p
proc2 p
short res
short valid_for

◆ sValCmd3

struct sValCmd3

Definition at line 86 of file gentable.cc.

Data Fields
short arg1
short arg2
short arg3
short cmd
int p
proc3 p
short res
short valid_for

◆ sValCmdM

struct sValCmdM

Definition at line 96 of file gentable.cc.

Data Fields
short cmd
short number_of_args
int p
proc1 p
short res
short valid_for

◆ SArithBase

struct SArithBase

Definition at line 182 of file iparith.cc.

Data Fields
unsigned nCmdAllocated number of commands-slots allocated
unsigned nCmdUsed number of commands used
unsigned nLastIdentifier valid indentifieres are slot 1..nLastIdentifier
struct sValCmd1 * psValCmd1
struct sValCmd2 * psValCmd2
struct sValCmd3 * psValCmd3
struct sValCmdM * psValCmdM
cmdnames * sCmds array of existing commands

Macro Definition Documentation

◆ ALLOW_LP

#define ALLOW_LP   64

Definition at line 111 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 112 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 104 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 107 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 110 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 114 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 106 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8697 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 218 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8699 of file iparith.cc.

◆ jjWRONG2

#define jjWRONG2   (proc2)jjWRONG

Definition at line 3670 of file iparith.cc.

◆ jjWRONG3

#define jjWRONG3   (proc3)jjWRONG

Definition at line 3671 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 92 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 120 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 105 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 108 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 109 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 8698 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 98 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3267 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3264 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3265 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3266 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3269 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3263 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3268 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 118 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 99 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 131 of file iparith.cc.

◆ proc2

typedef BOOLEAN(* proc2) (leftv, leftv, leftv)

Definition at line 151 of file iparith.cc.

◆ proc3

typedef BOOLEAN(* proc3) (leftv, leftv, leftv, leftv)

Definition at line 162 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

Definition at line 9602 of file iparith.cc.

Function Documentation

◆ _gentable_sort_cmds()

static int _gentable_sort_cmds ( const void *  a,
const void *  b 
)
static

compares to entry of cmdsname-list

Parameters
[in]a
[in]b
Returns
<ReturnValue>

Definition at line 9658 of file iparith.cc.

9659{
9660 cmdnames *pCmdL = (cmdnames*)a;
9661 cmdnames *pCmdR = (cmdnames*)b;
9662
9663 if(a==NULL || b==NULL) return 0;
9664
9665 /* empty entries goes to the end of the list for later reuse */
9666 if(pCmdL->name==NULL) return 1;
9667 if(pCmdR->name==NULL) return -1;
9668
9669 /* $INVALID$ must come first */
9670 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9671 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9672
9673 /* tokval=-1 are reserved names at the end */
9674 if (pCmdL->tokval==-1)
9675 {
9676 if (pCmdR->tokval==-1)
9677 return strcmp(pCmdL->name, pCmdR->name);
9678 /* pCmdL->tokval==-1, pCmdL goes at the end */
9679 return 1;
9680 }
9681 /* pCmdR->tokval==-1, pCmdR goes at the end */
9682 if(pCmdR->tokval==-1) return -1;
9683
9684 return strcmp(pCmdL->name, pCmdR->name);
9685}
CanonicalForm b
Definition: cfModGcd.cc:4103
#define NULL
Definition: omList.c:12

◆ check_valid()

static BOOLEAN check_valid ( const int  p,
const int  op 
)
static

Definition at line 9884 of file iparith.cc.

9885{
9887 {
9888 if ((p & NC_MASK)==NO_NC)
9889 {
9890 WerrorS("not implemented for non-commutative rings");
9891 return TRUE;
9892 }
9893 else if ((p & NC_MASK)==COMM_PLURAL)
9894 {
9895 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9896 return FALSE;
9897 }
9898 /* else, ALLOW_PLURAL */
9899 }
9900 else if (rIsLPRing(currRing))
9901 {
9902 if ((p & ALLOW_LP)==0)
9903 {
9904 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9905 return TRUE;
9906 }
9907 }
9909 {
9910 if ((p & RING_MASK)==0 /*NO_RING*/)
9911 {
9912 WerrorS("not implemented for rings with rings as coeffients");
9913 return TRUE;
9914 }
9915 /* else ALLOW_RING */
9916 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9918 {
9919 WerrorS("domain required as coeffients");
9920 return TRUE;
9921 }
9922 /* else ALLOW_ZERODIVISOR */
9923 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9924 {
9925 WarnS("considering the image in Q[...]");
9926 }
9927 }
9928 return FALSE;
9929}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR char my_yylinebuf[80]
Definition: febase.cc:44
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:106
#define NO_ZERODIVISOR
Definition: iparith.cc:109
#define ALLOW_LP
Definition: iparith.cc:111
#define RING_MASK
Definition: iparith.cc:98
#define WARN_RING
Definition: iparith.cc:118
#define NC_MASK
Definition: iparith.cc:92
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9604
#define NO_NC
Definition: iparith.cc:105
#define ZERODIVISOR_MASK
Definition: iparith.cc:99
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:488
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411
#define rField_is_Ring(R)
Definition: ring.h:486

◆ iiArithAddCmd()

int iiArithAddCmd ( const char *  szName,
short  nAlias,
short  nTokval,
short  nToktype,
short  nPos = -1 
)

Definition at line 9825 of file iparith.cc.

9832{
9833 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9834 // nTokval, nToktype, nPos);
9835 if(nPos>=0)
9836 {
9837 // no checks: we rely on a correct generated code in iparith.inc
9838 assume((unsigned)nPos < sArithBase.nCmdAllocated);
9839 assume(szName!=NULL);
9840 sArithBase.sCmds[nPos].name = omStrDup(szName);
9841 sArithBase.sCmds[nPos].alias = nAlias;
9842 sArithBase.sCmds[nPos].tokval = nTokval;
9843 sArithBase.sCmds[nPos].toktype = nToktype;
9845 //if(nTokval>0) sArithBase.nLastIdentifier++;
9846 }
9847 else
9848 {
9849 if(szName==NULL) return -1;
9850 int nIndex = iiArithFindCmd(szName);
9851 if(nIndex>=0)
9852 {
9853 Print("'%s' already exists at %d\n", szName, nIndex);
9854 return -1;
9855 }
9856
9858 {
9859 /* needs to create new slots */
9860 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9862 if(sArithBase.sCmds==NULL) return -1;
9864 }
9865 /* still free slots available */
9867 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9868 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9869 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9871
9872 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9876 {
9877 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9878 }
9879 //Print("L=%d\n", sArithBase.nLastIdentifier);
9880 }
9881 return 0;
9882}
#define Print
Definition: emacs.cc:80
static int _gentable_sort_cmds(const void *a, const void *b)
compares to entry of cmdsname-list
Definition: iparith.cc:9658
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9730
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:184
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:191
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:199
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:190
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:189
#define assume(x)
Definition: mod2.h:387
#define nSize(n)
Definition: numbers.h:39
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 9730 of file iparith.cc.

9731{
9732 int an=0;
9733 int i = 0,v = 0;
9735
9736 loop
9737 //for(an=0; an<sArithBase.nCmdUsed; )
9738 {
9739 if(an>=en-1)
9740 {
9741 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9742 {
9743 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9744 return an;
9745 }
9746 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9747 {
9748 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9749 return en;
9750 }
9751 else
9752 {
9753 //Print("RET- 1\n");
9754 return -1;
9755 }
9756 }
9757 i=(an+en)/2;
9758 if (*szName < *(sArithBase.sCmds[i].name))
9759 {
9760 en=i-1;
9761 }
9762 else if (*szName > *(sArithBase.sCmds[i].name))
9763 {
9764 an=i+1;
9765 }
9766 else
9767 {
9768 v=strcmp(szName,sArithBase.sCmds[i].name);
9769 if(v<0)
9770 {
9771 en=i-1;
9772 }
9773 else if(v>0)
9774 {
9775 an=i+1;
9776 }
9777 else /*v==0*/
9778 {
9779 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9780 return i;
9781 }
9782 }
9783 }
9784 //if(i>=0 && i<sArithBase.nCmdUsed)
9785 // return i;
9786 //PrintS("RET-2\n");
9787 return -2;
9788}
int i
Definition: cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define loop
Definition: structs.h:75

◆ iiArithGetCmd()

char * iiArithGetCmd ( int  nPos)

Definition at line 9790 of file iparith.cc.

9791{
9792 if(nPos<0) return NULL;
9793 if(nPos<(int)sArithBase.nCmdUsed)
9794 return sArithBase.sCmds[nPos].name;
9795 return NULL;
9796}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9798 of file iparith.cc.

9799{
9800 int nIndex;
9801 if(szName==NULL) return -1;
9802
9803 nIndex = iiArithFindCmd(szName);
9804 if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9805 {
9806 Print("'%s' not found (%d)\n", szName, nIndex);
9807 return -1;
9808 }
9809 omFreeBinAddr(sArithBase.sCmds[nIndex].name);
9810 sArithBase.sCmds[nIndex].name=NULL;
9811 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9814
9815 /* fix last-identifier */
9818 {
9819 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9820 }
9821 //Print("L=%d\n", sArithBase.nLastIdentifier);
9822 return 0;
9823}
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258

◆ iiExprArith1()

BOOLEAN iiExprArith1 ( leftv  res,
leftv  a,
int  op 
)

Definition at line 9070 of file iparith.cc.

9071{
9072 if (!errorreported)
9073 {
9074 res->Init();
9075#ifdef SIQ
9076 if (siq>0)
9077 {
9078 //Print("siq:%d\n",siq);
9080 memcpy(&d->arg1,a,sizeof(sleftv));
9081 a->Init();
9082 d->op=op;
9083 d->argc=1;
9084 res->data=(char *)d;
9085 res->rtyp=COMMAND;
9086 return FALSE;
9087 }
9088#endif
9089 int at=a->Typ();
9090 // handling bb-objects ----------------------------------------------------
9091 if(op>MAX_TOK) // explicit type conversion to bb
9092 {
9093 blackbox *bb=getBlackboxStuff(op);
9094 if (bb!=NULL)
9095 {
9096 res->rtyp=op;
9097 res->data=bb->blackbox_Init(bb);
9098 if(!bb->blackbox_Assign(res,a)) return FALSE;
9099 }
9100 else
9101 return TRUE;
9102 }
9103 else if (at>MAX_TOK) // argument is of bb-type
9104 {
9105 blackbox *bb=getBlackboxStuff(at);
9106 if (bb!=NULL)
9107 {
9108 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9109 // else: no op defined
9110 }
9111 else
9112 return TRUE;
9113 }
9114 if (errorreported) return TRUE;
9115
9116 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9117 return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9118 }
9119 a->CleanUp();
9120 return TRUE;
9121}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1011
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:60
VAR short errorreported
Definition: feFopen.cc:23
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation 'op' to an argument a return TRUE on failure
Definition: iparith.cc:8940
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9579
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1280
VAR omBin sip_command_bin
Definition: ipid.cc:45
ip_command * command
Definition: ipid.h:23
const struct sValCmd1 dArith1[]
Definition: table.h:37
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
VAR BOOLEAN siq
Definition: subexpr.cc:48
@ MAX_TOK
Definition: tok.h:218
#define COMMAND
Definition: tok.h:29

◆ iiExprArith1Tab()

BOOLEAN iiExprArith1Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd1 dA1,
int  at,
const struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to an argument a return TRUE on failure

Parameters
[out]respre-allocated result
[in]aargument
[in]opoperation
[in]dA1table of possible proc assumes dArith1[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 8940 of file iparith.cc.

8941{
8942 res->Init();
8943 BOOLEAN call_failed=FALSE;
8944
8945 if (!errorreported)
8946 {
8947 BOOLEAN failed=FALSE;
8948 iiOp=op;
8949 int i = 0;
8950 while (dA1[i].cmd==op)
8951 {
8952 if (at==dA1[i].arg)
8953 {
8954 if (currRing!=NULL)
8955 {
8956 if (check_valid(dA1[i].valid_for,op)) break;
8957 }
8958 else
8959 {
8960 if (RingDependend(dA1[i].res))
8961 {
8962 WerrorS("no ring active (5)");
8963 break;
8964 }
8965 }
8966 if (traceit&TRACE_CALL)
8967 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8968 res->rtyp=dA1[i].res;
8969 if ((call_failed=dA1[i].p(res,a)))
8970 {
8971 break;// leave loop, goto error handling
8972 }
8973 if (a->Next()!=NULL)
8974 {
8976 failed=iiExprArith1(res->next,a->next,op);
8977 }
8978 a->CleanUp();
8979 return failed;
8980 }
8981 i++;
8982 }
8983 // implicite type conversion --------------------------------------------
8984 if (dA1[i].cmd!=op)
8985 {
8987 i=0;
8988 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8989 while (dA1[i].cmd==op)
8990 {
8991 int ai;
8992 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8993 if ((dA1[i].valid_for & NO_CONVERSION)==0)
8994 {
8995 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8996 {
8997 if (currRing!=NULL)
8998 {
8999 if (check_valid(dA1[i].valid_for,op)) break;
9000 }
9001 else
9002 {
9003 if (RingDependend(dA1[i].res))
9004 {
9005 WerrorS("no ring active (6)");
9006 break;
9007 }
9008 }
9009 if (traceit&TRACE_CALL)
9010 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9011 res->rtyp=dA1[i].res;
9012 failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9013 || (call_failed=dA1[i].p(res,an)));
9014 // everything done, clean up temp. variables
9015 if (failed)
9016 {
9017 // leave loop, goto error handling
9018 break;
9019 }
9020 else
9021 {
9022 if (an->Next() != NULL)
9023 {
9024 res->next = (leftv)omAllocBin(sleftv_bin);
9025 failed=iiExprArith1(res->next,an->next,op);
9026 }
9027 // everything ok, clean up and return
9028 an->CleanUp();
9030 return failed;
9031 }
9032 }
9033 }
9034 i++;
9035 }
9036 an->CleanUp();
9038 }
9039 // error handling
9040 if (!errorreported)
9041 {
9042 if ((at==0) && (a->Fullname()!=sNoName_fe))
9043 {
9044 Werror("`%s` is not defined",a->Fullname());
9045 }
9046 else
9047 {
9048 i=0;
9049 const char *s = iiTwoOps(op);
9050 Werror("%s(`%s`) failed"
9051 ,s,Tok2Cmdname(at));
9052 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9053 {
9054 while (dA1[i].cmd==op)
9055 {
9056 if ((dA1[i].res!=0)
9057 && (dA1[i].p!=jjWRONG))
9058 Werror("expected %s(`%s`)"
9059 ,s,Tok2Cmdname(dA1[i].arg));
9060 i++;
9061 }
9062 }
9063 }
9064 }
9065 res->rtyp = UNKNOWN;
9066 }
9067 a->CleanUp();
9068 return TRUE;
9069}
int BOOLEAN
Definition: auxiliary.h:87
void * ADDRESS
Definition: auxiliary.h:119
leftv next
Definition: subexpr.h:86
leftv Next()
Definition: subexpr.h:136
const char * Fullname()
Definition: subexpr.h:125
const CanonicalForm int s
Definition: facAbsFact.cc:51
const char sNoName_fe[]
Definition: fevoices.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
const char * iiTwoOps(int t)
Definition: gentable.cc:261
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3672
#define NO_CONVERSION
Definition: iparith.cc:120
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:9070
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9884
VAR int iiOp
Definition: iparith.cc:220
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:435
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:145
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:34
#define V_SHOW_USE
Definition: options.h:51
EXTERN_VAR int traceit
Definition: reporter.h:24
#define TRACE_CALL
Definition: reporter.h:44
sleftv * leftv
Definition: structs.h:57
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142
#define UNKNOWN
Definition: tok.h:222

◆ iiExprArith2()

BOOLEAN iiExprArith2 ( leftv  res,
leftv  a,
int  op,
leftv  b,
BOOLEAN  proccall 
)

Definition at line 8881 of file iparith.cc.

8882{
8883 res->Init();
8884
8885 if (!errorreported)
8886 {
8887#ifdef SIQ
8888 if (siq>0)
8889 {
8890 //Print("siq:%d\n",siq);
8892 memcpy(&d->arg1,a,sizeof(sleftv));
8893 a->Init();
8894 memcpy(&d->arg2,b,sizeof(sleftv));
8895 b->Init();
8896 d->argc=2;
8897 d->op=op;
8898 res->data=(char *)d;
8899 res->rtyp=COMMAND;
8900 return FALSE;
8901 }
8902#endif
8903 int at=a->Typ();
8904 int bt=b->Typ();
8905 // handling bb-objects ----------------------------------------------------
8906 if (at>MAX_TOK)
8907 {
8908 blackbox *bb=getBlackboxStuff(at);
8909 if (bb!=NULL)
8910 {
8911 if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8912 //else: no op defined, try the default
8913 }
8914 else
8915 return TRUE;
8916 }
8917 else if ((bt>MAX_TOK)&&(op!='('))
8918 {
8919 blackbox *bb=getBlackboxStuff(bt);
8920 if (bb!=NULL)
8921 {
8922 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8923 // else: no op defined
8924 }
8925 else
8926 return TRUE;
8927 }
8928 int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8929 return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8930 }
8931 a->CleanUp();
8932 b->CleanUp();
8933 return TRUE;
8934}
static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8708
const struct sValCmd2 dArith2[]
Definition: table.h:320

◆ iiExprArith2Tab()

BOOLEAN iiExprArith2Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd2 dA2,
int  at,
const struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to arguments a and a->next return TRUE on failure

Parameters
[out]respre-allocated result
[in]a2 arguments
[in]opoperation
[in]dA2table of possible proc assumes dA2[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 8867 of file iparith.cc.

8871{
8872 res->Init();
8873 leftv b=a->next;
8874 a->next=NULL;
8875 int bt=b->Typ();
8877 a->next=b;
8878 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8879 return bo;
8880}

◆ iiExprArith2TabIntern()

static BOOLEAN iiExprArith2TabIntern ( leftv  res,
leftv  a,
int  op,
leftv  b,
BOOLEAN  proccall,
const struct sValCmd2 dA2,
int  at,
int  bt,
const struct sConvertTypes dConvertTypes 
)
static

Definition at line 8708 of file iparith.cc.

8713{
8714 BOOLEAN call_failed=FALSE;
8715
8716 if (!errorreported)
8717 {
8718 int i=0;
8719 iiOp=op;
8720 while (dA2[i].cmd==op)
8721 {
8722 if ((at==dA2[i].arg1)
8723 && (bt==dA2[i].arg2))
8724 {
8725 res->rtyp=dA2[i].res;
8726 if (currRing!=NULL)
8727 {
8728 if (check_valid(dA2[i].valid_for,op)) break;
8729 }
8730 else
8731 {
8732 if (RingDependend(dA2[i].res))
8733 {
8734 WerrorS("no ring active (3)");
8735 break;
8736 }
8737 }
8738 if (traceit&TRACE_CALL)
8739 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
8740 if ((call_failed=dA2[i].p(res,a,b)))
8741 {
8742 break;// leave loop, goto error handling
8743 }
8744 a->CleanUp();
8745 b->CleanUp();
8746 //Print("op: %d,result typ:%d\n",op,res->rtyp);
8747 return FALSE;
8748 }
8749 i++;
8750 }
8751 // implicite type conversion ----------------------------------------------
8752 if (dA2[i].cmd!=op)
8753 {
8754 int ai,bi;
8757 BOOLEAN failed=FALSE;
8758 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8759 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
8760 while (dA2[i].cmd==op)
8761 {
8762 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8763 if ((dA2[i].valid_for & NO_CONVERSION)==0)
8764 {
8765 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
8766 {
8767 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
8768 {
8769 res->rtyp=dA2[i].res;
8770 if (currRing!=NULL)
8771 {
8772 if (check_valid(dA2[i].valid_for,op)) break;
8773 }
8774 else
8775 {
8776 if (RingDependend(dA2[i].res))
8777 {
8778 WerrorS("no ring active (4)");
8779 break;
8780 }
8781 }
8782 if (traceit&TRACE_CALL)
8783 Print("call %s(%s,%s)\n",iiTwoOps(op),
8784 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8785 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
8786 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
8787 || (call_failed=dA2[i].p(res,an,bn)));
8788 // everything done, clean up temp. variables
8789 if (failed)
8790 {
8791 // leave loop, goto error handling
8792 break;
8793 }
8794 else
8795 {
8796 // everything ok, clean up and return
8797 an->CleanUp();
8798 bn->CleanUp();
8801 return FALSE;
8802 }
8803 }
8804 }
8805 }
8806 i++;
8807 }
8808 an->CleanUp();
8809 bn->CleanUp();
8812 }
8813 // error handling ---------------------------------------------------
8814 const char *s=NULL;
8815 if (!errorreported)
8816 {
8817 if ((at==0) && (a->Fullname()!=sNoName_fe))
8818 {
8819 s=a->Fullname();
8820 }
8821 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8822 {
8823 s=b->Fullname();
8824 }
8825 if (s!=NULL)
8826 Werror("`%s` is not defined",s);
8827 else
8828 {
8829 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8830 s = iiTwoOps(op);
8831 if (proccall)
8832 {
8833 Werror("%s(`%s`,`%s`) failed"
8834 ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8835 }
8836 else
8837 {
8838 Werror("`%s` %s `%s` failed"
8839 ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8840 }
8841 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8842 {
8843 while (dA2[i].cmd==op)
8844 {
8845 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8846 && (dA2[i].res!=0)
8847 && (dA2[i].p!=jjWRONG2))
8848 {
8849 if (proccall)
8850 Werror("expected %s(`%s`,`%s`)"
8851 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8852 else
8853 Werror("expected `%s` %s `%s`"
8854 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8855 }
8856 i++;
8857 }
8858 }
8859 }
8860 }
8861 a->CleanUp();
8862 b->CleanUp();
8863 res->rtyp = UNKNOWN;
8864 }
8865 return TRUE;
8866}
#define jjWRONG2
Definition: iparith.cc:3670
short res
Definition: gentable.cc:73

◆ iiExprArith3()

BOOLEAN iiExprArith3 ( leftv  res,
int  op,
leftv  a,
leftv  b,
leftv  c 
)

Definition at line 9280 of file iparith.cc.

9281{
9282 res->Init();
9283
9284 if (!errorreported)
9285 {
9286#ifdef SIQ
9287 if (siq>0)
9288 {
9289 //Print("siq:%d\n",siq);
9291 memcpy(&d->arg1,a,sizeof(sleftv));
9292 a->Init();
9293 memcpy(&d->arg2,b,sizeof(sleftv));
9294 b->Init();
9295 memcpy(&d->arg3,c,sizeof(sleftv));
9296 c->Init();
9297 d->op=op;
9298 d->argc=3;
9299 res->data=(char *)d;
9300 res->rtyp=COMMAND;
9301 return FALSE;
9302 }
9303#endif
9304 int at=a->Typ();
9305 // handling bb-objects ----------------------------------------------
9306 if (at>MAX_TOK)
9307 {
9308 blackbox *bb=getBlackboxStuff(at);
9309 if (bb!=NULL)
9310 {
9311 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9312 // else: no op defined
9313 }
9314 else
9315 return TRUE;
9316 if (errorreported) return TRUE;
9317 }
9318 int bt=b->Typ();
9319 int ct=c->Typ();
9320
9321 iiOp=op;
9322 int i=0;
9323 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9324 return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9325 }
9326 a->CleanUp();
9327 b->CleanUp();
9328 c->CleanUp();
9329 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9330 return TRUE;
9331}
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:9127
const struct sValCmd3 dArith3[]
Definition: table.h:773

◆ iiExprArith3Tab()

BOOLEAN iiExprArith3Tab ( leftv  res,
leftv  a,
int  op,
const struct sValCmd3 dA3,
int  at,
const struct sConvertTypes dConvertTypes 
)

apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure

Parameters
[out]respre-allocated result
[in]a3 arguments
[in]opoperation
[in]dA3table of possible proc assumes dA3[0].cmd==op
[in]ata->Typ()
[in]dConvertTypestable of type conversions

Definition at line 9332 of file iparith.cc.

9336{
9337 res->Init();
9338 leftv b=a->next;
9339 a->next=NULL;
9340 int bt=b->Typ();
9341 leftv c=b->next;
9342 b->next=NULL;
9343 int ct=c->Typ();
9344 BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9345 b->next=c;
9346 a->next=b;
9347 a->CleanUp(); // to cleanup the chain, content already done
9348 return bo;
9349}

◆ iiExprArith3TabIntern()

static BOOLEAN iiExprArith3TabIntern ( leftv  res,
int  op,
leftv  a,
leftv  b,
leftv  c,
const struct sValCmd3 dA3,
int  at,
int  bt,
int  ct,
const struct sConvertTypes dConvertTypes 
)
static

Definition at line 9127 of file iparith.cc.

9130{
9131 BOOLEAN call_failed=FALSE;
9132
9133 assume(dA3[0].cmd==op);
9134
9135 if (!errorreported)
9136 {
9137 int i=0;
9138 iiOp=op;
9139 while (dA3[i].cmd==op)
9140 {
9141 if ((at==dA3[i].arg1)
9142 && (bt==dA3[i].arg2)
9143 && (ct==dA3[i].arg3))
9144 {
9145 res->rtyp=dA3[i].res;
9146 if (currRing!=NULL)
9147 {
9148 if (check_valid(dA3[i].valid_for,op)) break;
9149 }
9150 if (traceit&TRACE_CALL)
9151 Print("call %s(%s,%s,%s)\n",
9153 if ((call_failed=dA3[i].p(res,a,b,c)))
9154 {
9155 break;// leave loop, goto error handling
9156 }
9157 a->CleanUp();
9158 b->CleanUp();
9159 c->CleanUp();
9160 return FALSE;
9161 }
9162 i++;
9163 }
9164 // implicite type conversion ----------------------------------------------
9165 if (dA3[i].cmd!=op)
9166 {
9167 int ai,bi,ci;
9171 BOOLEAN failed=FALSE;
9172 i=0;
9173 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9174 while (dA3[i].cmd==op)
9175 {
9176 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9177 {
9178 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9179 {
9180 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9181 {
9182 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9183 {
9184 res->rtyp=dA3[i].res;
9185 if (currRing!=NULL)
9186 {
9187 if (check_valid(dA3[i].valid_for,op)) break;
9188 }
9189 if (traceit&TRACE_CALL)
9190 Print("call %s(%s,%s,%s)\n",
9191 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9192 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9193 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9194 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9195 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9196 || (call_failed=dA3[i].p(res,an,bn,cn)));
9197 // everything done, clean up temp. variables
9198 if (failed)
9199 {
9200 // leave loop, goto error handling
9201 break;
9202 }
9203 else
9204 {
9205 // everything ok, clean up and return
9206 an->CleanUp();
9207 bn->CleanUp();
9208 cn->CleanUp();
9212 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9213 return FALSE;
9214 }
9215 }
9216 }
9217 }
9218 }
9219 i++;
9220 }
9221 an->CleanUp();
9222 bn->CleanUp();
9223 cn->CleanUp();
9227 }
9228 // error handling ---------------------------------------------------
9229 if (!errorreported)
9230 {
9231 const char *s=NULL;
9232 if ((at==0) && (a->Fullname()!=sNoName_fe))
9233 {
9234 s=a->Fullname();
9235 }
9236 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9237 {
9238 s=b->Fullname();
9239 }
9240 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9241 {
9242 s=c->Fullname();
9243 }
9244 if (s!=NULL)
9245 Werror("`%s` is not defined",s);
9246 else
9247 {
9248 i=0;
9249 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9250 const char *s = iiTwoOps(op);
9251 Werror("%s(`%s`,`%s`,`%s`) failed"
9252 ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9253 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9254 {
9255 while (dA3[i].cmd==op)
9256 {
9257 if(((at==dA3[i].arg1)
9258 ||(bt==dA3[i].arg2)
9259 ||(ct==dA3[i].arg3))
9260 && (dA3[i].res!=0))
9261 {
9262 Werror("expected %s(`%s`,`%s`,`%s`)"
9263 ,s,Tok2Cmdname(dA3[i].arg1)
9264 ,Tok2Cmdname(dA3[i].arg2)
9265 ,Tok2Cmdname(dA3[i].arg3));
9266 }
9267 i++;
9268 }
9269 }
9270 }
9271 }
9272 res->rtyp = UNKNOWN;
9273 }
9274 a->CleanUp();
9275 b->CleanUp();
9276 c->CleanUp();
9277 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9278 return TRUE;
9279}
short res
Definition: gentable.cc:90

◆ iiExprArithM()

BOOLEAN iiExprArithM ( leftv  res,
leftv  a,
int  op 
)

Definition at line 9371 of file iparith.cc.

9372{
9373 res->Init();
9374
9375 if (!errorreported)
9376 {
9377#ifdef SIQ
9378 if (siq>0)
9379 {
9380 //Print("siq:%d\n",siq);
9382 d->op=op;
9383 res->data=(char *)d;
9384 if (a!=NULL)
9385 {
9386 d->argc=a->listLength();
9387 // else : d->argc=0;
9388 memcpy(&d->arg1,a,sizeof(sleftv));
9389 switch(d->argc)
9390 {
9391 case 3:
9392 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9393 a->next->next->Init();
9394 /* no break */
9395 case 2:
9396 memcpy(&d->arg2,a->next,sizeof(sleftv));
9397 a->next->Init();
9398 a->next->next=d->arg2.next;
9399 d->arg2.next=NULL;
9400 /* no break */
9401 case 1:
9402 a->Init();
9403 a->next=d->arg1.next;
9404 d->arg1.next=NULL;
9405 }
9406 if (d->argc>3) a->next=NULL;
9407 a->name=NULL;
9408 a->rtyp=0;
9409 a->data=NULL;
9410 a->e=NULL;
9411 a->attribute=NULL;
9412 a->CleanUp();
9413 }
9414 res->rtyp=COMMAND;
9415 return FALSE;
9416 }
9417#endif
9418 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9419 {
9420 blackbox *bb=getBlackboxStuff(a->Typ());
9421 if (bb!=NULL)
9422 {
9423 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9424 // else: no op defined
9425 }
9426 else
9427 return TRUE;
9428 if (errorreported) return TRUE;
9429 }
9430 int args=0;
9431 if (a!=NULL) args=a->listLength();
9432
9433 iiOp=op;
9434 int i=0;
9435 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9436 while (dArithM[i].cmd==op)
9437 {
9438 if ((args==dArithM[i].number_of_args)
9439 || (dArithM[i].number_of_args==-1)
9440 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9441 {
9442 res->rtyp=dArithM[i].res;
9443 if (currRing!=NULL)
9444 {
9445 if (check_valid(dArithM[i].valid_for,op)) break;
9446 }
9447 if (traceit&TRACE_CALL)
9448 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9449 if (dArithM[i].p(res,a))
9450 {
9451 break;// leave loop, goto error handling
9452 }
9453 if (a!=NULL) a->CleanUp();
9454 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9455 return FALSE;
9456 }
9457 i++;
9458 }
9459 // error handling
9460 if (!errorreported)
9461 {
9462 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9463 {
9464 Werror("`%s` is not defined",a->Fullname());
9465 }
9466 else
9467 {
9468 const char *s = iiTwoOps(op);
9469 Werror("%s(...) failed",s);
9470 }
9471 }
9472 res->rtyp = UNKNOWN;
9473 }
9474 if (a!=NULL) a->CleanUp();
9475 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9476 return TRUE;
9477}
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
const char * Name()
Definition: subexpr.h:120
int listLength()
Definition: subexpr.cc:51
void * data
Definition: subexpr.h:88
Subexpr e
Definition: subexpr.h:105
attr attribute
Definition: subexpr.h:89
short res
Definition: gentable.cc:100
const struct sValCmdM dArithM[]
Definition: table.h:904

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9695 of file iparith.cc.

9696{
9697 //printf("iiInitArithmetic()\n");
9698 memset(&sArithBase, 0, sizeof(sArithBase));
9699 iiInitCmdName();
9700 /* fix last-identifier */
9701#if 0
9702 /* we expect that gentable allready did every thing */
9705 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9706 }
9707#endif
9708 //Print("L=%d\n", sArithBase.nLastIdentifier);
9709
9710 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9711 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9712
9713 //iiArithAddCmd("Top", 0,-1,0);
9714
9715
9716 //for(i=0; i<sArithBase.nCmdUsed; i++) {
9717 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9718 // sArithBase.sCmds[i].name,
9719 // sArithBase.sCmds[i].alias,
9720 // sArithBase.sCmds[i].tokval,
9721 // sArithBase.sCmds[i].toktype);
9722 //}
9723 //iiArithRemoveCmd("Top");
9724 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9725 //iiArithRemoveCmd("mygcd");
9726 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9727 return 0;
9728}

◆ iin_Int()

static int iin_Int ( number &  n,
coeffs  cf 
)
static

Definition at line 223 of file iparith.cc.

224{
225 long l=n_Int(n,cf);
226 int i=(int)l;
227 if ((long)i==l) return l;
228 return 0;
229}
int l
Definition: cfEzgcd.cc:100
CanonicalForm cf
Definition: cfModGcd.cc:4083
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:547

◆ iiTabIndex()

static int iiTabIndex ( const jjValCmdTab  dArithTab,
const int  len,
const int  op 
)
static

Definition at line 9579 of file iparith.cc.

9580{
9581 // user defined types are not in the pre-computed table:
9582 if (op>MAX_TOK) return 0;
9583
9584 int a=0;
9585 int e=len;
9586 int p=len/2;
9587 do
9588 {
9589 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9590 if (op<dArithTab[p].cmd) e=p-1;
9591 else a = p+1;
9592 p=a+(e-a)/2;
9593 }
9594 while ( a <= e);
9595
9596 // catch missing a cmd:
9597 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9598 // Print("op %d (%c) unknown",op,op);
9599 return 0;
9600}

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 235 of file iparith.cc.

236{
237 for (unsigned i=0;i<sArithBase.nCmdUsed;i++)
238 {
239 if (sArithBase.sCmds[i].tokval==op)
240 return sArithBase.sCmds[i].toktype;
241 }
242 return 0;
243}

◆ IsCmd()

int IsCmd ( const char *  n,
int &  tok 
)

Definition at line 9480 of file iparith.cc.

9481{
9482 int i;
9483 int an=1;
9485
9486 loop
9487 //for(an=0; an<sArithBase.nCmdUsed; )
9488 {
9489 if(an>=en-1)
9490 {
9491 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9492 {
9493 i=an;
9494 break;
9495 }
9496 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9497 {
9498 i=en;
9499 break;
9500 }
9501 else
9502 {
9503 // -- blackbox extensions:
9504 // return 0;
9505 return blackboxIsCmd(n,tok);
9506 }
9507 }
9508 i=(an+en)/2;
9509 if (*n < *(sArithBase.sCmds[i].name))
9510 {
9511 en=i-1;
9512 }
9513 else if (*n > *(sArithBase.sCmds[i].name))
9514 {
9515 an=i+1;
9516 }
9517 else
9518 {
9519 int v=strcmp(n,sArithBase.sCmds[i].name);
9520 if(v<0)
9521 {
9522 en=i-1;
9523 }
9524 else if(v>0)
9525 {
9526 an=i+1;
9527 }
9528 else /*v==0*/
9529 {
9530 break;
9531 }
9532 }
9533 }
9535 tok=sArithBase.sCmds[i].tokval;
9536 if(sArithBase.sCmds[i].alias==2)
9537 {
9538 Warn("outdated identifier `%s` used - please change your code",
9539 sArithBase.sCmds[i].name);
9540 sArithBase.sCmds[i].alias=1;
9541 }
9542 #if 0
9543 if (currRingHdl==NULL)
9544 {
9545 #ifdef SIQ
9546 if (siq<=0)
9547 {
9548 #endif
9549 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9550 {
9551 WerrorS("no ring active");
9552 return 0;
9553 }
9554 #ifdef SIQ
9555 }
9556 #endif
9557 }
9558 #endif
9559 if (!expected_parms)
9560 {
9561 switch (tok)
9562 {
9563 case IDEAL_CMD:
9564 case INT_CMD:
9565 case INTVEC_CMD:
9566 case MAP_CMD:
9567 case MATRIX_CMD:
9568 case MODUL_CMD:
9569 case POLY_CMD:
9570 case PROC_CMD:
9571 case RING_CMD:
9572 case STRING_CMD:
9573 cmdtok = tok;
9574 break;
9575 }
9576 }
9577 return sArithBase.sCmds[i].toktype;
9578}
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:218
@ END_RING
Definition: grammar.cc:310
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ MAP_CMD
Definition: grammar.cc:285
@ PROC_CMD
Definition: grammar.cc:280
@ BEGIN_RING
Definition: grammar.cc:282
@ MODUL_CMD
Definition: grammar.cc:287
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
EXTERN_VAR BOOLEAN expected_parms
Definition: iparith.cc:216
EXTERN_VAR int cmdtok
Definition: iparith.cc:215
VAR idhdl currRingHdl
Definition: ipid.cc:59
const char * lastreserved
Definition: ipshell.cc:82
@ INTVEC_CMD
Definition: tok.h:101
@ STRING_CMD
Definition: tok.h:185
@ INT_CMD
Definition: tok.h:96

◆ jjALIGN_M()

static BOOLEAN jjALIGN_M ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1781 of file iparith.cc.

1782{
1783 ideal M=(ideal)u->CopyD();
1784 int s=(int)(long)v->Data();
1785 for(int i=IDELEMS(M)-1; i>=0;i--)
1786 {
1787 if (s+p_MinComp(M->m[i],currRing)<=0)
1788 { id_Delete(&M,currRing);return TRUE;}
1789 }
1791 res->data=M;
1792 return FALSE;
1793}
void * CopyD(int t)
Definition: subexpr.cc:710
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:313
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void id_Shift(ideal M, int s, const ring r)
#define IDELEMS(i)
Definition: simpleideals.h:23
#define M
Definition: sirandom.c:25

◆ jjALIGN_V()

static BOOLEAN jjALIGN_V ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1771 of file iparith.cc.

1772{
1773 poly p=(poly)u->CopyD();
1774 int s=(int)(long)v->Data();
1775 if (s+p_MinComp(p,currRing)<=0)
1776 { p_Delete(&p,currRing);return TRUE;}
1777 p_Shift(&p,s,currRing);
1778 res->data=p;
1779 return FALSE;
1780}
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4771
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:901

◆ jjAND_I()

static BOOLEAN jjAND_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1382 of file iparith.cc.

1383{
1384 res->data = (char *)((long)u->Data() && (long)v->Data());
1385 return FALSE;
1386}
void * Data()
Definition: subexpr.cc:1154

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3783 of file iparith.cc.

3784{
3785 //matrix m=(matrix)v->Data();
3786 //lists l=mpBareiss(m,FALSE);
3787 intvec *iv;
3788 ideal m;
3789 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3791 l->Init(2);
3792 l->m[0].rtyp=MODUL_CMD;
3793 l->m[1].rtyp=INTVEC_CMD;
3794 l->m[0].data=(void *)m;
3795 l->m[1].data=(void *)iv;
3796 res->data = (char *)l;
3797 return FALSE;
3798}
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
Definition: lists.h:24
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition: sparsmat.cc:347

◆ jjBAREISS3()

static BOOLEAN jjBAREISS3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5981 of file iparith.cc.

5982{
5983 intvec *iv;
5984 ideal m;
5986 int k=(int)(long)w->Data();
5987 if (k>=0)
5988 {
5989 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
5990 l->Init(2);
5991 l->m[0].rtyp=MODUL_CMD;
5992 l->m[1].rtyp=INTVEC_CMD;
5993 l->m[0].data=(void *)m;
5994 l->m[1].data=(void *)iv;
5995 }
5996 else
5997 {
5998 m=sm_CallSolv((ideal)u->Data(), currRing);
5999 l->Init(1);
6000 l->m[0].rtyp=IDEAL_CMD;
6001 l->m[0].data=(void *)m;
6002 }
6003 res->data = (char *)l;
6004 return FALSE;
6005}
int k
Definition: cfEzgcd.cc:99
const CanonicalForm & w
Definition: facAbsFact.cc:51
ideal sm_CallSolv(ideal I, const ring R)
Definition: sparsmat.cc:2316

◆ jjBAREISS_BIM()

static BOOLEAN jjBAREISS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3806 of file iparith.cc.

3807{
3808 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3809 b->hnf();
3810 res->data=(char*)b;
3811 return FALSE;
3812}
Matrices of numbers.
Definition: bigintmat.h:51
@ BIGINTMAT_CMD
Definition: grammar.cc:278

◆ jjBI2IM()

static BOOLEAN jjBI2IM ( leftv  res,
leftv  u 
)
static

Definition at line 3828 of file iparith.cc.

3829{
3830 bigintmat *b=(bigintmat*)u->Data();
3831 res->data=(void *)bim2iv(b);
3832 return FALSE;
3833}
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3813 of file iparith.cc.

3814{
3815 BOOLEAN bo=FALSE;
3816 number n=(number)u->CopyD();
3818 if (nMap!=NULL)
3819 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3820 else
3821 {
3822 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3823 bo=TRUE;
3824 }
3826 return bo;
3827}
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:700
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:963
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3834 of file iparith.cc.

3835{
3836 sleftv tmp;
3837 BOOLEAN bo=jjBI2N(&tmp,u);
3838 if (!bo)
3839 {
3840 number n=(number) tmp.data;
3841 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3842 else
3843 {
3844 res->data=(void *)pNSet(n);
3845 }
3846 }
3847 return bo;
3848}
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3813
if(yy_init)
Definition: libparse.cc:1420
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define pNSet(n)
Definition: polys.h:313

◆ jjBRACK_Bim()

static BOOLEAN jjBRACK_Bim ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5726 of file iparith.cc.

5727{
5728 bigintmat *bim = (bigintmat *)u->Data();
5729 int r = (int)(long)v->Data();
5730 int c = (int)(long)w->Data();
5731 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5732 {
5733 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5734 r,c,u->Fullname(),bim->rows(),bim->cols());
5735 return TRUE;
5736 }
5737 res->data=u->data; u->data=NULL;
5738 res->rtyp=u->rtyp; u->rtyp=0;
5739 res->name=u->name; u->name=NULL;
5740 Subexpr e=jjMakeSub(v);
5741 e->next=jjMakeSub(w);
5742 if (u->e==NULL)
5743 res->e=e;
5744 else
5745 {
5746 Subexpr h=u->e;
5747 while (h->next!=NULL) h=h->next;
5748 h->next=e;
5749 res->e=u->e;
5750 u->e=NULL;
5751 }
5752 return FALSE;
5753}
int cols() const
Definition: bigintmat.h:144
int rows() const
Definition: bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:8675
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ jjBRACK_Im()

static BOOLEAN jjBRACK_Im ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5699 of file iparith.cc.

5700{
5701 intvec *iv = (intvec *)u->Data();
5702 int r = (int)(long)v->Data();
5703 int c = (int)(long)w->Data();
5704 if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5705 {
5706 Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5707 r,c,u->Fullname(),iv->rows(),iv->cols());
5708 return TRUE;
5709 }
5710 res->data=u->data; u->data=NULL;
5711 res->rtyp=u->rtyp; u->rtyp=0;
5712 res->name=u->name; u->name=NULL;
5713 Subexpr e=jjMakeSub(v);
5714 e->next=jjMakeSub(w);
5715 if (u->e==NULL) res->e=e;
5716 else
5717 {
5718 Subexpr h=u->e;
5719 while (h->next!=NULL) h=h->next;
5720 h->next=e;
5721 res->e=u->e;
5722 u->e=NULL;
5723 }
5724 return FALSE;
5725}
int cols() const
Definition: intvec.h:95
int rows() const
Definition: intvec.h:96

◆ jjBRACK_Ma()

static BOOLEAN jjBRACK_Ma ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5754 of file iparith.cc.

5755{
5756 matrix m= (matrix)u->Data();
5757 int r = (int)(long)v->Data();
5758 int c = (int)(long)w->Data();
5759 //Print("gen. elem %d, %d\n",r,c);
5760 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5761 {
5762 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5763 MATROWS(m),MATCOLS(m));
5764 return TRUE;
5765 }
5766 res->data=u->data; u->data=NULL;
5767 res->rtyp=u->rtyp; u->rtyp=0;
5768 res->name=u->name; u->name=NULL;
5769 Subexpr e=jjMakeSub(v);
5770 e->next=jjMakeSub(w);
5771 if (u->e==NULL)
5772 res->e=e;
5773 else
5774 {
5775 Subexpr h=u->e;
5776 while (h->next!=NULL) h=h->next;
5777 h->next=e;
5778 res->e=u->e;
5779 u->e=NULL;
5780 }
5781 return FALSE;
5782}
ip_smatrix * matrix
Definition: matpol.h:43
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27

◆ jjBRACK_Ma_I_IV()

static BOOLEAN jjBRACK_Ma_I_IV ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5812 of file iparith.cc.

5813{
5814 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5815 {
5816 WerrorS("cannot build expression lists from unnamed objects");
5817 return TRUE;
5818 }
5819
5820 leftv p=NULL;
5821 intvec *iv=(intvec *)w->Data();
5822 int l;
5823 BOOLEAN nok;
5824 sleftv ut;
5825 memcpy(&ut,u,sizeof(ut));
5826 sleftv t;
5827 t.Init();
5828 t.rtyp=INT_CMD;
5829 for (l=0;l< iv->length(); l++)
5830 {
5831 t.data=(char *)(long)((*iv)[l]);
5832 if (p==NULL)
5833 {
5834 p=res;
5835 }
5836 else
5837 {
5838 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5839 p=p->next;
5840 }
5841 memcpy(u,&ut,sizeof(ut));
5842 if (u->Typ() == MATRIX_CMD)
5843 nok=jjBRACK_Ma(p,u,v,&t);
5844 else if (u->Typ() == BIGINTMAT_CMD)
5845 nok=jjBRACK_Bim(p,u,v,&t);
5846 else /* INTMAT_CMD */
5847 nok=jjBRACK_Im(p,u,v,&t);
5848 if (nok)
5849 {
5850 while (res->next!=NULL)
5851 {
5852 p=res->next->next;
5854 // res->e aufraeumen !!!!
5855 res->next=p;
5856 }
5857 return TRUE;
5858 }
5859 }
5860 return FALSE;
5861}
int length() const
Definition: intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5726
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5699
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5754
#define IDHDL
Definition: tok.h:31

◆ jjBRACK_Ma_IV_I()

static BOOLEAN jjBRACK_Ma_IV_I ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5862 of file iparith.cc.

5863{
5864 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5865 {
5866 WerrorS("cannot build expression lists from unnamed objects");
5867 return TRUE;
5868 }
5869 leftv p=NULL;
5870 intvec *iv=(intvec *)v->Data();
5871 int l;
5872 BOOLEAN nok;
5873 sleftv ut;
5874 memcpy(&ut,u,sizeof(ut));
5875 sleftv t;
5876 t.Init();
5877 t.rtyp=INT_CMD;
5878 for (l=0;l< iv->length(); l++)
5879 {
5880 t.data=(char *)(long)((*iv)[l]);
5881 if (p==NULL)
5882 {
5883 p=res;
5884 }
5885 else
5886 {
5887 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5888 p=p->next;
5889 }
5890 memcpy(u,&ut,sizeof(ut));
5891 if (u->Typ() == MATRIX_CMD)
5892 nok=jjBRACK_Ma(p,u,&t,w);
5893 else if (u->Typ() == BIGINTMAT_CMD)
5894 nok=jjBRACK_Bim(p,u,&t,w);
5895 else /* INTMAT_CMD */
5896 nok=jjBRACK_Im(p,u,&t,w);
5897 if (nok)
5898 {
5899 while (res->next!=NULL)
5900 {
5901 p=res->next->next;
5903 // res->e aufraeumen !!
5904 res->next=p;
5905 }
5906 return TRUE;
5907 }
5908 }
5909 return FALSE;
5910}

◆ jjBRACK_Ma_IV_IV()

static BOOLEAN jjBRACK_Ma_IV_IV ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5911 of file iparith.cc.

5912{
5913 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5914 {
5915 WerrorS("cannot build expression lists from unnamed objects");
5916 return TRUE;
5917 }
5918 leftv p=NULL;
5919 intvec *vv=(intvec *)v->Data();
5920 intvec *wv=(intvec *)w->Data();
5921 int vl;
5922 int wl;
5923 BOOLEAN nok;
5924
5925 sleftv t1,t2,ut;
5926 memcpy(&ut,u,sizeof(ut));
5927 t1.Init();
5928 t1.rtyp=INT_CMD;
5929 t2.Init();
5930 t2.rtyp=INT_CMD;
5931 for (vl=0;vl< vv->length(); vl++)
5932 {
5933 t1.data=(char *)(long)((*vv)[vl]);
5934 for (wl=0;wl< wv->length(); wl++)
5935 {
5936 t2.data=(char *)(long)((*wv)[wl]);
5937 if (p==NULL)
5938 {
5939 p=res;
5940 }
5941 else
5942 {
5943 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5944 p=p->next;
5945 }
5946 memcpy(u,&ut,sizeof(ut));
5947 if (u->Typ() == MATRIX_CMD)
5948 nok=jjBRACK_Ma(p,u,&t1,&t2);
5949 else if (u->Typ() == BIGINTMAT_CMD)
5950 nok=jjBRACK_Bim(p,u,&t1,&t2);
5951 else /* INTMAT_CMD */
5952 nok=jjBRACK_Im(p,u,&t1,&t2);
5953 if (nok)
5954 {
5955 res->CleanUp();
5956 return TRUE;
5957 }
5958 }
5959 }
5960 return FALSE;
5961}

◆ jjBRACK_S()

static BOOLEAN jjBRACK_S ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5683 of file iparith.cc.

5684{
5685 char *s= (char *)u->Data();
5686 int r = (int)(long)v->Data();
5687 int c = (int)(long)w->Data();
5688 int l = strlen(s);
5689
5690 if ( (r<1) || (r>l) || (c<0) )
5691 {
5692 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5693 return TRUE;
5694 }
5695 res->data = (char *)omAlloc((long)(c+1));
5696 sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5697 return FALSE;
5698}
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ jjBRACK_SM()

static BOOLEAN jjBRACK_SM ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5783 of file iparith.cc.

5784{
5785 ideal m= (ideal)u->Data();
5786 int r = (int)(long)v->Data();
5787 int c = (int)(long)w->Data();
5788 //Print("gen. elem %d, %d\n",r,c);
5789 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5790 {
5791 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5792 (int)m->rank,IDELEMS(m));
5793 return TRUE;
5794 }
5795 res->data=u->data; u->data=NULL;
5796 res->rtyp=u->rtyp; u->rtyp=0;
5797 res->name=u->name; u->name=NULL;
5798 Subexpr e=jjMakeSub(v);
5799 e->next=jjMakeSub(w);
5800 if (u->e==NULL)
5801 res->e=e;
5802 else
5803 {
5804 Subexpr h=u->e;
5805 while (h->next!=NULL) h=h->next;
5806 h->next=e;
5807 res->e=u->e;
5808 u->e=NULL;
5809 }
5810 return FALSE;
5811}

◆ jjBRACKET()

static BOOLEAN jjBRACKET ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2884 of file iparith.cc.

2885{
2886 res->data=NULL;
2887
2889 {
2890 const poly q = (poly)b->Data();
2891
2892 if( q != NULL )
2893 {
2894 if( (poly)a->Data() != NULL )
2895 {
2897 {
2898 poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2899 res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2900 }
2901 else if (rIsLPRing(currRing))
2902 {
2903 const poly p = (poly)a->Data();
2904 res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2905 }
2906 }
2907 }
2908 }
2909 return FALSE;
2910}
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
#define pAdd(p, q)
Definition: polys.h:203
#define pNeg(p)
Definition: polys.h:198
#define ppMult_qq(p, q)
Definition: polys.h:208

◆ jjBRACKET_REC()

static BOOLEAN jjBRACKET_REC ( leftv  res,
leftv  a,
leftv  b,
leftv  c 
)
static

Definition at line 2911 of file iparith.cc.

2912{
2913 res->data=NULL;
2914
2916 {
2917 const poly q = (poly)b->Data();
2918 if(q != NULL)
2919 {
2920 if((poly)a->Data() != NULL)
2921 {
2922 const poly p = (poly)a->Data();
2923 int k=(int)(long)c->Data();
2924 if (k > 0)
2925 {
2926 poly qq = pCopy(q);
2927 for (int i = 0; i < k; i++)
2928 {
2929 poly qq_ref = qq;
2930 if (rIsLPRing(currRing))
2931 {
2932 qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
2933 }
2934 else if (rIsPluralRing(currRing))
2935 {
2936 qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
2937 }
2938 pDelete(&qq_ref);
2939 if (qq == NULL) break;
2940 }
2941 res->data = qq;
2942 }
2943 else
2944 {
2945 Werror("invalid number of iterations");
2946 }
2947 }
2948 }
2949 }
2950 return FALSE;
2951}
#define pDelete(p_ptr)
Definition: polys.h:186
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 7097 of file iparith.cc.

7098{
7099#ifdef HAVE_SDB
7100 sdb_show_bp();
7101#endif
7102 return FALSE;
7103}
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7104 of file iparith.cc.

7105{
7106#ifdef HAVE_SDB
7107 if(v->Typ()==PROC_CMD)
7108 {
7109 int lineno=0;
7110 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7111 {
7112 lineno=(int)(long)v->next->Data();
7113 }
7114 return sdb_set_breakpoint(v->Name(),lineno);
7115 }
7116 return TRUE;
7117#else
7118 return FALSE;
7119#endif
7120}
Variable next() const
Definition: variable.h:52
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
Definition: sdb.cc:64

◆ jjCALL1ARG()

static BOOLEAN jjCALL1ARG ( leftv  res,
leftv  v 
)
static

Definition at line 7121 of file iparith.cc.

7122{
7123 return iiExprArith1(res,v,iiOp);
7124}

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3849 of file iparith.cc.

3850{
3851 return iiExprArithM(res,u,iiOp);
3852}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:9371

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7125 of file iparith.cc.

7126{
7127 leftv v=u->next;
7128 u->next=NULL;
7129 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7130 u->next=v;
7131 return b;
7132}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8881

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7133 of file iparith.cc.

7134{
7135 leftv v = u->next;
7136 leftv w = v->next;
7137 u->next = NULL;
7138 v->next = NULL;
7139 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7140 u->next = v;
7141 v->next = w;
7142 return b;
7143}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:9280

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3853 of file iparith.cc.

3854{
3855 res->data = (char *)(long)rChar((ring)v->Data());
3856 return FALSE;
3857}
int rChar(ring r)
Definition: ring.cc:713

◆ jjCHINREM_BI()

static BOOLEAN jjCHINREM_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1684 of file iparith.cc.

1685{
1686 intvec *c=(intvec*)u->Data();
1687 intvec* p=(intvec*)v->Data();
1688 int rl=p->length();
1689 number *x=(number *)omAlloc(rl*sizeof(number));
1690 number *q=(number *)omAlloc(rl*sizeof(number));
1691 int i;
1692 for(i=rl-1;i>=0;i--)
1693 {
1694 q[i]=n_Init((*p)[i], coeffs_BIGINT);
1695 x[i]=n_Init((*c)[i], coeffs_BIGINT);
1696 }
1697 CFArray iv(rl);
1698 number n=n_ChineseRemainderSym(x,q,rl,FALSE,iv,coeffs_BIGINT);
1699 for(i=rl-1;i>=0;i--)
1700 {
1701 n_Delete(&(q[i]),coeffs_BIGINT);
1703 }
1704 omFree(x); omFree(q);
1705 res->data=(char *)n;
1706 return FALSE;
1707}
Variable x
Definition: cfModGcd.cc:4082
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:764
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ jjCHINREM_ID()

static BOOLEAN jjCHINREM_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 9931 of file iparith.cc.

9932{
9933 if ((currRing!=NULL)
9935 && (!rField_is_Z(currRing)))
9936 {
9937 WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
9938 return TRUE;
9939 }
9940 coeffs cf;
9941 lists c=(lists)u->CopyD(); // list of ideal or bigint/int
9942 int rl=c->nr+1;
9943 int return_type=c->m[0].Typ();
9944 if ((return_type!=IDEAL_CMD)
9945 && (return_type!=MODUL_CMD)
9946 && (return_type!=SMATRIX_CMD)
9947 && (return_type!=MATRIX_CMD)
9948 && (return_type!=POLY_CMD))
9949 {
9950 if((return_type==BIGINT_CMD)
9951 ||(return_type==INT_CMD))
9952 return_type=BIGINT_CMD;
9953 else if (return_type==LIST_CMD)
9954 {
9955 // create a tmp list of the correct size
9957 res_l->Init(rl /*c->nr+1*/);
9958 BOOLEAN bo=FALSE;
9959 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
9960 for (unsigned i=0;i<=(unsigned)c->nr;i++)
9961 {
9962 sleftv tmp;
9963 tmp.Copy(v);
9964 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9965 if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
9966 }
9967 c->Clean();
9968 res->data=res_l;
9969 res->rtyp=LIST_CMD;
9970 return bo;
9971 }
9972 else
9973 {
9974 c->Clean();
9975 WerrorS("poly/ideal/module/matrix/list expected");
9976 return TRUE;
9977 }
9978 }
9979 if (return_type==BIGINT_CMD)
9981 else
9982 {
9983 cf=currRing->cf;
9984 if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
9985 cf=cf->extRing->cf;
9986 }
9987 lists pl=NULL;
9988 intvec *p=NULL;
9989 if (v->Typ()==LIST_CMD)
9990 {
9991 pl=(lists)v->Data();
9992 if (pl->nr!=rl-1)
9993 {
9994 WerrorS("wromg number of primes");
9995 return TRUE;
9996 }
9997 }
9998 else
9999 {
10000 p=(intvec*)v->Data();
10001 if (p->length()!=rl)
10002 {
10003 WerrorS("wromg number of primes");
10004 return TRUE;
10005 }
10006 }
10007 ideal result;
10008 ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
10009 number *xx=NULL;
10011 int i;
10012 if (return_type!=BIGINT_CMD)
10013 {
10014 for(i=rl-1;i>=0;i--)
10015 {
10016 if (c->m[i].Typ()!=return_type)
10017 {
10018 Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
10019 omFree(x); // delete c
10020 return TRUE;
10021 }
10022 if (return_type==POLY_CMD)
10023 {
10024 x[i]=idInit(1,1);
10025 x[i]->m[0]=(poly)c->m[i].CopyD();
10026 }
10027 else
10028 {
10029 x[i]=(ideal)c->m[i].CopyD();
10030 }
10031 //c->m[i].Init();
10032 }
10033 }
10034 else
10035 {
10036 if (nMap==NULL)
10037 {
10038 Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10039 return TRUE;
10040 }
10041 xx=(number *)omAlloc(rl*sizeof(number));
10042 for(i=rl-1;i>=0;i--)
10043 {
10044 if (c->m[i].Typ()==INT_CMD)
10045 {
10046 xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10047 }
10048 else if (c->m[i].Typ()==BIGINT_CMD)
10049 {
10050 xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10051 }
10052 else
10053 {
10054 Werror("bigint expected at pos %d",i+1);
10055 omFree(x); // delete c
10056 omFree(xx); // delete c
10057 return TRUE;
10058 }
10059 }
10060 }
10061 number *q=(number *)omAlloc(rl*sizeof(number));
10062 if (p!=NULL)
10063 {
10064 for(i=rl-1;i>=0;i--)
10065 {
10066 q[i]=n_Init((*p)[i], cf);
10067 }
10068 }
10069 else
10070 {
10071 for(i=rl-1;i>=0;i--)
10072 {
10073 if (pl->m[i].Typ()==INT_CMD)
10074 {
10075 q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10076 }
10077 else if (pl->m[i].Typ()==BIGINT_CMD)
10078 {
10079 q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10080 }
10081 else
10082 {
10083 Werror("bigint expected at pos %d",i+1);
10084 for(i++;i<rl;i++)
10085 {
10086 n_Delete(&(q[i]),cf);
10087 }
10088 omFree(x); // delete c
10089 omFree(q); // delete pl
10090 if (xx!=NULL) omFree(xx); // delete c
10091 return TRUE;
10092 }
10093 }
10094 }
10095 if (return_type==BIGINT_CMD)
10096 {
10097 CFArray i_v(rl);
10098 number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
10099 res->data=(char *)n;
10100 }
10101 else
10102 {
10103 #if 0
10104 #ifdef HAVE_VSPACE
10105 int cpus = (long) feOptValue(FE_OPT_CPUS);
10106 if ((cpus>1) && (rField_is_Q(currRing)))
10107 result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10108 else
10109 #endif
10110 #endif
10111 result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10112 c->Clean();
10113 if ((return_type==POLY_CMD) &&(result!=NULL))
10114 {
10115 res->data=(char *)result->m[0];
10116 result->m[0]=NULL;
10117 idDelete(&result);
10118 }
10119 else
10120 res->data=(char *)result;
10121 }
10122 for(i=rl-1;i>=0;i--)
10123 {
10124 n_Delete(&(q[i]),cf);
10125 }
10126 omFree(q);
10127 res->rtyp=return_type;
10128 return result==NULL;
10129}
void Copy(leftv e)
Definition: subexpr.cc:685
sleftv * m
Definition: lists.h:46
void Clean(ring r=currRing)
Definition: lists.h:26
INLINE_THIS void Init(int l=0)
int nr
Definition: lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:846
return result
Definition: facAbsBiFact.cc:75
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
@ SMATRIX_CMD
Definition: grammar.cc:291
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
Definition: kChinese.cc:196
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:510
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:507
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
@ BIGINT_CMD
Definition: tok.h:38
@ LIST_CMD
Definition: tok.h:118
@ CHINREM_CMD
Definition: tok.h:45

◆ jjCOEF()

static BOOLEAN jjCOEF ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1795 of file iparith.cc.

1796{
1797 poly p=(poly)v->Data();
1798 if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1799 res->data=(char *)mp_CoeffProc((poly)u->Data(),p /*(poly)v->Data()*/,currRing);
1800 return FALSE;
1801}
matrix mp_CoeffProc(poly f, poly vars, const ring R)
Definition: matpol.cc:399
#define pNext(p)
Definition: monomials.h:36

◆ jjCOEF_Id()

static BOOLEAN jjCOEF_Id ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1802 of file iparith.cc.

1803{
1804 poly p=(poly)v->Data();
1805 if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1806 res->data=(char *)mp_CoeffProcId((ideal)u->Data(),p /*(poly)v->Data()*/,currRing);
1807 return FALSE;
1808}
matrix mp_CoeffProcId(ideal I, poly vars, const ring R)
Definition: matpol.cc:476

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 7145 of file iparith.cc.

7146{
7147 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7148 if (iiCheckTypes(v,t,1))
7149 {
7150 idhdl c=(idhdl)v->next->next->data;
7151 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7152 idhdl m=(idhdl)v->next->next->next->data;
7153 idDelete((ideal *)&(c->data.uideal));
7154 idDelete((ideal *)&(m->data.uideal));
7155 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7156 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7157 return FALSE;
7158 }
7159 return TRUE;
7160}
Definition: idrec.h:35
utypes data
Definition: idrec.h:40
@ VECTOR_CMD
Definition: grammar.cc:292
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6566
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition: matpol.cc:581
idrec * idhdl
Definition: ring.h:21

◆ jjCOEFFS2_KB()

static BOOLEAN jjCOEFFS2_KB ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1820 of file iparith.cc.

1821{
1822 poly p = pInit();
1823 int i;
1824 for (i=1; i<=currRing->N; i++)
1825 {
1826 pSetExp(p, i, 1);
1827 }
1828 pSetm(p);
1829 res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1830 (ideal)(v->Data()), p);
1831 pLmFree(&p);
1832 return FALSE;
1833}
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2625
#define pSetm(p)
Definition: polys.h:271
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:70
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pSetExp(p, i, v)
Definition: polys.h:42

◆ jjCOEFFS3_Id()

static BOOLEAN jjCOEFFS3_Id ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6006 of file iparith.cc.

6007{
6008 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6009 {
6010 WerrorS("3rd argument must be a name of a matrix");
6011 return TRUE;
6012 }
6013 ideal i=(ideal)u->Data();
6014 int rank=(int)i->rank;
6015 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6016 if (r) return TRUE;
6017 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6018 return FALSE;
6019}
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1809
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition: matpol.cc:362
#define pVar(m)
Definition: polys.h:381

◆ jjCOEFFS3_KB()

static BOOLEAN jjCOEFFS3_KB ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6020 of file iparith.cc.

6021{
6022 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6023 (ideal)(v->Data()),(poly)(w->Data()));
6024 return FALSE;
6025}

◆ jjCOEFFS3_P()

static BOOLEAN jjCOEFFS3_P ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6026 of file iparith.cc.

6027{
6028 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6029 {
6030 WerrorS("3rd argument must be a name of a matrix");
6031 return TRUE;
6032 }
6033 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6034 poly p=(poly)u->CopyD(POLY_CMD);
6035 ideal i=idInit(1,1);
6036 i->m[0]=p;
6037 sleftv t;
6038 t.Init();
6039 t.data=(char *)i;
6040 t.rtyp=IDEAL_CMD;
6041 int rank=1;
6042 if (u->Typ()==VECTOR_CMD)
6043 {
6044 i->rank=rank=pMaxComp(p);
6045 t.rtyp=MODUL_CMD;
6046 }
6047 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6048 t.CleanUp();
6049 if (r) return TRUE;
6050 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6051 return FALSE;
6052}
#define pMaxComp(p)
Definition: polys.h:299

◆ jjCOEFFS_Id()

static BOOLEAN jjCOEFFS_Id ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1809 of file iparith.cc.

1810{
1811 int i=pVar((poly)v->Data());
1812 if (i==0)
1813 {
1814 WerrorS("ringvar expected");
1815 return TRUE;
1816 }
1817 res->data=(char *)mp_Coeffs((ideal)u->CopyD(),i,currRing);
1818 return FALSE;
1819}
matrix mp_Coeffs(ideal I, int var, const ring R)
corresponds to Maple's coeffs: var has to be the number of a variable
Definition: matpol.cc:313

◆ jjCOLCOL()

static BOOLEAN jjCOLCOL ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 696 of file iparith.cc.

697{
698 switch(u->Typ())
699 {
700 case 0:
701 {
702 int name_err=0;
703 if(isupper(u->name[0]))
704 {
705 const char *c=u->name+1;
706 while((*c!='\0')&&(islower(*c)||(isdigit(*c))||(*c=='_'))) c++;
707 if (*c!='\0')
708 name_err=1;
709 else
710 {
711 Print("%s of type 'ANY'. Trying load.\n", u->name);
712 if(iiTryLoadLib(u, u->name))
713 {
714 Werror("'%s' no such package", u->name);
715 return TRUE;
716 }
717 syMake(u,u->name,NULL);
718 }
719 }
720 else name_err=1;
721 if(name_err)
722 { Werror("'%s' is an invalid package name",u->name);return TRUE;}
723 // and now, after the loading: use next case !!! no break !!!
724 }
725 case PACKAGE_CMD:
726 {
727 package pa=(package)u->Data();
728 if (u->rtyp==IDHDL) pa=IDPACKAGE((idhdl)u->data);
729 if((!pa->loaded)
730 && (pa->language > LANG_TOP))
731 {
732 Werror("'%s' not loaded", u->name);
733 return TRUE;
734 }
735 if(v->rtyp == IDHDL)
736 {
737 v->name = omStrDup(v->name);
738 }
739 else if (v->rtyp!=0)
740 {
741 WerrorS("reserved name with ::");
742 return TRUE;
743 }
744 v->req_packhdl=pa;
745 syMake(v, v->name, pa);
746 memcpy(res, v, sizeof(sleftv));
747 v->Init();
748 }
749 break;
750 case DEF_CMD:
751 break;
752 default:
753 WerrorS("<package>::<id> expected");
754 return TRUE;
755 }
756 return FALSE;
757}
char name() const
Definition: variable.cc:122
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4344
#define IDPACKAGE(a)
Definition: ipid.h:139
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition: iplib.cc:823
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1562
@ LANG_TOP
Definition: subexpr.h:22
@ PACKAGE_CMD
Definition: tok.h:149
@ DEF_CMD
Definition: tok.h:58

◆ jjCOLON()

static BOOLEAN jjCOLON ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 325 of file iparith.cc.

326{
327 int l=(int)(long)v->Data();
328 if (l>=0)
329 {
330 int d=(int)(long)u->Data();
331 intvec *vv=new intvec(l);
332 int i;
333 for(i=l-1;i>=0;i--) { (*vv)[i]=d; }
334 res->data=(char *)vv;
335 }
336 return (l<0);
337}

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3858 of file iparith.cc.

3859{
3860 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3861 return FALSE;
3862}

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3863 of file iparith.cc.

3864{
3865 res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3866 return FALSE;
3867}

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3868 of file iparith.cc.

3869{
3870 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3871 return FALSE;
3872}

◆ jjCOMPARE_ALL()

static int jjCOMPARE_ALL ( const void *  aa,
const void *  bb 
)
static

Definition at line 10149 of file iparith.cc.

10150{
10151 leftv a=(leftv)aa;
10152 int at=a->Typ();
10153 leftv b=(leftv)bb;
10154 int bt=b->Typ();
10155 if (at < bt) return -1;
10156 if (at > bt) return 1;
10157 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10158 sleftv tmp;
10159 tmp.Init();
10160 iiOp='<';
10161 BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10162 if (bo)
10163 {
10164 Werror(" no `<` for %s",Tok2Cmdname(at));
10165 unsigned long ad=(unsigned long)a->Data();
10166 unsigned long bd=(unsigned long)b->Data();
10167 if (ad<bd) return -1;
10168 else if (ad==bd) return 0;
10169 else return 1;
10170 }
10171 else if (tmp.data==NULL) /* not < */
10172 {
10174 tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10176 if (bo)
10177 {
10178 Werror(" no `==` for %s",Tok2Cmdname(at));
10179 unsigned long ad=(unsigned long)a->Data();
10180 unsigned long bd=(unsigned long)b->Data();
10181 if (ad<bd) return -1;
10182 else if (ad==bd) return 0;
10183 else return 1;
10184 }
10185 else if (tmp.data==NULL) /* not <,== */ return 1;
10186 else return 0;
10187 }
10188 else return -1;
10189}
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

static BOOLEAN jjCOMPARE_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 372 of file iparith.cc.

373{
374 bigintmat* a = (bigintmat * )(u->Data());
375 bigintmat* b = (bigintmat * )(v->Data());
376 int r=a->compare(b);
377 switch (iiOp)
378 {
379 case '<':
380 res->data = (char *) (r<0);
381 break;
382 case '>':
383 res->data = (char *) (r>0);
384 break;
385 case LE:
386 res->data = (char *) (r<=0);
387 break;
388 case GE:
389 res->data = (char *) (r>=0);
390 break;
391 case EQUAL_EQUAL:
392 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
393 res->data = (char *) (r==0);
394 break;
395 }
396 jjEQUAL_REST(res,u,v);
397 if(r==-2) { WerrorS("size incompatible"); return TRUE; }
398 return FALSE;
399}
int compare(const bigintmat *op) const
Definition: bigintmat.cc:362
@ GE
Definition: grammar.cc:269
@ LE
Definition: grammar.cc:270
@ NOTEQUAL
Definition: grammar.cc:273
static void jjEQUAL_REST(leftv res, leftv u, leftv v)
Definition: iparith.cc:1369

◆ jjCOMPARE_IV()

static BOOLEAN jjCOMPARE_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 344 of file iparith.cc.

345{
346 intvec* a = (intvec * )(u->Data());
347 intvec* b = (intvec * )(v->Data());
348 int r=a->compare(b);
349 switch (iiOp)
350 {
351 case '<':
352 res->data = (char *) (r<0);
353 break;
354 case '>':
355 res->data = (char *) (r>0);
356 break;
357 case LE:
358 res->data = (char *) (r<=0);
359 break;
360 case GE:
361 res->data = (char *) (r>=0);
362 break;
363 case EQUAL_EQUAL:
364 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
365 res->data = (char *) (r==0);
366 break;
367 }
368 jjEQUAL_REST(res,u,v);
369 if(r==-2) { WerrorS("size incompatible"); return TRUE; }
370 return FALSE;
371}
int compare(const intvec *o) const
Definition: intvec.cc:206

◆ jjCOMPARE_IV_I()

static BOOLEAN jjCOMPARE_IV_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 400 of file iparith.cc.

401{
402 intvec* a = (intvec * )(u->Data());
403 int b = (int)(long)(v->Data());
404 int r=a->compare(b);
405 switch (iiOp)
406 {
407 case '<':
408 res->data = (char *) (r<0);
409 break;
410 case '>':
411 res->data = (char *) (r>0);
412 break;
413 case LE:
414 res->data = (char *) (r<=0);
415 break;
416 case GE:
417 res->data = (char *) (r>=0);
418 break;
419 case EQUAL_EQUAL:
420 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
421 res->data = (char *) (r==0);
422 break;
423 }
424 jjEQUAL_REST(res,u,v);
425 return FALSE;
426}

◆ jjCOMPARE_MA()

static BOOLEAN jjCOMPARE_MA ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 427 of file iparith.cc.

428{
429 //Print("in: >>%s<<\n",my_yylinebuf);
430 matrix a=(matrix)u->Data();
431 matrix b=(matrix)v->Data();
432 int r=mp_Compare(a,b,currRing);
433 switch (iiOp)
434 {
435 case '<':
436 res->data = (char *) (long)(r < 0);
437 break;
438 case '>':
439 res->data = (char *) (long)(r > 0);
440 break;
441 case LE:
442 res->data = (char *) (long)(r <= 0);
443 break;
444 case GE:
445 res->data = (char *) (long)(r >= 0);
446 break;
447 case EQUAL_EQUAL:
448 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
449 res->data = (char *)(long) (r == 0);
450 break;
451 }
452 jjEQUAL_REST(res,u,v);
453 return FALSE;
454}
int mp_Compare(matrix a, matrix b, const ring R)
Definition: matpol.cc:643

◆ jjCOMPARE_P()

static BOOLEAN jjCOMPARE_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 455 of file iparith.cc.

456{
457 poly p=(poly)u->Data();
458 poly q=(poly)v->Data();
459 int r=p_Compare(p,q,currRing);
460 switch (iiOp)
461 {
462 case '<':
463 res->data = (char *) (r < 0);
464 break;
465 case '>':
466 res->data = (char *) (r > 0);
467 break;
468 case LE:
469 res->data = (char *) (r <= 0);
470 break;
471 case GE:
472 res->data = (char *) (r >= 0);
473 break;
474 //case EQUAL_EQUAL:
475 //case NOTEQUAL: /* negation handled by jjEQUAL_REST */
476 // res->data = (char *) (r == 0);
477 // break;
478 }
479 jjEQUAL_REST(res,u,v);
480 return FALSE;
481}
int p_Compare(const poly a, const poly b, const ring R)
Definition: p_polys.cc:4972

◆ jjCOMPARE_S()

static BOOLEAN jjCOMPARE_S ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 482 of file iparith.cc.

483{
484 char* a = (char * )(u->Data());
485 char* b = (char * )(v->Data());
486 int result = strcmp(a,b);
487 switch (iiOp)
488 {
489 case '<':
490 res->data = (char *) (result < 0);
491 break;
492 case '>':
493 res->data = (char *) (result > 0);
494 break;
495 case LE:
496 res->data = (char *) (result <= 0);
497 break;
498 case GE:
499 res->data = (char *) (result >= 0);
500 break;
501 case EQUAL_EQUAL:
502 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
503 res->data = (char *) (result == 0);
504 break;
505 }
506 jjEQUAL_REST(res,u,v);
507 return FALSE;
508}

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3873 of file iparith.cc.

3874{
3875 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3876 poly p=(poly)v->CopyD(POLY_CMD);
3877 if (p!=NULL) p_Cleardenom(p, currRing);
3878 res->data = (char *)p;
3879 return FALSE;
3880}
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2910

◆ jjCONTRACT()

static BOOLEAN jjCONTRACT ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1834 of file iparith.cc.

1835{
1836 res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data(),FALSE);
1837 return FALSE;
1838}
matrix idDiffOp(ideal I, ideal J, BOOLEAN multiply)
Definition: ideals.cc:2155

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3881 of file iparith.cc.

3882{
3883 res->data = (char *)(long)n_Size((number)v->Data(),coeffs_BIGINT);
3884 return FALSE;
3885}
static FORCE_INLINE int n_Size(number n, const coeffs r)
return a non-negative measure for the complexity of n; return 0 only when n represents zero; (used fo...
Definition: coeffs.h:570

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3886 of file iparith.cc.

3887{
3888 bigintmat* aa= (bigintmat *)v->Data();
3889 res->data = (char *)(long)(aa->rows()*aa->cols());
3890 return FALSE;
3891}

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3909 of file iparith.cc.

3910{
3911 res->data = (char *)(long)((intvec*)(v->Data()))->length();
3912 return FALSE;
3913}

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3897 of file iparith.cc.

3898{
3899 lists l=(lists)v->Data();
3900 res->data = (char *)(long)(lSize(l)+1);
3901 return FALSE;
3902}
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3903 of file iparith.cc.

3904{
3905 matrix m=(matrix)v->Data();
3906 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3907 return FALSE;
3908}

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3892 of file iparith.cc.

3893{
3894 res->data = (char *)(long)nSize((number)v->Data());
3895 return FALSE;
3896}

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5652 of file iparith.cc.

5653{
5654 res->data=(char *)(long)sySize((syStrategy)v->Data());
5655 return FALSE;
5656}
int sySize(syStrategy syzstr)
Definition: syz1.cc:1829

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3914 of file iparith.cc.

3915{
3916 ring r=(ring)v->Data();
3917 int elems=-1;
3918 if (rField_is_Zp(r)) elems=r->cf->ch;
3919 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3920 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3921 {
3922 extern int ipower ( int b, int n ); /* factory/cf_util */
3923 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3924 }
3925 res->data = (char *)(long)elems;
3926 return FALSE;
3927}
int ipower(int b, int m)
int ipower ( int b, int m )
Definition: cf_util.cc:27
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:35
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:530
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:501
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:522

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3966 of file iparith.cc.

3967{
3968 if ((v->rtyp==IDHDL)
3969 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
3970 {
3971 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
3972 }
3973 else if (v->rtyp!=0) res->data=(void *)(-1);
3974 return FALSE;
3975}
#define IDLEV(a)
Definition: ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3928 of file iparith.cc.

3929{
3930 int dummy;
3931 poly p=(poly)v->Data();
3932 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3933 else res->data=(char *)-1;
3934 return FALSE;
3935}

◆ jjDEG_IV()

static BOOLEAN jjDEG_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1850 of file iparith.cc.

1851{
1852 poly p=(poly)u->Data();
1853 if (p!=NULL)
1854 {
1855 int *iv=iv2array((intvec *)v->Data(),currRing);
1856 const long d = p_DegW(p,iv,currRing);
1857 omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(int) );
1858 res->data = (char *)(d);
1859 }
1860 else
1861 res->data=(char *)(long)(-1);
1862 return FALSE;
1863}
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long p_DegW(poly p, const int *w, const ring R)
Definition: p_polys.cc:690
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:593
int * iv2array(intvec *iv, const ring R)
Definition: weight.cc:200

◆ jjDEG_M()

static BOOLEAN jjDEG_M ( leftv  res,
leftv  u 
)
static

Definition at line 3936 of file iparith.cc.

3937{
3938 ideal I=(ideal)u->Data();
3939 int d=-1;
3940 int dummy;
3941 int i;
3942 for(i=IDELEMS(I)-1;i>=0;i--)
3943 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3944 res->data = (char *)(long)d;
3945 return FALSE;
3946}
static int si_max(const int a, const int b)
Definition: auxiliary.h:124

◆ jjDEG_M_IV()

static BOOLEAN jjDEG_M_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1839 of file iparith.cc.

1840{
1841 int *iv=iv2array((intvec *)v->Data(),currRing);
1842 ideal I=(ideal)u->Data();
1843 int d=-1;
1844 int i;
1845 for(i=IDELEMS(I);i>=0;i--) d=si_max(d,(int)p_DegW(I->m[i],iv,currRing));
1846 omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(int) );
1847 res->data = (char *)((long)d);
1848 return FALSE;
1849}

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3947 of file iparith.cc.

3948{
3949 SPrintStart();
3950#ifdef HAVE_RINGS
3951 if (rField_is_Z(currRing))
3952 {
3953 PrintS("// NOTE: computation of degree is being performed for\n");
3954 PrintS("// generic fibre, that is, over Q\n");
3955 }
3956#endif
3958 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3959 scDegree((ideal)v->Data(),module_w,currRing->qideal);
3960 char *s=SPrintEnd();
3961 int l=strlen(s)-1;
3962 s[l]='\0';
3963 res->data=(void*)s;
3964 return FALSE;
3965}
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:895
void SPrintStart()
Definition: reporter.cc:246
void PrintS(const char *s)
Definition: reporter.cc:284
char * SPrintEnd()
Definition: reporter.cc:273
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1536

◆ jjDelete_ID()

static BOOLEAN jjDelete_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1871 of file iparith.cc.

1872{
1873 int pos=(int)(long)v->Data();
1874 ideal I=(ideal)u->Data();
1875 res->data=(void*)id_Delete_Pos(I,pos-1,currRing);
1876 return res->data==NULL;
1877}
ideal id_Delete_Pos(const ideal I, const int p, const ring r)

◆ jjDelete_IV()

static BOOLEAN jjDelete_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1864 of file iparith.cc.

1865{
1866 int pos=(int)(long)v->Data();
1867 intvec *iv=(intvec*)u->Data();
1868 res->data=(void*)iv->delete_pos(pos-1);
1869 return res->data==NULL;
1870}
intvec * delete_pos(int p)
Definition: intvec.cc:824

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

Return the denominator of the input number.

Definition at line 3978 of file iparith.cc.

3979{
3980 number n = reinterpret_cast<number>(v->CopyD());
3981 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
3982 n_Delete(&n,currRing->cf);
3983 return FALSE;
3984}
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:603

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 3995 of file iparith.cc.

3996{
3997 matrix m=(matrix)v->Data();
3998 res ->data = mp_Det(m,currRing);
3999 return FALSE;
4000}
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition: matpol.cc:2143

◆ jjDET2()

static BOOLEAN jjDET2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1878 of file iparith.cc.

1879{
1880 matrix m=(matrix)u->Data();
1881 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1882 res ->data = mp_Det(m,currRing,d);
1883 return FALSE;
1884}
DetVariant mp_GetAlgorithmDet(matrix m, const ring r)
Definition: matpol.cc:2112
DetVariant
Definition: matpol.h:35

◆ jjDET2_S()

static BOOLEAN jjDET2_S ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1885 of file iparith.cc.

1886{
1887 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1888 ideal m=(ideal)u->Data();
1889 res ->data = sm_Det(m,currRing,d);
1890 return FALSE;
1891}
poly sm_Det(ideal a, const ring r, DetVariant d)
Definition: matpol.cc:2167

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 4001 of file iparith.cc.

4002{
4003 bigintmat * m=(bigintmat*)v->Data();
4004 int i,j;
4005 i=m->rows();j=m->cols();
4006 if(i==j)
4007 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4008 else
4009 {
4010 Werror("det of %d x %d bigintmat",i,j);
4011 return TRUE;
4012 }
4013 return FALSE;
4014}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1798
int j
Definition: facHensel.cc:110

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4037 of file iparith.cc.

4038{
4039 intvec * m=(intvec*)v->Data();
4040 int i,j;
4041 i=m->rows();j=m->cols();
4042 if(i==j)
4043 res->data = (char *)(long)singclap_det_i(m,currRing);
4044 else
4045 {
4046 Werror("det of %d x %d intmat",i,j);
4047 return TRUE;
4048 }
4049 return FALSE;
4050}
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1780

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 4051 of file iparith.cc.

4052{
4053 ideal I=(ideal)v->Data();
4054 res->data=(char*)sm_Det(I,currRing);
4055 return FALSE;
4056}

◆ jjDIFF_COEF()

static BOOLEAN jjDIFF_COEF ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 4425 of file iparith.cc.

4426{
4427 if (!nCoeff_is_transExt(currRing->cf))
4428 {
4429 WerrorS("differentiation not defined in the coefficient ring");
4430 return TRUE;
4431 }
4432 number n = (number) u->Data();
4433 number k = (number) v->Data();
4434 res->data = ntDiff(n,k,currRing->cf);
4435 return FALSE;
4436}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:918
number ntDiff(number a, number d, const coeffs cf)
Definition: transext.cc:897

◆ jjDIFF_ID()

static BOOLEAN jjDIFF_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1903 of file iparith.cc.

1904{
1905 int i=pVar((poly)v->Data());
1906 if (i==0)
1907 {
1908 WerrorS("ringvar expected");
1909 return TRUE;
1910 }
1911 res->data=(char *)idDiff((matrix)(u->Data()),i);
1912 return FALSE;
1913}
matrix idDiff(matrix i, int k)
Definition: ideals.cc:2142

◆ jjDIFF_ID_ID()

static BOOLEAN jjDIFF_ID_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1914 of file iparith.cc.

1915{
1916 res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data());
1917 return FALSE;
1918}

◆ jjDIFF_P()

static BOOLEAN jjDIFF_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1892 of file iparith.cc.

1893{
1894 int i=pVar((poly)v->Data());
1895 if (i==0)
1896 {
1897 WerrorS("ringvar expected");
1898 return TRUE;
1899 }
1900 res->data=(char *)pDiff((poly)(u->Data()),i);
1901 return FALSE;
1902}
#define pDiff(a, b)
Definition: polys.h:296

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4057 of file iparith.cc.

4058{
4060#ifdef HAVE_SHIFTBBA
4061 if (rIsLPRing(currRing))
4062 {
4063#ifdef HAVE_RINGS
4065 {
4066 WerrorS("`dim` is not implemented for letterplace rings over rings");
4067 return TRUE;
4068 }
4069#endif
4070 if (currRing->qideal != NULL)
4071 {
4072 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4073 return TRUE;
4074 }
4075 int gkDim = lp_gkDim((ideal)(v->Data()));
4076 res->data = (char *)(long)gkDim;
4077 return (gkDim == -2);
4078 }
4079#endif
4081 {
4082 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4083 }
4084 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4085 return FALSE;
4086}
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition: hdegree.cc:135
int lp_gkDim(const ideal _G)
Definition: hdegree.cc:1840
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:762

◆ jjDIM2()

static BOOLEAN jjDIM2 ( leftv  res,
leftv  v,
leftv  w 
)
static

Definition at line 1919 of file iparith.cc.

1920{
1923 {
1924 Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1925 }
1926 if(currRing->qideal==NULL)
1927 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),(ideal)w->Data()));
1928 else
1929 {
1930 ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1931 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),q));
1932 idDelete(&q);
1933 }
1934 return FALSE;
1935}
#define idSimpleAdd(A, B)
Definition: ideals.h:42

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5657 of file iparith.cc.

5658{
5659 res->data = (char *)(long)syDim((syStrategy)v->Data());
5660 return FALSE;
5661}
int syDim(syStrategy syzstr)
Definition: syz1.cc:1849

◆ jjDIV_BI()

static BOOLEAN jjDIV_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1252 of file iparith.cc.

1253{
1254 number q=(number)v->Data();
1255 if (n_IsZero(q,coeffs_BIGINT))
1256 {
1258 return TRUE;
1259 }
1260 q = n_Div((number)u->Data(),q,coeffs_BIGINT);
1262 res->data = (char *)q;
1263 return FALSE;
1264}
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:615
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:578
#define ii_div_by_0
Definition: iparith.cc:218

◆ jjDIV_Ma()

static BOOLEAN jjDIV_Ma ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1296 of file iparith.cc.

1297{
1298 poly q=(poly)v->Data();
1299 if (q==NULL)
1300 {
1302 return TRUE;
1303 }
1304 matrix m=(matrix)(u->Data());
1305 int r=m->rows();
1306 int c=m->cols();
1307 matrix mm=mpNew(r,c);
1308 unsigned i,j;
1309 for(i=r;i>0;i--)
1310 {
1311 for(j=c;j>0;j--)
1312 {
1313 if (pNext(q)!=NULL)
1314 {
1316 q /*(poly)(v->Data())*/, currRing );
1317 }
1318 else
1319 MATELEM(mm,i,j) = pp_DivideM(MATELEM(m,i,j),q,currRing);
1320 }
1321 }
1322 res->data=(char *)mm;
1323 return FALSE;
1324}
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:624
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
poly pp_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1629

◆ jjDIV_N()

static BOOLEAN jjDIV_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1265 of file iparith.cc.

1266{
1267 number q=(number)v->Data();
1268 if (nIsZero(q))
1269 {
1271 return TRUE;
1272 }
1273 q = nDiv((number)u->Data(),q);
1274 nNormalize(q);
1275 res->data = (char *)q;
1276 return FALSE;
1277}
#define nDiv(a, b)
Definition: numbers.h:32
#define nNormalize(n)
Definition: numbers.h:30

◆ jjDIV_P()

static BOOLEAN jjDIV_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1278 of file iparith.cc.

1279{
1280 poly q=(poly)v->Data();
1281 poly p=(poly)(u->Data());
1282 if (q!=NULL)
1283 {
1284 res->data=(void*)(pp_Divide(p /*(poly)(u->Data())*/ ,
1285 q /*(poly)(v->Data())*/ ,currRing));
1286 if (res->data!=NULL) pNormalize((poly)res->data);
1287 return errorreported; /*there may be errors in p_Divide: div. ny 0, etc.*/
1288 }
1289 else
1290 {
1291 WerrorS("div. by 0");
1292 return TRUE;
1293 }
1294
1295}
poly pp_Divide(poly p, poly q, const ring r)
polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift does not destroy a,...
Definition: polys.cc:174
#define pNormalize(p)
Definition: polys.h:317

◆ jjDIVISION()

static BOOLEAN jjDIVISION ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1936 of file iparith.cc.

1937{
1938 ideal vi=(ideal)v->Data();
1939 int vl= IDELEMS(vi);
1940 ideal ui=(ideal)u->Data();
1941 unsigned ul= IDELEMS(ui);
1942 ideal R; matrix U;
1943 ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1944 if (m==NULL) return TRUE;
1945 // now make sure that all matrices have the correct size:
1947 int i;
1948 assume (MATCOLS(U) == (int)ul);
1950 L->Init(3);
1951 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1952 L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1953 L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1954 res->data=(char *)L;
1955 return FALSE;
1956}
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition: ideals.cc:1105
#define hasFlag(A, F)
Definition: ipid.h:112
#define FLAG_STD
Definition: ipid.h:106
STATIC_VAR jList * T
Definition: janet.cc:30
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition: sirandom.c:27

◆ jjDIVISION4()

static BOOLEAN jjDIVISION4 ( leftv  res,
leftv  v 
)
static

Definition at line 7162 of file iparith.cc.

7163{ // may have 3 or 4 arguments
7164 leftv v1=v;
7165 leftv v2=v1->next;
7166 leftv v3=v2->next;
7167 leftv v4=v3->next;
7168 assumeStdFlag(v2);
7169
7170 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7171 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7172
7173 if((i1==0)||(i2==0)
7174 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7175 {
7176 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7177 return TRUE;
7178 }
7179
7180 sleftv w1,w2;
7181 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7182 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7183 ideal P=(ideal)w1.Data();
7184 ideal Q=(ideal)w2.Data();
7185
7186 int n=(int)(long)v3->Data();
7187 int *w=NULL;
7188 if(v4!=NULL)
7189 {
7190 w = iv2array((intvec *)v4->Data(),currRing);
7191 int * w0 = w + 1;
7192 int i = currRing->N;
7193 while( (i > 0) && ((*w0) > 0) )
7194 {
7195 w0++;
7196 i--;
7197 }
7198 if(i>0)
7199 WarnS("not all weights are positive!");
7200 }
7201
7202 matrix T;
7203 ideal R;
7204 idLiftW(P,Q,n,T,R,w);
7205
7206 w1.CleanUp();
7207 w2.CleanUp();
7208 if(w!=NULL)
7209 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7210
7212 L->Init(2);
7213 L->m[1].rtyp=v1->Typ();
7214 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7215 {
7216 if(v1->Typ()==POLY_CMD)
7217 p_Shift(&R->m[0],-1,currRing);
7218 L->m[1].data=(void *)R->m[0];
7219 R->m[0]=NULL;
7220 idDelete(&R);
7221 }
7222 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7223 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7224 else
7225 {
7226 L->m[1].rtyp=MODUL_CMD;
7227 L->m[1].data=(void *)R;
7228 }
7229 L->m[0].rtyp=MATRIX_CMD;
7230 L->m[0].data=(char *)T;
7231
7232 res->data=L;
7233
7234 return FALSE;
7235}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition: ideals.cc:1324
STATIC_VAR jList * Q
Definition: janet.cc:30
matrix id_Module2Matrix(ideal mod, const ring R)

◆ jjDIVMOD_I()

static BOOLEAN jjDIVMOD_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1229 of file iparith.cc.

1230{
1231 if (iiOp=='/') Warn("int division with `/`: use `div` instead in line >>%s<<",my_yylinebuf);
1232 int a= (int)(long)u->Data();
1233 int b= (int)(long)v->Data();
1234 if (b==0)
1235 {
1237 return TRUE;
1238 }
1239 int c=a%b;
1240 int r=0;
1241 switch (iiOp)
1242 {
1243 case '%':
1244 r=c; break;
1245 case '/':
1246 case INTDIV_CMD:
1247 r=((a-c) /b); break;
1248 }
1249 res->data=(void *)((long)r);
1250 return FALSE;
1251}
@ INTDIV_CMD
Definition: tok.h:97

◆ jjDOTDOT()

static BOOLEAN jjDOTDOT ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 338 of file iparith.cc.

339{
340 res->data=(char *)new intvec((int)(long)u->Data(),(int)(long)v->Data());
341 return FALSE;
342}

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3681 of file iparith.cc.

3682{
3683// res->data = (char *)u->CopyD();
3684// also copy attributes:
3685 res->Copy(u);
3686 return FALSE;
3687}

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4087 of file iparith.cc.

4088{
4089 si_link l = (si_link)v->Data();
4090 if (slDump(l))
4091 {
4092 const char *s;
4093 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4094 else s=sNoName_fe;
4095 Werror("cannot dump to `%s`",s);
4096 return TRUE;
4097 }
4098 else
4099 return FALSE;
4100}

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4101 of file iparith.cc.

4102{
4103 res->data = (char *)pOne();
4104 int co=(int)(long)v->Data();
4105 if (co>0)
4106 {
4107 pSetComp((poly)res->data,co);
4108 pSetm((poly)res->data);
4109 }
4110 else WerrorS("argument of gen must be positive");
4111 return (co<=0);
4112}
#define pSetComp(p, v)
Definition: polys.h:38
#define pOne()
Definition: polys.h:315

◆ jjELIMIN()

static BOOLEAN jjELIMIN ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1957 of file iparith.cc.

1958{
1959 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1960 //setFlag(res,FLAG_STD);
1961 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
1962}
ideal idElimination(ideal h1, poly delVar, intvec *hilb, GbVariant alg)
Definition: ideals.cc:1593

◆ jjELIMIN_ALG()

static BOOLEAN jjELIMIN_ALG ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6053 of file iparith.cc.

6054{
6055 ideal I=(ideal)u->Data();
6056 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6057 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6058 //setFlag(res,FLAG_STD);
6059 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6060}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3158
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

static BOOLEAN jjELIMIN_HILB ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6061 of file iparith.cc.

6062{
6063 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6064 (intvec *)w->Data());
6065 //setFlag(res,FLAG_STD);
6066 return FALSE;
6067}

◆ jjELIMIN_IV()

static BOOLEAN jjELIMIN_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1963 of file iparith.cc.

1964{
1965 poly p=pOne();
1966 intvec *iv=(intvec*)v->Data();
1967 for(int i=iv->length()-1; i>=0; i--)
1968 {
1969 pSetExp(p,(*iv)[i],1);
1970 }
1971 pSetm(p);
1972 res->data=(char *)idElimination((ideal)u->Data(),p);
1973 pLmDelete(&p);
1974 //setFlag(res,FLAG_STD);
1975 return FALSE;
1976}
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76

◆ jjENVELOPE()

static BOOLEAN jjENVELOPE ( leftv  res,
leftv  a 
)
static

Definition at line 5226 of file iparith.cc.

5227{
5228#ifdef HAVE_PLURAL
5229 ring r = (ring)a->Data();
5230 if (rIsPluralRing(r))
5231 {
5232 ring s = rEnvelope(r);
5233 res->data = s;
5234 }
5235 else res->data = rCopy(r);
5236 return FALSE;
5237#else
5238 return TRUE;
5239#endif
5240}
ring rEnvelope(ring R)
Definition: ring.cc:5772
ring rCopy(ring r)
Definition: ring.cc:1731

◆ jjEQUAL_BI()

static BOOLEAN jjEQUAL_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1325 of file iparith.cc.

1326{
1327 res->data = (char *)((long)n_Equal((number)u->Data(),(number)v->Data(),coeffs_BIGINT));
1328 jjEQUAL_REST(res,u,v);
1329 return FALSE;
1330}
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:460

◆ jjEQUAL_I()

static BOOLEAN jjEQUAL_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1331 of file iparith.cc.

1332{
1333 res->data = (char *)((int)((long)u->Data()) == (int)((long)v->Data()));
1334 jjEQUAL_REST(res,u,v);
1335 return FALSE;
1336}

◆ jjEQUAL_Ma()

static BOOLEAN jjEQUAL_Ma ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1337 of file iparith.cc.

1338{
1339 res->data = (char *)((long)mp_Equal((matrix)u->Data(),(matrix)v->Data(),currRing));
1340 jjEQUAL_REST(res,u,v);
1341 return FALSE;
1342}
BOOLEAN mp_Equal(matrix a, matrix b, const ring R)
Definition: matpol.cc:662

◆ jjEQUAL_N()

static BOOLEAN jjEQUAL_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1355 of file iparith.cc.

1356{
1357 res->data = (char *)((long)nEqual((number)u->Data(),(number)v->Data()));
1358 jjEQUAL_REST(res,u,v);
1359 return FALSE;
1360}
#define nEqual(n1, n2)
Definition: numbers.h:20

◆ jjEQUAL_P()

static BOOLEAN jjEQUAL_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1361 of file iparith.cc.

1362{
1363 poly p=(poly)u->Data();
1364 poly q=(poly)v->Data();
1365 res->data = (char *) ((long)pEqualPolys(p,q));
1366 jjEQUAL_REST(res,u,v);
1367 return FALSE;
1368}
#define pEqualPolys(p1, p2)
Definition: polys.h:400

◆ jjEQUAL_R()

static BOOLEAN jjEQUAL_R ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1349 of file iparith.cc.

1350{
1351 res->data = (char *)(long)(u->Data()==v->Data());
1352 jjEQUAL_REST(res,u,v);
1353 return FALSE;
1354}

◆ jjEQUAL_REST()

static void jjEQUAL_REST ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1369 of file iparith.cc.

1370{
1371 if ((res->data) && (u->next!=NULL) && (v->next!=NULL))
1372 {
1373 int save_iiOp=iiOp;
1374 if (iiOp==NOTEQUAL)
1376 else
1378 iiOp=save_iiOp;
1379 }
1380 if (iiOp==NOTEQUAL) res->data=(char *)(!(long)res->data);
1381}

◆ jjEQUAL_SM()

static BOOLEAN jjEQUAL_SM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1343 of file iparith.cc.

1344{
1345 res->data = (char *)((long)sm_Equal((ideal)u->Data(),(ideal)v->Data(),currRing));
1346 jjEQUAL_REST(res,u,v);
1347 return FALSE;
1348}
BOOLEAN sm_Equal(ideal a, ideal b, const ring R)
Definition: matpol.cc:2003

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 1982 of file iparith.cc.

1983{
1984 WerrorS((char *)u->Data());
1985 EXTERN_VAR int inerror;
1986 inerror=3;
1987 return TRUE;
1988}
#define EXTERN_VAR
Definition: globaldefs.h:6
EXTERN_VAR int inerror

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4113 of file iparith.cc.

4114{
4115 char * d = (char *)v->Data();
4116 char * s = (char *)omAlloc(strlen(d) + 13);
4117 strcpy( s, (char *)d);
4118 strcat( s, "\n;RETURN();\n");
4120 return yyparse();
4121}
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:164
@ BT_execute
Definition: fevoices.h:23
int yyparse(void)
Definition: grammar.cc:2111

◆ jjEXPORTTO()

static BOOLEAN jjEXPORTTO ( leftv  ,
leftv  u,
leftv  v 
)
static

Definition at line 1977 of file iparith.cc.

1978{
1979 //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1980 return iiExport(v,0,IDPACKAGE((idhdl)u->data));
1981}
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1515

◆ jjEXTGCD_BI()

static BOOLEAN jjEXTGCD_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1989 of file iparith.cc.

1990{
1991 number uu=(number)u->Data();number vv=(number)v->Data();
1993 number a,b;
1994 number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
1995 L->Init(3);
1996 L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
1997 L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
1998 L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
1999 res->rtyp=LIST_CMD;
2000 res->data=(char *)L;
2001 return FALSE;
2002}
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:671

◆ jjEXTGCD_I()

static BOOLEAN jjEXTGCD_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2003 of file iparith.cc.

2004{
2005 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2006 int p0=ABS(uu),p1=ABS(vv);
2007 int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
2008
2009 while ( p1!=0 )
2010 {
2011 q=p0 / p1;
2012 r=p0 % p1;
2013 p0 = p1; p1 = r;
2014 r = g0 - g1 * q;
2015 g0 = g1; g1 = r;
2016 r = f0 - f1 * q;
2017 f0 = f1; f1 = r;
2018 }
2019 int a = f0;
2020 int b = g0;
2021 if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
2022 if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
2024 L->Init(3);
2025 L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
2026 L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
2027 L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
2028 res->data=(char *)L;
2029 return FALSE;
2030}
static int ABS(int v)
Definition: auxiliary.h:112

◆ jjEXTGCD_P()

static BOOLEAN jjEXTGCD_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2031 of file iparith.cc.

2032{
2033 poly r,pa,pb;
2034 BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2035 if (ret) return TRUE;
2037 L->Init(3);
2038 res->data=(char *)L;
2039 L->m[0].data=(void *)r;
2040 L->m[0].rtyp=POLY_CMD;
2041 L->m[1].data=(void *)pa;
2042 L->m[1].rtyp=POLY_CMD;
2043 L->m[2].data=(void *)pb;
2044 L->m[2].rtyp=POLY_CMD;
2045 return FALSE;
2046}
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition: clapsing.cc:489
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4371

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4162 of file iparith.cc.

4163{
4164 intvec *v=NULL;
4166 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4167 if (f==NULL) return TRUE;
4168 ivTest(v);
4170 l->Init(2);
4171 l->m[0].rtyp=IDEAL_CMD;
4172 l->m[0].data=(void *)f;
4173 l->m[1].rtyp=INTVEC_CMD;
4174 l->m[1].data=(void *)v;
4175 res->data=(void *)l;
4176 return FALSE;
4177}
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:948
#define ivTest(v)
Definition: intvec.h:158
EXTERN_VAR int singclap_factorize_retry
Definition: iparith.cc:2047

◆ jjFAC_P2()

static BOOLEAN jjFAC_P2 ( leftv  res,
leftv  u,
leftv  dummy 
)
static

Definition at line 2048 of file iparith.cc.

2049{
2050 intvec *v=NULL;
2051 int sw=(int)(long)dummy->Data();
2052 int fac_sw=sw;
2053 if ((sw<0)||(sw>2)) fac_sw=1;
2055 ideal f=singclap_factorize((poly)(u->CopyD()), &v, fac_sw,currRing);
2056 if (f==NULL)
2057 return TRUE;
2058 switch(sw)
2059 {
2060 case 0:
2061 case 2:
2062 {
2064 l->Init(2);
2065 l->m[0].rtyp=IDEAL_CMD;
2066 l->m[0].data=(void *)f;
2067 l->m[1].rtyp=INTVEC_CMD;
2068 l->m[1].data=(void *)v;
2069 res->data=(void *)l;
2070 res->rtyp=LIST_CMD;
2071 return FALSE;
2072 }
2073 case 1:
2074 res->data=(void *)f;
2075 return FALSE;
2076 case 3:
2077 {
2078 poly p=f->m[0];
2079 int i=IDELEMS(f);
2080 f->m[0]=NULL;
2081 while(i>1)
2082 {
2083 i--;
2084 p=pMult(p,f->m[i]);
2085 f->m[i]=NULL;
2086 }
2087 res->data=(void *)p;
2088 res->rtyp=POLY_CMD;
2089 }
2090 return FALSE;
2091 }
2092 WerrorS("invalid switch");
2093 return TRUE;
2094}
#define pMult(p, q)
Definition: polys.h:207

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4122 of file iparith.cc.

4123{
4125 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4126 {
4127 ideal_list p,h;
4128 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4129 if (h==NULL)
4130 {
4131 L->Init(1);
4132 L->m[0].data=(char *)idInit(1);
4133 L->m[0].rtyp=IDEAL_CMD;
4134 }
4135 else
4136 {
4137 p=h;
4138 int l=0;
4139 while (p!=NULL) { p=p->next;l++; }
4140 L->Init(l);
4141 l=0;
4142 while(h!=NULL)
4143 {
4144 L->m[l].data=(char *)h->d;
4145 L->m[l].rtyp=IDEAL_CMD;
4146 p=h->next;
4147 omFreeSize(h,sizeof(*h));
4148 h=p;
4149 l++;
4150 }
4151 }
4152 }
4153 else
4154 {
4155 WarnS("no factorization implemented");
4156 L->Init(1);
4157 iiExprArith1(&(L->m[0]),v,STD_CMD);
4158 }
4159 res->data=(void *)L;
4160 return FALSE;
4161}
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition: kstdfac.cc:798
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:276
@ testHomog
Definition: structs.h:38
@ STD_CMD
Definition: tok.h:184

◆ jjFACSTD2()

static BOOLEAN jjFACSTD2 ( leftv  res,
leftv  v,
leftv  w 
)
static

Definition at line 2095 of file iparith.cc.

2096{
2097 ideal_list p,h;
2098 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2099 p=h;
2100 int l=0;
2101 while (p!=NULL) { p=p->next;l++; }
2103 L->Init(l);
2104 l=0;
2105 while(h!=NULL)
2106 {
2107 L->m[l].data=(char *)h->d;
2108 L->m[l].rtyp=IDEAL_CMD;
2109 p=h->next;
2110 omFreeSize(h,sizeof(*h));
2111 h=p;
2112 l++;
2113 }
2114 res->data=(void *)L;
2115 return FALSE;
2116}

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8363 of file iparith.cc.

8364{
8365 /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
8366 see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
8367
8368 valid argument lists:
8369 - (poly h, int d),
8370 - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
8371 - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
8372 in list of ring vars,
8373 - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
8374 optional: all 4 optional args
8375 (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
8376 by singclap_factorize and h(0, y)
8377 has exactly two distinct monic factors [possibly with exponent > 1].)
8378 result:
8379 - list with the two factors f and g such that
8380 h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
8381
8382 poly h = NULL;
8383 int d = 1;
8384 poly f0 = NULL;
8385 poly g0 = NULL;
8386 int xIndex = 1; /* default index if none provided */
8387 int yIndex = 2; /* default index if none provided */
8388
8389 leftv u = v; int factorsGiven = 0;
8390 if ((u == NULL) || (u->Typ() != POLY_CMD))
8391 {
8392 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8393 return TRUE;
8394 }
8395 else h = (poly)u->Data();
8396 u = u->next;
8397 if ((u == NULL) || (u->Typ() != INT_CMD))
8398 {
8399 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8400 return TRUE;
8401 }
8402 else d = (int)(long)u->Data();
8403 u = u->next;
8404 if ((u != NULL) && (u->Typ() == POLY_CMD))
8405 {
8406 if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
8407 {
8408 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8409 return TRUE;
8410 }
8411 else
8412 {
8413 f0 = (poly)u->Data();
8414 g0 = (poly)u->next->Data();
8415 factorsGiven = 1;
8416 u = u->next->next;
8417 }
8418 }
8419 if ((u != NULL) && (u->Typ() == INT_CMD))
8420 {
8421 if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
8422 {
8423 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8424 return TRUE;
8425 }
8426 else
8427 {
8428 xIndex = (int)(long)u->Data();
8429 yIndex = (int)(long)u->next->Data();
8430 u = u->next->next;
8431 }
8432 }
8433 if (u != NULL)
8434 {
8435 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8436 return TRUE;
8437 }
8438
8439 /* checks for provided arguments */
8440 if (pIsConstant(h) || (factorsGiven && (pIsConstant(f0) || pIsConstant(g0))))
8441 {
8442 WerrorS("expected non-constant polynomial argument(s)");
8443 return TRUE;
8444 }
8445 int n = rVar(currRing);
8446 if ((xIndex < 1) || (n < xIndex))
8447 {
8448 Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
8449 return TRUE;
8450 }
8451 if ((yIndex < 1) || (n < yIndex))
8452 {
8453 Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
8454 return TRUE;
8455 }
8456 if (xIndex == yIndex)
8457 {
8458 WerrorS("expected distinct indices for variables x and y");
8459 return TRUE;
8460 }
8461
8462 /* computation of f0 and g0 if missing */
8463 if (factorsGiven == 0)
8464 {
8465 poly h0 = pSubst(pCopy(h), xIndex, NULL);
8466 intvec* v = NULL;
8467 ideal i = singclap_factorize(h0, &v, 0,currRing);
8468
8469 ivTest(v);
8470
8471 if (i == NULL) return TRUE;
8472
8473 idTest(i);
8474
8475 if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
8476 {
8477 WerrorS("expected h(0,y) to have exactly two distinct monic factors");
8478 return TRUE;
8479 }
8480 f0 = pPower(pCopy(i->m[1]), (*v)[1]);
8481 g0 = pPower(pCopy(i->m[2]), (*v)[2]);
8482 idDelete(&i);
8483 }
8484
8485 poly f; poly g;
8486 henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
8488 L->Init(2);
8489 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
8490 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
8491 res->rtyp = LIST_CMD;
8492 res->data = (char*)L;
8493 return FALSE;
8494}
g
Definition: cfModGcd.cc:4090
#define idTest(id)
Definition: ideals.h:47
VAR idhdl h0
Definition: libparse.cc:1143
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x,...
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define nIsOne(n)
Definition: numbers.h:25
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:238
#define pPower(p, q)
Definition: polys.h:204
#define pSubst(p, n, e)
Definition: polys.h:366

◆ jjFAREY_BI()

static BOOLEAN jjFAREY_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2117 of file iparith.cc.

2118{
2119 if (rField_is_Q(currRing))
2120 {
2121 number uu=(number)u->Data();
2122 number vv=(number)v->Data();
2123 res->data=(char *)n_Farey(uu,vv,currRing->cf);
2124 return FALSE;
2125 }
2126 else return TRUE;
2127}
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:767

◆ jjFAREY_ID()

static BOOLEAN jjFAREY_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2128 of file iparith.cc.

2129{
2130 ideal uu=(ideal)u->Data();
2131 number vv=(number)v->Data();
2132 //timespec buf1,buf2;
2133 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2134 #if 1
2135 #ifdef HAVE_VSPACE
2136 int cpus = (long) feOptValue(FE_OPT_CPUS);
2137 if ((cpus>1) && (rField_is_Q(currRing)))
2138 res->data=(void*)id_Farey_0(uu,vv,currRing);
2139 else
2140 #endif
2141 #endif
2142 res->data=(void*)id_Farey(uu,vv,currRing);
2143 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2144 //const unsigned long SEC = 1000L*1000L*1000L;
2145 //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2146 // buf2.tv_nsec-buf1.tv_nsec);
2147 //farey_cnt++;
2148 return FALSE;
2149}
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2852
ideal id_Farey_0(ideal x, number N, const ring r)
Definition: kChinese.cc:298

◆ jjFAREY_LI()

static BOOLEAN jjFAREY_LI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 10130 of file iparith.cc.

10131{
10132 lists c=(lists)u->CopyD();
10134 res_l->Init(c->nr+1);
10135 BOOLEAN bo=FALSE;
10136 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10137 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10138 {
10139 sleftv tmp;
10140 tmp.Copy(v);
10141 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10142 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10143 }
10144 c->Clean();
10145 res->data=res_l;
10146 return bo;
10147}
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

static BOOLEAN jjFETCH ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2151 of file iparith.cc.

2152{
2153 ring r=(ring)u->Data();
2154 idhdl w;
2155 int op=iiOp;
2156 nMapFunc nMap;
2157
2158 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
2159 {
2160 int *perm=NULL;
2161 int *par_perm=NULL;
2162 int par_perm_size=0;
2163 BOOLEAN bo;
2164 nMap=n_SetMap(r->cf,currRing->cf);
2165 if (nMap==NULL)
2166 {
2167 // Allow imap/fetch to be make an exception only for:
2168 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2169 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
2170 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
2171 {
2172 par_perm_size=rPar(r);
2173 }
2174 else
2175 {
2176 goto err_fetch;
2177 }
2178 }
2179 if (
2180 (iiOp!=FETCH_CMD) || (r->N!=currRing->N) || (rPar(r)!=rPar(currRing))
2181#ifdef HAVE_SHIFTBBA
2183#endif
2184 )
2185 {
2186 perm=(int *)omAlloc0((r->N+1)*sizeof(int));
2187 if (par_perm_size!=0)
2188 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2189 op=IMAP_CMD;
2190 if (iiOp==IMAP_CMD)
2191 {
2192 int r_par=0;
2193 char ** r_par_names=NULL;
2194 if (r->cf->extRing!=NULL)
2195 {
2196 r_par=r->cf->extRing->N;
2197 r_par_names=r->cf->extRing->names;
2198 }
2199 int c_par=0;
2200 char ** c_par_names=NULL;
2201 if (currRing->cf->extRing!=NULL)
2202 {
2203 c_par=currRing->cf->extRing->N;
2204 c_par_names=currRing->cf->extRing->names;
2205 }
2206 if (!rIsLPRing(r))
2207 {
2208 maFindPerm(r->names, r->N, r_par_names, r_par,
2209 currRing->names,currRing->N,c_par_names, c_par,
2210 perm,par_perm, currRing->cf->type);
2211 }
2212 #ifdef HAVE_SHIFTBBA
2213 else
2214 {
2215 maFindPermLP(r->names, r->N, r_par_names, r_par,
2216 currRing->names,currRing->N,c_par_names, c_par,
2217 perm,par_perm, currRing->cf->type,r->isLPring);
2218 }
2219 #endif
2220 }
2221 else
2222 {
2223#ifdef HAVE_SHIFTBBA
2224 if (rIsLPRing(currRing))
2225 {
2226 maFetchPermLP(r, currRing, perm);
2227 }
2228 else
2229#endif
2230 {
2231 unsigned i;
2232 if (par_perm_size!=0)
2233 for(i=si_min(rPar(r),rPar(currRing));i>0;i--) par_perm[i-1]=-i;
2234 for(i=si_min(r->N,currRing->N);i>0;i--) perm[i]=i;
2235 }
2236 }
2237 }
2238 if ((iiOp==FETCH_CMD) && (BVERBOSE(V_IMAP)))
2239 {
2240 unsigned i;
2241 for(i=0;i<(unsigned)si_min(r->N,currRing->N);i++)
2242 {
2243 Print("// var nr %d: %s -> %s\n",i,r->names[i],currRing->names[i]);
2244 }
2245 for(i=0;i<(unsigned)si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
2246 {
2247 Print("// par nr %d: %s -> %s\n",
2249 }
2250 }
2251 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
2252 sleftv tmpW;
2253 tmpW.Init();
2254 tmpW.rtyp=IDTYP(w);
2255 tmpW.data=IDDATA(w);
2256 if ((bo=maApplyFetch(op,NULL,res,&tmpW, r,
2257 perm,par_perm,par_perm_size,nMap)))
2258 {
2259 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
2260 }
2261 if (perm!=NULL)
2262 omFreeSize((ADDRESS)perm,(r->N+1)*sizeof(int));
2263 if (par_perm!=NULL)
2264 omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
2265 return bo;
2266 }
2267 else
2268 {
2269 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
2270 }
2271 return TRUE;
2272err_fetch:
2273 char *s1=nCoeffString(r->cf);
2274 char *s2=nCoeffString(currRing->cf);
2275 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
2276 omFree(s2); omFree(s1);
2277 return TRUE;
2278}
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: coeffs.h:959
@ IMAP_CMD
Definition: grammar.cc:298
@ FETCH_CMD
Definition: grammar.cc:295
#define IDDATA(a)
Definition: ipid.h:126
#define IDTYP(a)
Definition: ipid.h:119
void maFetchPermLP(const ring preimage_r, const ring dst_r, int *perm)
Definition: maps.cc:306
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:163
void maFindPermLP(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch, int lV)
Definition: maps.cc:231
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:45
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define V_IMAP
Definition: options.h:52
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:600
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:626
@ ALIAS_CMD
Definition: tok.h:34

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7305 of file iparith.cc.

7306{
7307 ring r=(ring)u->Data();
7308 leftv v=u->next;
7309 leftv perm_var_l=v->next;
7310 leftv perm_par_l=v->next->next;
7311 if ((perm_var_l->Typ()!=INTVEC_CMD)
7312 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7313 ||(u->Typ()!=RING_CMD))
7314 {
7315 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7316 return TRUE;
7317 }
7318 intvec *perm_var_v=(intvec*)perm_var_l->Data();
7319 intvec *perm_par_v=NULL;
7320 if (perm_par_l!=NULL)
7321 perm_par_v=(intvec*)perm_par_l->Data();
7322 idhdl w;
7323 nMapFunc nMap;
7324
7325 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7326 {
7327 int *perm=NULL;
7328 int *par_perm=NULL;
7329 int par_perm_size=0;
7330 BOOLEAN bo;
7331 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7332 {
7333 // Allow imap/fetch to be make an exception only for:
7334 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7335 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7336 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7337 {
7338 par_perm_size=rPar(r);
7339 }
7340 else
7341 {
7342 goto err_fetch;
7343 }
7344 }
7345 else
7346 par_perm_size=rPar(r);
7347 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7348 if (par_perm_size!=0)
7349 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7350 int i;
7351 if (perm_par_l==NULL)
7352 {
7353 if (par_perm_size!=0)
7354 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7355 }
7356 else
7357 {
7358 if (par_perm_size==0) WarnS("source ring has no parameters");
7359 else
7360 {
7361 for(i=rPar(r)-1;i>=0;i--)
7362 {
7363 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7364 if ((par_perm[i]<-rPar(currRing))
7365 || (par_perm[i]>rVar(currRing)))
7366 {
7367 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7368 par_perm[i]=0;
7369 }
7370 }
7371 }
7372 }
7373 for(i=rVar(r)-1;i>=0;i--)
7374 {
7375 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7376 if ((perm[i]<-rPar(currRing))
7377 || (perm[i]>rVar(currRing)))
7378 {
7379 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7380 perm[i]=0;
7381 }
7382 }
7383 if (BVERBOSE(V_IMAP))
7384 {
7385 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7386 {
7387 if (perm[i]>0)
7388 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7389 else if (perm[i]<0)
7390 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7391 }
7392 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7393 {
7394 if (par_perm[i-1]<0)
7395 Print("// par nr %d: %s -> par %s\n",
7396 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7397 else if (par_perm[i-1]>0)
7398 Print("// par nr %d: %s -> var %s\n",
7399 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7400 }
7401 }
7402 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7403 sleftv tmpW;
7404 tmpW.Init();
7405 tmpW.rtyp=IDTYP(w);
7406 tmpW.data=IDDATA(w);
7407 if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7408 perm,par_perm,par_perm_size,nMap)))
7409 {
7410 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7411 }
7412 if (perm!=NULL)
7413 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7414 if (par_perm!=NULL)
7415 omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7416 return bo;
7417 }
7418 else
7419 {
7420 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7421 }
7422 return TRUE;
7423err_fetch:
7424 char *s1=nCoeffString(r->cf);
7425 char *s2=nCoeffString(currRing->cf);
7426 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7428 return TRUE;
7429}
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257

◆ jjFIND2()

static BOOLEAN jjFIND2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2279 of file iparith.cc.

2280{
2281 /*4
2282 * look for the substring what in the string where
2283 * return the position of the first char of what in where
2284 * or 0
2285 */
2286 char *where=(char *)u->Data();
2287 char *what=(char *)v->Data();
2288 char *found = strstr(where,what);
2289 if (found != NULL)
2290 {
2291 res->data=(char *)((found-where)+1);
2292 }
2293 /*else res->data=NULL;*/
2294 return FALSE;
2295}
bool found
Definition: facFactorize.cc:55

◆ jjFIND3()

static BOOLEAN jjFIND3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6068 of file iparith.cc.

6069{
6070 /*4
6071 * look for the substring what in the string where
6072 * starting at position n
6073 * return the position of the first char of what in where
6074 * or 0
6075 */
6076 int n=(int)(long)w->Data();
6077 char *where=(char *)u->Data();
6078 char *what=(char *)v->Data();
6079 char *found;
6080 if ((1>n)||(n>(int)strlen(where)))
6081 {
6082 Werror("start position %d out of range",n);
6083 return TRUE;
6084 }
6085 found = strchr(where+n-1,*what);
6086 if (*(what+1)!='\0')
6087 {
6088 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6089 {
6090 found=strchr(found+1,*what);
6091 }
6092 }
6093 if (found != NULL)
6094 {
6095 res->data=(char *)((found-where)+1);
6096 }
6097 return FALSE;
6098}

◆ jjFRES()

static BOOLEAN jjFRES ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2334 of file iparith.cc.

2335{
2337 w->rtyp = STRING_CMD;
2338 w->data = (char *)"complete"; // default
2339 BOOLEAN RES = jjFRES3(res, u, v, w);
2341 return RES;
2342}
static BOOLEAN jjFRES3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:2297

◆ jjFRES3()

static BOOLEAN jjFRES3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 2297 of file iparith.cc.

2298{
2299 assumeStdFlag(u);
2300 ideal id = (ideal)u->Data();
2301 int max_length = (int)(long)v->Data();
2302 if (max_length < 0)
2303 {
2304 WerrorS("length for fres must not be negative");
2305 return TRUE;
2306 }
2307 if (max_length == 0)
2308 {
2309 max_length = currRing->N+1;
2310 if (currRing->qideal != NULL)
2311 {
2312 Warn("full resolution in a qring may be infinite, "
2313 "setting max length to %d", max_length);
2314 }
2315 }
2316 char *method = (char *)w->Data();
2317 /* For the moment, only "complete" (default), "frame", or "extended frame"
2318 * are allowed. Another useful option would be "linear strand".
2319 */
2320 if (strcmp(method, "complete") != 0
2321 && strcmp(method, "frame") != 0
2322 && strcmp(method, "extended frame") != 0
2323 && strcmp(method, "single module") != 0)
2324 {
2325 WerrorS("wrong optional argument for fres");
2326 return TRUE;
2327 }
2328 syStrategy r = syFrank(id, max_length, method);
2329 assume(r->fullres != NULL);
2330 res->data = (void *)r;
2331 return FALSE;
2332}
resolvente fullres
Definition: syz.h:57
syStrategy syFrank(const ideal arg, const int length, const char *method, const bool use_cache=true, const bool use_tensor_trick=false)
Definition: syz4.cc:822

◆ jjFWALK()

static BOOLEAN jjFWALK ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2344 of file iparith.cc.

2345{
2346 res->data=(char *)fractalWalkProc(u,v);
2347 setFlag( res, FLAG_STD );
2348 return FALSE;
2349}
#define setFlag(A, F)
Definition: ipid.h:113
ideal fractalWalkProc(leftv first, leftv second)
Definition: walk_ip.cc:161

◆ jjFWALK3()

static BOOLEAN jjFWALK3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6099 of file iparith.cc.

6100{
6101 if ((int)(long)w->Data()==0)
6102 res->data=(char *)walkProc(u,v);
6103 else
6104 res->data=(char *)fractalWalkProc(u,v);
6105 setFlag( res, FLAG_STD );
6106 return FALSE;
6107}
ideal walkProc(leftv first, leftv second)
Definition: walk_ip.cc:55

◆ jjGCD_BI()

static BOOLEAN jjGCD_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2363 of file iparith.cc.

2364{
2365 number n1 = (number) u->Data();
2366 number n2 = (number) v->Data();
2367 res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2368 return FALSE;
2369}
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:664

◆ jjGCD_I()

static BOOLEAN jjGCD_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2350 of file iparith.cc.

2351{
2352 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2353 int p0=ABS(uu),p1=ABS(vv);
2354 int r;
2355 while ( p1!=0 )
2356 {
2357 r=p0 % p1;
2358 p0 = p1; p1 = r;
2359 }
2360 res->data=(char *)(long)p0;
2361 return FALSE;
2362}

◆ jjGCD_N()

static BOOLEAN jjGCD_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2370 of file iparith.cc.

2371{
2372 number a=(number) u->Data();
2373 number b=(number) v->Data();
2374 if (nIsZero(a))
2375 {
2376 if (nIsZero(b)) res->data=(char *)nInit(1);
2377 else res->data=(char *)nCopy(b);
2378 }
2379 else
2380 {
2381 if (nIsZero(b)) res->data=(char *)nCopy(a);
2382 //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2383 else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2384 }
2385 return FALSE;
2386}
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:666
#define nCopy(n)
Definition: numbers.h:15
#define nInit(i)
Definition: numbers.h:24

◆ jjGCD_P()

static BOOLEAN jjGCD_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2387 of file iparith.cc.

2388{
2389 res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2390 (poly)(v->CopyD(POLY_CMD)),currRing);
2391 return FALSE;
2392}
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
Definition: polys.cc:380

◆ jjGE_BI()

static BOOLEAN jjGE_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1168 of file iparith.cc.

1169{
1170 number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1171 res->data = (char *) (n_GreaterZero(h,coeffs_BIGINT)||(n_IsZero(h,coeffs_BIGINT)));
1173 return FALSE;
1174}
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition: coeffs.h:655

◆ jjGE_I()

static BOOLEAN jjGE_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1175 of file iparith.cc.

1176{
1177 res->data = (char *)(long)((int)((long)u->Data()) >= (int)((long)v->Data()));
1178 return FALSE;
1179}

◆ jjGE_N()

static BOOLEAN jjGE_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1180 of file iparith.cc.

1181{
1182 res->data = (char *)(long) (nGreater((number)u->Data(),(number)v->Data())
1183 || nEqual((number)u->Data(),(number)v->Data()));
1184 return FALSE;
1185}
#define nGreater(a, b)
Definition: numbers.h:28

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4178 of file iparith.cc.

4179{
4180 si_link l = (si_link)v->Data();
4181 if (slGetDump(l))
4182 {
4183 const char *s;
4184 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4185 else s=sNoName_fe;
4186 Werror("cannot get dump from `%s`",s);
4187 return TRUE;
4188 }
4189 else
4190 return FALSE;
4191}

◆ jjGT_BI()

static BOOLEAN jjGT_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1186 of file iparith.cc.

1187{
1188 number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1189 res->data = (char *)(long) (n_GreaterZero(h,coeffs_BIGINT)&&(!n_IsZero(h,coeffs_BIGINT)));
1191 return FALSE;
1192}

◆ jjGT_I()

static BOOLEAN jjGT_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1193 of file iparith.cc.

1194{
1195 res->data = (char *)(long)((int)((long)u->Data()) > (int)((long)v->Data()));
1196 return FALSE;
1197}

◆ jjGT_N()

static BOOLEAN jjGT_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1198 of file iparith.cc.

1199{
1200 res->data = (char *)(long)(nGreater((number)u->Data(),(number)v->Data()));
1201 return FALSE;
1202}

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4192 of file iparith.cc.

4193{
4195 ideal I=(ideal)v->Data();
4196 res->data=(void *)iiHighCorner(I,0);
4197 return FALSE;
4198}
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1610

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4199 of file iparith.cc.

4200{
4202 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4203 BOOLEAN delete_w=FALSE;
4204 ideal I=(ideal)v->Data();
4205 int i;
4206 poly p=NULL,po=NULL;
4207 int rk=id_RankFreeModule(I,currRing);
4208 if (w==NULL)
4209 {
4210 w = new intvec(rk);
4211 delete_w=TRUE;
4212 }
4213 for(i=rk;i>0;i--)
4214 {
4215 p=iiHighCorner(I,i);
4216 if (p==NULL)
4217 {
4218 WerrorS("module must be zero-dimensional");
4219 if (delete_w) delete w;
4220 return TRUE;
4221 }
4222 if (po==NULL)
4223 {
4224 po=p;
4225 }
4226 else
4227 {
4228 // now po!=NULL, p!=NULL
4229 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4230 if (d==0)
4231 d=pLmCmp(po,p);
4232 if (d > 0)
4233 {
4234 pDelete(&p);
4235 }
4236 else // (d < 0)
4237 {
4238 pDelete(&po); po=p;
4239 }
4240 }
4241 }
4242 if (delete_w) delete w;
4243 res->data=(void *)po;
4244 return FALSE;
4245}
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s

◆ jjHILBERT()

static BOOLEAN jjHILBERT ( leftv  ,
leftv  v 
)
static

Definition at line 4246 of file iparith.cc.

4247{
4248#ifdef HAVE_RINGS
4249 if (rField_is_Z(currRing))
4250 {
4251 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4252 PrintS("// performed for generic fibre, that is, over Q\n");
4253 }
4254#endif
4256 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4257 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4258 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4259 return FALSE;
4260}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1462

◆ jjHILBERT2()

static BOOLEAN jjHILBERT2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2393 of file iparith.cc.

2394{
2395#ifdef HAVE_RINGS
2396 if (rField_is_Z(currRing))
2397 {
2398 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2399 PrintS("// performed for generic fibre, that is, over Q\n");
2400 }
2401#endif
2402 assumeStdFlag(u);
2403 intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2404 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2405 if (errorreported) return TRUE;
2406
2407 switch((int)(long)v->Data())
2408 {
2409 case 1:
2410 res->data=(void *)iv;
2411 return FALSE;
2412 case 2:
2413 res->data=(void *)hSecondSeries(iv);
2414 delete iv;
2415 return FALSE;
2416 }
2417 delete iv;
2419 return TRUE;
2420}
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1383
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1373
const char feNotImplemented[]
Definition: reporter.cc:54

◆ jjHILBERT3()

static BOOLEAN jjHILBERT3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6108 of file iparith.cc.

6109{
6110 intvec *wdegree=(intvec*)w->Data();
6111 if (wdegree->length()!=currRing->N)
6112 {
6113 Werror("weight vector must have size %d, not %d",
6114 currRing->N,wdegree->length());
6115 return TRUE;
6116 }
6117#ifdef HAVE_RINGS
6118 if (rField_is_Z(currRing))
6119 {
6120 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6121 PrintS("// performed for generic fibre, that is, over Q\n");
6122 }
6123#endif
6124 assumeStdFlag(u);
6125 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6126 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
6127 if (errorreported) return TRUE;
6128
6129 switch((int)(long)v->Data())
6130 {
6131 case 1:
6132 res->data=(void *)iv;
6133 return FALSE;
6134 case 2:
6135 res->data=(void *)hSecondSeries(iv);
6136 delete iv;
6137 return FALSE;
6138 }
6139 delete iv;
6141 return TRUE;
6142}

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4261 of file iparith.cc.

4262{
4263#ifdef HAVE_RINGS
4264 if (rField_is_Z(currRing))
4265 {
4266 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4267 PrintS("// performed for generic fibre, that is, over Q\n");
4268 }
4269#endif
4270 res->data=(void *)hSecondSeries((intvec *)v->Data());
4271 return FALSE;
4272}

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4273 of file iparith.cc.

4274{
4275 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4276 ideal v_id=(ideal)v->Data();
4277 if (w==NULL)
4278 {
4279 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4280 if (res->data!=NULL)
4281 {
4282 if (v->rtyp==IDHDL)
4283 {
4284 char *s_isHomog=omStrDup("isHomog");
4285 if (v->e==NULL)
4286 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4287 else
4288 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4289 }
4290 else if (w!=NULL) delete w;
4291 } // if res->data==NULL then w==NULL
4292 }
4293 else
4294 {
4295 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4296 if((res->data==NULL) && (v->rtyp==IDHDL))
4297 {
4298 if (v->e==NULL)
4299 atKill((idhdl)(v->data),"isHomog");
4300 else
4301 atKill((idhdl)(v->LData()),"isHomog");
4302 }
4303 }
4304 return FALSE;
4305}
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:153
#define atKill(H, A)
Definition: attrib.h:49
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:2073
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96

◆ jjHOMOG1_W()

static BOOLEAN jjHOMOG1_W ( leftv  res,
leftv  v,
leftv  u 
)
static

Definition at line 2460 of file iparith.cc.

2461{
2462 intvec *w=new intvec(rVar(currRing));
2463 intvec *vw=(intvec*)u->Data();
2464 ideal v_id=(ideal)v->Data();
2465 pFDegProc save_FDeg=currRing->pFDeg;
2466 pLDegProc save_LDeg=currRing->pLDeg;
2467 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2468 currRing->pLexOrder=FALSE;
2469 kHomW=vw;
2470 kModW=w;
2472 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2473 currRing->pLexOrder=save_pLexOrder;
2474 kHomW=NULL;
2475 kModW=NULL;
2476 pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2477 if (w!=NULL) delete w;
2478 return FALSE;
2479}
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2420
VAR intvec * kHomW
Definition: kstd1.cc:2408
VAR intvec * kModW
Definition: kstd1.cc:2408
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3727
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3715
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:38
long(* pLDegProc)(poly p, int *length, ring r)
Definition: ring.h:37

◆ jjHOMOG_ID()

static BOOLEAN jjHOMOG_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2438 of file iparith.cc.

2439{
2440 int i=pVar((poly)v->Data());
2441 if (i==0)
2442 {
2443 WerrorS("ringvar expected");
2444 return TRUE;
2445 }
2446 pFDegProc deg;
2447 if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2448 deg=p_Totaldegree;
2449 else
2450 deg=currRing->pFDeg;
2451 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2452 int d=deg(p,currRing);
2453 pLmDelete(p);
2454 if (d==1)
2455 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2456 else
2457 WerrorS("variable must have weight 1");
2458 return (d!=1);
2459}
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1507
@ ringorder_lp
Definition: ring.h:77
ideal id_Homogen(ideal h, int varnum, const ring r)

◆ jjHOMOG_ID_W()

static BOOLEAN jjHOMOG_ID_W ( leftv  res,
leftv  u,
leftv  v,
leftv   
)
static

Definition at line 6143 of file iparith.cc.

6144{
6145 PrintS("TODO\n");
6146 int i=pVar((poly)v->Data());
6147 if (i==0)
6148 {
6149 WerrorS("ringvar expected");
6150 return TRUE;
6151 }
6152 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6153 int d=pWTotaldegree(p);
6154 pLmDelete(p);
6155 if (d==1)
6156 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6157 else
6158 WerrorS("variable must have weight 1");
6159 return (d!=1);
6160}
#define pWTotaldegree(p)
Definition: polys.h:283

◆ jjHOMOG_P()

static BOOLEAN jjHOMOG_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2421 of file iparith.cc.

2422{
2423 int i=pVar((poly)v->Data());
2424 if (i==0)
2425 {
2426 WerrorS("ringvar expected");
2427 return TRUE;
2428 }
2429 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2430 int d=pWTotaldegree(p);
2431 pLmDelete(p);
2432 if (d==1)
2433 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2434 else
2435 WerrorS("variable must have weight 1");
2436 return (d!=1);
2437}
poly p_Homogen(poly p, int varnum, const ring r)
Definition: p_polys.cc:3335

◆ jjHOMOG_P_W()

static BOOLEAN jjHOMOG_P_W ( leftv  res,
leftv  u,
leftv  v,
leftv   
)
static

Definition at line 6161 of file iparith.cc.

6162{
6163 PrintS("TODO\n");
6164 int i=pVar((poly)v->Data());
6165 if (i==0)
6166 {
6167 WerrorS("ringvar expected");
6168 return TRUE;
6169 }
6170 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6171 int d=pWTotaldegree(p);
6172 pLmDelete(p);
6173 if (d==1)
6174 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6175 else
6176 WerrorS("variable must have weight 1");
6177 return (d!=1);
6178}

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4323 of file iparith.cc.

4324{
4325 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4326 IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4327 if (IDELEMS((ideal)mat)==0)
4328 {
4329 idDelete((ideal *)&mat);
4330 mat=(matrix)idInit(1,1);
4331 }
4332 else
4333 {
4334 MATROWS(mat)=1;
4335 mat->rank=1;
4336 idTest((ideal)mat);
4337 }
4338 res->data=(char *)mat;
4339 return FALSE;
4340}

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4341 of file iparith.cc.

4342{
4343 map m=(map)v->CopyD(MAP_CMD);
4344 omFreeBinAddr((ADDRESS)m->preimage);
4345 m->preimage=NULL;
4346 ideal I=(ideal)m;
4347 I->rank=1;
4348 res->data=(char *)I;
4349 return FALSE;
4350}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:504

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7261 of file iparith.cc.

7262{
7263 int s=1;
7264 leftv h=v;
7265 if (h!=NULL) s=exprlist_length(h);
7266 ideal id=idInit(s,1);
7267 int rank=1;
7268 int i=0;
7269 poly p;
7270 int dest_type=POLY_CMD;
7271 if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7272 while (h!=NULL)
7273 {
7274 // use standard type conversions to poly/vector
7275 int ri;
7276 int ht=h->Typ();
7277 if (ht==dest_type)
7278 {
7279 p=(poly)h->CopyD();
7280 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7281 }
7282 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7283 {
7284 sleftv tmp;
7285 leftv hnext=h->next;
7286 h->next=NULL;
7287 iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7288 h->next=hnext;
7289 p=(poly)tmp.data;
7290 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7291 }
7292 else
7293 {
7294 idDelete(&id);
7295 return TRUE;
7296 }
7297 id->m[i]=p;
7298 i++;
7299 h=h->next;
7300 }
7301 id->rank=rank;
7302 res->data=(char *)id;
7303 return FALSE;
7304}
int exprlist_length(leftv v)
Definition: ipshell.cc:552

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4351 of file iparith.cc.

4352{
4353 if (currRing!=NULL)
4354 {
4355 ring q=(ring)v->Data();
4356 if (rSamePolyRep(currRing, q))
4357 {
4358 if (q->qideal==NULL)
4359 res->data=(char *)idInit(1,1);
4360 else
4361 res->data=(char *)idCopy(q->qideal);
4362 return FALSE;
4363 }
4364 }
4365 WerrorS("can only get ideal from identical qring");
4366 return TRUE;
4367}
ideal idCopy(ideal A)
Definition: ideals.h:60
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1799

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5579 of file iparith.cc.

5580{
5581 res->data = (char *)(long)idElem((ideal)v->Data());
5582 return FALSE;
5583}
int idElem(const ideal F)
count non-zero elements

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5584 of file iparith.cc.

5585{
5586 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5587 return FALSE;
5588}
ideal id_FreeModule(int i, const ring r)
the free module of rank i

◆ jjidHead()

static BOOLEAN jjidHead ( leftv  res,
leftv  v 
)
static

Definition at line 5604 of file iparith.cc.

5605{
5606 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5608 return FALSE;
5609}
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms

◆ jjidMaxIdeal()

static BOOLEAN jjidMaxIdeal ( leftv  res,
leftv  v 
)
static

Definition at line 4306 of file iparith.cc.

4307{
4308#ifdef HAVE_SHIFTBBA
4309 if (rIsLPRing(currRing))
4310 {
4311 int deg = (int)(long)v->Data();
4312 if (deg > currRing->N/currRing->isLPring)
4313 {
4314 WerrorS("degree bound of Letterplace ring is to small");
4315 return TRUE;
4316 }
4317 }
4318#endif
4319 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4321 return FALSE;
4322}
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33

◆ jjidMinBase()

static BOOLEAN jjidMinBase ( leftv  res,
leftv  v 
)
static

Definition at line 5610 of file iparith.cc.

5611{
5612 res->data = (char *)idMinBase((ideal)v->Data());
5613 return FALSE;
5614}
ideal idMinBase(ideal h1)
Definition: ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5662 of file iparith.cc.

5663{
5664 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5665 return FALSE;
5666}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5589 of file iparith.cc.

5590{
5591 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5592 return FALSE;
5593}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4368 of file iparith.cc.

4369{
4370 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4371 iv->makeVector();
4372 res->data = iv;
4373 return FALSE;
4374}
void makeVector()
Definition: intvec.h:102
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4375 of file iparith.cc.

4376{
4377 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4378 return FALSE;
4379}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:793

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4380 of file iparith.cc.

4381{
4383 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4384 return FALSE;
4385}
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:285

◆ jjINDEPSET2()

static BOOLEAN jjINDEPSET2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2480 of file iparith.cc.

2481{
2482 assumeStdFlag(u);
2483 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2484 currRing->qideal);
2485 return FALSE;
2486}
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1103

◆ jjINDEX_I()

static BOOLEAN jjINDEX_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1392 of file iparith.cc.

1393{
1394 res->rtyp=u->rtyp; u->rtyp=0;
1395 res->data=u->data; u->data=NULL;
1396 res->name=u->name; u->name=NULL;
1397 res->e=u->e; u->e=NULL;
1398 if (res->e==NULL) res->e=jjMakeSub(v);
1399 else
1400 {
1401 Subexpr sh=res->e;
1402 while (sh->next != NULL) sh=sh->next;
1403 sh->next=jjMakeSub(v);
1404 }
1405 if (u->next!=NULL)
1406 {
1408 BOOLEAN bo=iiExprArith2(rn,u->next,iiOp,v);
1409 res->next=rn;
1410 return bo;
1411 }
1412 return FALSE;
1413}

◆ jjINDEX_IV()

static BOOLEAN jjINDEX_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1414 of file iparith.cc.

1415{
1416 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
1417 {
1418 WerrorS("indexed object must have a name");
1419 return TRUE;
1420 }
1421 intvec * iv=(intvec *)v->Data();
1422 leftv p=NULL;
1423 int i;
1424 sleftv t;
1425 t.Init();
1426 t.rtyp=INT_CMD;
1427 for (i=0;i<iv->length(); i++)
1428 {
1429 t.data=(char *)((long)(*iv)[i]);
1430 if (p==NULL)
1431 {
1432 p=res;
1433 }
1434 else
1435 {
1436 p->next=(leftv)omAlloc0Bin(sleftv_bin);
1437 p=p->next;
1438 }
1439 p->rtyp=IDHDL;
1440 p->data=u->data;
1441 p->name=u->name;
1442 p->flag=u->flag;
1443 p->e=jjMakeSub(&t);
1444 }
1445 u->rtyp=0;
1446 u->data=NULL;
1447 u->name=NULL;
1448 return FALSE;
1449}
BITSET flag
Definition: subexpr.h:90

◆ jjINDEX_P()

static BOOLEAN jjINDEX_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1450 of file iparith.cc.

1451{
1452 poly p=(poly)u->Data();
1453 int i=(int)(long)v->Data();
1454 int j=0;
1455 while (p!=NULL)
1456 {
1457 j++;
1458 if (j==i)
1459 {
1460 res->data=(char *)pHead(p);
1461 return FALSE;
1462 }
1463 pIter(p);
1464 }
1465 return FALSE;
1466}
#define pIter(p)
Definition: monomials.h:37
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67

◆ jjINDEX_P_IV()

static BOOLEAN jjINDEX_P_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1490 of file iparith.cc.

1491{
1492 poly p=(poly)u->Data();
1493 poly r=NULL;
1494 intvec *iv=(intvec *)v->CopyD(INTVEC_CMD);
1495 int i;
1496 int sum=0;
1497 for(i=iv->length()-1;i>=0;i--)
1498 sum+=(*iv)[i];
1499 int j=0;
1500 while ((p!=NULL) && (sum>0))
1501 {
1502 j++;
1503 for(i=iv->length()-1;i>=0;i--)
1504 {
1505 if (j==(*iv)[i])
1506 {
1507 r=pAdd(r,pHead(p));
1508 sum-=j;
1509 (*iv)[i]=0;
1510 break;
1511 }
1512 }
1513 pIter(p);
1514 }
1515 delete iv;
1516 res->data=(char *)r;
1517 return FALSE;
1518}

◆ jjINDEX_PBu()

static BOOLEAN jjINDEX_PBu ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1467 of file iparith.cc.

1468{
1471 int l; poly p,pp;
1472 sBucketDestroyAdd(b, &pp, &l);
1473 int i=(int)(long)v->Data();
1474 int j=0;
1475 p=pp;
1476 while (p!=NULL)
1477 {
1478 j++;
1479 if (j==i)
1480 {
1481 res->data=(char *)pHead(p);
1483 return FALSE;
1484 }
1485 pIter(p);
1486 }
1488 return FALSE;
1489}
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
void sBucketCanonicalize(sBucket_pt bucket)
Definition: sbuckets.cc:401
sBucket * sBucket_pt
Definition: sbuckets.h:16
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68

◆ jjINDEX_V()

static BOOLEAN jjINDEX_V ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1519 of file iparith.cc.

1520{
1521 poly p=(poly)u->Data();
1522 int i=(int)(long)v->Data();
1523 res->data=(char *)p_Vec2Poly(p,i,currRing);
1524 return FALSE;
1525}
poly p_Vec2Poly(poly v, int k, const ring r)
Definition: p_polys.cc:3651

◆ jjINDEX_V_IV()

static BOOLEAN jjINDEX_V_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1526 of file iparith.cc.

1527{
1528 poly p=(poly)u->CopyD(VECTOR_CMD);
1529 if (p!=NULL)
1530 {
1531 poly r=pOne();
1532 poly hp=r;
1533 intvec *iv=(intvec *)v->Data();
1534 int i;
1535 loop
1536 {
1537 for(i=0;i<iv->length();i++)
1538 {
1539 if (((int)pGetComp(p))==(*iv)[i])
1540 {
1541 poly h;
1542 pSplit(p,&h);
1543 pNext(hp)=p;
1544 p=h;
1545 pIter(hp);
1546 break;
1547 }
1548 }
1549 if (p==NULL) break;
1550 if (i==iv->length())
1551 {
1552 pLmDelete(&p);
1553 if (p==NULL) break;
1554 }
1555 }
1556 pLmDelete(&r);
1557 res->data=(char *)r;
1558 }
1559 return FALSE;
1560}
#define pSplit(p, r)
Definition: polys.h:265

◆ jjINTERPOLATION()

static BOOLEAN jjINTERPOLATION ( leftv  res,
leftv  l,
leftv  v 
)
static

Definition at line 2493 of file iparith.cc.

2494{
2495 const lists L = (lists)l->Data();
2496 const int n = L->nr; assume (n >= 0);
2497 std::vector<ideal> V(n + 1);
2498
2499 for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2500
2501 res->data=interpolation(V, (intvec*)v->Data());
2503 return errorreported;
2504}
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4386 of file iparith.cc.

4387{
4388 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4389#ifdef HAVE_RINGS
4391 WarnS("interred: this command is experimental over the integers");
4392#endif
4393 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4394 res->data = result;
4395 return FALSE;
4396}
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3743
#define TEST_OPT_PROT
Definition: options.h:103
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:58

◆ jjINTERSEC3S()

static BOOLEAN jjINTERSEC3S ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6206 of file iparith.cc.

6207{
6208 ideal I=(ideal)u->Data();
6209 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6210 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6212 return FALSE;
6213}
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:316
#define TEST_OPT_RETURN_SB
Definition: options.h:112

◆ jjINTERSECT()

static BOOLEAN jjINTERSECT ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2487 of file iparith.cc.

2488{
2489 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2491 return FALSE;
2492}

◆ jjINTERSECT3()

static BOOLEAN jjINTERSECT3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6193 of file iparith.cc.

6194{
6195 ideal I1=(ideal)u->Data();
6196 ideal I2=(ideal)v->Data();
6197 ideal I3=(ideal)w->Data();
6198 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6199 r[0]=I1;
6200 r[1]=I2;
6201 r[2]=I3;
6202 res->data=(char *)idMultSect(r,3);
6203 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6204 return FALSE;
6205}
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition: ideals.cc:472
ideal * resolvente
Definition: ideals.h:18

◆ jjINTERSECT_PL()

static BOOLEAN jjINTERSECT_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7430 of file iparith.cc.

7431{
7432 leftv h=v;
7433 int l=v->listLength();
7434 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7435 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7436 int t=0;
7437 // try to convert to IDEAL_CMD
7438 while (h!=NULL)
7439 {
7440 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7441 {
7442 t=IDEAL_CMD;
7443 }
7444 else break;
7445 h=h->next;
7446 }
7447 // if failure, try MODUL_CMD
7448 if (t==0)
7449 {
7450 h=v;
7451 while (h!=NULL)
7452 {
7453 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7454 {
7455 t=MODUL_CMD;
7456 }
7457 else break;
7458 h=h->next;
7459 }
7460 }
7461 // check for success in converting
7462 if (t==0)
7463 {
7464 WerrorS("cannot convert to ideal or module");
7465 return TRUE;
7466 }
7467 // call idMultSect
7468 h=v;
7469 int i=0;
7470 sleftv tmp;
7471 while (h!=NULL)
7472 {
7473 if (h->Typ()==t)
7474 {
7475 r[i]=(ideal)h->Data(); /*no copy*/
7476 h=h->next;
7477 }
7478 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7479 {
7480 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7481 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7482 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7483 return TRUE;
7484 }
7485 else
7486 {
7487 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7488 copied[i]=TRUE;
7489 h=tmp.next;
7490 }
7491 i++;
7492 }
7493 res->rtyp=t;
7494 res->data=(char *)idMultSect(r,i);
7495 while(i>0)
7496 {
7497 i--;
7498 if (copied[i]) idDelete(&(r[i]));
7499 }
7500 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7501 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7502 return FALSE;
7503}

◆ jjINTMAT3()

static BOOLEAN jjINTMAT3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6179 of file iparith.cc.

6180{
6181 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6182 intvec* arg = (intvec*) u->Data();
6183 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6184
6185 for (i=0; i<n; i++)
6186 {
6187 (*im)[i] = (*arg)[i];
6188 }
6189
6190 res->data = (char *)im;
6191 return FALSE;
6192}

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7666 of file iparith.cc.

7667{
7668 int i=0;
7669 leftv h=v;
7670 if (h!=NULL) i=exprlist_length(h);
7671 intvec *iv=new intvec(i);
7672 i=0;
7673 while (h!=NULL)
7674 {
7675 if(h->Typ()==INT_CMD)
7676 {
7677 (*iv)[i]=(int)(long)h->Data();
7678 }
7679 else if (h->Typ()==INTVEC_CMD)
7680 {
7681 intvec *ivv=(intvec*)h->Data();
7682 for(int j=0;j<ivv->length();j++,i++)
7683 {
7684 (*iv)[i]=(*ivv)[j];
7685 }
7686 i--;
7687 }
7688 else
7689 {
7690 delete iv;
7691 return TRUE;
7692 }
7693 i++;
7694 h=h->next;
7695 }
7696 res->data=(char *)iv;
7697 return FALSE;
7698}

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4408 of file iparith.cc.

4409{
4410 res->data = (char *)0;
4411 return FALSE;
4412}

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4397 of file iparith.cc.

4398{
4399 res->data = (char *)(long)pVar((poly)v->Data());
4400 return FALSE;
4401}

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4402 of file iparith.cc.

4403{
4404 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4405 currRing->N)+1);
4406 return FALSE;
4407}
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:212

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv  res,
leftv  a 
)
static

Definition at line 4444 of file iparith.cc.

4445{
4446 ideal id = (ideal)a->Data();
4447 id = id_Transp(id,currRing);
4448 int W = IDELEMS(id);
4449
4450 ideal result = idInit(W * currRing->N, id->rank);
4451 poly *p = result->m;
4452
4453 for( int v = 1; v <= currRing->N; v++ )
4454 {
4455 poly* q = id->m;
4456 for( int i = 0; i < W; i++, p++, q++ )
4457 *p = pDiff( *q, v );
4458 }
4459 idDelete(&id);
4460
4461 res->data = (char *)result;
4462 return FALSE;
4463}

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4413 of file iparith.cc.

4414{
4415 ideal i=idInit(currRing->N,1);
4416 int k;
4417 poly p=(poly)(v->Data());
4418 for (k=currRing->N;k>0;k--)
4419 {
4420 i->m[k-1]=pDiff(p,k);
4421 }
4422 res->data = (char *)i;
4423 return FALSE;
4424}

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2511 of file iparith.cc.

2512{
2513 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2514 return jjStdJanetBasis(res,v,0);
2515}
BOOLEAN jjStdJanetBasis(leftv res, leftv v, int flag)
flag: 0: JB, 1: SB
Definition: wrapper.cc:50

◆ jjJanetBasis2()

static BOOLEAN jjJanetBasis2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2505 of file iparith.cc.

2506{
2507 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2508 return jjStdJanetBasis(res,u,(int)(long)v->Data());
2509}

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7699 of file iparith.cc.

7700{
7701 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7702 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7703 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7704 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7705 leftv u1=u;
7706 leftv u2=u1->next;
7707 leftv u3=u2->next;
7708 leftv u4=u3->next;
7709 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7710 {
7711 if(!pIsUnit((poly)u2->Data()))
7712 {
7713 WerrorS("2nd argument must be a unit");
7714 return TRUE;
7715 }
7716 res->rtyp=u1->Typ();
7717 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7718 pCopy((poly)u2->Data()),(intvec*)u4->Data());
7719 return FALSE;
7720 }
7721 else
7722 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7723 {
7724 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7725 {
7726 WerrorS("2nd argument must be a diagonal matrix of units");
7727 return TRUE;
7728 }
7729 res->rtyp=u1->Typ();
7730 res->data=(char*)idSeries(
7731 (int)(long)u3->Data(),
7732 idCopy((ideal)u1->Data()),
7733 mp_Copy((matrix)u2->Data(), currRing),
7734 (intvec*)u4->Data()
7735 );
7736 return FALSE;
7737 }
7738 else
7739 {
7740 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7741 Tok2Cmdname(iiOp));
7742 return TRUE;
7743 }
7744}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2125
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition: matpol.cc:816
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition: polys.h:240
#define pSeries(n, p, u, w)
Definition: polys.h:372

◆ jjJET_ID()

static BOOLEAN jjJET_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2521 of file iparith.cc.

2522{
2523 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2524 return FALSE;
2525}
ideal id_Jet(const ideal i, int d, const ring R)

◆ jjJET_ID_IV()

static BOOLEAN jjJET_ID_IV ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6231 of file iparith.cc.

6232{
6233 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6234 (intvec *)w->Data(),currRing);
6235 return FALSE;
6236}
ideal id_JetW(const ideal i, int d, intvec *iv, const ring R)

◆ jjJET_ID_M()

static BOOLEAN jjJET_ID_M ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6237 of file iparith.cc.

6238{
6239 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6240 {
6241 WerrorS("2nd argument must be a diagonal matrix of units");
6242 return TRUE;
6243 }
6244 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6245 (matrix)v->CopyD());
6246 return FALSE;
6247}

◆ jjJET_P()

static BOOLEAN jjJET_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2516 of file iparith.cc.

2517{
2518 res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2519 return FALSE;
2520}
#define pJet(p, m)
Definition: polys.h:368

◆ jjJET_P_IV()

static BOOLEAN jjJET_P_IV ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6214 of file iparith.cc.

6215{
6216 int *iw=iv2array((intvec *)w->Data(),currRing);
6217 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6218 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6219 return FALSE;
6220}
#define ppJetW(p, m, iv)
Definition: polys.h:369

◆ jjJET_P_P()

static BOOLEAN jjJET_P_P ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6221 of file iparith.cc.

6222{
6223 if (!pIsUnit((poly)v->Data()))
6224 {
6225 WerrorS("2nd argument must be a unit");
6226 return TRUE;
6227 }
6228 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6229 return FALSE;
6230}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4563

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4475 of file iparith.cc.

4476{
4478 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4479 return FALSE;
4480}
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1427

◆ jjKBASE2()

static BOOLEAN jjKBASE2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2526 of file iparith.cc.

2527{
2528 assumeStdFlag(u);
2529 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2530 res->data = (char *)scKBase((int)(long)v->Data(),
2531 (ideal)(u->Data()),currRing->qideal, w_u);
2532 if (w_u!=NULL)
2533 {
2534 atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2535 }
2536 return FALSE;
2537}
intvec * ivCopy(const intvec *o)
Definition: intvec.h:135

◆ jjKERNEL()

static BOOLEAN jjKERNEL ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2539 of file iparith.cc.

2540{
2541 return jjPREIMAGE(res,u,v,NULL);
2542}
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6454

◆ jjKERNEL_M()

static BOOLEAN jjKERNEL_M ( leftv  res,
leftv  v 
)
static

Definition at line 4465 of file iparith.cc.

4466{
4467 res->data = (char *)singflint_kernel((matrix)(v->Data()),currRing);
4468 return res->data==NULL;
4469}
matrix singflint_kernel(matrix m, const ring R)

◆ jjKERNEL_SM()

static BOOLEAN jjKERNEL_SM ( leftv  res,
leftv  v 
)
static

Definition at line 4470 of file iparith.cc.

4471{
4472 res->data = (char *)singflint_kernel((ideal)(v->Data()),currRing);
4473 return res->data==NULL;
4474}

◆ jjKLAMMER()

static BOOLEAN jjKLAMMER ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1562 of file iparith.cc.

1563{
1564 if(u->name==NULL) return TRUE;
1565 long slen = strlen(u->name) + 14;
1566 char *nn = (char*) omAlloc(slen);
1567 sprintf(nn,"%s(%d)",u->name,(int)(long)v->Data());
1568 char *n=omStrDup(nn);
1569 omFreeSize((ADDRESS)nn,slen);
1570 syMake(res,n);
1571 if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1572 return FALSE;
1573}
static BOOLEAN jjKLAMMER_rest(leftv res, leftv u, leftv v)
Definition: iparith.cc:1601

◆ jjKLAMMER_IV()

static BOOLEAN jjKLAMMER_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1574 of file iparith.cc.

1575{
1576 if(u->name==NULL) return TRUE;
1577 intvec * iv=(intvec *)v->Data();
1578 leftv p=NULL;
1579 int i;
1580 long slen = strlen(u->name) + 14;
1581 char *n = (char*) omAlloc(slen);
1582
1583 for (i=0;i<iv->length(); i++)
1584 {
1585 if (p==NULL)
1586 {
1587 p=res;
1588 }
1589 else
1590 {
1591 p->next=(leftv)omAlloc0Bin(sleftv_bin);
1592 p=p->next;
1593 }
1594 sprintf(n,"%s(%d)",u->name,(*iv)[i]);
1595 syMake(p,omStrDup(n));
1596 }
1597 omFreeSize(n, slen);
1598 if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1599 return FALSE;
1600}

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7782 of file iparith.cc.

7783{
7785 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7786 {
7787 memcpy(res,u,sizeof(sleftv));
7788 u->Init();
7789 return FALSE;
7790 }
7791 leftv v=u->next;
7792 BOOLEAN b;
7793 if(v==NULL) // p()
7795 else if ((v->next==NULL) // p(1)
7796 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7797 {
7798 u->next=NULL;
7799 b=iiExprArith2(res,u,iiOp,v);
7800 u->next=v;
7801 }
7802 else // p(1,2), p undefined
7803 {
7804 if (v->Typ()!=INT_CMD)
7805 {
7806 Werror("`int` expected while building `%s(`",u->name);
7807 return TRUE;
7808 }
7809 int l=u->listLength();
7810 char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7811 sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7812 char *s=nn;
7813 do
7814 {
7815 while (*s!='\0') s++;
7816 v=v->next;
7817 if (v->Typ()!=INT_CMD)
7818 {
7819 Werror("`int` expected while building `%s`",nn);
7820 omFree((ADDRESS)nn);
7821 return TRUE;
7822 }
7823 sprintf(s,",%d",(int)(long)v->Data());
7824 } while (v->next!=NULL);
7825 while (*s!='\0') s++;
7826 nn=strcat(nn,")");
7827 char *n=omStrDup(nn);
7828 omFree((ADDRESS)nn);
7829 syMake(res,n);
7830 b=FALSE;
7831 }
7832 return b;
7833}
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

static BOOLEAN jjKLAMMER_rest ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1601 of file iparith.cc.

1602{
1604 BOOLEAN b;
1605 if (v->Typ()==INTVEC_CMD)
1606 b=jjKLAMMER_IV(tmp,u,v);
1607 else
1608 b=jjKLAMMER(tmp,u,v);
1609 if (b)
1610 {
1611 omFreeBin(tmp,sleftv_bin);
1612 return TRUE;
1613 }
1614 leftv h=res;
1615 while (h->next!=NULL) h=h->next;
1616 h->next=tmp;
1617 return FALSE;
1618}
static BOOLEAN jjKLAMMER_IV(leftv res, leftv u, leftv v)
Definition: iparith.cc:1574
static BOOLEAN jjKLAMMER(leftv res, leftv u, leftv v)
Definition: iparith.cc:1562

◆ jjKoszul()

static BOOLEAN jjKoszul ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2543 of file iparith.cc.

2544{
2545 return mpKoszul(res, u,v,NULL);
2546}
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3096

◆ jjKoszul_Id()

static BOOLEAN jjKoszul_Id ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2547 of file iparith.cc.

2548{
2549 sleftv h;
2550 h.Init();
2551 h.rtyp=INT_CMD;
2552 h.data=(void *)(long)IDELEMS((ideal)v->Data());
2553 return mpKoszul(res, u, &h, v);
2554}

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4481 of file iparith.cc.

4482{
4483 res->data=(char *)syConvList((lists)v->Data());
4484 if (res->data != NULL)
4485 return FALSE;
4486 else
4487 return TRUE;
4488}
syStrategy syConvList(lists li)
Definition: ipshell.cc:3259

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4558 of file iparith.cc.

4559{
4560 sleftv a2,a3;
4561 memset(&a2,0,sizeof(a2));
4562 memset(&a3,0,sizeof(a3));
4563 a2.rtyp=INT_CMD; a2.data=(void*)10;
4564 a3.rtyp=INT_CMD; a3.data=(void*)1;
4565 return nuLagSolve(res,v,&a2,&a3);
4566}
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
Definition: ipshell.cc:4681

◆ jjLE_BI()

static BOOLEAN jjLE_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1203 of file iparith.cc.

1204{
1205 return jjGE_BI(res,v,u);
1206}
static BOOLEAN jjGE_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1168

◆ jjLE_I()

static BOOLEAN jjLE_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1207 of file iparith.cc.

1208{
1209 res->data = (char *)(long)((int)((long)u->Data()) <= (int)((long)v->Data()));
1210 return FALSE;
1211}

◆ jjLE_N()

static BOOLEAN jjLE_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1212 of file iparith.cc.

1213{
1214 return jjGE_N(res,v,u);
1215}
static BOOLEAN jjGE_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1180

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4489 of file iparith.cc.

4490{
4491 poly p=(poly)v->Data();
4492 if (p==NULL)
4493 {
4494 res->data=(char *)nInit(0);
4495 }
4496 else
4497 {
4499 res->data=(char *)nCopy(pGetCoeff(p));
4500 }
4501 return FALSE;
4502}

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4503 of file iparith.cc.

4504{
4505 poly p=(poly)v->Data();
4506 int s=currRing->N;
4507 if (v->Typ()==VECTOR_CMD) s++;
4508 intvec *iv=new intvec(s);
4509 if (p!=NULL)
4510 {
4511 for(int i = currRing->N;i;i--)
4512 {
4513 (*iv)[i-1]=pGetExp(p,i);
4514 }
4515 if (s!=currRing->N)
4516 (*iv)[currRing->N]=pGetComp(p);
4517 }
4518 res->data=(char *)iv;
4519 return FALSE;
4520}
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4521 of file iparith.cc.

4522{
4523 poly p=(poly)v->Data();
4524 if (p == NULL)
4525 {
4526 res->data = (char*) NULL;
4527 }
4528 else
4529 {
4530 poly lm = pLmInit(p);
4531 pSetCoeff0(lm, nInit(1));
4532 res->data = (char*) lm;
4533 }
4534 return FALSE;
4535}
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64

◆ jjLIFT()

static BOOLEAN jjLIFT ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2555 of file iparith.cc.

2556{
2557 int ul= IDELEMS((ideal)u->Data());
2558 int vl= IDELEMS((ideal)v->Data());
2559#ifdef HAVE_SHIFTBBA
2560 if (rIsLPRing(currRing))
2561 {
2562 if (currRing->LPncGenCount < ul)
2563 {
2564 Werror("At least %d ncgen variables are needed for this computation.", ul);
2565 return TRUE;
2566 }
2567 }
2568#endif
2569 ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2570 hasFlag(u,FLAG_STD));
2571 if (m==NULL) return TRUE;
2572 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2573 return FALSE;
2574}

◆ jjLIFT3()

static BOOLEAN jjLIFT3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6894 of file iparith.cc.

6895{
6896 if (w->rtyp!=IDHDL) return TRUE;
6897 int ul= IDELEMS((ideal)u->Data());
6898 int vl= IDELEMS((ideal)v->Data());
6899#ifdef HAVE_SHIFTBBA
6900 if (rIsLPRing(currRing))
6901 {
6902 if (currRing->LPncGenCount < ul)
6903 {
6904 Werror("At least %d ncgen variables are needed for this computation.", ul);
6905 return TRUE;
6906 }
6907 }
6908#endif
6909 ideal m
6910 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6911 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6912 if (m==NULL) return TRUE;
6913 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6914 return FALSE;
6915}
#define IDMATRIX(a)
Definition: ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7834 of file iparith.cc.

7835{
7836 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7837 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7838 leftv u=U;
7839 leftv v=u->next;
7840 leftv w=v->next;
7841 leftv u4=w->next;
7842 if (w->rtyp!=IDHDL) return TRUE;
7843 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7844 {
7845 // see jjLIFT3
7846 ideal I=(ideal)u->Data();
7847 int ul= IDELEMS(I /*(ideal)u->Data()*/);
7848 int vl= IDELEMS((ideal)v->Data());
7849 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7850 ideal m
7851 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7852 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7853 if (m==NULL) return TRUE;
7854 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7855 return FALSE;
7856 }
7857 else
7858 {
7859 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7860 "or (`module`,`module`,`matrix`,`string`) expected",
7861 Tok2Cmdname(iiOp));
7862 return TRUE;
7863 }
7864}

◆ jjLIFTSTD()

static BOOLEAN jjLIFTSTD ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2575 of file iparith.cc.

2576{
2577 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2578 idhdl h=(idhdl)v->data;
2579#ifdef HAVE_SHIFTBBA
2581 {
2582 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2583 {
2584 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2585 return TRUE;
2586 }
2587 }
2588#endif
2589 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2590 res->data = (char *)idLiftStd((ideal)u->Data(),
2591 &(h->data.umatrix),testHomog);
2592 setFlag(res,FLAG_STD); v->flag=0;
2593 return FALSE;
2594}
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition: ideals.cc:976

◆ jjLIFTSTD_ALG()

static BOOLEAN jjLIFTSTD_ALG ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6939 of file iparith.cc.

6940{
6941 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6942 idhdl hv=(idhdl)v->data;
6943 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
6944#ifdef HAVE_SHIFTBBA
6945 if (rIsLPRing(currRing))
6946 {
6947 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6948 {
6949 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6950 return TRUE;
6951 }
6952 }
6953#endif
6954 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6955 res->data = (char *)idLiftStd((ideal)u->Data(),
6956 &(hv->data.umatrix),testHomog,
6957 NULL,alg);
6958 setFlag(res,FLAG_STD); v->flag=0;
6959 return FALSE;
6960}

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 7865 of file iparith.cc.

7866{
7867 // we have 4 or 5 arguments
7868 leftv u=U;
7869 leftv v=u->next;
7870 leftv u3=v->next;
7871 leftv u4=u3->next;
7872 leftv u5=u4->next; // might be NULL
7873
7874 ideal *syz=NULL;
7875 GbVariant alg=GbDefault;
7876 ideal h11=NULL;
7877
7878 if(u5==NULL)
7879 {
7880 // test all three possibilities for 4 arguments
7881 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7882 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7883 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
7884 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
7885 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
7886 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
7887
7888 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7889 {
7890 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7891 idhdl hw=(idhdl)u3->data;
7892 syz=&(hw->data.uideal);
7893 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7894 }
7895 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
7896 {
7897 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7898 idhdl hw=(idhdl)u3->data;
7899 syz=&(hw->data.uideal);
7900 h11=(ideal)u4->Data();
7901 }
7902 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
7903 {
7904 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
7905 h11=(ideal)u4->Data();
7906 }
7907 else
7908 {
7909 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7910 return TRUE;
7911 }
7912 }
7913 else
7914 {
7915 // we have 5 arguments
7916 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
7917 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
7918 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7919 {
7920 idhdl hw=(idhdl)u3->data;
7921 syz=&(hw->data.uideal);
7922 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7923 h11=(ideal)u5->Data();
7924 }
7925 else
7926 {
7927 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7928 return TRUE;
7929 }
7930 }
7931
7932#ifdef HAVE_SHIFTBBA
7933 if (rIsLPRing(currRing))
7934 {
7935 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7936 {
7937 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7938 return TRUE;
7939 }
7940 }
7941#endif
7942
7943 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7944 idhdl hv=(idhdl)v->data;
7945 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7946 res->rtyp = u->Typ();
7947 res->data = (char *)idLiftStd((ideal)u->Data(),
7948 &(hv->data.umatrix),testHomog,
7949 syz,alg,h11);
7950 setFlag(res,FLAG_STD); v->flag=0;
7951 if(syz!=NULL)
7952 u3->flag=0;
7953 return FALSE;
7954}
@ GbDefault
Definition: ideals.h:120

◆ jjLIFTSTD_SYZ()

static BOOLEAN jjLIFTSTD_SYZ ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6916 of file iparith.cc.

6917{
6918 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6919 if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6920 idhdl hv=(idhdl)v->data;
6921 idhdl hw=(idhdl)w->data;
6922#ifdef HAVE_SHIFTBBA
6923 if (rIsLPRing(currRing))
6924 {
6925 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6926 {
6927 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6928 return TRUE;
6929 }
6930 }
6931#endif
6932 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6933 res->data = (char *)idLiftStd((ideal)u->Data(),
6934 &(hv->data.umatrix),testHomog,
6935 &(hw->data.uideal));
6936 setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
6937 return FALSE;
6938}

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7955 of file iparith.cc.

7956{
7957 int sl=0;
7958 if (v!=NULL) sl = v->listLength();
7959 lists L;
7960 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7961 {
7962 int add_row_shift = 0;
7963 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7964 if (weights!=NULL) add_row_shift=weights->min_in();
7965 L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7966 }
7967 else
7968 {
7970 leftv h=NULL;
7971 int i;
7972 int rt;
7973
7974 L->Init(sl);
7975 for (i=0;i<sl;i++)
7976 {
7977 if (h!=NULL)
7978 { /* e.g. not in the first step:
7979 * h is the pointer to the old sleftv,
7980 * v is the pointer to the next sleftv
7981 * (in this moment) */
7982 h->next=v;
7983 }
7984 h=v;
7985 v=v->next;
7986 h->next=NULL;
7987 rt=h->Typ();
7988 if (rt==0)
7989 {
7990 L->Clean();
7991 Werror("`%s` is undefined",h->Fullname());
7992 return TRUE;
7993 }
7994 if (rt==RING_CMD)
7995 {
7996 L->m[i].rtyp=rt;
7997 L->m[i].data=rIncRefCnt(((ring)h->Data()));
7998 }
7999 else
8000 L->m[i].Copy(h);
8001 }
8002 }
8003 res->data=(char *)L;
8004 return FALSE;
8005}
int min_in()
Definition: intvec.h:121
@ RESOLUTION_CMD
Definition: grammar.cc:290
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3187
static ring rIncRefCnt(ring r)
Definition: ring.h:843

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4540 of file iparith.cc.

4541{
4542 lists l=(lists)v->Data();
4543 long mm=(long)atGet(v,"maxExp",INT_CMD);
4544 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4545 ring r=rCompose(l,TRUE,mm,isLetterplace);
4546 res->data=(char *)r;
4547 return (r==NULL);
4548}
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2787

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5477 of file iparith.cc.

5478{
5479 char libnamebuf[1024];
5481
5482#ifdef HAVE_DYNAMIC_LOADING
5483 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5484#endif /* HAVE_DYNAMIC_LOADING */
5485 switch(LT)
5486 {
5487 default:
5488 case LT_NONE:
5489 Werror("%s: unknown type", s);
5490 break;
5491 case LT_NOTFOUND:
5492 Werror("cannot open %s", s);
5493 break;
5494
5495 case LT_SINGULAR:
5496 {
5497 char *plib = iiConvName(s);
5498 idhdl pl = IDROOT->get_level(plib,0);
5499 if (pl==NULL)
5500 {
5501 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5502 IDPACKAGE(pl)->language = LANG_SINGULAR;
5503 IDPACKAGE(pl)->libname=omStrDup(s);
5504 }
5505 else if (IDTYP(pl)!=PACKAGE_CMD)
5506 {
5507 Werror("can not create package `%s`",plib);
5508 omFreeBinAddr(plib);
5509 return TRUE;
5510 }
5511 else /* package */
5512 {
5513 package pa=IDPACKAGE(pl);
5514 if ((pa->language==LANG_C)
5515 || (pa->language==LANG_MIX))
5516 {
5517 Werror("can not create package `%s` - binaries exists",plib);
5518 omFreeBinAddr(plib);
5519 return TRUE;
5520 }
5521 }
5522 omFreeBinAddr(plib);
5523 package savepack=currPack;
5524 currPack=IDPACKAGE(pl);
5525 IDPACKAGE(pl)->loaded=TRUE;
5526 char libnamebuf[1024];
5527 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5528 BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5529 currPack=savepack;
5530 IDPACKAGE(pl)->loaded=(!bo);
5531 return bo;
5532 }
5533 case LT_BUILTIN:
5534 SModulFunc_t iiGetBuiltinModInit(const char*);
5535 return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5536 case LT_MACH_O:
5537 case LT_ELF:
5538 case LT_HPUX:
5539#ifdef HAVE_DYNAMIC_LOADING
5540 return load_modules(s, libnamebuf, autoexport);
5541#else /* HAVE_DYNAMIC_LOADING */
5542 WerrorS("Dynamic modules are not supported by this version of Singular");
5543 break;
5544#endif /* HAVE_DYNAMIC_LOADING */
5545 }
5546 return TRUE;
5547}
CanonicalForm fp
Definition: cfModGcd.cc:4102
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:279
VAR package basePack
Definition: ipid.cc:58
VAR package currPack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:19
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1294
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:81
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:973
char * iiConvName(const char *libname)
Definition: iplib.cc:1429
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1284
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:807
VAR char libnamebuf[1024]
Definition: libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:27
lib_types
Definition: mod_raw.h:16
@ LT_MACH_O
Definition: mod_raw.h:16
@ LT_HPUX
Definition: mod_raw.h:16
@ LT_SINGULAR
Definition: mod_raw.h:16
@ LT_BUILTIN
Definition: mod_raw.h:16
@ LT_ELF
Definition: mod_raw.h:16
@ LT_NONE
Definition: mod_raw.h:16
@ LT_NOTFOUND
Definition: mod_raw.h:16
@ LANG_SINGULAR
Definition: subexpr.h:22
@ LANG_MIX
Definition: subexpr.h:22
@ LANG_C
Definition: subexpr.h:22

◆ jjLOAD1()

static BOOLEAN jjLOAD1 ( leftv  ,
leftv  v 
)
static

Definition at line 4536 of file iparith.cc.

4537{
4538 return jjLOAD((char*)v->Data(),FALSE);
4539}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5477

◆ jjLOAD2()

static BOOLEAN jjLOAD2 ( leftv  ,
leftv  ,
leftv  v 
)
static

Definition at line 2595 of file iparith.cc.

2596{
2597 return jjLOAD((char*)v->Data(),TRUE);
2598}

◆ jjLOAD_E()

static BOOLEAN jjLOAD_E ( leftv  ,
leftv  v,
leftv  u 
)
static

Definition at line 2599 of file iparith.cc.

2600{
2601 char * s=(char *)u->Data();
2602 if(strcmp(s, "with")==0)
2603 return jjLOAD((char*)v->Data(), TRUE);
2604 if (strcmp(s,"try")==0)
2605 return jjLOAD_TRY((char*)v->Data());
2606 WerrorS("invalid second argument");
2607 WerrorS("load(\"libname\" [,option]);");
2608 return TRUE;
2609}
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5553

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5553 of file iparith.cc.

5554{
5555 if (!iiGetLibStatus(s))
5556 {
5557 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5560 BOOLEAN bo=jjLOAD(s,TRUE);
5561 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5562 Print("loading of >%s< failed\n",s);
5563 WerrorS_callback=WerrorS_save;
5564 errorreported=0;
5565 }
5566 return FALSE;
5567}
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5548
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5549
BOOLEAN iiGetLibStatus(const char *lib)
Definition: iplib.cc:77

◆ jjLT_BI()

static BOOLEAN jjLT_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1216 of file iparith.cc.

1217{
1218 return jjGT_BI(res,v,u);
1219}
static BOOLEAN jjGT_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1186

◆ jjLT_I()

static BOOLEAN jjLT_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1220 of file iparith.cc.

1221{
1222 res->data = (char *)(long)((int)((long)u->Data()) < (int)((long)v->Data()));
1223 return FALSE;
1224}

◆ jjLT_N()

static BOOLEAN jjLT_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1225 of file iparith.cc.

1226{
1227 return jjGT_N(res,v,u);
1228}
static BOOLEAN jjGT_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1198

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4567 of file iparith.cc.

4568{
4569 /* computes the LU-decomposition of a matrix M;
4570 i.e., M = P * L * U, where
4571 - P is a row permutation matrix,
4572 - L is in lower triangular form,
4573 - U is in upper row echelon form
4574 Then, we also have P * M = L * U.
4575 A list [P, L, U] is returned. */
4576 matrix mat = (const matrix)v->Data();
4577 if (!idIsConstant((ideal)mat))
4578 {
4579 WerrorS("matrix must be constant");
4580 return TRUE;
4581 }
4582 matrix pMat;
4583 matrix lMat;
4584 matrix uMat;
4585
4586 luDecomp(mat, pMat, lMat, uMat);
4587
4589 ll->Init(3);
4590 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4591 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4592 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4593 res->data=(char*)ll;
4594
4595 return FALSE;
4596}
#define idIsConstant(I)
Definition: ideals.h:40
void luDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &uMat, const ring R)
LU-decomposition of a given (m x n)-matrix.

◆ jjLU_INVERSE()

static BOOLEAN jjLU_INVERSE ( leftv  res,
leftv  v 
)
static

Definition at line 7504 of file iparith.cc.

7505{
7506 /* computation of the inverse of a quadratic matrix A
7507 using the L-U-decomposition of A;
7508 There are two valid parametrisations:
7509 1) exactly one argument which is just the matrix A,
7510 2) exactly three arguments P, L, U which already
7511 realise the L-U-decomposition of A, that is,
7512 P * A = L * U, and P, L, and U satisfy the
7513 properties decribed in method 'jjLU_DECOMP';
7514 see there;
7515 If A is invertible, the list [1, A^(-1)] is returned,
7516 otherwise the list [0] is returned. Thus, the user may
7517 inspect the first entry of the returned list to see
7518 whether A is invertible. */
7519 matrix iMat; int invertible;
7520 const short t1[]={1,MATRIX_CMD};
7521 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7522 if (iiCheckTypes(v,t1))
7523 {
7524 matrix aMat = (matrix)v->Data();
7525 int rr = aMat->rows();
7526 int cc = aMat->cols();
7527 if (rr != cc)
7528 {
7529 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7530 return TRUE;
7531 }
7532 if (!idIsConstant((ideal)aMat))
7533 {
7534 WerrorS("matrix must be constant");
7535 return TRUE;
7536 }
7537 invertible = luInverse(aMat, iMat);
7538 }
7539 else if (iiCheckTypes(v,t2))
7540 {
7541 matrix pMat = (matrix)v->Data();
7542 matrix lMat = (matrix)v->next->Data();
7543 matrix uMat = (matrix)v->next->next->Data();
7544 int rr = uMat->rows();
7545 int cc = uMat->cols();
7546 if (rr != cc)
7547 {
7548 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7549 rr, cc);
7550 return TRUE;
7551 }
7552 if (!idIsConstant((ideal)pMat)
7553 || (!idIsConstant((ideal)lMat))
7554 || (!idIsConstant((ideal)uMat))
7555 )
7556 {
7557 WerrorS("matricesx must be constant");
7558 return TRUE;
7559 }
7560 invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7561 }
7562 else
7563 {
7564 Werror("expected either one or three matrices");
7565 return TRUE;
7566 }
7567
7568 /* build the return structure; a list with either one or two entries */
7570 if (invertible)
7571 {
7572 ll->Init(2);
7573 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7574 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7575 }
7576 else
7577 {
7578 ll->Init(1);
7579 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7580 }
7581
7582 res->data=(char*)ll;
7583 return FALSE;
7584}
int & cols()
Definition: matpol.h:24
int & rows()
Definition: matpol.h:23
bool luInverseFromLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, matrix &iMat, const ring R)
This code computes the inverse by inverting lMat and uMat, and then performing two matrix multiplicat...
bool luInverse(const matrix aMat, matrix &iMat, const ring R)
This code first computes the LU-decomposition of aMat, and then calls the method for inverting a matr...

◆ jjLU_SOLVE()

static BOOLEAN jjLU_SOLVE ( leftv  res,
leftv  v 
)
static

Definition at line 7585 of file iparith.cc.

7586{
7587 /* for solving a linear equation system A * x = b, via the
7588 given LU-decomposition of the matrix A;
7589 There is one valid parametrisation:
7590 1) exactly four arguments P, L, U, b;
7591 P, L, and U realise the L-U-decomposition of A, that is,
7592 P * A = L * U, and P, L, and U satisfy the
7593 properties decribed in method 'jjLU_DECOMP';
7594 see there;
7595 b is the right-hand side vector of the equation system;
7596 The method will return a list of either 1 entry or three entries:
7597 1) [0] if there is no solution to the system;
7598 2) [1, x, H] if there is at least one solution;
7599 x is any solution of the given linear system,
7600 H is the matrix with column vectors spanning the homogeneous
7601 solution space.
7602 The method produces an error if matrix and vector sizes do not fit. */
7603 const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7604 if (!iiCheckTypes(v,t))
7605 {
7606 WerrorS("expected exactly three matrices and one vector as input");
7607 return TRUE;
7608 }
7609 matrix pMat = (matrix)v->Data();
7610 matrix lMat = (matrix)v->next->Data();
7611 matrix uMat = (matrix)v->next->next->Data();
7612 matrix bVec = (matrix)v->next->next->next->Data();
7613 matrix xVec; int solvable; matrix homogSolSpace;
7614 if (pMat->rows() != pMat->cols())
7615 {
7616 Werror("first matrix (%d x %d) is not quadratic",
7617 pMat->rows(), pMat->cols());
7618 return TRUE;
7619 }
7620 if (lMat->rows() != lMat->cols())
7621 {
7622 Werror("second matrix (%d x %d) is not quadratic",
7623 lMat->rows(), lMat->cols());
7624 return TRUE;
7625 }
7626 if (lMat->rows() != uMat->rows())
7627 {
7628 Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7629 lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7630 return TRUE;
7631 }
7632 if (uMat->rows() != bVec->rows())
7633 {
7634 Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7635 uMat->rows(), uMat->cols(), bVec->rows());
7636 return TRUE;
7637 }
7638 if (!idIsConstant((ideal)pMat)
7639 ||(!idIsConstant((ideal)lMat))
7640 ||(!idIsConstant((ideal)uMat))
7641 )
7642 {
7643 WerrorS("matrices must be constant");
7644 return TRUE;
7645 }
7646 solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7647
7648 /* build the return structure; a list with either one or three entries */
7650 if (solvable)
7651 {
7652 ll->Init(3);
7653 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7654 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7655 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7656 }
7657 else
7658 {
7659 ll->Init(1);
7660 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7661 }
7662
7663 res->data=(char*)ll;
7664 return FALSE;
7665}
bool luSolveViaLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LU-decompositi...

◆ jjMakeSub()

static Subexpr jjMakeSub ( leftv  e)
static

Definition at line 8675 of file iparith.cc.

8676{
8677 assume( e->Typ()==INT_CMD );
8678 Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8679 r->start =(int)(long)e->Data();
8680 return r;
8681}
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

static BOOLEAN jjMAP ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1655 of file iparith.cc.

1656{
1657 //Print("try to map %s with %s\n",$3.Name(),$1.Name());
1658 if ((v->e==NULL)&&(v->name!=NULL)&&(v->next==NULL))
1659 {
1660 map m=(map)u->Data();
1661 leftv sl=iiMap(m,v->name);
1662 if (sl!=NULL)
1663 {
1664 memcpy(res,sl,sizeof(sleftv));
1666 return FALSE;
1667 }
1668 }
1669 else
1670 {
1671 Werror("%s(<name>) expected",u->Name());
1672 }
1673 return TRUE; /*sl==NULL or Werror*/
1674}
leftv iiMap(map theMap, const char *what)
Definition: ipshell.cc:615

◆ jjMATRIX_Id()

static BOOLEAN jjMATRIX_Id ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6717 of file iparith.cc.

6718{
6719 int mi=(int)(long)v->Data();
6720 int ni=(int)(long)w->Data();
6721 if ((mi<1)||(ni<1))
6722 {
6723 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6724 return TRUE;
6725 }
6726 matrix m=mpNew(mi,ni);
6727 ideal I=(ideal)u->CopyD(IDEAL_CMD);
6728 int i=si_min(IDELEMS(I),mi*ni);
6729 //for(i=i-1;i>=0;i--)
6730 //{
6731 // m->m[i]=I->m[i];
6732 // I->m[i]=NULL;
6733 //}
6734 memcpy(m->m,I->m,i*sizeof(poly));
6735 memset(I->m,0,i*sizeof(poly));
6736 id_Delete(&I,currRing);
6737 res->data = (char *)m;
6738 return FALSE;
6739}

◆ jjMATRIX_Ma()

static BOOLEAN jjMATRIX_Ma ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6753 of file iparith.cc.

6754{
6755 int mi=(int)(long)v->Data();
6756 int ni=(int)(long)w->Data();
6757 if ((mi<1)||(ni<1))
6758 {
6759 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6760 return TRUE;
6761 }
6762 matrix m=mpNew(mi,ni);
6764 int r=si_min(MATROWS(I),mi);
6765 int c=si_min(MATCOLS(I),ni);
6766 int i,j;
6767 for(i=r;i>0;i--)
6768 {
6769 for(j=c;j>0;j--)
6770 {
6771 MATELEM(m,i,j)=MATELEM(I,i,j);
6772 MATELEM(I,i,j)=NULL;
6773 }
6774 }
6775 id_Delete((ideal *)&I,currRing);
6776 res->data = (char *)m;
6777 return FALSE;
6778}

◆ jjMATRIX_Mo()

static BOOLEAN jjMATRIX_Mo ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6740 of file iparith.cc.

6741{
6742 int mi=(int)(long)v->Data();
6743 int ni=(int)(long)w->Data();
6744 if ((mi<0)||(ni<1))
6745 {
6746 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6747 return TRUE;
6748 }
6749 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6750 mi,ni,currRing);
6751 return FALSE;
6752}

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4597 of file iparith.cc.

4598{
4599 // clean out "_":
4601 // collect all info:
4602 omUpdateInfo();
4603 switch(((int)(long)v->Data()))
4604 {
4605 case 0:
4606 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4607 break;
4608 case 1:
4609 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4610 break;
4611 case 2:
4612 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4613 break;
4614 default:
4615 omPrintStats(stdout);
4616 omPrintInfo(stdout);
4617 omPrintBinStats(stdout);
4618 res->data = (char *)0;
4619 res->rtyp = NONE;
4620 }
4621 return FALSE;
4622}
omInfo_t om_Info
Definition: omStats.c:16
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
#define NONE
Definition: tok.h:221
#define omPrintStats(F)
Definition: xalloc.h:231
#define omPrintInfo(F)
Definition: xalloc.h:232
#define omPrintBinStats(F)
Definition: xalloc.h:233
#define omUpdateInfo()
Definition: xalloc.h:230

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6248 of file iparith.cc.

6249{
6250 /* Here's the use pattern for the minor command:
6251 minor ( matrix_expression m, int_expression minorSize,
6252 optional ideal_expression IasSB, optional int_expression k,
6253 optional string_expression algorithm,
6254 optional int_expression cachedMinors,
6255 optional int_expression cachedMonomials )
6256 This method here assumes that there are at least two arguments.
6257 - If IasSB is present, it must be a std basis. All minors will be
6258 reduced w.r.t. IasSB.
6259 - If k is absent, all non-zero minors will be computed.
6260 If k is present and k > 0, the first k non-zero minors will be
6261 computed.
6262 If k is present and k < 0, the first |k| minors (some of which
6263 may be zero) will be computed.
6264 If k is present and k = 0, an error is reported.
6265 - If algorithm is absent, all the following arguments must be absent too.
6266 In this case, a heuristic picks the best-suited algorithm (among
6267 Bareiss, Laplace, and Laplace with caching).
6268 If algorithm is present, it must be one of "Bareiss", "bareiss",
6269 "Laplace", "laplace", "Cache", "cache". In the cases "Cache" and
6270 "cache" two more arguments may be given, determining how many entries
6271 the cache may have at most, and how many cached monomials there are at
6272 most. (Cached monomials are counted over all cached polynomials.)
6273 If these two additional arguments are not provided, 200 and 100000
6274 will be used as defaults.
6275 */
6276 matrix m;
6277 leftv u=v->next;
6278 v->next=NULL;
6279 int v_typ=v->Typ();
6280 if (v_typ==MATRIX_CMD)
6281 {
6282 m = (const matrix)v->Data();
6283 }
6284 else
6285 {
6286 if (v_typ==0)
6287 {
6288 Werror("`%s` is undefined",v->Fullname());
6289 return TRUE;
6290 }
6291 // try to convert to MATRIX:
6292 int ii=iiTestConvert(v_typ,MATRIX_CMD);
6293 BOOLEAN bo;
6294 sleftv tmp;
6295 if (ii>0) bo=iiConvert(v_typ,MATRIX_CMD,ii,v,&tmp);
6296 else bo=TRUE;
6297 if (bo)
6298 {
6299 Werror("cannot convert %s to matrix",Tok2Cmdname(v_typ));
6300 return TRUE;
6301 }
6302 m=(matrix)tmp.data;
6303 }
6304 const int mk = (const int)(long)u->Data();
6305 bool noIdeal = true; bool noK = true; bool noAlgorithm = true;
6306 bool noCacheMinors = true; bool noCacheMonomials = true;
6307 ideal IasSB; int k; char* algorithm; int cacheMinors; int cacheMonomials;
6308
6309 /* here come the different cases of correct argument sets */
6310 if ((u->next != NULL) && (u->next->Typ() == IDEAL_CMD))
6311 {
6312 IasSB = (ideal)u->next->Data();
6313 noIdeal = false;
6314 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6315 {
6316 k = (int)(long)u->next->next->Data();
6317 noK = false;
6318 if ((u->next->next->next != NULL) &&
6319 (u->next->next->next->Typ() == STRING_CMD))
6320 {
6321 algorithm = (char*)u->next->next->next->Data();
6322 noAlgorithm = false;
6323 if ((u->next->next->next->next != NULL) &&
6324 (u->next->next->next->next->Typ() == INT_CMD))
6325 {
6326 cacheMinors = (int)(long)u->next->next->next->next->Data();
6327 noCacheMinors = false;
6328 if ((u->next->next->next->next->next != NULL) &&
6329 (u->next->next->next->next->next->Typ() == INT_CMD))
6330 {
6331 cacheMonomials =
6332 (int)(long)u->next->next->next->next->next->Data();
6333 noCacheMonomials = false;
6334 }
6335 }
6336 }
6337 }
6338 }
6339 else if ((u->next != NULL) && (u->next->Typ() == INT_CMD))
6340 {
6341 k = (int)(long)u->next->Data();
6342 noK = false;
6343 if ((u->next->next != NULL) && (u->next->next->Typ() == STRING_CMD))
6344 {
6345 algorithm = (char*)u->next->next->Data();
6346 noAlgorithm = false;
6347 if ((u->next->next->next != NULL) &&
6348 (u->next->next->next->Typ() == INT_CMD))
6349 {
6350 cacheMinors = (int)(long)u->next->next->next->Data();
6351 noCacheMinors = false;
6352 if ((u->next->next->next->next != NULL) &&
6353 (u->next->next->next->next->Typ() == INT_CMD))
6354 {
6355 cacheMonomials = (int)(long)u->next->next->next->next->Data();
6356 noCacheMonomials = false;
6357 }
6358 }
6359 }
6360 }
6361 else if ((u->next != NULL) && (u->next->Typ() == STRING_CMD))
6362 {
6363 algorithm = (char*)u->next->Data();
6364 noAlgorithm = false;
6365 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6366 {
6367 cacheMinors = (int)(long)u->next->next->Data();
6368 noCacheMinors = false;
6369 if ((u->next->next->next != NULL) &&
6370 (u->next->next->next->Typ() == INT_CMD))
6371 {
6372 cacheMonomials = (int)(long)u->next->next->next->Data();
6373 noCacheMonomials = false;
6374 }
6375 }
6376 }
6377
6378 /* upper case conversion for the algorithm if present */
6379 if (!noAlgorithm)
6380 {
6381 if (strcmp(algorithm, "bareiss") == 0)
6382 algorithm = (char*)"Bareiss";
6383 if (strcmp(algorithm, "laplace") == 0)
6384 algorithm = (char*)"Laplace";
6385 if (strcmp(algorithm, "cache") == 0)
6386 algorithm = (char*)"Cache";
6387 }
6388
6389 v->next=u;
6390 /* here come some tests */
6391 if (!noIdeal)
6392 {
6393 assumeStdFlag(u->next);
6394 }
6395 if ((!noK) && (k == 0))
6396 {
6397 WerrorS("Provided number of minors to be computed is zero.");
6398 return TRUE;
6399 }
6400 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") != 0)
6401 && (strcmp(algorithm, "Laplace") != 0)
6402 && (strcmp(algorithm, "Cache") != 0))
6403 {
6404 WerrorS("Expected as algorithm one of 'B/bareiss', 'L/laplace', or 'C/cache'.");
6405 return TRUE;
6406 }
6407 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") == 0)
6409 {
6410 Werror("Bareiss algorithm not defined over coefficient rings %s",
6411 "with zero divisors.");
6412 return TRUE;
6413 }
6414 if ((mk < 1) || (mk > m->rows()) || (mk > m->cols()))
6415 {
6416 ideal I=idInit(1,1);
6417 if (mk<1) I->m[0]=p_One(currRing);
6418 //Werror("invalid size of minors: %d (matrix is (%d x %d))", mk,
6419 // m->rows(), m->cols());
6420 res->data=(void*)I;
6421 return FALSE;
6422 }
6423 if ((!noAlgorithm) && (strcmp(algorithm, "Cache") == 0)
6424 && (noCacheMinors || noCacheMonomials))
6425 {
6426 cacheMinors = 200;
6427 cacheMonomials = 100000;
6428 }
6429
6430 /* here come the actual procedure calls */
6431 if (noAlgorithm)
6432 res->data = getMinorIdealHeuristic(m, mk, (noK ? 0 : k),
6433 (noIdeal ? 0 : IasSB), false);
6434 else if (strcmp(algorithm, "Cache") == 0)
6435 res->data = getMinorIdealCache(m, mk, (noK ? 0 : k),
6436 (noIdeal ? 0 : IasSB), 3, cacheMinors,
6437 cacheMonomials, false);
6438 else
6439 res->data = getMinorIdeal(m, mk, (noK ? 0 : k), algorithm,
6440 (noIdeal ? 0 : IasSB), false);
6441 if (v_typ!=MATRIX_CMD) idDelete((ideal *)&m);
6442 return FALSE;
6443}
ideal getMinorIdealCache(const matrix mat, const int minorSize, const int k, const ideal iSB, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
ideal getMinorIdeal(const matrix mat, const int minorSize, const int k, const char *algorithm, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
ideal getMinorIdealHeuristic(const matrix mat, const int minorSize, const int k, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
poly p_One(const ring r)
Definition: p_polys.cc:1313

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4648 of file iparith.cc.

4649{
4650 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4651
4652 syStrategy tmp=(syStrategy)v->Data();
4653 tmp = syMinimize(tmp); // enrich itself!
4654
4655 res->data=(char *)tmp;
4656
4657 if (weights!=NULL)
4658 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4659
4660 return FALSE;
4661}
syStrategy syMinimize(syStrategy syzstr)
Definition: syz1.cc:2393
ssyStrategy * syStrategy
Definition: syz.h:35

◆ jjMINUS_B()

static BOOLEAN jjMINUS_B ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 922 of file iparith.cc.

923{
925 poly p=(poly)u->CopyD(POLY_CMD);
926 int l=pLength(p);
928 p= (poly)v->CopyD(POLY_CMD);
929 p=p_Neg(p,currRing);
930 l=pLength(p);
932 res->data=(void*)b;
933 return jjPLUSMINUS_Gen(res,u,v);
934}
static BOOLEAN jjPLUSMINUS_Gen(leftv res, leftv u, leftv v)
Definition: iparith.cc:634
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1107
static unsigned pLength(poly a)
Definition: p_polys.h:191
void sBucket_Add_p(sBucket_pt bucket, poly p, int length)
adds poly p to bucket destroys p!
Definition: sbuckets.cc:203
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96

◆ jjMINUS_B_P()

static BOOLEAN jjMINUS_B_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 912 of file iparith.cc.

913{
915 poly p= (poly)v->CopyD(POLY_CMD);
916 int l=pLength(p);
917 p=p_Neg(p,currRing);
919 res->data=(void*)b;
920 return jjPLUSMINUS_Gen(res,u,v);
921}
@ BUCKET_CMD
Definition: grammar.cc:283

◆ jjMINUS_BI()

static BOOLEAN jjMINUS_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 897 of file iparith.cc.

898{
899 res->data = (char *)(n_Sub((number)u->Data(), (number)v->Data(),coeffs_BIGINT));
900 return jjPLUSMINUS_Gen(res,u,v);
901}

◆ jjMINUS_BIM()

static BOOLEAN jjMINUS_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 945 of file iparith.cc.

946{
947 res->data = (char *)bimSub((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
948 if (res->data==NULL)
949 {
950 WerrorS("bigintmat/cmatrix not compatible");
951 return TRUE;
952 }
953 return jjPLUSMINUS_Gen(res,u,v);
954}
bigintmat * bimSub(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:218

◆ jjMINUS_I()

static BOOLEAN jjMINUS_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 881 of file iparith.cc.

882{
883 void *ap=u->Data(); void *bp=v->Data();
884 int aa=(int)(long)ap;
885 int bb=(int)(long)bp;
886 int cc=aa-bb;
887 unsigned int a=(unsigned int)(unsigned long)ap;
888 unsigned int b=(unsigned int)(unsigned long)bp;
889 unsigned int c=a-b;
890 if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
891 {
892 WarnS("int overflow(-), result may be wrong");
893 }
894 res->data = (char *)((long)cc);
895 return jjPLUSMINUS_Gen(res,u,v);
896}
Definition: ap.h:40
#define Sy_bit(x)
Definition: options.h:31

◆ jjMINUS_IV()

static BOOLEAN jjMINUS_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 935 of file iparith.cc.

936{
937 res->data = (char *)ivSub((intvec*)(u->Data()), (intvec*)(v->Data()));
938 if (res->data==NULL)
939 {
940 WerrorS("intmat size not compatible");
941 return TRUE;
942 }
943 return jjPLUSMINUS_Gen(res,u,v);
944}
intvec * ivSub(intvec *a, intvec *b)
Definition: intvec.cc:279

◆ jjMINUS_MA()

static BOOLEAN jjMINUS_MA ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 955 of file iparith.cc.

956{
957 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
958 res->data = (char *)(mp_Sub(A , B, currRing));
959 if (res->data==NULL)
960 {
961 Werror("matrix size not compatible(%dx%d, %dx%d)",
963 return TRUE;
964 }
965 return jjPLUSMINUS_Gen(res,u,v);
966 return FALSE;
967}
b *CanonicalForm B
Definition: facBivar.cc:52
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition: matpol.cc:196
#define A
Definition: sirandom.c:24

◆ jjMINUS_N()

static BOOLEAN jjMINUS_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 902 of file iparith.cc.

903{
904 res->data = (char *)(nSub((number)u->Data(), (number)v->Data()));
905 return jjPLUSMINUS_Gen(res,u,v);
906}
#define nSub(n1, n2)
Definition: numbers.h:22

◆ jjMINUS_SM()

static BOOLEAN jjMINUS_SM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 968 of file iparith.cc.

969{
970 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
971 res->data = (char *)(sm_Sub(A , B, currRing));
972 if (res->data==NULL)
973 {
974 Werror("matrix size not compatible(%dx%d, %dx%d)",
975 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
976 return TRUE;
977 }
978 return jjPLUSMINUS_Gen(res,u,v);
979 return FALSE;
980}
ideal sm_Sub(ideal a, ideal b, const ring R)
Definition: matpol.cc:1881

◆ jjMINUS_V()

static BOOLEAN jjMINUS_V ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 907 of file iparith.cc.

908{
909 res->data = (char *)(pSub((poly)u->CopyD(POLY_CMD) , (poly)v->CopyD(POLY_CMD)));
910 return jjPLUSMINUS_Gen(res,u,v);
911}
#define pSub(a, b)
Definition: polys.h:287

◆ jjMOD_BI()

static BOOLEAN jjMOD_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2663 of file iparith.cc.

2664{
2665 number q=(number)v->Data();
2666 if (n_IsZero(q,coeffs_BIGINT))
2667 {
2669 return TRUE;
2670 }
2671 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2672 return FALSE;
2673}
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628

◆ jjMOD_N()

static BOOLEAN jjMOD_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2674 of file iparith.cc.

2675{
2676 number q=(number)v->Data();
2677 if (nIsZero(q))
2678 {
2680 return TRUE;
2681 }
2682 res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2683 return FALSE;
2684}

◆ jjMOD_P()

static BOOLEAN jjMOD_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2685 of file iparith.cc.

2686{
2687 poly q=(poly)v->Data();
2688 if (q==NULL)
2689 {
2691 return TRUE;
2692 }
2693 poly p=(poly)(u->Data());
2694 if (p==NULL)
2695 {
2696 res->data=NULL;
2697 return FALSE;
2698 }
2699 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2700 q /*(poly)(v->Data())*/ ,currRing));
2701 return FALSE;
2702}
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:702

◆ jjMODULO()

static BOOLEAN jjMODULO ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2610 of file iparith.cc.

2611{
2612 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2613 tHomog hom=testHomog;
2614 if (w_u!=NULL)
2615 {
2616 //PrintS("modulo: wu:");w_u->show(INTVEC_CMD);PrintLn();
2617 w_u=ivCopy(w_u);
2618 hom=isHomog;
2619 }
2620 //else PrintS("modulo: wu:none\n");
2621 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2622 if (w_v!=NULL)
2623 {
2624 //PrintS("modulo: wv:");w_v->show(INTVEC_CMD);PrintLn();
2625 w_v=ivCopy(w_v);
2626 hom=isHomog;
2627 }
2628 //else PrintS("modulo: wv:none\n");
2629 if ((w_u!=NULL) && (w_v==NULL))
2630 w_v=ivCopy(w_u);
2631 if ((w_v!=NULL) && (w_u==NULL))
2632 w_u=ivCopy(w_v);
2633 ideal u_id=(ideal)u->Data();
2634 ideal v_id=(ideal)v->Data();
2635 if (w_u!=NULL)
2636 {
2637 if ((*w_u).compare((w_v))!=0)
2638 {
2639 WarnS("incompatible weights");
2640 delete w_u; w_u=NULL;
2641 hom=testHomog;
2642 }
2643 else
2644 {
2645 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2646 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2647 {
2648 WarnS("wrong weights");
2649 delete w_u; w_u=NULL;
2650 hom=testHomog;
2651 }
2652 }
2653 }
2654 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2655 if (w_u!=NULL)
2656 {
2657 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2658 }
2659 delete w_v;
2660 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2661 return FALSE;
2662}
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w, matrix *T, GbVariant alg)
Definition: ideals.cc:2418
tHomog
Definition: structs.h:35
@ isHomog
Definition: structs.h:37

◆ jjMODULO3()

static BOOLEAN jjMODULO3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6779 of file iparith.cc.

6780{
6781 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6782 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6783 tHomog hom=testHomog;
6784 if (w_u!=NULL)
6785 {
6786 w_u=ivCopy(w_u);
6787 hom=isHomog;
6788 }
6789 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6790 if (w_v!=NULL)
6791 {
6792 w_v=ivCopy(w_v);
6793 hom=isHomog;
6794 }
6795 if ((w_u!=NULL) && (w_v==NULL))
6796 w_v=ivCopy(w_u);
6797 if ((w_v!=NULL) && (w_u==NULL))
6798 w_u=ivCopy(w_v);
6799 ideal u_id=(ideal)u->Data();
6800 ideal v_id=(ideal)v->Data();
6801 if (w_u!=NULL)
6802 {
6803 if ((*w_u).compare((w_v))!=0)
6804 {
6805 WarnS("incompatible weights");
6806 delete w_u; w_u=NULL;
6807 hom=testHomog;
6808 }
6809 else
6810 {
6811 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6812 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6813 {
6814 WarnS("wrong weights");
6815 delete w_u; w_u=NULL;
6816 hom=testHomog;
6817 }
6818 }
6819 }
6820 idhdl h=(idhdl)w->data;
6821 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
6822 if (w_u!=NULL)
6823 {
6824 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6825 }
6826 delete w_v;
6827 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6828 return FALSE;
6829}

◆ jjMODULO3S()

static BOOLEAN jjMODULO3S ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6830 of file iparith.cc.

6831{
6832 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6833 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6834 tHomog hom=testHomog;
6835 if (w_u!=NULL)
6836 {
6837 w_u=ivCopy(w_u);
6838 hom=isHomog;
6839 }
6840 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6841 if (w_v!=NULL)
6842 {
6843 w_v=ivCopy(w_v);
6844 hom=isHomog;
6845 }
6846 if ((w_u!=NULL) && (w_v==NULL))
6847 w_v=ivCopy(w_u);
6848 if ((w_v!=NULL) && (w_u==NULL))
6849 w_u=ivCopy(w_v);
6850 ideal u_id=(ideal)u->Data();
6851 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
6852 ideal v_id=(ideal)v->Data();
6853 if (w_u!=NULL)
6854 {
6855 if ((*w_u).compare((w_v))!=0)
6856 {
6857 WarnS("incompatible weights");
6858 delete w_u; w_u=NULL;
6859 hom=testHomog;
6860 }
6861 else
6862 {
6863 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6864 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6865 {
6866 WarnS("wrong weights");
6867 delete w_u; w_u=NULL;
6868 hom=testHomog;
6869 }
6870 }
6871 }
6872 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
6873 if (w_u!=NULL)
6874 {
6875 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6876 }
6877 delete w_v;
6878 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6879 return FALSE;
6880}

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 8006 of file iparith.cc.

8007{
8008 leftv v=u->next;
8009 leftv w=v->next;
8010 leftv u4=w->next;
8011 GbVariant alg;
8012 ideal u_id,v_id;
8013 // we have 4 arguments
8014 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8015 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8016 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8017 {
8018 u_id=(ideal)u->Data();
8019 v_id=(ideal)v->Data();
8020 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8021 }
8022 else
8023 {
8024 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8025 return TRUE;
8026 }
8027 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8028 tHomog hom=testHomog;
8029 if (w_u!=NULL)
8030 {
8031 w_u=ivCopy(w_u);
8032 hom=isHomog;
8033 }
8034 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8035 if (w_v!=NULL)
8036 {
8037 w_v=ivCopy(w_v);
8038 hom=isHomog;
8039 }
8040 if ((w_u!=NULL) && (w_v==NULL))
8041 w_v=ivCopy(w_u);
8042 if ((w_v!=NULL) && (w_u==NULL))
8043 w_u=ivCopy(w_v);
8044 if (w_u!=NULL)
8045 {
8046 if ((*w_u).compare((w_v))!=0)
8047 {
8048 WarnS("incompatible weights");
8049 delete w_u; w_u=NULL;
8050 hom=testHomog;
8051 }
8052 else
8053 {
8054 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8055 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8056 {
8057 WarnS("wrong weights");
8058 delete w_u; w_u=NULL;
8059 hom=testHomog;
8060 }
8061 }
8062 }
8063 idhdl h=(idhdl)w->data;
8064 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8065 if (w_u!=NULL)
8066 {
8067 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8068 }
8069 delete w_v;
8070 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8071 return FALSE;
8072}

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2704 of file iparith.cc.

2705{
2706 return jjMONITOR2(res,v,NULL);
2707}
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2708

◆ jjMONITOR2()

static BOOLEAN jjMONITOR2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2708 of file iparith.cc.

2709{
2710#if 0
2711 char *opt=(char *)v->Data();
2712 int mode=0;
2713 while(*opt!='\0')
2714 {
2715 if (*opt=='i') mode |= SI_PROT_I;
2716 else if (*opt=='o') mode |= SI_PROT_O;
2717 opt++;
2718 }
2719 monitor((char *)(u->Data()),mode);
2720#else
2721 si_link l=(si_link)u->Data();
2722 if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2723 if(strcmp(l->m->type,"ASCII")!=0)
2724 {
2725 Werror("ASCII link required, not `%s`",l->m->type);
2726 slClose(l);
2727 return TRUE;
2728 }
2729 SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2730 if ( l->name[0]!='\0') // "" is the stop condition
2731 {
2732 const char *opt;
2733 int mode=0;
2734 if (v==NULL) opt=(const char*)"i";
2735 else opt=(const char *)v->Data();
2736 while(*opt!='\0')
2737 {
2738 if (*opt=='i') mode |= SI_PROT_I;
2739 else if (*opt=='o') mode |= SI_PROT_O;
2740 opt++;
2741 }
2742 monitor((FILE *)l->data,mode);
2743 }
2744 else
2745 monitor(NULL,0);
2746 return FALSE;
2747#endif
2748}
void monitor(void *F, int mode)
Definition: febase.cc:68
#define SI_PROT_O
Definition: reporter.h:54
#define SI_PROT_I
Definition: reporter.h:53

◆ jjMONOM()

static BOOLEAN jjMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 2749 of file iparith.cc.

2750{
2751 intvec *iv=(intvec *)v->Data();
2752 poly p=pOne();
2753 int e;
2754 BOOLEAN err=FALSE;
2755 for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2756 {
2757 e=(*iv)[i-1];
2758 if (e>=0) pSetExp(p,i,e);
2759 else err=TRUE;
2760 }
2761 if (iv->length()==(currRing->N+1))
2762 {
2763 res->rtyp=VECTOR_CMD;
2764 e=(*iv)[currRing->N];
2765 if (e>=0) pSetComp(p,e);
2766 else err=TRUE;
2767 }
2768 pSetm(p);
2769 res->data=(char*)p;
2770 if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2771 return err;
2772}

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5627 of file iparith.cc.

5628{
5629 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5630 return FALSE;
5631}
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:275

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5632 of file iparith.cc.

5633{
5634 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5635 return FALSE;
5636}
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:254

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4627 of file iparith.cc.

4628{
4629 int t=v->Typ();
4630 ideal r,m;
4631 r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4633 l->Init(2);
4634 l->m[0].rtyp=t;
4635 l->m[0].data=(char *)r;
4636 setFlag(&(l->m[0]),FLAG_STD);
4637 l->m[1].rtyp=t;
4638 l->m[1].data=(char *)m;
4639 res->data=(char *)l;
4640 return FALSE;
4641}
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:3019

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4642 of file iparith.cc.

4643{
4645 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4646 return FALSE;
4647}
int scMultInt(ideal S, ideal Q)
Definition: hdegree.cc:872

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4662 of file iparith.cc.

4663{
4664 number n,i; i=(number)v->Data();
4666 if (nMap!=NULL)
4667 n=nMap(i,currRing->cf,coeffs_BIGINT);
4668 else goto err;
4669 res->data=(void *)n;
4670 return FALSE;
4671err:
4672 WerrorS("cannot convert to bigint"); return TRUE;
4673}

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4674 of file iparith.cc.

4675{
4676 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4677 res->data=omStrDup(v->name);
4678 else if (v->name==NULL)
4679 res->data=omStrDup("");
4680 else
4681 {
4682 res->data = (char *)v->name;
4683 v->name=NULL;
4684 }
4685 return FALSE;
4686}

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4687 of file iparith.cc.

4688{
4689 res->data=ipNameList(((ring)v->Data())->idroot);
4690 return FALSE;
4691}
lists ipNameList(idhdl root)
Definition: ipid.cc:618

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8073 of file iparith.cc.

8074{
8075 res->data=(void *)ipNameList(IDROOT);
8076 return FALSE;
8077}

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4692 of file iparith.cc.

4693{
4694 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4695 return FALSE;
4696}
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:641

◆ jjNEWSTRUCT2()

static BOOLEAN jjNEWSTRUCT2 ( leftv  ,
leftv  u,
leftv  v 
)
static

Definition at line 2773 of file iparith.cc.

2774{
2775 // u: the name of the new type
2776 // v: the elements
2777 const char *s=(const char *)u->Data();
2778 newstruct_desc d=NULL;
2779 if (strlen(s)>=2)
2780 {
2781 d=newstructFromString((const char *)v->Data());
2782 if (d!=NULL) newstruct_setup(s,d);
2783 }
2784 else WerrorS("name of newstruct must be longer than 1 character");
2785 return d==NULL;
2786}
void newstruct_setup(const char *n, newstruct_desc d)
Definition: newstruct.cc:688
newstruct_desc newstructFromString(const char *s)
Definition: newstruct.cc:792

◆ jjNEWSTRUCT3()

static BOOLEAN jjNEWSTRUCT3 ( leftv  ,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6444 of file iparith.cc.

6445{
6446 // u: the name of the new type
6447 // v: the parent type
6448 // w: the elements
6449 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6450 (const char *)w->Data());
6451 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6452 return (d==NULL);
6453}
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition: newstruct.cc:799

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5667 of file iparith.cc.

5668{
5669 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5670 res->data=(char *)(long)iin_Int(n,currRing->cf);
5671 n_Delete(&n,currRing->cf);
5672 return FALSE;
5673}
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:223

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5674 of file iparith.cc.

5675{
5676 number n=(number)u->Data();
5677 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5678 return FALSE;
5679}

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4697 of file iparith.cc.

4698{
4699 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4700 return FALSE;
4701}

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3688 of file iparith.cc.

3689{
3690 return FALSE;
3691}

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 3987 of file iparith.cc.

3988{
3989 number n = reinterpret_cast<number>(v->CopyD());
3990 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
3991 n_Delete(&n,currRing->cf);
3992 return FALSE;
3993}
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4702 of file iparith.cc.

4703{
4704 res->data = (char *)(long)(((ring)(v->Data()))->N);
4705 return FALSE;
4706}

◆ jjOP_BI_BIM()

static BOOLEAN jjOP_BI_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 281 of file iparith.cc.

282{
283 return jjOP_BIM_BI(res, v, u);
284}
static BOOLEAN jjOP_BIM_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:268

◆ jjOP_BIM_BI()

static BOOLEAN jjOP_BIM_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 268 of file iparith.cc.

269{
270 bigintmat* aa= (bigintmat *)u->Data();
271 number bb = (number)(v->Data());
272 if (errorreported) return TRUE;
273 bigintmat *cc=NULL;
274 switch (iiOp)
275 {
276 case '*': cc=bimMult(aa,bb,coeffs_BIGINT); break;
277 }
278 res->data=(char *)cc;
279 return cc==NULL;
280}
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:255

◆ jjOP_BIM_I()

static BOOLEAN jjOP_BIM_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 249 of file iparith.cc.

250{
251 bigintmat* aa= (bigintmat *)u->Data();
252 int bb = (int)(long)(v->Data());
253 if (errorreported) return TRUE;
254 bigintmat *cc=NULL;
255 switch (iiOp)
256 {
257 case '+': cc=bimAdd(aa,bb); break;
258 case '-': cc=bimSub(aa,bb); break;
259 case '*': cc=bimMult(aa,bb); break;
260 }
261 res->data=(char *)cc;
262 return cc==NULL;
263}
bigintmat * bimAdd(bigintmat *a, bigintmat *b)
Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? @Note: NULL as a result means an error (non-compati...
Definition: bigintmat.cc:182

◆ jjOP_I_BIM()

static BOOLEAN jjOP_I_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 264 of file iparith.cc.

265{
266 return jjOP_BIM_I(res, v, u);
267}
static BOOLEAN jjOP_BIM_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:249

◆ jjOP_I_IM()

static BOOLEAN jjOP_I_IM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 321 of file iparith.cc.

322{
323 return jjOP_IM_I(res,v,u);
324}
static BOOLEAN jjOP_IM_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:306

◆ jjOP_I_IV()

static BOOLEAN jjOP_I_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 302 of file iparith.cc.

303{
304 return jjOP_IV_I(res,v,u);
305}
static BOOLEAN jjOP_IV_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:285

◆ jjOP_IM_I()

static BOOLEAN jjOP_IM_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 306 of file iparith.cc.

307{
308 intvec* aa= (intvec *)u->CopyD(INTVEC_CMD);
309 int bb = (int)(long)(v->Data());
310 int i=si_min(aa->rows(),aa->cols());
311 switch (iiOp)
312 {
313 case '+': for (;i>0;i--) IMATELEM(*aa,i,i) += bb;
314 break;
315 case '-': for (;i>0;i--) IMATELEM(*aa,i,i) -= bb;
316 break;
317 }
318 res->data=(char *)aa;
319 return FALSE;
320}
#define IMATELEM(M, I, J)
Definition: intvec.h:85

◆ jjOP_IV_I()

static BOOLEAN jjOP_IV_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 285 of file iparith.cc.

286{
287 intvec* aa= (intvec *)u->CopyD(INTVEC_CMD);
288 int bb = (int)(long)(v->Data());
289 if (errorreported) return TRUE;
290 switch (iiOp)
291 {
292 case '+': (*aa) += bb; break;
293 case '-': (*aa) -= bb; break;
294 case '*': (*aa) *= bb; break;
295 case '/':
296 case INTDIV_CMD: (*aa) /= bb; break;
297 case '%': (*aa) %= bb; break;
298 }
299 res->data=(char *)aa;
300 return FALSE;
301}

◆ jjOP_REST()

static BOOLEAN jjOP_REST ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 509 of file iparith.cc.

510{
511 if (u->Next()!=NULL)
512 {
513 u=u->next;
514 res->next = (leftv)omAllocBin(sleftv_bin);
515 return iiExprArith2(res->next,u,iiOp,v);
516 }
517 else if (v->Next()!=NULL)
518 {
519 v=v->next;
520 res->next = (leftv)omAllocBin(sleftv_bin);
521 return iiExprArith2(res->next,u,iiOp,v);
522 }
523 return FALSE;
524}

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4707 of file iparith.cc.

4708{
4709 si_link l=(si_link)v->Data();
4710 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4711 else { slPrepClose(l); return slClose(l);}
4712}
@ OPEN_CMD
Definition: tok.h:144

◆ jjOPPOSE()

static BOOLEAN jjOPPOSE ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2952 of file iparith.cc.

2953{
2954 /* number, poly, vector, ideal, module, matrix */
2955 ring r = (ring)a->Data();
2956 if (r == currRing)
2957 {
2958 res->data = b->Data();
2959 res->rtyp = b->rtyp;
2960 return FALSE;
2961 }
2962 if (!rIsLikeOpposite(currRing, r))
2963 {
2964 Werror("%s is not an opposite ring to current ring",a->Fullname());
2965 return TRUE;
2966 }
2967 idhdl w;
2968 if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
2969 {
2970 int argtype = IDTYP(w);
2971 switch (argtype)
2972 {
2973 case NUMBER_CMD:
2974 {
2975 /* since basefields are equal, we can apply nCopy */
2976 res->data = nCopy((number)IDDATA(w));
2977 res->rtyp = argtype;
2978 break;
2979 }
2980 case POLY_CMD:
2981 case VECTOR_CMD:
2982 {
2983 poly q = (poly)IDDATA(w);
2984 res->data = pOppose(r,q,currRing);
2985 res->rtyp = argtype;
2986 break;
2987 }
2988 case IDEAL_CMD:
2989 case MODUL_CMD:
2990 {
2991 ideal Q = (ideal)IDDATA(w);
2992 res->data = idOppose(r,Q,currRing);
2993 res->rtyp = argtype;
2994 break;
2995 }
2996 case MATRIX_CMD:
2997 {
2998 ring save = currRing;
2999 rChangeCurrRing(r);
3000 matrix m = (matrix)IDDATA(w);
3002 rChangeCurrRing(save);
3003 ideal S = idOppose(r,Q,currRing);
3004 id_Delete(&Q, r);
3005 res->data = id_Module2Matrix(S,currRing);
3006 res->rtyp = argtype;
3007 break;
3008 }
3009 default:
3010 {
3011 WerrorS("unsupported type in oppose");
3012 return TRUE;
3013 }
3014 }
3015 }
3016 else
3017 {
3018 Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
3019 return TRUE;
3020 }
3021 return FALSE;
3022}
@ NUMBER_CMD
Definition: grammar.cc:288
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3381
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3342
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
Definition: old.gring.cc:3315
void rChangeCurrRing(ring r)
Definition: polys.cc:15
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat

◆ jjOPPOSITE()

static BOOLEAN jjOPPOSITE ( leftv  res,
leftv  a 
)
static

Definition at line 5207 of file iparith.cc.

5208{
5209#ifdef HAVE_PLURAL
5210 ring r = (ring)a->Data();
5211 //if (rIsPluralRing(r))
5212 if (r->OrdSgn==1)
5213 {
5214 res->data = rOpposite(r);
5215 }
5216 else
5217 {
5218 WarnS("opposite only for global orderings");
5219 res->data = rCopy(r);
5220 }
5221 return FALSE;
5222#else
5223 return TRUE;
5224#endif
5225}
ring rOpposite(ring src)
Definition: ring.cc:5382

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8078 of file iparith.cc.

8079{
8080 if(v==NULL)
8081 {
8082 res->data=(char *)showOption();
8083 return FALSE;
8084 }
8085 res->rtyp=NONE;
8086 return setOption(res,v);
8087}
char * showOption()
Definition: misc_ip.cc:709
void setOption(int ch)
Definition: shared.cc:1368

◆ jjOR_I()

static BOOLEAN jjOR_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1387 of file iparith.cc.

1388{
1389 res->data = (char *)((long)u->Data() || (long)v->Data());
1390 return FALSE;
1391}

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4713 of file iparith.cc.

4714{
4715 poly p=(poly)v->Data();
4716 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4717 return FALSE;
4718}

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4759 of file iparith.cc.

4760{
4761 poly p=(poly)v->Data();
4762 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4763 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4764 {
4765 WerrorS("poly must be constant");
4766 return TRUE;
4767 }
4768 number i=pGetCoeff(p);
4769 number n;
4771 if (nMap!=NULL)
4772 n=nMap(i,currRing->cf,coeffs_BIGINT);
4773 else goto err;
4774 res->data=(void *)n;
4775 return FALSE;
4776err:
4777 WerrorS("cannot convert to bigint"); return TRUE;
4778}

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4779 of file iparith.cc.

4780{
4781 poly p=(poly)v->Data();
4782 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4783 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4784 {
4785 WerrorS("poly must be constant");
4786 return TRUE;
4787 }
4788 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4789 return FALSE;
4790}

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4827 of file iparith.cc.

4828{
4829 number n;
4830 poly p;
4831 if (((p=(poly)v->Data())!=NULL)
4832 && (pIsConstant(p)))
4833 {
4834 n=nCopy(pGetCoeff(p));
4835 }
4836 else
4837 {
4838 n=nInit(0);
4839 }
4840 res->data = (char *)n;
4841 return FALSE;
4842}

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4719 of file iparith.cc.

4720{
4721 int i=(int)(long)v->Data();
4722 int p=0;
4723 p=rPar(currRing);
4724 if ((0<i) && (i<=p))
4725 {
4726 res->data=(char *)n_Param(i,currRing);
4727 }
4728 else
4729 {
4730 Werror("par number %d out of range 1..%d",i,p);
4731 return TRUE;
4732 }
4733 return FALSE;
4734}
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition: coeffs.h:783

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4735 of file iparith.cc.

4736{
4737 number nn=(number)v->Data();
4738 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4739 return FALSE;
4740}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition: coeffs.h:770

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4741 of file iparith.cc.

4742{
4743 if (currRing==NULL)
4744 {
4745 WerrorS("no ring active (1)");
4746 return TRUE;
4747 }
4748 int i=(int)(long)v->Data();
4749 int p=0;
4750 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4751 res->data=omStrDup(rParameter(currRing)[i-1]);
4752 else
4753 {
4754 Werror("par number %d out of range 1..%d",i,p);
4755 return TRUE;
4756 }
4757 return FALSE;
4758}

◆ jjPARSTR2()

static BOOLEAN jjPARSTR2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 2787 of file iparith.cc.

2788{
2789 idhdl h=(idhdl)u->data;
2790 int i=(int)(long)v->Data();
2791 int p=0;
2792 if ((0<i)
2793 && (rParameter(IDRING(h))!=NULL)
2794 && (i<=(p=rPar(IDRING(h)))))
2795 res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2796 else
2797 {
2798 Werror("par number %d out of range 1..%d",i,p);
2799 return TRUE;
2800 }
2801 return FALSE;
2802}
#define IDRING(a)
Definition: ipid.h:127

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4549 of file iparith.cc.

4550{
4551 /* call method jjPFAC2 with second argument = 0 (meaning that no
4552 valid bound for the prime factors has been given) */
4553 sleftv tmp;
4554 tmp.Init();
4555 tmp.rtyp = INT_CMD;
4556 return jjPFAC2(res, v, &tmp);
4557}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3211

◆ jjPFAC2()

static BOOLEAN jjPFAC2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3211 of file iparith.cc.

3212{
3213 number n1; int i;
3214
3215 if ((u->Typ() == BIGINT_CMD) ||
3216 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3217 {
3218 n1 = (number)u->CopyD();
3219 }
3220 else if (u->Typ() == INT_CMD)
3221 {
3222 i = (int)(long)u->Data();
3223 n1 = n_Init(i, coeffs_BIGINT);
3224 }
3225 else
3226 {
3227 return TRUE;
3228 }
3229
3230 i = (int)(long)v->Data();
3231
3232 lists l = primeFactorisation(n1, i);
3233 n_Delete(&n1, coeffs_BIGINT);
3234 res->data = (char*)l;
3235 return FALSE;
3236}
lists primeFactorisation(const number n, const int pBound)
Factorises a given bigint number n into its prime factors less than or equal to a given bound,...
Definition: misc_ip.cc:357

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5599 of file iparith.cc.

5600{
5601 res->data = (char *)pHead((poly)v->Data());
5602 return FALSE;
5603}

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5574 of file iparith.cc.

5575{
5576 res->data = (char *)(long)pLength((poly)v->Data());
5577 return FALSE;
5578}

◆ jjPlural_mat_mat()

static BOOLEAN jjPlural_mat_mat ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2864 of file iparith.cc.

2865{
2866 if( currRing->qideal != NULL )
2867 {
2868 WerrorS("basering must NOT be a qring!");
2869 return TRUE;
2870 }
2871
2872 if (iiOp==NCALGEBRA_CMD)
2873 {
2874 return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2875 }
2876 else
2877 {
2878 ring r=rCopy(currRing);
2879 BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2880 res->data=r;
2881 return result;
2882 }
2883}
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2682
@ NCALGEBRA_CMD
Definition: tok.h:137

◆ jjPlural_mat_poly()

static BOOLEAN jjPlural_mat_poly ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2844 of file iparith.cc.

2845{
2846 if( currRing->qideal != NULL )
2847 {
2848 WerrorS("basering must NOT be a qring!");
2849 return TRUE;
2850 }
2851
2852 if (iiOp==NCALGEBRA_CMD)
2853 {
2854 return nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),currRing,false,true,false,currRing);
2855 }
2856 else
2857 {
2858 ring r=rCopy(currRing);
2859 BOOLEAN result=nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),r,false,true,false,currRing);
2860 res->data=r;
2861 return result;
2862 }
2863}

◆ jjPlural_num_mat()

static BOOLEAN jjPlural_num_mat ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2824 of file iparith.cc.

2825{
2826 if( currRing->qideal != NULL )
2827 {
2828 WerrorS("basering must NOT be a qring!");
2829 return TRUE;
2830 }
2831
2832 if (iiOp==NCALGEBRA_CMD)
2833 {
2834 return nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,currRing,false,true,false,currRing);
2835 }
2836 else
2837 {
2838 ring r=rCopy(currRing);
2839 BOOLEAN result=nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,r,false,true,false,currRing);
2840 res->data=r;
2841 return result;
2842 }
2843}

◆ jjPlural_num_poly()

static BOOLEAN jjPlural_num_poly ( leftv  res,
leftv  a,
leftv  b 
)
static

Definition at line 2804 of file iparith.cc.

2805{
2806 if( currRing->qideal != NULL )
2807 {
2808 WerrorS("basering must NOT be a qring!");
2809 return TRUE;
2810 }
2811
2812 if (iiOp==NCALGEBRA_CMD)
2813 {
2814 return nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),currRing,false,true,false,currRing);
2815 }
2816 else
2817 {
2818 ring r=rCopy(currRing);
2819 BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),r,false,true,false,currRing);
2820 res->data=r;
2821 return result;
2822 }
2823}

◆ jjPLUS_B()

static BOOLEAN jjPLUS_B ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 785 of file iparith.cc.

786{
787 //res->data = (char *)(pAdd((poly)u->CopyD(POLY_CMD) , (poly)v->CopyD(POLY_CMD)));
789 poly p=(poly)u->CopyD(POLY_CMD);
790 int l=pLength(p);
792 p= (poly)v->CopyD(POLY_CMD);
793 l=pLength(p);
795 res->data=(void*)b;
796 return jjPLUSMINUS_Gen(res,u,v);
797}

◆ jjPLUS_B_P()

static BOOLEAN jjPLUS_B_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 798 of file iparith.cc.

799{
801 poly p= (poly)v->CopyD(POLY_CMD);
802 int l=pLength(p);
804 res->data=(void*)b;
805 return jjPLUSMINUS_Gen(res,u,v);
806}

◆ jjPLUS_BI()

static BOOLEAN jjPLUS_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 770 of file iparith.cc.

771{
772 res->data = (char *)(n_Add((number)u->Data(), (number)v->Data(),coeffs_BIGINT));
773 return jjPLUSMINUS_Gen(res,u,v);
774}
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
Definition: coeffs.h:650

◆ jjPLUS_BIM()

static BOOLEAN jjPLUS_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 817 of file iparith.cc.

818{
819 res->data = (char *)bimAdd((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
820 if (res->data==NULL)
821 {
822 WerrorS("bigintmat/cmatrix not compatible");
823 return TRUE;
824 }
825 return jjPLUSMINUS_Gen(res,u,v);
826}

◆ jjPLUS_I()

static BOOLEAN jjPLUS_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 758 of file iparith.cc.

759{
760 unsigned int a=(unsigned int)(unsigned long)u->Data();
761 unsigned int b=(unsigned int)(unsigned long)v->Data();
762 unsigned int c=a+b;
763 res->data = (char *)((long)c);
764 if (((Sy_bit(31)&a)==(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
765 {
766 WarnS("int overflow(+), result may be wrong");
767 }
768 return jjPLUSMINUS_Gen(res,u,v);
769}

◆ jjPLUS_ID()

static BOOLEAN jjPLUS_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 876 of file iparith.cc.

877{
878 res->data = (char *)idAdd((ideal)u->Data(),(ideal)v->Data());
879 return jjPLUSMINUS_Gen(res,u,v);
880}
ideal idAdd(ideal h1, ideal h2)
h1 + h2
Definition: ideals.h:68

◆ jjPLUS_IV()

static BOOLEAN jjPLUS_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 807 of file iparith.cc.

808{
809 res->data = (char *)ivAdd((intvec*)(u->Data()), (intvec*)(v->Data()));
810 if (res->data==NULL)
811 {
812 WerrorS("intmat size not compatible");
813 return TRUE;
814 }
815 return jjPLUSMINUS_Gen(res,u,v);
816}
intvec * ivAdd(intvec *a, intvec *b)
Definition: intvec.cc:249

◆ jjPLUS_MA()

static BOOLEAN jjPLUS_MA ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 827 of file iparith.cc.

828{
829 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
830 res->data = (char *)(mp_Add(A , B, currRing));
831 if (res->data==NULL)
832 {
833 Werror("matrix size not compatible(%dx%d, %dx%d)",
835 return TRUE;
836 }
837 return jjPLUSMINUS_Gen(res,u,v);
838}
matrix mp_Add(matrix a, matrix b, const ring R)
Definition: matpol.cc:179

◆ jjPLUS_MA_P()

static BOOLEAN jjPLUS_MA_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 851 of file iparith.cc.

852{
853 matrix m=(matrix)u->Data();
854 matrix p= mp_InitP(m->nrows,m->ncols,(poly)(v->CopyD(POLY_CMD)),currRing);
855 if (iiOp=='+')
856 res->data = (char *)mp_Add(m , p,currRing);
857 else
858 res->data = (char *)mp_Sub(m , p,currRing);
859 idDelete((ideal *)&p);
860 return jjPLUSMINUS_Gen(res,u,v);
861}
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
Definition: matpol.cc:113

◆ jjPLUS_N()

static BOOLEAN jjPLUS_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 775 of file iparith.cc.

776{
777 res->data = (char *)(nAdd((number)u->Data(), (number)v->Data()));
778 return jjPLUSMINUS_Gen(res,u,v);
779}
#define nAdd(n1, n2)
Definition: numbers.h:18

◆ jjPLUS_P_MA()

static BOOLEAN jjPLUS_P_MA ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 862 of file iparith.cc.

863{
864 return jjPLUS_MA_P(res,v,u);
865}
static BOOLEAN jjPLUS_MA_P(leftv res, leftv u, leftv v)
Definition: iparith.cc:851

◆ jjPLUS_S()

static BOOLEAN jjPLUS_S ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 866 of file iparith.cc.

867{
868 char* a = (char * )(u->Data());
869 char* b = (char * )(v->Data());
870 char* r = (char * )omAlloc(strlen(a) + strlen(b) + 1);
871 strcpy(r,a);
872 strcat(r,b);
873 res->data=r;
874 return jjPLUSMINUS_Gen(res,u,v);
875}

◆ jjPLUS_SM()

static BOOLEAN jjPLUS_SM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 839 of file iparith.cc.

840{
841 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
842 res->data = (char *)(sm_Add(A , B, currRing));
843 if (res->data==NULL)
844 {
845 Werror("matrix size not compatible(%dx%d, %dx%d)",
846 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
847 return TRUE;
848 }
849 return jjPLUSMINUS_Gen(res,u,v);
850}
ideal sm_Add(ideal a, ideal b, const ring R)
Definition: matpol.cc:1871

◆ jjPLUS_V()

static BOOLEAN jjPLUS_V ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 780 of file iparith.cc.

781{
782 res->data = (char *)(pAdd((poly)u->CopyD(POLY_CMD) , (poly)v->CopyD(POLY_CMD)));
783 return jjPLUSMINUS_Gen(res,u,v);
784}

◆ jjPLUSMINUS_Gen()

static BOOLEAN jjPLUSMINUS_Gen ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 634 of file iparith.cc.

635{
636 u=u->next;
637 v=v->next;
638 if (u==NULL)
639 {
640 if (v==NULL) return FALSE; /* u==NULL, v==NULL */
641 if (iiOp=='-') /* u==NULL, v<>NULL, iiOp=='-'*/
642 {
643 do
644 {
645 if (res->next==NULL)
647 leftv tmp_v=v->next;
648 v->next=NULL;
649 BOOLEAN b=iiExprArith1(res->next,v,'-');
650 v->next=tmp_v;
651 if (b)
652 return TRUE;
653 v=tmp_v;
654 res=res->next;
655 } while (v!=NULL);
656 return FALSE;
657 }
658 loop /* u==NULL, v<>NULL, iiOp=='+' */
659 {
661 res=res->next;
662 res->data = v->CopyD();
663 res->rtyp = v->Typ();
664 v=v->next;
665 if (v==NULL) return FALSE;
666 }
667 }
668 if (v!=NULL) /* u<>NULL, v<>NULL */
669 {
670 do
671 {
673 leftv tmp_u=u->next; u->next=NULL;
674 leftv tmp_v=v->next; v->next=NULL;
675 BOOLEAN b=iiExprArith2(res->next,u,iiOp,v);
676 u->next=tmp_u;
677 v->next=tmp_v;
678 if (b)
679 return TRUE;
680 u=tmp_u;
681 v=tmp_v;
682 res=res->next;
683 } while ((u!=NULL) && (v!=NULL));
684 return FALSE;
685 }
686 loop /* u<>NULL, v==NULL */
687 {
689 res=res->next;
690 res->data = u->CopyD();
691 res->rtyp = u->Typ();
692 u=u->next;
693 if (u==NULL) return FALSE;
694 }
695}

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3702 of file iparith.cc.

3703{
3704 if (IDTYP((idhdl)u->data)==INT_CMD)
3705 {
3706 int i=IDINT((idhdl)u->data);
3707 if (iiOp==PLUSPLUS) i++;
3708 else i--;
3709 IDDATA((idhdl)u->data)=(char *)(long)i;
3710 return FALSE;
3711 }
3712 return TRUE;
3713}
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5622 of file iparith.cc.

5623{
5624 res->data = (char *)pMaxComp((poly)v->Data());
5625 return FALSE;
5626}

◆ jjPOWER_BI()

static BOOLEAN jjPOWER_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 571 of file iparith.cc.

572{
573 int e=(int)(long)v->Data();
574 number n=(number)u->Data();
575 if (e>=0)
576 {
577 n_Power(n,e,(number*)&res->data,coeffs_BIGINT);
578 }
579 else
580 {
581 WerrorS("exponent must be non-negative");
582 return TRUE;
583 }
584 if (u!=NULL) return jjOP_REST(res,u,v);
585 return FALSE;
586}
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:632
static BOOLEAN jjOP_REST(leftv res, leftv u, leftv v)
Definition: iparith.cc:509

◆ jjPOWER_I()

static BOOLEAN jjPOWER_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 525 of file iparith.cc.

526{
527 int b=(int)(long)u->Data();
528 int e=(int)(long)v->Data();
529 int rc = 1;
530 BOOLEAN overflow=FALSE;
531 if (e >= 0)
532 {
533 if (b==0)
534 {
535 rc=(e==0);
536 }
537 else if ((e==0)||(b==1))
538 {
539 rc= 1;
540 }
541 else if (b== -1)
542 {
543 if (e&1) rc= -1;
544 else rc= 1;
545 }
546 else
547 {
548 int oldrc;
549 while ((e--)!=0)
550 {
551 oldrc=rc;
552 rc *= b;
553 if (!overflow)
554 {
555 if(rc/b!=oldrc) overflow=TRUE;
556 }
557 }
558 if (overflow)
559 WarnS("int overflow(^), result may be wrong");
560 }
561 res->data = (char *)((long)rc);
562 if (u!=NULL) return jjOP_REST(res,u,v);
563 return FALSE;
564 }
565 else
566 {
567 WerrorS("exponent must be non-negative");
568 return TRUE;
569 }
570}

◆ jjPOWER_ID()

static BOOLEAN jjPOWER_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 628 of file iparith.cc.

629{
630 res->data = (char *)id_Power((ideal)(u->Data()),(int)(long)(v->Data()), currRing);
631 if (u!=NULL) return jjOP_REST(res,u,v);
632 return FALSE;
633}
ideal id_Power(ideal given, int exp, const ring r)

◆ jjPOWER_N()

static BOOLEAN jjPOWER_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 587 of file iparith.cc.

588{
589 int e=(int)(long)v->Data();
590 number n=(number)u->Data();
591 int d=0;
592 if (e<0)
593 {
594 n=nInvers(n);
595 e=-e;
596 d=1;
597 }
598 number r;
599 nPower(n,e,(number*)&r);
600 res->data=(char*)r;
601 if (d) nDelete(&n);
602 if (u!=NULL) return jjOP_REST(res,u,v);
603 return FALSE;
604}
#define nInvers(a)
Definition: numbers.h:33
#define nPower(a, b, res)
Definition: numbers.h:38

◆ jjPOWER_P()

static BOOLEAN jjPOWER_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 605 of file iparith.cc.

606{
607 int v_i=(int)(long)v->Data();
608 if (v_i<0)
609 {
610 WerrorS("exponent must be non-negative");
611 return TRUE;
612 }
613 poly u_p=(poly)u->CopyD(POLY_CMD);
614 if ((u_p!=NULL)
615 && (!rIsLPRing(currRing))
616 && ((v_i!=0) &&
617 ((long)pTotaldegree(u_p) > (signed long)currRing->bitmask / (signed long)v_i/2)))
618 {
619 Werror("OVERFLOW in power(d=%ld, e=%d, max=%ld)",
620 pTotaldegree(u_p),v_i,currRing->bitmask/2);
621 pDelete(&u_p);
622 return TRUE;
623 }
624 res->data = (char *)pPower(u_p,v_i);
625 if (u!=NULL) return jjOP_REST(res,u,v);
626 return errorreported; /* pPower may set errorreported via Werror */
627}
static long pTotaldegree(poly p)
Definition: polys.h:282

◆ jjPREIMAGE()

static BOOLEAN jjPREIMAGE ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6454 of file iparith.cc.

6455{
6456 // handles preimage(r,phi,i) and kernel(r,phi)
6457 idhdl h;
6458 ring rr;
6459 map mapping;
6460 BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6461
6462 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6463 {
6464 WerrorS("2nd/3rd arguments must have names");
6465 return TRUE;
6466 }
6467 rr=(ring)u->Data();
6468 const char *ring_name=u->Name();
6469 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6470 {
6471 if (h->typ==MAP_CMD)
6472 {
6473 mapping=IDMAP(h);
6474 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6475 if ((preim_ring==NULL)
6476 || (IDRING(preim_ring)!=currRing))
6477 {
6478 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6479 return TRUE;
6480 }
6481 }
6482 else if (h->typ==IDEAL_CMD)
6483 {
6484 mapping=IDMAP(h);
6485 }
6486 else
6487 {
6488 Werror("`%s` is no map nor ideal",IDID(h));
6489 return TRUE;
6490 }
6491 }
6492 else
6493 {
6494 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6495 return TRUE;
6496 }
6497 ideal image;
6498 if (kernel_cmd) image=idInit(1,1);
6499 else
6500 {
6501 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6502 {
6503 if (h->typ==IDEAL_CMD)
6504 {
6505 image=IDIDEAL(h);
6506 }
6507 else
6508 {
6509 Werror("`%s` is no ideal",IDID(h));
6510 return TRUE;
6511 }
6512 }
6513 else
6514 {
6515 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6516 return TRUE;
6517 }
6518 }
6519 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6520 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6521 {
6522 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6523 }
6524 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6525 if (kernel_cmd) idDelete(&image);
6526 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6527}
#define IDMAP(a)
Definition: ipid.h:135
#define IDIDEAL(a)
Definition: ipid.h:133
#define IDID(a)
Definition: ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:57
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:761
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4791 of file iparith.cc.

4792{
4793 map mapping=(map)v->Data();
4794 syMake(res,omStrDup(mapping->preimage));
4795 return FALSE;
4796}

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4797 of file iparith.cc.

4798{
4799 int i = IsPrime((int)(long)(v->Data()));
4800 res->data = (char *)(long)(i > 1 ? i : 2);
4801 return FALSE;
4802}
int IsPrime(int p)
Definition: prime.cc:61

◆ jjPROC()

BOOLEAN jjPROC ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 1619 of file iparith.cc.

1620{
1621 void *d;
1622 Subexpr e;
1623 int typ;
1624 BOOLEAN t=FALSE;
1625 idhdl tmp_proc=NULL;
1626 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
1627 {
1628 tmp_proc=(idhdl)omAlloc0(sizeof(idrec));
1629 tmp_proc->id="_auto";
1630 tmp_proc->typ=PROC_CMD;
1631 tmp_proc->data.pinf=(procinfo *)u->Data();
1632 tmp_proc->ref=1;
1633 d=u->data; u->data=(void *)tmp_proc;
1634 e=u->e; u->e=NULL;
1635 t=TRUE;
1636 typ=u->rtyp; u->rtyp=IDHDL;
1637 }
1638 BOOLEAN sl;
1639 if (u->req_packhdl==currPack)
1640 sl = iiMake_proc((idhdl)u->data,NULL,v);
1641 else
1642 sl = iiMake_proc((idhdl)u->data,u->req_packhdl,v);
1643 if (t)
1644 {
1645 u->rtyp=typ;
1646 u->data=d;
1647 u->e=e;
1648 omFreeSize(tmp_proc,sizeof(idrec));
1649 }
1650 if (sl) return TRUE;
1651 memcpy(res,&iiRETURNEXPR,sizeof(sleftv));
1653 return FALSE;
1654}
int typ
Definition: idrec.h:43
short ref
Definition: idrec.h:46
const char * id
Definition: idrec.h:39
package req_packhdl
Definition: subexpr.h:106
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
Definition: iplib.cc:504
INST_VAR sleftv iiRETURNEXPR
Definition: iplib.cc:474

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3779 of file iparith.cc.

3780{
3781 return jjPROC(res,u,NULL);
3782}
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1619

◆ jjPROC3()

static BOOLEAN jjPROC3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5962 of file iparith.cc.

5963{
5965 memcpy(v->next,w,sizeof(sleftv));
5966 w->Init();
5967 return jjPROC(res,u,v);
5968}

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4803 of file iparith.cc.

4804{
4805 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4806 ideal v_id=(ideal)v->Data();
4807 if (w!=NULL)
4808 {
4809 if (!idTestHomModule(v_id,currRing->qideal,w))
4810 {
4811 WarnS("wrong weights");
4812 w=NULL;
4813 // and continue at the non-homog case below
4814 }
4815 else
4816 {
4817 w=ivCopy(w);
4818 intvec **ww=&w;
4819 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4820 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4821 return FALSE;
4822 }
4823 }
4824 res->data = (char *)idMinEmbedding(v_id);
4825 return FALSE;
4826}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2691

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8553 of file iparith.cc.

8554{
8555 if ((INPUT->Typ() != MATRIX_CMD) ||
8556 (INPUT->next->Typ() != NUMBER_CMD) ||
8557 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8558 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8559 {
8560 WerrorS("expected (matrix, number, number, number) as arguments");
8561 return TRUE;
8562 }
8563 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8564 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8565 (number)(v->Data()),
8566 (number)(w->Data()),
8567 (number)(x->Data()));
8568 return FALSE;
8569}
lists qrDoubleShift(const matrix A, const number tol1, const number tol2, const number tol3, const ring r=currRing)
Computes all eigenvalues of a given real quadratic matrix with multiplicites.

◆ jjQUOT()

static BOOLEAN jjQUOT ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3025 of file iparith.cc.

3026{
3027 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3028 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3030 return FALSE;
3031}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1494

◆ jjRANDOM()

static BOOLEAN jjRANDOM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3032 of file iparith.cc.

3033{
3034 int i=(int)(long)u->Data();
3035 int j=(int)(long)v->Data();
3036 if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3037 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3038 return FALSE;
3039}
int siRand()
Definition: sirandom.c:42

◆ jjRANDOM_Im()

static BOOLEAN jjRANDOM_Im ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6528 of file iparith.cc.

6529{
6530 int di, k;
6531 int i=(int)(long)u->Data();
6532 int r=(int)(long)v->Data();
6533 int c=(int)(long)w->Data();
6534 if ((r<=0) || (c<=0)) return TRUE;
6535 intvec *iv = new intvec(r, c, 0);
6536 if (iv->rows()==0)
6537 {
6538 delete iv;
6539 return TRUE;
6540 }
6541 if (i!=0)
6542 {
6543 if (i<0) i = -i;
6544 di = 2 * i + 1;
6545 for (k=0; k<iv->length(); k++)
6546 {
6547 (*iv)[k] = ((siRand() % di) - i);
6548 }
6549 }
6550 res->data = (char *)iv;
6551 return FALSE;
6552}

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4865 of file iparith.cc.

4866{
4867 matrix m =(matrix)v->Data();
4868 int rank = luRank(m, 0);
4869 res->data =(char *)(long)rank;
4870 return FALSE;
4871}
int luRank(const matrix aMat, const bool isRowEchelon, const ring R)
Computes the rank of a given (m x n)-matrix.

◆ jjRANK2()

static BOOLEAN jjRANK2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3040 of file iparith.cc.

3041{
3042 matrix m =(matrix)u->Data();
3043 int isRowEchelon = (int)(long)v->Data();
3044 if (isRowEchelon != 1) isRowEchelon = 0;
3045 int rank = luRank(m, isRowEchelon);
3046 res->data =(char *)(long)rank;
3047 return FALSE;
3048}

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5594 of file iparith.cc.

5595{
5596 res->data = rCharStr((ring)v->Data());
5597 return FALSE;
5598}
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: ring.cc:647

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4872 of file iparith.cc.

4873{
4874 return jjREAD2(res,v,NULL);
4875}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3049

◆ jjREAD2()

static BOOLEAN jjREAD2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3049 of file iparith.cc.

3050{
3051 si_link l=(si_link)u->Data();
3052 leftv r=slRead(l,v);
3053 if (r==NULL)
3054 {
3055 const char *s;
3056 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3057 else s=sNoName_fe;
3058 Werror("cannot read from `%s`",s);
3059 return TRUE;
3060 }
3061 memcpy(res,r,sizeof(sleftv));
3063 return FALSE;
3064}

◆ jjREDUCE3_CID()

static BOOLEAN jjREDUCE3_CID ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6973 of file iparith.cc.

6974{
6976 if (!idIsZeroDim((ideal)v->Data()))
6977 {
6978 Werror("`%s` must be 0-dimensional",v->Name());
6979 return TRUE;
6980 }
6981 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
6982 (matrix)w->CopyD());
6983 return FALSE;
6984}
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:176
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:2135

◆ jjREDUCE3_CP()

static BOOLEAN jjREDUCE3_CP ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6961 of file iparith.cc.

6962{
6964 if (!idIsZeroDim((ideal)v->Data()))
6965 {
6966 Werror("`%s` must be 0-dimensional",v->Name());
6967 return TRUE;
6968 }
6969 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
6970 (poly)w->CopyD());
6971 return FALSE;
6972}

◆ jjREDUCE3_ID()

static BOOLEAN jjREDUCE3_ID ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6992 of file iparith.cc.

6993{
6995 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
6996 0,(int)(long)w->Data());
6997 return FALSE;
6998}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3167

◆ jjREDUCE3_P()

static BOOLEAN jjREDUCE3_P ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6985 of file iparith.cc.

6986{
6988 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
6989 0,(int)(long)w->Data());
6990 return FALSE;
6991}

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8088 of file iparith.cc.

8089{
8090 leftv u1=u;
8091 leftv u2=u1->next;
8092 leftv u3=u2->next;
8093 leftv u4=u3->next;
8094 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8095 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8096 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8097 {
8098 int save_d=Kstd1_deg;
8099 Kstd1_deg=(int)(long)u3->Data();
8100 kModW=(intvec *)u4->Data();
8101 BITSET save2;
8102 SI_SAVE_OPT2(save2);
8104 u2->next=NULL;
8105 BOOLEAN r=jjCALL2ARG(res,u);
8106 kModW=NULL;
8107 Kstd1_deg=save_d;
8108 SI_RESTORE_OPT2(save2);
8109 u->next->next=u3;
8110 return r;
8111 }
8112 else
8113 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8114 (u4->Typ()==INT_CMD))
8115 {
8116 assumeStdFlag(u3);
8117 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8118 {
8119 WerrorS("2nd argument must be a diagonal matrix of units");
8120 return TRUE;
8121 }
8122 res->data=(char*)redNF(
8123 idCopy((ideal)u3->Data()),
8124 idCopy((ideal)u1->Data()),
8125 mp_Copy((matrix)u2->Data(), currRing),
8126 (int)(long)u4->Data()
8127 );
8128 return FALSE;
8129 }
8130 else
8131 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8132 (u4->Typ()==INT_CMD))
8133 {
8134 poly u1p;
8135 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8136 else u1p=(poly)u1->Data();
8137 poly u2p;
8138 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8139 else u2p=(poly)u2->Data();
8140 assumeStdFlag(u3);
8141 if(!pIsUnit(u2p))
8142 {
8143 WerrorS("2nd argument must be a unit");
8144 return TRUE;
8145 }
8146 res->rtyp=POLY_CMD;
8147 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8148 pCopy(u2p),(int)(long)u4->Data());
8149 return FALSE;
8150 }
8151 else
8152 {
8153 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8154 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8155 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8156 return TRUE;
8157 }
8158}
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:7125
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:49
VAR unsigned si_opt_2
Definition: options.c:6
#define SI_SAVE_OPT2(A)
Definition: options.h:22
#define SI_RESTORE_OPT2(A)
Definition: options.h:25
#define V_DEG_STOP
Definition: options.h:72
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
#define BITSET
Definition: structs.h:16

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 8159 of file iparith.cc.

8160{
8161 leftv u1=u;
8162 leftv u2=u1->next;
8163 leftv u3=u2->next;
8164 leftv u4=u3->next;
8165 leftv u5=u4->next;
8166 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8167 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8168 {
8169 assumeStdFlag(u3);
8170 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8171 {
8172 WerrorS("2nd argument must be a diagonal matrix of units");
8173 return TRUE;
8174 }
8175 res->data=(char*)redNF(
8176 idCopy((ideal)u3->Data()),
8177 idCopy((ideal)u1->Data()),
8178 mp_Copy((matrix)u2->Data(),currRing),
8179 (int)(long)u4->Data(),
8180 (intvec*)u5->Data()
8181 );
8182 return FALSE;
8183 }
8184 else
8185 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8186 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8187 {
8188 assumeStdFlag(u3);
8189 if(!pIsUnit((poly)u2->Data()))
8190 {
8191 WerrorS("2nd argument must be a unit");
8192 return TRUE;
8193 }
8194 res->rtyp=POLY_CMD;
8195 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8196 pCopy((poly)u2->Data()),
8197 (int)(long)u4->Data(),(intvec*)u5->Data());
8198 return FALSE;
8199 }
8200 else
8201 {
8202 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8203 Tok2Cmdname(iiOp));
8204 return TRUE;
8205 }
8206}

◆ jjREDUCE_ID()

static BOOLEAN jjREDUCE_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3073 of file iparith.cc.

3074{
3075 ideal ui=(ideal)u->Data();
3076 ideal vi=(ideal)v->Data();
3077 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3079 res->data = (char *)kNF(vi,currRing->qideal,ui);
3080 return FALSE;
3081}

◆ jjREDUCE_P()

static BOOLEAN jjREDUCE_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3065 of file iparith.cc.

3066{
3067 ideal vi=(ideal)v->Data();
3068 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3070 res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3071 return FALSE;
3072}

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4876 of file iparith.cc.

4877{
4878 res->data = (char *)(long)iiRegularity((lists)v->Data());
4879 return FALSE;
4880}
int iiRegularity(lists L)
Definition: ipshell.cc:1037

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4881 of file iparith.cc.

4882{
4883 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4884 return FALSE;
4885}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition: coeffs.h:790

◆ jjRES()

static BOOLEAN jjRES ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3082 of file iparith.cc.

3083{
3084 int maxl=(int)(long)v->Data();
3085 if (maxl<0)
3086 {
3087 WerrorS("length for res must not be negative");
3088 return TRUE;
3089 }
3090 syStrategy r;
3091 intvec *weights=NULL;
3092 int wmaxl=maxl;
3093 ideal u_id=(ideal)u->Data();
3094
3095 maxl--;
3096 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/
3097 {
3098 maxl = currRing->N-1+2*(iiOp==MRES_CMD);
3099 if (currRing->qideal!=NULL)
3100 {
3101 Warn(
3102 "full resolution in a qring may be infinite, setting max length to %d",
3103 maxl+1);
3104 }
3105 }
3106 weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
3107 if (weights!=NULL)
3108 {
3109 if (!idTestHomModule(u_id,currRing->qideal,weights))
3110 {
3111 WarnS("wrong weights given:");weights->show();PrintLn();
3112 weights=NULL;
3113 }
3114 }
3115 intvec *ww=NULL;
3116 int add_row_shift=0;
3117 if (weights!=NULL)
3118 {
3119 ww=ivCopy(weights);
3120 add_row_shift = ww->min_in();
3121 (*ww) -= add_row_shift;
3122 }
3123 unsigned save_opt=si_opt_1;
3125 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
3126 {
3127 r=syResolution(u_id,maxl, ww, iiOp==MRES_CMD);
3128 }
3129 else if (iiOp==SRES_CMD)
3130 // r=sySchreyerResolvente(u_id,maxl+1,&l);
3131 r=sySchreyer(u_id,maxl+1);
3132 else if (iiOp == LRES_CMD)
3133 {
3134 int dummy;
3135 if((currRing->qideal!=NULL)||
3136 (!idHomIdeal (u_id,NULL)))
3137 {
3138 WerrorS
3139 ("`lres` not implemented for inhomogeneous input or qring");
3140 return TRUE;
3141 }
3142 if(currRing->N == 1)
3143 WarnS("the current implementation of `lres` may not work in the case of a single variable");
3144 r=syLaScala3(u_id,&dummy);
3145 }
3146 else if (iiOp == KRES_CMD)
3147 {
3148 int dummy;
3149 if((currRing->qideal!=NULL)||
3150 (!idHomIdeal (u_id,NULL)))
3151 {
3152 WerrorS
3153 ("`kres` not implemented for inhomogeneous input or qring");
3154 return TRUE;
3155 }
3156 r=syKosz(u_id,&dummy);
3157 }
3158 else
3159 {
3160 int dummy;
3161 if((currRing->qideal!=NULL)||
3162 (!idHomIdeal (u_id,NULL)))
3163 {
3164 WerrorS
3165 ("`hres` not implemented for inhomogeneous input or qring");
3166 return TRUE;
3167 }
3168 ideal u_id_copy=idCopy(u_id);
3169 idSkipZeroes(u_id_copy);
3170 r=syHilb(u_id_copy,&dummy);
3171 idDelete(&u_id_copy);
3172 }
3173 if (r==NULL) return TRUE;
3174 if (r->list_length>wmaxl)
3175 {
3176 for(int i=wmaxl-1;i>=r->list_length;i--)
3177 {
3178 if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
3179 if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
3180 }
3181 }
3182 r->list_length=wmaxl;
3183 res->data=(void *)r;
3184 if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
3185 if ((r->weights!=NULL) && (r->weights[0]!=NULL))
3186 {
3187 ww=ivCopy(r->weights[0]);
3188 if (weights!=NULL) (*ww) += add_row_shift;
3189 atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
3190 }
3191 else
3192 {
3193 if (weights!=NULL)
3194 {
3195 atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
3196 }
3197 }
3198
3199 // test the La Scala case' output
3200 assume( ((iiOp == LRES_CMD) || (iiOp == HRES_CMD)) == (r->syRing != NULL) );
3201 assume( (r->syRing != NULL) == (r->resPairs != NULL) );
3202
3203 if(iiOp != HRES_CMD)
3204 assume( (r->minres != NULL) || (r->fullres != NULL) ); // is wrong for HRES_CMD...
3205 else
3206 assume( (r->orderedRes != NULL) || (r->res != NULL) ); // analog for hres...
3207
3208 si_opt_1=save_opt;
3209 return FALSE;
3210}
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
VAR unsigned si_opt_1
Definition: options.c:5
#define OPT_REDTAIL_SYZ
Definition: options.h:87
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
Definition: syz.cc:613
syStrategy syHilb(ideal arg, int *length)
Definition: syz2.cc:950
syStrategy sySchreyer(ideal arg, int maxlength)
Definition: syz0.cc:1018
ring syRing
Definition: syz.h:56
resolvente minres
Definition: syz.h:58
syStrategy syKosz(ideal arg, int *length)
Definition: syz3.cc:1763
short list_length
Definition: syz.h:62
resolvente res
Definition: syz.h:47
intvec ** weights
Definition: syz.h:45
resolvente orderedRes
Definition: syz.h:48
SRes resPairs
Definition: syz.h:49
syStrategy syLaScala3(ideal arg, int *length)
Definition: syz1.cc:2432
@ LRES_CMD
Definition: tok.h:120
@ HRES_CMD
Definition: tok.h:91
@ KRES_CMD
Definition: tok.h:109
@ MRES_CMD
Definition: tok.h:131
@ SRES_CMD
Definition: tok.h:182
@ RES_CMD
Definition: tok.h:167

◆ jjRES3()

static BOOLEAN jjRES3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 7000 of file iparith.cc.

7001{
7002 int maxl=(int)v->Data();
7003 ideal u_id=(ideal)u->Data();
7004 int l=0;
7005 resolvente r;
7006 intvec **weights=NULL;
7007 int wmaxl=maxl;
7008 maxl--;
7009 unsigned save_opt=si_opt_1;
7011 if ((maxl==-1) && (iiOp!=MRES_CMD))
7012 maxl = currRing->N-1;
7013 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7014 {
7015 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7016 if (iv!=NULL)
7017 {
7018 l=1;
7019 if (!idTestHomModule(u_id,currRing->qideal,iv))
7020 {
7021 WarnS("wrong weights");
7022 iv=NULL;
7023 }
7024 else
7025 {
7026 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7027 weights[0] = ivCopy(iv);
7028 }
7029 }
7030 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7031 }
7032 else
7033 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7034 if (r==NULL) return TRUE;
7035 int t3=u->Typ();
7036 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7037 si_opt_1=save_opt;
7038 return FALSE;
7039}
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:847
EXTERN_VAR omBin char_ptr_bin
Definition: structs.h:77
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:389
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:855

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 8207 of file iparith.cc.

8208{
8209 unsigned i=1;
8210 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8211 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8212 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8213 // sArithBase.nCmdAllocated);
8214 for(i=0; i<nCount; i++)
8215 {
8216 Print("%-20s",sArithBase.sCmds[i+1].name);
8217 if(i+1+nCount<sArithBase.nCmdUsed)
8218 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8219 if(i+1+2*nCount<sArithBase.nCmdUsed)
8220 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8221 //if ((i%3)==1) PrintLn();
8222 PrintLn();
8223 }
8224 PrintLn();
8226 return FALSE;
8227}
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8229 of file iparith.cc.

8230{
8231 unsigned i=1;
8232 int l = 0;
8233 int k = 0;
8235 struct blackbox_list *bb_list = NULL;
8236 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8237
8238 if ((3*nCount) < sArithBase.nCmdUsed)
8239 {
8240 nCount++;
8241 }
8242 bb_list = getBlackboxTypes();
8243 // count the number of entries;
8244 for (i=0; i<nCount; i++)
8245 {
8246 l++;
8247 if (i + 1 + nCount < sArithBase.nCmdUsed)
8248 {
8249 l++;
8250 }
8251 if(i+1+2*nCount<sArithBase.nCmdUsed)
8252 {
8253 l++;
8254 }
8255 }
8256 for (i = 0; i < bb_list->count; i++)
8257 {
8258 if (bb_list->list[i] != NULL)
8259 {
8260 l++;
8261 }
8262 }
8263 // initiate list
8264 L->Init(l);
8265 k = 0;
8266 for (i=0; i<nCount; i++)
8267 {
8268 L->m[k].rtyp = STRING_CMD;
8269 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8270 k++;
8271 // Print("%-20s", sArithBase.sCmds[i+1].name);
8272 if (i + 1 + nCount < sArithBase.nCmdUsed)
8273 {
8274 L->m[k].rtyp = STRING_CMD;
8275 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8276 k++;
8277 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8278 }
8279 if(i+1+2*nCount<sArithBase.nCmdUsed)
8280 {
8281 L->m[k].rtyp = STRING_CMD;
8282 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8283 k++;
8284 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8285 }
8286 // PrintLn();
8287 }
8288
8289 // assign blackbox types
8290 for (i = 0; i < bb_list->count; i++)
8291 {
8292 if (bb_list->list[i] != NULL)
8293 {
8294 L->m[k].rtyp = STRING_CMD;
8295 // already used strdup in getBlackBoxTypes
8296 L->m[k].data = bb_list->list[i];
8297 k++;
8298 }
8299 }
8300 // free the struct (not the list entries itself, which were allocated
8301 // by strdup)
8302 omfree(bb_list->list);
8303 omfree(bb_list);
8304
8305 // pass the resultant list to the res datastructure
8306 res->data=(void *)L;
8307
8308 return FALSE;
8309}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition: blackbox.cc:244
void ** list
Definition: blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition: blackbox.h:84
#define omfree(addr)
Definition: omAllocDecl.h:237

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4843 of file iparith.cc.

4844{
4845 char *s= (char *)v->Data();
4846 // try system keywords
4847 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4848 {
4849 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4850 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4851 {
4852 res->data = (char *)1;
4853 return FALSE;
4854 }
4855 }
4856 // try blackbox names
4857 int id;
4858 blackboxIsCmd(s,id);
4859 if (id>0)
4860 {
4861 res->data = (char *)1;
4862 }
4863 return FALSE;
4864}

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8682 of file iparith.cc.

8683{
8684 int c=(int)(long)u->Data();
8685 switch(c)
8686 {
8687 case 0:{
8688 PrintS("delete all variables\n");
8689 killlocals(0);
8690 WerrorS("restarting...");
8691 break;
8692 };
8693 default: WerrorS("not implemented");
8694 }
8695 return FALSE;
8696}
void killlocals(int v)
Definition: ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5260 of file iparith.cc.

5261{
5262#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5263 if (rIsLPRing(currRing))
5264 {
5266 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5267 ideal result;
5268 ideal v_id=(ideal)v->Data();
5269 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5270 /* tHomog hom=testHomog; */
5271 /* if (w!=NULL) */
5272 /* { */
5273 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5274 /* { */
5275 /* WarnS("wrong weights"); */
5276 /* w=NULL; */
5277 /* } */
5278 /* else */
5279 /* { */
5280 /* hom=isHomog; */
5281 /* w=ivCopy(w); */
5282 /* } */
5283 /* } */
5284 /* result=kStd(v_id,currRing->qideal,hom,&w); */
5285 result = rightgb(v_id, currRing->qideal);
5287 res->data = (char *)result;
5289 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5290 return FALSE;
5291 }
5292 else if (rIsPluralRing(currRing))
5293 {
5294 ideal I=(ideal)v->Data();
5295
5296 ring A = currRing;
5297 ring Aopp = rOpposite(A);
5298 currRing = Aopp;
5299 ideal Iopp = idOppose(A, I, Aopp);
5300 ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
5301 currRing = A;
5302 ideal J = idOppose(Aopp, Jopp, A);
5303
5304 id_Delete(&Iopp, Aopp);
5305 id_Delete(&Jopp, Aopp);
5306 rDelete(Aopp);
5307
5308 idSkipZeroes(J);
5309 res->data = (char *)J;
5311 return FALSE;
5312 }
5313 else
5314 {
5315 return jjSTD(res, v);
5316 }
5317#else
5318 return TRUE;
5319#endif
5320}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition: iparith.cc:5061
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2433
ideal rightgb(ideal F, ideal Q)
Definition: kstd2.cc:4715
#define TEST_OPT_DEGBOUND
Definition: options.h:113
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:516

◆ jjRING3()

static BOOLEAN jjRING3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 7041 of file iparith.cc.

7042{
7043 res->data=(void *)rInit(u,v,w);
7044 return (res->data==NULL);
7045}
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5628

◆ jjRING_1()

static BOOLEAN jjRING_1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1675 of file iparith.cc.

1676{
1677 u->next=(leftv)omAlloc(sizeof(sleftv));
1678 memcpy(u->next,v,sizeof(sleftv));
1679 v->Init();
1680 BOOLEAN bo=iiExprArithM(res,u,'[');
1681 u->next=NULL;
1682 return bo;
1683}

◆ jjRING_2()

static BOOLEAN jjRING_2 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 5969 of file iparith.cc.

5970{
5971 u->next=(leftv)omAlloc(sizeof(sleftv));
5972 memcpy(u->next,v,sizeof(sleftv));
5973 v->Init();
5974 u->next->next=(leftv)omAlloc(sizeof(sleftv));
5975 memcpy(u->next->next,w,sizeof(sleftv));
5976 w->Init();
5977 BOOLEAN bo=iiExprArithM(res,u,'[');
5978 u->next=NULL;
5979 return bo;
5980}

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4908 of file iparith.cc.

4909{
4910 ring r=(ring)v->Data();
4911 if (r!=NULL)
4912 res->data = (char *)rDecompose_list_cf((ring)v->Data());
4913 return (r==NULL)||(res->data==NULL);
4914}
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:2126

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8653 of file iparith.cc.

8654{
8655 //Print("construct ring\n");
8656 if (a->Typ()!=CRING_CMD)
8657 {
8658 WerrorS("expected `cring` [ `id` ... ]");
8659 return TRUE;
8660 }
8661 assume(a->next!=NULL);
8662 leftv names=a->next;
8663 int N=names->listLength();
8664 char **n=(char**)omAlloc0(N*sizeof(char*));
8665 for(int i=0; i<N;i++,names=names->next)
8666 {
8667 n[i]=(char *)names->Name();
8668 }
8669 coeffs cf=(coeffs)a->CopyD();
8670 res->data=rDefault(cf,N,n, ringorder_dp);
8671 omFreeSize(n,N*sizeof(char*));
8672 return FALSE;
8673}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102
@ ringorder_dp
Definition: ring.h:78
@ CRING_CMD
Definition: tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4886 of file iparith.cc.

4887{
4888 ring r=(ring)v->Data();
4889 if (r!=NULL)
4890 {
4891 res->data = (char *)rDecompose((ring)v->Data());
4892 if (res->data!=NULL)
4893 {
4894 long mm=r->wanted_maxExp;
4895 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4896 return FALSE;
4897 }
4898 }
4899 return TRUE;
4900}
lists rDecompose(const ring r)
Definition: ipshell.cc:2165

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4901 of file iparith.cc.

4902{
4903 coeffs r=(coeffs)v->Data();
4904 if (r!=NULL)
4905 return rDecompose_CF(res,r);
4906 return TRUE;
4907}
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1953

◆ jjRMINUS()

static BOOLEAN jjRMINUS ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3237 of file iparith.cc.

3238{
3239 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3240 res->data = (char *)r;
3241 return r==NULL;
3242}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition: ring.cc:6000

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5637 of file iparith.cc.

5638{
5639 res->data = rOrdStr((ring)v->Data());
5640 return FALSE;
5641}
char * rOrdStr(ring r)
Definition: ring.cc:521

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4915 of file iparith.cc.

4916{
4917 ideal i = (ideal)v->Data();
4918 res->data = (char *)i->rank;
4919 return FALSE;
4920}

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4921 of file iparith.cc.

4922{
4923 res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
4924 return FALSE;
4925}

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4926 of file iparith.cc.

4927{
4928 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
4929 return FALSE;
4930}

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4931 of file iparith.cc.

4932{
4933 res->data = (char *)(long)rPar(((ring)v->Data()));
4934 return FALSE;
4935}

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5647 of file iparith.cc.

5648{
5649 res->data = rParStr((ring)v->Data());
5650 return FALSE;
5651}
char * rParStr(ring r)
Definition: ring.cc:649

◆ jjRPLUS()

static BOOLEAN jjRPLUS ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3243 of file iparith.cc.

3244{
3245 int left;
3246 if (u->Typ()==RING_CMD) left=0;
3247 else
3248 {
3249 leftv h=u;u=v;v=h;
3250 left=1;
3251 }
3252 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3253 res->data = (char *)r;
3254 return r==NULL;
3255}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5918

◆ jjRSUM()

static BOOLEAN jjRSUM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3256 of file iparith.cc.

3257{
3258 ring r;
3259 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3260 res->data = (char *)r;
3261 return (i==-1);
3262}
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1402

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5642 of file iparith.cc.

5643{
5644 res->data = rVarStr((ring)v->Data());
5645 return FALSE;
5646}
char * rVarStr(ring r)
Definition: ring.cc:623

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 4936 of file iparith.cc.

4937{
4938 res->data = (char *)(long)atoi((char*)v->Data());
4939 return FALSE;
4940}

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 4983 of file iparith.cc.

4984{
4985 ideal result;
4986 ideal v_id=(ideal)v->Data();
4987 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4988 tHomog hom=testHomog;
4989 if (w!=NULL)
4990 {
4991 if (!idTestHomModule(v_id,currRing->qideal,w))
4992 {
4993 WarnS("wrong weights");
4994 w=NULL;
4995 }
4996 else
4997 {
4998 hom=isHomog;
4999 w=ivCopy(w);
5000 }
5001 }
5002 result=kSba(v_id,currRing->qideal,hom,&w,1,0);
5004 res->data = (char *)result;
5006 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5007 return FALSE;
5008}
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2617

◆ jjSBA_1()

static BOOLEAN jjSBA_1 ( leftv  res,
leftv  v,
leftv  u 
)
static

Definition at line 5009 of file iparith.cc.

5010{
5011 ideal result;
5012 ideal v_id=(ideal)v->Data();
5013 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5014 tHomog hom=testHomog;
5015 if (w!=NULL)
5016 {
5017 if (!idTestHomModule(v_id,currRing->qideal,w))
5018 {
5019 WarnS("wrong weights");
5020 w=NULL;
5021 }
5022 else
5023 {
5024 hom=isHomog;
5025 w=ivCopy(w);
5026 }
5027 }
5028 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0);
5030 res->data = (char *)result;
5032 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5033 return FALSE;
5034}

◆ jjSBA_2()

static BOOLEAN jjSBA_2 ( leftv  res,
leftv  v,
leftv  u,
leftv  t 
)
static

Definition at line 5035 of file iparith.cc.

5036{
5037 ideal result;
5038 ideal v_id=(ideal)v->Data();
5039 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5040 tHomog hom=testHomog;
5041 if (w!=NULL)
5042 {
5043 if (!idTestHomModule(v_id,currRing->qideal,w))
5044 {
5045 WarnS("wrong weights");
5046 w=NULL;
5047 }
5048 else
5049 {
5050 hom=isHomog;
5051 w=ivCopy(w);
5052 }
5053 }
5054 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
5056 res->data = (char *)result;
5058 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5059 return FALSE;
5060}

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3759 of file iparith.cc.

3760{
3761 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3762 else
3763 {
3764 ring r=(ring)u->Data();
3765 idhdl h=rFindHdl(r,NULL);
3766 if (h==NULL)
3767 {
3768 char name_buffer[100];
3769 STATIC_VAR int ending=1000000;
3770 ending++;
3771 sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3772 h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3773 IDRING(h)=rIncRefCnt(r);
3774 }
3775 rSetHdl(h);
3776 }
3777 return FALSE;
3778}
#define STATIC_VAR
Definition: globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1705
void rSetHdl(idhdl h)
Definition: ipshell.cc:5129

◆ jjSIMPL_ID()

static BOOLEAN jjSIMPL_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3270 of file iparith.cc.

3271{
3272 int sw = (int)(long)v->Data();
3273 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3274 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3275 if (sw & SIMPL_LMDIV)
3276 {
3277 id_DelDiv(id,currRing);
3278 }
3279 if (sw & SIMPL_LMEQ)
3280 {
3282 }
3283 if (sw & SIMPL_MULT)
3284 {
3286 }
3287 else if(sw & SIMPL_EQU)
3288 {
3290 }
3291 if (sw & SIMPL_NULL)
3292 {
3293 idSkipZeroes(id);
3294 }
3295 if (sw & SIMPL_NORM)
3296 {
3297 id_Norm(id,currRing);
3298 }
3299 if (sw & SIMPL_NORMALIZE)
3300 {
3302 }
3303 res->data = (char * )id;
3304 return FALSE;
3305}
#define SIMPL_EQU
Definition: iparith.cc:3267
#define SIMPL_NORM
Definition: iparith.cc:3269
#define SIMPL_LMEQ
Definition: iparith.cc:3265
#define SIMPL_NULL
Definition: iparith.cc:3268
#define SIMPL_MULT
Definition: iparith.cc:3266
#define SIMPL_NORMALIZE
Definition: iparith.cc:3263
#define SIMPL_LMDIV
Definition: iparith.cc:3264
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
void id_Normalize(ideal I, const ring r)
normialize all polys in id
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.

◆ jjSIMPL_P()

static BOOLEAN jjSIMPL_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3365 of file iparith.cc.

3366{
3367 int sw = (int)(long)v->Data();
3368 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3369 poly p = (poly)u->CopyD(POLY_CMD);
3370 if (sw & SIMPL_NORM)
3371 {
3372 pNorm(p);
3373 }
3374 if (sw & SIMPL_NORMALIZE)
3375 {
3377 }
3378 res->data = (char * )p;
3379 return FALSE;
3380}
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3879
void pNorm(poly p)
Definition: polys.h:363

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4941 of file iparith.cc.

4942{
4943 const bool bIsSCA = rIsSCA(currRing);
4944
4945 if ((currRing->qideal!=NULL) && !bIsSCA)
4946 {
4947 WerrorS("qring not supported by slimgb at the moment");
4948 return TRUE;
4949 }
4951 {
4952 WerrorS("ordering must be global for slimgb");
4953 return TRUE;
4954 }
4956 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4957 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4958 // tHomog hom=testHomog;
4959 ideal u_id=(ideal)u->Data();
4960 if (w!=NULL)
4961 {
4962 if (!idTestHomModule(u_id,currRing->qideal,w))
4963 {
4964 WarnS("wrong weights");
4965 w=NULL;
4966 }
4967 else
4968 {
4969 w=ivCopy(w);
4970 // hom=isHomog;
4971 }
4972 }
4973
4974 assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
4975 res->data=(char *)t_rep_gb(currRing,
4976 u_id,u_id->rank);
4977 //res->data=(char *)t_rep_gb(currRing, u_id);
4978
4980 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4981 return FALSE;
4982}
static bool rIsSCA(const ring r)
Definition: nc.h:190
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition: tgb.cc:3571

◆ jjSMATRIX_Mo()

static BOOLEAN jjSMATRIX_Mo ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6881 of file iparith.cc.

6882{
6883 int mi=(int)(long)v->Data();
6884 int ni=(int)(long)w->Data();
6885 if ((mi<0)||(ni<1))
6886 {
6887 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6888 return TRUE;
6889 }
6890 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6891 mi,ni,currRing);
6892 return FALSE;
6893}
ideal id_ResizeModule(ideal mod, int rows, int cols, const ring R)

◆ jjSort_Id()

static BOOLEAN jjSort_Id ( leftv  res,
leftv  v 
)
static

Definition at line 5089 of file iparith.cc.

5090{
5091 res->data = (char *)idSort((ideal)v->Data());
5092 return FALSE;
5093}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:184

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10190 of file iparith.cc.

10191{
10192 lists l=(lists)arg->Data();
10193 if (l->nr>0)
10194 {
10195 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10196 }
10197 return FALSE;
10198}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:10149

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5094 of file iparith.cc.

5095{
5097 intvec *v=NULL;
5098 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5099 if (f==NULL) return TRUE;
5100 ivTest(v);
5102 l->Init(2);
5103 l->m[0].rtyp=IDEAL_CMD;
5104 l->m[0].data=(void *)f;
5105 l->m[1].rtyp=INTVEC_CMD;
5106 l->m[1].data=(void *)v;
5107 res->data=(void *)l;
5108 return FALSE;
5109}
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1338

◆ jjSQR_FREE2()

static BOOLEAN jjSQR_FREE2 ( leftv  res,
leftv  u,
leftv  dummy 
)
static

Definition at line 3307 of file iparith.cc.

3308{
3309 intvec *v=NULL;
3310 int sw=(int)(long)dummy->Data();
3311 int fac_sw=sw;
3312 if (sw<0) fac_sw=1;
3314 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3315 if (f==NULL)
3316 return TRUE;
3317 switch(sw)
3318 {
3319 case 0:
3320 case 2:
3321 {
3323 l->Init(2);
3324 l->m[0].rtyp=IDEAL_CMD;
3325 l->m[0].data=(void *)f;
3326 l->m[1].rtyp=INTVEC_CMD;
3327 l->m[1].data=(void *)v;
3328 res->data=(void *)l;
3329 res->rtyp=LIST_CMD;
3330 return FALSE;
3331 }
3332 case 1:
3333 res->data=(void *)f;
3334 return FALSE;
3335 case 3:
3336 {
3337 poly p=f->m[0];
3338 int i=IDELEMS(f);
3339 f->m[0]=NULL;
3340 while(i>1)
3341 {
3342 i--;
3343 p=pMult(p,f->m[i]);
3344 f->m[i]=NULL;
3345 }
3346 res->data=(void *)p;
3347 res->rtyp=POLY_CMD;
3348 }
3349 return FALSE;
3350 }
3351 WerrorS("invalid switch");
3352 return FALSE;
3353}

◆ jjSTATUS2()

static BOOLEAN jjSTATUS2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3354 of file iparith.cc.

3355{
3356 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3357 return FALSE;
3358}

◆ jjSTATUS2L()

static BOOLEAN jjSTATUS2L ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3359 of file iparith.cc.

3360{
3361 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3362 //return (res->data== (void*)(long)-2);
3363 return FALSE;
3364}

◆ jjSTATUS3()

static BOOLEAN jjSTATUS3 ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 7046 of file iparith.cc.

7047{
7048 int yes;
7049 jjSTATUS2(res, u, v);
7050 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7051 omFreeBinAddr((ADDRESS) res->data);
7052 res->data = (void *)(long)yes;
7053 return FALSE;
7054}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3354

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8495 of file iparith.cc.

8496{
8497 if ((v->Typ() != LINK_CMD) ||
8498 (v->next->Typ() != STRING_CMD) ||
8499 (v->next->next->Typ() != STRING_CMD) ||
8500 (v->next->next->next->Typ() != INT_CMD))
8501 return TRUE;
8502 jjSTATUS3(res, v, v->next, v->next->next);
8503#if defined(HAVE_USLEEP)
8504 if (((long) res->data) == 0L)
8505 {
8506 int i_s = (int)(long) v->next->next->next->Data();
8507 if (i_s > 0)
8508 {
8509 usleep((int)(long) v->next->next->next->Data());
8510 jjSTATUS3(res, v, v->next, v->next->next);
8511 }
8512 }
8513#elif defined(HAVE_SLEEP)
8514 if (((int) res->data) == 0)
8515 {
8516 int i_s = (int) v->next->next->next->Data();
8517 if (i_s > 0)
8518 {
8519 si_sleep((is - 1)/1000000 + 1);
8520 jjSTATUS3(res, v, v->next, v->next->next);
8521 }
8522 }
8523#endif
8524 return FALSE;
8525}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:7046
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5061 of file iparith.cc.

5062{
5064 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5065 ideal result;
5066 ideal v_id=(ideal)v->Data();
5067 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5068 tHomog hom=testHomog;
5069 if (w!=NULL)
5070 {
5071 if (!idTestHomModule(v_id,currRing->qideal,w))
5072 {
5073 WarnS("wrong weights");
5074 w=NULL;
5075 }
5076 else
5077 {
5078 hom=isHomog;
5079 w=ivCopy(w);
5080 }
5081 }
5082 result=kStd(v_id,currRing->qideal,hom,&w);
5084 res->data = (char *)result;
5086 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5087 return FALSE;
5088}

◆ jjSTD_1()

static BOOLEAN jjSTD_1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3407 of file iparith.cc.

3408{
3409 ideal result;
3410 assumeStdFlag(u);
3411 ideal i1=(ideal)(u->Data());
3412 int ii1=idElem(i1); /* size of i1 */
3413 ideal i0;
3414 int r=v->Typ();
3415 if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3416 {
3417 poly p=(poly)v->Data();
3418 i0=idInit(1,i1->rank);
3419 i0->m[0]=p;
3420 i1=idSimpleAdd(i1,i0); //
3421 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3422 idDelete(&i0);
3423 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3424 tHomog hom=testHomog;
3425
3426 if (w!=NULL)
3427 {
3428 if (!idTestHomModule(i1,currRing->qideal,w))
3429 {
3430 // no warnung: this is legal, if i in std(i,p)
3431 // is homogeneous, but p not
3432 w=NULL;
3433 }
3434 else
3435 {
3436 w=ivCopy(w);
3437 hom=isHomog;
3438 }
3439 }
3440 BITSET save1;
3441 SI_SAVE_OPT1(save1);
3443 /* ii1 appears to be the position of the first element of il that
3444 does not belong to the old SB ideal */
3445 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3446 SI_RESTORE_OPT1(save1);
3447 idDelete(&i1);
3449 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3450 res->data = (char *)result;
3451 }
3452 else /*IDEAL/MODULE*/
3453 {
3454 i0=(ideal)v->CopyD();
3455 i1=idSimpleAdd(i1,i0); //
3456 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3457 idDelete(&i0);
3458 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3459 tHomog hom=testHomog;
3460
3461 if (w!=NULL)
3462 {
3463 if (!idTestHomModule(i1,currRing->qideal,w))
3464 {
3465 // no warnung: this is legal, if i in std(i,p)
3466 // is homogeneous, but p not
3467 w=NULL;
3468 hom=isNotHomog;
3469 }
3470 else
3471 {
3472 w=ivCopy(w);
3473 hom=isHomog;
3474 }
3475 }
3476 BITSET save1;
3477 SI_SAVE_OPT1(save1);
3479 /* ii1 appears to be the position of the first element of i1 that
3480 does not belong to the old SB ideal */
3481 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3482 SI_RESTORE_OPT1(save1);
3483 idDelete(&i1);
3485 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3486 res->data = (char *)result;
3487 }
3489 return FALSE;
3490}
#define OPT_SB_1
Definition: options.h:95
#define SI_SAVE_OPT1(A)
Definition: options.h:21
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
@ isNotHomog
Definition: structs.h:36

◆ jjSTD_HILB()

static BOOLEAN jjSTD_HILB ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3381 of file iparith.cc.

3382{
3383 ideal result;
3384 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3385 tHomog hom=testHomog;
3386 ideal u_id=(ideal)(u->Data());
3387 if (w!=NULL)
3388 {
3389 if (!idTestHomModule(u_id,currRing->qideal,w))
3390 {
3391 WarnS("wrong weights:");w->show();PrintLn();
3392 w=NULL;
3393 }
3394 else
3395 {
3396 w=ivCopy(w);
3397 hom=isHomog;
3398 }
3399 }
3400 result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3402 res->data = (char *)result;
3404 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3405 return FALSE;
3406}

◆ jjSTD_HILB_W()

static BOOLEAN jjSTD_HILB_W ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 7055 of file iparith.cc.

7056{
7057 intvec *vw=(intvec *)w->Data(); // weights of vars
7058 if (vw->length()!=currRing->N)
7059 {
7060 Werror("%d weights for %d variables",vw->length(),currRing->N);
7061 return TRUE;
7062 }
7063 ideal result;
7064 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7065 tHomog hom=testHomog;
7066 ideal u_id=(ideal)(u->Data());
7067 if (ww!=NULL)
7068 {
7069 if (!idTestHomModule(u_id,currRing->qideal,ww))
7070 {
7071 WarnS("wrong weights");
7072 ww=NULL;
7073 }
7074 else
7075 {
7076 ww=ivCopy(ww);
7077 hom=isHomog;
7078 }
7079 }
7080 result=kStd(u_id,
7081 currRing->qideal,
7082 hom,
7083 &ww, // module weights
7084 (intvec *)v->Data(), // hilbert series
7085 0,0, // syzComp, newIdeal
7086 vw); // weights of vars
7088 res->data = (char *)result;
7090 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7091 return FALSE;
7092}

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8570 of file iparith.cc.

8571{ ideal result;
8572 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8573 leftv v = u->next; /* one additional polynomial or ideal */
8574 leftv h = v->next; /* Hilbert vector */
8575 leftv w = h->next; /* weight vector */
8576 assumeStdFlag(u);
8577 ideal i1=(ideal)(u->Data());
8578 ideal i0;
8579 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8580 || (h->Typ()!=INTVEC_CMD)
8581 || (w->Typ()!=INTVEC_CMD))
8582 {
8583 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8584 return TRUE;
8585 }
8586 intvec *vw=(intvec *)w->Data(); // weights of vars
8587 /* merging std_hilb_w and std_1 */
8588 if (vw->length()!=currRing->N)
8589 {
8590 Werror("%d weights for %d variables",vw->length(),currRing->N);
8591 return TRUE;
8592 }
8593 int r=v->Typ();
8594 BOOLEAN cleanup_i0=FALSE;
8595 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8596 {
8597 i0=idInit(1,i1->rank);
8598 i0->m[0]=(poly)v->Data();
8599 cleanup_i0=TRUE;
8600 }
8601 else if (r==IDEAL_CMD)/* IDEAL */
8602 {
8603 i0=(ideal)v->Data();
8604 }
8605 else
8606 {
8607 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8608 return TRUE;
8609 }
8610 int ii0=idElem(i0);
8611 i1 = idSimpleAdd(i1,i0);
8612 if (cleanup_i0)
8613 {
8614 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8615 idDelete(&i0);
8616 }
8617 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8618 tHomog hom=testHomog;
8619 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8620 if (ww!=NULL)
8621 {
8622 if (!idTestHomModule(i1,currRing->qideal,ww))
8623 {
8624 WarnS("wrong weights");
8625 ww=NULL;
8626 }
8627 else
8628 {
8629 ww=ivCopy(ww);
8630 hom=isHomog;
8631 }
8632 }
8633 BITSET save1;
8634 SI_SAVE_OPT1(save1);
8636 result=kStd(i1,
8637 currRing->qideal,
8638 hom,
8639 &ww, // module weights
8640 (intvec *)h->Data(), // hilbert series
8641 0, // syzComp, whatever it is...
8642 IDELEMS(i1)-ii0, // new ideal
8643 vw); // weights of vars
8644 SI_RESTORE_OPT1(save1);
8645 idDelete(&i1);
8647 res->data = (char *)result;
8649 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8650 return FALSE;
8651}

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8310 of file iparith.cc.

8311{
8312 if (v == NULL)
8313 {
8314 res->data = omStrDup("");
8315 return FALSE;
8316 }
8317 int n = v->listLength();
8318 if (n == 1)
8319 {
8320 res->data = v->String();
8321 return FALSE;
8322 }
8323
8324 char** slist = (char**) omAlloc(n*sizeof(char*));
8325 int i, j;
8326
8327 for (i=0, j=0; i<n; i++, v = v ->next)
8328 {
8329 slist[i] = v->String();
8330 assume(slist[i] != NULL);
8331 j+=strlen(slist[i]);
8332 }
8333 char* s = (char*) omAlloc((j+1)*sizeof(char));
8334 *s='\0';
8335 for (i=0;i<n;i++)
8336 {
8337 strcat(s, slist[i]);
8338 omFree(slist[i]);
8339 }
8340 omFreeSize(slist, n*sizeof(char*));
8341 res->data = s;
8342 return FALSE;
8343}

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5569 of file iparith.cc.

5570{
5571 res->data = (char *)strlen((char *)v->Data());
5572 return FALSE;
5573}

◆ jjSUBST_Bu()

static BOOLEAN jjSUBST_Bu ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6603 of file iparith.cc.

6604{
6605 // generic conversion from polyBucket to poly:
6606 // force this to be the first try everytime
6607 poly p; int l;
6608 sBucket_pt bu=(sBucket_pt)w->CopyD();
6609 sBucketDestroyAdd(bu,&p,&l);
6610 sleftv tmpw;
6611 tmpw.Init();
6612 tmpw.rtyp=POLY_CMD;
6613 tmpw.data=p;
6614 return iiExprArith3(res, iiOp, u, v, &tmpw);
6615}

◆ jjSUBST_Id()

static BOOLEAN jjSUBST_Id ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6649 of file iparith.cc.

6650{
6651 int ringvar;
6652 poly monomexpr;
6653 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6654 if (nok) return TRUE;
6655 ideal id=(ideal)u->Data();
6656 if (ringvar>0)
6657 {
6658 BOOLEAN overflow=FALSE;
6659 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6660 {
6661 long deg_monexp=pTotaldegree(monomexpr);
6662 for(int i=IDELEMS(id)-1;i>=0;i--)
6663 {
6664 poly p=id->m[i];
6665 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6666 if ((p!=NULL) && (mm!=0) &&
6667 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6668 {
6669 overflow=TRUE;
6670 break;
6671 }
6672 }
6673 }
6674 if (overflow)
6675 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6676 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6677 {
6678 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6679 else id=id_Copy(id,currRing);
6680 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6681 }
6682 else
6683 res->data = idSubstPoly(id,ringvar,monomexpr);
6684 }
6685 else
6686 {
6687 if (rIsLPRing(currRing))
6688 {
6689 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6690 return TRUE;
6691 }
6692 res->data = idSubstPar(id,-ringvar,monomexpr);
6693 }
6694 return FALSE;
6695}
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static BOOLEAN jjSUBST_Test(leftv v, leftv w, int &ringvar, poly &monomexpr)
Definition: iparith.cc:6575
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:426
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:387
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition: p_polys.cc:5068
ideal id_Subst(ideal id, int n, poly e, const ring r)

◆ jjSUBST_Id_I()

static BOOLEAN jjSUBST_Id_I ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6699 of file iparith.cc.

6700{
6701 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6702}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6707

◆ jjSUBST_Id_N()

static BOOLEAN jjSUBST_Id_N ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6703 of file iparith.cc.

6704{
6705 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6706}

◆ jjSUBST_Id_X()

static BOOLEAN jjSUBST_Id_X ( leftv  res,
leftv  u,
leftv  v,
leftv  w,
int  input_type 
)
static

Definition at line 6707 of file iparith.cc.

6708{
6709 sleftv tmp;
6710 tmp.Init();
6711 // do not check the result, conversion from int/number to poly works always
6712 iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6713 BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6714 tmp.CleanUp();
6715 return b;
6716}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6649

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8526 of file iparith.cc.

8527{
8528 leftv v = u->next; // number of args > 0
8529 if (v==NULL) return TRUE;
8530 leftv w = v->next;
8531 if (w==NULL) return TRUE;
8532 leftv rest = w->next;
8533
8534 u->next = NULL;
8535 v->next = NULL;
8536 w->next = NULL;
8537 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8538 if ((rest!=NULL) && (!b))
8539 {
8540 leftv tmp_next=res->next;
8541 res->next=rest;
8542 sleftv tmp_res;
8543 tmp_res.Init();
8544 b = iiExprArithM(&tmp_res,res,iiOp);
8545 memcpy(res,&tmp_res,sizeof(tmp_res));
8546 res->next=tmp_next;
8547 }
8548 u->next = v;
8549 v->next = w;
8550 // rest was w->next, but is already cleaned
8551 return b;
8552}

◆ jjSUBST_P()

static BOOLEAN jjSUBST_P ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)
static

Definition at line 6616 of file iparith.cc.

6617{
6618 int ringvar;
6619 poly monomexpr;
6620 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6621 if (nok) return TRUE;
6622 poly p=(poly)u->Data();
6623 if (ringvar>0)
6624 {
6625 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6626 if (!rIsLPRing(currRing) &&
6627 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6628 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6629 {
6630 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6631 //return TRUE;
6632 }
6633 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6634 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6635 else
6636 res->data= pSubstPoly(p,ringvar,monomexpr);
6637 }
6638 else
6639 {
6640 if (rIsLPRing(currRing))
6641 {
6642 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6643 return TRUE;
6644 }
6645 res->data=pSubstPar(p,-ringvar,monomexpr);
6646 }
6647 return FALSE;
6648}
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:404
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:267

◆ jjSUBST_Test()

static BOOLEAN jjSUBST_Test ( leftv  v,
leftv  w,
int &  ringvar,
poly &  monomexpr 
)
static

Definition at line 6575 of file iparith.cc.

6577{
6578 monomexpr=(poly)w->Data();
6579 poly p=(poly)v->Data();
6580#if 0
6581 if (pLength(monomexpr)>1)
6582 {
6583 Werror("`%s` substitutes a ringvar only by a term",
6585 return TRUE;
6586 }
6587#endif
6588 if ((ringvar=pVar(p))==0)
6589 {
6590 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6591 {
6592 number n = pGetCoeff(p);
6593 ringvar= -n_IsParam(n, currRing);
6594 }
6595 if(ringvar==0)
6596 {
6597 WerrorS("ringvar/par expected");
6598 return TRUE;
6599 }
6600 }
6601 return FALSE;
6602}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5897
@ SUBST_CMD
Definition: tok.h:186

◆ jjSYZ_2()

static BOOLEAN jjSYZ_2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3491 of file iparith.cc.

3492{
3493 // see jjSYZYGY
3494 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3495 intvec *w=NULL;
3496 tHomog hom=testHomog;
3497 ideal I=(ideal)u->Data();
3498 GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3499 if (ww!=NULL)
3500 {
3501 if (idTestHomModule(I,currRing->qideal,ww))
3502 {
3503 w=ivCopy(ww);
3504 int add_row_shift=w->min_in();
3505 (*w)-=add_row_shift;
3506 hom=isHomog;
3507 }
3508 else
3509 {
3510 //WarnS("wrong weights");
3511 delete ww; ww=NULL;
3512 hom=testHomog;
3513 }
3514 }
3515 else
3516 {
3517 if (u->Typ()==IDEAL_CMD)
3518 if (idHomIdeal(I,currRing->qideal))
3519 hom=isHomog;
3520 }
3521 ideal S=idSyzygies(I,hom,&w,TRUE,FALSE,NULL,alg);
3522 if (w!=NULL) delete w;
3523 res->data = (char *)S;
3524 if (hom==isHomog)
3525 {
3526 int vl=S->rank;
3527 intvec *vv=new intvec(vl);
3528 if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3529 {
3530 for(int i=0;i<vl;i++)
3531 {
3532 if (I->m[i]!=NULL)
3533 (*vv)[i]=p_Deg(I->m[i],currRing);
3534 }
3535 }
3536 else
3537 {
3538 p_SetModDeg(ww, currRing);
3539 for(int i=0;i<vl;i++)
3540 {
3541 if (I->m[i]!=NULL)
3542 (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3543 }
3545 }
3546 if (idTestHomModule(S,currRing->qideal,vv))
3547 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3548 else
3549 delete vv;
3550 }
3552 return FALSE;
3553}
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:830
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3751
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5121 of file iparith.cc.

5122{
5123 ideal v_id=(ideal)v->Data();
5124#ifdef HAVE_SHIFTBBA
5125 if (rIsLPRing(currRing))
5126 {
5127 if (currRing->LPncGenCount < IDELEMS(v_id))
5128 {
5129 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5130 return TRUE;
5131 }
5132 }
5133#endif
5134 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5135 intvec *w=NULL;
5136 tHomog hom=testHomog;
5137 if (ww!=NULL)
5138 {
5139 if (idTestHomModule(v_id,currRing->qideal,ww))
5140 {
5141 w=ivCopy(ww);
5142 int add_row_shift=w->min_in();
5143 (*w)-=add_row_shift;
5144 hom=isHomog;
5145 }
5146 else
5147 {
5148 //WarnS("wrong weights");
5149 delete ww; ww=NULL;
5150 hom=testHomog;
5151 }
5152 }
5153 else
5154 {
5155 if (v->Typ()==IDEAL_CMD)
5156 if (idHomIdeal(v_id,currRing->qideal))
5157 hom=isHomog;
5158 }
5159 ideal S=idSyzygies(v_id,hom,&w);
5160 res->data = (char *)S;
5161 if (hom==isHomog)
5162 {
5163 int vl=S->rank;
5164 intvec *vv=new intvec(vl);
5165 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5166 {
5167 for(int i=0;i<vl;i++)
5168 {
5169 if (v_id->m[i]!=NULL)
5170 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5171 }
5172 }
5173 else
5174 {
5175 p_SetModDeg(ww, currRing);
5176 for(int i=0;i<vl;i++)
5177 {
5178 if (v_id->m[i]!=NULL)
5179 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5180 }
5182 }
5183 if (idTestHomModule(S,currRing->qideal,vv))
5184 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5185 else
5186 delete vv;
5187 }
5188 if (w!=NULL) delete w;
5189 return FALSE;
5190}

◆ jjTENSOR()

static BOOLEAN jjTENSOR ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3554 of file iparith.cc.

3555{
3556 ideal A=(ideal)u->Data();
3557 ideal B=(ideal)v->Data();
3558 res->data = (char *)sm_Tensor(A,B,currRing);
3559 return FALSE;
3560}
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition: matpol.cc:1831

◆ jjTENSOR_Ma()

static BOOLEAN jjTENSOR_Ma ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3561 of file iparith.cc.

3562{
3563 sleftv tmp_u,tmp_v,tmp_res;
3567 tmp_res.Init();
3568 tmp_res.rtyp=SMATRIX_CMD;
3569 BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3570 if (!bo)
3571 {
3574 }
3575 tmp_u.CleanUp();
3576 tmp_v.CleanUp();
3577 tmp_res.CleanUp();
3578 return bo;
3579}
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition: iparith.cc:3554
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 8344 of file iparith.cc.

8345{
8346 do
8347 {
8348 if (v->Typ()!=INT_CMD)
8349 return TRUE;
8350 test_cmd((int)(long)v->Data());
8351 v=v->next;
8352 }
8353 while (v!=NULL);
8354 return FALSE;
8355}
void test_cmd(int i)
Definition: ipshell.cc:514

◆ jjTIMES_BI()

static BOOLEAN jjTIMES_BI ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 993 of file iparith.cc.

994{
995 res->data = (char *)(n_Mult( (number)u->Data(), (number)v->Data(),coeffs_BIGINT));
996 if ((v->next!=NULL) || (u->next!=NULL))
997 return jjOP_REST(res,u,v);
998 return FALSE;
999}
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636

◆ jjTIMES_BIM()

static BOOLEAN jjTIMES_BIM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1076 of file iparith.cc.

1077{
1078 res->data = (char *)bimMult((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
1079 if (res->data==NULL)
1080 {
1081 WerrorS("bigintmat/cmatrix not compatible");
1082 return TRUE;
1083 }
1084 if ((v->next!=NULL) || (u->next!=NULL))
1085 return jjOP_REST(res,u,v);
1086 return FALSE;
1087}

◆ jjTIMES_I()

static BOOLEAN jjTIMES_I ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 981 of file iparith.cc.

982{
983 int a=(int)(long)u->Data();
984 int b=(int)(long)v->Data();
985 int64 c=(int64)a * (int64)b;
986 if ((c>INT_MAX)||(c<INT_MIN))
987 WarnS("int overflow(*), result may be wrong");
988 res->data = (char *)((long)((int)c));
989 if ((u->Next()!=NULL) || (v->Next()!=NULL))
990 return jjOP_REST(res,u,v);
991 return FALSE;
992}
long int64
Definition: auxiliary.h:68

◆ jjTIMES_ID()

static BOOLEAN jjTIMES_ID ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1057 of file iparith.cc.

1058{
1059 res->data = (char *)idMult((ideal)u->Data(),(ideal)v->Data());
1060 if ((v->next!=NULL) || (u->next!=NULL))
1061 return jjOP_REST(res,u,v);
1062 return FALSE;
1063}
static ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition: ideals.h:84

◆ jjTIMES_IV()

static BOOLEAN jjTIMES_IV ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1064 of file iparith.cc.

1065{
1066 res->data = (char *)ivMult((intvec*)(u->Data()), (intvec*)(v->Data()));
1067 if (res->data==NULL)
1068 {
1069 WerrorS("intmat size not compatible");
1070 return TRUE;
1071 }
1072 if ((v->next!=NULL) || (u->next!=NULL))
1073 return jjOP_REST(res,u,v);
1074 return FALSE;
1075}
intvec * ivMult(intvec *a, intvec *b)
Definition: intvec.cc:331

◆ jjTIMES_MA()

static BOOLEAN jjTIMES_MA ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1140 of file iparith.cc.

1141{
1142 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
1143 res->data = (char *)mp_Mult(A,B,currRing);
1144 if (res->data==NULL)
1145 {
1146 Werror("matrix size not compatible(%dx%d, %dx%d) in *",
1148 return TRUE;
1149 }
1150 if ((v->next!=NULL) || (u->next!=NULL))
1151 return jjOP_REST(res,u,v);
1152 return FALSE;
1153}
matrix mp_Mult(matrix a, matrix b, const ring R)
Definition: matpol.cc:213

◆ jjTIMES_MA_BI1()

static BOOLEAN jjTIMES_MA_BI1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1088 of file iparith.cc.

1089{
1091 if (nMap==NULL) return TRUE;
1092 number n=nMap((number)v->Data(),coeffs_BIGINT,currRing->cf);
1093 poly p=pNSet(n);
1094 ideal I= (ideal)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1095 res->data = (char *)I;
1096 return FALSE;
1097}
matrix mp_MultP(matrix a, poly p, const ring R)
multiply a matrix 'a' by a poly 'p', destroy the args
Definition: matpol.cc:148

◆ jjTIMES_MA_BI2()

static BOOLEAN jjTIMES_MA_BI2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1098 of file iparith.cc.

1099{
1100 return jjTIMES_MA_BI1(res,v,u);
1101}
static BOOLEAN jjTIMES_MA_BI1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1088

◆ jjTIMES_MA_I1()

static BOOLEAN jjTIMES_MA_I1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1131 of file iparith.cc.

1132{
1133 res->data = (char *)mp_MultI((matrix)u->CopyD(MATRIX_CMD),(int)(long)v->Data(),currRing);
1134 return FALSE;
1135}
matrix mp_MultI(matrix a, int f, const ring R)
c = f*a
Definition: matpol.cc:135

◆ jjTIMES_MA_I2()

static BOOLEAN jjTIMES_MA_I2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1136 of file iparith.cc.

1137{
1138 return jjTIMES_MA_I1(res,v,u);
1139}
static BOOLEAN jjTIMES_MA_I1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1131

◆ jjTIMES_MA_N1()

static BOOLEAN jjTIMES_MA_N1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1120 of file iparith.cc.

1121{
1122 number n=(number)v->CopyD(NUMBER_CMD);
1123 poly p=pNSet(n);
1124 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1125 return FALSE;
1126}

◆ jjTIMES_MA_N2()

static BOOLEAN jjTIMES_MA_N2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1127 of file iparith.cc.

1128{
1129 return jjTIMES_MA_N1(res,v,u);
1130}
static BOOLEAN jjTIMES_MA_N1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1120

◆ jjTIMES_MA_P1()

static BOOLEAN jjTIMES_MA_P1 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1102 of file iparith.cc.

1103{
1104 poly p=(poly)v->CopyD(POLY_CMD);
1105 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1106 ideal I= (ideal)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1107 if (r>0) I->rank=r;
1108 res->data = (char *)I;
1109 return FALSE;
1110}
long rank
Definition: matpol.h:19

◆ jjTIMES_MA_P2()

static BOOLEAN jjTIMES_MA_P2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1111 of file iparith.cc.

1112{
1113 poly p=(poly)u->CopyD(POLY_CMD);
1114 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1115 ideal I= (ideal)pMultMp(p,(matrix)v->CopyD(MATRIX_CMD),currRing);
1116 if (r>0) I->rank=r;
1117 res->data = (char *)I;
1118 return FALSE;
1119}
matrix pMultMp(poly p, matrix a, const ring R)
Definition: matpol.cc:165

◆ jjTIMES_N()

static BOOLEAN jjTIMES_N ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1000 of file iparith.cc.

1001{
1002 res->data = (char *)(nMult( (number)u->Data(), (number)v->Data()));
1003 number n=(number)res->data;
1004 nNormalize(n);
1005 res->data=(char *)n;
1006 if ((v->next!=NULL) || (u->next!=NULL))
1007 return jjOP_REST(res,u,v);
1008 return FALSE;
1009}
#define nMult(n1, n2)
Definition: numbers.h:17

◆ jjTIMES_P()

static BOOLEAN jjTIMES_P ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1010 of file iparith.cc.

1011{
1012 poly a;
1013 poly b;
1014 if (v->next==NULL)
1015 {
1016 if (u->next==NULL)
1017 {
1018 a=(poly)u->Data(); // works also for VECTOR_CMD
1019 b=(poly)v->Data(); // works also for VECTOR_CMD
1020 if (!rIsLPRing(currRing)
1021 && (a!=NULL) && (b!=NULL)
1022 && ((long)pTotaldegree(a)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)-(long)pTotaldegree(b)))
1023 {
1024 Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
1025 pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
1026 }
1027 res->data = (char *)(pp_Mult_qq( a, b, currRing));
1028 return FALSE;
1029 }
1030 // u->next exists: copy v
1031 a=(poly)u->CopyD(POLY_CMD); // works also for VECTOR_CMD
1032 b=pCopy((poly)v->Data());
1033 if (!rIsLPRing(currRing)
1034 && (a!=NULL) && (b!=NULL)
1035 && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)))
1036 {
1037 Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
1038 pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
1039 }
1040 res->data = (char *)(pMult( a, b));
1041 return jjOP_REST(res,u,v);
1042 }
1043 // v->next exists: copy u
1044 a=pCopy((poly)u->Data());
1045 b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD
1046 if ((a!=NULL) && (b!=NULL)
1047 && ((unsigned long)(pTotaldegree(a)+pTotaldegree(b))>=currRing->bitmask/2))
1048 {
1049 pDelete(&a);
1050 pDelete(&b);
1051 WerrorS("OVERFLOW");
1052 return TRUE;
1053 }
1054 res->data = (char *)(pMult( a, b));
1055 return jjOP_REST(res,u,v);
1056}
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1151

◆ jjTIMES_SM()

static BOOLEAN jjTIMES_SM ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 1154 of file iparith.cc.

1155{
1156 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
1157 res->data = (char *)sm_Mult(A,B,currRing);
1158 if (res->data==NULL)
1159 {
1160 Werror("matrix size not compatible(%dx%d, %dx%d) in *",
1161 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
1162 return TRUE;
1163 }
1164 if ((v->next!=NULL) || (u->next!=NULL))
1165 return jjOP_REST(res,u,v);
1166 return FALSE;
1167}
ideal sm_Mult(ideal a, ideal b, const ring R)
Definition: matpol.cc:1891

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5192 of file iparith.cc.

5193{
5194 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5195 return FALSE;
5196}
int ivTrace(intvec *o)
Definition: intvec.cc:321

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5197 of file iparith.cc.

5198{
5199 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5200 return FALSE;
5201}

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5202 of file iparith.cc.

5203{
5204 res->data = (char *)ivTranp((intvec*)(v->Data()));
5205 return FALSE;
5206}
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5241 of file iparith.cc.

5242{
5243#ifdef HAVE_PLURAL
5244 ideal result;
5245 ideal v_id=(ideal)a->Data();
5247 result=(ideal)twostd(v_id);
5248 else /*commutative or shiftalgebra*/
5249 {
5250 return jjSTD(res,a);
5251 }
5252 res->data = (char *)result;
5255 return FALSE;
5256#else
5257 return TRUE;
5258#endif
5259}
#define FLAG_TWOSTD
Definition: ipid.h:107
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18

◆ jjTYPEOF()

static BOOLEAN jjTYPEOF ( leftv  res,
leftv  v 
)
static

Definition at line 5321 of file iparith.cc.

5322{
5323 int t=(int)(long)v->data;
5324 switch (t)
5325 {
5326 case CRING_CMD:
5327 case INT_CMD:
5328 case POLY_CMD:
5329 case VECTOR_CMD:
5330 case STRING_CMD:
5331 case INTVEC_CMD:
5332 case IDEAL_CMD:
5333 case MATRIX_CMD:
5334 case MODUL_CMD:
5335 case MAP_CMD:
5336 case PROC_CMD:
5337 case RING_CMD:
5338 case SMATRIX_CMD:
5339 //case QRING_CMD:
5340 case INTMAT_CMD:
5341 case BIGINTMAT_CMD:
5342 case NUMBER_CMD:
5343 #ifdef SINGULAR_4_2
5344 case CNUMBER_CMD:
5345 #endif
5346 case BIGINT_CMD:
5347 case BUCKET_CMD:
5348 case LIST_CMD:
5349 case PACKAGE_CMD:
5350 case LINK_CMD:
5351 case RESOLUTION_CMD:
5352 res->data=omStrDup(Tok2Cmdname(t)); break;
5353 case DEF_CMD:
5354 case NONE: res->data=omStrDup("none"); break;
5355 default:
5356 {
5357 if (t>MAX_TOK)
5358 res->data=omStrDup(getBlackboxName(t));
5359 else
5360 res->data=omStrDup("?unknown type?");
5361 break;
5362 }
5363 }
5364 return FALSE;
5365}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition: blackbox.cc:212
@ CNUMBER_CMD
Definition: tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3714 of file iparith.cc.

3715{
3716 number n=(number)u->CopyD(BIGINT_CMD);
3718 res->data = (char *)n;
3719 return FALSE;
3720}
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3751 of file iparith.cc.

3752{
3754 (*bim)*=(-1);
3755 res->data = (char *)bim;
3756 return FALSE;
3757}

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3721 of file iparith.cc.

3722{
3723 res->data = (char *)(-(long)u->Data());
3724 return FALSE;
3725}

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3744 of file iparith.cc.

3745{
3746 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3747 (*iv)*=(-1);
3748 res->data = (char *)iv;
3749 return FALSE;
3750}

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3738 of file iparith.cc.

3739{
3740 poly m1=pISet(-1);
3741 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3742 return FALSE;
3743}
#define pISet(i)
Definition: polys.h:312

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3726 of file iparith.cc.

3727{
3728 number n=(number)u->CopyD(NUMBER_CMD);
3729 n=nInpNeg(n);
3730 res->data = (char *)n;
3731 return FALSE;
3732}
#define nInpNeg(n)
Definition: numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3733 of file iparith.cc.

3734{
3735 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3736 return FALSE;
3737}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10199 of file iparith.cc.

10200{
10201 lists l=(lists)arg->Data();
10202 if (l->nr>0)
10203 {
10204 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10205 int i, j, len;
10206 len=l->nr;
10207 i=0;
10208 while(i<len)
10209 {
10210 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10211 {
10212 l->m[i].CleanUp();
10213 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10214 memset(&(l->m[len]),0,sizeof(sleftv));
10215 l->m[len].rtyp=DEF_CMD;
10216 len--;
10217 }
10218 else
10219 i++;
10220 }
10221 //Print("new len:%d\n",len);
10222 }
10223 return FALSE;
10224}

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5366 of file iparith.cc.

5367{
5368 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5369 return FALSE;
5370}
#define pIsUnivariate(p)
Definition: polys.h:249

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5371 of file iparith.cc.

5372{
5373 int i=(int)(long)v->Data();
5374 if ((0<i) && (i<=currRing->N))
5375 {
5376 poly p=pOne();
5377 pSetExp(p,i,1);
5378 pSetm(p);
5379 res->data=(char *)p;
5380 }
5381 else
5382 {
5383 Werror("var number %d out of range 1..%d",i,currRing->N);
5384 return TRUE;
5385 }
5386 return FALSE;
5387}

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5388 of file iparith.cc.

5389{
5390 if (currRing==NULL)
5391 {
5392 WerrorS("no ring active (2)");
5393 return TRUE;
5394 }
5395 int i=(int)(long)v->Data();
5396 if ((0<i) && (i<=currRing->N))
5397 res->data=omStrDup(currRing->names[i-1]);
5398 else
5399 {
5400 Werror("var number %d out of range 1..%d",i,currRing->N);
5401 return TRUE;
5402 }
5403 return FALSE;
5404}

◆ jjVARSTR2()

static BOOLEAN jjVARSTR2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3580 of file iparith.cc.

3581{
3582 idhdl h=(idhdl)u->data;
3583 int i=(int)(long)v->Data();
3584 if ((0<i) && (i<=IDRING(h)->N))
3585 res->data=omStrDup(IDRING(h)->names[i-1]);
3586 else
3587 {
3588 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3589 return TRUE;
3590 }
3591 return FALSE;
3592}

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5405 of file iparith.cc.

5406{
5408#ifdef HAVE_SHIFTBBA
5409 if (rIsLPRing(currRing))
5410 {
5411#ifdef HAVE_RINGS
5413 {
5414 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5415 return TRUE;
5416 }
5417#endif
5418 if (currRing->qideal != NULL)
5419 {
5420 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5421 return TRUE;
5422 }
5423 int kDim = lp_kDim((ideal)(v->Data()));
5424 res->data = (char *)(long)kDim;
5425 return (kDim == -2);
5426 }
5427#endif
5428 res->data = (char *)(long)scMult0Int((ideal)v->Data(),currRing->qideal);
5429 return FALSE;
5430}
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:993
int lp_kDim(const ideal _G)
Definition: hdegree.cc:2090

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5431 of file iparith.cc.

5432{
5433// input: u: a list with links of type
5434// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5435// returns: -1: the read state of all links is eof
5436// i>0: (at least) u[i] is ready
5437 lists Lforks = (lists)u->Data();
5438 int i = slStatusSsiL(Lforks, -1);
5439 if(i == -2) /* error */
5440 {
5441 return TRUE;
5442 }
5443 res->data = (void*)(long)i;
5444 return FALSE;
5445}

◆ jjWAIT1ST2()

static BOOLEAN jjWAIT1ST2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3593 of file iparith.cc.

3594{
3595// input: u: a list with links of type
3596// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3597// v: timeout for select in milliseconds
3598// or 0 for polling
3599// returns: ERROR (via Werror): timeout negative
3600// -1: the read state of all links is eof
3601// 0: timeout (or polling): none ready
3602// i>0: (at least) L[i] is ready
3603 lists Lforks = (lists)u->Data();
3604 int t = (int)(long)v->Data();
3605 if(t < 0)
3606 {
3607 WerrorS("negative timeout"); return TRUE;
3608 }
3609 int i = slStatusSsiL(Lforks, t*1000);
3610 if(i == -2) /* error */
3611 {
3612 return TRUE;
3613 }
3614 res->data = (void*)(long)i;
3615 return FALSE;
3616}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5446 of file iparith.cc.

5447{
5448// input: u: a list with links of type
5449// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5450// returns: -1: the read state of all links is eof
5451// 1: all links are ready
5452// (caution: at least one is ready, but some maybe dead)
5453 lists Lforks = (lists)u->CopyD();
5454 int i;
5455 int j = -1;
5456 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5457 {
5458 i = slStatusSsiL(Lforks, -1);
5459 if(i == -2) /* error */
5460 {
5461 return TRUE;
5462 }
5463 if(i == -1)
5464 {
5465 break;
5466 }
5467 j = 1;
5468 Lforks->m[i-1].CleanUp();
5469 Lforks->m[i-1].rtyp=DEF_CMD;
5470 Lforks->m[i-1].data=NULL;
5471 }
5472 res->data = (void*)(long)j;
5473 Lforks->Clean();
5474 return FALSE;
5475}

◆ jjWAITALL2()

static BOOLEAN jjWAITALL2 ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3617 of file iparith.cc.

3618{
3619// input: u: a list with links of type
3620// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3621// v: timeout for select in milliseconds
3622// or 0 for polling
3623// returns: ERROR (via Werror): timeout negative
3624// -1: the read state of all links is eof
3625// 0: timeout (or polling): none ready
3626// 1: all links are ready
3627// (caution: at least one is ready, but some maybe dead)
3628 lists Lforks = (lists)u->CopyD();
3629 int timeout = 1000*(int)(long)v->Data();
3630 if(timeout < 0)
3631 {
3632 WerrorS("negative timeout"); return TRUE;
3633 }
3634 int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3635 int i;
3636 int ret = -1;
3637 for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3638 {
3639 i = slStatusSsiL(Lforks, timeout);
3640 if(i > 0) /* Lforks[i] is ready */
3641 {
3642 ret = 1;
3643 Lforks->m[i-1].CleanUp();
3644 Lforks->m[i-1].rtyp=DEF_CMD;
3645 Lforks->m[i-1].data=NULL;
3646 timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3647 }
3648 else /* terminate the for loop */
3649 {
3650 if(i == -2) /* error */
3651 {
3652 return TRUE;
3653 }
3654 if(i == 0) /* timeout */
3655 {
3656 ret = 0;
3657 }
3658 break;
3659 }
3660 }
3661 Lforks->Clean();
3662 res->data = (void*)(long)ret;
3663 return FALSE;
3664}
#define TIMER_RESOLUTION
Definition: mod2.h:34
int getRTimer()
Definition: timer.cc:170

◆ jjWEDGE()

static BOOLEAN jjWEDGE ( leftv  res,
leftv  u,
leftv  v 
)
static

Definition at line 3665 of file iparith.cc.

3666{
3667 res->data = (char *)mp_Wedge((matrix)u->Data(),(int)(long)v->Data(),currRing);
3668 return FALSE;
3669}
matrix mp_Wedge(matrix a, int ar, const ring R)
Definition: matpol.cc:1751

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3672 of file iparith.cc.

3673{
3674 return TRUE;
3675}

◆ pHeadProc()

poly pHeadProc ( poly  p)

Definition at line 230 of file iparith.cc.

231{
232 return pHead(p);
233}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int  tok)

Definition at line 9604 of file iparith.cc.

9605{
9606 if (tok <= 0)
9607 {
9608 return sArithBase.sCmds[0].name;
9609 }
9610 if (tok==ANY_TYPE) return "any_type";
9611 if (tok==COMMAND) return "command";
9612 if (tok==NONE) return "nothing";
9613 if (tok < 128)
9614 {
9615 Tok2Cmdname_buf[0]=(char)tok;
9616 return Tok2Cmdname_buf;
9617 }
9618 //if (tok==IFBREAK) return "if_break";
9619 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9620 //if (tok==ORDER_VECTOR) return "ordering";
9621 //if (tok==REF_VAR) return "ref";
9622 //if (tok==OBJECT) return "object";
9623 //if (tok==PRINT_EXPR) return "print_expr";
9624 if (tok==IDHDL) return "identifier";
9625 if (tok>MAX_TOK) return getBlackboxName(tok);
9626 unsigned i;
9627 for(i=0; i<sArithBase.nCmdUsed; i++)
9628 //while (sArithBase.sCmds[i].tokval!=0)
9629 {
9630 if ((sArithBase.sCmds[i].tokval == tok)&&
9631 (sArithBase.sCmds[i].alias==0))
9632 {
9633 return sArithBase.sCmds[i].name;
9634 }
9635 }
9636 // try gain for alias/old names:
9637 for(i=0; i<sArithBase.nCmdUsed; i++)
9638 {
9639 if (sArithBase.sCmds[i].tokval == tok)
9640 {
9641 return sArithBase.sCmds[i].name;
9642 }
9643 }
9644 return sArithBase.sCmds[0].name;
9645}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9603
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5549 of file iparith.cc.

5550{
5552}

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 215 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 216 of file iparith.cc.

◆ farey_cnt

long farey_cnt =0L

Definition at line 9 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 220 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 199 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2047 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9603 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5548 of file iparith.cc.