My Project
Loading...
Searching...
No Matches
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 bit31   SIZEOF_LONG*8-1
 
#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 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
 
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)
 
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 jjDelete_ID_IV (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 jjHOMOG1_WI (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 jjPRUNE_MAP (leftv res, leftv v, leftv ma)
 
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 jjWRONG2 (leftv, leftv, leftv)
 
static BOOLEAN jjWRONG3 (leftv, leftv, 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 jjCOEFFS1 (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.
 
static BOOLEAN jjNUMERATOR (leftv res, leftv v)
 Return the numerator of the input number.
 
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 jjBIV2IV (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
 
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 jjHILBERT3Qt (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 jjHOMOG_W_M (leftv res, leftv v1, leftv v2, leftv v3)
 
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 jjMRES_MAP (leftv res, leftv u, leftv v, leftv ma)
 
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 jjBIGINTVEC_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
 
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
 
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
 
BOOLEAN iiExprArithM (leftv res, leftv a, int op)
 
int IsCmd (const char *n, int &tok)
 
const charTok2Cmdname (int tok)
 
int iiInitArithmetic ()
 initialisation of arithmetic structured data
 
int iiArithFindCmd (const char *szName)
 
chariiArithGetCmd (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.
 
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 127 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 184 of file iparith.cc.

Data Fields
unsigned nCmdAllocated number of commands-slots allocated
unsigned nCmdUsed number of commands used
unsigned nLastIdentifier valid identifiers 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.

◆ bit31

#define bit31   SIZEOF_LONG*8-1

Definition at line 124 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 8998 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 220 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 9000 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 8999 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 3350 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3347 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3348 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3349 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3352 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3346 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3351 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 133 of file iparith.cc.

◆ proc2

Definition at line 153 of file iparith.cc.

◆ proc3

Definition at line 164 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

Definition at line 9903 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 9959 of file iparith.cc.

9960{
9961 cmdnames *pCmdL = (cmdnames*)a;
9962 cmdnames *pCmdR = (cmdnames*)b;
9963
9964 if(a==NULL || b==NULL) return 0;
9965
9966 /* empty entries goes to the end of the list for later reuse */
9967 if(pCmdL->name==NULL) return 1;
9968 if(pCmdR->name==NULL) return -1;
9969
9970 /* $INVALID$ must come first */
9971 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9972 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9973
9974 /* tokval=-1 are reserved names at the end */
9975 if (pCmdL->tokval==-1)
9976 {
9977 if (pCmdR->tokval==-1)
9978 return strcmp(pCmdL->name, pCmdR->name);
9979 /* pCmdL->tokval==-1, pCmdL goes at the end */
9980 return 1;
9981 }
9982 /* pCmdR->tokval==-1, pCmdR goes at the end */
9983 if(pCmdR->tokval==-1) return -1;
9984
9985 return strcmp(pCmdL->name, pCmdR->name);
9986}
CanonicalForm b
Definition cfModGcd.cc:4111
#define NULL
Definition omList.c:12

◆ check_valid()

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

Definition at line 10185 of file iparith.cc.

10186{
10188 {
10189 if ((p & NC_MASK)==NO_NC)
10190 {
10191 WerrorS("not implemented for non-commutative rings");
10192 return TRUE;
10193 }
10194 else if ((p & NC_MASK)==COMM_PLURAL)
10195 {
10196 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10197 return FALSE;
10198 }
10199 /* else, ALLOW_PLURAL */
10200 }
10201 else if (rIsLPRing(currRing))
10202 {
10203 if ((p & ALLOW_LP)==0)
10204 {
10205 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10206 return TRUE;
10207 }
10208 }
10210 {
10211 if ((p & RING_MASK)==0 /*NO_RING*/)
10212 {
10213 WerrorS("not implemented for rings with rings as coeffients");
10214 return TRUE;
10215 }
10216 /* else ALLOW_RING */
10217 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
10219 {
10220 WerrorS("domain required as coeffients");
10221 return TRUE;
10222 }
10223 /* else ALLOW_ZERODIVISOR */
10224 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
10225 {
10226 WarnS("considering the image in Q[...]");
10227 }
10228 }
10229 return FALSE;
10230}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
int p
Definition cfModGcd.cc:4086
#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:9905
#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:405
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:492
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:416
#define rField_is_Ring(R)
Definition ring.h:490

◆ iiArithAddCmd()

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

Definition at line 10126 of file iparith.cc.

10133{
10134 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
10135 // nTokval, nToktype, nPos);
10136 if(nPos>=0)
10137 {
10138 // no checks: we rely on a correct generated code in iparith.inc
10139 assume((unsigned)nPos < sArithBase.nCmdAllocated);
10140 assume(szName!=NULL);
10142 sArithBase.sCmds[nPos].alias = nAlias;
10143 sArithBase.sCmds[nPos].tokval = nTokval;
10144 sArithBase.sCmds[nPos].toktype = nToktype;
10146 //if(nTokval>0) sArithBase.nLastIdentifier++;
10147 }
10148 else
10149 {
10150 if(szName==NULL) return -1;
10152 if(nIndex>=0)
10153 {
10154 Print("'%s' already exists at %d\n", szName, nIndex);
10155 return -1;
10156 }
10157
10159 {
10160 /* needs to create new slots */
10161 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
10163 if(sArithBase.sCmds==NULL) return -1;
10165 }
10166 /* still free slots available */
10172
10177 {
10178 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10179 }
10180 //Print("L=%d\n", sArithBase.nLastIdentifier);
10181 }
10182 return 0;
10183}
#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:9959
int iiArithFindCmd(const char *szName)
Definition iparith.cc:10031
cmdnames * sCmds
array of existing commands
Definition iparith.cc:186
unsigned nLastIdentifier
valid identifiers are slot 1..nLastIdentifier
Definition iparith.cc:193
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition iparith.cc:201
unsigned nCmdAllocated
number of commands-slots allocated
Definition iparith.cc:192
unsigned nCmdUsed
number of commands used
Definition iparith.cc:191
#define assume(x)
Definition mod2.h:387
#define nSize(n)
Definition numbers.h:39
#define omStrDup(s)
#define omRealloc(addr, size)

◆ iiArithFindCmd()

int iiArithFindCmd ( const char * szName)

Definition at line 10031 of file iparith.cc.

10032{
10033 int an=0;
10034 int i = 0,v = 0;
10036
10037 loop
10038 //for(an=0; an<sArithBase.nCmdUsed; )
10039 {
10040 if(an>=en-1)
10041 {
10042 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
10043 {
10044 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
10045 return an;
10046 }
10047 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
10048 {
10049 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
10050 return en;
10051 }
10052 else
10053 {
10054 //Print("RET- 1\n");
10055 return -1;
10056 }
10057 }
10058 i=(an+en)/2;
10059 if (*szName < *(sArithBase.sCmds[i].name))
10060 {
10061 en=i-1;
10062 }
10063 else if (*szName > *(sArithBase.sCmds[i].name))
10064 {
10065 an=i+1;
10066 }
10067 else
10068 {
10070 if(v<0)
10071 {
10072 en=i-1;
10073 }
10074 else if(v>0)
10075 {
10076 an=i+1;
10077 }
10078 else /*v==0*/
10079 {
10080 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
10081 return i;
10082 }
10083 }
10084 }
10085 //if(i>=0 && i<sArithBase.nCmdUsed)
10086 // return i;
10087 //PrintS("RET-2\n");
10088 return -2;
10089}
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 10091 of file iparith.cc.

10092{
10093 if(nPos<0) return NULL;
10094 if(nPos<(int)sArithBase.nCmdUsed)
10095 return sArithBase.sCmds[nPos].name;
10096 return NULL;
10097}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char * szName)
extern

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char * szName)

Definition at line 10099 of file iparith.cc.

10100{
10101 int nIndex;
10102 if(szName==NULL) return -1;
10103
10106 {
10107 Print("'%s' not found (%d)\n", szName, nIndex);
10108 return -1;
10109 }
10115
10116 /* fix last-identifier */
10119 {
10120 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10121 }
10122 //Print("L=%d\n", sArithBase.nLastIdentifier);
10123 return 0;
10124}
#define omFreeBinAddr(addr)

◆ iiExprArith1()

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

Definition at line 9371 of file iparith.cc.

9372{
9373 if (!errorreported)
9374 {
9375 res->Init();
9376#ifdef SIQ
9377 if (siq>0)
9378 {
9379 //Print("siq:%d\n",siq);
9381 memcpy(&d->arg1,a,sizeof(sleftv));
9382 a->Init();
9383 d->op=op;
9384 d->argc=1;
9385 res->data=(char *)d;
9386 res->rtyp=COMMAND;
9387 return FALSE;
9388 }
9389#endif
9390 int at=a->Typ();
9391 // handling bb-objects ----------------------------------------------------
9392 if(op>MAX_TOK) // explicit type conversion to bb
9393 {
9395 if (bb!=NULL)
9396 {
9397 res->rtyp=op;
9398 res->data=bb->blackbox_Init(bb);
9399 return bb->blackbox_Assign(res,a);
9400 }
9401 else
9402 return TRUE;
9403 }
9404 else if (at>MAX_TOK) // argument is of bb-type
9405 {
9407 if (bb!=NULL)
9408 {
9409 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9410 // if not defined, try generic routines (attrib, defined,..)
9411 }
9412 else
9413 return TRUE;
9414 }
9415 if (errorreported) return TRUE;
9416
9419 }
9420 a->CleanUp();
9421 return TRUE;
9422}
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:1047
void Init()
Definition subexpr.h:107
void CleanUp(ring r=currRing)
Definition subexpr.cc:349
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:9241
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition iparith.cc:9880
const struct sConvertTypes dConvertTypes[]
Definition table.h:1322
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)
VAR BOOLEAN siq
Definition subexpr.cc:48
@ MAX_TOK
Definition tok.h:220
#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 9241 of file iparith.cc.

9242{
9243 res->Init();
9245
9246 if (!errorreported)
9247 {
9249 iiOp=op;
9250 int i = 0;
9251 while (dA1[i].cmd==op)
9252 {
9253 if (at==dA1[i].arg)
9254 {
9255 if (currRing!=NULL)
9256 {
9257 if (check_valid(dA1[i].valid_for,op)) break;
9258 }
9259 else
9260 {
9261 if (RingDependend(dA1[i].res))
9262 {
9263 WerrorS("no ring active (5)");
9264 break;
9265 }
9266 }
9267 if (traceit&TRACE_CALL)
9268 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9269 res->rtyp=dA1[i].res;
9270 if ((call_failed=dA1[i].p(res,a)))
9271 {
9272 break;// leave loop, goto error handling
9273 }
9274 if (a->Next()!=NULL)
9275 {
9277 failed=iiExprArith1(res->next,a->next,op);
9278 }
9279 a->CleanUp();
9280 return failed;
9281 }
9282 i++;
9283 }
9284 // implicite type conversion --------------------------------------------
9285 if (dA1[i].cmd!=op)
9286 {
9288 i=0;
9289 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9290 while (dA1[i].cmd==op)
9291 {
9292 int ai;
9293 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9294 if ((dA1[i].valid_for & NO_CONVERSION)==0)
9295 {
9296 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9297 {
9298 if (currRing!=NULL)
9299 {
9300 if (check_valid(dA1[i].valid_for,op)) break;
9301 }
9302 else
9303 {
9304 if (RingDependend(dA1[i].res))
9305 {
9306 WerrorS("no ring active (6)");
9307 break;
9308 }
9309 }
9310 if (traceit&TRACE_CALL)
9311 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9312 res->rtyp=dA1[i].res;
9314 || (call_failed=dA1[i].p(res,an)));
9315 // everything done, clean up temp. variables
9316 if (failed)
9317 {
9318 // leave loop, goto error handling
9319 break;
9320 }
9321 else
9322 {
9323 if (an->Next() != NULL)
9324 {
9325 res->next = (leftv)omAllocBin(sleftv_bin);
9326 failed=iiExprArith1(res->next,an->next,op);
9327 }
9328 // everything ok, clean up and return
9329 an->CleanUp();
9331 return failed;
9332 }
9333 }
9334 }
9335 i++;
9336 }
9337 an->CleanUp();
9339 }
9340 // error handling
9341 if (!errorreported)
9342 {
9343 if ((at==0) && (a->Fullname()!=sNoName_fe))
9344 {
9345 Werror("`%s` is not defined",a->Fullname());
9346 }
9347 else
9348 {
9349 i=0;
9350 const char *s = iiTwoOps(op);
9351 Werror("%s(`%s`) failed"
9352 ,s,Tok2Cmdname(at));
9353 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9354 {
9355 while (dA1[i].cmd==op)
9356 {
9357 if ((dA1[i].res!=0)
9358 && (dA1[i].p!=jjWRONG))
9359 Werror("expected %s(`%s`)"
9360 ,s,Tok2Cmdname(dA1[i].arg));
9361 i++;
9362 }
9363 }
9364 }
9365 }
9366 res->rtyp = UNKNOWN;
9367 }
9368 a->CleanUp();
9369 return TRUE;
9370}
int BOOLEAN
Definition auxiliary.h:87
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:57
int iiTestConvert(int inputType, int outputType)
Definition gentable.cc:301
const char * iiTwoOps(int t)
Definition gentable.cc:261
#define jjWRONG
Definition gentable.cc:127
static int RingDependend(int t)
Definition gentable.cc:28
#define NO_CONVERSION
Definition iparith.cc:120
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9371
static BOOLEAN check_valid(const int p, const int op)
Definition iparith.cc:10185
VAR int iiOp
Definition iparith.cc:222
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition ipconv.cc:449
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
#define omAllocBin(bin)
#define omFreeBin(addr, bin)
#define BVERBOSE(a)
Definition options.h:35
#define V_SHOW_USE
Definition options.h:52
EXTERN_VAR int traceit
Definition reporter.h:24
#define TRACE_CALL
Definition reporter.h:44
sleftv * leftv
Definition structs.h:57
#define UNKNOWN
Definition tok.h:224

◆ iiExprArith2()

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

Definition at line 9182 of file iparith.cc.

9183{
9184 res->Init();
9185
9186 if (!errorreported)
9187 {
9188#ifdef SIQ
9189 if (siq>0)
9190 {
9191 //Print("siq:%d\n",siq);
9193 memcpy(&d->arg1,a,sizeof(sleftv));
9194 a->Init();
9195 memcpy(&d->arg2,b,sizeof(sleftv));
9196 b->Init();
9197 d->argc=2;
9198 d->op=op;
9199 res->data=(char *)d;
9200 res->rtyp=COMMAND;
9201 return FALSE;
9202 }
9203#endif
9204 int at=a->Typ();
9205 int bt=b->Typ();
9206 // handling bb-objects ----------------------------------------------------
9207 if (at>MAX_TOK)
9208 {
9210 if (bb!=NULL)
9211 {
9212 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9213 // if not defined, try generic (attrib, ..)
9214 }
9215 else
9216 return TRUE;
9217 }
9218 else if ((bt>MAX_TOK)&&(op!='('))
9219 {
9221 if (bb!=NULL)
9222 {
9223 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9224 // if not defined, try generic (attrib, ..)
9225 }
9226 else
9227 return TRUE;
9228 }
9231 }
9232 a->CleanUp();
9233 b->CleanUp();
9234 return TRUE;
9235}
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:9009
const struct sValCmd2 dArith2[]
Definition table.h:324

◆ 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 9168 of file iparith.cc.

9172{
9173 res->Init();
9174 leftv b=a->next;
9175 a->next=NULL;
9176 int bt=b->Typ();
9178 a->next=b;
9179 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
9180 return bo;
9181}

◆ 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 9009 of file iparith.cc.

9014{
9016
9017 if (!errorreported)
9018 {
9019 int i=0;
9020 iiOp=op;
9021 while (dA2[i].cmd==op)
9022 {
9023 if ((at==dA2[i].arg1)
9024 && (bt==dA2[i].arg2))
9025 {
9026 res->rtyp=dA2[i].res;
9027 if (currRing!=NULL)
9028 {
9029 if (check_valid(dA2[i].valid_for,op)) break;
9030 }
9031 else
9032 {
9033 if (RingDependend(dA2[i].res))
9034 {
9035 WerrorS("no ring active (3)");
9036 break;
9037 }
9038 }
9039 if (traceit&TRACE_CALL)
9040 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
9041 if ((call_failed=dA2[i].p(res,a,b)))
9042 {
9043 break;// leave loop, goto error handling
9044 }
9045 a->CleanUp();
9046 b->CleanUp();
9047 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9048 return FALSE;
9049 }
9050 i++;
9051 }
9052 // implicite type conversion ----------------------------------------------
9053 if (dA2[i].cmd!=op)
9054 {
9055 int ai,bi;
9059 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9060 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
9061 while (dA2[i].cmd==op)
9062 {
9063 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9064 if ((dA2[i].valid_for & NO_CONVERSION)==0)
9065 {
9066 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
9067 {
9068 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
9069 {
9070 res->rtyp=dA2[i].res;
9071 if (currRing!=NULL)
9072 {
9073 if (check_valid(dA2[i].valid_for,op)) break;
9074 }
9075 else
9076 {
9077 if (RingDependend(dA2[i].res))
9078 {
9079 WerrorS("no ring active (4)");
9080 break;
9081 }
9082 }
9083 if (traceit&TRACE_CALL)
9084 Print("call %s(%s,%s)\n",iiTwoOps(op),
9085 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9086 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
9087 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
9088 || (call_failed=dA2[i].p(res,an,bn)));
9089 // everything done, clean up temp. variables
9090 if (failed)
9091 {
9092 // leave loop, goto error handling
9093 break;
9094 }
9095 else
9096 {
9097 // everything ok, clean up and return
9098 an->CleanUp();
9099 bn->CleanUp();
9102 return FALSE;
9103 }
9104 }
9105 }
9106 }
9107 i++;
9108 }
9109 an->CleanUp();
9110 bn->CleanUp();
9113 }
9114 // error handling ---------------------------------------------------
9115 const char *s=NULL;
9116 if (!errorreported)
9117 {
9118 if ((at==0) && (a->Fullname()!=sNoName_fe))
9119 {
9120 s=a->Fullname();
9121 }
9122 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9123 {
9124 s=b->Fullname();
9125 }
9126 if (s!=NULL)
9127 Werror("`%s` is not defined",s);
9128 else
9129 {
9130 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9131 s = iiTwoOps(op);
9132 if (proccall)
9133 {
9134 Werror("%s(`%s`,`%s`) failed"
9136 }
9137 else
9138 {
9139 Werror("`%s` %s `%s` failed"
9141 }
9142 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9143 {
9144 while (dA2[i].cmd==op)
9145 {
9146 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
9147 && (dA2[i].res!=0)
9148 && (dA2[i].p!=jjWRONG2))
9149 {
9150 if (proccall)
9151 Werror("expected %s(`%s`,`%s`)"
9152 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9153 else
9154 Werror("expected `%s` %s `%s`"
9155 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
9156 }
9157 i++;
9158 }
9159 }
9160 }
9161 }
9162 a->CleanUp();
9163 b->CleanUp();
9164 res->rtyp = UNKNOWN;
9165 }
9166 return TRUE;
9167}
#define jjWRONG2
Definition gentable.cc:128

◆ iiExprArith3()

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

Definition at line 9581 of file iparith.cc.

9582{
9583 res->Init();
9584
9585 if (!errorreported)
9586 {
9587#ifdef SIQ
9588 if (siq>0)
9589 {
9590 //Print("siq:%d\n",siq);
9592 memcpy(&d->arg1,a,sizeof(sleftv));
9593 a->Init();
9594 memcpy(&d->arg2,b,sizeof(sleftv));
9595 b->Init();
9596 memcpy(&d->arg3,c,sizeof(sleftv));
9597 c->Init();
9598 d->op=op;
9599 d->argc=3;
9600 res->data=(char *)d;
9601 res->rtyp=COMMAND;
9602 return FALSE;
9603 }
9604#endif
9605 int at=a->Typ();
9606 // handling bb-objects ----------------------------------------------
9607 if (at>MAX_TOK)
9608 {
9610 if (bb!=NULL)
9611 {
9612 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9613 // otherwise, try defaul (attrib,..)
9614 }
9615 else
9616 return TRUE;
9617 if (errorreported) return TRUE;
9618 }
9619 int bt=b->Typ();
9620 int ct=c->Typ();
9621
9622 iiOp=op;
9623 int i=0;
9624 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9626 }
9627 a->CleanUp();
9628 b->CleanUp();
9629 c->CleanUp();
9630 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9631 return TRUE;
9632}
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:9428
const struct sValCmd3 dArith3[]
Definition table.h:802

◆ 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 9633 of file iparith.cc.

9637{
9638 res->Init();
9639 leftv b=a->next;
9640 a->next=NULL;
9641 int bt=b->Typ();
9642 leftv c=b->next;
9643 b->next=NULL;
9644 int ct=c->Typ();
9646 b->next=c;
9647 a->next=b;
9648 a->CleanUp(); // to cleanup the chain, content already done
9649 return bo;
9650}

◆ 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 9428 of file iparith.cc.

9431{
9433
9434 assume(dA3[0].cmd==op);
9435
9436 if (!errorreported)
9437 {
9438 int i=0;
9439 iiOp=op;
9440 while (dA3[i].cmd==op)
9441 {
9442 if ((at==dA3[i].arg1)
9443 && (bt==dA3[i].arg2)
9444 && (ct==dA3[i].arg3))
9445 {
9446 res->rtyp=dA3[i].res;
9447 if (currRing!=NULL)
9448 {
9449 if (check_valid(dA3[i].valid_for,op)) break;
9450 }
9451 if (traceit&TRACE_CALL)
9452 Print("call %s(%s,%s,%s)\n",
9454 if ((call_failed=dA3[i].p(res,a,b,c)))
9455 {
9456 break;// leave loop, goto error handling
9457 }
9458 a->CleanUp();
9459 b->CleanUp();
9460 c->CleanUp();
9461 return FALSE;
9462 }
9463 i++;
9464 }
9465 // implicite type conversion ----------------------------------------------
9466 if (dA3[i].cmd!=op)
9467 {
9468 int ai,bi,ci;
9473 i=0;
9474 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9475 while (dA3[i].cmd==op)
9476 {
9477 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9478 {
9479 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9480 {
9481 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9482 {
9483 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9484 {
9485 res->rtyp=dA3[i].res;
9486 if (currRing!=NULL)
9487 {
9488 if (check_valid(dA3[i].valid_for,op)) break;
9489 }
9490 if (traceit&TRACE_CALL)
9491 Print("call %s(%s,%s,%s)\n",
9492 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9493 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9494 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9495 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9496 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9497 || (call_failed=dA3[i].p(res,an,bn,cn)));
9498 // everything done, clean up temp. variables
9499 if (failed)
9500 {
9501 // leave loop, goto error handling
9502 break;
9503 }
9504 else
9505 {
9506 // everything ok, clean up and return
9507 an->CleanUp();
9508 bn->CleanUp();
9509 cn->CleanUp();
9513 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9514 return FALSE;
9515 }
9516 }
9517 }
9518 }
9519 }
9520 i++;
9521 }
9522 an->CleanUp();
9523 bn->CleanUp();
9524 cn->CleanUp();
9528 }
9529 // error handling ---------------------------------------------------
9530 if (!errorreported)
9531 {
9532 const char *s=NULL;
9533 if ((at==0) && (a->Fullname()!=sNoName_fe))
9534 {
9535 s=a->Fullname();
9536 }
9537 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9538 {
9539 s=b->Fullname();
9540 }
9541 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9542 {
9543 s=c->Fullname();
9544 }
9545 if (s!=NULL)
9546 Werror("`%s` is not defined",s);
9547 else
9548 {
9549 i=0;
9550 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9551 const char *s = iiTwoOps(op);
9552 Werror("%s(`%s`,`%s`,`%s`) failed"
9554 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9555 {
9556 while (dA3[i].cmd==op)
9557 {
9558 if(((at==dA3[i].arg1)
9559 ||(bt==dA3[i].arg2)
9560 ||(ct==dA3[i].arg3))
9561 && (dA3[i].res!=0))
9562 {
9563 Werror("expected %s(`%s`,`%s`,`%s`)"
9564 ,s,Tok2Cmdname(dA3[i].arg1)
9565 ,Tok2Cmdname(dA3[i].arg2)
9566 ,Tok2Cmdname(dA3[i].arg3));
9567 }
9568 i++;
9569 }
9570 }
9571 }
9572 }
9573 res->rtyp = UNKNOWN;
9574 }
9575 a->CleanUp();
9576 b->CleanUp();
9577 c->CleanUp();
9578 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9579 return TRUE;
9580}

◆ iiExprArithM()

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

Definition at line 9672 of file iparith.cc.

9673{
9674 res->Init();
9675
9676 if (!errorreported)
9677 {
9678#ifdef SIQ
9679 if (siq>0)
9680 {
9681 //Print("siq:%d\n",siq);
9683 d->op=op;
9684 res->data=(char *)d;
9685 if (a!=NULL)
9686 {
9687 d->argc=a->listLength();
9688 // else : d->argc=0;
9689 memcpy(&d->arg1,a,sizeof(sleftv));
9690 switch(d->argc)
9691 {
9692 case 3:
9693 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9694 a->next->next->Init();
9695 /* no break */
9696 case 2:
9697 memcpy(&d->arg2,a->next,sizeof(sleftv));
9698 a->next->Init();
9699 a->next->next=d->arg2.next;
9700 d->arg2.next=NULL;
9701 /* no break */
9702 case 1:
9703 a->Init();
9704 a->next=d->arg1.next;
9705 d->arg1.next=NULL;
9706 }
9707 if (d->argc>3) a->next=NULL;
9708 a->name=NULL;
9709 a->rtyp=0;
9710 a->data=NULL;
9711 a->e=NULL;
9712 a->attribute=NULL;
9713 a->CleanUp();
9714 }
9715 res->rtyp=COMMAND;
9716 return FALSE;
9717 }
9718#endif
9719 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9720 {
9722 if (bb!=NULL)
9723 {
9724 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9725 // otherwise, try default
9726 }
9727 else
9728 return TRUE;
9729 if (errorreported) return TRUE;
9730 }
9731 int args=0;
9732 if (a!=NULL) args=a->listLength();
9733
9734 iiOp=op;
9735 int i=0;
9736 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9737 while (dArithM[i].cmd==op)
9738 {
9739 if ((args==dArithM[i].number_of_args)
9740 || (dArithM[i].number_of_args==-1)
9741 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9742 {
9743 res->rtyp=dArithM[i].res;
9744 if (currRing!=NULL)
9745 {
9746 if (check_valid(dArithM[i].valid_for,op)) break;
9747 }
9748 if (traceit&TRACE_CALL)
9749 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9750 if (dArithM[i].p(res,a))
9751 {
9752 break;// leave loop, goto error handling
9753 }
9754 if (a!=NULL) a->CleanUp();
9755 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9756 return FALSE;
9757 }
9758 i++;
9759 }
9760 // error handling
9761 if (!errorreported)
9762 {
9763 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9764 {
9765 Werror("`%s` is not defined",a->Fullname());
9766 }
9767 else
9768 {
9769 const char *s = iiTwoOps(op);
9770 Werror("%s(...) failed",s);
9771 }
9772 }
9773 res->rtyp = UNKNOWN;
9774 }
9775 if (a!=NULL) a->CleanUp();
9776 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9777 return TRUE;
9778}
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
const struct sValCmdM dArithM[]
Definition table.h:938

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9996 of file iparith.cc.

9997{
9998 //printf("iiInitArithmetic()\n");
9999 memset(&sArithBase, 0, sizeof(sArithBase));
10000 iiInitCmdName();
10001 /* fix last-identifier */
10002#if 0
10003 /* we expect that gentable allready did every thing */
10006 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10007 }
10008#endif
10009 //Print("L=%d\n", sArithBase.nLastIdentifier);
10010
10011 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
10012 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
10013
10014 //iiArithAddCmd("Top", 0,-1,0);
10015
10016
10017 //for(i=0; i<sArithBase.nCmdUsed; i++) {
10018 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
10019 // sArithBase.sCmds[i].name,
10020 // sArithBase.sCmds[i].alias,
10021 // sArithBase.sCmds[i].tokval,
10022 // sArithBase.sCmds[i].toktype);
10023 //}
10024 //iiArithRemoveCmd("Top");
10025 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
10026 //iiArithRemoveCmd("mygcd");
10027 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
10028 return 0;
10029}

◆ iin_Int()

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

Definition at line 225 of file iparith.cc.

226{
227 long l=n_Int(n,cf);
228 int i=(int)l;
229 if ((long)i==l) return l;
230 return 0;
231}
int l
Definition cfEzgcd.cc:100
CanonicalForm cf
Definition cfModGcd.cc:4091
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:551

◆ iiTabIndex()

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

Definition at line 9880 of file iparith.cc.

9881{
9882 // user defined types are not in the pre-computed table:
9883 if (op>MAX_TOK) return 0;
9884
9885 int a=0;
9886 int e=len;
9887 int p=len/2;
9888 do
9889 {
9890 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9891 if (op<dArithTab[p].cmd) e=p-1;
9892 else a = p+1;
9893 p=a+(e-a)/2;
9894 }
9895 while ( a <= e);
9896
9897 // catch missing a cmd:
9898 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9899 // Print("op %d (%c) unknown",op,op);
9900 return 0;
9901}

◆ iiTokType()

int iiTokType ( int op)

Definition at line 233 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9781 of file iparith.cc.

9782{
9783 int i;
9784 int an=1;
9786
9787 loop
9788 //for(an=0; an<sArithBase.nCmdUsed; )
9789 {
9790 if(an>=en-1)
9791 {
9792 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9793 {
9794 i=an;
9795 break;
9796 }
9797 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9798 {
9799 i=en;
9800 break;
9801 }
9802 else
9803 {
9804 // -- blackbox extensions:
9805 // return 0;
9806 return blackboxIsCmd(n,tok);
9807 }
9808 }
9809 i=(an+en)/2;
9810 if (*n < *(sArithBase.sCmds[i].name))
9811 {
9812 en=i-1;
9813 }
9814 else if (*n > *(sArithBase.sCmds[i].name))
9815 {
9816 an=i+1;
9817 }
9818 else
9819 {
9820 int v=strcmp(n,sArithBase.sCmds[i].name);
9821 if(v<0)
9822 {
9823 en=i-1;
9824 }
9825 else if(v>0)
9826 {
9827 an=i+1;
9828 }
9829 else /*v==0*/
9830 {
9831 break;
9832 }
9833 }
9834 }
9836 tok=sArithBase.sCmds[i].tokval;
9837 if(sArithBase.sCmds[i].alias==2)
9838 {
9839 Warn("outdated identifier `%s` used - please change your code",
9840 sArithBase.sCmds[i].name);
9841 sArithBase.sCmds[i].alias=1;
9842 }
9843 #if 0
9844 if (currRingHdl==NULL)
9845 {
9846 #ifdef SIQ
9847 if (siq<=0)
9848 {
9849 #endif
9850 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9851 {
9852 WerrorS("no ring active");
9853 return 0;
9854 }
9855 #ifdef SIQ
9856 }
9857 #endif
9858 }
9859 #endif
9860 if (!expected_parms)
9861 {
9862 switch (tok)
9863 {
9864 case IDEAL_CMD:
9865 case INT_CMD:
9866 case INTVEC_CMD:
9867 case MAP_CMD:
9868 case MATRIX_CMD:
9869 case MODUL_CMD:
9870 case POLY_CMD:
9871 case PROC_CMD:
9872 case RING_CMD:
9873 case STRING_CMD:
9874 cmdtok = tok;
9875 break;
9876 }
9877 }
9878 return sArithBase.sCmds[i].toktype;
9879}
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:219
@ END_RING
Definition grammar.cc:311
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ MAP_CMD
Definition grammar.cc:286
@ PROC_CMD
Definition grammar.cc:281
@ BEGIN_RING
Definition grammar.cc:283
@ MODUL_CMD
Definition grammar.cc:288
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
EXTERN_VAR BOOLEAN expected_parms
Definition iparith.cc:218
EXTERN_VAR int cmdtok
Definition iparith.cc:217
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:187
@ 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:713
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)
#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 long s=(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:4756
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:1191

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv res,
leftv v )
static

Definition at line 3879 of file iparith.cc.

3880{
3881 //matrix m=(matrix)v->Data();
3882 //lists l=mpBareiss(m,FALSE);
3883 intvec *iv;
3884 ideal m;
3885 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3887 l->Init(2);
3888 l->m[0].rtyp=MODUL_CMD;
3889 l->m[1].rtyp=INTVEC_CMD;
3890 l->m[0].data=(void *)m;
3891 l->m[1].data=(void *)iv;
3892 res->data = (char *)l;
3893 return FALSE;
3894}
int m
Definition cfEzgcd.cc:128
Definition lists.h:24
VAR omBin slists_bin
Definition lists.cc:23
slists * lists
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 6091 of file iparith.cc.

6092{
6093 intvec *iv;
6094 ideal m;
6096 int k=(int)(long)w->Data();
6097 if (k>=0)
6098 {
6099 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6100 l->Init(2);
6101 l->m[0].rtyp=MODUL_CMD;
6102 l->m[1].rtyp=INTVEC_CMD;
6103 l->m[0].data=(void *)m;
6104 l->m[1].data=(void *)iv;
6105 }
6106 else
6107 {
6109 l->Init(1);
6110 l->m[0].rtyp=IDEAL_CMD;
6111 l->m[0].data=(void *)m;
6112 }
6113 res->data = (char *)l;
6114 return FALSE;
6115}
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 3902 of file iparith.cc.

3903{
3904 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3905 b->hnf();
3906 res->data=(char*)b;
3907 return FALSE;
3908}
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 3924 of file iparith.cc.

3925{
3926 bigintmat *b=(bigintmat*)u->Data();
3927 res->data=(void *)bim2iv(b);
3928 return FALSE;
3929}
intvec * bim2iv(bigintmat *b)
Definition bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv res,
leftv u )
static

Definition at line 3909 of file iparith.cc.

3910{
3912 number n=(number)u->CopyD();
3914 if (nMap!=NULL)
3915 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3916 else
3917 {
3918 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3919 bo=TRUE;
3920 }
3922 return bo;
3923}
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:704
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition coeffs.h:967
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv res,
leftv u )
static

Definition at line 3930 of file iparith.cc.

3931{
3932 sleftv tmp;
3933 BOOLEAN bo=jjBI2N(&tmp,u);
3934 if (!bo)
3935 {
3936 number n=(number) tmp.data;
3937 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3938 else
3939 {
3940 res->data=(void *)pNSet(n);
3941 }
3942 }
3943 return bo;
3944}
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition iparith.cc:3909
#define nDelete(n)
Definition numbers.h:16
#define nIsZero(n)
Definition numbers.h:19
#define pNSet(n)
Definition polys.h:313

◆ jjBIGINTVEC_PL()

static BOOLEAN jjBIGINTVEC_PL ( leftv res,
leftv v )
static

Definition at line 7939 of file iparith.cc.

7940{
7941 leftv h=v;
7942 int l=0;
7943 while (h!=NULL)
7944 {
7945 if(h->Typ()==INT_CMD) l++;
7946 else if (h->Typ()==BIGINT_CMD) l++;
7947 else if (h->Typ()==INTVEC_CMD)
7948 {
7949 intvec *ivv=(intvec*)h->Data();
7950 l+=ivv->rows();
7951 }
7952 else if (h->Typ()==BIGINTVEC_CMD)
7953 {
7954 bigintmat *ivv=(bigintmat *)h->Data();
7955 l+=ivv->rows();
7956 }
7957 else return TRUE;
7958 h=h->next;
7959 }
7960 bigintmat *bim=new bigintmat(1,l,coeffs_BIGINT);
7961 h=v;
7962 int i=0;
7963 while (h!=NULL)
7964 {
7965 if(h->Typ()==INT_CMD)
7966 {
7967 number tp = n_Init((long)(h->Data()), coeffs_BIGINT);
7968 bim->set(i++, tp);
7970 }
7971 else if (h->Typ()==INTVEC_CMD)
7972 {
7973 intvec *ivv=(intvec*)h->Data();
7974 for(int j=0;j<ivv->length();j++)
7975 {
7976 number tp = n_Init((long)(*ivv)[j], coeffs_BIGINT);
7977 bim->set(i++, tp);
7979 }
7980 }
7981 else if(h->Typ()==BIGINT_CMD)
7982 {
7983 number tp = (number)h->Data();
7984 bim->set(i++, tp);
7985 }
7986 else if(h->Typ()==BIGINTVEC_CMD)
7987 {
7988 bigintmat *b=(bigintmat*)h->Data();
7989 for(int j=0;j<b->cols();j++)
7990 {
7991 number tp=BIMATELEM((*b),1,j);
7992 bim->set(i++, tp);
7993 }
7994 }
7995 h=h->next;
7996 }
7997 res->data=(char *)bim;
7998 return FALSE;
7999}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int length() const
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition bigintmat.cc:95
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:542
int j
Definition facHensel.cc:110
@ BIGINTVEC_CMD
Definition grammar.cc:279
STATIC_VAR Poly * h
Definition janet.cc:971
@ BIGINT_CMD
Definition tok.h:38

◆ jjBIV2IV()

static BOOLEAN jjBIV2IV ( leftv res,
leftv v )
static

Definition at line 4487 of file iparith.cc.

4488{
4489 bigintmat* aa= (bigintmat *)v->Data();
4490 int l=aa->cols();
4491 intvec *iv=new intvec(l);
4492 for(int i=0;i<l;i++) (*iv)[i]=iin_Int(BIMATELEM((*aa),1,i+1),coeffs_BIGINT);
4493 res->data = (void*)iv;
4494 return FALSE;
4495}
static int iin_Int(number &n, coeffs cf)
Definition iparith.cc:225

◆ jjBRACK_Bim()

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

Definition at line 5836 of file iparith.cc.

5837{
5838 bigintmat *bim = (bigintmat *)u->Data();
5839 int r = (int)(long)v->Data();
5840 int c = (int)(long)w->Data();
5841 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5842 {
5843 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5844 r,c,u->Fullname(),bim->rows(),bim->cols());
5845 return TRUE;
5846 }
5847 res->data=u->data; u->data=NULL;
5848 res->rtyp=u->rtyp; u->rtyp=0;
5849 res->name=u->name; u->name=NULL;
5850 Subexpr e=jjMakeSub(v);
5851 e->next=jjMakeSub(w);
5852 if (u->e==NULL)
5853 res->e=e;
5854 else
5855 {
5856 Subexpr h=u->e;
5857 while (h->next!=NULL) h=h->next;
5858 h->next=e;
5859 res->e=u->e;
5860 u->e=NULL;
5861 }
5862 return FALSE;
5863}
int cols() const
Definition bigintmat.h:144
int rows() const
Definition bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition iparith.cc:8976

◆ jjBRACK_Im()

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

Definition at line 5809 of file iparith.cc.

5810{
5811 intvec *iv = (intvec *)u->Data();
5812 int r = (int)(long)v->Data();
5813 int c = (int)(long)w->Data();
5814 if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5815 {
5816 Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5817 r,c,u->Fullname(),iv->rows(),iv->cols());
5818 return TRUE;
5819 }
5820 res->data=u->data; u->data=NULL;
5821 res->rtyp=u->rtyp; u->rtyp=0;
5822 res->name=u->name; u->name=NULL;
5823 Subexpr e=jjMakeSub(v);
5824 e->next=jjMakeSub(w);
5825 if (u->e==NULL) res->e=e;
5826 else
5827 {
5828 Subexpr h=u->e;
5829 while (h->next!=NULL) h=h->next;
5830 h->next=e;
5831 res->e=u->e;
5832 u->e=NULL;
5833 }
5834 return FALSE;
5835}
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 5864 of file iparith.cc.

5865{
5866 matrix m= (matrix)u->Data();
5867 int r = (int)(long)v->Data();
5868 int c = (int)(long)w->Data();
5869 //Print("gen. elem %d, %d\n",r,c);
5870 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5871 {
5872 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5873 MATROWS(m),MATCOLS(m));
5874 return TRUE;
5875 }
5876 res->data=u->data; u->data=NULL;
5877 res->rtyp=u->rtyp; u->rtyp=0;
5878 res->name=u->name; u->name=NULL;
5879 Subexpr e=jjMakeSub(v);
5880 e->next=jjMakeSub(w);
5881 if (u->e==NULL)
5882 res->e=e;
5883 else
5884 {
5885 Subexpr h=u->e;
5886 while (h->next!=NULL) h=h->next;
5887 h->next=e;
5888 res->e=u->e;
5889 u->e=NULL;
5890 }
5891 return FALSE;
5892}
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 5922 of file iparith.cc.

5923{
5924 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5925 {
5926 WerrorS("cannot build expression lists from unnamed objects");
5927 return TRUE;
5928 }
5929
5930 leftv p=NULL;
5931 intvec *iv=(intvec *)w->Data();
5932 int l;
5933 BOOLEAN nok;
5934 sleftv ut;
5935 memcpy(&ut,u,sizeof(ut));
5936 sleftv t;
5937 t.Init();
5938 t.rtyp=INT_CMD;
5939 for (l=0;l< iv->length(); l++)
5940 {
5941 t.data=(char *)(long)((*iv)[l]);
5942 if (p==NULL)
5943 {
5944 p=res;
5945 }
5946 else
5947 {
5948 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5949 p=p->next;
5950 }
5951 memcpy(u,&ut,sizeof(ut));
5952 if (u->Typ() == MATRIX_CMD)
5953 nok=jjBRACK_Ma(p,u,v,&t);
5954 else if (u->Typ() == BIGINTMAT_CMD)
5955 nok=jjBRACK_Bim(p,u,v,&t);
5956 else /* INTMAT_CMD */
5957 nok=jjBRACK_Im(p,u,v,&t);
5958 if (nok)
5959 {
5960 while (res->next!=NULL)
5961 {
5962 p=res->next->next;
5964 // res->e aufraeumen !!!!
5965 res->next=p;
5966 }
5967 return TRUE;
5968 }
5969 }
5970 return FALSE;
5971}
int length() const
Definition intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5836
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5809
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5864
#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 5972 of file iparith.cc.

5973{
5974 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5975 {
5976 WerrorS("cannot build expression lists from unnamed objects");
5977 return TRUE;
5978 }
5979 leftv p=NULL;
5980 intvec *iv=(intvec *)v->Data();
5981 int l;
5982 BOOLEAN nok;
5983 sleftv ut;
5984 memcpy(&ut,u,sizeof(ut));
5985 sleftv t;
5986 t.Init();
5987 t.rtyp=INT_CMD;
5988 for (l=0;l< iv->length(); l++)
5989 {
5990 t.data=(char *)(long)((*iv)[l]);
5991 if (p==NULL)
5992 {
5993 p=res;
5994 }
5995 else
5996 {
5997 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5998 p=p->next;
5999 }
6000 memcpy(u,&ut,sizeof(ut));
6001 if (u->Typ() == MATRIX_CMD)
6002 nok=jjBRACK_Ma(p,u,&t,w);
6003 else if (u->Typ() == BIGINTMAT_CMD)
6004 nok=jjBRACK_Bim(p,u,&t,w);
6005 else /* INTMAT_CMD */
6006 nok=jjBRACK_Im(p,u,&t,w);
6007 if (nok)
6008 {
6009 while (res->next!=NULL)
6010 {
6011 p=res->next->next;
6013 // res->e aufraeumen !!
6014 res->next=p;
6015 }
6016 return TRUE;
6017 }
6018 }
6019 return FALSE;
6020}

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 6021 of file iparith.cc.

6022{
6023 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
6024 {
6025 WerrorS("cannot build expression lists from unnamed objects");
6026 return TRUE;
6027 }
6028 leftv p=NULL;
6029 intvec *vv=(intvec *)v->Data();
6030 intvec *wv=(intvec *)w->Data();
6031 int vl;
6032 int wl;
6033 BOOLEAN nok;
6034
6035 sleftv t1,t2,ut;
6036 memcpy(&ut,u,sizeof(ut));
6037 t1.Init();
6038 t1.rtyp=INT_CMD;
6039 t2.Init();
6040 t2.rtyp=INT_CMD;
6041 for (vl=0;vl< vv->length(); vl++)
6042 {
6043 t1.data=(char *)(long)((*vv)[vl]);
6044 for (wl=0;wl< wv->length(); wl++)
6045 {
6046 t2.data=(char *)(long)((*wv)[wl]);
6047 if (p==NULL)
6048 {
6049 p=res;
6050 }
6051 else
6052 {
6053 p->next=(leftv)omAlloc0Bin(sleftv_bin);
6054 p=p->next;
6055 }
6056 memcpy(u,&ut,sizeof(ut));
6057 if (u->Typ() == MATRIX_CMD)
6058 nok=jjBRACK_Ma(p,u,&t1,&t2);
6059 else if (u->Typ() == BIGINTMAT_CMD)
6060 nok=jjBRACK_Bim(p,u,&t1,&t2);
6061 else /* INTMAT_CMD */
6062 nok=jjBRACK_Im(p,u,&t1,&t2);
6063 if (nok)
6064 {
6065 res->CleanUp();
6066 return TRUE;
6067 }
6068 }
6069 }
6070 return FALSE;
6071}

◆ jjBRACK_S()

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

Definition at line 5793 of file iparith.cc.

5794{
5795 char *s= (char *)u->Data();
5796 int r = (int)(long)v->Data();
5797 int c = (int)(long)w->Data();
5798 int l = strlen(s);
5799
5800 if ( (r<1) || (r>l) || (c<0) )
5801 {
5802 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5803 return TRUE;
5804 }
5805 res->data = (char *)omAlloc((long)(c+1));
5806 snprintf((char *)res->data,c+1,"%-*.*s",c,c,s+r-1);
5807 return FALSE;
5808}
#define omAlloc(size)

◆ jjBRACK_SM()

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

Definition at line 5893 of file iparith.cc.

5894{
5895 ideal m= (ideal)u->Data();
5896 int r = (int)(long)v->Data();
5897 int c = (int)(long)w->Data();
5898 //Print("gen. elem %d, %d\n",r,c);
5899 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5900 {
5901 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5902 (int)m->rank,IDELEMS(m));
5903 return TRUE;
5904 }
5905 res->data=u->data; u->data=NULL;
5906 res->rtyp=u->rtyp; u->rtyp=0;
5907 res->name=u->name; u->name=NULL;
5908 Subexpr e=jjMakeSub(v);
5909 e->next=jjMakeSub(w);
5910 if (u->e==NULL)
5911 res->e=e;
5912 else
5913 {
5914 Subexpr h=u->e;
5915 while (h->next!=NULL) h=h->next;
5916 h->next=e;
5917 res->e=u->e;
5918 u->e=NULL;
5919 }
5920 return FALSE;
5921}

◆ jjBRACKET()

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

Definition at line 2922 of file iparith.cc.

2923{
2924 res->data=NULL;
2925
2927 {
2928 const poly q = (poly)b->Data();
2929
2930 if( q != NULL )
2931 {
2932 if( (poly)a->Data() != NULL )
2933 {
2935 {
2936 poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2937 res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2938 }
2939 else if (rIsLPRing(currRing))
2940 {
2941 const poly p = (poly)a->Data();
2942 res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2943 }
2944 }
2945 }
2946 }
2947 return FALSE;
2948}
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
#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 2949 of file iparith.cc.

2950{
2951 res->data=NULL;
2952
2954 {
2955 const poly q = (poly)b->Data();
2956 if(q != NULL)
2957 {
2958 if((poly)a->Data() != NULL)
2959 {
2960 const poly p = (poly)a->Data();
2961 int k=(int)(long)c->Data();
2962 if (k > 0)
2963 {
2964 poly qq = pCopy(q);
2965 for (int i = 0; i < k; i++)
2966 {
2967 poly qq_ref = qq;
2968 if (rIsLPRing(currRing))
2969 {
2971 }
2972 else if (rIsPluralRing(currRing))
2973 {
2975 }
2976 pDelete(&qq_ref);
2977 if (qq == NULL) break;
2978 }
2979 res->data = qq;
2980 }
2981 else
2982 {
2983 Werror("invalid number of iterations");
2984 }
2985 }
2986 }
2987 }
2988 return FALSE;
2989}
#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 7337 of file iparith.cc.

7338{
7339#ifdef HAVE_SDB
7340 sdb_show_bp();
7341#endif
7342 return FALSE;
7343}
void sdb_show_bp()
Definition sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv ,
leftv v )
static

Definition at line 7344 of file iparith.cc.

7345{
7346#ifdef HAVE_SDB
7347 if(v->Typ()==PROC_CMD)
7348 {
7349 int lineno=0;
7350 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7351 {
7352 lineno=(int)(long)v->next->Data();
7353 }
7354 return sdb_set_breakpoint(v->Name(),lineno);
7355 }
7356 return TRUE;
7357#else
7358 return FALSE;
7359#endif
7360}
Variable next() const
Definition factory.h:146
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 7361 of file iparith.cc.

7362{
7363 return iiExprArith1(res,v,iiOp);
7364}

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv res,
leftv u )
static

Definition at line 3945 of file iparith.cc.

3946{
3947 return iiExprArithM(res,u,iiOp);
3948}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9672

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv res,
leftv u )
static

Definition at line 7365 of file iparith.cc.

7366{
7367 leftv v=u->next;
7368 u->next=NULL;
7369 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7370 u->next=v;
7371 return b;
7372}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition iparith.cc:9182

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv res,
leftv u )
static

Definition at line 7373 of file iparith.cc.

7374{
7375 leftv v = u->next;
7376 leftv w = v->next;
7377 u->next = NULL;
7378 v->next = NULL;
7379 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7380 u->next = v;
7381 v->next = w;
7382 return b;
7383}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9581

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv res,
leftv v )
static

Definition at line 3949 of file iparith.cc.

3950{
3951 res->data = (char *)(long)rChar((ring)v->Data());
3952 return FALSE;
3953}
int rChar(ring r)
Definition ring.cc:715

◆ 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);
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:4090
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition coeffs.h:768
#define omFree(addr)

◆ jjCHINREM_ID()

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

Definition at line 10232 of file iparith.cc.

10233{
10234 if ((currRing!=NULL)
10236 && (!rField_is_Z(currRing)))
10237 {
10238 WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
10239 return TRUE;
10240 }
10241 coeffs cf;
10242 lists c=(lists)u->CopyD(); // list of ideal or bigint/int
10243 int rl=c->nr+1;
10244 int return_type=c->m[0].Typ();
10245 if ((return_type!=IDEAL_CMD)
10249 && (return_type!=POLY_CMD))
10250 {
10252 ||(return_type==INT_CMD))
10254 else if (return_type==LIST_CMD)
10255 {
10256 // create a tmp list of the correct size
10258 res_l->Init(rl /*c->nr+1*/);
10261 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10262 {
10263 sleftv tmp;
10264 tmp.Copy(v);
10266 if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
10267 }
10268 c->Clean();
10269 res->data=res_l;
10270 res->rtyp=LIST_CMD;
10271 return bo;
10272 }
10273 else
10274 {
10275 c->Clean();
10276 WerrorS("poly/ideal/module/matrix/list expected");
10277 return TRUE;
10278 }
10279 }
10282 else
10283 {
10284 cf=currRing->cf;
10285 if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
10286 cf=cf->extRing->cf;
10287 }
10288 lists pl=NULL;
10289 intvec *p=NULL;
10290 if (v->Typ()==LIST_CMD)
10291 {
10292 pl=(lists)v->Data();
10293 if (pl->nr!=rl-1)
10294 {
10295 WerrorS("wromg number of primes");
10296 return TRUE;
10297 }
10298 }
10299 else
10300 {
10301 p=(intvec*)v->Data();
10302 if (p->length()!=rl)
10303 {
10304 WerrorS("wromg number of primes");
10305 return TRUE;
10306 }
10307 }
10308 ideal result;
10309 ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
10310 number *xx=NULL;
10312 int i;
10314 {
10315 for(i=rl-1;i>=0;i--)
10316 {
10317 if (c->m[i].Typ()!=return_type)
10318 {
10319 Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
10320 omFree(x); // delete c
10321 return TRUE;
10322 }
10323 if (return_type==POLY_CMD)
10324 {
10325 x[i]=idInit(1,1);
10326 x[i]->m[0]=(poly)c->m[i].CopyD();
10327 }
10328 else
10329 {
10330 x[i]=(ideal)c->m[i].CopyD();
10331 }
10332 //c->m[i].Init();
10333 }
10334 }
10335 else
10336 {
10337 if (nMap==NULL)
10338 {
10339 Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10340 return TRUE;
10341 }
10342 xx=(number *)omAlloc(rl*sizeof(number));
10343 for(i=rl-1;i>=0;i--)
10344 {
10345 if (c->m[i].Typ()==INT_CMD)
10346 {
10347 xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10348 }
10349 else if (c->m[i].Typ()==BIGINT_CMD)
10350 {
10351 xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10352 }
10353 else
10354 {
10355 Werror("bigint expected at pos %d",i+1);
10356 omFree(x); // delete c
10357 omFree(xx); // delete c
10358 return TRUE;
10359 }
10360 }
10361 }
10362 number *q=(number *)omAlloc(rl*sizeof(number));
10363 if (p!=NULL)
10364 {
10365 for(i=rl-1;i>=0;i--)
10366 {
10367 q[i]=n_Init((*p)[i], cf);
10368 }
10369 }
10370 else
10371 {
10372 for(i=rl-1;i>=0;i--)
10373 {
10374 if (pl->m[i].Typ()==INT_CMD)
10375 {
10376 q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10377 }
10378 else if (pl->m[i].Typ()==BIGINT_CMD)
10379 {
10380 q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10381 }
10382 else
10383 {
10384 Werror("bigint expected at pos %d",i+1);
10385 for(i++;i<rl;i++)
10386 {
10387 n_Delete(&(q[i]),cf);
10388 }
10389 omFree(x); // delete c
10390 omFree(q); // delete pl
10391 if (xx!=NULL) omFree(xx); // delete c
10392 return TRUE;
10393 }
10394 }
10395 }
10397 {
10398 CFArray i_v(rl);
10400 res->data=(char *)n;
10401 }
10402 else
10403 {
10404 #if 0
10405 #ifdef HAVE_VSPACE
10407 if ((cpus>1) && (rField_is_Q(currRing)))
10408 result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10409 else
10410 #endif
10411 #endif
10412 result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10413 c->Clean();
10414 if ((return_type==POLY_CMD) &&(result!=NULL))
10415 {
10416 res->data=(char *)result->m[0];
10417 result->m[0]=NULL;
10418 idDelete(&result);
10419 }
10420 else
10421 res->data=(char *)result;
10422 }
10423 for(i=rl-1;i>=0;i--)
10424 {
10425 n_Delete(&(q[i]),cf);
10426 }
10427 omFree(q);
10428 res->rtyp=return_type;
10429 return result==NULL;
10430}
sleftv * m
Definition lists.h:46
void Clean(ring r=currRing)
Definition lists.h:26
int nr
Definition lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:850
return result
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
@ SMATRIX_CMD
Definition grammar.cc:292
#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:514
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:511
ideal idInit(int idsize, int rank)
initialise an ideal / module
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
@ 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:392
#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:469

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv ,
leftv v )
static

Definition at line 7385 of file iparith.cc.

7386{
7387 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7388 if (iiCheckTypes(v,t,1))
7389 {
7390 idhdl c=(idhdl)v->next->next->data;
7391 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7392 idhdl m=(idhdl)v->next->next->next->data;
7393 idDelete((ideal *)&(c->data.uideal));
7394 idDelete((ideal *)&(m->data.uideal));
7395 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7396 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7397 return FALSE;
7398 }
7399 return TRUE;
7400}
Definition idrec.h:35
@ VECTOR_CMD
Definition grammar.cc:293
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:6575
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:574
idrec * idhdl
Definition ring.h:21

◆ jjCOEFFS1()

static BOOLEAN jjCOEFFS1 ( leftv res,
leftv v )
static

Definition at line 3954 of file iparith.cc.

3955{
3956 ring r=(ring)v->Data();
3957 r->cf->ref++;
3958 res->data = (char *)r->cf;
3959 return FALSE;
3960}

◆ 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:2629
#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 6116 of file iparith.cc.

6117{
6118 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6119 {
6120 WerrorS("3rd argument must be a name of a matrix");
6121 return TRUE;
6122 }
6123 ideal i=(ideal)u->Data();
6124 int rank=(int)i->rank;
6125 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6126 if (r) return TRUE;
6127 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6128 return FALSE;
6129}
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:355
#define pVar(m)
Definition polys.h:380

◆ jjCOEFFS3_KB()

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

Definition at line 6130 of file iparith.cc.

6131{
6132 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6133 (ideal)(v->Data()),(poly)(w->Data()));
6134 return FALSE;
6135}

◆ jjCOEFFS3_P()

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

Definition at line 6136 of file iparith.cc.

6137{
6138 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6139 {
6140 WerrorS("3rd argument must be a name of a matrix");
6141 return TRUE;
6142 }
6143 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6144 poly p=(poly)u->CopyD(POLY_CMD);
6145 ideal i=idInit(1,1);
6146 i->m[0]=p;
6147 sleftv t;
6148 t.Init();
6149 t.data=(char *)i;
6150 t.rtyp=IDEAL_CMD;
6151 int rank=1;
6152 if (u->Typ()==VECTOR_CMD)
6153 {
6154 i->rank=rank=pMaxComp(p);
6155 t.rtyp=MODUL_CMD;
6156 }
6157 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6158 t.CleanUp();
6159 if (r) return TRUE;
6160 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6161 return FALSE;
6162}
#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:306

◆ 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
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3722
#define IDPACKAGE(a)
Definition ipid.h:139
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition iplib.cc:831
void syMake(leftv v, const char *id, package pa)
Definition subexpr.cc:1612
@ LANG_TOP
Definition subexpr.h:22
@ PACKAGE_CMD
Definition tok.h:150
@ DEF_CMD
Definition tok.h:58

◆ jjCOLON()

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

Definition at line 323 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv res,
leftv v )
static

Definition at line 3961 of file iparith.cc.

3962{
3963 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3964 return FALSE;
3965}

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv res,
leftv v )
static

Definition at line 3966 of file iparith.cc.

3967{
3968 res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3969 return FALSE;
3970}

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv res,
leftv v )
static

Definition at line 3971 of file iparith.cc.

3972{
3973 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3974 return FALSE;
3975}

◆ jjCOMPARE_ALL()

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

Definition at line 10450 of file iparith.cc.

10451{
10452 leftv a=(leftv)aa;
10453 int at=a->Typ();
10454 leftv b=(leftv)bb;
10455 int bt=b->Typ();
10456 if (at < bt) return -1;
10457 if (at > bt) return 1;
10459 sleftv tmp;
10460 tmp.Init();
10461 iiOp='<';
10463 if (bo)
10464 {
10465 Werror(" no `<` for %s",Tok2Cmdname(at));
10466 unsigned long ad=(unsigned long)a->Data();
10467 unsigned long bd=(unsigned long)b->Data();
10468 if (ad<bd) return -1;
10469 else if (ad==bd) return 0;
10470 else return 1;
10471 }
10472 else if (tmp.data==NULL) /* not < */
10473 {
10477 if (bo)
10478 {
10479 Werror(" no `==` for %s",Tok2Cmdname(at));
10480 unsigned long ad=(unsigned long)a->Data();
10481 unsigned long bd=(unsigned long)b->Data();
10482 if (ad<bd) return -1;
10483 else if (ad==bd) return 0;
10484 else return 1;
10485 }
10486 else if (tmp.data==NULL) /* not <,== */ return 1;
10487 else return 0;
10488 }
10489 else return -1;
10490}
@ EQUAL_EQUAL
Definition grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 370 of file iparith.cc.

371{
372 bigintmat* a = (bigintmat * )(u->Data());
373 bigintmat* b = (bigintmat * )(v->Data());
374 int r=a->compare(b);
375 switch (iiOp)
376 {
377 #if 0
378 case '<':
379 res->data = (char *) (r<0);
380 break;
381 case '>':
382 res->data = (char *) (r>0);
383 break;
384 case LE:
385 res->data = (char *) (r<=0);
386 break;
387 case GE:
388 res->data = (char *) (r>=0);
389 break;
390 #endif
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 342 of file iparith.cc.

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

◆ 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:4946

◆ 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 3976 of file iparith.cc.

3977{
3978 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3979 poly p=(poly)v->CopyD(POLY_CMD);
3980 if (p!=NULL) p_Cleardenom(p, currRing);
3981 res->data = (char *)p;
3982 return FALSE;
3983}
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2851

◆ 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:2159

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv res,
leftv v )
static

Definition at line 3984 of file iparith.cc.

3985{
3986 res->data = (char *)(long)n_Size((number)v->Data(),coeffs_BIGINT);
3987 return FALSE;
3988}
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:574

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv res,
leftv v )
static

Definition at line 3989 of file iparith.cc.

3990{
3991 bigintmat* aa= (bigintmat *)v->Data();
3992 res->data = (char *)(long)(aa->rows()*aa->cols());
3993 return FALSE;
3994}

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv res,
leftv v )
static

Definition at line 4012 of file iparith.cc.

4013{
4014 res->data = (char *)(long)((intvec*)(v->Data()))->length();
4015 return FALSE;
4016}

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv res,
leftv v )
static

Definition at line 4000 of file iparith.cc.

4001{
4002 lists l=(lists)v->Data();
4003 res->data = (char *)(long)(lSize(l)+1);
4004 return FALSE;
4005}
int lSize(lists L)
Definition lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv res,
leftv v )
static

Definition at line 4006 of file iparith.cc.

4007{
4008 matrix m=(matrix)v->Data();
4009 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
4010 return FALSE;
4011}

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv res,
leftv v )
static

Definition at line 3995 of file iparith.cc.

3996{
3997 res->data = (char *)(long)nSize((number)v->Data());
3998 return FALSE;
3999}

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv res,
leftv v )
static

Definition at line 5762 of file iparith.cc.

5763{
5764 res->data=(char *)(long)sySize((syStrategy)v->Data());
5765 return FALSE;
5766}
int sySize(syStrategy syzstr)
Definition syz1.cc:1830

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv res,
leftv v )
static

Definition at line 4017 of file iparith.cc.

4018{
4019 ring r=(ring)v->Data();
4020 int elems=-1;
4021 if (rField_is_Zp(r)) elems=r->cf->ch;
4022 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
4023 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
4024 {
4025 extern int ipower ( int b, int n ); /* factory/cf_util */
4026 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
4027 }
4028 res->data = (char *)(long)elems;
4029 return FALSE;
4030}
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:534
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:505
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:526

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv res,
leftv v )
static

Definition at line 4069 of file iparith.cc.

4070{
4071 if ((v->rtyp==IDHDL)
4072 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
4073 {
4074 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
4075 }
4076 else if (v->rtyp!=0) res->data=(void *)(-1);
4077 return FALSE;
4078}
#define IDLEV(a)
Definition ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv res,
leftv v )
static

Definition at line 4031 of file iparith.cc.

4032{
4033 int dummy;
4034 poly p=(poly)v->Data();
4035 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
4036 else res->data=(char *)-1;
4037 return FALSE;
4038}

◆ 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)
long p_DegW(poly p, const int *w, const ring R)
Definition p_polys.cc:693
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:597
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 4039 of file iparith.cc.

4040{
4041 ideal I=(ideal)u->Data();
4042 int d=-1;
4043 int dummy;
4044 int i;
4045 for(i=IDELEMS(I)-1;i>=0;i--)
4046 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
4047 res->data = (char *)(long)d;
4048 return FALSE;
4049}
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 4050 of file iparith.cc.

4051{
4052 SPrintStart();
4053#ifdef HAVE_RINGS
4054 if (rField_is_Z(currRing))
4055 {
4056 PrintS("// NOTE: computation of degree is being performed for\n");
4057 PrintS("// generic fibre, that is, over Q\n");
4058 }
4059#endif
4061 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4062 scDegree((ideal)v->Data(),module_w,currRing->qideal);
4063 char *s=SPrintEnd();
4064 int l=strlen(s)-1;
4065 s[l]='\0';
4066 res->data=(void*)s;
4067 return FALSE;
4068}
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:926
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:1586

◆ 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_ID_IV()

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

Definition at line 1878 of file iparith.cc.

1879{
1880 intvec *iv=(intvec*)v->Data();
1881 ideal I=(ideal)u->Data();
1882 ideal tmp1=NULL;
1883 ideal tmp2;
1884 for(int i=iv->length()-1;i>=0;i--)
1885 {
1886 int pos= (*iv)[i];
1888 if (tmp1==NULL) /* first entry */
1889 { tmp1=I; }
1890 else
1891 { id_Delete(&I,currRing); }
1892 I=tmp2;
1893 if (I==NULL) break;
1894 }
1895 res->data=(void*)I;
1896 return res->data==NULL;
1897}
CFList tmp1
Definition facFqBivar.cc:75
CFList tmp2
Definition facFqBivar.cc:75

◆ 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:842

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv res,
leftv v )
static

Return the denominator of the input number.

Definition at line 4081 of file iparith.cc.

4082{
4083 number n = reinterpret_cast<number>(v->CopyD());
4084 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
4085 n_Delete(&n,currRing->cf);
4086 return FALSE;
4087}
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:607

◆ jjDET()

static BOOLEAN jjDET ( leftv res,
leftv v )
static

Definition at line 4098 of file iparith.cc.

4099{
4100 matrix m=(matrix)v->Data();
4101 res ->data = mp_Det(m,currRing);
4102 return FALSE;
4103}
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition matpol.cc:2136

◆ jjDET2()

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

Definition at line 1898 of file iparith.cc.

1899{
1900 matrix m=(matrix)u->Data();
1901 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1902 res ->data = mp_Det(m,currRing,d);
1903 return FALSE;
1904}
DetVariant mp_GetAlgorithmDet(matrix m, const ring r)
Definition matpol.cc:2105
DetVariant
Definition matpol.h:35

◆ jjDET2_S()

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

Definition at line 1905 of file iparith.cc.

1906{
1907 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1908 ideal m=(ideal)u->Data();
1909 res ->data = sm_Det(m,currRing,d);
1910 return FALSE;
1911}
poly sm_Det(ideal a, const ring r, DetVariant d)
Definition matpol.cc:2160

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv res,
leftv v )
static

Definition at line 4104 of file iparith.cc.

4105{
4106 bigintmat * m=(bigintmat*)v->Data();
4107 int i,j;
4108 i=m->rows();j=m->cols();
4109 if(i==j)
4110 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4111 else
4112 {
4113 Werror("det of %d x %d bigintmat",i,j);
4114 return TRUE;
4115 }
4116 return FALSE;
4117}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition clapsing.cc:1798

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv res,
leftv v )
static

Definition at line 4140 of file iparith.cc.

4141{
4142 intvec * m=(intvec*)v->Data();
4143 int i,j;
4144 i=m->rows();j=m->cols();
4145 if(i==j)
4146 res->data = (char *)(long)singclap_det_i(m,currRing);
4147 else
4148 {
4149 Werror("det of %d x %d intmat",i,j);
4150 return TRUE;
4151 }
4152 return FALSE;
4153}
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 4154 of file iparith.cc.

4155{
4156 ideal I=(ideal)v->Data();
4157 res->data=(char*)sm_Det(I,currRing);
4158 return FALSE;
4159}

◆ jjDIFF_COEF()

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

Definition at line 4524 of file iparith.cc.

4525{
4526 if (!nCoeff_is_transExt(currRing->cf))
4527 {
4528 WerrorS("differentiation not defined in the coefficient ring");
4529 return TRUE;
4530 }
4531 number n = (number) u->Data();
4532 number k = (number) v->Data();
4533 res->data = ntDiff(n,k,currRing->cf);
4534 return FALSE;
4535}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:922
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 1923 of file iparith.cc.

1924{
1925 int i=pVar((poly)v->Data());
1926 if (i==0)
1927 {
1928 WerrorS("ringvar expected");
1929 return TRUE;
1930 }
1931 res->data=(char *)idDiff((matrix)(u->Data()),i);
1932 return FALSE;
1933}
matrix idDiff(matrix i, int k)
Definition ideals.cc:2146

◆ jjDIFF_ID_ID()

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

Definition at line 1934 of file iparith.cc.

1935{
1936 res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data());
1937 return FALSE;
1938}

◆ jjDIFF_P()

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

Definition at line 1912 of file iparith.cc.

1913{
1914 int i=pVar((poly)v->Data());
1915 if (i==0)
1916 {
1917 WerrorS("ringvar expected");
1918 return TRUE;
1919 }
1920 res->data=(char *)pDiff((poly)(u->Data()),i);
1921 return FALSE;
1922}
#define pDiff(a, b)
Definition polys.h:296

◆ jjDIM()

static BOOLEAN jjDIM ( leftv res,
leftv v )
static

Definition at line 4160 of file iparith.cc.

4161{
4163#ifdef HAVE_SHIFTBBA
4164 if (rIsLPRing(currRing))
4165 {
4166#ifdef HAVE_RINGS
4168 {
4169 WerrorS("`dim` is not implemented for letterplace rings over rings");
4170 return TRUE;
4171 }
4172#endif
4173 if (currRing->qideal != NULL)
4174 {
4175 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4176 return TRUE;
4177 }
4178 int gkDim = lp_gkDim((ideal)(v->Data()));
4179 res->data = (char *)(long)gkDim;
4180 return (gkDim == -2);
4181 }
4182#endif
4184 {
4185 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4186 }
4187 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4188 return FALSE;
4189}
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition hdegree.cc:136
int lp_gkDim(const ideal _G)
Definition hdegree.cc:1861
BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:768

◆ jjDIM2()

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

Definition at line 1939 of file iparith.cc.

1940{
1943 {
1944 Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1945 }
1946 if(currRing->qideal==NULL)
1947 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),(ideal)w->Data()));
1948 else
1949 {
1950 ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1951 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),q));
1952 idDelete(&q);
1953 }
1954 return FALSE;
1955}
#define idSimpleAdd(A, B)
Definition ideals.h:42

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv res,
leftv v )
static

Definition at line 5767 of file iparith.cc.

5768{
5769 res->data = (char *)(long)syDim((syStrategy)v->Data());
5770 return FALSE;
5771}
int syDim(syStrategy syzstr)
Definition syz1.cc:1850

◆ 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:619
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition coeffs.h:582
#define ii_div_by_0
Definition iparith.cc:220

◆ 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
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:1639

◆ 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 1956 of file iparith.cc.

1957{
1958 ideal vi=(ideal)v->Data();
1959 int vl= IDELEMS(vi);
1960 ideal ui=(ideal)u->Data();
1961 unsigned ul= IDELEMS(ui);
1962 ideal R; matrix U;
1964 if (m==NULL) return TRUE;
1965 // now make sure that all matrices have the correct size:
1967 assume (MATCOLS(U) == (int)ul);
1969 L->Init(3);
1970 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1971 L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1972 L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1973 res->data=(char *)L;
1974 return FALSE;
1975}
INLINE_THIS void Init(int l=0)
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 7402 of file iparith.cc.

7403{ // may have 3 or 4 arguments
7404 leftv v1=v;
7405 leftv v2=v1->next;
7406 leftv v3=v2->next;
7407 leftv v4=v3->next;
7409
7410 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7411 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7412
7413 if((i1==0)||(i2==0)
7414 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7415 {
7416 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7417 return TRUE;
7418 }
7419
7420 sleftv w1,w2;
7421 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7422 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7423 ideal P=(ideal)w1.Data();
7424 ideal Q=(ideal)w2.Data();
7425
7426 int n=(int)(long)v3->Data();
7427 int *w=NULL;
7428 if(v4!=NULL)
7429 {
7430 w = iv2array((intvec *)v4->Data(),currRing);
7431 int * w0 = w + 1;
7432 int i = currRing->N;
7433 while( (i > 0) && ((*w0) > 0) )
7434 {
7435 w0++;
7436 i--;
7437 }
7438 if(i>0)
7439 WarnS("not all weights are positive!");
7440 }
7441
7442 matrix T;
7443 ideal R;
7444 idLiftW(P,Q,n,T,R,w);
7445
7446 w1.CleanUp();
7447 w2.CleanUp();
7448 if(w!=NULL)
7449 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7450
7452 L->Init(2);
7453 L->m[1].rtyp=v1->Typ();
7454 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7455 {
7456 if(v1->Typ()==POLY_CMD)
7457 p_Shift(&R->m[0],-1,currRing);
7458 L->m[1].data=(void *)R->m[0];
7459 R->m[0]=NULL;
7460 idDelete(&R);
7461 }
7462 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7463 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7464 else
7465 {
7466 L->m[1].rtyp=MODUL_CMD;
7467 L->m[1].data=(void *)R;
7468 }
7469 L->m[0].rtyp=MATRIX_CMD;
7470 L->m[0].data=(char *)T;
7471
7472 res->data=L;
7473
7474 return FALSE;
7475}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition ideals.cc:1336
matrix id_Module2Matrix(ideal mod, const ring R)
#define Q
Definition sirandom.c:26

◆ 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 long a= (long)u->Data();
1233 long b= (long)v->Data();
1234 if (b==0)
1235 {
1237 return TRUE;
1238 }
1239 long c=a%b;
1240 long 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 *)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 336 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv res,
leftv u )
static

Definition at line 3777 of file iparith.cc.

3778{
3779// res->data = (char *)u->CopyD();
3780// also copy attributes:
3781 res->Copy(u);
3782 return FALSE;
3783}

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv ,
leftv v )
static

Definition at line 4190 of file iparith.cc.

4191{
4192 si_link l = (si_link)v->Data();
4193 if (slDump(l))
4194 {
4195 const char *s;
4196 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4197 else s=sNoName_fe;
4198 Werror("cannot dump to `%s`",s);
4199 return TRUE;
4200 }
4201 else
4202 return FALSE;
4203}

◆ jjE()

static BOOLEAN jjE ( leftv res,
leftv v )
static

Definition at line 4204 of file iparith.cc.

4205{
4206 res->data = (char *)pOne();
4207 int co=(int)(long)v->Data();
4208 if (co>0)
4209 {
4210 pSetComp((poly)res->data,co);
4211 pSetm((poly)res->data);
4212 }
4213 else WerrorS("argument of gen must be positive");
4214 return (co<=0);
4215}
#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 1976 of file iparith.cc.

1977{
1978 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1979 //setFlag(res,FLAG_STD);
1980 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
1981}
ideal idElimination(ideal h1, poly delVar, intvec *hilb, GbVariant alg)
Definition ideals.cc:1605

◆ jjELIMIN_ALG()

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

Definition at line 6163 of file iparith.cc.

6164{
6165 ideal I=(ideal)u->Data();
6166 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6167 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6168 //setFlag(res,FLAG_STD);
6169 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6170}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition ideals.cc:3624
GbVariant
Definition ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6171 of file iparith.cc.

6172{
6173 bigintmat *ww=(bigintmat*)w->Data();
6174 intvec* vvv=new intvec(1,ww->cols());
6175 for(int i=0;i<ww->cols();i++)
6176 {
6177 (*vvv)[i]=n_Int(BIMATELEM(*ww,1,i+1),coeffs_BIGINT);
6178 }
6179
6180 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6181 vvv);
6182 delete vvv;
6183 //setFlag(res,FLAG_STD);
6184 return FALSE;
6185}

◆ jjELIMIN_IV()

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

Definition at line 1982 of file iparith.cc.

1983{
1984 poly p=pOne();
1985 intvec *iv=(intvec*)v->Data();
1986 for(int i=iv->length()-1; i>=0; i--)
1987 {
1988 pSetExp(p,(*iv)[i],1);
1989 }
1990 pSetm(p);
1991 res->data=(char *)idElimination((ideal)u->Data(),p);
1992 pLmDelete(&p);
1993 //setFlag(res,FLAG_STD);
1994 return FALSE;
1995}
#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 5333 of file iparith.cc.

5334{
5335#ifdef HAVE_PLURAL
5336 ring r = (ring)a->Data();
5337 if (rIsPluralRing(r))
5338 {
5339 ring s = rEnvelope(r);
5340 res->data = s;
5341 }
5342 else res->data = rCopy(r);
5343 return FALSE;
5344#else
5345 return TRUE;
5346#endif
5347}
ring rEnvelope(ring R)
Definition ring.cc:5759
ring rCopy(ring r)
Definition ring.cc:1733

◆ 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:464

◆ 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:655

◆ 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:399

◆ 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
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:1996

◆ jjERROR()

static BOOLEAN jjERROR ( leftv ,
leftv u )
static

Definition at line 2001 of file iparith.cc.

2002{
2003 WerrorS((char *)u->Data());
2004 EXTERN_VAR int inerror;
2005 inerror=3;
2006 return TRUE;
2007}
#define EXTERN_VAR
Definition globaldefs.h:6
EXTERN_VAR int inerror

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv ,
leftv v )
static

Definition at line 4216 of file iparith.cc.

4217{
4218 char * d = (char *)v->Data();
4219 char * s = (char *)omAlloc(strlen(d) + 13);
4220 strcpy( s, (char *)d);
4221 strcat( s, "\n;RETURN();\n");
4223 return yyparse();
4224}
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition fevoices.cc:166
@ BT_execute
Definition fevoices.h:23
int yyparse(void)
Definition grammar.cc:2149

◆ jjEXPORTTO()

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

Definition at line 1996 of file iparith.cc.

1997{
1998 //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1999 return iiExport(v,0,IDPACKAGE((idhdl)u->data));
2000}
BOOLEAN iiExport(leftv v, int toLev)
Definition ipshell.cc:1512

◆ jjEXTGCD_BI()

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

Definition at line 2008 of file iparith.cc.

2009{
2010 number uu=(number)u->Data();number vv=(number)v->Data();
2012 number a,b;
2014 L->Init(3);
2015 L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
2016 L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
2017 L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
2018 res->rtyp=LIST_CMD;
2019 res->data=(char *)L;
2020 return FALSE;
2021}
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:675

◆ jjEXTGCD_I()

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

Definition at line 2022 of file iparith.cc.

2023{
2024 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2025 int p0=ABS(uu),p1=ABS(vv);
2026 int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
2027
2028 while ( p1!=0 )
2029 {
2030 q=p0 / p1;
2031 r=p0 % p1;
2032 p0 = p1; p1 = r;
2033 r = g0 - g1 * q;
2034 g0 = g1; g1 = r;
2035 r = f0 - f1 * q;
2036 f0 = f1; f1 = r;
2037 }
2038 int a = f0;
2039 int b = g0;
2040 if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
2041 if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
2043 L->Init(3);
2044 L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
2045 L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
2046 L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
2047 res->data=(char *)L;
2048 return FALSE;
2049}
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 2050 of file iparith.cc.

2051{
2052 poly r,pa,pb;
2053 BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2054 if (ret) return TRUE;
2056 L->Init(3);
2057 res->data=(char *)L;
2058 L->m[0].data=(void *)r;
2059 L->m[0].rtyp=POLY_CMD;
2060 L->m[1].data=(void *)pa;
2061 L->m[1].rtyp=POLY_CMD;
2062 L->m[2].data=(void *)pb;
2063 L->m[2].rtyp=POLY_CMD;
2064 return FALSE;
2065}
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition clapsing.cc:489
static BOOLEAN pb(leftv res, leftv args)
Definition cohomo.cc:3746

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv res,
leftv u )
static

Definition at line 4265 of file iparith.cc.

4266{
4267 intvec *v=NULL;
4269 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4270 if (f==NULL) return TRUE;
4271 ivTest(v);
4273 l->Init(2);
4274 l->m[0].rtyp=IDEAL_CMD;
4275 l->m[0].data=(void *)f;
4276 l->m[1].rtyp=INTVEC_CMD;
4277 l->m[1].data=(void *)v;
4278 res->data=(void *)l;
4279 return FALSE;
4280}
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:169
EXTERN_VAR int singclap_factorize_retry
Definition iparith.cc:2066

◆ jjFAC_P2()

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

Definition at line 2067 of file iparith.cc.

2068{
2069 intvec *v=NULL;
2070 int sw=(int)(long)dummy->Data();
2071 int fac_sw=sw;
2072 if ((sw<0)||(sw>2)) fac_sw=1;
2074 ideal f=singclap_factorize((poly)(u->CopyD()), &v, fac_sw,currRing);
2075 if (f==NULL)
2076 return TRUE;
2077 switch(sw)
2078 {
2079 case 0:
2080 case 2:
2081 {
2083 l->Init(2);
2084 l->m[0].rtyp=IDEAL_CMD;
2085 l->m[0].data=(void *)f;
2086 l->m[1].rtyp=INTVEC_CMD;
2087 l->m[1].data=(void *)v;
2088 res->data=(void *)l;
2089 res->rtyp=LIST_CMD;
2090 return FALSE;
2091 }
2092 case 1:
2093 res->data=(void *)f;
2094 return FALSE;
2095 case 3:
2096 {
2097 poly p=f->m[0];
2098 int i=IDELEMS(f);
2099 f->m[0]=NULL;
2100 while(i>1)
2101 {
2102 i--;
2103 p=pMult(p,f->m[i]);
2104 f->m[i]=NULL;
2105 }
2106 res->data=(void *)p;
2107 res->rtyp=POLY_CMD;
2108 }
2109 return FALSE;
2110 }
2111 WerrorS("invalid switch");
2112 return TRUE;
2113}
#define pMult(p, q)
Definition polys.h:207

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv res,
leftv v )
static

Definition at line 4225 of file iparith.cc.

4226{
4228 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4229 {
4230 ideal_list p,h;
4231 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4232 if (h==NULL)
4233 {
4234 L->Init(1);
4235 L->m[0].data=(char *)idInit(1);
4236 L->m[0].rtyp=IDEAL_CMD;
4237 }
4238 else
4239 {
4240 p=h;
4241 int l=0;
4242 while (p!=NULL) { p=p->next;l++; }
4243 L->Init(l);
4244 l=0;
4245 while(h!=NULL)
4246 {
4247 L->m[l].data=(char *)h->d;
4248 L->m[l].rtyp=IDEAL_CMD;
4249 p=h->next;
4250 omFreeSize(h,sizeof(*h));
4251 h=p;
4252 l++;
4253 }
4254 }
4255 }
4256 else
4257 {
4258 WarnS("no factorization implemented");
4259 L->Init(1);
4260 iiExprArith1(&(L->m[0]),v,STD_CMD);
4261 }
4262 res->data=(void *)L;
4263 return FALSE;
4264}
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:313
@ testHomog
Definition structs.h:38
@ STD_CMD
Definition tok.h:186

◆ jjFACSTD2()

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

Definition at line 2114 of file iparith.cc.

2115{
2116 ideal_list p,h;
2117 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2118 p=h;
2119 int l=0;
2120 while (p!=NULL) { p=p->next;l++; }
2122 L->Init(l);
2123 l=0;
2124 while(h!=NULL)
2125 {
2126 L->m[l].data=(char *)h->d;
2127 L->m[l].rtyp=IDEAL_CMD;
2128 p=h->next;
2129 omFreeSize(h,sizeof(*h));
2130 h=p;
2131 l++;
2132 }
2133 res->data=(void *)L;
2134 return FALSE;
2135}

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv res,
leftv v )
static

Definition at line 8664 of file iparith.cc.

8665{
8666 /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
8667 see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
8668
8669 valid argument lists:
8670 - (poly h, int d),
8671 - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
8672 - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
8673 in list of ring vars,
8674 - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
8675 optional: all 4 optional args
8676 (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
8677 by singclap_factorize and h(0, y)
8678 has exactly two distinct monic factors [possibly with exponent > 1].)
8679 result:
8680 - list with the two factors f and g such that
8681 h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
8682
8683 poly h = NULL;
8684 int d = 1;
8685 poly f0 = NULL;
8686 poly g0 = NULL;
8687 int xIndex = 1; /* default index if none provided */
8688 int yIndex = 2; /* default index if none provided */
8689
8690 leftv u = v; int factorsGiven = 0;
8691 if ((u == NULL) || (u->Typ() != POLY_CMD))
8692 {
8693 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8694 return TRUE;
8695 }
8696 else h = (poly)u->Data();
8697 u = u->next;
8698 if ((u == NULL) || (u->Typ() != INT_CMD))
8699 {
8700 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8701 return TRUE;
8702 }
8703 else d = (int)(long)u->Data();
8704 u = u->next;
8705 if ((u != NULL) && (u->Typ() == POLY_CMD))
8706 {
8707 if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
8708 {
8709 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8710 return TRUE;
8711 }
8712 else
8713 {
8714 f0 = (poly)u->Data();
8715 g0 = (poly)u->next->Data();
8716 factorsGiven = 1;
8717 u = u->next->next;
8718 }
8719 }
8720 if ((u != NULL) && (u->Typ() == INT_CMD))
8721 {
8722 if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
8723 {
8724 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8725 return TRUE;
8726 }
8727 else
8728 {
8729 xIndex = (int)(long)u->Data();
8730 yIndex = (int)(long)u->next->Data();
8731 u = u->next->next;
8732 }
8733 }
8734 if (u != NULL)
8735 {
8736 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8737 return TRUE;
8738 }
8739
8740 /* checks for provided arguments */
8742 {
8743 WerrorS("expected non-constant polynomial argument(s)");
8744 return TRUE;
8745 }
8746 int n = rVar(currRing);
8747 if ((xIndex < 1) || (n < xIndex))
8748 {
8749 Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
8750 return TRUE;
8751 }
8752 if ((yIndex < 1) || (n < yIndex))
8753 {
8754 Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
8755 return TRUE;
8756 }
8757 if (xIndex == yIndex)
8758 {
8759 WerrorS("expected distinct indices for variables x and y");
8760 return TRUE;
8761 }
8762
8763 /* computation of f0 and g0 if missing */
8764 if (factorsGiven == 0)
8765 {
8766 poly h0 = pSubst(pCopy(h), xIndex, NULL);
8767 intvec* v = NULL;
8769
8770 ivTest(v);
8771
8772 if (i == NULL) return TRUE;
8773
8774 idTest(i);
8775
8776 if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
8777 {
8778 WerrorS("expected h(0,y) to have exactly two distinct monic factors");
8779 return TRUE;
8780 }
8781 f0 = pPower(pCopy(i->m[1]), (*v)[1]);
8782 g0 = pPower(pCopy(i->m[2]), (*v)[2]);
8783 idDelete(&i);
8784 }
8785
8786 poly f; poly g;
8787 henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
8789 L->Init(2);
8790 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
8791 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
8792 res->rtyp = LIST_CMD;
8793 res->data = (char*)L;
8794 return FALSE;
8795}
g
Definition cfModGcd.cc:4098
#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:365

◆ jjFAREY_BI()

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

Definition at line 2136 of file iparith.cc.

2137{
2138 if (rField_is_Q(currRing))
2139 {
2140 number uu=(number)u->Data();
2141 number vv=(number)v->Data();
2142 res->data=(char *)n_Farey(uu,vv,currRing->cf);
2143 return FALSE;
2144 }
2145 else return TRUE;
2146}
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition coeffs.h:771

◆ jjFAREY_ID()

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

Definition at line 2147 of file iparith.cc.

2148{
2149 ideal uu=(ideal)u->Data();
2150 number vv=(number)v->Data();
2151 //timespec buf1,buf2;
2152 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2153 #if 1
2154 #ifdef HAVE_VSPACE
2156 if ((cpus>1) && (rField_is_Q(currRing)))
2157 res->data=(void*)id_Farey_0(uu,vv,currRing);
2158 else
2159 #endif
2160 #endif
2161 res->data=(void*)id_Farey(uu,vv,currRing);
2162 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2163 //const unsigned long SEC = 1000L*1000L*1000L;
2164 //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2165 // buf2.tv_nsec-buf1.tv_nsec);
2166 //farey_cnt++;
2167 return FALSE;
2168}
ideal id_Farey(ideal x, number N, const ring r)
Definition ideals.cc:3055
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 10431 of file iparith.cc.

10432{
10433 lists c=(lists)u->CopyD();
10435 res_l->Init(c->nr+1);
10438 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10439 {
10440 sleftv tmp;
10441 tmp.Copy(v);
10443 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10444 }
10445 c->Clean();
10446 res->data=res_l;
10447 return bo;
10448}
@ FAREY_CMD
Definition tok.h:77

◆ jjFETCH()

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

Definition at line 2170 of file iparith.cc.

2171{
2172 ring r=(ring)u->Data();
2173 idhdl w;
2174 int op=iiOp;
2175 nMapFunc nMap;
2176
2177 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
2178 {
2179 int *perm=NULL;
2180 int *par_perm=NULL;
2181 int par_perm_size=0;
2182 BOOLEAN bo;
2183 nMap=n_SetMap(r->cf,currRing->cf);
2184 if (nMap==NULL)
2185 {
2186 // Allow imap/fetch to be make an exception only for:
2187 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2188 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
2189 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
2190 {
2192 }
2193 else
2194 {
2195 goto err_fetch;
2196 }
2197 }
2198 if (
2199 (iiOp!=FETCH_CMD) || (r->N!=currRing->N) || (rPar(r)!=rPar(currRing))
2202#endif
2203 )
2204 {
2205 perm=(int *)omAlloc0((r->N+1)*sizeof(int));
2206 if (par_perm_size!=0)
2207 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2208 op=IMAP_CMD;
2209 if (iiOp==IMAP_CMD)
2210 {
2211 int r_par=0;
2212 char ** r_par_names=NULL;
2213 if (r->cf->extRing!=NULL)
2214 {
2215 r_par=r->cf->extRing->N;
2216 r_par_names=r->cf->extRing->names;
2217 }
2218 int c_par=0;
2219 char ** c_par_names=NULL;
2220 if (currRing->cf->extRing!=NULL)
2221 {
2222 c_par=currRing->cf->extRing->N;
2223 c_par_names=currRing->cf->extRing->names;
2224 }
2225 if (!rIsLPRing(r))
2226 {
2227 maFindPerm(r->names, r->N, r_par_names, r_par,
2229 perm,par_perm, currRing->cf->type);
2230 }
2231 #ifdef HAVE_SHIFTBBA
2232 else
2233 {
2234 maFindPermLP(r->names, r->N, r_par_names, r_par,
2236 perm,par_perm, currRing->cf->type,r->isLPring);
2237 }
2238 #endif
2239 }
2240 else
2241 {
2242#ifdef HAVE_SHIFTBBA
2243 if (rIsLPRing(currRing))
2244 {
2245 maFetchPermLP(r, currRing, perm);
2246 }
2247 else
2248#endif
2249 {
2250 unsigned i;
2251 if (par_perm_size!=0)
2252 for(i=si_min(rPar(r),rPar(currRing));i>0;i--) par_perm[i-1]=-i;
2253 for(i=si_min(r->N,currRing->N);i>0;i--) perm[i]=i;
2254 }
2255 }
2256 }
2257 if ((iiOp==FETCH_CMD) && (BVERBOSE(V_IMAP)))
2258 {
2259 unsigned i;
2260 for(i=0;i<(unsigned)si_min(r->N,currRing->N);i++)
2261 {
2262 Print("// var nr %d: %s -> %s\n",i,r->names[i],currRing->names[i]);
2263 }
2264 for(i=0;i<(unsigned)si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
2265 {
2266 Print("// par nr %d: %s -> %s\n",
2268 }
2269 }
2270 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
2271 sleftv tmpW;
2272 tmpW.Init();
2273 tmpW.rtyp=IDTYP(w);
2274 tmpW.data=IDDATA(w);
2275 if ((bo=maApplyFetch(op,NULL,res,&tmpW, r,
2277 {
2278 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
2279 }
2280 if (perm!=NULL)
2281 omFreeSize((ADDRESS)perm,(r->N+1)*sizeof(int));
2282 if (par_perm!=NULL)
2284 return bo;
2285 }
2286 else
2287 {
2288 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
2289 }
2290 return TRUE;
2291err_fetch:
2292 char *s1=nCoeffString(r->cf);
2293 char *s2=nCoeffString(currRing->cf);
2294 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
2295 omFree(s2); omFree(s1);
2296 return TRUE;
2297}
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:963
@ IMAP_CMD
Definition grammar.cc:299
@ FETCH_CMD
Definition grammar.cc:296
#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)
#define V_IMAP
Definition options.h:53
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:604
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition ring.h:630
@ ALIAS_CMD
Definition tok.h:34

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv res,
leftv u )
static

Definition at line 7545 of file iparith.cc.

7546{
7547 ring r=(ring)u->Data();
7548 leftv v=u->next;
7551 if ((perm_var_l->Typ()!=INTVEC_CMD)
7552 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7553 ||(u->Typ()!=RING_CMD))
7554 {
7555 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7556 return TRUE;
7557 }
7560 if (perm_par_l!=NULL)
7561 perm_par_v=(intvec*)perm_par_l->Data();
7562 idhdl w;
7563 nMapFunc nMap;
7564
7565 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7566 {
7567 int *perm=NULL;
7568 int *par_perm=NULL;
7569 int par_perm_size=0;
7570 BOOLEAN bo;
7571 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7572 {
7573 // Allow imap/fetch to be make an exception only for:
7574 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7575 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7576 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7577 {
7579 }
7580 else
7581 {
7582 goto err_fetch;
7583 }
7584 }
7585 else
7587 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7588 if (par_perm_size!=0)
7589 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7590 int i;
7591 if (perm_par_l==NULL)
7592 {
7593 if (par_perm_size!=0)
7594 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7595 }
7596 else
7597 {
7598 if (par_perm_size==0) WarnS("source ring has no parameters");
7599 else
7600 {
7601 for(i=rPar(r)-1;i>=0;i--)
7602 {
7603 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7604 if ((par_perm[i]<-rPar(currRing))
7605 || (par_perm[i]>rVar(currRing)))
7606 {
7607 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7608 par_perm[i]=0;
7609 }
7610 }
7611 }
7612 }
7613 for(i=rVar(r)-1;i>=0;i--)
7614 {
7615 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7616 if ((perm[i]<-rPar(currRing))
7617 || (perm[i]>rVar(currRing)))
7618 {
7619 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7620 perm[i]=0;
7621 }
7622 }
7623 if (BVERBOSE(V_IMAP))
7624 {
7625 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7626 {
7627 if (perm[i]>0)
7628 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7629 else if (perm[i]<0)
7630 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7631 }
7632 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7633 {
7634 if (par_perm[i-1]<0)
7635 Print("// par nr %d: %s -> par %s\n",
7636 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7637 else if (par_perm[i-1]>0)
7638 Print("// par nr %d: %s -> var %s\n",
7639 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7640 }
7641 }
7642 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7643 sleftv tmpW;
7644 tmpW.Init();
7645 tmpW.rtyp=IDTYP(w);
7646 tmpW.data=IDDATA(w);
7649 {
7650 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7651 }
7652 if (perm!=NULL)
7653 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7654 if (par_perm!=NULL)
7656 return bo;
7657 }
7658 else
7659 {
7660 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7661 }
7662 return TRUE;
7663err_fetch:
7664 char *s1=nCoeffString(r->cf);
7665 char *s2=nCoeffString(currRing->cf);
7666 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7668 return TRUE;
7669}
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 2298 of file iparith.cc.

2299{
2300 /*4
2301 * look for the substring what in the string where
2302 * return the position of the first char of what in where
2303 * or 0
2304 */
2305 char *where=(char *)u->Data();
2306 char *what=(char *)v->Data();
2307 char *found = strstr(where,what);
2308 if (found != NULL)
2309 {
2310 res->data=(char *)((found-where)+1);
2311 }
2312 /*else res->data=NULL;*/
2313 return FALSE;
2314}
bool found

◆ jjFIND3()

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

Definition at line 6186 of file iparith.cc.

6187{
6188 /*4
6189 * look for the substring what in the string where
6190 * starting at position n
6191 * return the position of the first char of what in where
6192 * or 0
6193 */
6194 int n=(int)(long)w->Data();
6195 char *where=(char *)u->Data();
6196 char *what=(char *)v->Data();
6197 char *found;
6198 if ((1>n)||(n>(int)strlen(where)))
6199 {
6200 Werror("start position %d out of range",n);
6201 return TRUE;
6202 }
6203 found = strchr(where+n-1,*what);
6204 if (*(what+1)!='\0')
6205 {
6206 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6207 {
6208 found=strchr(found+1,*what);
6209 }
6210 }
6211 if (found != NULL)
6212 {
6213 res->data=(char *)((found-where)+1);
6214 }
6215 return FALSE;
6216}

◆ jjFRES()

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

Definition at line 2353 of file iparith.cc.

2354{
2356 w->rtyp = STRING_CMD;
2357 w->data = (char *)"complete"; // default
2358 BOOLEAN RES = jjFRES3(res, u, v, w);
2360 return RES;
2361}
static BOOLEAN jjFRES3(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:2316

◆ jjFRES3()

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

Definition at line 2316 of file iparith.cc.

2317{
2318 assumeStdFlag(u);
2319 ideal id = (ideal)u->Data();
2320 int max_length = (int)(long)v->Data();
2321 if (max_length < 0)
2322 {
2323 WerrorS("length for fres must not be negative");
2324 return TRUE;
2325 }
2326 if (max_length == 0)
2327 {
2328 max_length = currRing->N+1;
2329 if (currRing->qideal != NULL)
2330 {
2331 Warn("full resolution in a qring may be infinite, "
2332 "setting max length to %d", max_length);
2333 }
2334 }
2335 char *method = (char *)w->Data();
2336 /* For the moment, only "complete" (default), "frame", or "extended frame"
2337 * are allowed. Another useful option would be "linear strand".
2338 */
2339 if (strcmp(method, "complete") != 0
2340 && strcmp(method, "frame") != 0
2341 && strcmp(method, "extended frame") != 0
2342 && strcmp(method, "single module") != 0)
2343 {
2344 WerrorS("wrong optional argument for fres");
2345 return TRUE;
2346 }
2348 assume(r->fullres != NULL);
2349 res->data = (void *)r;
2350 return FALSE;
2351}
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:792

◆ jjFWALK()

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

Definition at line 2363 of file iparith.cc.

2364{
2365 res->data=(char *)fractalWalkProc(u,v);
2366 setFlag( res, FLAG_STD );
2367 return FALSE;
2368}
#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 6217 of file iparith.cc.

6218{
6219 if ((int)(long)w->Data()==0)
6220 res->data=(char *)walkProc(u,v);
6221 else
6222 res->data=(char *)fractalWalkProc(u,v);
6223 setFlag( res, FLAG_STD );
6224 return FALSE;
6225}
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 2382 of file iparith.cc.

2383{
2384 number n1 = (number) u->Data();
2385 number n2 = (number) v->Data();
2386 res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2387 return FALSE;
2388}
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:668

◆ jjGCD_I()

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

Definition at line 2369 of file iparith.cc.

2370{
2371 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2372 int p0=ABS(uu),p1=ABS(vv);
2373 int r;
2374 while ( p1!=0 )
2375 {
2376 r=p0 % p1;
2377 p0 = p1; p1 = r;
2378 }
2379 res->data=(char *)(long)p0;
2380 return FALSE;
2381}

◆ jjGCD_N()

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

Definition at line 2389 of file iparith.cc.

2390{
2391 number a=(number) u->Data();
2392 number b=(number) v->Data();
2393 if (nIsZero(a))
2394 {
2395 if (nIsZero(b)) res->data=(char *)nInit(1);
2396 else res->data=(char *)nCopy(b);
2397 }
2398 else
2399 {
2400 if (nIsZero(b)) res->data=(char *)nCopy(a);
2401 //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2402 else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2403 }
2404 return FALSE;
2405}
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:670
#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 2406 of file iparith.cc.

2407{
2408 res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2409 (poly)(v->CopyD(POLY_CMD)),currRing);
2410 return FALSE;
2411}
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:498
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:659

◆ 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 4281 of file iparith.cc.

4282{
4283 si_link l = (si_link)v->Data();
4284 if (slGetDump(l))
4285 {
4286 const char *s;
4287 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4288 else s=sNoName_fe;
4289 Werror("cannot get dump from `%s`",s);
4290 return TRUE;
4291 }
4292 else
4293 return FALSE;
4294}

◆ 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 4295 of file iparith.cc.

4296{
4298 ideal I=(ideal)v->Data();
4299 res->data=(void *)iiHighCorner(I,0);
4300 return FALSE;
4301}
poly iiHighCorner(ideal I, int ak)
Definition ipshell.cc:1607

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv res,
leftv v )
static

Definition at line 4302 of file iparith.cc.

4303{
4305 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4307 ideal I=(ideal)v->Data();
4308 int i;
4309 poly p=NULL,po=NULL;
4311 if (w==NULL)
4312 {
4313 w = new intvec(rk);
4314 delete_w=TRUE;
4315 }
4316 for(i=rk;i>0;i--)
4317 {
4318 p=iiHighCorner(I,i);
4319 if (p==NULL)
4320 {
4321 WerrorS("module must be zero-dimensional");
4322 if (delete_w) delete w;
4323 return TRUE;
4324 }
4325 if (po==NULL)
4326 {
4327 po=p;
4328 }
4329 else
4330 {
4331 // now po!=NULL, p!=NULL
4332 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4333 if (d==0)
4334 d=pLmCmp(po,p);
4335 if (d > 0)
4336 {
4337 pDelete(&p);
4338 }
4339 else // (d < 0)
4340 {
4341 pDelete(&po); po=p;
4342 }
4343 }
4344 }
4345 if (delete_w) delete w;
4346 res->data=(void *)po;
4347 return FALSE;
4348}
#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 4349 of file iparith.cc.

4350{
4351#ifdef HAVE_RINGS
4352 if (rField_is_Z(currRing))
4353 {
4354 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4355 PrintS("// performed for generic fibre, that is, over Q\n");
4356 }
4357#endif
4359 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4360 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4361 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4362 return FALSE;
4363}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:873

◆ jjHILBERT2()

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

Definition at line 2412 of file iparith.cc.

2413{
2414#ifdef HAVE_RINGS
2415 if (rField_is_Z(currRing))
2416 {
2417 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2418 PrintS("// performed for generic fibre, that is, over Q\n");
2419 }
2420#endif
2421 assumeStdFlag(u);
2422 intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2423#if 1
2424 switch((int)(long)v->Data())
2425 {
2426 case 1:
2428 return FALSE;
2429 case 2:
2431 return FALSE;
2432 }
2433#else
2434 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2435 if (errorreported) return TRUE;
2436
2437 switch((int)(long)v->Data())
2438 {
2439 case 1:
2440 res->data=(void *)iv;
2441 return FALSE;
2442 case 2:
2443 res->data=(void *)hSecondSeries(iv);
2444 delete iv;
2445 return FALSE;
2446 }
2447 delete iv;
2448#endif
2450 return TRUE;
2451}
intvec * hSecondSeries(intvec *hseries1)
Definition hilb.cc:706
intvec * hFirstSeries(ideal A, intvec *module_w, ideal Q, intvec *wdegree)
Definition hilb.cc:2167
bigintmat * hFirstSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2672
bigintmat * hSecondSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2694
const char feNotImplemented[]
Definition reporter.cc:54

◆ jjHILBERT3()

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

Definition at line 6226 of file iparith.cc.

6227{
6228 intvec *wdegree=(intvec*)w->Data();
6229 if (wdegree->length()!=currRing->N)
6230 {
6231 Werror("weight vector must have size %d, not %d",
6232 currRing->N,wdegree->length());
6233 return TRUE;
6234 }
6235#ifdef HAVE_RINGS
6236 if (rField_is_Z(currRing))
6237 {
6238 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6239 PrintS("// performed for generic fibre, that is, over Q\n");
6240 }
6241#endif
6242 assumeStdFlag(u);
6243 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6245 if (errorreported) return TRUE;
6246
6247 switch((int)(long)v->Data())
6248 {
6249 case 1:
6250 res->data=(void *)iv;
6251 return FALSE;
6252 case 2:
6253 res->data=(void *)hSecondSeries(iv);
6254 delete iv;
6255 return FALSE;
6256 }
6257 delete iv;
6259 return TRUE;
6260}

◆ jjHILBERT3Qt()

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

Definition at line 6261 of file iparith.cc.

6262{
6263#ifdef HAVE_RINGS
6264 if (rField_is_Z(currRing))
6265 {
6266 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6267 PrintS("// performed for generic fibre, that is, over Q\n");
6268 }
6269#endif
6270 assumeStdFlag(u);
6271 ring Qt =(ring)v->Data();
6272 char *name=(char*)w->Data();
6273 poly h;
6274 if (u->Typ()==IDEAL_CMD)
6276 else
6277 {
6278 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6280 }
6282 IDPOLY(hh)=h;
6283 return FALSE;
6284}
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:2080
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:2037
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:258
#define IDPOLY(a)
Definition ipid.h:130
int name
New type name for int.

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv res,
leftv v )
static

Definition at line 4364 of file iparith.cc.

4365{
4366#ifdef HAVE_RINGS
4367 if (rField_is_Z(currRing))
4368 {
4369 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4370 PrintS("// performed for generic fibre, that is, over Q\n");
4371 }
4372#endif
4373 res->data=(void *)hSecondSeries((intvec *)v->Data());
4374 return FALSE;
4375}

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv res,
leftv v )
static

Definition at line 4376 of file iparith.cc.

4377{
4378 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4379 ideal v_id=(ideal)v->Data();
4380 if (w==NULL)
4381 {
4382 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4383 if (res->data!=NULL)
4384 {
4385 if (v->rtyp==IDHDL)
4386 {
4387 char *s_isHomog=omStrDup("isHomog");
4388 if (v->e==NULL)
4389 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4390 else
4391 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4392 }
4393 else if (w!=NULL) delete w;
4394 } // if res->data==NULL then w==NULL
4395 }
4396 else
4397 {
4398 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4399 if((res->data==NULL) && (v->rtyp==IDHDL))
4400 {
4401 if (v->e==NULL)
4402 atKill((idhdl)(v->data),"isHomog");
4403 else
4404 atKill((idhdl)(v->LData()),"isHomog");
4405 }
4406 }
4407 return FALSE;
4408}
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:2077
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 2491 of file iparith.cc.

2492{
2493 intvec *w=new intvec(rVar(currRing));
2494 intvec *vw=(intvec*)u->Data();
2495 ideal v_id=(ideal)v->Data();
2498 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2499 currRing->pLexOrder=FALSE;
2500 kHomW=vw;
2501 kModW=w;
2503 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2504 currRing->pLexOrder=save_pLexOrder;
2505 kHomW=NULL;
2506 kModW=NULL;
2508 if (w!=NULL) delete w;
2509 return FALSE;
2510}
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2436
VAR intvec * kHomW
Definition kstd1.cc:2424
VAR intvec * kModW
Definition kstd1.cc:2424
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3671
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3659
long(* pFDegProc)(poly p, ring r)
Definition ring.h:38
long(* pLDegProc)(poly p, int *length, ring r)
Definition ring.h:37

◆ jjHOMOG1_WI()

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

Definition at line 2511 of file iparith.cc.

2512{
2513 intvec *vw=(intvec*)u->Data();
2514 ideal v_id=(ideal)v->Data();
2515 res->data=(void *)(long)id_HomIdealW(v_id,currRing->qideal,vw,currRing);
2516 return FALSE;
2517}
BOOLEAN id_HomIdealW(ideal id, ideal Q, const intvec *w, const ring r)

◆ jjHOMOG_ID()

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

Definition at line 2469 of file iparith.cc.

2470{
2471 int i=pVar((poly)v->Data());
2472 if (i==0)
2473 {
2474 WerrorS("ringvar expected");
2475 return TRUE;
2476 }
2477 pFDegProc deg;
2478 if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2479 deg=p_Totaldegree;
2480 else
2481 deg=currRing->pFDeg;
2482 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2483 int d=deg(p,currRing);
2484 pLmDelete(p);
2485 if (d==1)
2486 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2487 else
2488 WerrorS("variable must have weight 1");
2489 return (d!=1);
2490}
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 6285 of file iparith.cc.

6286{
6287 PrintS("TODO\n");
6288 int i=pVar((poly)v->Data());
6289 if (i==0)
6290 {
6291 WerrorS("ringvar expected");
6292 return TRUE;
6293 }
6294 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6295 int d=pWTotaldegree(p);
6296 pLmDelete(p);
6297 if (d==1)
6298 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6299 else
6300 WerrorS("variable must have weight 1");
6301 return (d!=1);
6302}
#define pWTotaldegree(p)
Definition polys.h:283

◆ jjHOMOG_P()

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

Definition at line 2452 of file iparith.cc.

2453{
2454 int i=pVar((poly)v->Data());
2455 if (i==0)
2456 {
2457 WerrorS("ringvar expected");
2458 return TRUE;
2459 }
2460 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2461 int d=pWTotaldegree(p);
2462 pLmDelete(p);
2463 if (d==1)
2464 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2465 else
2466 WerrorS("variable must have weight 1");
2467 return (d!=1);
2468}
poly p_Homogen(poly p, int varnum, const ring r)
Definition p_polys.cc:3276

◆ jjHOMOG_P_W()

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

Definition at line 6303 of file iparith.cc.

6304{
6305 PrintS("TODO\n");
6306 int i=pVar((poly)v->Data());
6307 if (i==0)
6308 {
6309 WerrorS("ringvar expected");
6310 return TRUE;
6311 }
6312 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6313 int d=pWTotaldegree(p);
6314 pLmDelete(p);
6315 if (d==1)
6316 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6317 else
6318 WerrorS("variable must have weight 1");
6319 return (d!=1);
6320}

◆ jjHOMOG_W_M()

static BOOLEAN jjHOMOG_W_M ( leftv res,
leftv v1,
leftv v2,
leftv v3 )
static

Definition at line 6321 of file iparith.cc.

6322{
6323 intvec *w=(intvec *)v3->Data();
6324 intvec *vw=(intvec*)v2->Data();
6325 ideal v_id=(ideal)v1->Data();
6326 res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6327 return FALSE;
6328}
BOOLEAN id_HomModuleW(ideal id, ideal Q, const intvec *w, const intvec *module_w, const ring r)

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv res,
leftv v )
static

Definition at line 4426 of file iparith.cc.

4427{
4428 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4430 MATROWS(mat)=1;
4431 mat->rank=1;
4432 res->data=(char *)mat;
4433 return FALSE;
4434}

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv res,
leftv v )
static

Definition at line 4435 of file iparith.cc.

4436{
4437 map m=(map)v->CopyD(MAP_CMD);
4438 omFreeBinAddr((ADDRESS)m->preimage);
4439 m->preimage=NULL;
4440 ideal I=(ideal)m;
4441 I->rank=1;
4442 res->data=(char *)I;
4443 return FALSE;
4444}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv res,
leftv v )
static

Definition at line 7501 of file iparith.cc.

7502{
7503 int s=1;
7504 leftv h=v;
7505 if (h!=NULL) s=exprlist_length(h);
7506 ideal id=idInit(s,1);
7507 int rank=1;
7508 int i=0;
7509 poly p;
7510 int dest_type=POLY_CMD;
7512 while (h!=NULL)
7513 {
7514 // use standard type conversions to poly/vector
7515 int ri;
7516 int ht=h->Typ();
7517 if (ht==dest_type)
7518 {
7519 p=(poly)h->CopyD();
7520 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7521 }
7522 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7523 {
7524 sleftv tmp;
7525 leftv hnext=h->next;
7526 h->next=NULL;
7528 h->next=hnext;
7529 p=(poly)tmp.data;
7530 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7531 }
7532 else
7533 {
7534 idDelete(&id);
7535 return TRUE;
7536 }
7537 id->m[i]=p;
7538 i++;
7539 h=h->next;
7540 }
7541 id->rank=rank;
7542 res->data=(char *)id;
7543 return FALSE;
7544}
int exprlist_length(leftv v)
Definition ipshell.cc:552

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv res,
leftv v )
static

Definition at line 4445 of file iparith.cc.

4446{
4447 if (currRing!=NULL)
4448 {
4449 ring q=(ring)v->Data();
4450 if (rSamePolyRep(currRing, q))
4451 {
4452 if (q->qideal==NULL)
4453 res->data=(char *)idInit(1,1);
4454 else
4455 res->data=(char *)idCopy(q->qideal);
4456 return FALSE;
4457 }
4458 }
4459 WerrorS("can only get ideal from identical qring");
4460 return TRUE;
4461}
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:1801

◆ jjidElem()

static BOOLEAN jjidElem ( leftv res,
leftv v )
static

Definition at line 5689 of file iparith.cc.

5690{
5691 res->data = (char *)(long)idElem((ideal)v->Data());
5692 return FALSE;
5693}
static int idElem(const ideal F)
number of non-zero polys in F

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv res,
leftv v )
static

Definition at line 5694 of file iparith.cc.

5695{
5696 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5697 return FALSE;
5698}
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 5714 of file iparith.cc.

5715{
5716 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5718 return FALSE;
5719}
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 4409 of file iparith.cc.

4410{
4411#ifdef HAVE_SHIFTBBA
4412 if (rIsLPRing(currRing))
4413 {
4414 int deg = (int)(long)v->Data();
4415 if (deg > currRing->N/currRing->isLPring)
4416 {
4417 WerrorS("degree bound of Letterplace ring is to small");
4418 return TRUE;
4419 }
4420 }
4421#endif
4422 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4424 return FALSE;
4425}
#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 5720 of file iparith.cc.

5721{
5722 res->data = (char *)idMinBase((ideal)v->Data());
5723 return FALSE;
5724}
ideal idMinBase(ideal h1, ideal *SB)
Definition ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv res,
leftv v )
static

Definition at line 5772 of file iparith.cc.

5773{
5774 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5775 return FALSE;
5776}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv res,
leftv v )
static

Definition at line 5699 of file iparith.cc.

5700{
5701 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5702 return FALSE;
5703}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv res,
leftv v )
static

Definition at line 4462 of file iparith.cc.

4463{
4464 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4465 iv->makeVector();
4466 res->data = iv;
4467 return FALSE;
4468}
void makeVector()
Definition intvec.h:102
@ INTMAT_CMD
Definition grammar.cc:280

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv res,
leftv v )
static

Definition at line 4469 of file iparith.cc.

4470{
4471 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4472 return FALSE;
4473}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition coeffs.h:797

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv res,
leftv v )
static

Definition at line 4474 of file iparith.cc.

4475{
4477 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4478 return FALSE;
4479}
intvec * scIndIntvec(ideal S, ideal Q)
Definition hdegree.cc:286

◆ jjINDEPSET2()

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

Definition at line 2518 of file iparith.cc.

2519{
2520 assumeStdFlag(u);
2521 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2522 currRing->qideal);
2523 return FALSE;
2524}
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition ipshell.cc:1104

◆ 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 {
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 long i=(long)v->Data();
1454 long 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 long i=(long)v->Data();
1474 long 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:3595

◆ 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 2531 of file iparith.cc.

2532{
2533 const lists L = (lists)l->Data();
2534 const int n = L->nr; assume (n >= 0);
2535 std::vector<ideal> V(n + 1);
2536
2537 for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2538
2539 res->data=interpolation(V, (intvec*)v->Data());
2541 return errorreported;
2542}
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv res,
leftv v )
static

Definition at line 4480 of file iparith.cc.

4481{
4482 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4483 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4484 res->data = result;
4485 return FALSE;
4486}
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3814
#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 6356 of file iparith.cc.

6357{
6358 ideal I=(ideal)u->Data();
6359 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6360 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6362 return FALSE;
6363}
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition ideals.cc:315
#define TEST_OPT_RETURN_SB
Definition options.h:112

◆ jjINTERSECT()

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

Definition at line 2525 of file iparith.cc.

2526{
2527 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2529 return FALSE;
2530}

◆ jjINTERSECT3()

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

Definition at line 6343 of file iparith.cc.

6344{
6345 ideal I1=(ideal)u->Data();
6346 ideal I2=(ideal)v->Data();
6347 ideal I3=(ideal)w->Data();
6348 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6349 r[0]=I1;
6350 r[1]=I2;
6351 r[2]=I3;
6352 res->data=(char *)idMultSect(r,3);
6353 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6354 return FALSE;
6355}
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition ideals.cc:471
ideal * resolvente
Definition ideals.h:18

◆ jjINTERSECT_PL()

static BOOLEAN jjINTERSECT_PL ( leftv res,
leftv v )
static

Definition at line 7670 of file iparith.cc.

7671{
7672 leftv h=v;
7673 int l=v->listLength();
7674 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7675 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7676 int t=0;
7677 // try to convert to IDEAL_CMD
7678 while (h!=NULL)
7679 {
7680 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7681 {
7682 t=IDEAL_CMD;
7683 }
7684 else break;
7685 h=h->next;
7686 }
7687 // if failure, try MODUL_CMD
7688 if (t==0)
7689 {
7690 h=v;
7691 while (h!=NULL)
7692 {
7693 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7694 {
7695 t=MODUL_CMD;
7696 }
7697 else break;
7698 h=h->next;
7699 }
7700 }
7701 // check for success in converting
7702 if (t==0)
7703 {
7704 WerrorS("cannot convert to ideal or module");
7705 return TRUE;
7706 }
7707 // call idMultSect
7708 h=v;
7709 int i=0;
7710 sleftv tmp;
7711 while (h!=NULL)
7712 {
7713 if (h->Typ()==t)
7714 {
7715 r[i]=(ideal)h->Data(); /*no copy*/
7716 h=h->next;
7717 }
7718 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7719 {
7720 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7721 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7722 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7723 return TRUE;
7724 }
7725 else
7726 {
7727 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7728 copied[i]=TRUE;
7729 h=tmp.next;
7730 }
7731 i++;
7732 }
7733 res->rtyp=t;
7734 res->data=(char *)idMultSect(r,i);
7735 while(i>0)
7736 {
7737 i--;
7738 if (copied[i]) idDelete(&(r[i]));
7739 }
7740 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7741 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7742 return FALSE;
7743}

◆ jjINTMAT3()

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

Definition at line 6329 of file iparith.cc.

6330{
6331 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6332 intvec* arg = (intvec*) u->Data();
6333 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6334
6335 for (i=0; i<n; i++)
6336 {
6337 (*im)[i] = (*arg)[i];
6338 }
6339
6340 res->data = (char *)im;
6341 return FALSE;
6342}

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv res,
leftv v )
static

Definition at line 7906 of file iparith.cc.

7907{
7908 int i=0;
7909 leftv h=v;
7910 if (h!=NULL) i=exprlist_length(h);
7911 intvec *iv=new intvec(i);
7912 i=0;
7913 while (h!=NULL)
7914 {
7915 if(h->Typ()==INT_CMD)
7916 {
7917 (*iv)[i]=(int)(long)h->Data();
7918 }
7919 else if (h->Typ()==INTVEC_CMD)
7920 {
7921 intvec *ivv=(intvec*)h->Data();
7922 for(int j=0;j<ivv->length();j++,i++)
7923 {
7924 (*iv)[i]=(*ivv)[j];
7925 }
7926 i--;
7927 }
7928 else
7929 {
7930 delete iv;
7931 return TRUE;
7932 }
7933 i++;
7934 h=h->next;
7935 }
7936 res->data=(char *)iv;
7937 return FALSE;
7938}

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv res,
leftv  )
static

Definition at line 4507 of file iparith.cc.

4508{
4509 res->data = (char *)0;
4510 return FALSE;
4511}

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv res,
leftv v )
static

Definition at line 4496 of file iparith.cc.

4497{
4498 res->data = (char *)(long)pVar((poly)v->Data());
4499 return FALSE;
4500}

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv res,
leftv v )
static

Definition at line 4501 of file iparith.cc.

4502{
4503 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4504 currRing->N)+1);
4505 return FALSE;
4506}
int r_IsRingVar(const char *n, char **names, int N)
Definition ring.cc:213

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv res,
leftv a )
static

Definition at line 4543 of file iparith.cc.

4544{
4545 ideal id = (ideal)a->Data();
4546 id = id_Transp(id,currRing);
4547 int W = IDELEMS(id);
4548
4549 ideal result = idInit(W * currRing->N, id->rank);
4550 poly *p = result->m;
4551
4552 for( int v = 1; v <= currRing->N; v++ )
4553 {
4554 poly* q = id->m;
4555 for( int i = 0; i < W; i++, p++, q++ )
4556 *p = pDiff( *q, v );
4557 }
4558 idDelete(&id);
4559
4560 res->data = (char *)result;
4561 return FALSE;
4562}

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv res,
leftv v )
static

Definition at line 4512 of file iparith.cc.

4513{
4514 ideal i=idInit(currRing->N,1);
4515 int k;
4516 poly p=(poly)(v->Data());
4517 for (k=currRing->N;k>0;k--)
4518 {
4519 i->m[k-1]=pDiff(p,k);
4520 }
4521 res->data = (char *)i;
4522 return FALSE;
4523}

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv res,
leftv v )
static

Definition at line 2549 of file iparith.cc.

2550{
2551 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2552 return jjStdJanetBasis(res,v,0);
2553}
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 2543 of file iparith.cc.

2544{
2545 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2546 return jjStdJanetBasis(res,u,(int)(long)v->Data());
2547}

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv res,
leftv u )
static

Definition at line 8000 of file iparith.cc.

8001{
8002 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
8003 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
8004 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
8005 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
8006 leftv u1=u;
8007 leftv u2=u1->next;
8008 leftv u3=u2->next;
8009 leftv u4=u3->next;
8010 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
8011 {
8012 if(!pIsUnit((poly)u2->Data()))
8013 {
8014 WerrorS("2nd argument must be a unit");
8015 return TRUE;
8016 }
8017 res->rtyp=u1->Typ();
8018 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
8019 pCopy((poly)u2->Data()),(intvec*)u4->Data());
8020 return FALSE;
8021 }
8022 else
8023 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
8024 {
8025 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8026 {
8027 WerrorS("2nd argument must be a diagonal matrix of units");
8028 return TRUE;
8029 }
8030 res->rtyp=u1->Typ();
8031 res->data=(char*)idSeries(
8032 (int)(long)u3->Data(),
8033 idCopy((ideal)u1->Data()),
8034 mp_Copy((matrix)u2->Data(), currRing),
8035 (intvec*)u4->Data()
8036 );
8037 return FALSE;
8038 }
8039 else
8040 {
8041 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
8042 Tok2Cmdname(iiOp));
8043 return TRUE;
8044 }
8045}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition ideals.cc:2129
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition matpol.cc:809
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition matpol.cc:57
#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:371

◆ jjJET_ID()

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

Definition at line 2559 of file iparith.cc.

2560{
2561 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2562 return FALSE;
2563}
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 6381 of file iparith.cc.

6382{
6383 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6384 (intvec *)w->Data(),currRing);
6385 return FALSE;
6386}
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 6387 of file iparith.cc.

6388{
6389 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6390 {
6391 WerrorS("2nd argument must be a diagonal matrix of units");
6392 return TRUE;
6393 }
6394 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6395 (matrix)v->CopyD());
6396 return FALSE;
6397}

◆ jjJET_P()

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

Definition at line 2554 of file iparith.cc.

2555{
2556 res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2557 return FALSE;
2558}
#define pJet(p, m)
Definition polys.h:367

◆ jjJET_P_IV()

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

Definition at line 6364 of file iparith.cc.

6365{
6366 int *iw=iv2array((intvec *)w->Data(),currRing);
6367 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6368 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6369 return FALSE;
6370}
#define ppJetW(p, m, iv)
Definition polys.h:368

◆ jjJET_P_P()

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

Definition at line 6371 of file iparith.cc.

6372{
6373 if (!pIsUnit((poly)v->Data()))
6374 {
6375 WerrorS("2nd argument must be a unit");
6376 return TRUE;
6377 }
6378 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6379 return FALSE;
6380}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition p_polys.cc:4548

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv res,
leftv v )
static

Definition at line 4582 of file iparith.cc.

4583{
4585 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4586 return FALSE;
4587}
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition hdegree.cc:1448

◆ jjKBASE2()

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

Definition at line 2564 of file iparith.cc.

2565{
2566 assumeStdFlag(u);
2567 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2568 res->data = (char *)scKBase((int)(long)v->Data(),
2569 (ideal)(u->Data()),currRing->qideal, w_u);
2570 if (w_u!=NULL)
2571 {
2572 atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2573 }
2574 return FALSE;
2575}
intvec * ivCopy(const intvec *o)
Definition intvec.h:145

◆ jjKERNEL()

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

Definition at line 2577 of file iparith.cc.

2578{
2579 return jjPREIMAGE(res,u,v,NULL);
2580}
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:6687

◆ jjKERNEL_M()

static BOOLEAN jjKERNEL_M ( leftv res,
leftv v )
static

Definition at line 4564 of file iparith.cc.

4565{
4566#ifdef HAVE_FLINT
4567 res->data = (char *)singflint_kernel((matrix)(v->Data()),currRing);
4568 return res->data==NULL;
4569#else
4570 return TRUE;
4571#endif
4572}
matrix singflint_kernel(matrix m, const ring R)

◆ jjKERNEL_SM()

static BOOLEAN jjKERNEL_SM ( leftv res,
leftv v )
static

Definition at line 4573 of file iparith.cc.

4574{
4575#ifdef HAVE_FLINT
4576 res->data = (char *)singflint_kernel((ideal)(v->Data()),currRing);
4577 return res->data==NULL;
4578#else
4579 return TRUE;
4580#endif
4581}

◆ 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 snprintf(nn,slen,"%s(%d)",u->name,(int)(long)v->Data());
1568 char *n=omStrDup(nn);
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 snprintf(n,slen,"%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 8083 of file iparith.cc.

8084{
8086 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
8087 {
8088 memcpy(res,u,sizeof(sleftv));
8089 u->Init();
8090 return FALSE;
8091 }
8092 leftv v=u->next;
8093 BOOLEAN b;
8094 if(v==NULL) // p()
8096 else if ((v->next==NULL) // p(1)
8097 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
8098 {
8099 u->next=NULL;
8100 b=iiExprArith2(res,u,iiOp,v);
8101 u->next=v;
8102 }
8103 else // p(1,2), p undefined
8104 {
8105 if (v->Typ()!=INT_CMD)
8106 {
8107 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8108 return TRUE;
8109 }
8110 int l=u->listLength();
8111 size_t len=strlen(u->name) + 12*l;
8112 char * nn = (char *)omAlloc(len);
8113 snprintf(nn,len,"%s(%d",u->name,(int)(long)v->Data());
8114 char *s=nn;
8115 do
8116 {
8117 while (*s!='\0') s++;
8118 v=v->next;
8119 if (v->Typ()!=INT_CMD)
8120 {
8121 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8122 omFree((ADDRESS)nn);
8123 return TRUE;
8124 }
8125 snprintf(s,len-(nn-s),",%d",(int)(long)v->Data());
8126 } while (v->next!=NULL);
8127 while (*s!='\0') s++;
8128 nn=strcat(nn,")");
8129 char *n=omStrDup(nn);
8130 omFree((ADDRESS)nn);
8131 syMake(res,n);
8132 b=FALSE;
8133 }
8134 return b;
8135}
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 {
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 2581 of file iparith.cc.

2582{
2583 return mpKoszul(res, u,v,NULL);
2584}
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition ipshell.cc:3093

◆ jjKoszul_Id()

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

Definition at line 2585 of file iparith.cc.

2586{
2587 sleftv h;
2588 h.Init();
2589 h.rtyp=INT_CMD;
2590 h.data=(void *)(long)IDELEMS((ideal)v->Data());
2591 return mpKoszul(res, u, &h, v);
2592}

◆ jjL2R()

static BOOLEAN jjL2R ( leftv res,
leftv v )
static

Definition at line 4588 of file iparith.cc.

4589{
4590 res->data=(char *)syConvList((lists)v->Data());
4591 if (res->data != NULL)
4592 return FALSE;
4593 else
4594 return TRUE;
4595}
syStrategy syConvList(lists li)
Definition ipshell.cc:3256

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv res,
leftv v )
static

Definition at line 4665 of file iparith.cc.

4666{
4667 sleftv a2,a3;
4668 memset(&a2,0,sizeof(a2));
4669 memset(&a3,0,sizeof(a3));
4670 a2.rtyp=INT_CMD; a2.data=(void*)10;
4671 a3.rtyp=INT_CMD; a3.data=(void*)1;
4672 return nuLagSolve(res,v,&a2,&a3);
4673}
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:4680

◆ 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 4596 of file iparith.cc.

4597{
4598 poly p=(poly)v->Data();
4599 if (p==NULL)
4600 {
4601 res->data=(char *)nInit(0);
4602 }
4603 else
4604 {
4606 res->data=(char *)nCopy(pGetCoeff(p));
4607 }
4608 return FALSE;
4609}

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv res,
leftv v )
static

Definition at line 4610 of file iparith.cc.

4611{
4612 poly p=(poly)v->Data();
4613 int s=currRing->N;
4614 if (v->Typ()==VECTOR_CMD) s++;
4615 intvec *iv=new intvec(s);
4616 if (p!=NULL)
4617 {
4618 for(int i = currRing->N;i;i--)
4619 {
4620 (*iv)[i-1]=pGetExp(p,i);
4621 }
4622 if (s!=currRing->N)
4623 (*iv)[currRing->N]=pGetComp(p);
4624 }
4625 res->data=(char *)iv;
4626 return FALSE;
4627}
#define pGetExp(p, i)
Exponent.
Definition polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv res,
leftv v )
static

Definition at line 4628 of file iparith.cc.

4629{
4630 poly p=(poly)v->Data();
4631 if (p == NULL)
4632 {
4633 res->data = (char*) NULL;
4634 }
4635 else
4636 {
4637 poly lm = pLmInit(p);
4638 pSetCoeff0(lm, nInit(1));
4639 res->data = (char*) lm;
4640 }
4641 return FALSE;
4642}
#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 2593 of file iparith.cc.

2594{
2595 int ul= IDELEMS((ideal)u->Data());
2596 int vl= IDELEMS((ideal)v->Data());
2597#ifdef HAVE_SHIFTBBA
2598 if (rIsLPRing(currRing))
2599 {
2600 if (currRing->LPncGenCount < ul)
2601 {
2602 Werror("At least %d ncgen variables are needed for this computation.", ul);
2603 return TRUE;
2604 }
2605 }
2606#endif
2607 ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2608 hasFlag(u,FLAG_STD));
2609 if (m==NULL) return TRUE;
2610 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2611 return FALSE;
2612}

◆ jjLIFT3()

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

Definition at line 7127 of file iparith.cc.

7128{
7129 if (w->rtyp!=IDHDL) return TRUE;
7130 int ul= IDELEMS((ideal)u->Data());
7131 int vl= IDELEMS((ideal)v->Data());
7132#ifdef HAVE_SHIFTBBA
7133 if (rIsLPRing(currRing))
7134 {
7135 if (currRing->LPncGenCount < ul)
7136 {
7137 Werror("At least %d ncgen variables are needed for this computation.", ul);
7138 return TRUE;
7139 }
7140 }
7141#endif
7142 ideal m
7143 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7144 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
7145 if (m==NULL) return TRUE;
7146 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7147 return FALSE;
7148}
#define IDMATRIX(a)
Definition ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv res,
leftv U )
static

Definition at line 8136 of file iparith.cc.

8137{
8138 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8139 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8140 leftv u=U;
8141 leftv v=u->next;
8142 leftv w=v->next;
8143 leftv u4=w->next;
8144 if (w->rtyp!=IDHDL) return TRUE;
8145 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8146 {
8147 // see jjLIFT3
8148 ideal I=(ideal)u->Data();
8149 int ul= IDELEMS(I /*(ideal)u->Data()*/);
8150 int vl= IDELEMS((ideal)v->Data());
8151 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
8152 ideal m
8153 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
8154 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
8155 if (m==NULL) return TRUE;
8156 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
8157 return FALSE;
8158 }
8159 else
8160 {
8161 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
8162 "or (`module`,`module`,`matrix`,`string`) expected",
8163 Tok2Cmdname(iiOp));
8164 return TRUE;
8165 }
8166}

◆ jjLIFTSTD()

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

Definition at line 2613 of file iparith.cc.

2614{
2615 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2616 idhdl h=(idhdl)v->data;
2617#ifdef HAVE_SHIFTBBA
2618 if (rIsLPRing(currRing))
2619 {
2620 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2621 {
2622 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2623 return TRUE;
2624 }
2625 }
2626#endif
2627 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2628 res->data = (char *)idLiftStd((ideal)u->Data(),
2629 &(h->data.umatrix),testHomog);
2630 setFlag(res,FLAG_STD); v->flag=0;
2631 return FALSE;
2632}
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 7172 of file iparith.cc.

7173{
7174 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7175 idhdl hv=(idhdl)v->data;
7176 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
7177#ifdef HAVE_SHIFTBBA
7178 if (rIsLPRing(currRing))
7179 {
7180 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7181 {
7182 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7183 return TRUE;
7184 }
7185 }
7186#endif
7187 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7188 res->data = (char *)idLiftStd((ideal)u->Data(),
7189 &(hv->data.umatrix),testHomog,
7190 NULL,alg);
7191 setFlag(res,FLAG_STD); v->flag=0;
7192 return FALSE;
7193}

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv res,
leftv U )
static

Definition at line 8167 of file iparith.cc.

8168{
8169 // we have 4 or 5 arguments
8170 leftv u=U;
8171 leftv v=u->next;
8172 leftv u3=v->next;
8173 leftv u4=u3->next;
8174 leftv u5=u4->next; // might be NULL
8175
8176 ideal *syz=NULL;
8178 ideal h11=NULL;
8179
8180 if(u5==NULL)
8181 {
8182 // test all three possibilities for 4 arguments
8183 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8184 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8185 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
8186 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
8187 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
8188 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
8189
8190 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8191 {
8192 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8193 idhdl hw=(idhdl)u3->data;
8194 syz=&(hw->data.uideal);
8195 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8196 }
8197 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
8198 {
8199 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8200 idhdl hw=(idhdl)u3->data;
8201 syz=&(hw->data.uideal);
8202 h11=(ideal)u4->Data();
8203 }
8204 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
8205 {
8206 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
8207 h11=(ideal)u4->Data();
8208 }
8209 else
8210 {
8211 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8212 return TRUE;
8213 }
8214 }
8215 else
8216 {
8217 // we have 5 arguments
8218 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
8219 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
8220 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8221 {
8222 idhdl hw=(idhdl)u3->data;
8223 syz=&(hw->data.uideal);
8224 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8225 h11=(ideal)u5->Data();
8226 }
8227 else
8228 {
8229 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8230 return TRUE;
8231 }
8232 }
8233
8234#ifdef HAVE_SHIFTBBA
8235 if (rIsLPRing(currRing))
8236 {
8237 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
8238 {
8239 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
8240 return TRUE;
8241 }
8242 }
8243#endif
8244
8245 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
8246 idhdl hv=(idhdl)v->data;
8247 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
8248 res->rtyp = u->Typ();
8249 res->data = (char *)idLiftStd((ideal)u->Data(),
8250 &(hv->data.umatrix),testHomog,
8251 syz,alg,h11);
8252 setFlag(res,FLAG_STD); v->flag=0;
8253 if(syz!=NULL)
8254 u3->flag=0;
8255 return FALSE;
8256}
@ GbDefault
Definition ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 7149 of file iparith.cc.

7150{
7151 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7152 if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
7153 idhdl hv=(idhdl)v->data;
7154 idhdl hw=(idhdl)w->data;
7155#ifdef HAVE_SHIFTBBA
7156 if (rIsLPRing(currRing))
7157 {
7158 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7159 {
7160 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7161 return TRUE;
7162 }
7163 }
7164#endif
7165 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7166 res->data = (char *)idLiftStd((ideal)u->Data(),
7167 &(hv->data.umatrix),testHomog,
7168 &(hw->data.uideal));
7169 setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7170 return FALSE;
7171}

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv res,
leftv v )

Definition at line 8257 of file iparith.cc.

8258{
8259 int sl=0;
8260 if (v!=NULL) sl = v->listLength();
8261 lists L;
8262 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
8263 {
8264 int add_row_shift = 0;
8265 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
8266 if (weights!=NULL) add_row_shift=weights->min_in();
8268 }
8269 else
8270 {
8272 leftv h=NULL;
8273 int i;
8274 int rt;
8275
8276 L->Init(sl);
8277 for (i=0;i<sl;i++)
8278 {
8279 if (h!=NULL)
8280 { /* e.g. not in the first step:
8281 * h is the pointer to the old sleftv,
8282 * v is the pointer to the next sleftv
8283 * (in this moment) */
8284 h->next=v;
8285 }
8286 h=v;
8287 v=v->next;
8288 h->next=NULL;
8289 rt=h->Typ();
8290 if (rt==0)
8291 {
8292 L->Clean();
8293 Werror("`%s` is undefined",h->Fullname());
8294 return TRUE;
8295 }
8296 if (rt==RING_CMD)
8297 {
8298 L->m[i].rtyp=rt;
8299 L->m[i].data=rIncRefCnt(((ring)h->Data()));
8300 }
8301 else
8302 L->m[i].Copy(h);
8303 }
8304 }
8305 res->data=(char *)L;
8306 return FALSE;
8307}
int min_in()
Definition intvec.h:121
void Copy(leftv e)
Definition subexpr.cc:688
@ RESOLUTION_CMD
Definition grammar.cc:291
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3184
static ring rIncRefCnt(ring r)
Definition ring.h:846

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv res,
leftv v )
static

Definition at line 4647 of file iparith.cc.

4648{
4649 lists l=(lists)v->Data();
4650 long mm=(long)atGet(v,"maxExp",INT_CMD);
4651 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4653 res->data=(char *)r;
4654 return (r==NULL);
4655}
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition ipshell.cc:2785

◆ jjLOAD()

BOOLEAN jjLOAD ( const char * s,
BOOLEAN autoexport )

load lib/module given in v

Definition at line 5587 of file iparith.cc.

5588{
5589 char libnamebuf[1024];
5591
5592#ifdef HAVE_DYNAMIC_LOADING
5593 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5594#endif /* HAVE_DYNAMIC_LOADING */
5595 switch(LT)
5596 {
5597 default:
5598 case LT_NONE:
5599 Werror("%s: unknown type", s);
5600 break;
5601 case LT_NOTFOUND:
5602 Werror("cannot open %s", s);
5603 break;
5604
5605 case LT_SINGULAR:
5606 {
5607 char *plib = iiConvName(s);
5608 idhdl pl = IDROOT->get_level(plib,0);
5609 if (pl==NULL)
5610 {
5611 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5612 IDPACKAGE(pl)->language = LANG_SINGULAR;
5613 IDPACKAGE(pl)->libname=omStrDup(s);
5614 }
5615 else if (IDTYP(pl)!=PACKAGE_CMD)
5616 {
5617 Werror("can not create package `%s`",plib);
5619 return TRUE;
5620 }
5621 else /* package */
5622 {
5623 package pa=IDPACKAGE(pl);
5624 if ((pa->language==LANG_C)
5625 || (pa->language==LANG_MIX))
5626 {
5627 Werror("can not create package `%s` - binaries exists",plib);
5629 return TRUE;
5630 }
5631 }
5633 package savepack=currPack;
5634 currPack=IDPACKAGE(pl);
5635 IDPACKAGE(pl)->loaded=TRUE;
5636 char libnamebuf[1024];
5637 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5640 IDPACKAGE(pl)->loaded=(!bo);
5641 return bo;
5642 }
5643 case LT_BUILTIN:
5644 SModulFunc_t iiGetBuiltinModInit(const char*);
5646 case LT_MACH_O:
5647 case LT_ELF:
5648 case LT_HPUX:
5649#ifdef HAVE_DYNAMIC_LOADING
5651#else /* HAVE_DYNAMIC_LOADING */
5652 WerrorS("Dynamic modules are not supported by this version of Singular");
5653 break;
5654#endif /* HAVE_DYNAMIC_LOADING */
5655 }
5656 return TRUE;
5657}
CanonicalForm fp
Definition cfModGcd.cc:4110
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition feFopen.cc:47
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:1303
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:982
char * iiConvName(const char *libname)
Definition iplib.cc:1438
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition iplib.cc:1293
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition iplib.cc:815
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 4643 of file iparith.cc.

4644{
4645 return jjLOAD((char*)v->Data(),FALSE);
4646}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition iparith.cc:5587

◆ jjLOAD2()

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

Definition at line 2633 of file iparith.cc.

2634{
2635 return jjLOAD((char*)v->Data(),TRUE);
2636}

◆ jjLOAD_E()

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

Definition at line 2637 of file iparith.cc.

2638{
2639 char * s=(char *)u->Data();
2640 if(strcmp(s, "with")==0)
2641 return jjLOAD((char*)v->Data(), TRUE);
2642 if (strcmp(s,"try")==0)
2643 return jjLOAD_TRY((char*)v->Data());
2644 WerrorS("invalid second argument");
2645 WerrorS("load(\"libname\" [,option]);");
2646 return TRUE;
2647}
BOOLEAN jjLOAD_TRY(const char *s)
Definition iparith.cc:5663

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char * s)

Definition at line 5663 of file iparith.cc.

5664{
5665 if (!iiGetLibStatus(s))
5666 {
5667 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5671 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5672 Print("loading of >%s< failed\n",s);
5674 errorreported=0;
5675 }
5676 return FALSE;
5677}
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition iparith.cc:5658
static void WerrorS_dummy(const char *)
Definition iparith.cc:5659
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 4674 of file iparith.cc.

4675{
4676 /* computes the LU-decomposition of a matrix M;
4677 i.e., M = P * L * U, where
4678 - P is a row permutation matrix,
4679 - L is in lower triangular form,
4680 - U is in upper row echelon form
4681 Then, we also have P * M = L * U.
4682 A list [P, L, U] is returned. */
4683 matrix mat = (matrix)v->Data();
4684 if (!idIsConstant((ideal)mat))
4685 {
4686 WerrorS("matrix must be constant");
4687 return TRUE;
4688 }
4689 matrix pMat;
4690 matrix lMat;
4691 matrix uMat;
4692
4694
4696 ll->Init(3);
4697 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4698 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4699 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4700 res->data=(char*)ll;
4701
4702 return FALSE;
4703}
#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 7744 of file iparith.cc.

7745{
7746 /* computation of the inverse of a quadratic matrix A
7747 using the L-U-decomposition of A;
7748 There are two valid parametrisations:
7749 1) exactly one argument which is just the matrix A,
7750 2) exactly three arguments P, L, U which already
7751 realise the L-U-decomposition of A, that is,
7752 P * A = L * U, and P, L, and U satisfy the
7753 properties decribed in method 'jjLU_DECOMP';
7754 see there;
7755 If A is invertible, the list [1, A^(-1)] is returned,
7756 otherwise the list [0] is returned. Thus, the user may
7757 inspect the first entry of the returned list to see
7758 whether A is invertible. */
7759 matrix iMat; int invertible;
7760 const short t1[]={1,MATRIX_CMD};
7761 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7762 if (iiCheckTypes(v,t1))
7763 {
7764 matrix aMat = (matrix)v->Data();
7765 int rr = aMat->rows();
7766 int cc = aMat->cols();
7767 if (rr != cc)
7768 {
7769 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7770 return TRUE;
7771 }
7772 if (!idIsConstant((ideal)aMat))
7773 {
7774 WerrorS("matrix must be constant");
7775 return TRUE;
7776 }
7778 }
7779 else if (iiCheckTypes(v,t2))
7780 {
7781 matrix pMat = (matrix)v->Data();
7782 matrix lMat = (matrix)v->next->Data();
7783 matrix uMat = (matrix)v->next->next->Data();
7784 int rr = uMat->rows();
7785 int cc = uMat->cols();
7786 if (rr != cc)
7787 {
7788 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7789 rr, cc);
7790 return TRUE;
7791 }
7792 if (!idIsConstant((ideal)pMat)
7793 || (!idIsConstant((ideal)lMat))
7794 || (!idIsConstant((ideal)uMat))
7795 )
7796 {
7797 WerrorS("matricesx must be constant");
7798 return TRUE;
7799 }
7801 }
7802 else
7803 {
7804 Werror("expected either one or three matrices");
7805 return TRUE;
7806 }
7807
7808 /* build the return structure; a list with either one or two entries */
7810 if (invertible)
7811 {
7812 ll->Init(2);
7813 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7814 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7815 }
7816 else
7817 {
7818 ll->Init(1);
7819 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7820 }
7821
7822 res->data=(char*)ll;
7823 return FALSE;
7824}
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 7825 of file iparith.cc.

7826{
7827 /* for solving a linear equation system A * x = b, via the
7828 given LU-decomposition of the matrix A;
7829 There is one valid parametrisation:
7830 1) exactly four arguments P, L, U, b;
7831 P, L, and U realise the L-U-decomposition of A, that is,
7832 P * A = L * U, and P, L, and U satisfy the
7833 properties decribed in method 'jjLU_DECOMP';
7834 see there;
7835 b is the right-hand side vector of the equation system;
7836 The method will return a list of either 1 entry or three entries:
7837 1) [0] if there is no solution to the system;
7838 2) [1, x, H] if there is at least one solution;
7839 x is any solution of the given linear system,
7840 H is the matrix with column vectors spanning the homogeneous
7841 solution space.
7842 The method produces an error if matrix and vector sizes do not fit. */
7843 const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7844 if (!iiCheckTypes(v,t))
7845 {
7846 WerrorS("expected exactly three matrices and one vector as input");
7847 return TRUE;
7848 }
7849 matrix pMat = (matrix)v->Data();
7850 matrix lMat = (matrix)v->next->Data();
7851 matrix uMat = (matrix)v->next->next->Data();
7852 matrix bVec = (matrix)v->next->next->next->Data();
7854 if (pMat->rows() != pMat->cols())
7855 {
7856 Werror("first matrix (%d x %d) is not quadratic",
7857 pMat->rows(), pMat->cols());
7858 return TRUE;
7859 }
7860 if (lMat->rows() != lMat->cols())
7861 {
7862 Werror("second matrix (%d x %d) is not quadratic",
7863 lMat->rows(), lMat->cols());
7864 return TRUE;
7865 }
7866 if (lMat->rows() != uMat->rows())
7867 {
7868 Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7869 lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7870 return TRUE;
7871 }
7872 if (uMat->rows() != bVec->rows())
7873 {
7874 Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7875 uMat->rows(), uMat->cols(), bVec->rows());
7876 return TRUE;
7877 }
7878 if (!idIsConstant((ideal)pMat)
7879 ||(!idIsConstant((ideal)lMat))
7880 ||(!idIsConstant((ideal)uMat))
7881 )
7882 {
7883 WerrorS("matrices must be constant");
7884 return TRUE;
7885 }
7887
7888 /* build the return structure; a list with either one or three entries */
7890 if (solvable)
7891 {
7892 ll->Init(3);
7893 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7894 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7895 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7896 }
7897 else
7898 {
7899 ll->Init(1);
7900 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7901 }
7902
7903 res->data=(char*)ll;
7904 return FALSE;
7905}
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 8976 of file iparith.cc.

8977{
8978 assume( e->Typ()==INT_CMD );
8980 r->start =(int)(long)e->Data();
8981 return r;
8982}
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 6950 of file iparith.cc.

6951{
6952 int mi=(int)(long)v->Data();
6953 int ni=(int)(long)w->Data();
6954 if ((mi<1)||(ni<1))
6955 {
6956 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6957 return TRUE;
6958 }
6959 matrix m=mpNew(mi,ni);
6961 int i=si_min(IDELEMS(I),mi*ni);
6962 //for(i=i-1;i>=0;i--)
6963 //{
6964 // m->m[i]=I->m[i];
6965 // I->m[i]=NULL;
6966 //}
6967 memcpy(m->m,I->m,i*sizeof(poly));
6968 memset(I->m,0,i*sizeof(poly));
6970 res->data = (char *)m;
6971 return FALSE;
6972}

◆ jjMATRIX_Ma()

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

Definition at line 6986 of file iparith.cc.

6987{
6988 int mi=(int)(long)v->Data();
6989 int ni=(int)(long)w->Data();
6990 if ((mi<1)||(ni<1))
6991 {
6992 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6993 return TRUE;
6994 }
6995 matrix m=mpNew(mi,ni);
6997 int r=si_min(MATROWS(I),mi);
6998 int c=si_min(MATCOLS(I),ni);
6999 int i,j;
7000 for(i=r;i>0;i--)
7001 {
7002 for(j=c;j>0;j--)
7003 {
7004 MATELEM(m,i,j)=MATELEM(I,i,j);
7005 MATELEM(I,i,j)=NULL;
7006 }
7007 }
7009 res->data = (char *)m;
7010 return FALSE;
7011}

◆ jjMATRIX_Mo()

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

Definition at line 6973 of file iparith.cc.

6974{
6975 int mi=(int)(long)v->Data();
6976 int ni=(int)(long)w->Data();
6977 if ((mi<0)||(ni<1))
6978 {
6979 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6980 return TRUE;
6981 }
6982 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6983 mi,ni,currRing);
6984 return FALSE;
6985}

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv res,
leftv v )
static

Definition at line 4704 of file iparith.cc.

4705{
4706 // clean out "_":
4708 // collect all info:
4709 omUpdateInfo();
4710 switch(((int)(long)v->Data()))
4711 {
4712 case 0:
4713 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4714 break;
4715 case 1:
4716 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4717 break;
4718 case 2:
4719 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4720 break;
4721 default:
4725 res->data = (char *)0;
4726 res->rtyp = NONE;
4727 }
4728 return FALSE;
4729}
omInfo_t om_Info
Definition omStats.c:16
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
#define NONE
Definition tok.h:223
#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 6398 of file iparith.cc.

6399{
6400 /* Here's the use pattern for the minor command:
6401 minor ( matrix_expression m, int_expression minorSize,
6402 optional ideal_expression IasSB, optional int_expression k,
6403 optional string_expression algorithm,
6404 optional int_expression cachedMinors,
6405 optional int_expression cachedMonomials )
6406 This method here assumes that there are at least two arguments.
6407 - If IasSB is present, it must be a std basis. All minors will be
6408 reduced w.r.t. IasSB.
6409 - If k is absent, all non-zero minors will be computed.
6410 If k is present and k > 0, the first k non-zero minors will be
6411 computed.
6412 If k is present and k < 0, the first |k| minors (some of which
6413 may be zero) will be computed.
6414 If k is present and k = 0, an error is reported.
6415 - If algorithm is absent, all the following arguments must be absent too.
6416 In this case, a heuristic picks the best-suited algorithm (among
6417 Bareiss, Laplace, and Laplace with caching).
6418 If algorithm is present, it must be one of "Bareiss", "bareiss",
6419 "Laplace", "laplace", "Cache", "cache". In the cases "Cache" and
6420 "cache" two more arguments may be given, determining how many entries
6421 the cache may have at most, and how many cached monomials there are at
6422 most. (Cached monomials are counted over all cached polynomials.)
6423 If these two additional arguments are not provided, 200 and 100000
6424 will be used as defaults.
6425 */
6426 matrix m;
6427 leftv u=v->next;
6428 v->next=NULL;
6429 int v_typ=v->Typ();
6430 if (v_typ==MATRIX_CMD)
6431 {
6432 m = (matrix)v->Data();
6433 }
6434 else
6435 {
6436 if (v_typ==0)
6437 {
6438 Werror("`%s` is undefined",v->Fullname());
6439 return TRUE;
6440 }
6441 // try to convert to MATRIX:
6443 BOOLEAN bo;
6444 sleftv tmp;
6445 if (ii>0) bo=iiConvert(v_typ,MATRIX_CMD,ii,v,&tmp);
6446 else bo=TRUE;
6447 if (bo)
6448 {
6449 Werror("cannot convert %s to matrix",Tok2Cmdname(v_typ));
6450 return TRUE;
6451 }
6452 m=(matrix)tmp.data;
6453 }
6454 const int mk = (int)(long)u->Data();
6455 bool noIdeal = true; bool noK = true; bool noAlgorithm = true;
6456 bool noCacheMinors = true; bool noCacheMonomials = true;
6457 ideal IasSB; int k; char* algorithm; int cacheMinors; int cacheMonomials;
6458
6459 /* here come the different cases of correct argument sets */
6460 if ((u->next != NULL) && (u->next->Typ() == IDEAL_CMD))
6461 {
6462 IasSB = (ideal)u->next->Data();
6463 noIdeal = false;
6464 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6465 {
6466 k = (int)(long)u->next->next->Data();
6467 noK = false;
6468 if ((u->next->next->next != NULL) &&
6469 (u->next->next->next->Typ() == STRING_CMD))
6470 {
6471 algorithm = (char*)u->next->next->next->Data();
6472 noAlgorithm = false;
6473 if ((u->next->next->next->next != NULL) &&
6474 (u->next->next->next->next->Typ() == INT_CMD))
6475 {
6476 cacheMinors = (int)(long)u->next->next->next->next->Data();
6477 noCacheMinors = false;
6478 if ((u->next->next->next->next->next != NULL) &&
6479 (u->next->next->next->next->next->Typ() == INT_CMD))
6480 {
6482 (int)(long)u->next->next->next->next->next->Data();
6483 noCacheMonomials = false;
6484 }
6485 }
6486 }
6487 }
6488 }
6489 else if ((u->next != NULL) && (u->next->Typ() == INT_CMD))
6490 {
6491 k = (int)(long)u->next->Data();
6492 noK = false;
6493 if ((u->next->next != NULL) && (u->next->next->Typ() == STRING_CMD))
6494 {
6495 algorithm = (char*)u->next->next->Data();
6496 noAlgorithm = false;
6497 if ((u->next->next->next != NULL) &&
6498 (u->next->next->next->Typ() == INT_CMD))
6499 {
6500 cacheMinors = (int)(long)u->next->next->next->Data();
6501 noCacheMinors = false;
6502 if ((u->next->next->next->next != NULL) &&
6503 (u->next->next->next->next->Typ() == INT_CMD))
6504 {
6505 cacheMonomials = (int)(long)u->next->next->next->next->Data();
6506 noCacheMonomials = false;
6507 }
6508 }
6509 }
6510 }
6511 else if ((u->next != NULL) && (u->next->Typ() == STRING_CMD))
6512 {
6513 algorithm = (char*)u->next->Data();
6514 noAlgorithm = false;
6515 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6516 {
6517 cacheMinors = (int)(long)u->next->next->Data();
6518 noCacheMinors = false;
6519 if ((u->next->next->next != NULL) &&
6520 (u->next->next->next->Typ() == INT_CMD))
6521 {
6522 cacheMonomials = (int)(long)u->next->next->next->Data();
6523 noCacheMonomials = false;
6524 }
6525 }
6526 }
6527
6528 /* upper case conversion for the algorithm if present */
6529 if (!noAlgorithm)
6530 {
6531 if (strcmp(algorithm, "bareiss") == 0)
6532 algorithm = (char*)"Bareiss";
6533 if (strcmp(algorithm, "laplace") == 0)
6534 algorithm = (char*)"Laplace";
6535 if (strcmp(algorithm, "cache") == 0)
6536 algorithm = (char*)"Cache";
6537 }
6538
6539 v->next=u;
6540 /* here come some tests */
6541 if (!noIdeal)
6542 {
6543 assumeStdFlag(u->next);
6544 }
6545 if ((!noK) && (k == 0))
6546 {
6547 WerrorS("Provided number of minors to be computed is zero.");
6548 return TRUE;
6549 }
6550 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") != 0)
6551 && (strcmp(algorithm, "Laplace") != 0)
6552 && (strcmp(algorithm, "Cache") != 0))
6553 {
6554 WerrorS("Expected as algorithm one of 'B/bareiss', 'L/laplace', or 'C/cache'.");
6555 return TRUE;
6556 }
6557 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") == 0)
6559 {
6560 Werror("Bareiss algorithm not defined over coefficient rings %s",
6561 "with zero divisors.");
6562 return TRUE;
6563 }
6564 if ((mk < 1) || (mk > m->rows()) || (mk > m->cols()))
6565 {
6566 ideal I=idInit(1,1);
6567 if (mk<1) I->m[0]=p_One(currRing);
6568 //Werror("invalid size of minors: %d (matrix is (%d x %d))", mk,
6569 // m->rows(), m->cols());
6570 res->data=(void*)I;
6571 return FALSE;
6572 }
6573 if ((!noAlgorithm) && (strcmp(algorithm, "Cache") == 0)
6575 {
6576 cacheMinors = 200;
6577 cacheMonomials = 100000;
6578 }
6579
6580 /* here come the actual procedure calls */
6581 if (noAlgorithm)
6582 res->data = getMinorIdealHeuristic(m, mk, (noK ? 0 : k),
6583 (noIdeal ? 0 : IasSB), false);
6584 else if (strcmp(algorithm, "Cache") == 0)
6585 res->data = getMinorIdealCache(m, mk, (noK ? 0 : k),
6586 (noIdeal ? 0 : IasSB), 3, cacheMinors,
6588 else
6589 res->data = getMinorIdeal(m, mk, (noK ? 0 : k), algorithm,
6590 (noIdeal ? 0 : IasSB), false);
6591 if (v_typ!=MATRIX_CMD) idDelete((ideal *)&m);
6592 return FALSE;
6593}
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.
return false
Definition cfModGcd.cc:85
poly p_One(const ring r)
Definition p_polys.cc:1316

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv res,
leftv v )
static

Definition at line 4755 of file iparith.cc.

4756{
4757 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4758
4759 syStrategy tmp=syCopy((syStrategy)v->Data());
4760 tmp = syMinimize(tmp); // enrich itself!
4761
4762 res->data=(char *)tmp;
4763
4764 if (weights!=NULL)
4765 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4766
4767 return FALSE;
4768}
syStrategy syMinimize(syStrategy syzstr)
Definition syz1.cc:2393
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1885

◆ 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 int pLength(poly a)
Definition p_polys.h:190
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:284

◆ 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 long aa=(long)ap;
885 long bb=(long)bp;
886 long cc=aa-bb;
887 unsigned long a=(unsigned long)ap;
888 unsigned long b=(unsigned long)bp;
889 unsigned long c=a-b;
890 if (((Sy_bitL(bit31)&a)!=(Sy_bitL(bit31)&b))&&((Sy_bitL(bit31)&a)!=(Sy_bitL(bit31)&c)))
891 {
892 WarnS("int overflow(-), result may be wrong");
893 }
894 res->data = (char *)cc;
895 return jjPLUSMINUS_Gen(res,u,v);
896}
#define bit31
Definition iparith.cc:124
Definition ap.h:40
#define Sy_bitL(x)
Definition options.h:32

◆ 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:297

◆ 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:189
#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:1874

◆ 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 2701 of file iparith.cc.

2702{
2703 number q=(number)v->Data();
2704 if (n_IsZero(q,coeffs_BIGINT))
2705 {
2707 return TRUE;
2708 }
2709 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2710 return FALSE;
2711}
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:632

◆ jjMOD_N()

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

Definition at line 2712 of file iparith.cc.

2713{
2714 number q=(number)v->Data();
2715 if (nIsZero(q))
2716 {
2718 return TRUE;
2719 }
2720 res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2721 return FALSE;
2722}

◆ jjMOD_P()

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

Definition at line 2723 of file iparith.cc.

2724{
2725 poly q=(poly)v->Data();
2726 if (q==NULL)
2727 {
2729 return TRUE;
2730 }
2731 poly p=(poly)(u->Data());
2732 if (p==NULL)
2733 {
2734 res->data=NULL;
2735 return FALSE;
2736 }
2737 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2738 q /*(poly)(v->Data())*/ ,currRing));
2739 return FALSE;
2740}
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 2648 of file iparith.cc.

2649{
2650 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2652 if (w_u!=NULL)
2653 {
2654 //PrintS("modulo: wu:");w_u->show(INTVEC_CMD);PrintLn();
2655 w_u=ivCopy(w_u);
2656 hom=isHomog;
2657 }
2658 //else PrintS("modulo: wu:none\n");
2659 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2660 if (w_v!=NULL)
2661 {
2662 //PrintS("modulo: wv:");w_v->show(INTVEC_CMD);PrintLn();
2663 w_v=ivCopy(w_v);
2664 hom=isHomog;
2665 }
2666 //else PrintS("modulo: wv:none\n");
2667 if ((w_u!=NULL) && (w_v==NULL))
2668 w_v=ivCopy(w_u);
2669 if ((w_v!=NULL) && (w_u==NULL))
2670 w_u=ivCopy(w_v);
2671 ideal u_id=(ideal)u->Data();
2672 ideal v_id=(ideal)v->Data();
2673 if (w_u!=NULL)
2674 {
2675 if ((*w_u).compare((w_v))!=0)
2676 {
2677 WarnS("incompatible weights");
2678 delete w_u; w_u=NULL;
2679 hom=testHomog;
2680 }
2681 else
2682 {
2683 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2684 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2685 {
2686 WarnS("wrong weights");
2687 delete w_u; w_u=NULL;
2688 hom=testHomog;
2689 }
2690 }
2691 }
2692 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2693 if (w_u!=NULL)
2694 {
2695 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2696 }
2697 delete w_v;
2698 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2699 return FALSE;
2700}
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w, matrix *T, GbVariant alg)
Definition ideals.cc:2422
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 7012 of file iparith.cc.

7013{
7014 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
7015 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7017 if (w_u!=NULL)
7018 {
7019 w_u=ivCopy(w_u);
7020 hom=isHomog;
7021 }
7022 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
7023 if (w_v!=NULL)
7024 {
7025 w_v=ivCopy(w_v);
7026 hom=isHomog;
7027 }
7028 if ((w_u!=NULL) && (w_v==NULL))
7029 w_v=ivCopy(w_u);
7030 if ((w_v!=NULL) && (w_u==NULL))
7031 w_u=ivCopy(w_v);
7032 ideal u_id=(ideal)u->Data();
7033 ideal v_id=(ideal)v->Data();
7034 if (w_u!=NULL)
7035 {
7036 if ((*w_u).compare((w_v))!=0)
7037 {
7038 WarnS("incompatible weights");
7039 delete w_u; w_u=NULL;
7040 hom=testHomog;
7041 }
7042 else
7043 {
7044 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7045 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7046 {
7047 WarnS("wrong weights");
7048 delete w_u; w_u=NULL;
7049 hom=testHomog;
7050 }
7051 }
7052 }
7053 idhdl h=(idhdl)w->data;
7054 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
7055 if (w_u!=NULL)
7056 {
7057 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7058 }
7059 delete w_v;
7060 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7061 return FALSE;
7062}

◆ jjMODULO3S()

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

Definition at line 7063 of file iparith.cc.

7064{
7065 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
7066 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7068 if (w_u!=NULL)
7069 {
7070 w_u=ivCopy(w_u);
7071 hom=isHomog;
7072 }
7073 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
7074 if (w_v!=NULL)
7075 {
7076 w_v=ivCopy(w_v);
7077 hom=isHomog;
7078 }
7079 if ((w_u!=NULL) && (w_v==NULL))
7080 w_v=ivCopy(w_u);
7081 if ((w_v!=NULL) && (w_u==NULL))
7082 w_u=ivCopy(w_v);
7083 ideal u_id=(ideal)u->Data();
7084 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
7085 ideal v_id=(ideal)v->Data();
7086 if (w_u!=NULL)
7087 {
7088 if ((*w_u).compare((w_v))!=0)
7089 {
7090 WarnS("incompatible weights");
7091 delete w_u; w_u=NULL;
7092 hom=testHomog;
7093 }
7094 else
7095 {
7096 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7097 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7098 {
7099 WarnS("wrong weights");
7100 delete w_u; w_u=NULL;
7101 hom=testHomog;
7102 }
7103 }
7104 }
7105 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
7106 if (w_u!=NULL)
7107 {
7108 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7109 }
7110 delete w_v;
7111 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7112 return FALSE;
7113}

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv res,
leftv u )
static

Definition at line 8308 of file iparith.cc.

8309{
8310 leftv v=u->next;
8311 leftv w=v->next;
8312 leftv u4=w->next;
8313 GbVariant alg;
8314 ideal u_id,v_id;
8315 // we have 4 arguments
8316 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8317 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8318 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8319 {
8320 u_id=(ideal)u->Data();
8321 v_id=(ideal)v->Data();
8322 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8323 }
8324 else
8325 {
8326 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8327 return TRUE;
8328 }
8329 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8331 if (w_u!=NULL)
8332 {
8333 w_u=ivCopy(w_u);
8334 hom=isHomog;
8335 }
8336 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8337 if (w_v!=NULL)
8338 {
8339 w_v=ivCopy(w_v);
8340 hom=isHomog;
8341 }
8342 if ((w_u!=NULL) && (w_v==NULL))
8343 w_v=ivCopy(w_u);
8344 if ((w_v!=NULL) && (w_u==NULL))
8345 w_u=ivCopy(w_v);
8346 if (w_u!=NULL)
8347 {
8348 if ((*w_u).compare((w_v))!=0)
8349 {
8350 WarnS("incompatible weights");
8351 delete w_u; w_u=NULL;
8352 hom=testHomog;
8353 }
8354 else
8355 {
8356 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8357 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8358 {
8359 WarnS("wrong weights");
8360 delete w_u; w_u=NULL;
8361 hom=testHomog;
8362 }
8363 }
8364 }
8365 idhdl h=(idhdl)w->data;
8366 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8367 if (w_u!=NULL)
8368 {
8369 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8370 }
8371 delete w_v;
8372 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8373 return FALSE;
8374}

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv res,
leftv v )
static

Definition at line 2742 of file iparith.cc.

2743{
2744 return jjMONITOR2(res,v,NULL);
2745}
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition iparith.cc:2746

◆ jjMONITOR2()

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

Definition at line 2746 of file iparith.cc.

2747{
2748#if 0
2749 char *opt=(char *)v->Data();
2750 int mode=0;
2751 while(*opt!='\0')
2752 {
2753 if (*opt=='i') mode |= SI_PROT_I;
2754 else if (*opt=='o') mode |= SI_PROT_O;
2755 opt++;
2756 }
2757 monitor((char *)(u->Data()),mode);
2758#else
2759 si_link l=(si_link)u->Data();
2760 if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2761 if(strcmp(l->m->type,"ASCII")!=0)
2762 {
2763 Werror("ASCII link required, not `%s`",l->m->type);
2764 slClose(l);
2765 return TRUE;
2766 }
2767 SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2768 if ( l->name[0]!='\0') // "" is the stop condition
2769 {
2770 const char *opt;
2771 int mode=0;
2772 if (v==NULL) opt=(const char*)"i";
2773 else opt=(const char *)v->Data();
2774 while(*opt!='\0')
2775 {
2776 if (*opt=='i') mode |= SI_PROT_I;
2777 else if (*opt=='o') mode |= SI_PROT_O;
2778 opt++;
2779 }
2780 monitor((FILE *)l->data,mode);
2781 }
2782 else
2783 monitor(NULL,0);
2784 return FALSE;
2785#endif
2786}
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 2787 of file iparith.cc.

2788{
2789 intvec *iv=(intvec *)v->Data();
2790 poly p=pOne();
2791 int e;
2792 BOOLEAN err=FALSE;
2793 for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2794 {
2795 e=(*iv)[i-1];
2796 if (e>=0) pSetExp(p,i,e);
2797 else err=TRUE;
2798 }
2799 if (iv->length()==(currRing->N+1))
2800 {
2801 res->rtyp=VECTOR_CMD;
2802 e=(*iv)[currRing->N];
2803 if (e>=0) pSetComp(p,e);
2804 else err=TRUE;
2805 }
2806 pSetm(p);
2807 res->data=(char*)p;
2808 if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2809 return err;
2810}

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv res,
leftv v )
static

Definition at line 5737 of file iparith.cc.

5738{
5739 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5740 return FALSE;
5741}
poly mp_Trace(matrix a, const ring R)
Definition matpol.cc:268

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv res,
leftv v )
static

Definition at line 5742 of file iparith.cc.

5743{
5744 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5745 return FALSE;
5746}
matrix mp_Transp(matrix a, const ring R)
Definition matpol.cc:247

◆ jjMRES_MAP()

static BOOLEAN jjMRES_MAP ( leftv res,
leftv u,
leftv v,
leftv ma )
static

Definition at line 6594 of file iparith.cc.

6595{
6596 if ((ma->rtyp!=IDHDL)||(ma->e!=NULL))
6597 {
6598 WerrorS("3rd argument must have a name");
6599 return TRUE;
6600 }
6601 int maxl=(int)(long)v->Data();
6602 if (maxl<0)
6603 {
6604 WerrorS("length for res must not be negative");
6605 return TRUE;
6606 }
6607 syStrategy r;
6608 intvec *weights=NULL;
6609 int wmaxl=maxl;
6610 ideal u_id=(ideal)u->Data();
6611
6612 maxl--;
6613 if (/*(*/ maxl==-1 /*)*/)
6614 {
6615 maxl = currRing->N-1+2;
6616 if (currRing->qideal!=NULL)
6617 {
6618 Warn(
6619 "full resolution in a qring may be infinite, setting max length to %d",
6620 maxl+1);
6621 }
6622 }
6623 weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6624 if (weights!=NULL)
6625 {
6626 if (!idTestHomModule(u_id,currRing->qideal,weights))
6627 {
6628 WarnS("wrong weights given:");weights->show();PrintLn();
6629 weights=NULL;
6630 }
6631 }
6632 intvec *ww=NULL;
6633 int add_row_shift=0;
6634 if (weights!=NULL)
6635 {
6636 ww=ivCopy(weights);
6637 add_row_shift = ww->min_in();
6638 (*ww) -= add_row_shift;
6639 }
6640 unsigned save_opt=si_opt_1;
6642 u_id=(ideal)u->CopyD();
6643 ideal mat;
6645 idhdl h=(idhdl)ma->data;
6646 idDelete(&IDIDEAL(h));
6647 IDIDEAL(h)=mat;
6648 if (r->list_length>wmaxl)
6649 {
6650 for(int i=wmaxl-1;i>=r->list_length;i--)
6651 {
6652 if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
6653 if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
6654 }
6655 }
6656 r->list_length=wmaxl;
6657 res->data=(void *)r;
6658 if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
6659 if ((r->weights!=NULL) && (r->weights[0]!=NULL))
6660 {
6661 ww=ivCopy(r->weights[0]);
6662 if (weights!=NULL) (*ww) += add_row_shift;
6663 atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
6664 }
6665 else
6666 {
6667 if (weights!=NULL)
6668 {
6669 atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
6670 }
6671 }
6672 assume( (r->syRing != NULL) == (r->resPairs != NULL) );
6673 assume( (r->minres != NULL) || (r->fullres != NULL) );
6675 return FALSE;
6676}
void show(int mat=0, int spaces=0) const
Definition intvec.cc:149
#define IDIDEAL(a)
Definition ipid.h:133
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_REDTAIL_SYZ
Definition options.h:87
#define Sy_bit(x)
Definition options.h:31
syStrategy syMres_with_map(ideal arg, int maxlength, intvec *w, ideal &trans)
Definition syz.cc:1176
ring syRing
Definition syz.h:56
resolvente minres
Definition syz.h:58
short list_length
Definition syz.h:62
intvec ** weights
Definition syz.h:45
SRes resPairs
Definition syz.h:49

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv res,
leftv v )
static

Definition at line 4734 of file iparith.cc.

4735{
4736 int t=v->Typ();
4737 ideal r,m;
4738 r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4740 l->Init(2);
4741 l->m[0].rtyp=t;
4742 l->m[0].data=(char *)r;
4743 setFlag(&(l->m[0]),FLAG_STD);
4744 l->m[1].rtyp=t;
4745 l->m[1].data=(char *)m;
4746 res->data=(char *)l;
4747 return FALSE;
4748}
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition kstd1.cc:3085

◆ jjMULT()

static BOOLEAN jjMULT ( leftv res,
leftv v )
static

Definition at line 4749 of file iparith.cc.

4750{
4752 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4753 return FALSE;
4754}
int scMultInt(ideal S, ideal Q)
Definition hdegree.cc:903

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv res,
leftv v )
static

Definition at line 4769 of file iparith.cc.

4770{
4771 number n,i; i=(number)v->Data();
4773 if (nMap!=NULL)
4775 else goto err;
4776 res->data=(void *)n;
4777 return FALSE;
4778err:
4779 WerrorS("cannot convert to bigint"); return TRUE;
4780}

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv res,
leftv v )
static

Definition at line 4781 of file iparith.cc.

4782{
4783 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4784 res->data=omStrDup(v->name);
4785 else if (v->name==NULL)
4786 res->data=omStrDup("");
4787 else
4788 {
4789 res->data = (char *)v->name;
4790 v->name=NULL;
4791 }
4792 return FALSE;
4793}

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv res,
leftv v )
static

Definition at line 4794 of file iparith.cc.

4795{
4796 res->data=ipNameList(((ring)v->Data())->idroot);
4797 return FALSE;
4798}
lists ipNameList(idhdl root)
Definition ipid.cc:606

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv res,
leftv  )
static

Definition at line 8375 of file iparith.cc.

8376{
8377 res->data=(void *)ipNameList(IDROOT);
8378 return FALSE;
8379}

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv res,
leftv v )
static

Definition at line 4799 of file iparith.cc.

4800{
4801 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4802 return FALSE;
4803}
lists ipNameListLev(idhdl root, int lev)
Definition ipid.cc:629

◆ jjNEWSTRUCT2()

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

Definition at line 2811 of file iparith.cc.

2812{
2813 // u: the name of the new type
2814 // v: the elements
2815 const char *s=(const char *)u->Data();
2817 if (strlen(s)>=2)
2818 {
2819 d=newstructFromString((const char *)v->Data());
2820 if (d!=NULL) newstruct_setup(s,d);
2821 }
2822 else WerrorS("name of newstruct must be longer than 1 character");
2823 return d==NULL;
2824}
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 6677 of file iparith.cc.

6678{
6679 // u: the name of the new type
6680 // v: the parent type
6681 // w: the elements
6682 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6683 (const char *)w->Data());
6684 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6685 return (d==NULL);
6686}
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 5777 of file iparith.cc.

5778{
5779 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5780 res->data=(char *)(long)iin_Int(n,currRing->cf);
5781 n_Delete(&n,currRing->cf);
5782 return FALSE;
5783}

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv res,
leftv u )
static

Definition at line 5784 of file iparith.cc.

5785{
5786 number n=(number)u->Data();
5787 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5788 return FALSE;
5789}

◆ jjNOT()

static BOOLEAN jjNOT ( leftv res,
leftv v )
static

Definition at line 4804 of file iparith.cc.

4805{
4806 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4807 return FALSE;
4808}

◆ jjNULL()

static BOOLEAN jjNULL ( leftv ,
leftv  )
static

Definition at line 3784 of file iparith.cc.

3785{
3786 return FALSE;
3787}

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv res,
leftv v )
static

Return the numerator of the input number.

Definition at line 4090 of file iparith.cc.

4091{
4092 number n = reinterpret_cast<number>(v->CopyD());
4093 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
4094 n_Delete(&n,currRing->cf);
4095 return FALSE;
4096}
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:612

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv res,
leftv v )
static

Definition at line 4809 of file iparith.cc.

4810{
4811 res->data = (char *)(long)(((ring)(v->Data()))->N);
4812 return FALSE;
4813}

◆ jjOP_BI_BIM()

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

Definition at line 279 of file iparith.cc.

280{
281 return jjOP_BIM_BI(res, v, u);
282}
static BOOLEAN jjOP_BIM_BI(leftv res, leftv u, leftv v)
Definition iparith.cc:266

◆ jjOP_BIM_BI()

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

Definition at line 266 of file iparith.cc.

267{
268 bigintmat* aa= (bigintmat *)u->Data();
269 number bb = (number)(v->Data());
270 if (errorreported) return TRUE;
272 switch (iiOp)
273 {
274 case '*': cc=bimMult(aa,bb,coeffs_BIGINT); break;
275 }
276 res->data=(char *)cc;
277 return cc==NULL;
278}
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 247 of file iparith.cc.

248{
249 bigintmat* aa= (bigintmat *)u->Data();
250 long bb = (long)(v->Data());
251 if (errorreported) return TRUE;
253 switch (iiOp)
254 {
255 case '+': cc=bimAdd(aa,bb); break;
256 case '-': cc=bimSub(aa,bb); break;
257 case '*': cc=bimMult(aa,bb); break;
258 }
259 res->data=(char *)cc;
260 return cc==NULL;
261}
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 262 of file iparith.cc.

263{
264 return jjOP_BIM_I(res, v, u);
265}
static BOOLEAN jjOP_BIM_I(leftv res, leftv u, leftv v)
Definition iparith.cc:247

◆ jjOP_I_IM()

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

Definition at line 319 of file iparith.cc.

320{
321 return jjOP_IM_I(res,v,u);
322}
static BOOLEAN jjOP_IM_I(leftv res, leftv u, leftv v)
Definition iparith.cc:304

◆ jjOP_I_IV()

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

Definition at line 300 of file iparith.cc.

301{
302 return jjOP_IV_I(res,v,u);
303}
static BOOLEAN jjOP_IV_I(leftv res, leftv u, leftv v)
Definition iparith.cc:283

◆ jjOP_IM_I()

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

Definition at line 304 of file iparith.cc.

305{
307 int bb = (int)(long)(v->Data());
308 int i=si_min(aa->rows(),aa->cols());
309 switch (iiOp)
310 {
311 case '+': for (;i>0;i--) IMATELEM(*aa,i,i) += bb;
312 break;
313 case '-': for (;i>0;i--) IMATELEM(*aa,i,i) -= bb;
314 break;
315 }
316 res->data=(char *)aa;
317 return FALSE;
318}
#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 283 of file iparith.cc.

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

◆ 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 4814 of file iparith.cc.

4815{
4816 si_link l=(si_link)v->Data();
4817 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4818 else { slPrepClose(l); return slClose(l);}
4819}
@ OPEN_CMD
Definition tok.h:145

◆ jjOPPOSE()

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

Definition at line 2990 of file iparith.cc.

2991{
2992 /* number, poly, vector, ideal, module, matrix */
2993 ring r = (ring)a->Data();
2994 if (r == currRing)
2995 {
2996 res->data = b->Data();
2997 res->rtyp = b->rtyp;
2998 return FALSE;
2999 }
3000 if (!rIsLikeOpposite(currRing, r))
3001 {
3002 Werror("%s is not an opposite ring to current ring",a->Fullname());
3003 return TRUE;
3004 }
3005 idhdl w;
3006 if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
3007 {
3008 int argtype = IDTYP(w);
3009 switch (argtype)
3010 {
3011 case NUMBER_CMD:
3012 {
3013 /* since basefields are equal, we can apply nCopy */
3014 res->data = nCopy((number)IDDATA(w));
3015 res->rtyp = argtype;
3016 break;
3017 }
3018 case POLY_CMD:
3019 case VECTOR_CMD:
3020 {
3021 poly q = (poly)IDDATA(w);
3022 res->data = pOppose(r,q,currRing);
3023 res->rtyp = argtype;
3024 break;
3025 }
3026 case IDEAL_CMD:
3027 case MODUL_CMD:
3028 {
3029 ideal Q = (ideal)IDDATA(w);
3030 res->data = idOppose(r,Q,currRing);
3031 res->rtyp = argtype;
3032 break;
3033 }
3034 case MATRIX_CMD:
3035 {
3036 ring save = currRing;
3037 rChangeCurrRing(r);
3038 matrix m = (matrix)IDDATA(w);
3041 ideal S = idOppose(r,Q,currRing);
3042 id_Delete(&Q, r);
3043 res->data = id_Module2Matrix(S,currRing);
3044 res->rtyp = argtype;
3045 break;
3046 }
3047 default:
3048 {
3049 WerrorS("unsupported type in oppose");
3050 return TRUE;
3051 }
3052 }
3053 }
3054 else
3055 {
3056 Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
3057 return TRUE;
3058 }
3059 return FALSE;
3060}
@ NUMBER_CMD
Definition grammar.cc:289
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
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 5314 of file iparith.cc.

5315{
5316#ifdef HAVE_PLURAL
5317 ring r = (ring)a->Data();
5318 //if (rIsPluralRing(r))
5319 if (r->OrdSgn==1)
5320 {
5321 res->data = rOpposite(r);
5322 }
5323 else
5324 {
5325 WarnS("opposite only for global orderings");
5326 res->data = rCopy(r);
5327 }
5328 return FALSE;
5329#else
5330 return TRUE;
5331#endif
5332}
ring rOpposite(ring src)
Definition ring.cc:5365

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv res,
leftv v )
static

Definition at line 8380 of file iparith.cc.

8381{
8382 if(v==NULL)
8383 {
8384 res->data=(char *)showOption();
8385 return FALSE;
8386 }
8387 res->rtyp=NONE;
8388 return setOption(res,v);
8389}
BOOLEAN setOption(leftv res, leftv v)
Definition misc_ip.cc:568
char * showOption()
Definition misc_ip.cc:709

◆ 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 4820 of file iparith.cc.

4821{
4822 poly p=(poly)v->Data();
4823 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4824 return FALSE;
4825}

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv res,
leftv v )
static

Definition at line 4866 of file iparith.cc.

4867{
4868 poly p=(poly)v->Data();
4869 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4870 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4871 {
4872 WerrorS("poly must be constant");
4873 return TRUE;
4874 }
4876 number n;
4878 if (nMap!=NULL)
4880 else goto err;
4881 res->data=(void *)n;
4882 return FALSE;
4883err:
4884 WerrorS("cannot convert to bigint"); return TRUE;
4885}

◆ jjP2I()

static BOOLEAN jjP2I ( leftv res,
leftv v )
static

Definition at line 4886 of file iparith.cc.

4887{
4888 poly p=(poly)v->Data();
4889 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4890 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4891 {
4892 WerrorS("poly must be constant");
4893 return TRUE;
4894 }
4895 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4896 return FALSE;
4897}

◆ jjP2N()

static BOOLEAN jjP2N ( leftv res,
leftv v )
static

Definition at line 4934 of file iparith.cc.

4935{
4936 number n;
4937 poly p;
4938 if (((p=(poly)v->Data())!=NULL)
4939 && (pIsConstant(p)))
4940 {
4941 n=nCopy(pGetCoeff(p));
4942 }
4943 else
4944 {
4945 n=nInit(0);
4946 }
4947 res->data = (char *)n;
4948 return FALSE;
4949}

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv res,
leftv v )
static

Definition at line 4826 of file iparith.cc.

4827{
4828 int i=(int)(long)v->Data();
4829 int p=0;
4830 p=rPar(currRing);
4831 if ((0<i) && (i<=p))
4832 {
4833 res->data=(char *)n_Param(i,currRing);
4834 }
4835 else
4836 {
4837 Werror("par number %d out of range 1..%d",i,p);
4838 return TRUE;
4839 }
4840 return FALSE;
4841}
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:787

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv res,
leftv v )
static

Definition at line 4842 of file iparith.cc.

4843{
4844 number nn=(number)v->Data();
4845 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4846 return FALSE;
4847}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition coeffs.h:774

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv res,
leftv v )
static

Definition at line 4848 of file iparith.cc.

4849{
4850 if (currRing==NULL)
4851 {
4852 WerrorS("no ring active (1)");
4853 return TRUE;
4854 }
4855 int i=(int)(long)v->Data();
4856 int p=0;
4857 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4858 res->data=omStrDup(rParameter(currRing)[i-1]);
4859 else
4860 {
4861 Werror("par number %d out of range 1..%d",i,p);
4862 return TRUE;
4863 }
4864 return FALSE;
4865}

◆ jjPARSTR2()

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

Definition at line 2825 of file iparith.cc.

2826{
2827 idhdl h=(idhdl)u->data;
2828 int i=(int)(long)v->Data();
2829 int p=0;
2830 if ((0<i)
2831 && (rParameter(IDRING(h))!=NULL)
2832 && (i<=(p=rPar(IDRING(h)))))
2833 res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2834 else
2835 {
2836 Werror("par number %d out of range 1..%d",i,p);
2837 return TRUE;
2838 }
2839 return FALSE;
2840}
#define IDRING(a)
Definition ipid.h:127

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv res,
leftv v )
static

Definition at line 4656 of file iparith.cc.

4657{
4658 /* call method jjPFAC2 with second argument = 0 (meaning that no
4659 valid bound for the prime factors has been given) */
4660 sleftv tmp;
4661 tmp.Init();
4662 tmp.rtyp = INT_CMD;
4663 return jjPFAC2(res, v, &tmp);
4664}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition iparith.cc:3294

◆ jjPFAC2()

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

Definition at line 3294 of file iparith.cc.

3295{
3296 number n1; int i;
3297
3298 if ((u->Typ() == BIGINT_CMD) ||
3299 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3300 {
3301 n1 = (number)u->CopyD();
3302 }
3303 else if (u->Typ() == INT_CMD)
3304 {
3305 i = (int)(long)u->Data();
3307 }
3308 else
3309 {
3310 return TRUE;
3311 }
3312
3313 i = (int)(long)v->Data();
3314
3317 res->data = (char*)l;
3318 return FALSE;
3319}
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 5709 of file iparith.cc.

5710{
5711 res->data = (char *)pHead((poly)v->Data());
5712 return FALSE;
5713}

◆ jjpLength()

static BOOLEAN jjpLength ( leftv res,
leftv v )
static

Definition at line 5684 of file iparith.cc.

5685{
5686 res->data = (char *)(long)pLength((poly)v->Data());
5687 return FALSE;
5688}

◆ jjPlural_mat_mat()

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

Definition at line 2902 of file iparith.cc.

2903{
2904 if( currRing->qideal != NULL )
2905 {
2906 WerrorS("basering must NOT be a qring!");
2907 return TRUE;
2908 }
2909
2910 if (iiOp==NCALGEBRA_CMD)
2911 {
2912 return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2913 }
2914 else
2915 {
2916 ring r=rCopy(currRing);
2917 BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2918 res->data=r;
2919 return result;
2920 }
2921}
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,...
@ NCALGEBRA_CMD
Definition tok.h:138

◆ jjPlural_mat_poly()

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

Definition at line 2882 of file iparith.cc.

2883{
2884 if( currRing->qideal != NULL )
2885 {
2886 WerrorS("basering must NOT be a qring!");
2887 return TRUE;
2888 }
2889
2890 if (iiOp==NCALGEBRA_CMD)
2891 {
2892 return nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),currRing,false,true,false,currRing);
2893 }
2894 else
2895 {
2896 ring r=rCopy(currRing);
2897 BOOLEAN result=nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),r,false,true,false,currRing);
2898 res->data=r;
2899 return result;
2900 }
2901}

◆ jjPlural_num_mat()

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

Definition at line 2862 of file iparith.cc.

2863{
2864 if( currRing->qideal != NULL )
2865 {
2866 WerrorS("basering must NOT be a qring!");
2867 return TRUE;
2868 }
2869
2870 if (iiOp==NCALGEBRA_CMD)
2871 {
2872 return nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,currRing,false,true,false,currRing);
2873 }
2874 else
2875 {
2876 ring r=rCopy(currRing);
2877 BOOLEAN result=nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,r,false,true,false,currRing);
2878 res->data=r;
2879 return result;
2880 }
2881}

◆ jjPlural_num_poly()

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

Definition at line 2842 of file iparith.cc.

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

◆ 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:654

◆ 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 long a=(unsigned long)u->Data();
761 unsigned long b=(unsigned long)v->Data();
762 unsigned long c=a+b;
763 res->data = (char *)((long)c);
764 if (((Sy_bitL(bit31)&a)==(Sy_bitL(bit31)&b))&&((Sy_bitL(bit31)&a)!=(Sy_bitL(bit31)&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:172

◆ 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:106

◆ 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:1864

◆ 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;
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 3798 of file iparith.cc.

3799{
3800 if (IDTYP((idhdl)u->data)==INT_CMD)
3801 {
3802 int i=IDINT((idhdl)u->data);
3803 if (iiOp==PLUSPLUS) i++;
3804 else i--;
3805 IDDATA((idhdl)u->data)=(char *)(long)i;
3806 return FALSE;
3807 }
3808 return TRUE;
3809}
@ PLUSPLUS
Definition grammar.cc:274
#define IDINT(a)
Definition ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv res,
leftv v )
static

Definition at line 5732 of file iparith.cc.

5733{
5734 res->data = (char *)pMaxComp((poly)v->Data());
5735 return FALSE;
5736}

◆ 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:636
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 long b=(long)u->Data();
528 long e=(long)v->Data();
529 long 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 long 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 *)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 6687 of file iparith.cc.

6688{
6689 // handles preimage(r,phi,i) and kernel(r,phi)
6690 idhdl h;
6691 ring rr;
6692 map mapping;
6694
6695 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6696 {
6697 WerrorS("2nd/3rd arguments must have names");
6698 return TRUE;
6699 }
6700 rr=(ring)u->Data();
6701 const char *ring_name=u->Name();
6702 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6703 {
6704 if (h->typ==MAP_CMD)
6705 {
6706 mapping=IDMAP(h);
6707 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6708 if ((preim_ring==NULL)
6709 || (IDRING(preim_ring)!=currRing))
6710 {
6711 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6712 return TRUE;
6713 }
6714 }
6715 else if (h->typ==IDEAL_CMD)
6716 {
6717 mapping=IDMAP(h);
6718 }
6719 else
6720 {
6721 Werror("`%s` is no map nor ideal",IDID(h));
6722 return TRUE;
6723 }
6724 }
6725 else
6726 {
6727 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6728 return TRUE;
6729 }
6730 ideal image;
6731 if (kernel_cmd) image=idInit(1,1);
6732 else
6733 {
6734 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6735 {
6736 if (h->typ==IDEAL_CMD)
6737 {
6738 image=IDIDEAL(h);
6739 }
6740 else
6741 {
6742 Werror("`%s` is no ideal",IDID(h));
6743 return TRUE;
6744 }
6745 }
6746 else
6747 {
6748 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6749 return TRUE;
6750 }
6751 }
6752 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6753 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6754 {
6755 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6756 }
6757 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6758 if (kernel_cmd) idDelete(&image);
6759 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6760}
#define IDMAP(a)
Definition ipid.h:135
#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:767
@ KERNEL_CMD
Definition tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv res,
leftv v )
static

Definition at line 4898 of file iparith.cc.

4899{
4900 map mapping=(map)v->Data();
4901 syMake(res,omStrDup(mapping->preimage));
4902 return FALSE;
4903}

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv res,
leftv v )
static

Definition at line 4904 of file iparith.cc.

4905{
4906 int i = IsPrime((int)(long)(v->Data()));
4907 res->data = (char *)(long)(i > 1 ? i : 2);
4908 return FALSE;
4909}
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;
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}
package req_packhdl
Definition subexpr.h:106
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv args)
Definition iplib.cc:512
INST_VAR sleftv iiRETURNEXPR
Definition iplib.cc:482

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv res,
leftv u )
static

Definition at line 3875 of file iparith.cc.

3876{
3877 return jjPROC(res,u,NULL);
3878}
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 6072 of file iparith.cc.

6073{
6075 memcpy(v->next,w,sizeof(sleftv));
6076 w->Init();
6077 return jjPROC(res,u,v);
6078}

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv res,
leftv v )
static

Definition at line 4910 of file iparith.cc.

4911{
4912 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4913 ideal v_id=(ideal)v->Data();
4914 if (w!=NULL)
4915 {
4916 if (!idTestHomModule(v_id,currRing->qideal,w))
4917 {
4918 WarnS("wrong weights");
4919 w=NULL;
4920 // and continue at the non-homog case below
4921 }
4922 else
4923 {
4924 w=ivCopy(w);
4925 intvec **ww=&w;
4926 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4927 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4928 return FALSE;
4929 }
4930 }
4931 res->data = (char *)idMinEmbedding(v_id);
4932 return FALSE;
4933}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition ideals.cc:2814

◆ jjPRUNE_MAP()

static BOOLEAN jjPRUNE_MAP ( leftv res,
leftv v,
leftv ma )
static

Definition at line 3063 of file iparith.cc.

3064{
3065 if (ma->Typ()!=SMATRIX_CMD)
3066 {
3067 WerrorS("expected prune_map(`module`,`smatrix`)`");
3068 return TRUE;
3069 }
3070
3071 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
3072 ideal v_id=(ideal)v->Data();
3073 if (w!=NULL)
3074 {
3075 if (!idTestHomModule(v_id,currRing->qideal,w))
3076 {
3077 WarnS("wrong weights");
3078 w=NULL;
3079 // and continue at the non-homog case below
3080 }
3081 else
3082 {
3083 w=ivCopy(w);
3084 intvec **ww=&w;
3085 ideal mat;
3086 int *g=(int*)omAlloc(v_id->rank*sizeof(int));
3087 res->data = (char *)idMinEmbedding_with_map_v(v_id,ww,mat,g);
3088 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
3089 idhdl h=(idhdl)ma->data;
3090 idDelete(&IDIDEAL(h));
3091 IDIDEAL(h)=mat;
3092 for(int i=0;i<v_id->rank;i++) Print("v[%d]:%d ",i+1,g[i]); PrintLn();
3093 omFreeSize(g,v_id->rank*sizeof(int));
3094 return FALSE;
3095 }
3096 }
3097 ideal mat;
3098 int *g=(int*)omAlloc(v_id->rank*sizeof(int));
3099 res->data = (char *)idMinEmbedding_with_map_v(v_id,NULL,mat,g);
3100 for(int i=0;i<v_id->rank;i++) Print("v[%d]:%d ",i+1,g[i]); PrintLn();
3101 omFreeSize(g,v_id->rank*sizeof(int));
3102 idhdl h=(idhdl)ma->data;
3103 idDelete(&IDIDEAL(h));
3104 IDIDEAL(h)=mat;
3105 return FALSE;
3106}
ideal idMinEmbedding_with_map_v(ideal arg, intvec **w, ideal &trans, int *g)
Definition ideals.cc:2835

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv res,
leftv INPUT )
static

Definition at line 8854 of file iparith.cc.

8855{
8856 if ((INPUT->Typ() != MATRIX_CMD) ||
8857 (INPUT->next->Typ() != NUMBER_CMD) ||
8858 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8859 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8860 {
8861 WerrorS("expected (matrix, number, number, number) as arguments");
8862 return TRUE;
8863 }
8864 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8865 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8866 (number)(v->Data()),
8867 (number)(w->Data()),
8868 (number)(x->Data()));
8869 return FALSE;
8870}
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 3107 of file iparith.cc.

3108{
3109 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3110 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3111 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
3112 return FALSE;
3113}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition ideals.cc:1506

◆ jjRANDOM()

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

Definition at line 3114 of file iparith.cc.

3115{
3116 int i=(int)(long)u->Data();
3117 int j=(int)(long)v->Data();
3118 if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3119 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3120 return FALSE;
3121}
int siRand()
Definition sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6761 of file iparith.cc.

6762{
6763 int di, k;
6764 int i=(int)(long)u->Data();
6765 int r=(int)(long)v->Data();
6766 int c=(int)(long)w->Data();
6767 if ((r<=0) || (c<=0)) return TRUE;
6768 intvec *iv = new intvec(r, c, 0);
6769 if (iv->rows()==0)
6770 {
6771 delete iv;
6772 return TRUE;
6773 }
6774 if (i!=0)
6775 {
6776 if (i<0) i = -i;
6777 di = 2 * i + 1;
6778 for (k=0; k<iv->length(); k++)
6779 {
6780 (*iv)[k] = ((siRand() % di) - i);
6781 }
6782 }
6783 res->data = (char *)iv;
6784 return FALSE;
6785}

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv res,
leftv v )
static

Definition at line 4972 of file iparith.cc.

4973{
4974 matrix m =(matrix)v->Data();
4975 int rank = luRank(m, 0);
4976 res->data =(char *)(long)rank;
4977 return FALSE;
4978}
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 3122 of file iparith.cc.

3123{
3124 matrix m =(matrix)u->Data();
3125 int isRowEchelon = (int)(long)v->Data();
3126 if (isRowEchelon != 1) isRowEchelon = 0;
3127 int rank = luRank(m, isRowEchelon);
3128 res->data =(char *)(long)rank;
3129 return FALSE;
3130}

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv res,
leftv v )
static

Definition at line 5704 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv res,
leftv v )
static

Definition at line 4979 of file iparith.cc.

4980{
4981 return jjREAD2(res,v,NULL);
4982}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition iparith.cc:3131

◆ jjREAD2()

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

Definition at line 3131 of file iparith.cc.

3132{
3133 si_link l=(si_link)u->Data();
3134 leftv r=slRead(l,v);
3135 if (r==NULL)
3136 {
3137 const char *s;
3138 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3139 else s=sNoName_fe;
3140 Werror("cannot read from `%s`",s);
3141 return TRUE;
3142 }
3143 memcpy(res,r,sizeof(sleftv));
3145 return FALSE;
3146}

◆ jjREDUCE3_CID()

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

Definition at line 7206 of file iparith.cc.

7207{
7209 if (!idIsZeroDim((ideal)v->Data()))
7210 {
7211 Werror("`%s` must be 0-dimensional",v->Name());
7212 return TRUE;
7213 }
7214 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7215 (matrix)w->CopyD());
7216 return FALSE;
7217}
static BOOLEAN idIsZeroDim(ideal i)
Definition ideals.h:179
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2309

◆ jjREDUCE3_CP()

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

Definition at line 7194 of file iparith.cc.

7195{
7197 if (!idIsZeroDim((ideal)v->Data()))
7198 {
7199 Werror("`%s` must be 0-dimensional",v->Name());
7200 return TRUE;
7201 }
7202 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
7203 (poly)w->CopyD());
7204 return FALSE;
7205}

◆ jjREDUCE3_ID()

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

Definition at line 7225 of file iparith.cc.

7226{
7228 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
7229 0,(int)(long)w->Data());
7230 return FALSE;
7231}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3235

◆ jjREDUCE3_P()

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

Definition at line 7218 of file iparith.cc.

7219{
7221 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
7222 0,(int)(long)w->Data());
7223 return FALSE;
7224}

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv res,
leftv u )
static

Definition at line 8390 of file iparith.cc.

8391{
8392 leftv u1=u;
8393 leftv u2=u1->next;
8394 leftv u3=u2->next;
8395 leftv u4=u3->next;
8396 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8397 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8398 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8399 {
8400 int save_d=Kstd1_deg;
8401 Kstd1_deg=(int)(long)u3->Data();
8402 kModW=(intvec *)u4->Data();
8403 BITSET save2;
8406 u2->next=NULL;
8407 BOOLEAN r=jjCALL2ARG(res,u);
8408 kModW=NULL;
8411 u->next->next=u3;
8412 return r;
8413 }
8414 else
8415 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8416 (u4->Typ()==INT_CMD))
8417 {
8419 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8420 {
8421 WerrorS("2nd argument must be a diagonal matrix of units");
8422 return TRUE;
8423 }
8424 res->data=(char*)redNF(
8425 idCopy((ideal)u3->Data()),
8426 idCopy((ideal)u1->Data()),
8427 mp_Copy((matrix)u2->Data(), currRing),
8428 (int)(long)u4->Data()
8429 );
8430 return FALSE;
8431 }
8432 else
8433 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8434 (u4->Typ()==INT_CMD))
8435 {
8436 poly u1p;
8437 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8438 else u1p=(poly)u1->Data();
8439 poly u2p;
8440 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8441 else u2p=(poly)u2->Data();
8443 if(!pIsUnit(u2p))
8444 {
8445 WerrorS("2nd argument must be a unit");
8446 return TRUE;
8447 }
8448 res->rtyp=POLY_CMD;
8449 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8450 pCopy(u2p),(int)(long)u4->Data());
8451 return FALSE;
8452 }
8453 else
8454 {
8455 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8456 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8457 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8458 return TRUE;
8459 }
8460}
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition iparith.cc:7365
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:50
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 8461 of file iparith.cc.

8462{
8463 leftv u1=u;
8464 leftv u2=u1->next;
8465 leftv u3=u2->next;
8466 leftv u4=u3->next;
8467 leftv u5=u4->next;
8468 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8469 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8470 {
8472 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8473 {
8474 WerrorS("2nd argument must be a diagonal matrix of units");
8475 return TRUE;
8476 }
8477 res->data=(char*)redNF(
8478 idCopy((ideal)u3->Data()),
8479 idCopy((ideal)u1->Data()),
8480 mp_Copy((matrix)u2->Data(),currRing),
8481 (int)(long)u4->Data(),
8482 (intvec*)u5->Data()
8483 );
8484 return FALSE;
8485 }
8486 else
8487 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8488 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8489 {
8491 if(!pIsUnit((poly)u2->Data()))
8492 {
8493 WerrorS("2nd argument must be a unit");
8494 return TRUE;
8495 }
8496 res->rtyp=POLY_CMD;
8497 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8498 pCopy((poly)u2->Data()),
8499 (int)(long)u4->Data(),(intvec*)u5->Data());
8500 return FALSE;
8501 }
8502 else
8503 {
8504 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8505 Tok2Cmdname(iiOp));
8506 return TRUE;
8507 }
8508}

◆ jjREDUCE_ID()

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

Definition at line 3155 of file iparith.cc.

3156{
3157 ideal ui=(ideal)u->Data();
3158 ideal vi=(ideal)v->Data();
3159 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3161 res->data = (char *)kNF(vi,currRing->qideal,ui);
3162 return FALSE;
3163}

◆ jjREDUCE_P()

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

Definition at line 3147 of file iparith.cc.

3148{
3149 ideal vi=(ideal)v->Data();
3150 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3152 res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3153 return FALSE;
3154}

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv res,
leftv v )
static

Definition at line 4983 of file iparith.cc.

4984{
4985 res->data = (char *)(long)iiRegularity((lists)v->Data());
4986 return FALSE;
4987}
int iiRegularity(lists L)
Definition ipshell.cc:1038

◆ jjREPART()

static BOOLEAN jjREPART ( leftv res,
leftv v )
static

Definition at line 4988 of file iparith.cc.

4989{
4990 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4991 return FALSE;
4992}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition coeffs.h:794

◆ jjRES()

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

Definition at line 3164 of file iparith.cc.

3165{
3166 int maxl=(int)(long)v->Data();
3167 if (maxl<0)
3168 {
3169 WerrorS("length for res must not be negative");
3170 return TRUE;
3171 }
3172 syStrategy r;
3173 intvec *weights=NULL;
3174 int wmaxl=maxl;
3175 ideal u_id=(ideal)u->Data();
3176
3177 maxl--;
3178 if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/
3179 {
3180 maxl = currRing->N-1+2*(iiOp==MRES_CMD);
3181 if (currRing->qideal!=NULL)
3182 {
3183 Warn(
3184 "full resolution in a qring may be infinite, setting max length to %d",
3185 maxl+1);
3186 }
3187 }
3188 weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
3189 if (weights!=NULL)
3190 {
3191 if (!idTestHomModule(u_id,currRing->qideal,weights))
3192 {
3193 WarnS("wrong weights given:");weights->show();PrintLn();
3194 weights=NULL;
3195 }
3196 }
3197 intvec *ww=NULL;
3198 int add_row_shift=0;
3199 if (weights!=NULL)
3200 {
3201 ww=ivCopy(weights);
3202 add_row_shift = ww->min_in();
3203 (*ww) -= add_row_shift;
3204 }
3205 unsigned save_opt=si_opt_1;
3207 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
3208 {
3209 if (iiOp==MRES_CMD) u_id=(ideal)u->CopyD();
3211 }
3212 else if (iiOp==SRES_CMD)
3213 // r=sySchreyerResolvente(u_id,maxl+1,&l);
3214 r=sySchreyer(u_id,maxl+1);
3215 else if (iiOp == LRES_CMD)
3216 {
3217 int dummy;
3218 if((currRing->qideal!=NULL)||
3219 (!idHomIdeal (u_id,NULL)))
3220 {
3221 WerrorS
3222 ("`lres` not implemented for inhomogeneous input or qring");
3223 return TRUE;
3224 }
3225 if(currRing->N == 1)
3226 WarnS("the current implementation of `lres` may not work in the case of a single variable");
3227 r=syLaScala3(u_id,&dummy);
3228 }
3229 else if (iiOp == KRES_CMD)
3230 {
3231 int dummy;
3232 if((currRing->qideal!=NULL)||
3233 (!idHomIdeal (u_id,NULL)))
3234 {
3235 WerrorS
3236 ("`kres` not implemented for inhomogeneous input or qring");
3237 return TRUE;
3238 }
3239 r=syKosz(u_id,&dummy);
3240 }
3241 else
3242 {
3243 int dummy;
3244 if((currRing->qideal!=NULL)||
3245 (!idHomIdeal (u_id,NULL)))
3246 {
3247 WerrorS
3248 ("`hres` not implemented for inhomogeneous input or qring");
3249 return TRUE;
3250 }
3255 }
3256 if (r==NULL) return TRUE;
3257 if (r->list_length>wmaxl)
3258 {
3259 for(int i=wmaxl-1;i>=r->list_length;i--)
3260 {
3261 if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
3262 if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
3263 }
3264 }
3265 r->list_length=wmaxl;
3266 res->data=(void *)r;
3267 if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
3268 if ((r->weights!=NULL) && (r->weights[0]!=NULL))
3269 {
3270 ww=ivCopy(r->weights[0]);
3271 if (weights!=NULL) (*ww) += add_row_shift;
3272 atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
3273 }
3274 else
3275 {
3276 if (weights!=NULL)
3277 {
3278 atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
3279 }
3280 }
3281
3282 // test the La Scala case' output
3283 assume( ((iiOp == LRES_CMD) || (iiOp == HRES_CMD)) == (r->syRing != NULL) );
3284 assume( (r->syRing != NULL) == (r->resPairs != NULL) );
3285
3286 if(iiOp != HRES_CMD)
3287 assume( (r->minres != NULL) || (r->fullres != NULL) ); // is wrong for HRES_CMD...
3288 else
3289 assume( (r->orderedRes != NULL) || (r->res != NULL) ); // analog for hres...
3290
3292 return FALSE;
3293}
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
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:626
syStrategy syHilb(ideal arg, int *length)
Definition syz2.cc:950
syStrategy sySchreyer(ideal arg, int maxlength)
Definition syz0.cc:1018
syStrategy syKosz(ideal arg, int *length)
Definition syz3.cc:1766
resolvente res
Definition syz.h:47
resolvente orderedRes
Definition syz.h:48
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:184
@ RES_CMD
Definition tok.h:169

◆ jjRES3()

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

Definition at line 7233 of file iparith.cc.

7234{
7235 int maxl=(int)v->Data();
7236 ideal u_id=(ideal)u->Data();
7237 int l=0;
7238 resolvente r;
7239 intvec **weights=NULL;
7240 int wmaxl=maxl;
7241 maxl--;
7242 unsigned save_opt=si_opt_1;
7244 if ((maxl==-1) && (iiOp!=MRES_CMD))
7245 maxl = currRing->N-1;
7246 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7247 {
7248 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7249 if (iv!=NULL)
7250 {
7251 l=1;
7252 if (!idTestHomModule(u_id,currRing->qideal,iv))
7253 {
7254 WarnS("wrong weights");
7255 iv=NULL;
7256 }
7257 else
7258 {
7259 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7260 weights[0] = ivCopy(iv);
7261 }
7262 }
7263 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7264 }
7265 else
7266 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7267 if (r==NULL) return TRUE;
7268 int t3=u->Typ();
7269 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7271 return FALSE;
7272}
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:401
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 8509 of file iparith.cc.

8510{
8511 unsigned i=1;
8512 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8513 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8514 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8515 // sArithBase.nCmdAllocated);
8516 for(i=0; i<nCount; i++)
8517 {
8518 Print("%-20s",sArithBase.sCmds[i+1].name);
8520 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8521 if(i+1+2*nCount<sArithBase.nCmdUsed)
8522 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8523 //if ((i%3)==1) PrintLn();
8524 PrintLn();
8525 }
8526 PrintLn();
8528 return FALSE;
8529}
void printBlackboxTypes()
list all defined type (for debugging)
Definition blackbox.cc:236

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv res,
leftv  )
static

Definition at line 8531 of file iparith.cc.

8532{
8533 int l = 0;
8534 int k = 0;
8536 struct blackbox_list *bb_list = NULL;
8537 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8538
8539 if ((3*nCount) < sArithBase.nCmdUsed)
8540 {
8541 nCount++;
8542 }
8544 // count the number of entries;
8545 for (unsigned i=0; i<nCount; i++)
8546 {
8547 l++;
8548 if (i + 1 + nCount < sArithBase.nCmdUsed)
8549 {
8550 l++;
8551 }
8552 if(i+1+2*nCount<sArithBase.nCmdUsed)
8553 {
8554 l++;
8555 }
8556 }
8557 for (int i = 0; i < bb_list->count; i++)
8558 {
8559 if (bb_list->list[i] != NULL)
8560 {
8561 l++;
8562 }
8563 }
8564 // initiate list
8565 L->Init(l);
8566 k = 0;
8567 for (unsigned i=0; i<nCount; i++)
8568 {
8569 L->m[k].rtyp = STRING_CMD;
8570 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8571 k++;
8572 // Print("%-20s", sArithBase.sCmds[i+1].name);
8573 if (i + 1 + nCount < sArithBase.nCmdUsed)
8574 {
8575 L->m[k].rtyp = STRING_CMD;
8576 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8577 k++;
8578 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8579 }
8580 if(i+1+2*nCount<sArithBase.nCmdUsed)
8581 {
8582 L->m[k].rtyp = STRING_CMD;
8583 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8584 k++;
8585 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8586 }
8587 // PrintLn();
8588 }
8589
8590 // assign blackbox types
8591 for (int i = 0; i < bb_list->count; i++)
8592 {
8593 if (bb_list->list[i] != NULL)
8594 {
8595 L->m[k].rtyp = STRING_CMD;
8596 // already used strdup in getBlackBoxTypes
8597 L->m[k].data = bb_list->list[i];
8598 k++;
8599 }
8600 }
8601 // free the struct (not the list entries itself, which were allocated
8602 // by strdup)
8603 omfree(bb_list->list);
8604 omfree(bb_list);
8605
8606 // pass the resultant list to the res datastructure
8607 res->data=(void *)L;
8608
8609 return FALSE;
8610}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition blackbox.cc:245
struct for containing list of blackbox names and the number of them.
Definition blackbox.h:84
#define omfree(addr)

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv res,
leftv v )
static

Definition at line 4950 of file iparith.cc.

4951{
4952 char *s= (char *)v->Data();
4953 // try system keywords
4954 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4955 {
4956 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4957 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4958 {
4959 res->data = (char *)1;
4960 return FALSE;
4961 }
4962 }
4963 // try blackbox names
4964 int id;
4965 blackboxIsCmd(s,id);
4966 if (id>0)
4967 {
4968 res->data = (char *)1;
4969 }
4970 return FALSE;
4971}

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv ,
leftv u )
static

Definition at line 8983 of file iparith.cc.

8984{
8985 int c=(int)(long)u->Data();
8986 switch(c)
8987 {
8988 case 0:{
8989 PrintS("delete all variables\n");
8990 killlocals(0);
8991 WerrorS("restarting...");
8992 break;
8993 };
8994 default: WerrorS("not implemented");
8995 }
8996 return FALSE;
8997}
void killlocals(int v)
Definition ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv res,
leftv v )
static

Definition at line 5367 of file iparith.cc.

5368{
5369#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5370 if (rIsLPRing(currRing))
5371 {
5373 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5374 ideal result;
5375 ideal v_id=(ideal)v->Data();
5376 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5377 /* tHomog hom=testHomog; */
5378 /* if (w!=NULL) */
5379 /* { */
5380 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5381 /* { */
5382 /* WarnS("wrong weights"); */
5383 /* w=NULL; */
5384 /* } */
5385 /* else */
5386 /* { */
5387 /* hom=isHomog; */
5388 /* w=ivCopy(w); */
5389 /* } */
5390 /* } */
5391 /* result=kStd(v_id,currRing->qideal,hom,&w); */
5392 result = rightgb(v_id, currRing->qideal);
5394 res->data = (char *)result;
5396 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5397 return FALSE;
5398 }
5399 else if (rIsPluralRing(currRing))
5400 {
5401 ideal I=(ideal)v->Data();
5402
5403 ring A = currRing;
5404 ring Aopp = rOpposite(A);
5405 currRing = Aopp;
5406 ideal Iopp = idOppose(A, I, Aopp);
5408 currRing = A;
5409 ideal J = idOppose(Aopp, Jopp, A);
5410
5411 id_Delete(&Iopp, Aopp);
5412 id_Delete(&Jopp, Aopp);
5413 rDelete(Aopp);
5414
5415 idSkipZeroes(J);
5416 res->data = (char *)J;
5418 return FALSE;
5419 }
5420 else
5421 {
5422 return jjSTD(res, v);
5423 }
5424#else
5425 return TRUE;
5426#endif
5427}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition iparith.cc:5168
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:2483
ideal rightgb(ideal F, const ideal Q)
Definition kstd2.cc:4955
#define TEST_OPT_DEGBOUND
Definition options.h:113
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:520

◆ jjRING3()

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

Definition at line 7274 of file iparith.cc.

7275{
7276 res->data=(void *)rInit(u,v,w);
7277 return (res->data==NULL);
7278}
ring rInit(leftv pn, leftv rv, leftv ord)
Definition ipshell.cc:5627

◆ 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 6079 of file iparith.cc.

6080{
6081 u->next=(leftv)omAlloc(sizeof(sleftv));
6082 memcpy(u->next,v,sizeof(sleftv));
6083 v->Init();
6084 u->next->next=(leftv)omAlloc(sizeof(sleftv));
6085 memcpy(u->next->next,w,sizeof(sleftv));
6086 w->Init();
6087 BOOLEAN bo=iiExprArithM(res,u,'[');
6088 u->next=NULL;
6089 return bo;
6090}

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv res,
leftv v )
static

Definition at line 5015 of file iparith.cc.

5016{
5017 ring r=(ring)v->Data();
5018 if (r!=NULL)
5019 res->data = (char *)rDecompose_list_cf((ring)v->Data());
5020 return (r==NULL)||(res->data==NULL);
5021}
lists rDecompose_list_cf(const ring r)
Definition ipshell.cc:2123

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv res,
leftv a )
static

Definition at line 8954 of file iparith.cc.

8955{
8956 //Print("construct ring\n");
8957 if (a->Typ()!=CRING_CMD)
8958 {
8959 WerrorS("expected `cring` [ `id` ... ]");
8960 return TRUE;
8961 }
8962 assume(a->next!=NULL);
8963 leftv names=a->next;
8964 int N=names->listLength();
8965 char **n=(char**)omAlloc0(N*sizeof(char*));
8966 for(int i=0; i<N;i++,names=names->next)
8967 {
8968 n[i]=(char *)names->Name();
8969 }
8970 coeffs cf=(coeffs)a->CopyD();
8971 res->data=rDefault(cf,N,n, ringorder_dp);
8972 omFreeSize(n,N*sizeof(char*));
8973 return FALSE;
8974}
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:103
@ ringorder_dp
Definition ring.h:78
@ CRING_CMD
Definition tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv res,
leftv v )
static

Definition at line 4993 of file iparith.cc.

4994{
4995 ring r=(ring)v->Data();
4996 if (r!=NULL)
4997 {
4998 res->data = (char *)rDecompose((ring)v->Data());
4999 if (res->data!=NULL)
5000 {
5001 long mm=r->wanted_maxExp;
5002 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
5003 return FALSE;
5004 }
5005 }
5006 return TRUE;
5007}
lists rDecompose(const ring r)
Definition ipshell.cc:2162

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv res,
leftv v )
static

Definition at line 5008 of file iparith.cc.

5009{
5010 coeffs r=(coeffs)v->Data();
5011 if (r!=NULL)
5012 return rDecompose_CF(res,r);
5013 return TRUE;
5014}
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition ipshell.cc:1950

◆ jjRMINUS()

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

Definition at line 3320 of file iparith.cc.

3321{
3322 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3323 res->data = (char *)r;
3324 return r==NULL;
3325}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition ring.cc:5964

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv res,
leftv v )
static

Definition at line 5747 of file iparith.cc.

5748{
5749 res->data = rOrdStr((ring)v->Data());
5750 return FALSE;
5751}
char * rOrdStr(ring r)
Definition ring.cc:523

◆ jjROWS()

static BOOLEAN jjROWS ( leftv res,
leftv v )
static

Definition at line 5022 of file iparith.cc.

5023{
5024 ideal i = (ideal)v->Data();
5025 res->data = (char *)i->rank;
5026 return FALSE;
5027}

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv res,
leftv v )
static

Definition at line 5028 of file iparith.cc.

5029{
5030 res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
5031 return FALSE;
5032}

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv res,
leftv v )
static

Definition at line 5033 of file iparith.cc.

5034{
5035 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
5036 return FALSE;
5037}

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv res,
leftv v )
static

Definition at line 5038 of file iparith.cc.

5039{
5040 res->data = (char *)(long)rPar(((ring)v->Data()));
5041 return FALSE;
5042}

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv res,
leftv v )
static

Definition at line 5757 of file iparith.cc.

5758{
5759 res->data = rParStr((ring)v->Data());
5760 return FALSE;
5761}
char * rParStr(ring r)
Definition ring.cc:651

◆ jjRPLUS()

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

Definition at line 3326 of file iparith.cc.

3327{
3328 int left;
3329 if (u->Typ()==RING_CMD) left=0;
3330 else
3331 {
3332 leftv h=u;u=v;v=h;
3333 left=1;
3334 }
3335 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3336 res->data = (char *)r;
3337 return r==NULL;
3338}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition ring.cc:5882

◆ jjRSUM()

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

Definition at line 3339 of file iparith.cc.

3340{
3341 ring r;
3342 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3343 res->data = (char *)r;
3344 return (i==-1);
3345}
int rSum(ring r1, ring r2, ring &sum)
Definition ring.cc:1404

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv res,
leftv v )
static

Definition at line 5752 of file iparith.cc.

5753{
5754 res->data = rVarStr((ring)v->Data());
5755 return FALSE;
5756}
char * rVarStr(ring r)
Definition ring.cc:625

◆ jjS2I()

static BOOLEAN jjS2I ( leftv res,
leftv v )
static

Definition at line 5043 of file iparith.cc.

5044{
5045 res->data = (char *)(long)atoi((char*)v->Data());
5046 return FALSE;
5047}

◆ jjSBA()

static BOOLEAN jjSBA ( leftv res,
leftv v )
static

Definition at line 5090 of file iparith.cc.

5091{
5092 ideal result;
5093 ideal v_id=(ideal)v->Data();
5094 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5096 if (w!=NULL)
5097 {
5098 if (!idTestHomModule(v_id,currRing->qideal,w))
5099 {
5100 WarnS("wrong weights");
5101 w=NULL;
5102 }
5103 else
5104 {
5105 hom=isHomog;
5106 w=ivCopy(w);
5107 }
5108 }
5109 result=kSba(v_id,currRing->qideal,hom,&w,1,0);
5111 res->data = (char *)result;
5113 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5114 return FALSE;
5115}
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:2684

◆ jjSBA_1()

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

Definition at line 5116 of file iparith.cc.

5117{
5118 ideal result;
5119 ideal v_id=(ideal)v->Data();
5120 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5122 if (w!=NULL)
5123 {
5124 if (!idTestHomModule(v_id,currRing->qideal,w))
5125 {
5126 WarnS("wrong weights");
5127 w=NULL;
5128 }
5129 else
5130 {
5131 hom=isHomog;
5132 w=ivCopy(w);
5133 }
5134 }
5135 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0);
5137 res->data = (char *)result;
5139 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5140 return FALSE;
5141}

◆ jjSBA_2()

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

Definition at line 5142 of file iparith.cc.

5143{
5144 ideal result;
5145 ideal v_id=(ideal)v->Data();
5146 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5148 if (w!=NULL)
5149 {
5150 if (!idTestHomModule(v_id,currRing->qideal,w))
5151 {
5152 WarnS("wrong weights");
5153 w=NULL;
5154 }
5155 else
5156 {
5157 hom=isHomog;
5158 w=ivCopy(w);
5159 }
5160 }
5161 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
5163 res->data = (char *)result;
5165 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5166 return FALSE;
5167}

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv ,
leftv u )
static

Definition at line 3855 of file iparith.cc.

3856{
3857 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3858 else
3859 {
3860 ring r=(ring)u->Data();
3861 idhdl h=rFindHdl(r,NULL);
3862 if (h==NULL)
3863 {
3864 char name_buffer[100];
3865 STATIC_VAR int ending=1000000;
3866 ending++;
3867 snprintf(name_buffer,100, "PYTHON_RING_VAR%d",ending);
3869 IDRING(h)=rIncRefCnt(r);
3870 }
3871 rSetHdl(h);
3872 }
3873 return FALSE;
3874}
#define STATIC_VAR
Definition globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition ipshell.cc:1702
void rSetHdl(idhdl h)
Definition ipshell.cc:5128

◆ jjSIMPL_ID()

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

Definition at line 3353 of file iparith.cc.

3354{
3355 int sw = (int)(long)v->Data();
3356 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3357 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3358 if (sw & SIMPL_LMDIV)
3359 {
3360 id_DelDiv(id,currRing);
3361 }
3362 if (sw & SIMPL_LMEQ)
3363 {
3365 }
3366 if (sw & SIMPL_MULT)
3367 {
3369 }
3370 else if(sw & SIMPL_EQU)
3371 {
3373 }
3374 if (sw & SIMPL_NULL)
3375 {
3376 idSkipZeroes(id);
3377 }
3378 if (sw & SIMPL_NORM)
3379 {
3380 id_Norm(id,currRing);
3381 }
3382 if (sw & SIMPL_NORMALIZE)
3383 {
3385 }
3386 res->data = (char * )id;
3387 return FALSE;
3388}
#define SIMPL_EQU
Definition iparith.cc:3350
#define SIMPL_NORM
Definition iparith.cc:3352
#define SIMPL_LMEQ
Definition iparith.cc:3348
#define SIMPL_NULL
Definition iparith.cc:3351
#define SIMPL_MULT
Definition iparith.cc:3349
#define SIMPL_NORMALIZE
Definition iparith.cc:3346
#define SIMPL_LMDIV
Definition iparith.cc:3347
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 3448 of file iparith.cc.

3449{
3450 int sw = (int)(long)v->Data();
3451 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3452 poly p = (poly)u->CopyD(POLY_CMD);
3453 if (sw & SIMPL_NORM)
3454 {
3455 pNorm(p);
3456 }
3457 if (sw & SIMPL_NORMALIZE)
3458 {
3460 }
3461 res->data = (char * )p;
3462 return FALSE;
3463}
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3835
void pNorm(poly p)
Definition polys.h:362

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv res,
leftv u )
static

Definition at line 5048 of file iparith.cc.

5049{
5050 const bool bIsSCA = rIsSCA(currRing);
5051
5052 if ((currRing->qideal!=NULL) && !bIsSCA)
5053 {
5054 WerrorS("qring not supported by slimgb at the moment");
5055 return TRUE;
5056 }
5058 {
5059 WerrorS("ordering must be global for slimgb");
5060 return TRUE;
5061 }
5063 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5064 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
5065 // tHomog hom=testHomog;
5066 ideal u_id=(ideal)u->Data();
5067 if (w!=NULL)
5068 {
5069 if (!idTestHomModule(u_id,currRing->qideal,w))
5070 {
5071 WarnS("wrong weights");
5072 w=NULL;
5073 }
5074 else
5075 {
5076 w=ivCopy(w);
5077 // hom=isHomog;
5078 }
5079 }
5080
5082 res->data=(char *)t_rep_gb(currRing,
5083 u_id,u_id->rank);
5084 //res->data=(char *)t_rep_gb(currRing, u_id);
5085
5087 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5088 return FALSE;
5089}
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:3581

◆ jjSMATRIX_Mo()

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

Definition at line 7114 of file iparith.cc.

7115{
7116 int mi=(int)(long)v->Data();
7117 int ni=(int)(long)w->Data();
7118 if ((mi<0)||(ni<1))
7119 {
7120 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
7121 return TRUE;
7122 }
7123 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
7124 mi,ni,currRing);
7125 return FALSE;
7126}
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 5196 of file iparith.cc.

5197{
5198 res->data = (char *)idSort((ideal)v->Data());
5199 return FALSE;
5200}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:187

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv ,
leftv arg )

Definition at line 10491 of file iparith.cc.

10492{
10493 lists l=(lists)arg->Data();
10494 if (l->nr>0)
10495 {
10496 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10497 }
10498 return FALSE;
10499}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition iparith.cc:10450

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv res,
leftv u )
static

Definition at line 5201 of file iparith.cc.

5202{
5204 intvec *v=NULL;
5205 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5206 if (f==NULL) return TRUE;
5207 ivTest(v);
5209 l->Init(2);
5210 l->m[0].rtyp=IDEAL_CMD;
5211 l->m[0].data=(void *)f;
5212 l->m[1].rtyp=INTVEC_CMD;
5213 l->m[1].data=(void *)v;
5214 res->data=(void *)l;
5215 return FALSE;
5216}
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 3390 of file iparith.cc.

3391{
3392 intvec *v=NULL;
3393 int sw=(int)(long)dummy->Data();
3394 int fac_sw=sw;
3395 if (sw<0) fac_sw=1;
3397 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3398 if (f==NULL)
3399 return TRUE;
3400 switch(sw)
3401 {
3402 case 0:
3403 case 2:
3404 {
3406 l->Init(2);
3407 l->m[0].rtyp=IDEAL_CMD;
3408 l->m[0].data=(void *)f;
3409 l->m[1].rtyp=INTVEC_CMD;
3410 l->m[1].data=(void *)v;
3411 res->data=(void *)l;
3412 res->rtyp=LIST_CMD;
3413 return FALSE;
3414 }
3415 case 1:
3416 res->data=(void *)f;
3417 return FALSE;
3418 case 3:
3419 {
3420 poly p=f->m[0];
3421 int i=IDELEMS(f);
3422 f->m[0]=NULL;
3423 while(i>1)
3424 {
3425 i--;
3426 p=pMult(p,f->m[i]);
3427 f->m[i]=NULL;
3428 }
3429 res->data=(void *)p;
3430 res->rtyp=POLY_CMD;
3431 }
3432 return FALSE;
3433 }
3434 WerrorS("invalid switch");
3435 return FALSE;
3436}

◆ jjSTATUS2()

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

Definition at line 3437 of file iparith.cc.

3438{
3439 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3440 return FALSE;
3441}

◆ jjSTATUS2L()

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

Definition at line 3442 of file iparith.cc.

3443{
3444 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3445 //return (res->data== (void*)(long)-2);
3446 return FALSE;
3447}

◆ jjSTATUS3()

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

Definition at line 7279 of file iparith.cc.

7280{
7281 int yes;
7282 jjSTATUS2(res, u, v);
7283 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7284 omFreeBinAddr((ADDRESS) res->data);
7285 res->data = (void *)(long)yes;
7286 return FALSE;
7287}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition iparith.cc:3437

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv res,
leftv v )
static

Definition at line 8796 of file iparith.cc.

8797{
8798 if ((v->Typ() != LINK_CMD) ||
8799 (v->next->Typ() != STRING_CMD) ||
8800 (v->next->next->Typ() != STRING_CMD) ||
8801 (v->next->next->next->Typ() != INT_CMD))
8802 return TRUE;
8803 jjSTATUS3(res, v, v->next, v->next->next);
8804#if defined(HAVE_USLEEP)
8805 if (((long) res->data) == 0L)
8806 {
8807 int i_s = (int)(long) v->next->next->next->Data();
8808 if (i_s > 0)
8809 {
8810 usleep((int)(long) v->next->next->next->Data());
8811 jjSTATUS3(res, v, v->next, v->next->next);
8812 }
8813 }
8814#elif defined(HAVE_SLEEP)
8815 if (((int) res->data) == 0)
8816 {
8817 int i_s = (int) v->next->next->next->Data();
8818 if (i_s > 0)
8819 {
8820 si_sleep((is - 1)/1000000 + 1);
8821 jjSTATUS3(res, v, v->next, v->next->next);
8822 }
8823 }
8824#endif
8825 return FALSE;
8826}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:7279
@ LINK_CMD
Definition tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv res,
leftv v )
static

Definition at line 5168 of file iparith.cc.

5169{
5171 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5172 ideal result;
5173 ideal v_id=(ideal)v->Data();
5174 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5176 if (w!=NULL)
5177 {
5178 if (!idTestHomModule(v_id,currRing->qideal,w))
5179 {
5180 WarnS("wrong weights");
5181 w=NULL;
5182 }
5183 else
5184 {
5185 hom=isHomog;
5186 w=ivCopy(w);
5187 }
5188 }
5189 result=kStd(v_id,currRing->qideal,hom,&w);
5191 res->data = (char *)result;
5193 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5194 return FALSE;
5195}

◆ jjSTD_1()

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

Definition at line 3497 of file iparith.cc.

3498{
3499 ideal result;
3500 assumeStdFlag(u);
3501 ideal i1=(ideal)(u->Data());
3502 int ii1=idElem(i1); /* size of i1 */
3503 ideal i0;
3504 int r=v->Typ();
3505 if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3506 {
3507 poly p=(poly)v->Data();
3508 i0=idInit(1,i1->rank);
3509 i0->m[0]=p;
3510 i1=idSimpleAdd(i1,i0); //
3511 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3512 idDelete(&i0);
3513 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3515
3516 if (w!=NULL)
3517 {
3518 if (!idTestHomModule(i1,currRing->qideal,w))
3519 {
3520 // no warnung: this is legal, if i in std(i,p)
3521 // is homogeneous, but p not
3522 w=NULL;
3523 }
3524 else
3525 {
3526 w=ivCopy(w);
3527 hom=isHomog;
3528 }
3529 }
3530 BITSET save1;
3533 /* ii1 appears to be the position of the first element of il that
3534 does not belong to the old SB ideal */
3535 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3537 idDelete(&i1);
3539 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3540 res->data = (char *)result;
3541 }
3542 else /*IDEAL/MODULE*/
3543 {
3544 i0=(ideal)v->CopyD();
3545 i1=idSimpleAdd(i1,i0); //
3546 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3547 idDelete(&i0);
3548 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3550
3551 if (w!=NULL)
3552 {
3553 if (!idTestHomModule(i1,currRing->qideal,w))
3554 {
3555 // no warnung: this is legal, if i in std(i,p)
3556 // is homogeneous, but p not
3557 w=NULL;
3559 }
3560 else
3561 {
3562 w=ivCopy(w);
3563 hom=isHomog;
3564 }
3565 }
3566 BITSET save1;
3569 /* ii1 appears to be the position of the first element of i1 that
3570 does not belong to the old SB ideal */
3571 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3573 idDelete(&i1);
3575 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3576 res->data = (char *)result;
3577 }
3579 return FALSE;
3580}
#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 3464 of file iparith.cc.

3465{
3466 ideal result;
3467 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3469 ideal u_id=(ideal)(u->Data());
3470 if (w!=NULL)
3471 {
3472 if (!idTestHomModule(u_id,currRing->qideal,w))
3473 {
3474 WarnS("wrong weights:");w->show();PrintLn();
3475 w=NULL;
3476 }
3477 else
3478 {
3479 w=ivCopy(w);
3480 hom=isHomog;
3481 }
3482 }
3483 bigintmat *vv=(bigintmat*)v->Data();
3484 intvec* vvv=new intvec(1,vv->cols());
3485 for(int i=0;i<vv->cols();i++)
3486 {
3487 (*vvv)[i]=n_Int(BIMATELEM(*vv,1,i+1),coeffs_BIGINT);
3488 }
3489 result=kStd(u_id,currRing->qideal,hom,&w,vvv);
3490 delete vvv;
3492 res->data = (char *)result;
3494 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3495 return FALSE;
3496}

◆ jjSTD_HILB_W()

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

Definition at line 7288 of file iparith.cc.

7289{
7290 intvec *vw=(intvec *)w->Data(); // weights of vars
7291 if (vw->length()!=currRing->N)
7292 {
7293 Werror("%d weights for %d variables",vw->length(),currRing->N);
7294 return TRUE;
7295 }
7296 ideal result;
7297 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7299 ideal u_id=(ideal)(u->Data());
7300 if (ww!=NULL)
7301 {
7302 if (!idTestHomModule(u_id,currRing->qideal,ww))
7303 {
7304 WarnS("wrong weights");
7305 ww=NULL;
7306 }
7307 else
7308 {
7309 ww=ivCopy(ww);
7310 hom=isHomog;
7311 }
7312 }
7313 bigintmat *vv=(bigintmat*)v->Data();
7314 intvec* vvv=new intvec(1,vv->cols());
7315 for(int i=0;i<vv->cols();i++)
7316 {
7317 (*vvv)[i]=n_Int(BIMATELEM(*vv,1,i+1),coeffs_BIGINT);
7318 }
7320 currRing->qideal,
7321 hom,
7322 &ww, // module weights
7323 vvv, // hilbert series
7324 0,0, // syzComp, newIdeal
7325 vw); // weights of vars
7327 delete vvv;
7328 res->data = (char *)result;
7330 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7331 return FALSE;
7332}

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv res,
leftv INPUT )
static

Definition at line 8871 of file iparith.cc.

8872{ ideal result;
8873 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8874 leftv v = u->next; /* one additional polynomial or ideal */
8875 leftv h = v->next; /* Hilbert vector */
8876 leftv w = h->next; /* weight vector */
8877 assumeStdFlag(u);
8878 ideal i1=(ideal)(u->Data());
8879 ideal i0;
8880 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8881 || (h->Typ()!=INTVEC_CMD)
8882 || (w->Typ()!=INTVEC_CMD))
8883 {
8884 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8885 return TRUE;
8886 }
8887 intvec *vw=(intvec *)w->Data(); // weights of vars
8888 /* merging std_hilb_w and std_1 */
8889 if (vw->length()!=currRing->N)
8890 {
8891 Werror("%d weights for %d variables",vw->length(),currRing->N);
8892 return TRUE;
8893 }
8894 int r=v->Typ();
8896 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8897 {
8898 i0=idInit(1,i1->rank);
8899 i0->m[0]=(poly)v->Data();
8901 }
8902 else if (r==IDEAL_CMD)/* IDEAL */
8903 {
8904 i0=(ideal)v->Data();
8905 }
8906 else
8907 {
8908 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8909 return TRUE;
8910 }
8911 int ii0=idElem(i0);
8912 i1 = idSimpleAdd(i1,i0);
8913 if (cleanup_i0)
8914 {
8915 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8916 idDelete(&i0);
8917 }
8918 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8920 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8921 if (ww!=NULL)
8922 {
8923 if (!idTestHomModule(i1,currRing->qideal,ww))
8924 {
8925 WarnS("wrong weights");
8926 ww=NULL;
8927 }
8928 else
8929 {
8930 ww=ivCopy(ww);
8931 hom=isHomog;
8932 }
8933 }
8934 BITSET save1;
8937 result=kStd(i1,
8938 currRing->qideal,
8939 hom,
8940 &ww, // module weights
8941 (intvec *)h->Data(), // hilbert series
8942 0, // syzComp, whatever it is...
8943 IDELEMS(i1)-ii0, // new ideal
8944 vw); // weights of vars
8946 idDelete(&i1);
8948 res->data = (char *)result;
8950 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8951 return FALSE;
8952}

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv res,
leftv v )
static

Definition at line 8611 of file iparith.cc.

8612{
8613 if (v == NULL)
8614 {
8615 res->data = omStrDup("");
8616 return FALSE;
8617 }
8618 int n = v->listLength();
8619 if (n == 1)
8620 {
8621 res->data = v->String();
8622 return FALSE;
8623 }
8624
8625 char** slist = (char**) omAlloc(n*sizeof(char*));
8626 int i, j;
8627
8628 for (i=0, j=0; i<n; i++, v = v ->next)
8629 {
8630 slist[i] = v->String();
8631 assume(slist[i] != NULL);
8632 j+=strlen(slist[i]);
8633 }
8634 char* s = (char*) omAlloc((j+1)*sizeof(char));
8635 *s='\0';
8636 for (i=0;i<n;i++)
8637 {
8638 strcat(s, slist[i]);
8639 omFree(slist[i]);
8640 }
8641 omFreeSize(slist, n*sizeof(char*));
8642 res->data = s;
8643 return FALSE;
8644}

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv res,
leftv v )
static

Definition at line 5679 of file iparith.cc.

5680{
5681 res->data = (char *)strlen((char *)v->Data());
5682 return FALSE;
5683}

◆ jjSUBST_Bu()

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

Definition at line 6836 of file iparith.cc.

6837{
6838 // generic conversion from polyBucket to poly:
6839 // force this to be the first try everytime
6840 poly p; int l;
6841 sBucket_pt bu=(sBucket_pt)w->CopyD();
6843 sleftv tmpw;
6844 tmpw.Init();
6845 tmpw.rtyp=POLY_CMD;
6846 tmpw.data=p;
6847 return iiExprArith3(res, iiOp, u, v, &tmpw);
6848}

◆ jjSUBST_Id()

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

Definition at line 6882 of file iparith.cc.

6883{
6884 int ringvar;
6885 poly monomexpr;
6887 if (nok) return TRUE;
6888 ideal id=(ideal)u->Data();
6889 if (ringvar>0)
6890 {
6891 BOOLEAN overflow=FALSE;
6892 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6893 {
6895 for(int i=IDELEMS(id)-1;i>=0;i--)
6896 {
6897 poly p=id->m[i];
6899 if ((p!=NULL) && (mm!=0) &&
6900 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6901 {
6902 overflow=TRUE;
6903 break;
6904 }
6905 }
6906 }
6907 if (overflow)
6908 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6909 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6910 {
6911 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6912 else id=id_Copy(id,currRing);
6913 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6914 }
6915 else
6916 res->data = idSubstPoly(id,ringvar,monomexpr);
6917 }
6918 else
6919 {
6920 if (rIsLPRing(currRing))
6921 {
6922 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6923 return TRUE;
6924 }
6925 res->data = idSubstPar(id,-ringvar,monomexpr);
6926 }
6927 return FALSE;
6928}
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:6808
ideal idSubstPoly(ideal id, int n, poly e)
Definition maps_ip.cc:424
ideal idSubstPar(ideal id, int n, poly e)
Definition maps_ip.cc:385
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition p_polys.cc:5042
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 6932 of file iparith.cc.

6933{
6934 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6935}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition iparith.cc:6940

◆ jjSUBST_Id_N()

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

Definition at line 6936 of file iparith.cc.

6937{
6938 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6939}

◆ jjSUBST_Id_X()

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

Definition at line 6940 of file iparith.cc.

6941{
6942 sleftv tmp;
6943 tmp.Init();
6944 // do not check the result, conversion from int/number to poly works always
6947 tmp.CleanUp();
6948 return b;
6949}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:6882

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv res,
leftv u )
static

Definition at line 8827 of file iparith.cc.

8828{
8829 leftv v = u->next; // number of args > 0
8830 if (v==NULL) return TRUE;
8831 leftv w = v->next;
8832 if (w==NULL) return TRUE;
8833 leftv rest = w->next;
8834
8835 u->next = NULL;
8836 v->next = NULL;
8837 w->next = NULL;
8838 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8839 if ((rest!=NULL) && (!b))
8840 {
8841 leftv tmp_next=res->next;
8842 res->next=rest;
8844 tmp_res.Init();
8846 memcpy(res,&tmp_res,sizeof(tmp_res));
8847 res->next=tmp_next;
8848 }
8849 u->next = v;
8850 v->next = w;
8851 // rest was w->next, but is already cleaned
8852 return b;
8853}

◆ jjSUBST_P()

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

Definition at line 6849 of file iparith.cc.

6850{
6851 int ringvar;
6852 poly monomexpr;
6854 if (nok) return TRUE;
6855 poly p=(poly)u->Data();
6856 if (ringvar>0)
6857 {
6859 if (!rIsLPRing(currRing) &&
6860 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6861 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6862 {
6863 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6864 //return TRUE;
6865 }
6866 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6867 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6868 else
6870 }
6871 else
6872 {
6873 if (rIsLPRing(currRing))
6874 {
6875 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6876 return TRUE;
6877 }
6879 }
6880 return FALSE;
6881}
poly pSubstPoly(poly p, int var, poly image)
Definition maps_ip.cc:402
poly pSubstPar(poly p, int par, poly image)
Definition maps_ip.cc:265

◆ jjSUBST_Test()

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

Definition at line 6808 of file iparith.cc.

6810{
6811 monomexpr=(poly)w->Data();
6812 poly p=(poly)v->Data();
6813#if 0
6814 if (pLength(monomexpr)>1)
6815 {
6816 Werror("`%s` substitutes a ringvar only by a term",
6818 return TRUE;
6819 }
6820#endif
6821 if ((ringvar=pVar(p))==0)
6822 {
6823 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6824 {
6825 number n = pGetCoeff(p);
6827 }
6828 if(ringvar==0)
6829 {
6830 WerrorS("ringvar/par expected");
6831 return TRUE;
6832 }
6833 }
6834 return FALSE;
6835}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition ring.cc:5861
@ SUBST_CMD
Definition tok.h:188

◆ jjSYZ_2()

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

Definition at line 3581 of file iparith.cc.

3582{
3583 // see jjSYZYGY
3584 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3585 intvec *w=NULL;
3587 ideal I=(ideal)u->Data();
3588 GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3589 if (ww!=NULL)
3590 {
3591 if (idTestHomModule(I,currRing->qideal,ww))
3592 {
3593 w=ivCopy(ww);
3594 int add_row_shift=w->min_in();
3595 (*w)-=add_row_shift;
3596 hom=isHomog;
3597 }
3598 else
3599 {
3600 //WarnS("wrong weights");
3601 delete ww; ww=NULL;
3602 hom=testHomog;
3603 }
3604 }
3605 else
3606 {
3607 if (u->Typ()==IDEAL_CMD)
3608 if (idHomIdeal(I,currRing->qideal))
3609 hom=isHomog;
3610 }
3612 if (w!=NULL) delete w;
3613 res->data = (char *)S;
3614 if (hom==isHomog)
3615 {
3616 int vl=S->rank;
3617 intvec *vv=new intvec(vl);
3618 if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3619 {
3620 for(int i=0;i<vl;i++)
3621 {
3622 if (I->m[i]!=NULL)
3623 (*vv)[i]=p_Deg(I->m[i],currRing);
3624 }
3625 }
3626 else
3627 {
3629 for(int i=0;i<vl;i++)
3630 {
3631 if (I->m[i]!=NULL)
3632 (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3633 }
3635 }
3636 if (idTestHomModule(S,currRing->qideal,vv))
3637 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3638 else
3639 delete vv;
3640 }
3642 return FALSE;
3643}
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:3695
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 5228 of file iparith.cc.

5229{
5230 ideal v_id=(ideal)v->Data();
5231#ifdef HAVE_SHIFTBBA
5232 if (rIsLPRing(currRing))
5233 {
5234 if (currRing->LPncGenCount < IDELEMS(v_id))
5235 {
5236 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5237 return TRUE;
5238 }
5239 }
5240#endif
5241 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5242 intvec *w=NULL;
5244 if (ww!=NULL)
5245 {
5246 if (idTestHomModule(v_id,currRing->qideal,ww))
5247 {
5248 w=ivCopy(ww);
5249 int add_row_shift=w->min_in();
5250 (*w)-=add_row_shift;
5251 hom=isHomog;
5252 }
5253 else
5254 {
5255 //WarnS("wrong weights");
5256 delete ww; ww=NULL;
5257 hom=testHomog;
5258 }
5259 }
5260 else
5261 {
5262 if (v->Typ()==IDEAL_CMD)
5263 if (idHomIdeal(v_id,currRing->qideal))
5264 hom=isHomog;
5265 }
5267 res->data = (char *)S;
5268 if (hom==isHomog)
5269 {
5270 int vl=S->rank;
5271 intvec *vv=new intvec(vl);
5272 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5273 {
5274 for(int i=0;i<vl;i++)
5275 {
5276 if (v_id->m[i]!=NULL)
5277 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5278 }
5279 }
5280 else
5281 {
5283 for(int i=0;i<vl;i++)
5284 {
5285 if (v_id->m[i]!=NULL)
5286 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5287 }
5289 }
5290 if (idTestHomModule(S,currRing->qideal,vv))
5291 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5292 else
5293 delete vv;
5294 }
5295 if (w!=NULL) delete w;
5296 return FALSE;
5297}

◆ jjTENSOR()

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

Definition at line 3644 of file iparith.cc.

3645{
3646 ideal A=(ideal)u->Data();
3647 ideal B=(ideal)v->Data();
3648 res->data = (char *)sm_Tensor(A,B,currRing);
3649 return FALSE;
3650}
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition matpol.cc:1824

◆ jjTENSOR_Ma()

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

Definition at line 3651 of file iparith.cc.

3652{
3657 tmp_res.Init();
3658 tmp_res.rtyp=SMATRIX_CMD;
3660 if (!bo)
3661 {
3664 }
3665 tmp_u.CleanUp();
3666 tmp_v.CleanUp();
3667 tmp_res.CleanUp();
3668 return bo;
3669}
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition iparith.cc:3644
static int index(p_Length length, p_Ord ord)

◆ jjTEST()

static BOOLEAN jjTEST ( leftv ,
leftv v )
static

Definition at line 8645 of file iparith.cc.

8646{
8647 do
8648 {
8649 if (v->Typ()!=INT_CMD)
8650 return TRUE;
8651 test_cmd((int)(long)v->Data());
8652 v=v->next;
8653 }
8654 while (v!=NULL);
8655 return FALSE;
8656}
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:640

◆ 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 long a=(long)u->Data();
984 long b=(long)v->Data();
985 long c=a * b;
986 if ((a!=0)&&(c/a!=b))
987 WarnS("int overflow(*), result may be wrong");
988 res->data = (char *)c;
989 if ((u->Next()!=NULL) || (v->Next()!=NULL))
990 return jjOP_REST(res,u,v);
991 return FALSE;
992}

◆ 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:349

◆ 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:206

◆ 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);
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:141

◆ 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),(long)v->Data(),currRing);
1134 return FALSE;
1135}
matrix mp_MultI(matrix a, long f, const ring R)
c = f*a
Definition matpol.cc:128

◆ 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*/
1107 if (r>0) I->rank=r;
1108 res->data = (char *)I;
1109 return FALSE;
1110}

◆ 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*/
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:158

◆ 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:1884

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv res,
leftv v )
static

Definition at line 5299 of file iparith.cc.

5300{
5301 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5302 return FALSE;
5303}
int ivTrace(intvec *o)
Definition intvec.cc:339

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv res,
leftv v )
static

Definition at line 5304 of file iparith.cc.

5305{
5306 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5307 return FALSE;
5308}

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv res,
leftv v )
static

Definition at line 5309 of file iparith.cc.

5310{
5311 res->data = (char *)ivTranp((intvec*)(v->Data()));
5312 return FALSE;
5313}
intvec * ivTranp(intvec *o)
Definition intvec.cc:327

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv res,
leftv a )
static

Definition at line 5348 of file iparith.cc.

5349{
5350#ifdef HAVE_PLURAL
5351 ideal result;
5352 ideal v_id=(ideal)a->Data();
5355 else /*commutative or shiftalgebra*/
5356 {
5357 return jjSTD(res,a);
5358 }
5359 res->data = (char *)result;
5362 return FALSE;
5363#else
5364 return TRUE;
5365#endif
5366}
#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 5428 of file iparith.cc.

5429{
5430 int t=(int)(long)v->data;
5431 switch (t)
5432 {
5433 case CRING_CMD:
5434 case INT_CMD:
5435 case POLY_CMD:
5436 case VECTOR_CMD:
5437 case STRING_CMD:
5438 case INTVEC_CMD:
5439 case IDEAL_CMD:
5440 case MATRIX_CMD:
5441 case MODUL_CMD:
5442 case MAP_CMD:
5443 case PROC_CMD:
5444 case RING_CMD:
5445 case SMATRIX_CMD:
5446 //case QRING_CMD:
5447 case INTMAT_CMD:
5448 case BIGINTMAT_CMD:
5449 case NUMBER_CMD:
5450 #ifdef SINGULAR_4_2
5451 case CNUMBER_CMD:
5452 #endif
5453 case BIGINT_CMD:
5454 case BUCKET_CMD:
5455 case LIST_CMD:
5456 case PACKAGE_CMD:
5457 case LINK_CMD:
5458 case RESOLUTION_CMD:
5459 res->data=omStrDup(Tok2Cmdname(t)); break;
5460 case DEF_CMD:
5461 case NONE: res->data=omStrDup("none"); break;
5462 default:
5463 {
5464 if (t>MAX_TOK)
5465 res->data=omStrDup(getBlackboxName(t));
5466 else
5467 res->data=omStrDup("?unknown type?");
5468 break;
5469 }
5470 }
5471 return FALSE;
5472}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition blackbox.cc:213
@ CNUMBER_CMD
Definition tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv res,
leftv u )
static

Definition at line 3810 of file iparith.cc.

3811{
3814 res->data = (char *)n;
3815 return FALSE;
3816}
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:561

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv res,
leftv u )
static

Definition at line 3847 of file iparith.cc.

3848{
3850 (*bim)*=(-1);
3851 res->data = (char *)bim;
3852 return FALSE;
3853}

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv res,
leftv u )
static

Definition at line 3817 of file iparith.cc.

3818{
3819 res->data = (char *)(-(long)u->Data());
3820 return FALSE;
3821}

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv res,
leftv u )
static

Definition at line 3840 of file iparith.cc.

3841{
3842 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3843 (*iv)*=(-1);
3844 res->data = (char *)iv;
3845 return FALSE;
3846}

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv res,
leftv u )
static

Definition at line 3834 of file iparith.cc.

3835{
3836 poly m1=pISet(-1);
3837 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3838 return FALSE;
3839}
#define pISet(i)
Definition polys.h:312

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv res,
leftv u )
static

Definition at line 3822 of file iparith.cc.

3823{
3825 n=nInpNeg(n);
3826 res->data = (char *)n;
3827 return FALSE;
3828}
#define nInpNeg(n)
Definition numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv res,
leftv u )
static

Definition at line 3829 of file iparith.cc.

3830{
3831 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3832 return FALSE;
3833}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv ,
leftv arg )

Definition at line 10500 of file iparith.cc.

10501{
10502 lists l=(lists)arg->Data();
10503 if (l->nr>0)
10504 {
10505 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10506 int i, j, len;
10507 len=l->nr;
10508 i=0;
10509 while(i<len)
10510 {
10511 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10512 {
10513 l->m[i].CleanUp();
10514 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10515 memset(&(l->m[len]),0,sizeof(sleftv));
10516 l->m[len].rtyp=DEF_CMD;
10517 len--;
10518 }
10519 else
10520 i++;
10521 }
10522 //Print("new len:%d\n",len);
10523 }
10524 return FALSE;
10525}

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv res,
leftv v )
static

Definition at line 5473 of file iparith.cc.

5474{
5475 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5476 return FALSE;
5477}
#define pIsUnivariate(p)
Definition polys.h:249

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv res,
leftv v )
static

Definition at line 5478 of file iparith.cc.

5479{
5480 int i=(int)(long)v->Data();
5481 if ((0<i) && (i<=currRing->N))
5482 {
5483 poly p=pOne();
5484 pSetExp(p,i,1);
5485 pSetm(p);
5486 res->data=(char *)p;
5487 }
5488 else
5489 {
5490 Werror("var number %d out of range 1..%d",i,currRing->N);
5491 return TRUE;
5492 }
5493 return FALSE;
5494}

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv res,
leftv v )
static

Definition at line 5495 of file iparith.cc.

5496{
5497 if (currRing==NULL)
5498 {
5499 WerrorS("no ring active (2)");
5500 return TRUE;
5501 }
5502 int i=(int)(long)v->Data();
5503 if ((0<i) && (i<=currRing->N))
5504 res->data=omStrDup(currRing->names[i-1]);
5505 else
5506 {
5507 Werror("var number %d out of range 1..%d",i,currRing->N);
5508 return TRUE;
5509 }
5510 return FALSE;
5511}

◆ jjVARSTR2()

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

Definition at line 3670 of file iparith.cc.

3671{
3672 idhdl h=(idhdl)u->data;
3673 int i=(int)(long)v->Data();
3674 if ((0<i) && (i<=IDRING(h)->N))
3675 res->data=omStrDup(IDRING(h)->names[i-1]);
3676 else
3677 {
3678 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3679 return TRUE;
3680 }
3681 return FALSE;
3682}

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv res,
leftv v )
static

Definition at line 5512 of file iparith.cc.

5513{
5515#ifdef HAVE_SHIFTBBA
5516 if (rIsLPRing(currRing))
5517 {
5518#ifdef HAVE_RINGS
5520 {
5521 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5522 return TRUE;
5523 }
5524#endif
5525 if (currRing->qideal != NULL)
5526 {
5527 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5528 return TRUE;
5529 }
5530 int kDim = lp_kDim((ideal)(v->Data()));
5531 res->data = (char *)(long)kDim;
5532 return (kDim == -2);
5533 }
5534#endif
5535 long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5536 if (l<-1L)
5537 WerrorS("int overflow in vdim");
5538 res->data = (char *)l;
5539 return FALSE;
5540}
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:950
int lp_kDim(const ideal _G)
Definition hdegree.cc:2111

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv res,
leftv u )

Definition at line 5541 of file iparith.cc.

5542{
5543// input: u: a list with links of type
5544// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5545// returns: -1: the read state of all links is eof
5546// i>0: (at least) u[i] is ready
5547 lists Lforks = (lists)u->Data();
5548 int i = slStatusSsiL(Lforks, -1);
5549 if(i == -2) /* error */
5550 {
5551 return TRUE;
5552 }
5553 res->data = (void*)(long)i;
5554 return FALSE;
5555}

◆ jjWAIT1ST2()

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

Definition at line 3683 of file iparith.cc.

3684{
3685// input: u: a list with links of type
3686// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3687// v: timeout for select in milliseconds
3688// or 0 for polling
3689// returns: ERROR (via Werror): timeout negative
3690// -1: the read state of all links is eof
3691// 0: timeout (or polling): none ready
3692// i>0: (at least) L[i] is ready
3693 lists Lforks = (lists)u->Data();
3694 int t = (int)(long)v->Data();
3695 if(t < 0)
3696 {
3697 WerrorS("negative timeout"); return TRUE;
3698 }
3699 int i = slStatusSsiL(Lforks, t*1000);
3700 if(i == -2) /* error */
3701 {
3702 return TRUE;
3703 }
3704 res->data = (void*)(long)i;
3705 return FALSE;
3706}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv res,
leftv u )

Definition at line 5556 of file iparith.cc.

5557{
5558// input: u: a list with links of type
5559// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5560// returns: -1: the read state of all links is eof
5561// 1: all links are ready
5562// (caution: at least one is ready, but some maybe dead)
5563 lists Lforks = (lists)u->CopyD();
5564 int i;
5565 int j = -1;
5566 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5567 {
5568 i = slStatusSsiL(Lforks, -1);
5569 if(i == -2) /* error */
5570 {
5571 return TRUE;
5572 }
5573 if(i == -1)
5574 {
5575 break;
5576 }
5577 j = 1;
5578 Lforks->m[i-1].CleanUp();
5579 Lforks->m[i-1].rtyp=DEF_CMD;
5580 Lforks->m[i-1].data=NULL;
5581 }
5582 res->data = (void*)(long)j;
5583 Lforks->Clean();
5584 return FALSE;
5585}

◆ jjWAITALL2()

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

Definition at line 3707 of file iparith.cc.

3708{
3709// input: u: a list with links of type
3710// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3711// v: timeout for select in milliseconds
3712// or 0 for polling
3713// returns: ERROR (via Werror): timeout negative
3714// -1: the read state of all links is eof
3715// 0: timeout (or polling): none ready
3716// 1: all links are ready
3717// (caution: at least one is ready, but some maybe dead)
3718 lists Lforks = (lists)u->CopyD();
3719 int timeout = 1000*(int)(long)v->Data();
3720 if(timeout < 0)
3721 {
3722 WerrorS("negative timeout"); return TRUE;
3723 }
3724 int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3725 int i;
3726 int ret = -1;
3727 for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3728 {
3730 if(i > 0) /* Lforks[i] is ready */
3731 {
3732 ret = 1;
3733 Lforks->m[i-1].CleanUp();
3734 Lforks->m[i-1].rtyp=DEF_CMD;
3735 Lforks->m[i-1].data=NULL;
3736 timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3737 }
3738 else /* terminate the for loop */
3739 {
3740 if(i == -2) /* error */
3741 {
3742 return TRUE;
3743 }
3744 if(i == 0) /* timeout */
3745 {
3746 ret = 0;
3747 }
3748 break;
3749 }
3750 }
3751 Lforks->Clean();
3752 res->data = (void*)(long)ret;
3753 return FALSE;
3754}
#define TIMER_RESOLUTION
Definition mod2.h:35
int getRTimer()
Definition timer.cc:170

◆ jjWEDGE()

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

Definition at line 3755 of file iparith.cc.

3756{
3757 res->data = (char *)mp_Wedge((matrix)u->Data(),(int)(long)v->Data(),currRing);
3758 return FALSE;
3759}
matrix mp_Wedge(matrix a, int ar, const ring R)
Definition matpol.cc:1744

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv ,
leftv  )
static

Definition at line 3760 of file iparith.cc.

3761{
3762 return TRUE;
3763}

◆ jjWRONG2()

static BOOLEAN jjWRONG2 ( leftv ,
leftv ,
leftv  )
static

Definition at line 3764 of file iparith.cc.

3765{
3766 return TRUE;
3767}

◆ jjWRONG3()

static BOOLEAN jjWRONG3 ( leftv ,
leftv ,
leftv ,
leftv  )
static

Definition at line 3768 of file iparith.cc.

3769{
3770 return TRUE;
3771}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int tok)

Definition at line 9905 of file iparith.cc.

9906{
9907 if (tok <= 0)
9908 {
9909 return sArithBase.sCmds[0].name;
9910 }
9911 if (tok==ANY_TYPE) return "any_type";
9912 if (tok==COMMAND) return "command";
9913 if (tok==NONE) return "nothing";
9914 if (tok < 128)
9915 {
9917 return Tok2Cmdname_buf;
9918 }
9919 //if (tok==IFBREAK) return "if_break";
9920 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9921 //if (tok==ORDER_VECTOR) return "ordering";
9922 //if (tok==REF_VAR) return "ref";
9923 //if (tok==OBJECT) return "object";
9924 //if (tok==PRINT_EXPR) return "print_expr";
9925 if (tok==IDHDL) return "identifier";
9926 if (tok>MAX_TOK) return getBlackboxName(tok);
9927 unsigned i;
9928 for(i=0; i<sArithBase.nCmdUsed; i++)
9929 //while (sArithBase.sCmds[i].tokval!=0)
9930 {
9931 if ((sArithBase.sCmds[i].tokval == tok)&&
9932 (sArithBase.sCmds[i].alias==0))
9933 {
9934 return sArithBase.sCmds[i].name;
9935 }
9936 }
9937 // try gain for alias/old names:
9938 for(i=0; i<sArithBase.nCmdUsed; i++)
9939 {
9940 if (sArithBase.sCmds[i].tokval == tok)
9941 {
9942 return sArithBase.sCmds[i].name;
9943 }
9944 }
9945 return sArithBase.sCmds[0].name;
9946}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition iparith.cc:9904
#define ANY_TYPE
Definition tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char * )
static

Definition at line 5659 of file iparith.cc.

5660{
5662}

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 217 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 218 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 222 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 201 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2066 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9904 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5658 of file iparith.cc.