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

Go to the source code of this file.

Data Structures

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

Macros

#define NC_MASK   (3+64)
 
#define RING_MASK   4
 
#define ZERODIVISOR_MASK   8
 
#define ALLOW_PLURAL   1
 
#define NO_NC   0
 
#define COMM_PLURAL   2
 
#define ALLOW_RING   4
 
#define NO_RING   0
 
#define NO_ZERODIVISOR   8
 
#define ALLOW_ZERODIVISOR   0
 
#define ALLOW_LP   64
 
#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL
 
#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)
 
#define WARN_RING   16
 
#define NO_CONVERSION   32
 
#define 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 More...
 
int iiArithRemoveCmd (char *szName)
 
int iiArithAddCmd (const char *szName, short nAlias, short nTokval, short nToktype, short nPos=-1)
 
static int iiTabIndex (const jjValCmdTab dArithTab, const int len, const int op)
 
static Subexpr jjMakeSub (leftv e)
 
static int iin_Int (number &n, coeffs cf)
 
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 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. More...
 
static BOOLEAN jjNUMERATOR (leftv res, leftv v)
 Return the numerator of the input number. More...
 
static BOOLEAN jjDET (leftv res, leftv v)
 
static BOOLEAN jjDET_BI (leftv res, leftv v)
 
static BOOLEAN jjDET_I (leftv res, leftv v)
 
static BOOLEAN jjDET_S (leftv res, leftv v)
 
static BOOLEAN jjDIM (leftv res, leftv v)
 
static BOOLEAN jjDUMP (leftv, leftv v)
 
static BOOLEAN jjE (leftv res, leftv v)
 
static BOOLEAN jjEXECUTE (leftv, leftv v)
 
static BOOLEAN jjFACSTD (leftv res, leftv v)
 
static BOOLEAN jjFAC_P (leftv res, leftv u)
 
static BOOLEAN jjGETDUMP (leftv, leftv v)
 
static BOOLEAN jjHIGHCORNER (leftv res, leftv v)
 
static BOOLEAN jjHIGHCORNER_M (leftv res, leftv v)
 
static BOOLEAN jjHILBERT (leftv, leftv v)
 
static BOOLEAN jjHILBERT_IV (leftv res, leftv v)
 
static BOOLEAN jjHOMOG1 (leftv res, leftv v)
 
static BOOLEAN jjidMaxIdeal (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Ma (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Map (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_R (leftv res, leftv v)
 
static BOOLEAN jjIm2Iv (leftv res, leftv v)
 
static BOOLEAN jjIMPART (leftv res, leftv v)
 
static BOOLEAN jjINDEPSET (leftv res, leftv v)
 
static BOOLEAN jjINTERRED (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_P (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_S (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR0 (leftv res, leftv)
 
static BOOLEAN jjJACOB_P (leftv res, leftv v)
 
static BOOLEAN jjDIFF_COEF (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJACOB_M (leftv res, leftv a)
 
static BOOLEAN jjKERNEL_M (leftv res, leftv v)
 
static BOOLEAN jjKERNEL_SM (leftv res, leftv v)
 
static BOOLEAN jjKBASE (leftv res, leftv v)
 
static BOOLEAN jjL2R (leftv res, leftv v)
 
static BOOLEAN jjLEADCOEF (leftv res, leftv v)
 
static BOOLEAN jjLEADEXP (leftv res, leftv v)
 
static BOOLEAN jjLEADMONOM (leftv res, leftv v)
 
static BOOLEAN jjLOAD1 (leftv, leftv v)
 
static BOOLEAN jjLISTRING (leftv res, leftv v)
 
static BOOLEAN jjPFAC1 (leftv res, leftv v)
 
static BOOLEAN jjLagSolve (leftv res, leftv v)
 
static BOOLEAN jjLU_DECOMP (leftv res, leftv v)
 
static BOOLEAN jjMEMORY (leftv res, leftv v)
 
static BOOLEAN jjMSTD (leftv res, leftv v)
 
static BOOLEAN jjMULT (leftv res, leftv v)
 
static BOOLEAN jjMINRES_R (leftv res, leftv v)
 
static BOOLEAN jjN2BI (leftv res, leftv v)
 
static BOOLEAN jjNAMEOF (leftv res, leftv v)
 
static BOOLEAN jjNAMES (leftv res, leftv v)
 
static BOOLEAN jjNAMES_I (leftv res, leftv v)
 
static BOOLEAN jjNOT (leftv res, leftv v)
 
static BOOLEAN jjNVARS (leftv res, leftv v)
 
static BOOLEAN jjOpenClose (leftv, leftv v)
 
static BOOLEAN jjORD (leftv res, leftv v)
 
static BOOLEAN jjPAR1 (leftv res, leftv v)
 
static BOOLEAN jjPARDEG (leftv res, leftv v)
 
static BOOLEAN jjPARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjP2BI (leftv res, leftv v)
 
static BOOLEAN jjP2I (leftv res, leftv v)
 
static BOOLEAN jjPREIMAGE_R (leftv res, leftv v)
 
static BOOLEAN jjPRIME (leftv res, leftv v)
 
static BOOLEAN jjPRUNE (leftv res, leftv v)
 
static BOOLEAN jjP2N (leftv res, leftv v)
 
static BOOLEAN jjRESERVEDNAME (leftv res, leftv v)
 
static BOOLEAN jjRANK1 (leftv res, leftv v)
 
static BOOLEAN jjREAD (leftv res, leftv v)
 
static BOOLEAN jjREGULARITY (leftv res, leftv v)
 
static BOOLEAN jjREPART (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST_C (leftv res, leftv v)
 
static BOOLEAN jjRING_LIST (leftv res, leftv v)
 
static BOOLEAN jjROWS (leftv res, leftv v)
 
static BOOLEAN jjROWS_BIM (leftv res, leftv v)
 
static BOOLEAN jjROWS_IV (leftv res, leftv v)
 
static BOOLEAN jjRPAR (leftv res, leftv v)
 
static BOOLEAN jjS2I (leftv res, leftv v)
 
static BOOLEAN jjSLIM_GB (leftv res, leftv u)
 
static BOOLEAN jjSBA (leftv res, leftv v)
 
static BOOLEAN jjSBA_1 (leftv res, leftv v, leftv u)
 
static BOOLEAN jjSBA_2 (leftv res, leftv v, leftv u, leftv t)
 
static BOOLEAN jjSTD (leftv res, leftv v)
 
static BOOLEAN jjSort_Id (leftv res, leftv v)
 
static BOOLEAN jjSQR_FREE (leftv res, leftv u)
 
static BOOLEAN jjSYZYGY (leftv res, leftv v)
 
static BOOLEAN jjTRACE_IV (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_BIM (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_IV (leftv res, leftv v)
 
static BOOLEAN jjOPPOSITE (leftv res, leftv a)
 
static BOOLEAN jjENVELOPE (leftv res, leftv a)
 
static BOOLEAN jjTWOSTD (leftv res, leftv a)
 
static BOOLEAN jjRIGHTSTD (leftv res, leftv v)
 
static BOOLEAN jjTYPEOF (leftv res, leftv v)
 
static BOOLEAN jjUNIVARIATE (leftv res, leftv v)
 
static BOOLEAN jjVAR1 (leftv res, leftv v)
 
static BOOLEAN jjVARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjVDIM (leftv res, leftv v)
 
BOOLEAN jjWAIT1ST1 (leftv res, leftv u)
 
BOOLEAN jjWAITALL1 (leftv res, leftv u)
 
BOOLEAN jjLOAD (const char *s, BOOLEAN autoexport)
 load lib/module given in v More...
 
static void WerrorS_dummy (const char *)
 
BOOLEAN jjLOAD_TRY (const char *s)
 
static BOOLEAN jjstrlen (leftv res, leftv v)
 
static BOOLEAN jjpLength (leftv res, leftv v)
 
static BOOLEAN jjidElem (leftv res, leftv v)
 
static BOOLEAN jjidFreeModule (leftv res, leftv v)
 
static BOOLEAN jjidVec2Ideal (leftv res, leftv v)
 
static BOOLEAN jjrCharStr (leftv res, leftv v)
 
static BOOLEAN jjpHead (leftv res, leftv v)
 
static BOOLEAN jjidHead (leftv res, leftv v)
 
static BOOLEAN jjidMinBase (leftv res, leftv v)
 
static BOOLEAN jjpMaxComp (leftv res, leftv v)
 
static BOOLEAN jjmpTrace (leftv res, leftv v)
 
static BOOLEAN jjmpTransp (leftv res, leftv v)
 
static BOOLEAN jjrOrdStr (leftv res, leftv v)
 
static BOOLEAN jjrVarStr (leftv res, leftv v)
 
static BOOLEAN jjrParStr (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RES (leftv res, leftv v)
 
static BOOLEAN jjDIM_R (leftv res, leftv v)
 
static BOOLEAN jjidTransp (leftv res, leftv v)
 
static BOOLEAN jjnInt (leftv res, leftv u)
 
static BOOLEAN jjnlInt (leftv res, leftv u)
 
static BOOLEAN jjBRACK_S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Bim (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_SM (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_I_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjPROC3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING_2 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBAREISS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_KB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_ALG (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_HILB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFIND3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFWALK3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjHILBERT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN 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 jjNEWSTRUCT3 (leftv, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRANDOM_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Test (leftv v, leftv w, int &ringvar, poly &monomexpr)
 
static BOOLEAN jjSUBST_Bu (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_X (leftv res, leftv u, leftv v, leftv w, int input_type)
 
static BOOLEAN jjSUBST_Id_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_N (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMODULO3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMODULO3S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD_SYZ (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD_ALG (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CP (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_ID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRES3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTATUS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTD_HILB_W (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBREAK0 (leftv, leftv)
 
static BOOLEAN jjBREAK1 (leftv, leftv v)
 
static BOOLEAN jjCALL1ARG (leftv res, leftv v)
 
static BOOLEAN jjCALL2ARG (leftv res, leftv u)
 
static BOOLEAN jjCALL3ARG (leftv res, leftv u)
 
static BOOLEAN jjCOEF_M (leftv, leftv v)
 
static BOOLEAN jjDIVISION4 (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_PL (leftv res, leftv v)
 
static BOOLEAN jjFETCH_M (leftv res, leftv u)
 
static BOOLEAN jjINTERSECT_PL (leftv res, leftv v)
 
static BOOLEAN jjLU_INVERSE (leftv res, leftv v)
 
static BOOLEAN jjLU_SOLVE (leftv res, leftv v)
 
static BOOLEAN jjINTVEC_PL (leftv res, leftv v)
 
static BOOLEAN jjJET4 (leftv res, leftv u)
 
static BOOLEAN jjKLAMMER_PL (leftv res, leftv u)
 
static BOOLEAN jjLIFT_4 (leftv res, leftv U)
 
static BOOLEAN jjLIFTSTD_M (leftv res, leftv U)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
static BOOLEAN jjMODULO4 (leftv res, leftv u)
 
static BOOLEAN jjNAMES0 (leftv res, leftv)
 
static BOOLEAN jjOPTION_PL (leftv res, leftv v)
 
static BOOLEAN jjREDUCE4 (leftv res, leftv u)
 
static BOOLEAN jjREDUCE5 (leftv res, leftv u)
 
static BOOLEAN jjRESERVED0 (leftv, leftv)
 
static BOOLEAN jjRESERVEDLIST0 (leftv res, leftv)
 
static BOOLEAN jjSTRING_PL (leftv res, leftv v)
 
static BOOLEAN jjTEST (leftv, leftv v)
 
static BOOLEAN jjFactModD_M (leftv res, leftv v)
 
static BOOLEAN jjSTATUS_M (leftv res, leftv v)
 
static BOOLEAN jjSUBST_M (leftv res, leftv u)
 
static BOOLEAN jjQRDS (leftv res, leftv INPUT)
 
static BOOLEAN jjSTD_HILB_WP (leftv res, leftv INPUT)
 
static BOOLEAN jjRING_PL (leftv res, leftv a)
 
static BOOLEAN jjRESTART (leftv, leftv u)
 
static BOOLEAN iiExprArith2TabIntern (leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a and a->next return TRUE on failure More...
 
BOOLEAN iiExprArith2 (leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
 
BOOLEAN iiExprArith1Tab (leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith1 (leftv res, leftv a, int op)
 
static BOOLEAN iiExprArith3TabIntern (leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith3 (leftv res, int op, leftv a, leftv b, leftv c)
 
BOOLEAN iiExprArith3Tab (leftv res, leftv a, int op, const struct sValCmd3 *dA3, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure More...
 
BOOLEAN iiExprArithM (leftv res, leftv a, int op)
 
int IsCmd (const char *n, int &tok)
 
const char * Tok2Cmdname (int tok)
 
int iiInitArithmetic ()
 initialisation of arithmetic structured data More...
 
int iiArithFindCmd (const char *szName)
 
char * iiArithGetCmd (int nPos)
 
int iiArithRemoveCmd (const char *szName)
 
static int jjCOMPARE_ALL (const void *aa, const void *bb)
 
BOOLEAN jjSORTLIST (leftv, leftv arg)
 
BOOLEAN jjUNIQLIST (leftv, leftv arg)
 

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 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 8764 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 8766 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 8765 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 3291 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3288 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3289 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3290 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3293 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3287 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3292 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

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

Definition at line 153 of file iparith.cc.

◆ proc3

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

Definition at line 164 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9726{
9727 cmdnames *pCmdL = (cmdnames*)a;
9728 cmdnames *pCmdR = (cmdnames*)b;
9729
9730 if(a==NULL || b==NULL) return 0;
9731
9732 /* empty entries goes to the end of the list for later reuse */
9733 if(pCmdL->name==NULL) return 1;
9734 if(pCmdR->name==NULL) return -1;
9735
9736 /* $INVALID$ must come first */
9737 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9738 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9739
9740 /* tokval=-1 are reserved names at the end */
9741 if (pCmdL->tokval==-1)
9742 {
9743 if (pCmdR->tokval==-1)
9744 return strcmp(pCmdL->name, pCmdR->name);
9745 /* pCmdL->tokval==-1, pCmdL goes at the end */
9746 return 1;
9747 }
9748 /* pCmdR->tokval==-1, pCmdR goes at the end */
9749 if(pCmdR->tokval==-1) return -1;
9750
9751 return strcmp(pCmdL->name, pCmdR->name);
9752}
CanonicalForm b
Definition: cfModGcd.cc:4103
#define NULL
Definition: omList.c:12

◆ check_valid()

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

Definition at line 9951 of file iparith.cc.

9952{
9954 {
9955 if ((p & NC_MASK)==NO_NC)
9956 {
9957 WerrorS("not implemented for non-commutative rings");
9958 return TRUE;
9959 }
9960 else if ((p & NC_MASK)==COMM_PLURAL)
9961 {
9962 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9963 return FALSE;
9964 }
9965 /* else, ALLOW_PLURAL */
9966 }
9967 else if (rIsLPRing(currRing))
9968 {
9969 if ((p & ALLOW_LP)==0)
9970 {
9971 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9972 return TRUE;
9973 }
9974 }
9976 {
9977 if ((p & RING_MASK)==0 /*NO_RING*/)
9978 {
9979 WerrorS("not implemented for rings with rings as coeffients");
9980 return TRUE;
9981 }
9982 /* else ALLOW_RING */
9983 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9985 {
9986 WerrorS("domain required as coeffients");
9987 return TRUE;
9988 }
9989 /* else ALLOW_ZERODIVISOR */
9990 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9991 {
9992 WarnS("considering the image in Q[...]");
9993 }
9994 }
9995 return FALSE;
9996}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR char my_yylinebuf[80]
Definition: febase.cc:44
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:106
#define NO_ZERODIVISOR
Definition: iparith.cc:109
#define ALLOW_LP
Definition: iparith.cc:111
#define RING_MASK
Definition: iparith.cc:98
#define WARN_RING
Definition: iparith.cc:118
#define NC_MASK
Definition: iparith.cc:92
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9671
#define NO_NC
Definition: iparith.cc:105
#define ZERODIVISOR_MASK
Definition: iparith.cc:99
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:487
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411
#define rField_is_Ring(R)
Definition: ring.h:485

◆ iiArithAddCmd()

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

Definition at line 9892 of file iparith.cc.

9899{
9900 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9901 // nTokval, nToktype, nPos);
9902 if(nPos>=0)
9903 {
9904 // no checks: we rely on a correct generated code in iparith.inc
9905 assume((unsigned)nPos < sArithBase.nCmdAllocated);
9906 assume(szName!=NULL);
9907 sArithBase.sCmds[nPos].name = omStrDup(szName);
9908 sArithBase.sCmds[nPos].alias = nAlias;
9909 sArithBase.sCmds[nPos].tokval = nTokval;
9910 sArithBase.sCmds[nPos].toktype = nToktype;
9912 //if(nTokval>0) sArithBase.nLastIdentifier++;
9913 }
9914 else
9915 {
9916 if(szName==NULL) return -1;
9917 int nIndex = iiArithFindCmd(szName);
9918 if(nIndex>=0)
9919 {
9920 Print("'%s' already exists at %d\n", szName, nIndex);
9921 return -1;
9922 }
9923
9925 {
9926 /* needs to create new slots */
9927 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9929 if(sArithBase.sCmds==NULL) return -1;
9931 }
9932 /* still free slots available */
9934 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9935 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9936 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9938
9939 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9943 {
9944 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9945 }
9946 //Print("L=%d\n", sArithBase.nLastIdentifier);
9947 }
9948 return 0;
9949}
#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:9725
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9797
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:389
#define nSize(n)
Definition: numbers.h:39
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 9797 of file iparith.cc.

9798{
9799 int an=0;
9800 int i = 0,v = 0;
9802
9803 loop
9804 //for(an=0; an<sArithBase.nCmdUsed; )
9805 {
9806 if(an>=en-1)
9807 {
9808 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9809 {
9810 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9811 return an;
9812 }
9813 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9814 {
9815 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9816 return en;
9817 }
9818 else
9819 {
9820 //Print("RET- 1\n");
9821 return -1;
9822 }
9823 }
9824 i=(an+en)/2;
9825 if (*szName < *(sArithBase.sCmds[i].name))
9826 {
9827 en=i-1;
9828 }
9829 else if (*szName > *(sArithBase.sCmds[i].name))
9830 {
9831 an=i+1;
9832 }
9833 else
9834 {
9835 v=strcmp(szName,sArithBase.sCmds[i].name);
9836 if(v<0)
9837 {
9838 en=i-1;
9839 }
9840 else if(v>0)
9841 {
9842 an=i+1;
9843 }
9844 else /*v==0*/
9845 {
9846 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9847 return i;
9848 }
9849 }
9850 }
9851 //if(i>=0 && i<sArithBase.nCmdUsed)
9852 // return i;
9853 //PrintS("RET-2\n");
9854 return -2;
9855}
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 9857 of file iparith.cc.

9858{
9859 if(nPos<0) return NULL;
9860 if(nPos<(int)sArithBase.nCmdUsed)
9861 return sArithBase.sCmds[nPos].name;
9862 return NULL;
9863}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9865 of file iparith.cc.

9866{
9867 int nIndex;
9868 if(szName==NULL) return -1;
9869
9870 nIndex = iiArithFindCmd(szName);
9871 if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9872 {
9873 Print("'%s' not found (%d)\n", szName, nIndex);
9874 return -1;
9875 }
9876 omFreeBinAddr(sArithBase.sCmds[nIndex].name);
9877 sArithBase.sCmds[nIndex].name=NULL;
9878 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9881
9882 /* fix last-identifier */
9885 {
9886 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9887 }
9888 //Print("L=%d\n", sArithBase.nLastIdentifier);
9889 return 0;
9890}
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258

◆ iiExprArith1()

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

Definition at line 9137 of file iparith.cc.

9138{
9139 if (!errorreported)
9140 {
9141 res->Init();
9142#ifdef SIQ
9143 if (siq>0)
9144 {
9145 //Print("siq:%d\n",siq);
9147 memcpy(&d->arg1,a,sizeof(sleftv));
9148 a->Init();
9149 d->op=op;
9150 d->argc=1;
9151 res->data=(char *)d;
9152 res->rtyp=COMMAND;
9153 return FALSE;
9154 }
9155#endif
9156 int at=a->Typ();
9157 // handling bb-objects ----------------------------------------------------
9158 if(op>MAX_TOK) // explicit type conversion to bb
9159 {
9160 blackbox *bb=getBlackboxStuff(op);
9161 if (bb!=NULL)
9162 {
9163 res->rtyp=op;
9164 res->data=bb->blackbox_Init(bb);
9165 return bb->blackbox_Assign(res,a);
9166 }
9167 else
9168 return TRUE;
9169 }
9170 else if (at>MAX_TOK) // argument is of bb-type
9171 {
9172 blackbox *bb=getBlackboxStuff(at);
9173 if (bb!=NULL)
9174 {
9175 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9176 // if not defined, try generic routines (attrib, defined,..)
9177 }
9178 else
9179 return TRUE;
9180 }
9181 if (errorreported) return TRUE;
9182
9183 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9184 return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9185 }
9186 a->CleanUp();
9187 return TRUE;
9188}
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:1030
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:60
VAR short errorreported
Definition: feFopen.cc:23
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation 'op' to an argument a return TRUE on failure
Definition: iparith.cc:9007
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9646
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1287
VAR omBin sip_command_bin
Definition: ipid.cc:45
ip_command * command
Definition: ipid.h:23
const struct sValCmd1 dArith1[]
Definition: table.h:37
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
VAR BOOLEAN siq
Definition: subexpr.cc:48
@ MAX_TOK
Definition: tok.h:218
#define COMMAND
Definition: tok.h:29

◆ iiExprArith1Tab()

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

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

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

Definition at line 9007 of file iparith.cc.

9008{
9009 res->Init();
9010 BOOLEAN call_failed=FALSE;
9011
9012 if (!errorreported)
9013 {
9014 BOOLEAN failed=FALSE;
9015 iiOp=op;
9016 int i = 0;
9017 while (dA1[i].cmd==op)
9018 {
9019 if (at==dA1[i].arg)
9020 {
9021 if (currRing!=NULL)
9022 {
9023 if (check_valid(dA1[i].valid_for,op)) break;
9024 }
9025 else
9026 {
9027 if (RingDependend(dA1[i].res))
9028 {
9029 WerrorS("no ring active (5)");
9030 break;
9031 }
9032 }
9033 if (traceit&TRACE_CALL)
9034 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9035 res->rtyp=dA1[i].res;
9036 if ((call_failed=dA1[i].p(res,a)))
9037 {
9038 break;// leave loop, goto error handling
9039 }
9040 if (a->Next()!=NULL)
9041 {
9043 failed=iiExprArith1(res->next,a->next,op);
9044 }
9045 a->CleanUp();
9046 return failed;
9047 }
9048 i++;
9049 }
9050 // implicite type conversion --------------------------------------------
9051 if (dA1[i].cmd!=op)
9052 {
9054 i=0;
9055 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9056 while (dA1[i].cmd==op)
9057 {
9058 int ai;
9059 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9060 if ((dA1[i].valid_for & NO_CONVERSION)==0)
9061 {
9062 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9063 {
9064 if (currRing!=NULL)
9065 {
9066 if (check_valid(dA1[i].valid_for,op)) break;
9067 }
9068 else
9069 {
9070 if (RingDependend(dA1[i].res))
9071 {
9072 WerrorS("no ring active (6)");
9073 break;
9074 }
9075 }
9076 if (traceit&TRACE_CALL)
9077 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9078 res->rtyp=dA1[i].res;
9079 failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9080 || (call_failed=dA1[i].p(res,an)));
9081 // everything done, clean up temp. variables
9082 if (failed)
9083 {
9084 // leave loop, goto error handling
9085 break;
9086 }
9087 else
9088 {
9089 if (an->Next() != NULL)
9090 {
9091 res->next = (leftv)omAllocBin(sleftv_bin);
9092 failed=iiExprArith1(res->next,an->next,op);
9093 }
9094 // everything ok, clean up and return
9095 an->CleanUp();
9097 return failed;
9098 }
9099 }
9100 }
9101 i++;
9102 }
9103 an->CleanUp();
9105 }
9106 // error handling
9107 if (!errorreported)
9108 {
9109 if ((at==0) && (a->Fullname()!=sNoName_fe))
9110 {
9111 Werror("`%s` is not defined",a->Fullname());
9112 }
9113 else
9114 {
9115 i=0;
9116 const char *s = iiTwoOps(op);
9117 Werror("%s(`%s`) failed"
9118 ,s,Tok2Cmdname(at));
9119 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9120 {
9121 while (dA1[i].cmd==op)
9122 {
9123 if ((dA1[i].res!=0)
9124 && (dA1[i].p!=jjWRONG))
9125 Werror("expected %s(`%s`)"
9126 ,s,Tok2Cmdname(dA1[i].arg));
9127 i++;
9128 }
9129 }
9130 }
9131 }
9132 res->rtyp = UNKNOWN;
9133 }
9134 a->CleanUp();
9135 return TRUE;
9136}
int BOOLEAN
Definition: auxiliary.h:87
void * ADDRESS
Definition: auxiliary.h:119
leftv next
Definition: subexpr.h:86
leftv Next()
Definition: subexpr.h:136
const char * Fullname()
Definition: subexpr.h:125
const CanonicalForm int s
Definition: facAbsFact.cc:51
const char sNoName_fe[]
Definition: fevoices.cc:57
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
const char * iiTwoOps(int t)
Definition: gentable.cc:261
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3694
#define NO_CONVERSION
Definition: iparith.cc:120
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:9137
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9951
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:435
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:145
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h: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
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142
#define UNKNOWN
Definition: tok.h:222

◆ iiExprArith2()

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

Definition at line 8948 of file iparith.cc.

8949{
8950 res->Init();
8951
8952 if (!errorreported)
8953 {
8954#ifdef SIQ
8955 if (siq>0)
8956 {
8957 //Print("siq:%d\n",siq);
8959 memcpy(&d->arg1,a,sizeof(sleftv));
8960 a->Init();
8961 memcpy(&d->arg2,b,sizeof(sleftv));
8962 b->Init();
8963 d->argc=2;
8964 d->op=op;
8965 res->data=(char *)d;
8966 res->rtyp=COMMAND;
8967 return FALSE;
8968 }
8969#endif
8970 int at=a->Typ();
8971 int bt=b->Typ();
8972 // handling bb-objects ----------------------------------------------------
8973 if (at>MAX_TOK)
8974 {
8975 blackbox *bb=getBlackboxStuff(at);
8976 if (bb!=NULL)
8977 {
8978 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8979 // if not defined, try generic (attrib, ..)
8980 }
8981 else
8982 return TRUE;
8983 }
8984 else if ((bt>MAX_TOK)&&(op!='('))
8985 {
8986 blackbox *bb=getBlackboxStuff(bt);
8987 if (bb!=NULL)
8988 {
8989 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8990 // if not defined, try generic (attrib, ..)
8991 }
8992 else
8993 return TRUE;
8994 }
8995 int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8996 return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8997 }
8998 a->CleanUp();
8999 b->CleanUp();
9000 return TRUE;
9001}
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:8775
const struct sValCmd2 dArith2[]
Definition: table.h:321

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

8938{
8939 res->Init();
8940 leftv b=a->next;
8941 a->next=NULL;
8942 int bt=b->Typ();
8944 a->next=b;
8945 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8946 return bo;
8947}

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

8780{
8781 BOOLEAN call_failed=FALSE;
8782
8783 if (!errorreported)
8784 {
8785 int i=0;
8786 iiOp=op;
8787 while (dA2[i].cmd==op)
8788 {
8789 if ((at==dA2[i].arg1)
8790 && (bt==dA2[i].arg2))
8791 {
8792 res->rtyp=dA2[i].res;
8793 if (currRing!=NULL)
8794 {
8795 if (check_valid(dA2[i].valid_for,op)) break;
8796 }
8797 else
8798 {
8799 if (RingDependend(dA2[i].res))
8800 {
8801 WerrorS("no ring active (3)");
8802 break;
8803 }
8804 }
8805 if (traceit&TRACE_CALL)
8806 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
8807 if ((call_failed=dA2[i].p(res,a,b)))
8808 {
8809 break;// leave loop, goto error handling
8810 }
8811 a->CleanUp();
8812 b->CleanUp();
8813 //Print("op: %d,result typ:%d\n",op,res->rtyp);
8814 return FALSE;
8815 }
8816 i++;
8817 }
8818 // implicite type conversion ----------------------------------------------
8819 if (dA2[i].cmd!=op)
8820 {
8821 int ai,bi;
8824 BOOLEAN failed=FALSE;
8825 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8826 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
8827 while (dA2[i].cmd==op)
8828 {
8829 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8830 if ((dA2[i].valid_for & NO_CONVERSION)==0)
8831 {
8832 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
8833 {
8834 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
8835 {
8836 res->rtyp=dA2[i].res;
8837 if (currRing!=NULL)
8838 {
8839 if (check_valid(dA2[i].valid_for,op)) break;
8840 }
8841 else
8842 {
8843 if (RingDependend(dA2[i].res))
8844 {
8845 WerrorS("no ring active (4)");
8846 break;
8847 }
8848 }
8849 if (traceit&TRACE_CALL)
8850 Print("call %s(%s,%s)\n",iiTwoOps(op),
8851 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8852 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
8853 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
8854 || (call_failed=dA2[i].p(res,an,bn)));
8855 // everything done, clean up temp. variables
8856 if (failed)
8857 {
8858 // leave loop, goto error handling
8859 break;
8860 }
8861 else
8862 {
8863 // everything ok, clean up and return
8864 an->CleanUp();
8865 bn->CleanUp();
8868 return FALSE;
8869 }
8870 }
8871 }
8872 }
8873 i++;
8874 }
8875 an->CleanUp();
8876 bn->CleanUp();
8879 }
8880 // error handling ---------------------------------------------------
8881 const char *s=NULL;
8882 if (!errorreported)
8883 {
8884 if ((at==0) && (a->Fullname()!=sNoName_fe))
8885 {
8886 s=a->Fullname();
8887 }
8888 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8889 {
8890 s=b->Fullname();
8891 }
8892 if (s!=NULL)
8893 Werror("`%s` is not defined",s);
8894 else
8895 {
8896 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8897 s = iiTwoOps(op);
8898 if (proccall)
8899 {
8900 Werror("%s(`%s`,`%s`) failed"
8901 ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8902 }
8903 else
8904 {
8905 Werror("`%s` %s `%s` failed"
8906 ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8907 }
8908 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8909 {
8910 while (dA2[i].cmd==op)
8911 {
8912 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8913 && (dA2[i].res!=0)
8914 && (dA2[i].p!=jjWRONG2))
8915 {
8916 if (proccall)
8917 Werror("expected %s(`%s`,`%s`)"
8918 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8919 else
8920 Werror("expected `%s` %s `%s`"
8921 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8922 }
8923 i++;
8924 }
8925 }
8926 }
8927 }
8928 a->CleanUp();
8929 b->CleanUp();
8930 res->rtyp = UNKNOWN;
8931 }
8932 return TRUE;
8933}
static BOOLEAN jjWRONG2(leftv, leftv, leftv)
Definition: iparith.cc:3698
short res
Definition: gentable.cc:73

◆ iiExprArith3()

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

Definition at line 9347 of file iparith.cc.

9348{
9349 res->Init();
9350
9351 if (!errorreported)
9352 {
9353#ifdef SIQ
9354 if (siq>0)
9355 {
9356 //Print("siq:%d\n",siq);
9358 memcpy(&d->arg1,a,sizeof(sleftv));
9359 a->Init();
9360 memcpy(&d->arg2,b,sizeof(sleftv));
9361 b->Init();
9362 memcpy(&d->arg3,c,sizeof(sleftv));
9363 c->Init();
9364 d->op=op;
9365 d->argc=3;
9366 res->data=(char *)d;
9367 res->rtyp=COMMAND;
9368 return FALSE;
9369 }
9370#endif
9371 int at=a->Typ();
9372 // handling bb-objects ----------------------------------------------
9373 if (at>MAX_TOK)
9374 {
9375 blackbox *bb=getBlackboxStuff(at);
9376 if (bb!=NULL)
9377 {
9378 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9379 // otherwise, try defaul (attrib,..)
9380 }
9381 else
9382 return TRUE;
9383 if (errorreported) return TRUE;
9384 }
9385 int bt=b->Typ();
9386 int ct=c->Typ();
9387
9388 iiOp=op;
9389 int i=0;
9390 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9391 return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9392 }
9393 a->CleanUp();
9394 b->CleanUp();
9395 c->CleanUp();
9396 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9397 return TRUE;
9398}
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:9194
const struct sValCmd3 dArith3[]
Definition: table.h:777

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

9403{
9404 res->Init();
9405 leftv b=a->next;
9406 a->next=NULL;
9407 int bt=b->Typ();
9408 leftv c=b->next;
9409 b->next=NULL;
9410 int ct=c->Typ();
9411 BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9412 b->next=c;
9413 a->next=b;
9414 a->CleanUp(); // to cleanup the chain, content already done
9415 return bo;
9416}

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

9197{
9198 BOOLEAN call_failed=FALSE;
9199
9200 assume(dA3[0].cmd==op);
9201
9202 if (!errorreported)
9203 {
9204 int i=0;
9205 iiOp=op;
9206 while (dA3[i].cmd==op)
9207 {
9208 if ((at==dA3[i].arg1)
9209 && (bt==dA3[i].arg2)
9210 && (ct==dA3[i].arg3))
9211 {
9212 res->rtyp=dA3[i].res;
9213 if (currRing!=NULL)
9214 {
9215 if (check_valid(dA3[i].valid_for,op)) break;
9216 }
9217 if (traceit&TRACE_CALL)
9218 Print("call %s(%s,%s,%s)\n",
9220 if ((call_failed=dA3[i].p(res,a,b,c)))
9221 {
9222 break;// leave loop, goto error handling
9223 }
9224 a->CleanUp();
9225 b->CleanUp();
9226 c->CleanUp();
9227 return FALSE;
9228 }
9229 i++;
9230 }
9231 // implicite type conversion ----------------------------------------------
9232 if (dA3[i].cmd!=op)
9233 {
9234 int ai,bi,ci;
9238 BOOLEAN failed=FALSE;
9239 i=0;
9240 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9241 while (dA3[i].cmd==op)
9242 {
9243 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9244 {
9245 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9246 {
9247 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9248 {
9249 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9250 {
9251 res->rtyp=dA3[i].res;
9252 if (currRing!=NULL)
9253 {
9254 if (check_valid(dA3[i].valid_for,op)) break;
9255 }
9256 if (traceit&TRACE_CALL)
9257 Print("call %s(%s,%s,%s)\n",
9258 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9259 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9260 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9261 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9262 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9263 || (call_failed=dA3[i].p(res,an,bn,cn)));
9264 // everything done, clean up temp. variables
9265 if (failed)
9266 {
9267 // leave loop, goto error handling
9268 break;
9269 }
9270 else
9271 {
9272 // everything ok, clean up and return
9273 an->CleanUp();
9274 bn->CleanUp();
9275 cn->CleanUp();
9279 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9280 return FALSE;
9281 }
9282 }
9283 }
9284 }
9285 }
9286 i++;
9287 }
9288 an->CleanUp();
9289 bn->CleanUp();
9290 cn->CleanUp();
9294 }
9295 // error handling ---------------------------------------------------
9296 if (!errorreported)
9297 {
9298 const char *s=NULL;
9299 if ((at==0) && (a->Fullname()!=sNoName_fe))
9300 {
9301 s=a->Fullname();
9302 }
9303 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9304 {
9305 s=b->Fullname();
9306 }
9307 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9308 {
9309 s=c->Fullname();
9310 }
9311 if (s!=NULL)
9312 Werror("`%s` is not defined",s);
9313 else
9314 {
9315 i=0;
9316 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9317 const char *s = iiTwoOps(op);
9318 Werror("%s(`%s`,`%s`,`%s`) failed"
9319 ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9320 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9321 {
9322 while (dA3[i].cmd==op)
9323 {
9324 if(((at==dA3[i].arg1)
9325 ||(bt==dA3[i].arg2)
9326 ||(ct==dA3[i].arg3))
9327 && (dA3[i].res!=0))
9328 {
9329 Werror("expected %s(`%s`,`%s`,`%s`)"
9330 ,s,Tok2Cmdname(dA3[i].arg1)
9331 ,Tok2Cmdname(dA3[i].arg2)
9332 ,Tok2Cmdname(dA3[i].arg3));
9333 }
9334 i++;
9335 }
9336 }
9337 }
9338 }
9339 res->rtyp = UNKNOWN;
9340 }
9341 a->CleanUp();
9342 b->CleanUp();
9343 c->CleanUp();
9344 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9345 return TRUE;
9346}
short res
Definition: gentable.cc:90

◆ iiExprArithM()

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

Definition at line 9438 of file iparith.cc.

9439{
9440 res->Init();
9441
9442 if (!errorreported)
9443 {
9444#ifdef SIQ
9445 if (siq>0)
9446 {
9447 //Print("siq:%d\n",siq);
9449 d->op=op;
9450 res->data=(char *)d;
9451 if (a!=NULL)
9452 {
9453 d->argc=a->listLength();
9454 // else : d->argc=0;
9455 memcpy(&d->arg1,a,sizeof(sleftv));
9456 switch(d->argc)
9457 {
9458 case 3:
9459 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9460 a->next->next->Init();
9461 /* no break */
9462 case 2:
9463 memcpy(&d->arg2,a->next,sizeof(sleftv));
9464 a->next->Init();
9465 a->next->next=d->arg2.next;
9466 d->arg2.next=NULL;
9467 /* no break */
9468 case 1:
9469 a->Init();
9470 a->next=d->arg1.next;
9471 d->arg1.next=NULL;
9472 }
9473 if (d->argc>3) a->next=NULL;
9474 a->name=NULL;
9475 a->rtyp=0;
9476 a->data=NULL;
9477 a->e=NULL;
9478 a->attribute=NULL;
9479 a->CleanUp();
9480 }
9481 res->rtyp=COMMAND;
9482 return FALSE;
9483 }
9484#endif
9485 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9486 {
9487 blackbox *bb=getBlackboxStuff(a->Typ());
9488 if (bb!=NULL)
9489 {
9490 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9491 // otherwise, try default
9492 }
9493 else
9494 return TRUE;
9495 if (errorreported) return TRUE;
9496 }
9497 int args=0;
9498 if (a!=NULL) args=a->listLength();
9499
9500 iiOp=op;
9501 int i=0;
9502 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9503 while (dArithM[i].cmd==op)
9504 {
9505 if ((args==dArithM[i].number_of_args)
9506 || (dArithM[i].number_of_args==-1)
9507 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9508 {
9509 res->rtyp=dArithM[i].res;
9510 if (currRing!=NULL)
9511 {
9512 if (check_valid(dArithM[i].valid_for,op)) break;
9513 }
9514 if (traceit&TRACE_CALL)
9515 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9516 if (dArithM[i].p(res,a))
9517 {
9518 break;// leave loop, goto error handling
9519 }
9520 if (a!=NULL) a->CleanUp();
9521 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9522 return FALSE;
9523 }
9524 i++;
9525 }
9526 // error handling
9527 if (!errorreported)
9528 {
9529 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9530 {
9531 Werror("`%s` is not defined",a->Fullname());
9532 }
9533 else
9534 {
9535 const char *s = iiTwoOps(op);
9536 Werror("%s(...) failed",s);
9537 }
9538 }
9539 res->rtyp = UNKNOWN;
9540 }
9541 if (a!=NULL) a->CleanUp();
9542 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9543 return TRUE;
9544}
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
const char * Name()
Definition: subexpr.h:120
int listLength()
Definition: subexpr.cc:51
void * data
Definition: subexpr.h:88
Subexpr e
Definition: subexpr.h:105
attr attribute
Definition: subexpr.h:89
short res
Definition: gentable.cc:100
const struct sValCmdM dArithM[]
Definition: table.h:911

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9762 of file iparith.cc.

9763{
9764 //printf("iiInitArithmetic()\n");
9765 memset(&sArithBase, 0, sizeof(sArithBase));
9766 iiInitCmdName();
9767 /* fix last-identifier */
9768#if 0
9769 /* we expect that gentable allready did every thing */
9772 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9773 }
9774#endif
9775 //Print("L=%d\n", sArithBase.nLastIdentifier);
9776
9777 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9778 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9779
9780 //iiArithAddCmd("Top", 0,-1,0);
9781
9782
9783 //for(i=0; i<sArithBase.nCmdUsed; i++) {
9784 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9785 // sArithBase.sCmds[i].name,
9786 // sArithBase.sCmds[i].alias,
9787 // sArithBase.sCmds[i].tokval,
9788 // sArithBase.sCmds[i].toktype);
9789 //}
9790 //iiArithRemoveCmd("Top");
9791 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9792 //iiArithRemoveCmd("mygcd");
9793 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9794 return 0;
9795}

◆ 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:4083
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition: coeffs.h:544

◆ iiTabIndex()

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

Definition at line 9646 of file iparith.cc.

9647{
9648 // user defined types are not in the pre-computed table:
9649 if (op>MAX_TOK) return 0;
9650
9651 int a=0;
9652 int e=len;
9653 int p=len/2;
9654 do
9655 {
9656 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9657 if (op<dArithTab[p].cmd) e=p-1;
9658 else a = p+1;
9659 p=a+(e-a)/2;
9660 }
9661 while ( a <= e);
9662
9663 // catch missing a cmd:
9664 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9665 // Print("op %d (%c) unknown",op,op);
9666 return 0;
9667}

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

9548{
9549 int i;
9550 int an=1;
9552
9553 loop
9554 //for(an=0; an<sArithBase.nCmdUsed; )
9555 {
9556 if(an>=en-1)
9557 {
9558 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9559 {
9560 i=an;
9561 break;
9562 }
9563 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9564 {
9565 i=en;
9566 break;
9567 }
9568 else
9569 {
9570 // -- blackbox extensions:
9571 // return 0;
9572 return blackboxIsCmd(n,tok);
9573 }
9574 }
9575 i=(an+en)/2;
9576 if (*n < *(sArithBase.sCmds[i].name))
9577 {
9578 en=i-1;
9579 }
9580 else if (*n > *(sArithBase.sCmds[i].name))
9581 {
9582 an=i+1;
9583 }
9584 else
9585 {
9586 int v=strcmp(n,sArithBase.sCmds[i].name);
9587 if(v<0)
9588 {
9589 en=i-1;
9590 }
9591 else if(v>0)
9592 {
9593 an=i+1;
9594 }
9595 else /*v==0*/
9596 {
9597 break;
9598 }
9599 }
9600 }
9602 tok=sArithBase.sCmds[i].tokval;
9603 if(sArithBase.sCmds[i].alias==2)
9604 {
9605 Warn("outdated identifier `%s` used - please change your code",
9606 sArithBase.sCmds[i].name);
9607 sArithBase.sCmds[i].alias=1;
9608 }
9609 #if 0
9610 if (currRingHdl==NULL)
9611 {
9612 #ifdef SIQ
9613 if (siq<=0)
9614 {
9615 #endif
9616 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9617 {
9618 WerrorS("no ring active");
9619 return 0;
9620 }
9621 #ifdef SIQ
9622 }
9623 #endif
9624 }
9625 #endif
9626 if (!expected_parms)
9627 {
9628 switch (tok)
9629 {
9630 case IDEAL_CMD:
9631 case INT_CMD:
9632 case INTVEC_CMD:
9633 case MAP_CMD:
9634 case MATRIX_CMD:
9635 case MODUL_CMD:
9636 case POLY_CMD:
9637 case PROC_CMD:
9638 case RING_CMD:
9639 case STRING_CMD:
9640 cmdtok = tok;
9641 break;
9642 }
9643 }
9644 return sArithBase.sCmds[i].toktype;
9645}
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:310
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ MAP_CMD
Definition: grammar.cc:285
@ PROC_CMD
Definition: grammar.cc:280
@ BEGIN_RING
Definition: grammar.cc:282
@ MODUL_CMD
Definition: grammar.cc:287
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
EXTERN_VAR BOOLEAN expected_parms
Definition: iparith.cc: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:185
@ INT_CMD
Definition: tok.h:96

◆ jjALIGN_M()

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

Definition at line 1779 of file iparith.cc.

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

◆ jjALIGN_V()

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

Definition at line 1769 of file iparith.cc.

1770{
1771 poly p=(poly)u->CopyD();
1772 int s=(int)(long)v->Data();
1773 if (s+p_MinComp(p,currRing)<=0)
1774 { p_Delete(&p,currRing);return TRUE;}
1775 p_Shift(&p,s,currRing);
1776 res->data=p;
1777 return FALSE;
1778}
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4706
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 1380 of file iparith.cc.

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

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3813 of file iparith.cc.

3814{
3815 //matrix m=(matrix)v->Data();
3816 //lists l=mpBareiss(m,FALSE);
3817 intvec *iv;
3818 ideal m;
3819 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3821 l->Init(2);
3822 l->m[0].rtyp=MODUL_CMD;
3823 l->m[1].rtyp=INTVEC_CMD;
3824 l->m[0].data=(void *)m;
3825 l->m[1].data=(void *)iv;
3826 res->data = (char *)l;
3827 return FALSE;
3828}
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
Definition: lists.h:24
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition: sparsmat.cc:347

◆ jjBAREISS3()

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

Definition at line 6016 of file iparith.cc.

6017{
6018 intvec *iv;
6019 ideal m;
6021 int k=(int)(long)w->Data();
6022 if (k>=0)
6023 {
6024 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6025 l->Init(2);
6026 l->m[0].rtyp=MODUL_CMD;
6027 l->m[1].rtyp=INTVEC_CMD;
6028 l->m[0].data=(void *)m;
6029 l->m[1].data=(void *)iv;
6030 }
6031 else
6032 {
6033 m=sm_CallSolv((ideal)u->Data(), currRing);
6034 l->Init(1);
6035 l->m[0].rtyp=IDEAL_CMD;
6036 l->m[0].data=(void *)m;
6037 }
6038 res->data = (char *)l;
6039 return FALSE;
6040}
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 3836 of file iparith.cc.

3837{
3838 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3839 b->hnf();
3840 res->data=(char*)b;
3841 return FALSE;
3842}
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 3858 of file iparith.cc.

3859{
3860 bigintmat *b=(bigintmat*)u->Data();
3861 res->data=(void *)bim2iv(b);
3862 return FALSE;
3863}
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3843 of file iparith.cc.

3844{
3845 BOOLEAN bo=FALSE;
3846 number n=(number)u->CopyD();
3848 if (nMap!=NULL)
3849 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3850 else
3851 {
3852 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3853 bo=TRUE;
3854 }
3856 return bo;
3857}
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:697
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:452
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:960
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3864 of file iparith.cc.

3865{
3866 sleftv tmp;
3867 BOOLEAN bo=jjBI2N(&tmp,u);
3868 if (!bo)
3869 {
3870 number n=(number) tmp.data;
3871 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3872 else
3873 {
3874 res->data=(void *)pNSet(n);
3875 }
3876 }
3877 return bo;
3878}
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3843
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define pNSet(n)
Definition: polys.h:313

◆ jjBRACK_Bim()

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

Definition at line 5761 of file iparith.cc.

5762{
5763 bigintmat *bim = (bigintmat *)u->Data();
5764 int r = (int)(long)v->Data();
5765 int c = (int)(long)w->Data();
5766 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5767 {
5768 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5769 r,c,u->Fullname(),bim->rows(),bim->cols());
5770 return TRUE;
5771 }
5772 res->data=u->data; u->data=NULL;
5773 res->rtyp=u->rtyp; u->rtyp=0;
5774 res->name=u->name; u->name=NULL;
5775 Subexpr e=jjMakeSub(v);
5776 e->next=jjMakeSub(w);
5777 if (u->e==NULL)
5778 res->e=e;
5779 else
5780 {
5781 Subexpr h=u->e;
5782 while (h->next!=NULL) h=h->next;
5783 h->next=e;
5784 res->e=u->e;
5785 u->e=NULL;
5786 }
5787 return FALSE;
5788}
int cols() const
Definition: bigintmat.h:144
int rows() const
Definition: bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:8742
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ jjBRACK_Im()

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

Definition at line 5734 of file iparith.cc.

5735{
5736 intvec *iv = (intvec *)u->Data();
5737 int r = (int)(long)v->Data();
5738 int c = (int)(long)w->Data();
5739 if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5740 {
5741 Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5742 r,c,u->Fullname(),iv->rows(),iv->cols());
5743 return TRUE;
5744 }
5745 res->data=u->data; u->data=NULL;
5746 res->rtyp=u->rtyp; u->rtyp=0;
5747 res->name=u->name; u->name=NULL;
5748 Subexpr e=jjMakeSub(v);
5749 e->next=jjMakeSub(w);
5750 if (u->e==NULL) res->e=e;
5751 else
5752 {
5753 Subexpr h=u->e;
5754 while (h->next!=NULL) h=h->next;
5755 h->next=e;
5756 res->e=u->e;
5757 u->e=NULL;
5758 }
5759 return FALSE;
5760}
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 5789 of file iparith.cc.

5790{
5791 matrix m= (matrix)u->Data();
5792 int r = (int)(long)v->Data();
5793 int c = (int)(long)w->Data();
5794 //Print("gen. elem %d, %d\n",r,c);
5795 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5796 {
5797 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5798 MATROWS(m),MATCOLS(m));
5799 return TRUE;
5800 }
5801 res->data=u->data; u->data=NULL;
5802 res->rtyp=u->rtyp; u->rtyp=0;
5803 res->name=u->name; u->name=NULL;
5804 Subexpr e=jjMakeSub(v);
5805 e->next=jjMakeSub(w);
5806 if (u->e==NULL)
5807 res->e=e;
5808 else
5809 {
5810 Subexpr h=u->e;
5811 while (h->next!=NULL) h=h->next;
5812 h->next=e;
5813 res->e=u->e;
5814 u->e=NULL;
5815 }
5816 return FALSE;
5817}
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 5847 of file iparith.cc.

5848{
5849 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5850 {
5851 WerrorS("cannot build expression lists from unnamed objects");
5852 return TRUE;
5853 }
5854
5855 leftv p=NULL;
5856 intvec *iv=(intvec *)w->Data();
5857 int l;
5858 BOOLEAN nok;
5859 sleftv ut;
5860 memcpy(&ut,u,sizeof(ut));
5861 sleftv t;
5862 t.Init();
5863 t.rtyp=INT_CMD;
5864 for (l=0;l< iv->length(); l++)
5865 {
5866 t.data=(char *)(long)((*iv)[l]);
5867 if (p==NULL)
5868 {
5869 p=res;
5870 }
5871 else
5872 {
5873 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5874 p=p->next;
5875 }
5876 memcpy(u,&ut,sizeof(ut));
5877 if (u->Typ() == MATRIX_CMD)
5878 nok=jjBRACK_Ma(p,u,v,&t);
5879 else if (u->Typ() == BIGINTMAT_CMD)
5880 nok=jjBRACK_Bim(p,u,v,&t);
5881 else /* INTMAT_CMD */
5882 nok=jjBRACK_Im(p,u,v,&t);
5883 if (nok)
5884 {
5885 while (res->next!=NULL)
5886 {
5887 p=res->next->next;
5889 // res->e aufraeumen !!!!
5890 res->next=p;
5891 }
5892 return TRUE;
5893 }
5894 }
5895 return FALSE;
5896}
int length() const
Definition: intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5761
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5734
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5789
#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 5897 of file iparith.cc.

5898{
5899 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5900 {
5901 WerrorS("cannot build expression lists from unnamed objects");
5902 return TRUE;
5903 }
5904 leftv p=NULL;
5905 intvec *iv=(intvec *)v->Data();
5906 int l;
5907 BOOLEAN nok;
5908 sleftv ut;
5909 memcpy(&ut,u,sizeof(ut));
5910 sleftv t;
5911 t.Init();
5912 t.rtyp=INT_CMD;
5913 for (l=0;l< iv->length(); l++)
5914 {
5915 t.data=(char *)(long)((*iv)[l]);
5916 if (p==NULL)
5917 {
5918 p=res;
5919 }
5920 else
5921 {
5922 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5923 p=p->next;
5924 }
5925 memcpy(u,&ut,sizeof(ut));
5926 if (u->Typ() == MATRIX_CMD)
5927 nok=jjBRACK_Ma(p,u,&t,w);
5928 else if (u->Typ() == BIGINTMAT_CMD)
5929 nok=jjBRACK_Bim(p,u,&t,w);
5930 else /* INTMAT_CMD */
5931 nok=jjBRACK_Im(p,u,&t,w);
5932 if (nok)
5933 {
5934 while (res->next!=NULL)
5935 {
5936 p=res->next->next;
5938 // res->e aufraeumen !!
5939 res->next=p;
5940 }
5941 return TRUE;
5942 }
5943 }
5944 return FALSE;
5945}

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5946 of file iparith.cc.

5947{
5948 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5949 {
5950 WerrorS("cannot build expression lists from unnamed objects");
5951 return TRUE;
5952 }
5953 leftv p=NULL;
5954 intvec *vv=(intvec *)v->Data();
5955 intvec *wv=(intvec *)w->Data();
5956 int vl;
5957 int wl;
5958 BOOLEAN nok;
5959
5960 sleftv t1,t2,ut;
5961 memcpy(&ut,u,sizeof(ut));
5962 t1.Init();
5963 t1.rtyp=INT_CMD;
5964 t2.Init();
5965 t2.rtyp=INT_CMD;
5966 for (vl=0;vl< vv->length(); vl++)
5967 {
5968 t1.data=(char *)(long)((*vv)[vl]);
5969 for (wl=0;wl< wv->length(); wl++)
5970 {
5971 t2.data=(char *)(long)((*wv)[wl]);
5972 if (p==NULL)
5973 {
5974 p=res;
5975 }
5976 else
5977 {
5978 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5979 p=p->next;
5980 }
5981 memcpy(u,&ut,sizeof(ut));
5982 if (u->Typ() == MATRIX_CMD)
5983 nok=jjBRACK_Ma(p,u,&t1,&t2);
5984 else if (u->Typ() == BIGINTMAT_CMD)
5985 nok=jjBRACK_Bim(p,u,&t1,&t2);
5986 else /* INTMAT_CMD */
5987 nok=jjBRACK_Im(p,u,&t1,&t2);
5988 if (nok)
5989 {
5990 res->CleanUp();
5991 return TRUE;
5992 }
5993 }
5994 }
5995 return FALSE;
5996}

◆ jjBRACK_S()

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

Definition at line 5718 of file iparith.cc.

5719{
5720 char *s= (char *)u->Data();
5721 int r = (int)(long)v->Data();
5722 int c = (int)(long)w->Data();
5723 int l = strlen(s);
5724
5725 if ( (r<1) || (r>l) || (c<0) )
5726 {
5727 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5728 return TRUE;
5729 }
5730 res->data = (char *)omAlloc((long)(c+1));
5731 snprintf((char *)res->data,c+1,"%-*.*s",c,c,s+r-1);
5732 return FALSE;
5733}
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ jjBRACK_SM()

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

Definition at line 5818 of file iparith.cc.

5819{
5820 ideal m= (ideal)u->Data();
5821 int r = (int)(long)v->Data();
5822 int c = (int)(long)w->Data();
5823 //Print("gen. elem %d, %d\n",r,c);
5824 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5825 {
5826 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5827 (int)m->rank,IDELEMS(m));
5828 return TRUE;
5829 }
5830 res->data=u->data; u->data=NULL;
5831 res->rtyp=u->rtyp; u->rtyp=0;
5832 res->name=u->name; u->name=NULL;
5833 Subexpr e=jjMakeSub(v);
5834 e->next=jjMakeSub(w);
5835 if (u->e==NULL)
5836 res->e=e;
5837 else
5838 {
5839 Subexpr h=u->e;
5840 while (h->next!=NULL) h=h->next;
5841 h->next=e;
5842 res->e=u->e;
5843 u->e=NULL;
5844 }
5845 return FALSE;
5846}

◆ jjBRACKET()

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

Definition at line 2908 of file iparith.cc.

2909{
2910 res->data=NULL;
2911
2913 {
2914 const poly q = (poly)b->Data();
2915
2916 if( q != NULL )
2917 {
2918 if( (poly)a->Data() != NULL )
2919 {
2921 {
2922 poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2923 res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2924 }
2925 else if (rIsLPRing(currRing))
2926 {
2927 const poly p = (poly)a->Data();
2928 res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2929 }
2930 }
2931 }
2932 }
2933 return FALSE;
2934}
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2251
#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 2935 of file iparith.cc.

2936{
2937 res->data=NULL;
2938
2940 {
2941 const poly q = (poly)b->Data();
2942 if(q != NULL)
2943 {
2944 if((poly)a->Data() != NULL)
2945 {
2946 const poly p = (poly)a->Data();
2947 int k=(int)(long)c->Data();
2948 if (k > 0)
2949 {
2950 poly qq = pCopy(q);
2951 for (int i = 0; i < k; i++)
2952 {
2953 poly qq_ref = qq;
2954 if (rIsLPRing(currRing))
2955 {
2956 qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
2957 }
2958 else if (rIsPluralRing(currRing))
2959 {
2960 qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
2961 }
2962 pDelete(&qq_ref);
2963 if (qq == NULL) break;
2964 }
2965 res->data = qq;
2966 }
2967 else
2968 {
2969 Werror("invalid number of iterations");
2970 }
2971 }
2972 }
2973 }
2974 return FALSE;
2975}
#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 7164 of file iparith.cc.

7165{
7166#ifdef HAVE_SDB
7167 sdb_show_bp();
7168#endif
7169 return FALSE;
7170}
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7171 of file iparith.cc.

7172{
7173#ifdef HAVE_SDB
7174 if(v->Typ()==PROC_CMD)
7175 {
7176 int lineno=0;
7177 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7178 {
7179 lineno=(int)(long)v->next->Data();
7180 }
7181 return sdb_set_breakpoint(v->Name(),lineno);
7182 }
7183 return TRUE;
7184#else
7185 return FALSE;
7186#endif
7187}
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 7188 of file iparith.cc.

7189{
7190 return iiExprArith1(res,v,iiOp);
7191}

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3879 of file iparith.cc.

3880{
3881 return iiExprArithM(res,u,iiOp);
3882}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:9438

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7192 of file iparith.cc.

7193{
7194 leftv v=u->next;
7195 u->next=NULL;
7196 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7197 u->next=v;
7198 return b;
7199}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8948

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7200 of file iparith.cc.

7201{
7202 leftv v = u->next;
7203 leftv w = v->next;
7204 u->next = NULL;
7205 v->next = NULL;
7206 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7207 u->next = v;
7208 v->next = w;
7209 return b;
7210}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:9347

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3883 of file iparith.cc.

3884{
3885 res->data = (char *)(long)rChar((ring)v->Data());
3886 return FALSE;
3887}
int rChar(ring r)
Definition: ring.cc:713

◆ jjCHINREM_BI()

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

Definition at line 1682 of file iparith.cc.

1683{
1684 intvec *c=(intvec*)u->Data();
1685 intvec* p=(intvec*)v->Data();
1686 int rl=p->length();
1687 number *x=(number *)omAlloc(rl*sizeof(number));
1688 number *q=(number *)omAlloc(rl*sizeof(number));
1689 int i;
1690 for(i=rl-1;i>=0;i--)
1691 {
1692 q[i]=n_Init((*p)[i], coeffs_BIGINT);
1693 x[i]=n_Init((*c)[i], coeffs_BIGINT);
1694 }
1695 CFArray iv(rl);
1696 number n=n_ChineseRemainderSym(x,q,rl,FALSE,iv,coeffs_BIGINT);
1697 for(i=rl-1;i>=0;i--)
1698 {
1699 n_Delete(&(q[i]),coeffs_BIGINT);
1701 }
1702 omFree(x); omFree(q);
1703 res->data=(char *)n;
1704 return FALSE;
1705}
Variable x
Definition: cfModGcd.cc:4082
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:761
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:535
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ jjCHINREM_ID()

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

Definition at line 9998 of file iparith.cc.

9999{
10000 if ((currRing!=NULL)
10002 && (!rField_is_Z(currRing)))
10003 {
10004 WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
10005 return TRUE;
10006 }
10007 coeffs cf;
10008 lists c=(lists)u->CopyD(); // list of ideal or bigint/int
10009 int rl=c->nr+1;
10010 int return_type=c->m[0].Typ();
10011 if ((return_type!=IDEAL_CMD)
10012 && (return_type!=MODUL_CMD)
10013 && (return_type!=SMATRIX_CMD)
10014 && (return_type!=MATRIX_CMD)
10015 && (return_type!=POLY_CMD))
10016 {
10017 if((return_type==BIGINT_CMD)
10018 ||(return_type==INT_CMD))
10019 return_type=BIGINT_CMD;
10020 else if (return_type==LIST_CMD)
10021 {
10022 // create a tmp list of the correct size
10024 res_l->Init(rl /*c->nr+1*/);
10025 BOOLEAN bo=FALSE;
10026 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
10027 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10028 {
10029 sleftv tmp;
10030 tmp.Copy(v);
10031 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10032 if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
10033 }
10034 c->Clean();
10035 res->data=res_l;
10036 res->rtyp=LIST_CMD;
10037 return bo;
10038 }
10039 else
10040 {
10041 c->Clean();
10042 WerrorS("poly/ideal/module/matrix/list expected");
10043 return TRUE;
10044 }
10045 }
10046 if (return_type==BIGINT_CMD)
10048 else
10049 {
10050 cf=currRing->cf;
10051 if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
10052 cf=cf->extRing->cf;
10053 }
10054 lists pl=NULL;
10055 intvec *p=NULL;
10056 if (v->Typ()==LIST_CMD)
10057 {
10058 pl=(lists)v->Data();
10059 if (pl->nr!=rl-1)
10060 {
10061 WerrorS("wromg number of primes");
10062 return TRUE;
10063 }
10064 }
10065 else
10066 {
10067 p=(intvec*)v->Data();
10068 if (p->length()!=rl)
10069 {
10070 WerrorS("wromg number of primes");
10071 return TRUE;
10072 }
10073 }
10074 ideal result;
10075 ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
10076 number *xx=NULL;
10078 int i;
10079 if (return_type!=BIGINT_CMD)
10080 {
10081 for(i=rl-1;i>=0;i--)
10082 {
10083 if (c->m[i].Typ()!=return_type)
10084 {
10085 Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
10086 omFree(x); // delete c
10087 return TRUE;
10088 }
10089 if (return_type==POLY_CMD)
10090 {
10091 x[i]=idInit(1,1);
10092 x[i]->m[0]=(poly)c->m[i].CopyD();
10093 }
10094 else
10095 {
10096 x[i]=(ideal)c->m[i].CopyD();
10097 }
10098 //c->m[i].Init();
10099 }
10100 }
10101 else
10102 {
10103 if (nMap==NULL)
10104 {
10105 Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10106 return TRUE;
10107 }
10108 xx=(number *)omAlloc(rl*sizeof(number));
10109 for(i=rl-1;i>=0;i--)
10110 {
10111 if (c->m[i].Typ()==INT_CMD)
10112 {
10113 xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10114 }
10115 else if (c->m[i].Typ()==BIGINT_CMD)
10116 {
10117 xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10118 }
10119 else
10120 {
10121 Werror("bigint expected at pos %d",i+1);
10122 omFree(x); // delete c
10123 omFree(xx); // delete c
10124 return TRUE;
10125 }
10126 }
10127 }
10128 number *q=(number *)omAlloc(rl*sizeof(number));
10129 if (p!=NULL)
10130 {
10131 for(i=rl-1;i>=0;i--)
10132 {
10133 q[i]=n_Init((*p)[i], cf);
10134 }
10135 }
10136 else
10137 {
10138 for(i=rl-1;i>=0;i--)
10139 {
10140 if (pl->m[i].Typ()==INT_CMD)
10141 {
10142 q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10143 }
10144 else if (pl->m[i].Typ()==BIGINT_CMD)
10145 {
10146 q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10147 }
10148 else
10149 {
10150 Werror("bigint expected at pos %d",i+1);
10151 for(i++;i<rl;i++)
10152 {
10153 n_Delete(&(q[i]),cf);
10154 }
10155 omFree(x); // delete c
10156 omFree(q); // delete pl
10157 if (xx!=NULL) omFree(xx); // delete c
10158 return TRUE;
10159 }
10160 }
10161 }
10162 if (return_type==BIGINT_CMD)
10163 {
10164 CFArray i_v(rl);
10165 number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
10166 res->data=(char *)n;
10167 }
10168 else
10169 {
10170 #if 0
10171 #ifdef HAVE_VSPACE
10172 int cpus = (long) feOptValue(FE_OPT_CPUS);
10173 if ((cpus>1) && (rField_is_Q(currRing)))
10174 result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10175 else
10176 #endif
10177 #endif
10178 result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10179 c->Clean();
10180 if ((return_type==POLY_CMD) &&(result!=NULL))
10181 {
10182 res->data=(char *)result->m[0];
10183 result->m[0]=NULL;
10184 idDelete(&result);
10185 }
10186 else
10187 res->data=(char *)result;
10188 }
10189 for(i=rl-1;i>=0;i--)
10190 {
10191 n_Delete(&(q[i]),cf);
10192 }
10193 omFree(q);
10194 res->rtyp=return_type;
10195 return result==NULL;
10196}
void Copy(leftv e)
Definition: subexpr.cc:685
sleftv * m
Definition: lists.h:46
void Clean(ring r=currRing)
Definition: lists.h:26
INLINE_THIS void Init(int l=0)
int nr
Definition: lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:843
return result
Definition: facAbsBiFact.cc:76
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
@ SMATRIX_CMD
Definition: grammar.cc:291
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
Definition: kChinese.cc:196
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:509
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:506
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
@ BIGINT_CMD
Definition: tok.h:38
@ LIST_CMD
Definition: tok.h:118
@ CHINREM_CMD
Definition: tok.h:45

◆ jjCOEF()

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

Definition at line 1793 of file iparith.cc.

1794{
1795 poly p=(poly)v->Data();
1796 if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1797 res->data=(char *)mp_CoeffProc((poly)u->Data(),p /*(poly)v->Data()*/,currRing);
1798 return FALSE;
1799}
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 1800 of file iparith.cc.

1801{
1802 poly p=(poly)v->Data();
1803 if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1804 res->data=(char *)mp_CoeffProcId((ideal)u->Data(),p /*(poly)v->Data()*/,currRing);
1805 return FALSE;
1806}
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 7212 of file iparith.cc.

7213{
7214 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7215 if (iiCheckTypes(v,t,1))
7216 {
7217 idhdl c=(idhdl)v->next->next->data;
7218 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7219 idhdl m=(idhdl)v->next->next->next->data;
7220 idDelete((ideal *)&(c->data.uideal));
7221 idDelete((ideal *)&(m->data.uideal));
7222 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7223 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7224 return FALSE;
7225 }
7226 return TRUE;
7227}
Definition: idrec.h:35
utypes data
Definition: idrec.h:40
@ VECTOR_CMD
Definition: grammar.cc:292
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc: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 3888 of file iparith.cc.

3889{
3890 ring r=(ring)v->Data();
3891 r->cf->ref++;
3892 res->data = (char *)r->cf;
3893 return FALSE;
3894}

◆ jjCOEFFS2_KB()

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

Definition at line 1818 of file iparith.cc.

1819{
1820 poly p = pInit();
1821 int i;
1822 for (i=1; i<=currRing->N; i++)
1823 {
1824 pSetExp(p, i, 1);
1825 }
1826 pSetm(p);
1827 res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1828 (ideal)(v->Data()), p);
1829 pLmFree(&p);
1830 return FALSE;
1831}
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 6041 of file iparith.cc.

6042{
6043 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6044 {
6045 WerrorS("3rd argument must be a name of a matrix");
6046 return TRUE;
6047 }
6048 ideal i=(ideal)u->Data();
6049 int rank=(int)i->rank;
6050 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6051 if (r) return TRUE;
6052 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6053 return FALSE;
6054}
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1807
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 6055 of file iparith.cc.

6056{
6057 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6058 (ideal)(v->Data()),(poly)(w->Data()));
6059 return FALSE;
6060}

◆ jjCOEFFS3_P()

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

Definition at line 6061 of file iparith.cc.

6062{
6063 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6064 {
6065 WerrorS("3rd argument must be a name of a matrix");
6066 return TRUE;
6067 }
6068 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6069 poly p=(poly)u->CopyD(POLY_CMD);
6070 ideal i=idInit(1,1);
6071 i->m[0]=p;
6072 sleftv t;
6073 t.Init();
6074 t.data=(char *)i;
6075 t.rtyp=IDEAL_CMD;
6076 int rank=1;
6077 if (u->Typ()==VECTOR_CMD)
6078 {
6079 i->rank=rank=pMaxComp(p);
6080 t.rtyp=MODUL_CMD;
6081 }
6082 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6083 t.CleanUp();
6084 if (r) return TRUE;
6085 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6086 return FALSE;
6087}
#define pMaxComp(p)
Definition: polys.h:299

◆ jjCOEFFS_Id()

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

Definition at line 1807 of file iparith.cc.

1808{
1809 int i=pVar((poly)v->Data());
1810 if (i==0)
1811 {
1812 WerrorS("ringvar expected");
1813 return TRUE;
1814 }
1815 res->data=(char *)mp_Coeffs((ideal)u->CopyD(),i,currRing);
1816 return FALSE;
1817}
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 694 of file iparith.cc.

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

◆ jjCOLON()

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

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

3896{
3897 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3898 return FALSE;
3899}

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3900 of file iparith.cc.

3901{
3902 res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3903 return FALSE;
3904}

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3905 of file iparith.cc.

3906{
3907 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3908 return FALSE;
3909}

◆ jjCOMPARE_ALL()

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

Definition at line 10216 of file iparith.cc.

10217{
10218 leftv a=(leftv)aa;
10219 int at=a->Typ();
10220 leftv b=(leftv)bb;
10221 int bt=b->Typ();
10222 if (at < bt) return -1;
10223 if (at > bt) return 1;
10224 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10225 sleftv tmp;
10226 tmp.Init();
10227 iiOp='<';
10228 BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10229 if (bo)
10230 {
10231 Werror(" no `<` for %s",Tok2Cmdname(at));
10232 unsigned long ad=(unsigned long)a->Data();
10233 unsigned long bd=(unsigned long)b->Data();
10234 if (ad<bd) return -1;
10235 else if (ad==bd) return 0;
10236 else return 1;
10237 }
10238 else if (tmp.data==NULL) /* not < */
10239 {
10241 tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10243 if (bo)
10244 {
10245 Werror(" no `==` for %s",Tok2Cmdname(at));
10246 unsigned long ad=(unsigned long)a->Data();
10247 unsigned long bd=(unsigned long)b->Data();
10248 if (ad<bd) return -1;
10249 else if (ad==bd) return 0;
10250 else return 1;
10251 }
10252 else if (tmp.data==NULL) /* not <,== */ return 1;
10253 else return 0;
10254 }
10255 else return -1;
10256}
@ 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 case '<':
378 res->data = (char *) (r<0);
379 break;
380 case '>':
381 res->data = (char *) (r>0);
382 break;
383 case LE:
384 res->data = (char *) (r<=0);
385 break;
386 case GE:
387 res->data = (char *) (r>=0);
388 break;
389 case EQUAL_EQUAL:
390 case NOTEQUAL: /* negation handled by jjEQUAL_REST */
391 res->data = (char *) (r==0);
392 break;
393 }
394 jjEQUAL_REST(res,u,v);
395 if(r==-2) { WerrorS("size incompatible"); return TRUE; }
396 return FALSE;
397}
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:1367

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

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

◆ jjCOMPARE_MA()

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

Definition at line 425 of file iparith.cc.

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

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

◆ jjCOMPARE_S()

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

Definition at line 480 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3910 of file iparith.cc.

3911{
3912 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3913 poly p=(poly)v->CopyD(POLY_CMD);
3914 if (p!=NULL) p_Cleardenom(p, currRing);
3915 res->data = (char *)p;
3916 return FALSE;
3917}
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2845

◆ jjCONTRACT()

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

Definition at line 1832 of file iparith.cc.

1833{
1834 res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data(),FALSE);
1835 return FALSE;
1836}
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 3918 of file iparith.cc.

3919{
3920 res->data = (char *)(long)n_Size((number)v->Data(),coeffs_BIGINT);
3921 return FALSE;
3922}
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:567

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3923 of file iparith.cc.

3924{
3925 bigintmat* aa= (bigintmat *)v->Data();
3926 res->data = (char *)(long)(aa->rows()*aa->cols());
3927 return FALSE;
3928}

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3946 of file iparith.cc.

3947{
3948 res->data = (char *)(long)((intvec*)(v->Data()))->length();
3949 return FALSE;
3950}

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3934 of file iparith.cc.

3935{
3936 lists l=(lists)v->Data();
3937 res->data = (char *)(long)(lSize(l)+1);
3938 return FALSE;
3939}
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3940 of file iparith.cc.

3941{
3942 matrix m=(matrix)v->Data();
3943 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3944 return FALSE;
3945}

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3929 of file iparith.cc.

3930{
3931 res->data = (char *)(long)nSize((number)v->Data());
3932 return FALSE;
3933}

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5687 of file iparith.cc.

5688{
5689 res->data=(char *)(long)sySize((syStrategy)v->Data());
5690 return FALSE;
5691}
int sySize(syStrategy syzstr)
Definition: syz1.cc:1829

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3951 of file iparith.cc.

3952{
3953 ring r=(ring)v->Data();
3954 int elems=-1;
3955 if (rField_is_Zp(r)) elems=r->cf->ch;
3956 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3957 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3958 {
3959 extern int ipower ( int b, int n ); /* factory/cf_util */
3960 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3961 }
3962 res->data = (char *)(long)elems;
3963 return FALSE;
3964}
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:529
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:500
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:521

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 4003 of file iparith.cc.

4004{
4005 if ((v->rtyp==IDHDL)
4006 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
4007 {
4008 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
4009 }
4010 else if (v->rtyp!=0) res->data=(void *)(-1);
4011 return FALSE;
4012}
#define IDLEV(a)
Definition: ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3965 of file iparith.cc.

3966{
3967 int dummy;
3968 poly p=(poly)v->Data();
3969 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3970 else res->data=(char *)-1;
3971 return FALSE;
3972}

◆ jjDEG_IV()

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

Definition at line 1848 of file iparith.cc.

1849{
1850 poly p=(poly)u->Data();
1851 if (p!=NULL)
1852 {
1853 int *iv=iv2array((intvec *)v->Data(),currRing);
1854 const long d = p_DegW(p,iv,currRing);
1855 omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(int) );
1856 res->data = (char *)(d);
1857 }
1858 else
1859 res->data=(char *)(long)(-1);
1860 return FALSE;
1861}
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long p_DegW(poly p, const int *w, const ring R)
Definition: p_polys.cc:690
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:592
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 3973 of file iparith.cc.

3974{
3975 ideal I=(ideal)u->Data();
3976 int d=-1;
3977 int dummy;
3978 int i;
3979 for(i=IDELEMS(I)-1;i>=0;i--)
3980 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3981 res->data = (char *)(long)d;
3982 return FALSE;
3983}
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 1837 of file iparith.cc.

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

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3984 of file iparith.cc.

3985{
3986 SPrintStart();
3987#ifdef HAVE_RINGS
3988 if (rField_is_Z(currRing))
3989 {
3990 PrintS("// NOTE: computation of degree is being performed for\n");
3991 PrintS("// generic fibre, that is, over Q\n");
3992 }
3993#endif
3995 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3996 scDegree((ideal)v->Data(),module_w,currRing->qideal);
3997 char *s=SPrintEnd();
3998 int l=strlen(s)-1;
3999 s[l]='\0';
4000 res->data=(void*)s;
4001 return FALSE;
4002}
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:1555

◆ jjDelete_ID()

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

Definition at line 1869 of file iparith.cc.

1870{
1871 int pos=(int)(long)v->Data();
1872 ideal I=(ideal)u->Data();
1873 res->data=(void*)id_Delete_Pos(I,pos-1,currRing);
1874 return res->data==NULL;
1875}
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 1876 of file iparith.cc.

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

◆ jjDelete_IV()

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

Definition at line 1862 of file iparith.cc.

1863{
1864 int pos=(int)(long)v->Data();
1865 intvec *iv=(intvec*)u->Data();
1866 res->data=(void*)iv->delete_pos(pos-1);
1867 return res->data==NULL;
1868}
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 4015 of file iparith.cc.

4016{
4017 number n = reinterpret_cast<number>(v->CopyD());
4018 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
4019 n_Delete(&n,currRing->cf);
4020 return FALSE;
4021}
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:600

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 4032 of file iparith.cc.

4033{
4034 matrix m=(matrix)v->Data();
4035 res ->data = mp_Det(m,currRing);
4036 return FALSE;
4037}
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 1896 of file iparith.cc.

1897{
1898 matrix m=(matrix)u->Data();
1899 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1900 res ->data = mp_Det(m,currRing,d);
1901 return FALSE;
1902}
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 1903 of file iparith.cc.

1904{
1905 DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1906 ideal m=(ideal)u->Data();
1907 res ->data = sm_Det(m,currRing,d);
1908 return FALSE;
1909}
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 4038 of file iparith.cc.

4039{
4040 bigintmat * m=(bigintmat*)v->Data();
4041 int i,j;
4042 i=m->rows();j=m->cols();
4043 if(i==j)
4044 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4045 else
4046 {
4047 Werror("det of %d x %d bigintmat",i,j);
4048 return TRUE;
4049 }
4050 return FALSE;
4051}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1798
int j
Definition: facHensel.cc:110

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4074 of file iparith.cc.

4075{
4076 intvec * m=(intvec*)v->Data();
4077 int i,j;
4078 i=m->rows();j=m->cols();
4079 if(i==j)
4080 res->data = (char *)(long)singclap_det_i(m,currRing);
4081 else
4082 {
4083 Werror("det of %d x %d intmat",i,j);
4084 return TRUE;
4085 }
4086 return FALSE;
4087}
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 4088 of file iparith.cc.

4089{
4090 ideal I=(ideal)v->Data();
4091 res->data=(char*)sm_Det(I,currRing);
4092 return FALSE;
4093}

◆ jjDIFF_COEF()

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

Definition at line 4449 of file iparith.cc.

4450{
4451 if (!nCoeff_is_transExt(currRing->cf))
4452 {
4453 WerrorS("differentiation not defined in the coefficient ring");
4454 return TRUE;
4455 }
4456 number n = (number) u->Data();
4457 number k = (number) v->Data();
4458 res->data = ntDiff(n,k,currRing->cf);
4459 return FALSE;
4460}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:915
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 1921 of file iparith.cc.

1922{
1923 int i=pVar((poly)v->Data());
1924 if (i==0)
1925 {
1926 WerrorS("ringvar expected");
1927 return TRUE;
1928 }
1929 res->data=(char *)idDiff((matrix)(u->Data()),i);
1930 return FALSE;
1931}
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 1932 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1910 of file iparith.cc.

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

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4094 of file iparith.cc.

4095{
4097#ifdef HAVE_SHIFTBBA
4098 if (rIsLPRing(currRing))
4099 {
4100#ifdef HAVE_RINGS
4102 {
4103 WerrorS("`dim` is not implemented for letterplace rings over rings");
4104 return TRUE;
4105 }
4106#endif
4107 if (currRing->qideal != NULL)
4108 {
4109 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4110 return TRUE;
4111 }
4112 int gkDim = lp_gkDim((ideal)(v->Data()));
4113 res->data = (char *)(long)gkDim;
4114 return (gkDim == -2);
4115 }
4116#endif
4118 {
4119 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4120 }
4121 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4122 return FALSE;
4123}
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:763

◆ jjDIM2()

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

Definition at line 1937 of file iparith.cc.

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

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5692 of file iparith.cc.

5693{
5694 res->data = (char *)(long)syDim((syStrategy)v->Data());
5695 return FALSE;
5696}
int syDim(syStrategy syzstr)
Definition: syz1.cc:1849

◆ jjDIV_BI()

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

Definition at line 1250 of file iparith.cc.

1251{
1252 number q=(number)v->Data();
1253 if (n_IsZero(q,coeffs_BIGINT))
1254 {
1256 return TRUE;
1257 }
1258 q = n_Div((number)u->Data(),q,coeffs_BIGINT);
1260 res->data = (char *)q;
1261 return FALSE;
1262}
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:612
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:461
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:575
#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 1294 of file iparith.cc.

1295{
1296 poly q=(poly)v->Data();
1297 if (q==NULL)
1298 {
1300 return TRUE;
1301 }
1302 matrix m=(matrix)(u->Data());
1303 int r=m->rows();
1304 int c=m->cols();
1305 matrix mm=mpNew(r,c);
1306 unsigned i,j;
1307 for(i=r;i>0;i--)
1308 {
1309 for(j=c;j>0;j--)
1310 {
1311 if (pNext(q)!=NULL)
1312 {
1314 q /*(poly)(v->Data())*/, currRing );
1315 }
1316 else
1317 MATELEM(mm,i,j) = pp_DivideM(MATELEM(m,i,j),q,currRing);
1318 }
1319 }
1320 res->data=(char *)mm;
1321 return FALSE;
1322}
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:1633

◆ jjDIV_N()

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

Definition at line 1263 of file iparith.cc.

1264{
1265 number q=(number)v->Data();
1266 if (nIsZero(q))
1267 {
1269 return TRUE;
1270 }
1271 q = nDiv((number)u->Data(),q);
1272 nNormalize(q);
1273 res->data = (char *)q;
1274 return FALSE;
1275}
#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 1276 of file iparith.cc.

1277{
1278 poly q=(poly)v->Data();
1279 poly p=(poly)(u->Data());
1280 if (q!=NULL)
1281 {
1282 res->data=(void*)(pp_Divide(p /*(poly)(u->Data())*/ ,
1283 q /*(poly)(v->Data())*/ ,currRing));
1284 if (res->data!=NULL) pNormalize((poly)res->data);
1285 return errorreported; /*there may be errors in p_Divide: div. ny 0, etc.*/
1286 }
1287 else
1288 {
1289 WerrorS("div. by 0");
1290 return TRUE;
1291 }
1292
1293}
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 1954 of file iparith.cc.

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

7230{ // may have 3 or 4 arguments
7231 leftv v1=v;
7232 leftv v2=v1->next;
7233 leftv v3=v2->next;
7234 leftv v4=v3->next;
7235 assumeStdFlag(v2);
7236
7237 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7238 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7239
7240 if((i1==0)||(i2==0)
7241 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7242 {
7243 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7244 return TRUE;
7245 }
7246
7247 sleftv w1,w2;
7248 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7249 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7250 ideal P=(ideal)w1.Data();
7251 ideal Q=(ideal)w2.Data();
7252
7253 int n=(int)(long)v3->Data();
7254 int *w=NULL;
7255 if(v4!=NULL)
7256 {
7257 w = iv2array((intvec *)v4->Data(),currRing);
7258 int * w0 = w + 1;
7259 int i = currRing->N;
7260 while( (i > 0) && ((*w0) > 0) )
7261 {
7262 w0++;
7263 i--;
7264 }
7265 if(i>0)
7266 WarnS("not all weights are positive!");
7267 }
7268
7269 matrix T;
7270 ideal R;
7271 idLiftW(P,Q,n,T,R,w);
7272
7273 w1.CleanUp();
7274 w2.CleanUp();
7275 if(w!=NULL)
7276 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7277
7279 L->Init(2);
7280 L->m[1].rtyp=v1->Typ();
7281 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7282 {
7283 if(v1->Typ()==POLY_CMD)
7284 p_Shift(&R->m[0],-1,currRing);
7285 L->m[1].data=(void *)R->m[0];
7286 R->m[0]=NULL;
7287 idDelete(&R);
7288 }
7289 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7290 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7291 else
7292 {
7293 L->m[1].rtyp=MODUL_CMD;
7294 L->m[1].data=(void *)R;
7295 }
7296 L->m[0].rtyp=MATRIX_CMD;
7297 L->m[0].data=(char *)T;
7298
7299 res->data=L;
7300
7301 return FALSE;
7302}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition: ideals.cc:1336
STATIC_VAR jList * Q
Definition: janet.cc:30
matrix id_Module2Matrix(ideal mod, const ring R)

◆ jjDIVMOD_I()

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

Definition at line 1227 of file iparith.cc.

1228{
1229 if (iiOp=='/') Warn("int division with `/`: use `div` instead in line >>%s<<",my_yylinebuf);
1230 int a= (int)(long)u->Data();
1231 int b= (int)(long)v->Data();
1232 if (b==0)
1233 {
1235 return TRUE;
1236 }
1237 int c=a%b;
1238 int r=0;
1239 switch (iiOp)
1240 {
1241 case '%':
1242 r=c; break;
1243 case '/':
1244 case INTDIV_CMD:
1245 r=((a-c) /b); break;
1246 }
1247 res->data=(void *)((long)r);
1248 return FALSE;
1249}
@ 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 3711 of file iparith.cc.

3712{
3713// res->data = (char *)u->CopyD();
3714// also copy attributes:
3715 res->Copy(u);
3716 return FALSE;
3717}

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4124 of file iparith.cc.

4125{
4126 si_link l = (si_link)v->Data();
4127 if (slDump(l))
4128 {
4129 const char *s;
4130 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4131 else s=sNoName_fe;
4132 Werror("cannot dump to `%s`",s);
4133 return TRUE;
4134 }
4135 else
4136 return FALSE;
4137}

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4138 of file iparith.cc.

4139{
4140 res->data = (char *)pOne();
4141 int co=(int)(long)v->Data();
4142 if (co>0)
4143 {
4144 pSetComp((poly)res->data,co);
4145 pSetm((poly)res->data);
4146 }
4147 else WerrorS("argument of gen must be positive");
4148 return (co<=0);
4149}
#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 1974 of file iparith.cc.

1975{
1976 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1977 //setFlag(res,FLAG_STD);
1978 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
1979}
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 6088 of file iparith.cc.

6089{
6090 ideal I=(ideal)u->Data();
6091 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6092 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6093 //setFlag(res,FLAG_STD);
6094 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6095}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3425
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6096 of file iparith.cc.

6097{
6098 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6099 (intvec *)w->Data());
6100 //setFlag(res,FLAG_STD);
6101 return FALSE;
6102}

◆ jjELIMIN_IV()

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

Definition at line 1980 of file iparith.cc.

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

5259{
5260#ifdef HAVE_PLURAL
5261 ring r = (ring)a->Data();
5262 if (rIsPluralRing(r))
5263 {
5264 ring s = rEnvelope(r);
5265 res->data = s;
5266 }
5267 else res->data = rCopy(r);
5268 return FALSE;
5269#else
5270 return TRUE;
5271#endif
5272}
ring rEnvelope(ring R)
Definition: ring.cc:5732
ring rCopy(ring r)
Definition: ring.cc:1731

◆ jjEQUAL_BI()

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

Definition at line 1323 of file iparith.cc.

1324{
1325 res->data = (char *)((long)n_Equal((number)u->Data(),(number)v->Data(),coeffs_BIGINT));
1326 jjEQUAL_REST(res,u,v);
1327 return FALSE;
1328}
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:457

◆ jjEQUAL_I()

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

Definition at line 1329 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1335 of file iparith.cc.

1336{
1337 res->data = (char *)((long)mp_Equal((matrix)u->Data(),(matrix)v->Data(),currRing));
1338 jjEQUAL_REST(res,u,v);
1339 return FALSE;
1340}
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 1353 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1359 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1347 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1367 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1341 of file iparith.cc.

1342{
1343 res->data = (char *)((long)sm_Equal((ideal)u->Data(),(ideal)v->Data(),currRing));
1344 jjEQUAL_REST(res,u,v);
1345 return FALSE;
1346}
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 1999 of file iparith.cc.

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

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4150 of file iparith.cc.

4151{
4152 char * d = (char *)v->Data();
4153 char * s = (char *)omAlloc(strlen(d) + 13);
4154 strcpy( s, (char *)d);
4155 strcat( s, "\n;RETURN();\n");
4157 return yyparse();
4158}
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:2111

◆ jjEXPORTTO()

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

Definition at line 1994 of file iparith.cc.

1995{
1996 //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1997 return iiExport(v,0,IDPACKAGE((idhdl)u->data));
1998}
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 2006 of file iparith.cc.

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

◆ jjEXTGCD_I()

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

Definition at line 2020 of file iparith.cc.

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

2049{
2050 poly r,pa,pb;
2051 BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2052 if (ret) return TRUE;
2054 L->Init(3);
2055 res->data=(char *)L;
2056 L->m[0].data=(void *)r;
2057 L->m[0].rtyp=POLY_CMD;
2058 L->m[1].data=(void *)pa;
2059 L->m[1].rtyp=POLY_CMD;
2060 L->m[2].data=(void *)pb;
2061 L->m[2].rtyp=POLY_CMD;
2062 return FALSE;
2063}
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 4199 of file iparith.cc.

4200{
4201 intvec *v=NULL;
4203 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4204 if (f==NULL) return TRUE;
4205 ivTest(v);
4207 l->Init(2);
4208 l->m[0].rtyp=IDEAL_CMD;
4209 l->m[0].data=(void *)f;
4210 l->m[1].rtyp=INTVEC_CMD;
4211 l->m[1].data=(void *)v;
4212 res->data=(void *)l;
4213 return FALSE;
4214}
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:2064

◆ jjFAC_P2()

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

Definition at line 2065 of file iparith.cc.

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

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4159 of file iparith.cc.

4160{
4162 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4163 {
4164 ideal_list p,h;
4165 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4166 if (h==NULL)
4167 {
4168 L->Init(1);
4169 L->m[0].data=(char *)idInit(1);
4170 L->m[0].rtyp=IDEAL_CMD;
4171 }
4172 else
4173 {
4174 p=h;
4175 int l=0;
4176 while (p!=NULL) { p=p->next;l++; }
4177 L->Init(l);
4178 l=0;
4179 while(h!=NULL)
4180 {
4181 L->m[l].data=(char *)h->d;
4182 L->m[l].rtyp=IDEAL_CMD;
4183 p=h->next;
4184 omFreeSize(h,sizeof(*h));
4185 h=p;
4186 l++;
4187 }
4188 }
4189 }
4190 else
4191 {
4192 WarnS("no factorization implemented");
4193 L->Init(1);
4194 iiExprArith1(&(L->m[0]),v,STD_CMD);
4195 }
4196 res->data=(void *)L;
4197 return FALSE;
4198}
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:184

◆ jjFACSTD2()

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

Definition at line 2112 of file iparith.cc.

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

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8430 of file iparith.cc.

8431{
8432 /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
8433 see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
8434
8435 valid argument lists:
8436 - (poly h, int d),
8437 - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
8438 - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
8439 in list of ring vars,
8440 - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
8441 optional: all 4 optional args
8442 (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
8443 by singclap_factorize and h(0, y)
8444 has exactly two distinct monic factors [possibly with exponent > 1].)
8445 result:
8446 - list with the two factors f and g such that
8447 h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
8448
8449 poly h = NULL;
8450 int d = 1;
8451 poly f0 = NULL;
8452 poly g0 = NULL;
8453 int xIndex = 1; /* default index if none provided */
8454 int yIndex = 2; /* default index if none provided */
8455
8456 leftv u = v; int factorsGiven = 0;
8457 if ((u == NULL) || (u->Typ() != POLY_CMD))
8458 {
8459 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8460 return TRUE;
8461 }
8462 else h = (poly)u->Data();
8463 u = u->next;
8464 if ((u == NULL) || (u->Typ() != INT_CMD))
8465 {
8466 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8467 return TRUE;
8468 }
8469 else d = (int)(long)u->Data();
8470 u = u->next;
8471 if ((u != NULL) && (u->Typ() == POLY_CMD))
8472 {
8473 if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
8474 {
8475 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8476 return TRUE;
8477 }
8478 else
8479 {
8480 f0 = (poly)u->Data();
8481 g0 = (poly)u->next->Data();
8482 factorsGiven = 1;
8483 u = u->next->next;
8484 }
8485 }
8486 if ((u != NULL) && (u->Typ() == INT_CMD))
8487 {
8488 if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
8489 {
8490 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8491 return TRUE;
8492 }
8493 else
8494 {
8495 xIndex = (int)(long)u->Data();
8496 yIndex = (int)(long)u->next->Data();
8497 u = u->next->next;
8498 }
8499 }
8500 if (u != NULL)
8501 {
8502 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8503 return TRUE;
8504 }
8505
8506 /* checks for provided arguments */
8507 if (pIsConstant(h) || (factorsGiven && (pIsConstant(f0) || pIsConstant(g0))))
8508 {
8509 WerrorS("expected non-constant polynomial argument(s)");
8510 return TRUE;
8511 }
8512 int n = rVar(currRing);
8513 if ((xIndex < 1) || (n < xIndex))
8514 {
8515 Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
8516 return TRUE;
8517 }
8518 if ((yIndex < 1) || (n < yIndex))
8519 {
8520 Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
8521 return TRUE;
8522 }
8523 if (xIndex == yIndex)
8524 {
8525 WerrorS("expected distinct indices for variables x and y");
8526 return TRUE;
8527 }
8528
8529 /* computation of f0 and g0 if missing */
8530 if (factorsGiven == 0)
8531 {
8532 poly h0 = pSubst(pCopy(h), xIndex, NULL);
8533 intvec* v = NULL;
8534 ideal i = singclap_factorize(h0, &v, 0,currRing);
8535
8536 ivTest(v);
8537
8538 if (i == NULL) return TRUE;
8539
8540 idTest(i);
8541
8542 if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
8543 {
8544 WerrorS("expected h(0,y) to have exactly two distinct monic factors");
8545 return TRUE;
8546 }
8547 f0 = pPower(pCopy(i->m[1]), (*v)[1]);
8548 g0 = pPower(pCopy(i->m[2]), (*v)[2]);
8549 idDelete(&i);
8550 }
8551
8552 poly f; poly g;
8553 henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
8555 L->Init(2);
8556 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
8557 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
8558 res->rtyp = LIST_CMD;
8559 res->data = (char*)L;
8560 return FALSE;
8561}
g
Definition: cfModGcd.cc:4090
#define idTest(id)
Definition: ideals.h:47
VAR idhdl h0
Definition: libparse.cc:1143
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x,...
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define nIsOne(n)
Definition: numbers.h:25
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:238
#define pPower(p, q)
Definition: polys.h:204
#define pSubst(p, n, e)
Definition: polys.h:365

◆ jjFAREY_BI()

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

Definition at line 2134 of file iparith.cc.

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

◆ jjFAREY_ID()

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

Definition at line 2145 of file iparith.cc.

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

10198{
10199 lists c=(lists)u->CopyD();
10201 res_l->Init(c->nr+1);
10202 BOOLEAN bo=FALSE;
10203 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10204 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10205 {
10206 sleftv tmp;
10207 tmp.Copy(v);
10208 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10209 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10210 }
10211 c->Clean();
10212 res->data=res_l;
10213 return bo;
10214}
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2168 of file iparith.cc.

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

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7372 of file iparith.cc.

7373{
7374 ring r=(ring)u->Data();
7375 leftv v=u->next;
7376 leftv perm_var_l=v->next;
7377 leftv perm_par_l=v->next->next;
7378 if ((perm_var_l->Typ()!=INTVEC_CMD)
7379 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7380 ||(u->Typ()!=RING_CMD))
7381 {
7382 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7383 return TRUE;
7384 }
7385 intvec *perm_var_v=(intvec*)perm_var_l->Data();
7386 intvec *perm_par_v=NULL;
7387 if (perm_par_l!=NULL)
7388 perm_par_v=(intvec*)perm_par_l->Data();
7389 idhdl w;
7390 nMapFunc nMap;
7391
7392 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7393 {
7394 int *perm=NULL;
7395 int *par_perm=NULL;
7396 int par_perm_size=0;
7397 BOOLEAN bo;
7398 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7399 {
7400 // Allow imap/fetch to be make an exception only for:
7401 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7402 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7403 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7404 {
7405 par_perm_size=rPar(r);
7406 }
7407 else
7408 {
7409 goto err_fetch;
7410 }
7411 }
7412 else
7413 par_perm_size=rPar(r);
7414 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7415 if (par_perm_size!=0)
7416 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7417 int i;
7418 if (perm_par_l==NULL)
7419 {
7420 if (par_perm_size!=0)
7421 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7422 }
7423 else
7424 {
7425 if (par_perm_size==0) WarnS("source ring has no parameters");
7426 else
7427 {
7428 for(i=rPar(r)-1;i>=0;i--)
7429 {
7430 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7431 if ((par_perm[i]<-rPar(currRing))
7432 || (par_perm[i]>rVar(currRing)))
7433 {
7434 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7435 par_perm[i]=0;
7436 }
7437 }
7438 }
7439 }
7440 for(i=rVar(r)-1;i>=0;i--)
7441 {
7442 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7443 if ((perm[i]<-rPar(currRing))
7444 || (perm[i]>rVar(currRing)))
7445 {
7446 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7447 perm[i]=0;
7448 }
7449 }
7450 if (BVERBOSE(V_IMAP))
7451 {
7452 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7453 {
7454 if (perm[i]>0)
7455 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7456 else if (perm[i]<0)
7457 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7458 }
7459 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7460 {
7461 if (par_perm[i-1]<0)
7462 Print("// par nr %d: %s -> par %s\n",
7463 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7464 else if (par_perm[i-1]>0)
7465 Print("// par nr %d: %s -> var %s\n",
7466 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7467 }
7468 }
7469 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7470 sleftv tmpW;
7471 tmpW.Init();
7472 tmpW.rtyp=IDTYP(w);
7473 tmpW.data=IDDATA(w);
7474 if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7475 perm,par_perm,par_perm_size,nMap)))
7476 {
7477 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7478 }
7479 if (perm!=NULL)
7480 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7481 if (par_perm!=NULL)
7482 omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7483 return bo;
7484 }
7485 else
7486 {
7487 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7488 }
7489 return TRUE;
7490err_fetch:
7491 char *s1=nCoeffString(r->cf);
7492 char *s2=nCoeffString(currRing->cf);
7493 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7495 return TRUE;
7496}
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 2296 of file iparith.cc.

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

◆ jjFIND3()

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

Definition at line 6103 of file iparith.cc.

6104{
6105 /*4
6106 * look for the substring what in the string where
6107 * starting at position n
6108 * return the position of the first char of what in where
6109 * or 0
6110 */
6111 int n=(int)(long)w->Data();
6112 char *where=(char *)u->Data();
6113 char *what=(char *)v->Data();
6114 char *found;
6115 if ((1>n)||(n>(int)strlen(where)))
6116 {
6117 Werror("start position %d out of range",n);
6118 return TRUE;
6119 }
6120 found = strchr(where+n-1,*what);
6121 if (*(what+1)!='\0')
6122 {
6123 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6124 {
6125 found=strchr(found+1,*what);
6126 }
6127 }
6128 if (found != NULL)
6129 {
6130 res->data=(char *)((found-where)+1);
6131 }
6132 return FALSE;
6133}

◆ jjFRES()

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

Definition at line 2351 of file iparith.cc.

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

◆ jjFRES3()

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

Definition at line 2314 of file iparith.cc.

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

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

6135{
6136 if ((int)(long)w->Data()==0)
6137 res->data=(char *)walkProc(u,v);
6138 else
6139 res->data=(char *)fractalWalkProc(u,v);
6140 setFlag( res, FLAG_STD );
6141 return FALSE;
6142}
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 2380 of file iparith.cc.

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

◆ jjGCD_I()

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

Definition at line 2367 of file iparith.cc.

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

◆ jjGCD_N()

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

Definition at line 2387 of file iparith.cc.

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

2405{
2406 res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2407 (poly)(v->CopyD(POLY_CMD)),currRing);
2408 return FALSE;
2409}
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 1166 of file iparith.cc.

1167{
1168 number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1169 res->data = (char *) (n_GreaterZero(h,coeffs_BIGINT)||(n_IsZero(h,coeffs_BIGINT)));
1171 return FALSE;
1172}
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:491
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:652

◆ jjGE_I()

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

Definition at line 1173 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1178 of file iparith.cc.

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

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4215 of file iparith.cc.

4216{
4217 si_link l = (si_link)v->Data();
4218 if (slGetDump(l))
4219 {
4220 const char *s;
4221 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4222 else s=sNoName_fe;
4223 Werror("cannot get dump from `%s`",s);
4224 return TRUE;
4225 }
4226 else
4227 return FALSE;
4228}

◆ jjGT_BI()

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

Definition at line 1184 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1191 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1196 of file iparith.cc.

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

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4229 of file iparith.cc.

4230{
4232 ideal I=(ideal)v->Data();
4233 res->data=(void *)iiHighCorner(I,0);
4234 return FALSE;
4235}
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1607

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4236 of file iparith.cc.

4237{
4239 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4240 BOOLEAN delete_w=FALSE;
4241 ideal I=(ideal)v->Data();
4242 int i;
4243 poly p=NULL,po=NULL;
4244 int rk=id_RankFreeModule(I,currRing);
4245 if (w==NULL)
4246 {
4247 w = new intvec(rk);
4248 delete_w=TRUE;
4249 }
4250 for(i=rk;i>0;i--)
4251 {
4252 p=iiHighCorner(I,i);
4253 if (p==NULL)
4254 {
4255 WerrorS("module must be zero-dimensional");
4256 if (delete_w) delete w;
4257 return TRUE;
4258 }
4259 if (po==NULL)
4260 {
4261 po=p;
4262 }
4263 else
4264 {
4265 // now po!=NULL, p!=NULL
4266 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4267 if (d==0)
4268 d=pLmCmp(po,p);
4269 if (d > 0)
4270 {
4271 pDelete(&p);
4272 }
4273 else // (d < 0)
4274 {
4275 pDelete(&po); po=p;
4276 }
4277 }
4278 }
4279 if (delete_w) delete w;
4280 res->data=(void *)po;
4281 return FALSE;
4282}
#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 4283 of file iparith.cc.

4284{
4285#ifdef HAVE_RINGS
4286 if (rField_is_Z(currRing))
4287 {
4288 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4289 PrintS("// performed for generic fibre, that is, over Q\n");
4290 }
4291#endif
4293 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4294 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4295 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4296 return FALSE;
4297}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition: hilb.cc:869

◆ jjHILBERT2()

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

Definition at line 2410 of file iparith.cc.

2411{
2412#ifdef HAVE_RINGS
2413 if (rField_is_Z(currRing))
2414 {
2415 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2416 PrintS("// performed for generic fibre, that is, over Q\n");
2417 }
2418#endif
2419 assumeStdFlag(u);
2420 intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2421 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2422 if (errorreported) return TRUE;
2423
2424 switch((int)(long)v->Data())
2425 {
2426 case 1:
2427 res->data=(void *)iv;
2428 return FALSE;
2429 case 2:
2430 res->data=(void *)hSecondSeries(iv);
2431 delete iv;
2432 return FALSE;
2433 }
2434 delete iv;
2436 return TRUE;
2437}
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:706
intvec * hFirstSeries(ideal A, intvec *module_w, ideal Q, intvec *wdegree)
Definition: hilb.cc:2155
const char feNotImplemented[]
Definition: reporter.cc:54

◆ jjHILBERT3()

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

Definition at line 6143 of file iparith.cc.

6144{
6145 intvec *wdegree=(intvec*)w->Data();
6146 if (wdegree->length()!=currRing->N)
6147 {
6148 Werror("weight vector must have size %d, not %d",
6149 currRing->N,wdegree->length());
6150 return TRUE;
6151 }
6152#ifdef HAVE_RINGS
6153 if (rField_is_Z(currRing))
6154 {
6155 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6156 PrintS("// performed for generic fibre, that is, over Q\n");
6157 }
6158#endif
6159 assumeStdFlag(u);
6160 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6161 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
6162 if (errorreported) return TRUE;
6163
6164 switch((int)(long)v->Data())
6165 {
6166 case 1:
6167 res->data=(void *)iv;
6168 return FALSE;
6169 case 2:
6170 res->data=(void *)hSecondSeries(iv);
6171 delete iv;
6172 return FALSE;
6173 }
6174 delete iv;
6176 return TRUE;
6177}

◆ jjHILBERT3Qt()

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

Definition at line 6178 of file iparith.cc.

6179{
6180#ifdef HAVE_RINGS
6181 if (rField_is_Z(currRing))
6182 {
6183 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6184 PrintS("// performed for generic fibre, that is, over Q\n");
6185 }
6186#endif
6187 assumeStdFlag(u);
6188 ring Qt =(ring)v->Data();
6189 char *name=(char*)w->Data();
6190 poly h;
6191 if (u->Typ()==IDEAL_CMD)
6192 h=hFirstSeries0p((ideal)u->Data(),currRing->qideal,NULL,currRing,Qt);
6193 else
6194 {
6195 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6196 h=hFirstSeries0m((ideal)u->Data(),currRing->qideal,NULL,module_w,currRing,Qt);
6197 }
6198 idhdl hh=enterid(name,myynest,POLY_CMD,&(Qt->idroot),FALSE,FALSE);
6199 IDPOLY(hh)=h;
6200 return FALSE;
6201}
char name(const Variable &v)
Definition: factory.h:189
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition: hilb.cc:2076
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition: hilb.cc:2033
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:279
#define IDPOLY(a)
Definition: ipid.h:130

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4298 of file iparith.cc.

4299{
4300#ifdef HAVE_RINGS
4301 if (rField_is_Z(currRing))
4302 {
4303 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4304 PrintS("// performed for generic fibre, that is, over Q\n");
4305 }
4306#endif
4307 res->data=(void *)hSecondSeries((intvec *)v->Data());
4308 return FALSE;
4309}

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4310 of file iparith.cc.

4311{
4312 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4313 ideal v_id=(ideal)v->Data();
4314 if (w==NULL)
4315 {
4316 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4317 if (res->data!=NULL)
4318 {
4319 if (v->rtyp==IDHDL)
4320 {
4321 char *s_isHomog=omStrDup("isHomog");
4322 if (v->e==NULL)
4323 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4324 else
4325 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4326 }
4327 else if (w!=NULL) delete w;
4328 } // if res->data==NULL then w==NULL
4329 }
4330 else
4331 {
4332 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4333 if((res->data==NULL) && (v->rtyp==IDHDL))
4334 {
4335 if (v->e==NULL)
4336 atKill((idhdl)(v->data),"isHomog");
4337 else
4338 atKill((idhdl)(v->LData()),"isHomog");
4339 }
4340 }
4341 return FALSE;
4342}
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 2477 of file iparith.cc.

2478{
2479 intvec *w=new intvec(rVar(currRing));
2480 intvec *vw=(intvec*)u->Data();
2481 ideal v_id=(ideal)v->Data();
2482 pFDegProc save_FDeg=currRing->pFDeg;
2483 pLDegProc save_LDeg=currRing->pLDeg;
2484 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2485 currRing->pLexOrder=FALSE;
2486 kHomW=vw;
2487 kModW=w;
2489 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2490 currRing->pLexOrder=save_pLexOrder;
2491 kHomW=NULL;
2492 kModW=NULL;
2493 pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2494 if (w!=NULL) delete w;
2495 return FALSE;
2496}
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:3649
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3637
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 2497 of file iparith.cc.

2498{
2499 intvec *vw=(intvec*)u->Data();
2500 ideal v_id=(ideal)v->Data();
2501 res->data=(void *)(long)id_HomIdealW(v_id,currRing->qideal,vw,currRing);
2502 return FALSE;
2503}
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 2455 of file iparith.cc.

2456{
2457 int i=pVar((poly)v->Data());
2458 if (i==0)
2459 {
2460 WerrorS("ringvar expected");
2461 return TRUE;
2462 }
2463 pFDegProc deg;
2464 if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2465 deg=p_Totaldegree;
2466 else
2467 deg=currRing->pFDeg;
2468 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2469 int d=deg(p,currRing);
2470 pLmDelete(p);
2471 if (d==1)
2472 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2473 else
2474 WerrorS("variable must have weight 1");
2475 return (d!=1);
2476}
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 6202 of file iparith.cc.

6203{
6204 PrintS("TODO\n");
6205 int i=pVar((poly)v->Data());
6206 if (i==0)
6207 {
6208 WerrorS("ringvar expected");
6209 return TRUE;
6210 }
6211 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6212 int d=pWTotaldegree(p);
6213 pLmDelete(p);
6214 if (d==1)
6215 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6216 else
6217 WerrorS("variable must have weight 1");
6218 return (d!=1);
6219}
#define pWTotaldegree(p)
Definition: polys.h:283

◆ jjHOMOG_P()

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

Definition at line 2438 of file iparith.cc.

2439{
2440 int i=pVar((poly)v->Data());
2441 if (i==0)
2442 {
2443 WerrorS("ringvar expected");
2444 return TRUE;
2445 }
2446 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2447 int d=pWTotaldegree(p);
2448 pLmDelete(p);
2449 if (d==1)
2450 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2451 else
2452 WerrorS("variable must have weight 1");
2453 return (d!=1);
2454}
poly p_Homogen(poly p, int varnum, const ring r)
Definition: p_polys.cc:3270

◆ jjHOMOG_P_W()

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

Definition at line 6220 of file iparith.cc.

6221{
6222 PrintS("TODO\n");
6223 int i=pVar((poly)v->Data());
6224 if (i==0)
6225 {
6226 WerrorS("ringvar expected");
6227 return TRUE;
6228 }
6229 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6230 int d=pWTotaldegree(p);
6231 pLmDelete(p);
6232 if (d==1)
6233 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6234 else
6235 WerrorS("variable must have weight 1");
6236 return (d!=1);
6237}

◆ jjHOMOG_W_M()

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

Definition at line 6238 of file iparith.cc.

6239{
6240 intvec *w=(intvec *)v3->Data();
6241 intvec *vw=(intvec*)v2->Data();
6242 ideal v_id=(ideal)v1->Data();
6243 res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6244 return FALSE;
6245}
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 4360 of file iparith.cc.

4361{
4362 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4363 IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4364 MATROWS(mat)=1;
4365 mat->rank=1;
4366 res->data=(char *)mat;
4367 return FALSE;
4368}
long rank
Definition: matpol.h:19

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4369 of file iparith.cc.

4370{
4371 map m=(map)v->CopyD(MAP_CMD);
4372 omFreeBinAddr((ADDRESS)m->preimage);
4373 m->preimage=NULL;
4374 ideal I=(ideal)m;
4375 I->rank=1;
4376 res->data=(char *)I;
4377 return FALSE;
4378}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:505

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7328 of file iparith.cc.

7329{
7330 int s=1;
7331 leftv h=v;
7332 if (h!=NULL) s=exprlist_length(h);
7333 ideal id=idInit(s,1);
7334 int rank=1;
7335 int i=0;
7336 poly p;
7337 int dest_type=POLY_CMD;
7338 if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7339 while (h!=NULL)
7340 {
7341 // use standard type conversions to poly/vector
7342 int ri;
7343 int ht=h->Typ();
7344 if (ht==dest_type)
7345 {
7346 p=(poly)h->CopyD();
7347 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7348 }
7349 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7350 {
7351 sleftv tmp;
7352 leftv hnext=h->next;
7353 h->next=NULL;
7354 iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7355 h->next=hnext;
7356 p=(poly)tmp.data;
7357 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7358 }
7359 else
7360 {
7361 idDelete(&id);
7362 return TRUE;
7363 }
7364 id->m[i]=p;
7365 i++;
7366 h=h->next;
7367 }
7368 id->rank=rank;
7369 res->data=(char *)id;
7370 return FALSE;
7371}
int exprlist_length(leftv v)
Definition: ipshell.cc:552

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4379 of file iparith.cc.

4380{
4381 if (currRing!=NULL)
4382 {
4383 ring q=(ring)v->Data();
4384 if (rSamePolyRep(currRing, q))
4385 {
4386 if (q->qideal==NULL)
4387 res->data=(char *)idInit(1,1);
4388 else
4389 res->data=(char *)idCopy(q->qideal);
4390 return FALSE;
4391 }
4392 }
4393 WerrorS("can only get ideal from identical qring");
4394 return TRUE;
4395}
ideal idCopy(ideal A)
Definition: ideals.h:60
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1799

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5614 of file iparith.cc.

5615{
5616 res->data = (char *)(long)idElem((ideal)v->Data());
5617 return FALSE;
5618}
static int idElem(const ideal F)
number of non-zero polys in F
Definition: simpleideals.h:69

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5619 of file iparith.cc.

5620{
5621 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5622 return FALSE;
5623}
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 5639 of file iparith.cc.

5640{
5641 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5643 return FALSE;
5644}
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 4343 of file iparith.cc.

4344{
4345#ifdef HAVE_SHIFTBBA
4346 if (rIsLPRing(currRing))
4347 {
4348 int deg = (int)(long)v->Data();
4349 if (deg > currRing->N/currRing->isLPring)
4350 {
4351 WerrorS("degree bound of Letterplace ring is to small");
4352 return TRUE;
4353 }
4354 }
4355#endif
4356 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4358 return FALSE;
4359}
#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 5645 of file iparith.cc.

5646{
5647 res->data = (char *)idMinBase((ideal)v->Data());
5648 return FALSE;
5649}
ideal idMinBase(ideal h1, ideal *SB)
Definition: ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5697 of file iparith.cc.

5698{
5699 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5700 return FALSE;
5701}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5624 of file iparith.cc.

5625{
5626 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5627 return FALSE;
5628}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4396 of file iparith.cc.

4397{
4398 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4399 iv->makeVector();
4400 res->data = iv;
4401 return FALSE;
4402}
void makeVector()
Definition: intvec.h:102
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4403 of file iparith.cc.

4404{
4405 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4406 return FALSE;
4407}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:790

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4408 of file iparith.cc.

4409{
4411 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4412 return FALSE;
4413}
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:286

◆ jjINDEPSET2()

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

Definition at line 2504 of file iparith.cc.

2505{
2506 assumeStdFlag(u);
2507 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2508 currRing->qideal);
2509 return FALSE;
2510}
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 1390 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1412 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1448 of file iparith.cc.

1449{
1450 poly p=(poly)u->Data();
1451 int i=(int)(long)v->Data();
1452 int j=0;
1453 while (p!=NULL)
1454 {
1455 j++;
1456 if (j==i)
1457 {
1458 res->data=(char *)pHead(p);
1459 return FALSE;
1460 }
1461 pIter(p);
1462 }
1463 return FALSE;
1464}
#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 1488 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1465 of file iparith.cc.

1466{
1469 int l; poly p,pp;
1470 sBucketDestroyAdd(b, &pp, &l);
1471 int i=(int)(long)v->Data();
1472 int j=0;
1473 p=pp;
1474 while (p!=NULL)
1475 {
1476 j++;
1477 if (j==i)
1478 {
1479 res->data=(char *)pHead(p);
1481 return FALSE;
1482 }
1483 pIter(p);
1484 }
1486 return FALSE;
1487}
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 1517 of file iparith.cc.

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

◆ jjINDEX_V_IV()

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

Definition at line 1524 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2517 of file iparith.cc.

2518{
2519 const lists L = (lists)l->Data();
2520 const int n = L->nr; assume (n >= 0);
2521 std::vector<ideal> V(n + 1);
2522
2523 for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2524
2525 res->data=interpolation(V, (intvec*)v->Data());
2527 return errorreported;
2528}
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4414 of file iparith.cc.

4415{
4416 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4417 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4418 res->data = result;
4419 return FALSE;
4420}
ideal kInterRed(ideal F, const ideal Q)
Definition: kstd1.cc:3765
#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 6273 of file iparith.cc.

6274{
6275 ideal I=(ideal)u->Data();
6276 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6277 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6279 return FALSE;
6280}
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 2511 of file iparith.cc.

2512{
2513 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2515 return FALSE;
2516}

◆ jjINTERSECT3()

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

Definition at line 6260 of file iparith.cc.

6261{
6262 ideal I1=(ideal)u->Data();
6263 ideal I2=(ideal)v->Data();
6264 ideal I3=(ideal)w->Data();
6265 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6266 r[0]=I1;
6267 r[1]=I2;
6268 r[2]=I3;
6269 res->data=(char *)idMultSect(r,3);
6270 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6271 return FALSE;
6272}
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 7497 of file iparith.cc.

7498{
7499 leftv h=v;
7500 int l=v->listLength();
7501 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7502 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7503 int t=0;
7504 // try to convert to IDEAL_CMD
7505 while (h!=NULL)
7506 {
7507 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7508 {
7509 t=IDEAL_CMD;
7510 }
7511 else break;
7512 h=h->next;
7513 }
7514 // if failure, try MODUL_CMD
7515 if (t==0)
7516 {
7517 h=v;
7518 while (h!=NULL)
7519 {
7520 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7521 {
7522 t=MODUL_CMD;
7523 }
7524 else break;
7525 h=h->next;
7526 }
7527 }
7528 // check for success in converting
7529 if (t==0)
7530 {
7531 WerrorS("cannot convert to ideal or module");
7532 return TRUE;
7533 }
7534 // call idMultSect
7535 h=v;
7536 int i=0;
7537 sleftv tmp;
7538 while (h!=NULL)
7539 {
7540 if (h->Typ()==t)
7541 {
7542 r[i]=(ideal)h->Data(); /*no copy*/
7543 h=h->next;
7544 }
7545 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7546 {
7547 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7548 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7549 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7550 return TRUE;
7551 }
7552 else
7553 {
7554 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7555 copied[i]=TRUE;
7556 h=tmp.next;
7557 }
7558 i++;
7559 }
7560 res->rtyp=t;
7561 res->data=(char *)idMultSect(r,i);
7562 while(i>0)
7563 {
7564 i--;
7565 if (copied[i]) idDelete(&(r[i]));
7566 }
7567 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7568 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7569 return FALSE;
7570}

◆ jjINTMAT3()

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

Definition at line 6246 of file iparith.cc.

6247{
6248 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6249 intvec* arg = (intvec*) u->Data();
6250 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6251
6252 for (i=0; i<n; i++)
6253 {
6254 (*im)[i] = (*arg)[i];
6255 }
6256
6257 res->data = (char *)im;
6258 return FALSE;
6259}

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7733 of file iparith.cc.

7734{
7735 int i=0;
7736 leftv h=v;
7737 if (h!=NULL) i=exprlist_length(h);
7738 intvec *iv=new intvec(i);
7739 i=0;
7740 while (h!=NULL)
7741 {
7742 if(h->Typ()==INT_CMD)
7743 {
7744 (*iv)[i]=(int)(long)h->Data();
7745 }
7746 else if (h->Typ()==INTVEC_CMD)
7747 {
7748 intvec *ivv=(intvec*)h->Data();
7749 for(int j=0;j<ivv->length();j++,i++)
7750 {
7751 (*iv)[i]=(*ivv)[j];
7752 }
7753 i--;
7754 }
7755 else
7756 {
7757 delete iv;
7758 return TRUE;
7759 }
7760 i++;
7761 h=h->next;
7762 }
7763 res->data=(char *)iv;
7764 return FALSE;
7765}

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4432 of file iparith.cc.

4433{
4434 res->data = (char *)0;
4435 return FALSE;
4436}

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4421 of file iparith.cc.

4422{
4423 res->data = (char *)(long)pVar((poly)v->Data());
4424 return FALSE;
4425}

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4426 of file iparith.cc.

4427{
4428 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4429 currRing->N)+1);
4430 return FALSE;
4431}
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:212

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv  res,
leftv  a 
)
static

Definition at line 4468 of file iparith.cc.

4469{
4470 ideal id = (ideal)a->Data();
4471 id = id_Transp(id,currRing);
4472 int W = IDELEMS(id);
4473
4474 ideal result = idInit(W * currRing->N, id->rank);
4475 poly *p = result->m;
4476
4477 for( int v = 1; v <= currRing->N; v++ )
4478 {
4479 poly* q = id->m;
4480 for( int i = 0; i < W; i++, p++, q++ )
4481 *p = pDiff( *q, v );
4482 }
4483 idDelete(&id);
4484
4485 res->data = (char *)result;
4486 return FALSE;
4487}

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4437 of file iparith.cc.

4438{
4439 ideal i=idInit(currRing->N,1);
4440 int k;
4441 poly p=(poly)(v->Data());
4442 for (k=currRing->N;k>0;k--)
4443 {
4444 i->m[k-1]=pDiff(p,k);
4445 }
4446 res->data = (char *)i;
4447 return FALSE;
4448}

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2535 of file iparith.cc.

2536{
2537 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2538 return jjStdJanetBasis(res,v,0);
2539}
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 2529 of file iparith.cc.

2530{
2531 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2532 return jjStdJanetBasis(res,u,(int)(long)v->Data());
2533}

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7766 of file iparith.cc.

7767{
7768 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7769 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7770 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7771 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7772 leftv u1=u;
7773 leftv u2=u1->next;
7774 leftv u3=u2->next;
7775 leftv u4=u3->next;
7776 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7777 {
7778 if(!pIsUnit((poly)u2->Data()))
7779 {
7780 WerrorS("2nd argument must be a unit");
7781 return TRUE;
7782 }
7783 res->rtyp=u1->Typ();
7784 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7785 pCopy((poly)u2->Data()),(intvec*)u4->Data());
7786 return FALSE;
7787 }
7788 else
7789 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7790 {
7791 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7792 {
7793 WerrorS("2nd argument must be a diagonal matrix of units");
7794 return TRUE;
7795 }
7796 res->rtyp=u1->Typ();
7797 res->data=(char*)idSeries(
7798 (int)(long)u3->Data(),
7799 idCopy((ideal)u1->Data()),
7800 mp_Copy((matrix)u2->Data(), currRing),
7801 (intvec*)u4->Data()
7802 );
7803 return FALSE;
7804 }
7805 else
7806 {
7807 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7808 Tok2Cmdname(iiOp));
7809 return TRUE;
7810 }
7811}
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 2545 of file iparith.cc.

2546{
2547 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2548 return FALSE;
2549}
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 6298 of file iparith.cc.

6299{
6300 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6301 (intvec *)w->Data(),currRing);
6302 return FALSE;
6303}
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 6304 of file iparith.cc.

6305{
6306 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6307 {
6308 WerrorS("2nd argument must be a diagonal matrix of units");
6309 return TRUE;
6310 }
6311 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6312 (matrix)v->CopyD());
6313 return FALSE;
6314}

◆ jjJET_P()

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

Definition at line 2540 of file iparith.cc.

2541{
2542 res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2543 return FALSE;
2544}
#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 6281 of file iparith.cc.

6282{
6283 int *iw=iv2array((intvec *)w->Data(),currRing);
6284 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6285 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6286 return FALSE;
6287}
#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 6288 of file iparith.cc.

6289{
6290 if (!pIsUnit((poly)v->Data()))
6291 {
6292 WerrorS("2nd argument must be a unit");
6293 return TRUE;
6294 }
6295 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6296 return FALSE;
6297}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4498

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4507 of file iparith.cc.

4508{
4510 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4511 return FALSE;
4512}
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 2550 of file iparith.cc.

2551{
2552 assumeStdFlag(u);
2553 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2554 res->data = (char *)scKBase((int)(long)v->Data(),
2555 (ideal)(u->Data()),currRing->qideal, w_u);
2556 if (w_u!=NULL)
2557 {
2558 atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2559 }
2560 return FALSE;
2561}
intvec * ivCopy(const intvec *o)
Definition: intvec.h:145

◆ jjKERNEL()

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

Definition at line 2563 of file iparith.cc.

2564{
2565 return jjPREIMAGE(res,u,v,NULL);
2566}
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6521

◆ jjKERNEL_M()

static BOOLEAN jjKERNEL_M ( leftv  res,
leftv  v 
)
static

Definition at line 4489 of file iparith.cc.

4490{
4491#ifdef HAVE_FLINT
4492 res->data = (char *)singflint_kernel((matrix)(v->Data()),currRing);
4493 return res->data==NULL;
4494#else
4495 return TRUE;
4496#endif
4497}
matrix singflint_kernel(matrix m, const ring R)

◆ jjKERNEL_SM()

static BOOLEAN jjKERNEL_SM ( leftv  res,
leftv  v 
)
static

Definition at line 4498 of file iparith.cc.

4499{
4500#ifdef HAVE_FLINT
4501 res->data = (char *)singflint_kernel((ideal)(v->Data()),currRing);
4502 return res->data==NULL;
4503#else
4504 return TRUE;
4505#endif
4506}

◆ jjKLAMMER()

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

Definition at line 1560 of file iparith.cc.

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

◆ jjKLAMMER_IV()

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

Definition at line 1572 of file iparith.cc.

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

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7849 of file iparith.cc.

7850{
7852 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7853 {
7854 memcpy(res,u,sizeof(sleftv));
7855 u->Init();
7856 return FALSE;
7857 }
7858 leftv v=u->next;
7859 BOOLEAN b;
7860 if(v==NULL) // p()
7862 else if ((v->next==NULL) // p(1)
7863 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7864 {
7865 u->next=NULL;
7866 b=iiExprArith2(res,u,iiOp,v);
7867 u->next=v;
7868 }
7869 else // p(1,2), p undefined
7870 {
7871 if (v->Typ()!=INT_CMD)
7872 {
7873 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
7874 return TRUE;
7875 }
7876 int l=u->listLength();
7877 size_t len=strlen(u->name) + 12*l;
7878 char * nn = (char *)omAlloc(len);
7879 snprintf(nn,len,"%s(%d",u->name,(int)(long)v->Data());
7880 char *s=nn;
7881 do
7882 {
7883 while (*s!='\0') s++;
7884 v=v->next;
7885 if (v->Typ()!=INT_CMD)
7886 {
7887 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
7888 omFree((ADDRESS)nn);
7889 return TRUE;
7890 }
7891 snprintf(s,len-(nn-s),",%d",(int)(long)v->Data());
7892 } while (v->next!=NULL);
7893 while (*s!='\0') s++;
7894 nn=strcat(nn,")");
7895 char *n=omStrDup(nn);
7896 omFree((ADDRESS)nn);
7897 syMake(res,n);
7898 b=FALSE;
7899 }
7900 return b;
7901}
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1599 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2567 of file iparith.cc.

2568{
2569 return mpKoszul(res, u,v,NULL);
2570}
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 2571 of file iparith.cc.

2572{
2573 sleftv h;
2574 h.Init();
2575 h.rtyp=INT_CMD;
2576 h.data=(void *)(long)IDELEMS((ideal)v->Data());
2577 return mpKoszul(res, u, &h, v);
2578}

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4513 of file iparith.cc.

4514{
4515 res->data=(char *)syConvList((lists)v->Data());
4516 if (res->data != NULL)
4517 return FALSE;
4518 else
4519 return TRUE;
4520}
syStrategy syConvList(lists li)
Definition: ipshell.cc:3256

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4590 of file iparith.cc.

4591{
4592 sleftv a2,a3;
4593 memset(&a2,0,sizeof(a2));
4594 memset(&a3,0,sizeof(a3));
4595 a2.rtyp=INT_CMD; a2.data=(void*)10;
4596 a3.rtyp=INT_CMD; a3.data=(void*)1;
4597 return nuLagSolve(res,v,&a2,&a3);
4598}
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 1201 of file iparith.cc.

1202{
1203 return jjGE_BI(res,v,u);
1204}
static BOOLEAN jjGE_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1166

◆ jjLE_I()

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

Definition at line 1205 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1210 of file iparith.cc.

1211{
1212 return jjGE_N(res,v,u);
1213}
static BOOLEAN jjGE_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1178

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4521 of file iparith.cc.

4522{
4523 poly p=(poly)v->Data();
4524 if (p==NULL)
4525 {
4526 res->data=(char *)nInit(0);
4527 }
4528 else
4529 {
4531 res->data=(char *)nCopy(pGetCoeff(p));
4532 }
4533 return FALSE;
4534}

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4535 of file iparith.cc.

4536{
4537 poly p=(poly)v->Data();
4538 int s=currRing->N;
4539 if (v->Typ()==VECTOR_CMD) s++;
4540 intvec *iv=new intvec(s);
4541 if (p!=NULL)
4542 {
4543 for(int i = currRing->N;i;i--)
4544 {
4545 (*iv)[i-1]=pGetExp(p,i);
4546 }
4547 if (s!=currRing->N)
4548 (*iv)[currRing->N]=pGetComp(p);
4549 }
4550 res->data=(char *)iv;
4551 return FALSE;
4552}
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4553 of file iparith.cc.

4554{
4555 poly p=(poly)v->Data();
4556 if (p == NULL)
4557 {
4558 res->data = (char*) NULL;
4559 }
4560 else
4561 {
4562 poly lm = pLmInit(p);
4563 pSetCoeff0(lm, nInit(1));
4564 res->data = (char*) lm;
4565 }
4566 return FALSE;
4567}
#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 2579 of file iparith.cc.

2580{
2581 int ul= IDELEMS((ideal)u->Data());
2582 int vl= IDELEMS((ideal)v->Data());
2583#ifdef HAVE_SHIFTBBA
2584 if (rIsLPRing(currRing))
2585 {
2586 if (currRing->LPncGenCount < ul)
2587 {
2588 Werror("At least %d ncgen variables are needed for this computation.", ul);
2589 return TRUE;
2590 }
2591 }
2592#endif
2593 ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2594 hasFlag(u,FLAG_STD));
2595 if (m==NULL) return TRUE;
2596 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2597 return FALSE;
2598}

◆ jjLIFT3()

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

Definition at line 6961 of file iparith.cc.

6962{
6963 if (w->rtyp!=IDHDL) return TRUE;
6964 int ul= IDELEMS((ideal)u->Data());
6965 int vl= IDELEMS((ideal)v->Data());
6966#ifdef HAVE_SHIFTBBA
6967 if (rIsLPRing(currRing))
6968 {
6969 if (currRing->LPncGenCount < ul)
6970 {
6971 Werror("At least %d ncgen variables are needed for this computation.", ul);
6972 return TRUE;
6973 }
6974 }
6975#endif
6976 ideal m
6977 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6978 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6979 if (m==NULL) return TRUE;
6980 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6981 return FALSE;
6982}
#define IDMATRIX(a)
Definition: ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7902 of file iparith.cc.

7903{
7904 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7905 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7906 leftv u=U;
7907 leftv v=u->next;
7908 leftv w=v->next;
7909 leftv u4=w->next;
7910 if (w->rtyp!=IDHDL) return TRUE;
7911 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7912 {
7913 // see jjLIFT3
7914 ideal I=(ideal)u->Data();
7915 int ul= IDELEMS(I /*(ideal)u->Data()*/);
7916 int vl= IDELEMS((ideal)v->Data());
7917 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7918 ideal m
7919 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7920 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7921 if (m==NULL) return TRUE;
7922 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7923 return FALSE;
7924 }
7925 else
7926 {
7927 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7928 "or (`module`,`module`,`matrix`,`string`) expected",
7929 Tok2Cmdname(iiOp));
7930 return TRUE;
7931 }
7932}

◆ jjLIFTSTD()

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

Definition at line 2599 of file iparith.cc.

2600{
2601 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2602 idhdl h=(idhdl)v->data;
2603#ifdef HAVE_SHIFTBBA
2605 {
2606 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2607 {
2608 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2609 return TRUE;
2610 }
2611 }
2612#endif
2613 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2614 res->data = (char *)idLiftStd((ideal)u->Data(),
2615 &(h->data.umatrix),testHomog);
2616 setFlag(res,FLAG_STD); v->flag=0;
2617 return FALSE;
2618}
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 7006 of file iparith.cc.

7007{
7008 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7009 idhdl hv=(idhdl)v->data;
7010 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
7011#ifdef HAVE_SHIFTBBA
7012 if (rIsLPRing(currRing))
7013 {
7014 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7015 {
7016 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7017 return TRUE;
7018 }
7019 }
7020#endif
7021 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7022 res->data = (char *)idLiftStd((ideal)u->Data(),
7023 &(hv->data.umatrix),testHomog,
7024 NULL,alg);
7025 setFlag(res,FLAG_STD); v->flag=0;
7026 return FALSE;
7027}

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 7933 of file iparith.cc.

7934{
7935 // we have 4 or 5 arguments
7936 leftv u=U;
7937 leftv v=u->next;
7938 leftv u3=v->next;
7939 leftv u4=u3->next;
7940 leftv u5=u4->next; // might be NULL
7941
7942 ideal *syz=NULL;
7943 GbVariant alg=GbDefault;
7944 ideal h11=NULL;
7945
7946 if(u5==NULL)
7947 {
7948 // test all three possibilities for 4 arguments
7949 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7950 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7951 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
7952 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
7953 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
7954 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
7955
7956 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7957 {
7958 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7959 idhdl hw=(idhdl)u3->data;
7960 syz=&(hw->data.uideal);
7961 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7962 }
7963 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
7964 {
7965 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7966 idhdl hw=(idhdl)u3->data;
7967 syz=&(hw->data.uideal);
7968 h11=(ideal)u4->Data();
7969 }
7970 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
7971 {
7972 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
7973 h11=(ideal)u4->Data();
7974 }
7975 else
7976 {
7977 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7978 return TRUE;
7979 }
7980 }
7981 else
7982 {
7983 // we have 5 arguments
7984 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
7985 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
7986 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7987 {
7988 idhdl hw=(idhdl)u3->data;
7989 syz=&(hw->data.uideal);
7990 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7991 h11=(ideal)u5->Data();
7992 }
7993 else
7994 {
7995 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7996 return TRUE;
7997 }
7998 }
7999
8000#ifdef HAVE_SHIFTBBA
8001 if (rIsLPRing(currRing))
8002 {
8003 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
8004 {
8005 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
8006 return TRUE;
8007 }
8008 }
8009#endif
8010
8011 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
8012 idhdl hv=(idhdl)v->data;
8013 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
8014 res->rtyp = u->Typ();
8015 res->data = (char *)idLiftStd((ideal)u->Data(),
8016 &(hv->data.umatrix),testHomog,
8017 syz,alg,h11);
8018 setFlag(res,FLAG_STD); v->flag=0;
8019 if(syz!=NULL)
8020 u3->flag=0;
8021 return FALSE;
8022}
@ GbDefault
Definition: ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 6983 of file iparith.cc.

6984{
6985 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6986 if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6987 idhdl hv=(idhdl)v->data;
6988 idhdl hw=(idhdl)w->data;
6989#ifdef HAVE_SHIFTBBA
6990 if (rIsLPRing(currRing))
6991 {
6992 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6993 {
6994 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6995 return TRUE;
6996 }
6997 }
6998#endif
6999 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7000 res->data = (char *)idLiftStd((ideal)u->Data(),
7001 &(hv->data.umatrix),testHomog,
7002 &(hw->data.uideal));
7003 setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7004 return FALSE;
7005}

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 8023 of file iparith.cc.

8024{
8025 int sl=0;
8026 if (v!=NULL) sl = v->listLength();
8027 lists L;
8028 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
8029 {
8030 int add_row_shift = 0;
8031 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
8032 if (weights!=NULL) add_row_shift=weights->min_in();
8033 L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
8034 }
8035 else
8036 {
8038 leftv h=NULL;
8039 int i;
8040 int rt;
8041
8042 L->Init(sl);
8043 for (i=0;i<sl;i++)
8044 {
8045 if (h!=NULL)
8046 { /* e.g. not in the first step:
8047 * h is the pointer to the old sleftv,
8048 * v is the pointer to the next sleftv
8049 * (in this moment) */
8050 h->next=v;
8051 }
8052 h=v;
8053 v=v->next;
8054 h->next=NULL;
8055 rt=h->Typ();
8056 if (rt==0)
8057 {
8058 L->Clean();
8059 Werror("`%s` is undefined",h->Fullname());
8060 return TRUE;
8061 }
8062 if (rt==RING_CMD)
8063 {
8064 L->m[i].rtyp=rt;
8065 L->m[i].data=rIncRefCnt(((ring)h->Data()));
8066 }
8067 else
8068 L->m[i].Copy(h);
8069 }
8070 }
8071 res->data=(char *)L;
8072 return FALSE;
8073}
int min_in()
Definition: intvec.h:121
@ RESOLUTION_CMD
Definition: grammar.cc:290
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3184
static ring rIncRefCnt(ring r)
Definition: ring.h:840

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4572 of file iparith.cc.

4573{
4574 lists l=(lists)v->Data();
4575 long mm=(long)atGet(v,"maxExp",INT_CMD);
4576 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4577 ring r=rCompose(l,TRUE,mm,isLetterplace);
4578 res->data=(char *)r;
4579 return (r==NULL);
4580}
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 5512 of file iparith.cc.

5513{
5514 char libnamebuf[1024];
5516
5517#ifdef HAVE_DYNAMIC_LOADING
5518 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5519#endif /* HAVE_DYNAMIC_LOADING */
5520 switch(LT)
5521 {
5522 default:
5523 case LT_NONE:
5524 Werror("%s: unknown type", s);
5525 break;
5526 case LT_NOTFOUND:
5527 Werror("cannot open %s", s);
5528 break;
5529
5530 case LT_SINGULAR:
5531 {
5532 char *plib = iiConvName(s);
5533 idhdl pl = IDROOT->get_level(plib,0);
5534 if (pl==NULL)
5535 {
5536 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5537 IDPACKAGE(pl)->language = LANG_SINGULAR;
5538 IDPACKAGE(pl)->libname=omStrDup(s);
5539 }
5540 else if (IDTYP(pl)!=PACKAGE_CMD)
5541 {
5542 Werror("can not create package `%s`",plib);
5543 omFreeBinAddr(plib);
5544 return TRUE;
5545 }
5546 else /* package */
5547 {
5548 package pa=IDPACKAGE(pl);
5549 if ((pa->language==LANG_C)
5550 || (pa->language==LANG_MIX))
5551 {
5552 Werror("can not create package `%s` - binaries exists",plib);
5553 omFreeBinAddr(plib);
5554 return TRUE;
5555 }
5556 }
5557 omFreeBinAddr(plib);
5558 package savepack=currPack;
5559 currPack=IDPACKAGE(pl);
5560 IDPACKAGE(pl)->loaded=TRUE;
5561 char libnamebuf[1024];
5562 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5563 BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5564 currPack=savepack;
5565 IDPACKAGE(pl)->loaded=(!bo);
5566 return bo;
5567 }
5568 case LT_BUILTIN:
5569 SModulFunc_t iiGetBuiltinModInit(const char*);
5570 return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5571 case LT_MACH_O:
5572 case LT_ELF:
5573 case LT_HPUX:
5574#ifdef HAVE_DYNAMIC_LOADING
5575 return load_modules(s, libnamebuf, autoexport);
5576#else /* HAVE_DYNAMIC_LOADING */
5577 WerrorS("Dynamic modules are not supported by this version of Singular");
5578 break;
5579#endif /* HAVE_DYNAMIC_LOADING */
5580 }
5581 return TRUE;
5582}
CanonicalForm fp
Definition: cfModGcd.cc:4102
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
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:1295
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:974
char * iiConvName(const char *libname)
Definition: iplib.cc:1430
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1285
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:807
VAR char libnamebuf[1024]
Definition: libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:27
lib_types
Definition: mod_raw.h:16
@ LT_MACH_O
Definition: mod_raw.h:16
@ LT_HPUX
Definition: mod_raw.h:16
@ LT_SINGULAR
Definition: mod_raw.h:16
@ LT_BUILTIN
Definition: mod_raw.h:16
@ LT_ELF
Definition: mod_raw.h:16
@ LT_NONE
Definition: mod_raw.h:16
@ LT_NOTFOUND
Definition: mod_raw.h:16
@ LANG_SINGULAR
Definition: subexpr.h:22
@ LANG_MIX
Definition: subexpr.h:22
@ LANG_C
Definition: subexpr.h:22

◆ jjLOAD1()

static BOOLEAN jjLOAD1 ( leftv  ,
leftv  v 
)
static

Definition at line 4568 of file iparith.cc.

4569{
4570 return jjLOAD((char*)v->Data(),FALSE);
4571}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5512

◆ jjLOAD2()

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

Definition at line 2619 of file iparith.cc.

2620{
2621 return jjLOAD((char*)v->Data(),TRUE);
2622}

◆ jjLOAD_E()

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

Definition at line 2623 of file iparith.cc.

2624{
2625 char * s=(char *)u->Data();
2626 if(strcmp(s, "with")==0)
2627 return jjLOAD((char*)v->Data(), TRUE);
2628 if (strcmp(s,"try")==0)
2629 return jjLOAD_TRY((char*)v->Data());
2630 WerrorS("invalid second argument");
2631 WerrorS("load(\"libname\" [,option]);");
2632 return TRUE;
2633}
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5588

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5588 of file iparith.cc.

5589{
5590 if (!iiGetLibStatus(s))
5591 {
5592 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5595 BOOLEAN bo=jjLOAD(s,TRUE);
5596 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5597 Print("loading of >%s< failed\n",s);
5598 WerrorS_callback=WerrorS_save;
5599 errorreported=0;
5600 }
5601 return FALSE;
5602}
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5583
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5584
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 1214 of file iparith.cc.

1215{
1216 return jjGT_BI(res,v,u);
1217}
static BOOLEAN jjGT_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1184

◆ jjLT_I()

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

Definition at line 1218 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1223 of file iparith.cc.

1224{
1225 return jjGT_N(res,v,u);
1226}
static BOOLEAN jjGT_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1196

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4599 of file iparith.cc.

4600{
4601 /* computes the LU-decomposition of a matrix M;
4602 i.e., M = P * L * U, where
4603 - P is a row permutation matrix,
4604 - L is in lower triangular form,
4605 - U is in upper row echelon form
4606 Then, we also have P * M = L * U.
4607 A list [P, L, U] is returned. */
4608 matrix mat = (matrix)v->Data();
4609 if (!idIsConstant((ideal)mat))
4610 {
4611 WerrorS("matrix must be constant");
4612 return TRUE;
4613 }
4614 matrix pMat;
4615 matrix lMat;
4616 matrix uMat;
4617
4618 luDecomp(mat, pMat, lMat, uMat);
4619
4621 ll->Init(3);
4622 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4623 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4624 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4625 res->data=(char*)ll;
4626
4627 return FALSE;
4628}
#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 7571 of file iparith.cc.

7572{
7573 /* computation of the inverse of a quadratic matrix A
7574 using the L-U-decomposition of A;
7575 There are two valid parametrisations:
7576 1) exactly one argument which is just the matrix A,
7577 2) exactly three arguments P, L, U which already
7578 realise the L-U-decomposition of A, that is,
7579 P * A = L * U, and P, L, and U satisfy the
7580 properties decribed in method 'jjLU_DECOMP';
7581 see there;
7582 If A is invertible, the list [1, A^(-1)] is returned,
7583 otherwise the list [0] is returned. Thus, the user may
7584 inspect the first entry of the returned list to see
7585 whether A is invertible. */
7586 matrix iMat; int invertible;
7587 const short t1[]={1,MATRIX_CMD};
7588 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7589 if (iiCheckTypes(v,t1))
7590 {
7591 matrix aMat = (matrix)v->Data();
7592 int rr = aMat->rows();
7593 int cc = aMat->cols();
7594 if (rr != cc)
7595 {
7596 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7597 return TRUE;
7598 }
7599 if (!idIsConstant((ideal)aMat))
7600 {
7601 WerrorS("matrix must be constant");
7602 return TRUE;
7603 }
7604 invertible = luInverse(aMat, iMat);
7605 }
7606 else if (iiCheckTypes(v,t2))
7607 {
7608 matrix pMat = (matrix)v->Data();
7609 matrix lMat = (matrix)v->next->Data();
7610 matrix uMat = (matrix)v->next->next->Data();
7611 int rr = uMat->rows();
7612 int cc = uMat->cols();
7613 if (rr != cc)
7614 {
7615 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7616 rr, cc);
7617 return TRUE;
7618 }
7619 if (!idIsConstant((ideal)pMat)
7620 || (!idIsConstant((ideal)lMat))
7621 || (!idIsConstant((ideal)uMat))
7622 )
7623 {
7624 WerrorS("matricesx must be constant");
7625 return TRUE;
7626 }
7627 invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7628 }
7629 else
7630 {
7631 Werror("expected either one or three matrices");
7632 return TRUE;
7633 }
7634
7635 /* build the return structure; a list with either one or two entries */
7637 if (invertible)
7638 {
7639 ll->Init(2);
7640 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7641 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7642 }
7643 else
7644 {
7645 ll->Init(1);
7646 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7647 }
7648
7649 res->data=(char*)ll;
7650 return FALSE;
7651}
int & cols()
Definition: matpol.h:24
int & rows()
Definition: matpol.h:23
bool luInverseFromLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, matrix &iMat, const ring R)
This code computes the inverse by inverting lMat and uMat, and then performing two matrix multiplicat...
bool luInverse(const matrix aMat, matrix &iMat, const ring R)
This code first computes the LU-decomposition of aMat, and then calls the method for inverting a matr...

◆ jjLU_SOLVE()

static BOOLEAN jjLU_SOLVE ( leftv  res,
leftv  v 
)
static

Definition at line 7652 of file iparith.cc.

7653{
7654 /* for solving a linear equation system A * x = b, via the
7655 given LU-decomposition of the matrix A;
7656 There is one valid parametrisation:
7657 1) exactly four arguments P, L, U, b;
7658 P, L, and U realise the L-U-decomposition of A, that is,
7659 P * A = L * U, and P, L, and U satisfy the
7660 properties decribed in method 'jjLU_DECOMP';
7661 see there;
7662 b is the right-hand side vector of the equation system;
7663 The method will return a list of either 1 entry or three entries:
7664 1) [0] if there is no solution to the system;
7665 2) [1, x, H] if there is at least one solution;
7666 x is any solution of the given linear system,
7667 H is the matrix with column vectors spanning the homogeneous
7668 solution space.
7669 The method produces an error if matrix and vector sizes do not fit. */
7670 const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7671 if (!iiCheckTypes(v,t))
7672 {
7673 WerrorS("expected exactly three matrices and one vector as input");
7674 return TRUE;
7675 }
7676 matrix pMat = (matrix)v->Data();
7677 matrix lMat = (matrix)v->next->Data();
7678 matrix uMat = (matrix)v->next->next->Data();
7679 matrix bVec = (matrix)v->next->next->next->Data();
7680 matrix xVec; int solvable; matrix homogSolSpace;
7681 if (pMat->rows() != pMat->cols())
7682 {
7683 Werror("first matrix (%d x %d) is not quadratic",
7684 pMat->rows(), pMat->cols());
7685 return TRUE;
7686 }
7687 if (lMat->rows() != lMat->cols())
7688 {
7689 Werror("second matrix (%d x %d) is not quadratic",
7690 lMat->rows(), lMat->cols());
7691 return TRUE;
7692 }
7693 if (lMat->rows() != uMat->rows())
7694 {
7695 Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7696 lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7697 return TRUE;
7698 }
7699 if (uMat->rows() != bVec->rows())
7700 {
7701 Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7702 uMat->rows(), uMat->cols(), bVec->rows());
7703 return TRUE;
7704 }
7705 if (!idIsConstant((ideal)pMat)
7706 ||(!idIsConstant((ideal)lMat))
7707 ||(!idIsConstant((ideal)uMat))
7708 )
7709 {
7710 WerrorS("matrices must be constant");
7711 return TRUE;
7712 }
7713 solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7714
7715 /* build the return structure; a list with either one or three entries */
7717 if (solvable)
7718 {
7719 ll->Init(3);
7720 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7721 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7722 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7723 }
7724 else
7725 {
7726 ll->Init(1);
7727 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7728 }
7729
7730 res->data=(char*)ll;
7731 return FALSE;
7732}
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 8742 of file iparith.cc.

8743{
8744 assume( e->Typ()==INT_CMD );
8745 Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8746 r->start =(int)(long)e->Data();
8747 return r;
8748}
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

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

Definition at line 1653 of file iparith.cc.

1654{
1655 //Print("try to map %s with %s\n",$3.Name(),$1.Name());
1656 if ((v->e==NULL)&&(v->name!=NULL)&&(v->next==NULL))
1657 {
1658 map m=(map)u->Data();
1659 leftv sl=iiMap(m,v->name);
1660 if (sl!=NULL)
1661 {
1662 memcpy(res,sl,sizeof(sleftv));
1664 return FALSE;
1665 }
1666 }
1667 else
1668 {
1669 Werror("%s(<name>) expected",u->Name());
1670 }
1671 return TRUE; /*sl==NULL or Werror*/
1672}
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 6784 of file iparith.cc.

6785{
6786 int mi=(int)(long)v->Data();
6787 int ni=(int)(long)w->Data();
6788 if ((mi<1)||(ni<1))
6789 {
6790 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6791 return TRUE;
6792 }
6793 matrix m=mpNew(mi,ni);
6794 ideal I=(ideal)u->CopyD(IDEAL_CMD);
6795 int i=si_min(IDELEMS(I),mi*ni);
6796 //for(i=i-1;i>=0;i--)
6797 //{
6798 // m->m[i]=I->m[i];
6799 // I->m[i]=NULL;
6800 //}
6801 memcpy(m->m,I->m,i*sizeof(poly));
6802 memset(I->m,0,i*sizeof(poly));
6803 id_Delete(&I,currRing);
6804 res->data = (char *)m;
6805 return FALSE;
6806}

◆ jjMATRIX_Ma()

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

Definition at line 6820 of file iparith.cc.

6821{
6822 int mi=(int)(long)v->Data();
6823 int ni=(int)(long)w->Data();
6824 if ((mi<1)||(ni<1))
6825 {
6826 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6827 return TRUE;
6828 }
6829 matrix m=mpNew(mi,ni);
6831 int r=si_min(MATROWS(I),mi);
6832 int c=si_min(MATCOLS(I),ni);
6833 int i,j;
6834 for(i=r;i>0;i--)
6835 {
6836 for(j=c;j>0;j--)
6837 {
6838 MATELEM(m,i,j)=MATELEM(I,i,j);
6839 MATELEM(I,i,j)=NULL;
6840 }
6841 }
6842 id_Delete((ideal *)&I,currRing);
6843 res->data = (char *)m;
6844 return FALSE;
6845}

◆ jjMATRIX_Mo()

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

Definition at line 6807 of file iparith.cc.

6808{
6809 int mi=(int)(long)v->Data();
6810 int ni=(int)(long)w->Data();
6811 if ((mi<0)||(ni<1))
6812 {
6813 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6814 return TRUE;
6815 }
6816 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6817 mi,ni,currRing);
6818 return FALSE;
6819}

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4629 of file iparith.cc.

4630{
4631 // clean out "_":
4633 // collect all info:
4634 omUpdateInfo();
4635 switch(((int)(long)v->Data()))
4636 {
4637 case 0:
4638 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4639 break;
4640 case 1:
4641 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4642 break;
4643 case 2:
4644 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4645 break;
4646 default:
4647 omPrintStats(stdout);
4648 omPrintInfo(stdout);
4649 omPrintBinStats(stdout);
4650 res->data = (char *)0;
4651 res->rtyp = NONE;
4652 }
4653 return FALSE;
4654}
omInfo_t om_Info
Definition: omStats.c:16
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
#define NONE
Definition: tok.h:221
#define omPrintStats(F)
Definition: xalloc.h:231
#define omPrintInfo(F)
Definition: xalloc.h:232
#define omPrintBinStats(F)
Definition: xalloc.h:233
#define omUpdateInfo()
Definition: xalloc.h:230

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6315 of file iparith.cc.

6316{
6317 /* Here's the use pattern for the minor command:
6318 minor ( matrix_expression m, int_expression minorSize,
6319 optional ideal_expression IasSB, optional int_expression k,
6320 optional string_expression algorithm,
6321 optional int_expression cachedMinors,
6322 optional int_expression cachedMonomials )
6323 This method here assumes that there are at least two arguments.
6324 - If IasSB is present, it must be a std basis. All minors will be
6325 reduced w.r.t. IasSB.
6326 - If k is absent, all non-zero minors will be computed.
6327 If k is present and k > 0, the first k non-zero minors will be
6328 computed.
6329 If k is present and k < 0, the first |k| minors (some of which
6330 may be zero) will be computed.
6331 If k is present and k = 0, an error is reported.
6332 - If algorithm is absent, all the following arguments must be absent too.
6333 In this case, a heuristic picks the best-suited algorithm (among
6334 Bareiss, Laplace, and Laplace with caching).
6335 If algorithm is present, it must be one of "Bareiss", "bareiss",
6336 "Laplace", "laplace", "Cache", "cache". In the cases "Cache" and
6337 "cache" two more arguments may be given, determining how many entries
6338 the cache may have at most, and how many cached monomials there are at
6339 most. (Cached monomials are counted over all cached polynomials.)
6340 If these two additional arguments are not provided, 200 and 100000
6341 will be used as defaults.
6342 */
6343 matrix m;
6344 leftv u=v->next;
6345 v->next=NULL;
6346 int v_typ=v->Typ();
6347 if (v_typ==MATRIX_CMD)
6348 {
6349 m = (matrix)v->Data();
6350 }
6351 else
6352 {
6353 if (v_typ==0)
6354 {
6355 Werror("`%s` is undefined",v->Fullname());
6356 return TRUE;
6357 }
6358 // try to convert to MATRIX:
6359 int ii=iiTestConvert(v_typ,MATRIX_CMD);
6360 BOOLEAN bo;
6361 sleftv tmp;
6362 if (ii>0) bo=iiConvert(v_typ,MATRIX_CMD,ii,v,&tmp);
6363 else bo=TRUE;
6364 if (bo)
6365 {
6366 Werror("cannot convert %s to matrix",Tok2Cmdname(v_typ));
6367 return TRUE;
6368 }
6369 m=(matrix)tmp.data;
6370 }
6371 const int mk = (int)(long)u->Data();
6372 bool noIdeal = true; bool noK = true; bool noAlgorithm = true;
6373 bool noCacheMinors = true; bool noCacheMonomials = true;
6374 ideal IasSB; int k; char* algorithm; int cacheMinors; int cacheMonomials;
6375
6376 /* here come the different cases of correct argument sets */
6377 if ((u->next != NULL) && (u->next->Typ() == IDEAL_CMD))
6378 {
6379 IasSB = (ideal)u->next->Data();
6380 noIdeal = false;
6381 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6382 {
6383 k = (int)(long)u->next->next->Data();
6384 noK = false;
6385 if ((u->next->next->next != NULL) &&
6386 (u->next->next->next->Typ() == STRING_CMD))
6387 {
6388 algorithm = (char*)u->next->next->next->Data();
6389 noAlgorithm = false;
6390 if ((u->next->next->next->next != NULL) &&
6391 (u->next->next->next->next->Typ() == INT_CMD))
6392 {
6393 cacheMinors = (int)(long)u->next->next->next->next->Data();
6394 noCacheMinors = false;
6395 if ((u->next->next->next->next->next != NULL) &&
6396 (u->next->next->next->next->next->Typ() == INT_CMD))
6397 {
6398 cacheMonomials =
6399 (int)(long)u->next->next->next->next->next->Data();
6400 noCacheMonomials = false;
6401 }
6402 }
6403 }
6404 }
6405 }
6406 else if ((u->next != NULL) && (u->next->Typ() == INT_CMD))
6407 {
6408 k = (int)(long)u->next->Data();
6409 noK = false;
6410 if ((u->next->next != NULL) && (u->next->next->Typ() == STRING_CMD))
6411 {
6412 algorithm = (char*)u->next->next->Data();
6413 noAlgorithm = false;
6414 if ((u->next->next->next != NULL) &&
6415 (u->next->next->next->Typ() == INT_CMD))
6416 {
6417 cacheMinors = (int)(long)u->next->next->next->Data();
6418 noCacheMinors = false;
6419 if ((u->next->next->next->next != NULL) &&
6420 (u->next->next->next->next->Typ() == INT_CMD))
6421 {
6422 cacheMonomials = (int)(long)u->next->next->next->next->Data();
6423 noCacheMonomials = false;
6424 }
6425 }
6426 }
6427 }
6428 else if ((u->next != NULL) && (u->next->Typ() == STRING_CMD))
6429 {
6430 algorithm = (char*)u->next->Data();
6431 noAlgorithm = false;
6432 if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6433 {
6434 cacheMinors = (int)(long)u->next->next->Data();
6435 noCacheMinors = false;
6436 if ((u->next->next->next != NULL) &&
6437 (u->next->next->next->Typ() == INT_CMD))
6438 {
6439 cacheMonomials = (int)(long)u->next->next->next->Data();
6440 noCacheMonomials = false;
6441 }
6442 }
6443 }
6444
6445 /* upper case conversion for the algorithm if present */
6446 if (!noAlgorithm)
6447 {
6448 if (strcmp(algorithm, "bareiss") == 0)
6449 algorithm = (char*)"Bareiss";
6450 if (strcmp(algorithm, "laplace") == 0)
6451 algorithm = (char*)"Laplace";
6452 if (strcmp(algorithm, "cache") == 0)
6453 algorithm = (char*)"Cache";
6454 }
6455
6456 v->next=u;
6457 /* here come some tests */
6458 if (!noIdeal)
6459 {
6460 assumeStdFlag(u->next);
6461 }
6462 if ((!noK) && (k == 0))
6463 {
6464 WerrorS("Provided number of minors to be computed is zero.");
6465 return TRUE;
6466 }
6467 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") != 0)
6468 && (strcmp(algorithm, "Laplace") != 0)
6469 && (strcmp(algorithm, "Cache") != 0))
6470 {
6471 WerrorS("Expected as algorithm one of 'B/bareiss', 'L/laplace', or 'C/cache'.");
6472 return TRUE;
6473 }
6474 if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") == 0)
6476 {
6477 Werror("Bareiss algorithm not defined over coefficient rings %s",
6478 "with zero divisors.");
6479 return TRUE;
6480 }
6481 if ((mk < 1) || (mk > m->rows()) || (mk > m->cols()))
6482 {
6483 ideal I=idInit(1,1);
6484 if (mk<1) I->m[0]=p_One(currRing);
6485 //Werror("invalid size of minors: %d (matrix is (%d x %d))", mk,
6486 // m->rows(), m->cols());
6487 res->data=(void*)I;
6488 return FALSE;
6489 }
6490 if ((!noAlgorithm) && (strcmp(algorithm, "Cache") == 0)
6491 && (noCacheMinors || noCacheMonomials))
6492 {
6493 cacheMinors = 200;
6494 cacheMonomials = 100000;
6495 }
6496
6497 /* here come the actual procedure calls */
6498 if (noAlgorithm)
6499 res->data = getMinorIdealHeuristic(m, mk, (noK ? 0 : k),
6500 (noIdeal ? 0 : IasSB), false);
6501 else if (strcmp(algorithm, "Cache") == 0)
6502 res->data = getMinorIdealCache(m, mk, (noK ? 0 : k),
6503 (noIdeal ? 0 : IasSB), 3, cacheMinors,
6504 cacheMonomials, false);
6505 else
6506 res->data = getMinorIdeal(m, mk, (noK ? 0 : k), algorithm,
6507 (noIdeal ? 0 : IasSB), false);
6508 if (v_typ!=MATRIX_CMD) idDelete((ideal *)&m);
6509 return FALSE;
6510}
ideal getMinorIdealCache(const matrix mat, const int minorSize, const int k, const ideal iSB, const int cacheStrategy, const int cacheN, const int cacheW, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
ideal getMinorIdeal(const matrix mat, const int minorSize, const int k, const char *algorithm, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
ideal getMinorIdealHeuristic(const matrix mat, const int minorSize, const int k, const ideal iSB, const bool allDifferent)
Returns the specified set of minors (= subdeterminantes) of the given matrix.
poly p_One(const ring r)
Definition: p_polys.cc:1313

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4680 of file iparith.cc.

4681{
4682 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4683
4684 syStrategy tmp=syCopy((syStrategy)v->Data());
4685 tmp = syMinimize(tmp); // enrich itself!
4686
4687 res->data=(char *)tmp;
4688
4689 if (weights!=NULL)
4690 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4691
4692 return FALSE;
4693}
syStrategy syMinimize(syStrategy syzstr)
Definition: syz1.cc:2392
syStrategy syCopy(syStrategy syzstr)
Definition: syz1.cc:1884

◆ jjMINUS_B()

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

Definition at line 920 of file iparith.cc.

921{
923 poly p=(poly)u->CopyD(POLY_CMD);
924 int l=pLength(p);
926 p= (poly)v->CopyD(POLY_CMD);
927 p=p_Neg(p,currRing);
928 l=pLength(p);
930 res->data=(void*)b;
931 return jjPLUSMINUS_Gen(res,u,v);
932}
static BOOLEAN jjPLUSMINUS_Gen(leftv res, leftv u, leftv v)
Definition: iparith.cc:632
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 910 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 895 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 943 of file iparith.cc.

944{
945 res->data = (char *)bimSub((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
946 if (res->data==NULL)
947 {
948 WerrorS("bigintmat/cmatrix not compatible");
949 return TRUE;
950 }
951 return jjPLUSMINUS_Gen(res,u,v);
952}
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 879 of file iparith.cc.

880{
881 void *ap=u->Data(); void *bp=v->Data();
882 long aa=(long)ap;
883 long bb=(long)bp;
884 long cc=aa-bb;
885 unsigned long a=(unsigned long)ap;
886 unsigned long b=(unsigned long)bp;
887 unsigned long c=a-b;
888 if (((Sy_bitL(bit31)&a)!=(Sy_bitL(bit31)&b))&&((Sy_bitL(bit31)&a)!=(Sy_bitL(bit31)&c)))
889 {
890 WarnS("int overflow(-), result may be wrong");
891 }
892 res->data = (char *)cc;
893 return jjPLUSMINUS_Gen(res,u,v);
894}
#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 933 of file iparith.cc.

934{
935 res->data = (char *)ivSub((intvec*)(u->Data()), (intvec*)(v->Data()));
936 if (res->data==NULL)
937 {
938 WerrorS("intmat size not compatible");
939 return TRUE;
940 }
941 return jjPLUSMINUS_Gen(res,u,v);
942}
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 953 of file iparith.cc.

954{
955 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
956 res->data = (char *)(mp_Sub(A , B, currRing));
957 if (res->data==NULL)
958 {
959 Werror("matrix size not compatible(%dx%d, %dx%d)",
961 return TRUE;
962 }
963 return jjPLUSMINUS_Gen(res,u,v);
964 return FALSE;
965}
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 900 of file iparith.cc.

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

◆ jjMINUS_SM()

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

Definition at line 966 of file iparith.cc.

967{
968 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
969 res->data = (char *)(sm_Sub(A , B, currRing));
970 if (res->data==NULL)
971 {
972 Werror("matrix size not compatible(%dx%d, %dx%d)",
973 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
974 return TRUE;
975 }
976 return jjPLUSMINUS_Gen(res,u,v);
977 return FALSE;
978}
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 905 of file iparith.cc.

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

◆ jjMOD_BI()

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

Definition at line 2687 of file iparith.cc.

2688{
2689 number q=(number)v->Data();
2690 if (n_IsZero(q,coeffs_BIGINT))
2691 {
2693 return TRUE;
2694 }
2695 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2696 return FALSE;
2697}
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:625

◆ jjMOD_N()

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

Definition at line 2698 of file iparith.cc.

2699{
2700 number q=(number)v->Data();
2701 if (nIsZero(q))
2702 {
2704 return TRUE;
2705 }
2706 res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2707 return FALSE;
2708}

◆ jjMOD_P()

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

Definition at line 2709 of file iparith.cc.

2710{
2711 poly q=(poly)v->Data();
2712 if (q==NULL)
2713 {
2715 return TRUE;
2716 }
2717 poly p=(poly)(u->Data());
2718 if (p==NULL)
2719 {
2720 res->data=NULL;
2721 return FALSE;
2722 }
2723 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2724 q /*(poly)(v->Data())*/ ,currRing));
2725 return FALSE;
2726}
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 2634 of file iparith.cc.

2635{
2636 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2637 tHomog hom=testHomog;
2638 if (w_u!=NULL)
2639 {
2640 //PrintS("modulo: wu:");w_u->show(INTVEC_CMD);PrintLn();
2641 w_u=ivCopy(w_u);
2642 hom=isHomog;
2643 }
2644 //else PrintS("modulo: wu:none\n");
2645 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2646 if (w_v!=NULL)
2647 {
2648 //PrintS("modulo: wv:");w_v->show(INTVEC_CMD);PrintLn();
2649 w_v=ivCopy(w_v);
2650 hom=isHomog;
2651 }
2652 //else PrintS("modulo: wv:none\n");
2653 if ((w_u!=NULL) && (w_v==NULL))
2654 w_v=ivCopy(w_u);
2655 if ((w_v!=NULL) && (w_u==NULL))
2656 w_u=ivCopy(w_v);
2657 ideal u_id=(ideal)u->Data();
2658 ideal v_id=(ideal)v->Data();
2659 if (w_u!=NULL)
2660 {
2661 if ((*w_u).compare((w_v))!=0)
2662 {
2663 WarnS("incompatible weights");
2664 delete w_u; w_u=NULL;
2665 hom=testHomog;
2666 }
2667 else
2668 {
2669 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2670 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2671 {
2672 WarnS("wrong weights");
2673 delete w_u; w_u=NULL;
2674 hom=testHomog;
2675 }
2676 }
2677 }
2678 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2679 if (w_u!=NULL)
2680 {
2681 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2682 }
2683 delete w_v;
2684 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2685 return FALSE;
2686}
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 6846 of file iparith.cc.

6847{
6848 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6849 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6850 tHomog hom=testHomog;
6851 if (w_u!=NULL)
6852 {
6853 w_u=ivCopy(w_u);
6854 hom=isHomog;
6855 }
6856 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6857 if (w_v!=NULL)
6858 {
6859 w_v=ivCopy(w_v);
6860 hom=isHomog;
6861 }
6862 if ((w_u!=NULL) && (w_v==NULL))
6863 w_v=ivCopy(w_u);
6864 if ((w_v!=NULL) && (w_u==NULL))
6865 w_u=ivCopy(w_v);
6866 ideal u_id=(ideal)u->Data();
6867 ideal v_id=(ideal)v->Data();
6868 if (w_u!=NULL)
6869 {
6870 if ((*w_u).compare((w_v))!=0)
6871 {
6872 WarnS("incompatible weights");
6873 delete w_u; w_u=NULL;
6874 hom=testHomog;
6875 }
6876 else
6877 {
6878 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6879 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6880 {
6881 WarnS("wrong weights");
6882 delete w_u; w_u=NULL;
6883 hom=testHomog;
6884 }
6885 }
6886 }
6887 idhdl h=(idhdl)w->data;
6888 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
6889 if (w_u!=NULL)
6890 {
6891 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6892 }
6893 delete w_v;
6894 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6895 return FALSE;
6896}

◆ jjMODULO3S()

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

Definition at line 6897 of file iparith.cc.

6898{
6899 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6900 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6901 tHomog hom=testHomog;
6902 if (w_u!=NULL)
6903 {
6904 w_u=ivCopy(w_u);
6905 hom=isHomog;
6906 }
6907 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6908 if (w_v!=NULL)
6909 {
6910 w_v=ivCopy(w_v);
6911 hom=isHomog;
6912 }
6913 if ((w_u!=NULL) && (w_v==NULL))
6914 w_v=ivCopy(w_u);
6915 if ((w_v!=NULL) && (w_u==NULL))
6916 w_u=ivCopy(w_v);
6917 ideal u_id=(ideal)u->Data();
6918 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
6919 ideal v_id=(ideal)v->Data();
6920 if (w_u!=NULL)
6921 {
6922 if ((*w_u).compare((w_v))!=0)
6923 {
6924 WarnS("incompatible weights");
6925 delete w_u; w_u=NULL;
6926 hom=testHomog;
6927 }
6928 else
6929 {
6930 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6931 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6932 {
6933 WarnS("wrong weights");
6934 delete w_u; w_u=NULL;
6935 hom=testHomog;
6936 }
6937 }
6938 }
6939 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
6940 if (w_u!=NULL)
6941 {
6942 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6943 }
6944 delete w_v;
6945 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6946 return FALSE;
6947}

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 8074 of file iparith.cc.

8075{
8076 leftv v=u->next;
8077 leftv w=v->next;
8078 leftv u4=w->next;
8079 GbVariant alg;
8080 ideal u_id,v_id;
8081 // we have 4 arguments
8082 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8083 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8084 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8085 {
8086 u_id=(ideal)u->Data();
8087 v_id=(ideal)v->Data();
8088 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8089 }
8090 else
8091 {
8092 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8093 return TRUE;
8094 }
8095 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8096 tHomog hom=testHomog;
8097 if (w_u!=NULL)
8098 {
8099 w_u=ivCopy(w_u);
8100 hom=isHomog;
8101 }
8102 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8103 if (w_v!=NULL)
8104 {
8105 w_v=ivCopy(w_v);
8106 hom=isHomog;
8107 }
8108 if ((w_u!=NULL) && (w_v==NULL))
8109 w_v=ivCopy(w_u);
8110 if ((w_v!=NULL) && (w_u==NULL))
8111 w_u=ivCopy(w_v);
8112 if (w_u!=NULL)
8113 {
8114 if ((*w_u).compare((w_v))!=0)
8115 {
8116 WarnS("incompatible weights");
8117 delete w_u; w_u=NULL;
8118 hom=testHomog;
8119 }
8120 else
8121 {
8122 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8123 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8124 {
8125 WarnS("wrong weights");
8126 delete w_u; w_u=NULL;
8127 hom=testHomog;
8128 }
8129 }
8130 }
8131 idhdl h=(idhdl)w->data;
8132 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8133 if (w_u!=NULL)
8134 {
8135 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8136 }
8137 delete w_v;
8138 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8139 return FALSE;
8140}

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2728 of file iparith.cc.

2729{
2730 return jjMONITOR2(res,v,NULL);
2731}
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2732

◆ jjMONITOR2()

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

Definition at line 2732 of file iparith.cc.

2733{
2734#if 0
2735 char *opt=(char *)v->Data();
2736 int mode=0;
2737 while(*opt!='\0')
2738 {
2739 if (*opt=='i') mode |= SI_PROT_I;
2740 else if (*opt=='o') mode |= SI_PROT_O;
2741 opt++;
2742 }
2743 monitor((char *)(u->Data()),mode);
2744#else
2745 si_link l=(si_link)u->Data();
2746 if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2747 if(strcmp(l->m->type,"ASCII")!=0)
2748 {
2749 Werror("ASCII link required, not `%s`",l->m->type);
2750 slClose(l);
2751 return TRUE;
2752 }
2753 SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2754 if ( l->name[0]!='\0') // "" is the stop condition
2755 {
2756 const char *opt;
2757 int mode=0;
2758 if (v==NULL) opt=(const char*)"i";
2759 else opt=(const char *)v->Data();
2760 while(*opt!='\0')
2761 {
2762 if (*opt=='i') mode |= SI_PROT_I;
2763 else if (*opt=='o') mode |= SI_PROT_O;
2764 opt++;
2765 }
2766 monitor((FILE *)l->data,mode);
2767 }
2768 else
2769 monitor(NULL,0);
2770 return FALSE;
2771#endif
2772}
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 2773 of file iparith.cc.

2774{
2775 intvec *iv=(intvec *)v->Data();
2776 poly p=pOne();
2777 int e;
2778 BOOLEAN err=FALSE;
2779 for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2780 {
2781 e=(*iv)[i-1];
2782 if (e>=0) pSetExp(p,i,e);
2783 else err=TRUE;
2784 }
2785 if (iv->length()==(currRing->N+1))
2786 {
2787 res->rtyp=VECTOR_CMD;
2788 e=(*iv)[currRing->N];
2789 if (e>=0) pSetComp(p,e);
2790 else err=TRUE;
2791 }
2792 pSetm(p);
2793 res->data=(char*)p;
2794 if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2795 return err;
2796}

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5662 of file iparith.cc.

5663{
5664 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5665 return FALSE;
5666}
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:268

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5667 of file iparith.cc.

5668{
5669 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5670 return FALSE;
5671}
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:247

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4659 of file iparith.cc.

4660{
4661 int t=v->Typ();
4662 ideal r,m;
4663 r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4665 l->Init(2);
4666 l->m[0].rtyp=t;
4667 l->m[0].data=(char *)r;
4668 setFlag(&(l->m[0]),FLAG_STD);
4669 l->m[1].rtyp=t;
4670 l->m[1].data=(char *)m;
4671 res->data=(char *)l;
4672 return FALSE;
4673}
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:3036

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4674 of file iparith.cc.

4675{
4677 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4678 return FALSE;
4679}
int scMultInt(ideal S, ideal Q)
Definition: hdegree.cc:903

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4694 of file iparith.cc.

4695{
4696 number n,i; i=(number)v->Data();
4698 if (nMap!=NULL)
4699 n=nMap(i,currRing->cf,coeffs_BIGINT);
4700 else goto err;
4701 res->data=(void *)n;
4702 return FALSE;
4703err:
4704 WerrorS("cannot convert to bigint"); return TRUE;
4705}

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4706 of file iparith.cc.

4707{
4708 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4709 res->data=omStrDup(v->name);
4710 else if (v->name==NULL)
4711 res->data=omStrDup("");
4712 else
4713 {
4714 res->data = (char *)v->name;
4715 v->name=NULL;
4716 }
4717 return FALSE;
4718}

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4719 of file iparith.cc.

4720{
4721 res->data=ipNameList(((ring)v->Data())->idroot);
4722 return FALSE;
4723}
lists ipNameList(idhdl root)
Definition: ipid.cc:627

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8141 of file iparith.cc.

8142{
8143 res->data=(void *)ipNameList(IDROOT);
8144 return FALSE;
8145}

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4724 of file iparith.cc.

4725{
4726 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4727 return FALSE;
4728}
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:650

◆ jjNEWSTRUCT2()

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

Definition at line 2797 of file iparith.cc.

2798{
2799 // u: the name of the new type
2800 // v: the elements
2801 const char *s=(const char *)u->Data();
2802 newstruct_desc d=NULL;
2803 if (strlen(s)>=2)
2804 {
2805 d=newstructFromString((const char *)v->Data());
2806 if (d!=NULL) newstruct_setup(s,d);
2807 }
2808 else WerrorS("name of newstruct must be longer than 1 character");
2809 return d==NULL;
2810}
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 6511 of file iparith.cc.

6512{
6513 // u: the name of the new type
6514 // v: the parent type
6515 // w: the elements
6516 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6517 (const char *)w->Data());
6518 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6519 return (d==NULL);
6520}
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 5702 of file iparith.cc.

5703{
5704 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5705 res->data=(char *)(long)iin_Int(n,currRing->cf);
5706 n_Delete(&n,currRing->cf);
5707 return FALSE;
5708}
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:225

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5709 of file iparith.cc.

5710{
5711 number n=(number)u->Data();
5712 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5713 return FALSE;
5714}

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4729 of file iparith.cc.

4730{
4731 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4732 return FALSE;
4733}

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3718 of file iparith.cc.

3719{
3720 return FALSE;
3721}

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 4024 of file iparith.cc.

4025{
4026 number n = reinterpret_cast<number>(v->CopyD());
4027 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
4028 n_Delete(&n,currRing->cf);
4029 return FALSE;
4030}
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:605

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4734 of file iparith.cc.

4735{
4736 res->data = (char *)(long)(((ring)(v->Data()))->N);
4737 return FALSE;
4738}

◆ 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;
271 bigintmat *cc=NULL;
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;
252 bigintmat *cc=NULL;
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{
306 intvec* aa= (intvec *)u->CopyD(INTVEC_CMD);
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{
285 intvec* aa= (intvec *)u->CopyD(INTVEC_CMD);
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 507 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4739 of file iparith.cc.

4740{
4741 si_link l=(si_link)v->Data();
4742 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4743 else { slPrepClose(l); return slClose(l);}
4744}
@ OPEN_CMD
Definition: tok.h:144

◆ jjOPPOSE()

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

Definition at line 2976 of file iparith.cc.

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

5240{
5241#ifdef HAVE_PLURAL
5242 ring r = (ring)a->Data();
5243 //if (rIsPluralRing(r))
5244 if (r->OrdSgn==1)
5245 {
5246 res->data = rOpposite(r);
5247 }
5248 else
5249 {
5250 WarnS("opposite only for global orderings");
5251 res->data = rCopy(r);
5252 }
5253 return FALSE;
5254#else
5255 return TRUE;
5256#endif
5257}
ring rOpposite(ring src)
Definition: ring.cc:5342

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8146 of file iparith.cc.

8147{
8148 if(v==NULL)
8149 {
8150 res->data=(char *)showOption();
8151 return FALSE;
8152 }
8153 res->rtyp=NONE;
8154 return setOption(res,v);
8155}
char * showOption()
Definition: misc_ip.cc:709
void setOption(int ch)
Definition: shared.cc:1368

◆ jjOR_I()

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

Definition at line 1385 of file iparith.cc.

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

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4745 of file iparith.cc.

4746{
4747 poly p=(poly)v->Data();
4748 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4749 return FALSE;
4750}

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4791 of file iparith.cc.

4792{
4793 poly p=(poly)v->Data();
4794 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4795 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4796 {
4797 WerrorS("poly must be constant");
4798 return TRUE;
4799 }
4800 number i=pGetCoeff(p);
4801 number n;
4803 if (nMap!=NULL)
4804 n=nMap(i,currRing->cf,coeffs_BIGINT);
4805 else goto err;
4806 res->data=(void *)n;
4807 return FALSE;
4808err:
4809 WerrorS("cannot convert to bigint"); return TRUE;
4810}

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4811 of file iparith.cc.

4812{
4813 poly p=(poly)v->Data();
4814 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4815 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4816 {
4817 WerrorS("poly must be constant");
4818 return TRUE;
4819 }
4820 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4821 return FALSE;
4822}

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4859 of file iparith.cc.

4860{
4861 number n;
4862 poly p;
4863 if (((p=(poly)v->Data())!=NULL)
4864 && (pIsConstant(p)))
4865 {
4866 n=nCopy(pGetCoeff(p));
4867 }
4868 else
4869 {
4870 n=nInit(0);
4871 }
4872 res->data = (char *)n;
4873 return FALSE;
4874}

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4751 of file iparith.cc.

4752{
4753 int i=(int)(long)v->Data();
4754 int p=0;
4755 p=rPar(currRing);
4756 if ((0<i) && (i<=p))
4757 {
4758 res->data=(char *)n_Param(i,currRing);
4759 }
4760 else
4761 {
4762 Werror("par number %d out of range 1..%d",i,p);
4763 return TRUE;
4764 }
4765 return FALSE;
4766}
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:780

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4767 of file iparith.cc.

4768{
4769 number nn=(number)v->Data();
4770 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4771 return FALSE;
4772}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition: coeffs.h:767

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4773 of file iparith.cc.

4774{
4775 if (currRing==NULL)
4776 {
4777 WerrorS("no ring active (1)");
4778 return TRUE;
4779 }
4780 int i=(int)(long)v->Data();
4781 int p=0;
4782 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4783 res->data=omStrDup(rParameter(currRing)[i-1]);
4784 else
4785 {
4786 Werror("par number %d out of range 1..%d",i,p);
4787 return TRUE;
4788 }
4789 return FALSE;
4790}

◆ jjPARSTR2()

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

Definition at line 2811 of file iparith.cc.

2812{
2813 idhdl h=(idhdl)u->data;
2814 int i=(int)(long)v->Data();
2815 int p=0;
2816 if ((0<i)
2817 && (rParameter(IDRING(h))!=NULL)
2818 && (i<=(p=rPar(IDRING(h)))))
2819 res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2820 else
2821 {
2822 Werror("par number %d out of range 1..%d",i,p);
2823 return TRUE;
2824 }
2825 return FALSE;
2826}
#define IDRING(a)
Definition: ipid.h:127

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4581 of file iparith.cc.

4582{
4583 /* call method jjPFAC2 with second argument = 0 (meaning that no
4584 valid bound for the prime factors has been given) */
4585 sleftv tmp;
4586 tmp.Init();
4587 tmp.rtyp = INT_CMD;
4588 return jjPFAC2(res, v, &tmp);
4589}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3235

◆ jjPFAC2()

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

Definition at line 3235 of file iparith.cc.

3236{
3237 number n1; int i;
3238
3239 if ((u->Typ() == BIGINT_CMD) ||
3240 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3241 {
3242 n1 = (number)u->CopyD();
3243 }
3244 else if (u->Typ() == INT_CMD)
3245 {
3246 i = (int)(long)u->Data();
3247 n1 = n_Init(i, coeffs_BIGINT);
3248 }
3249 else
3250 {
3251 return TRUE;
3252 }
3253
3254 i = (int)(long)v->Data();
3255
3256 lists l = primeFactorisation(n1, i);
3257 n_Delete(&n1, coeffs_BIGINT);
3258 res->data = (char*)l;
3259 return FALSE;
3260}
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 5634 of file iparith.cc.

5635{
5636 res->data = (char *)pHead((poly)v->Data());
5637 return FALSE;
5638}

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5609 of file iparith.cc.

5610{
5611 res->data = (char *)(long)pLength((poly)v->Data());
5612 return FALSE;
5613}

◆ jjPlural_mat_mat()

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

Definition at line 2888 of file iparith.cc.

2889{
2890 if( currRing->qideal != NULL )
2891 {
2892 WerrorS("basering must NOT be a qring!");
2893 return TRUE;
2894 }
2895
2896 if (iiOp==NCALGEBRA_CMD)
2897 {
2898 return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2899 }
2900 else
2901 {
2902 ring r=rCopy(currRing);
2903 BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2904 res->data=r;
2905 return result;
2906 }
2907}
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2692
@ NCALGEBRA_CMD
Definition: tok.h:137

◆ jjPlural_mat_poly()

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

Definition at line 2868 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2848 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2828 of file iparith.cc.

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

◆ jjPLUS_B()

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

Definition at line 783 of file iparith.cc.

784{
785 //res->data = (char *)(pAdd((poly)u->CopyD(POLY_CMD) , (poly)v->CopyD(POLY_CMD)));
787 poly p=(poly)u->CopyD(POLY_CMD);
788 int l=pLength(p);
790 p= (poly)v->CopyD(POLY_CMD);
791 l=pLength(p);
793 res->data=(void*)b;
794 return jjPLUSMINUS_Gen(res,u,v);
795}

◆ jjPLUS_B_P()

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

Definition at line 796 of file iparith.cc.

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

◆ jjPLUS_BI()

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

Definition at line 768 of file iparith.cc.

769{
770 res->data = (char *)(n_Add((number)u->Data(), (number)v->Data(),coeffs_BIGINT));
771 return jjPLUSMINUS_Gen(res,u,v);
772}
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:647

◆ jjPLUS_BIM()

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

Definition at line 815 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 756 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 874 of file iparith.cc.

875{
876 res->data = (char *)idAdd((ideal)u->Data(),(ideal)v->Data());
877 return jjPLUSMINUS_Gen(res,u,v);
878}
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 805 of file iparith.cc.

806{
807 res->data = (char *)ivAdd((intvec*)(u->Data()), (intvec*)(v->Data()));
808 if (res->data==NULL)
809 {
810 WerrorS("intmat size not compatible");
811 return TRUE;
812 }
813 return jjPLUSMINUS_Gen(res,u,v);
814}
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 825 of file iparith.cc.

826{
827 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
828 res->data = (char *)(mp_Add(A , B, currRing));
829 if (res->data==NULL)
830 {
831 Werror("matrix size not compatible(%dx%d, %dx%d)",
833 return TRUE;
834 }
835 return jjPLUSMINUS_Gen(res,u,v);
836}
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 849 of file iparith.cc.

850{
851 matrix m=(matrix)u->Data();
852 matrix p= mp_InitP(m->nrows,m->ncols,(poly)(v->CopyD(POLY_CMD)),currRing);
853 if (iiOp=='+')
854 res->data = (char *)mp_Add(m , p,currRing);
855 else
856 res->data = (char *)mp_Sub(m , p,currRing);
857 idDelete((ideal *)&p);
858 return jjPLUSMINUS_Gen(res,u,v);
859}
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 773 of file iparith.cc.

774{
775 res->data = (char *)(nAdd((number)u->Data(), (number)v->Data()));
776 return jjPLUSMINUS_Gen(res,u,v);
777}
#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 860 of file iparith.cc.

861{
862 return jjPLUS_MA_P(res,v,u);
863}
static BOOLEAN jjPLUS_MA_P(leftv res, leftv u, leftv v)
Definition: iparith.cc:849

◆ jjPLUS_S()

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

Definition at line 864 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 837 of file iparith.cc.

838{
839 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
840 res->data = (char *)(sm_Add(A , B, currRing));
841 if (res->data==NULL)
842 {
843 Werror("matrix size not compatible(%dx%d, %dx%d)",
844 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
845 return TRUE;
846 }
847 return jjPLUSMINUS_Gen(res,u,v);
848}
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 778 of file iparith.cc.

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

◆ jjPLUSMINUS_Gen()

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

Definition at line 632 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3732 of file iparith.cc.

3733{
3734 if (IDTYP((idhdl)u->data)==INT_CMD)
3735 {
3736 int i=IDINT((idhdl)u->data);
3737 if (iiOp==PLUSPLUS) i++;
3738 else i--;
3739 IDDATA((idhdl)u->data)=(char *)(long)i;
3740 return FALSE;
3741 }
3742 return TRUE;
3743}
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5657 of file iparith.cc.

5658{
5659 res->data = (char *)pMaxComp((poly)v->Data());
5660 return FALSE;
5661}

◆ jjPOWER_BI()

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

Definition at line 569 of file iparith.cc.

570{
571 int e=(int)(long)v->Data();
572 number n=(number)u->Data();
573 if (e>=0)
574 {
575 n_Power(n,e,(number*)&res->data,coeffs_BIGINT);
576 }
577 else
578 {
579 WerrorS("exponent must be non-negative");
580 return TRUE;
581 }
582 if (u!=NULL) return jjOP_REST(res,u,v);
583 return FALSE;
584}
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:629
static BOOLEAN jjOP_REST(leftv res, leftv u, leftv v)
Definition: iparith.cc:507

◆ jjPOWER_I()

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

Definition at line 523 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 626 of file iparith.cc.

627{
628 res->data = (char *)id_Power((ideal)(u->Data()),(int)(long)(v->Data()), currRing);
629 if (u!=NULL) return jjOP_REST(res,u,v);
630 return FALSE;
631}
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 585 of file iparith.cc.

586{
587 int e=(int)(long)v->Data();
588 number n=(number)u->Data();
589 int d=0;
590 if (e<0)
591 {
592 n=nInvers(n);
593 e=-e;
594 d=1;
595 }
596 number r;
597 nPower(n,e,(number*)&r);
598 res->data=(char*)r;
599 if (d) nDelete(&n);
600 if (u!=NULL) return jjOP_REST(res,u,v);
601 return FALSE;
602}
#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 603 of file iparith.cc.

604{
605 int v_i=(int)(long)v->Data();
606 if (v_i<0)
607 {
608 WerrorS("exponent must be non-negative");
609 return TRUE;
610 }
611 poly u_p=(poly)u->CopyD(POLY_CMD);
612 if ((u_p!=NULL)
613 && (!rIsLPRing(currRing))
614 && ((v_i!=0) &&
615 ((long)pTotaldegree(u_p) > (signed long)currRing->bitmask / (signed long)v_i/2)))
616 {
617 Werror("OVERFLOW in power(d=%ld, e=%d, max=%ld)",
618 pTotaldegree(u_p),v_i,currRing->bitmask/2);
619 pDelete(&u_p);
620 return TRUE;
621 }
622 res->data = (char *)pPower(u_p,v_i);
623 if (u!=NULL) return jjOP_REST(res,u,v);
624 return errorreported; /* pPower may set errorreported via Werror */
625}
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 6521 of file iparith.cc.

6522{
6523 // handles preimage(r,phi,i) and kernel(r,phi)
6524 idhdl h;
6525 ring rr;
6526 map mapping;
6527 BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6528
6529 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6530 {
6531 WerrorS("2nd/3rd arguments must have names");
6532 return TRUE;
6533 }
6534 rr=(ring)u->Data();
6535 const char *ring_name=u->Name();
6536 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6537 {
6538 if (h->typ==MAP_CMD)
6539 {
6540 mapping=IDMAP(h);
6541 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6542 if ((preim_ring==NULL)
6543 || (IDRING(preim_ring)!=currRing))
6544 {
6545 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6546 return TRUE;
6547 }
6548 }
6549 else if (h->typ==IDEAL_CMD)
6550 {
6551 mapping=IDMAP(h);
6552 }
6553 else
6554 {
6555 Werror("`%s` is no map nor ideal",IDID(h));
6556 return TRUE;
6557 }
6558 }
6559 else
6560 {
6561 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6562 return TRUE;
6563 }
6564 ideal image;
6565 if (kernel_cmd) image=idInit(1,1);
6566 else
6567 {
6568 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6569 {
6570 if (h->typ==IDEAL_CMD)
6571 {
6572 image=IDIDEAL(h);
6573 }
6574 else
6575 {
6576 Werror("`%s` is no ideal",IDID(h));
6577 return TRUE;
6578 }
6579 }
6580 else
6581 {
6582 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6583 return TRUE;
6584 }
6585 }
6586 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6587 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6588 {
6589 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6590 }
6591 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6592 if (kernel_cmd) idDelete(&image);
6593 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6594}
#define IDMAP(a)
Definition: ipid.h:135
#define IDIDEAL(a)
Definition: ipid.h:133
#define IDID(a)
Definition: ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:57
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:762
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4823 of file iparith.cc.

4824{
4825 map mapping=(map)v->Data();
4826 syMake(res,omStrDup(mapping->preimage));
4827 return FALSE;
4828}

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4829 of file iparith.cc.

4830{
4831 int i = IsPrime((int)(long)(v->Data()));
4832 res->data = (char *)(long)(i > 1 ? i : 2);
4833 return FALSE;
4834}
int IsPrime(int p)
Definition: prime.cc:61

◆ jjPROC()

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

Definition at line 1617 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3809 of file iparith.cc.

3810{
3811 return jjPROC(res,u,NULL);
3812}
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1617

◆ jjPROC3()

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

Definition at line 5997 of file iparith.cc.

5998{
6000 memcpy(v->next,w,sizeof(sleftv));
6001 w->Init();
6002 return jjPROC(res,u,v);
6003}

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4835 of file iparith.cc.

4836{
4837 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4838 ideal v_id=(ideal)v->Data();
4839 if (w!=NULL)
4840 {
4841 if (!idTestHomModule(v_id,currRing->qideal,w))
4842 {
4843 WarnS("wrong weights");
4844 w=NULL;
4845 // and continue at the non-homog case below
4846 }
4847 else
4848 {
4849 w=ivCopy(w);
4850 intvec **ww=&w;
4851 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4852 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4853 return FALSE;
4854 }
4855 }
4856 res->data = (char *)idMinEmbedding(v_id);
4857 return FALSE;
4858}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2695

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8620 of file iparith.cc.

8621{
8622 if ((INPUT->Typ() != MATRIX_CMD) ||
8623 (INPUT->next->Typ() != NUMBER_CMD) ||
8624 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8625 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8626 {
8627 WerrorS("expected (matrix, number, number, number) as arguments");
8628 return TRUE;
8629 }
8630 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8631 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8632 (number)(v->Data()),
8633 (number)(w->Data()),
8634 (number)(x->Data()));
8635 return FALSE;
8636}
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 3049 of file iparith.cc.

3050{
3051 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3052 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3053 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
3054 return FALSE;
3055}
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 3056 of file iparith.cc.

3057{
3058 int i=(int)(long)u->Data();
3059 int j=(int)(long)v->Data();
3060 if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3061 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3062 return FALSE;
3063}
int siRand()
Definition: sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6595 of file iparith.cc.

6596{
6597 int di, k;
6598 int i=(int)(long)u->Data();
6599 int r=(int)(long)v->Data();
6600 int c=(int)(long)w->Data();
6601 if ((r<=0) || (c<=0)) return TRUE;
6602 intvec *iv = new intvec(r, c, 0);
6603 if (iv->rows()==0)
6604 {
6605 delete iv;
6606 return TRUE;
6607 }
6608 if (i!=0)
6609 {
6610 if (i<0) i = -i;
6611 di = 2 * i + 1;
6612 for (k=0; k<iv->length(); k++)
6613 {
6614 (*iv)[k] = ((siRand() % di) - i);
6615 }
6616 }
6617 res->data = (char *)iv;
6618 return FALSE;
6619}

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4897 of file iparith.cc.

4898{
4899 matrix m =(matrix)v->Data();
4900 int rank = luRank(m, 0);
4901 res->data =(char *)(long)rank;
4902 return FALSE;
4903}
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 3064 of file iparith.cc.

3065{
3066 matrix m =(matrix)u->Data();
3067 int isRowEchelon = (int)(long)v->Data();
3068 if (isRowEchelon != 1) isRowEchelon = 0;
3069 int rank = luRank(m, isRowEchelon);
3070 res->data =(char *)(long)rank;
3071 return FALSE;
3072}

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5629 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4904 of file iparith.cc.

4905{
4906 return jjREAD2(res,v,NULL);
4907}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3073

◆ jjREAD2()

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

Definition at line 3073 of file iparith.cc.

3074{
3075 si_link l=(si_link)u->Data();
3076 leftv r=slRead(l,v);
3077 if (r==NULL)
3078 {
3079 const char *s;
3080 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3081 else s=sNoName_fe;
3082 Werror("cannot read from `%s`",s);
3083 return TRUE;
3084 }
3085 memcpy(res,r,sizeof(sleftv));
3087 return FALSE;
3088}

◆ jjREDUCE3_CID()

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

Definition at line 7040 of file iparith.cc.

7041{
7043 if (!idIsZeroDim((ideal)v->Data()))
7044 {
7045 Werror("`%s` must be 0-dimensional",v->Name());
7046 return TRUE;
7047 }
7048 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7049 (matrix)w->CopyD());
7050 return FALSE;
7051}
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:177
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:2319

◆ jjREDUCE3_CP()

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

Definition at line 7028 of file iparith.cc.

7029{
7031 if (!idIsZeroDim((ideal)v->Data()))
7032 {
7033 Werror("`%s` must be 0-dimensional",v->Name());
7034 return TRUE;
7035 }
7036 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
7037 (poly)w->CopyD());
7038 return FALSE;
7039}

◆ jjREDUCE3_ID()

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

Definition at line 7059 of file iparith.cc.

7060{
7062 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
7063 0,(int)(long)w->Data());
7064 return FALSE;
7065}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3186

◆ jjREDUCE3_P()

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

Definition at line 7052 of file iparith.cc.

7053{
7055 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
7056 0,(int)(long)w->Data());
7057 return FALSE;
7058}

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8156 of file iparith.cc.

8157{
8158 leftv u1=u;
8159 leftv u2=u1->next;
8160 leftv u3=u2->next;
8161 leftv u4=u3->next;
8162 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8163 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8164 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8165 {
8166 int save_d=Kstd1_deg;
8167 Kstd1_deg=(int)(long)u3->Data();
8168 kModW=(intvec *)u4->Data();
8169 BITSET save2;
8170 SI_SAVE_OPT2(save2);
8172 u2->next=NULL;
8173 BOOLEAN r=jjCALL2ARG(res,u);
8174 kModW=NULL;
8175 Kstd1_deg=save_d;
8176 SI_RESTORE_OPT2(save2);
8177 u->next->next=u3;
8178 return r;
8179 }
8180 else
8181 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8182 (u4->Typ()==INT_CMD))
8183 {
8184 assumeStdFlag(u3);
8185 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8186 {
8187 WerrorS("2nd argument must be a diagonal matrix of units");
8188 return TRUE;
8189 }
8190 res->data=(char*)redNF(
8191 idCopy((ideal)u3->Data()),
8192 idCopy((ideal)u1->Data()),
8193 mp_Copy((matrix)u2->Data(), currRing),
8194 (int)(long)u4->Data()
8195 );
8196 return FALSE;
8197 }
8198 else
8199 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8200 (u4->Typ()==INT_CMD))
8201 {
8202 poly u1p;
8203 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8204 else u1p=(poly)u1->Data();
8205 poly u2p;
8206 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8207 else u2p=(poly)u2->Data();
8208 assumeStdFlag(u3);
8209 if(!pIsUnit(u2p))
8210 {
8211 WerrorS("2nd argument must be a unit");
8212 return TRUE;
8213 }
8214 res->rtyp=POLY_CMD;
8215 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8216 pCopy(u2p),(int)(long)u4->Data());
8217 return FALSE;
8218 }
8219 else
8220 {
8221 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8222 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8223 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8224 return TRUE;
8225 }
8226}
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:7192
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 Sy_bit(x)
Definition: options.h:31
#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 8227 of file iparith.cc.

8228{
8229 leftv u1=u;
8230 leftv u2=u1->next;
8231 leftv u3=u2->next;
8232 leftv u4=u3->next;
8233 leftv u5=u4->next;
8234 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8235 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8236 {
8237 assumeStdFlag(u3);
8238 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8239 {
8240 WerrorS("2nd argument must be a diagonal matrix of units");
8241 return TRUE;
8242 }
8243 res->data=(char*)redNF(
8244 idCopy((ideal)u3->Data()),
8245 idCopy((ideal)u1->Data()),
8246 mp_Copy((matrix)u2->Data(),currRing),
8247 (int)(long)u4->Data(),
8248 (intvec*)u5->Data()
8249 );
8250 return FALSE;
8251 }
8252 else
8253 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8254 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8255 {
8256 assumeStdFlag(u3);
8257 if(!pIsUnit((poly)u2->Data()))
8258 {
8259 WerrorS("2nd argument must be a unit");
8260 return TRUE;
8261 }
8262 res->rtyp=POLY_CMD;
8263 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8264 pCopy((poly)u2->Data()),
8265 (int)(long)u4->Data(),(intvec*)u5->Data());
8266 return FALSE;
8267 }
8268 else
8269 {
8270 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8271 Tok2Cmdname(iiOp));
8272 return TRUE;
8273 }
8274}

◆ jjREDUCE_ID()

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

Definition at line 3097 of file iparith.cc.

3098{
3099 ideal ui=(ideal)u->Data();
3100 ideal vi=(ideal)v->Data();
3101 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3103 res->data = (char *)kNF(vi,currRing->qideal,ui);
3104 return FALSE;
3105}

◆ jjREDUCE_P()

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

Definition at line 3089 of file iparith.cc.

3090{
3091 ideal vi=(ideal)v->Data();
3092 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3094 res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3095 return FALSE;
3096}

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4908 of file iparith.cc.

4909{
4910 res->data = (char *)(long)iiRegularity((lists)v->Data());
4911 return FALSE;
4912}
int iiRegularity(lists L)
Definition: ipshell.cc:1038

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4913 of file iparith.cc.

4914{
4915 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4916 return FALSE;
4917}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition: coeffs.h:787

◆ jjRES()

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

Definition at line 3106 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 7067 of file iparith.cc.

7068{
7069 int maxl=(int)v->Data();
7070 ideal u_id=(ideal)u->Data();
7071 int l=0;
7072 resolvente r;
7073 intvec **weights=NULL;
7074 int wmaxl=maxl;
7075 maxl--;
7076 unsigned save_opt=si_opt_1;
7078 if ((maxl==-1) && (iiOp!=MRES_CMD))
7079 maxl = currRing->N-1;
7080 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7081 {
7082 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7083 if (iv!=NULL)
7084 {
7085 l=1;
7086 if (!idTestHomModule(u_id,currRing->qideal,iv))
7087 {
7088 WarnS("wrong weights");
7089 iv=NULL;
7090 }
7091 else
7092 {
7093 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7094 weights[0] = ivCopy(iv);
7095 }
7096 }
7097 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7098 }
7099 else
7100 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7101 if (r==NULL) return TRUE;
7102 int t3=u->Typ();
7103 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7104 si_opt_1=save_opt;
7105 return FALSE;
7106}
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:847
EXTERN_VAR omBin char_ptr_bin
Definition: structs.h:77
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:389
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:855

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 8275 of file iparith.cc.

8276{
8277 unsigned i=1;
8278 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8279 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8280 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8281 // sArithBase.nCmdAllocated);
8282 for(i=0; i<nCount; i++)
8283 {
8284 Print("%-20s",sArithBase.sCmds[i+1].name);
8285 if(i+1+nCount<sArithBase.nCmdUsed)
8286 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8287 if(i+1+2*nCount<sArithBase.nCmdUsed)
8288 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8289 //if ((i%3)==1) PrintLn();
8290 PrintLn();
8291 }
8292 PrintLn();
8294 return FALSE;
8295}
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:236

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8297 of file iparith.cc.

8298{
8299 int l = 0;
8300 int k = 0;
8302 struct blackbox_list *bb_list = NULL;
8303 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8304
8305 if ((3*nCount) < sArithBase.nCmdUsed)
8306 {
8307 nCount++;
8308 }
8309 bb_list = getBlackboxTypes();
8310 // count the number of entries;
8311 for (unsigned i=0; i<nCount; i++)
8312 {
8313 l++;
8314 if (i + 1 + nCount < sArithBase.nCmdUsed)
8315 {
8316 l++;
8317 }
8318 if(i+1+2*nCount<sArithBase.nCmdUsed)
8319 {
8320 l++;
8321 }
8322 }
8323 for (int i = 0; i < bb_list->count; i++)
8324 {
8325 if (bb_list->list[i] != NULL)
8326 {
8327 l++;
8328 }
8329 }
8330 // initiate list
8331 L->Init(l);
8332 k = 0;
8333 for (unsigned i=0; i<nCount; i++)
8334 {
8335 L->m[k].rtyp = STRING_CMD;
8336 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8337 k++;
8338 // Print("%-20s", sArithBase.sCmds[i+1].name);
8339 if (i + 1 + nCount < sArithBase.nCmdUsed)
8340 {
8341 L->m[k].rtyp = STRING_CMD;
8342 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8343 k++;
8344 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8345 }
8346 if(i+1+2*nCount<sArithBase.nCmdUsed)
8347 {
8348 L->m[k].rtyp = STRING_CMD;
8349 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8350 k++;
8351 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8352 }
8353 // PrintLn();
8354 }
8355
8356 // assign blackbox types
8357 for (int i = 0; i < bb_list->count; i++)
8358 {
8359 if (bb_list->list[i] != NULL)
8360 {
8361 L->m[k].rtyp = STRING_CMD;
8362 // already used strdup in getBlackBoxTypes
8363 L->m[k].data = bb_list->list[i];
8364 k++;
8365 }
8366 }
8367 // free the struct (not the list entries itself, which were allocated
8368 // by strdup)
8369 omfree(bb_list->list);
8370 omfree(bb_list);
8371
8372 // pass the resultant list to the res datastructure
8373 res->data=(void *)L;
8374
8375 return FALSE;
8376}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition: blackbox.cc:245
void ** list
Definition: blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition: blackbox.h:84
#define omfree(addr)
Definition: omAllocDecl.h:237

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4875 of file iparith.cc.

4876{
4877 char *s= (char *)v->Data();
4878 // try system keywords
4879 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4880 {
4881 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4882 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4883 {
4884 res->data = (char *)1;
4885 return FALSE;
4886 }
4887 }
4888 // try blackbox names
4889 int id;
4890 blackboxIsCmd(s,id);
4891 if (id>0)
4892 {
4893 res->data = (char *)1;
4894 }
4895 return FALSE;
4896}

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8749 of file iparith.cc.

8750{
8751 int c=(int)(long)u->Data();
8752 switch(c)
8753 {
8754 case 0:{
8755 PrintS("delete all variables\n");
8756 killlocals(0);
8757 WerrorS("restarting...");
8758 break;
8759 };
8760 default: WerrorS("not implemented");
8761 }
8762 return FALSE;
8763}
void killlocals(int v)
Definition: ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5292 of file iparith.cc.

5293{
5294#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5295 if (rIsLPRing(currRing))
5296 {
5298 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5299 ideal result;
5300 ideal v_id=(ideal)v->Data();
5301 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5302 /* tHomog hom=testHomog; */
5303 /* if (w!=NULL) */
5304 /* { */
5305 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5306 /* { */
5307 /* WarnS("wrong weights"); */
5308 /* w=NULL; */
5309 /* } */
5310 /* else */
5311 /* { */
5312 /* hom=isHomog; */
5313 /* w=ivCopy(w); */
5314 /* } */
5315 /* } */
5316 /* result=kStd(v_id,currRing->qideal,hom,&w); */
5317 result = rightgb(v_id, currRing->qideal);
5319 res->data = (char *)result;
5321 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5322 return FALSE;
5323 }
5324 else if (rIsPluralRing(currRing))
5325 {
5326 ideal I=(ideal)v->Data();
5327
5328 ring A = currRing;
5329 ring Aopp = rOpposite(A);
5330 currRing = Aopp;
5331 ideal Iopp = idOppose(A, I, Aopp);
5332 ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
5333 currRing = A;
5334 ideal J = idOppose(Aopp, Jopp, A);
5335
5336 id_Delete(&Iopp, Aopp);
5337 id_Delete(&Jopp, Aopp);
5338 rDelete(Aopp);
5339
5340 idSkipZeroes(J);
5341 res->data = (char *)J;
5343 return FALSE;
5344 }
5345 else
5346 {
5347 return jjSTD(res, v);
5348 }
5349#else
5350 return TRUE;
5351#endif
5352}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition: iparith.cc:5093
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:2449
ideal rightgb(ideal F, const ideal Q)
Definition: kstd2.cc:4965
#define TEST_OPT_DEGBOUND
Definition: options.h:113
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:515

◆ jjRING3()

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

Definition at line 7108 of file iparith.cc.

7109{
7110 res->data=(void *)rInit(u,v,w);
7111 return (res->data==NULL);
7112}
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 1673 of file iparith.cc.

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

◆ jjRING_2()

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

Definition at line 6004 of file iparith.cc.

6005{
6006 u->next=(leftv)omAlloc(sizeof(sleftv));
6007 memcpy(u->next,v,sizeof(sleftv));
6008 v->Init();
6009 u->next->next=(leftv)omAlloc(sizeof(sleftv));
6010 memcpy(u->next->next,w,sizeof(sleftv));
6011 w->Init();
6012 BOOLEAN bo=iiExprArithM(res,u,'[');
6013 u->next=NULL;
6014 return bo;
6015}

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4940 of file iparith.cc.

4941{
4942 ring r=(ring)v->Data();
4943 if (r!=NULL)
4944 res->data = (char *)rDecompose_list_cf((ring)v->Data());
4945 return (r==NULL)||(res->data==NULL);
4946}
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 8720 of file iparith.cc.

8721{
8722 //Print("construct ring\n");
8723 if (a->Typ()!=CRING_CMD)
8724 {
8725 WerrorS("expected `cring` [ `id` ... ]");
8726 return TRUE;
8727 }
8728 assume(a->next!=NULL);
8729 leftv names=a->next;
8730 int N=names->listLength();
8731 char **n=(char**)omAlloc0(N*sizeof(char*));
8732 for(int i=0; i<N;i++,names=names->next)
8733 {
8734 n[i]=(char *)names->Name();
8735 }
8736 coeffs cf=(coeffs)a->CopyD();
8737 res->data=rDefault(cf,N,n, ringorder_dp);
8738 omFreeSize(n,N*sizeof(char*));
8739 return FALSE;
8740}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102
@ ringorder_dp
Definition: ring.h:78
@ CRING_CMD
Definition: tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4918 of file iparith.cc.

4919{
4920 ring r=(ring)v->Data();
4921 if (r!=NULL)
4922 {
4923 res->data = (char *)rDecompose((ring)v->Data());
4924 if (res->data!=NULL)
4925 {
4926 long mm=r->wanted_maxExp;
4927 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4928 return FALSE;
4929 }
4930 }
4931 return TRUE;
4932}
lists rDecompose(const ring r)
Definition: ipshell.cc:2162

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4933 of file iparith.cc.

4934{
4935 coeffs r=(coeffs)v->Data();
4936 if (r!=NULL)
4937 return rDecompose_CF(res,r);
4938 return TRUE;
4939}
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 3261 of file iparith.cc.

3262{
3263 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3264 res->data = (char *)r;
3265 return r==NULL;
3266}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition: ring.cc:5937

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5672 of file iparith.cc.

5673{
5674 res->data = rOrdStr((ring)v->Data());
5675 return FALSE;
5676}
char * rOrdStr(ring r)
Definition: ring.cc:521

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4947 of file iparith.cc.

4948{
4949 ideal i = (ideal)v->Data();
4950 res->data = (char *)i->rank;
4951 return FALSE;
4952}

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4953 of file iparith.cc.

4954{
4955 res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
4956 return FALSE;
4957}

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4958 of file iparith.cc.

4959{
4960 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
4961 return FALSE;
4962}

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4963 of file iparith.cc.

4964{
4965 res->data = (char *)(long)rPar(((ring)v->Data()));
4966 return FALSE;
4967}

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5682 of file iparith.cc.

5683{
5684 res->data = rParStr((ring)v->Data());
5685 return FALSE;
5686}
char * rParStr(ring r)
Definition: ring.cc:649

◆ jjRPLUS()

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

Definition at line 3267 of file iparith.cc.

3268{
3269 int left;
3270 if (u->Typ()==RING_CMD) left=0;
3271 else
3272 {
3273 leftv h=u;u=v;v=h;
3274 left=1;
3275 }
3276 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3277 res->data = (char *)r;
3278 return r==NULL;
3279}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5855

◆ jjRSUM()

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

Definition at line 3280 of file iparith.cc.

3281{
3282 ring r;
3283 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3284 res->data = (char *)r;
3285 return (i==-1);
3286}
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1402

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5677 of file iparith.cc.

5678{
5679 res->data = rVarStr((ring)v->Data());
5680 return FALSE;
5681}
char * rVarStr(ring r)
Definition: ring.cc:623

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 4968 of file iparith.cc.

4969{
4970 res->data = (char *)(long)atoi((char*)v->Data());
4971 return FALSE;
4972}

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 5015 of file iparith.cc.

5016{
5017 ideal result;
5018 ideal v_id=(ideal)v->Data();
5019 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5020 tHomog hom=testHomog;
5021 if (w!=NULL)
5022 {
5023 if (!idTestHomModule(v_id,currRing->qideal,w))
5024 {
5025 WarnS("wrong weights");
5026 w=NULL;
5027 }
5028 else
5029 {
5030 hom=isHomog;
5031 w=ivCopy(w);
5032 }
5033 }
5034 result=kSba(v_id,currRing->qideal,hom,&w,1,0);
5036 res->data = (char *)result;
5038 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5039 return FALSE;
5040}
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:2634

◆ jjSBA_1()

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

Definition at line 5041 of file iparith.cc.

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

◆ jjSBA_2()

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

Definition at line 5067 of file iparith.cc.

5068{
5069 ideal result;
5070 ideal v_id=(ideal)v->Data();
5071 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5072 tHomog hom=testHomog;
5073 if (w!=NULL)
5074 {
5075 if (!idTestHomModule(v_id,currRing->qideal,w))
5076 {
5077 WarnS("wrong weights");
5078 w=NULL;
5079 }
5080 else
5081 {
5082 hom=isHomog;
5083 w=ivCopy(w);
5084 }
5085 }
5086 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
5088 res->data = (char *)result;
5090 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5091 return FALSE;
5092}

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3789 of file iparith.cc.

3790{
3791 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3792 else
3793 {
3794 ring r=(ring)u->Data();
3795 idhdl h=rFindHdl(r,NULL);
3796 if (h==NULL)
3797 {
3798 char name_buffer[100];
3799 STATIC_VAR int ending=1000000;
3800 ending++;
3801 snprintf(name_buffer,100, "PYTHON_RING_VAR%d",ending);
3802 h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3803 IDRING(h)=rIncRefCnt(r);
3804 }
3805 rSetHdl(h);
3806 }
3807 return FALSE;
3808}
#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 3294 of file iparith.cc.

3295{
3296 int sw = (int)(long)v->Data();
3297 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3298 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3299 if (sw & SIMPL_LMDIV)
3300 {
3301 id_DelDiv(id,currRing);
3302 }
3303 if (sw & SIMPL_LMEQ)
3304 {
3306 }
3307 if (sw & SIMPL_MULT)
3308 {
3310 }
3311 else if(sw & SIMPL_EQU)
3312 {
3314 }
3315 if (sw & SIMPL_NULL)
3316 {
3317 idSkipZeroes(id);
3318 }
3319 if (sw & SIMPL_NORM)
3320 {
3321 id_Norm(id,currRing);
3322 }
3323 if (sw & SIMPL_NORMALIZE)
3324 {
3326 }
3327 res->data = (char * )id;
3328 return FALSE;
3329}
#define SIMPL_EQU
Definition: iparith.cc:3291
#define SIMPL_NORM
Definition: iparith.cc:3293
#define SIMPL_LMEQ
Definition: iparith.cc:3289
#define SIMPL_NULL
Definition: iparith.cc:3292
#define SIMPL_MULT
Definition: iparith.cc:3290
#define SIMPL_NORMALIZE
Definition: iparith.cc:3287
#define SIMPL_LMDIV
Definition: iparith.cc:3288
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 3389 of file iparith.cc.

3390{
3391 int sw = (int)(long)v->Data();
3392 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3393 poly p = (poly)u->CopyD(POLY_CMD);
3394 if (sw & SIMPL_NORM)
3395 {
3396 pNorm(p);
3397 }
3398 if (sw & SIMPL_NORMALIZE)
3399 {
3401 }
3402 res->data = (char * )p;
3403 return FALSE;
3404}
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3813
void pNorm(poly p)
Definition: polys.h:362

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4973 of file iparith.cc.

4974{
4975 const bool bIsSCA = rIsSCA(currRing);
4976
4977 if ((currRing->qideal!=NULL) && !bIsSCA)
4978 {
4979 WerrorS("qring not supported by slimgb at the moment");
4980 return TRUE;
4981 }
4983 {
4984 WerrorS("ordering must be global for slimgb");
4985 return TRUE;
4986 }
4988 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4989 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4990 // tHomog hom=testHomog;
4991 ideal u_id=(ideal)u->Data();
4992 if (w!=NULL)
4993 {
4994 if (!idTestHomModule(u_id,currRing->qideal,w))
4995 {
4996 WarnS("wrong weights");
4997 w=NULL;
4998 }
4999 else
5000 {
5001 w=ivCopy(w);
5002 // hom=isHomog;
5003 }
5004 }
5005
5006 assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
5007 res->data=(char *)t_rep_gb(currRing,
5008 u_id,u_id->rank);
5009 //res->data=(char *)t_rep_gb(currRing, u_id);
5010
5012 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5013 return FALSE;
5014}
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 6948 of file iparith.cc.

6949{
6950 int mi=(int)(long)v->Data();
6951 int ni=(int)(long)w->Data();
6952 if ((mi<0)||(ni<1))
6953 {
6954 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6955 return TRUE;
6956 }
6957 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6958 mi,ni,currRing);
6959 return FALSE;
6960}
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 5121 of file iparith.cc.

5122{
5123 res->data = (char *)idSort((ideal)v->Data());
5124 return FALSE;
5125}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:185

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10257 of file iparith.cc.

10258{
10259 lists l=(lists)arg->Data();
10260 if (l->nr>0)
10261 {
10262 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10263 }
10264 return FALSE;
10265}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:10216

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5126 of file iparith.cc.

5127{
5129 intvec *v=NULL;
5130 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5131 if (f==NULL) return TRUE;
5132 ivTest(v);
5134 l->Init(2);
5135 l->m[0].rtyp=IDEAL_CMD;
5136 l->m[0].data=(void *)f;
5137 l->m[1].rtyp=INTVEC_CMD;
5138 l->m[1].data=(void *)v;
5139 res->data=(void *)l;
5140 return FALSE;
5141}
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 3331 of file iparith.cc.

3332{
3333 intvec *v=NULL;
3334 int sw=(int)(long)dummy->Data();
3335 int fac_sw=sw;
3336 if (sw<0) fac_sw=1;
3338 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3339 if (f==NULL)
3340 return TRUE;
3341 switch(sw)
3342 {
3343 case 0:
3344 case 2:
3345 {
3347 l->Init(2);
3348 l->m[0].rtyp=IDEAL_CMD;
3349 l->m[0].data=(void *)f;
3350 l->m[1].rtyp=INTVEC_CMD;
3351 l->m[1].data=(void *)v;
3352 res->data=(void *)l;
3353 res->rtyp=LIST_CMD;
3354 return FALSE;
3355 }
3356 case 1:
3357 res->data=(void *)f;
3358 return FALSE;
3359 case 3:
3360 {
3361 poly p=f->m[0];
3362 int i=IDELEMS(f);
3363 f->m[0]=NULL;
3364 while(i>1)
3365 {
3366 i--;
3367 p=pMult(p,f->m[i]);
3368 f->m[i]=NULL;
3369 }
3370 res->data=(void *)p;
3371 res->rtyp=POLY_CMD;
3372 }
3373 return FALSE;
3374 }
3375 WerrorS("invalid switch");
3376 return FALSE;
3377}

◆ jjSTATUS2()

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

Definition at line 3378 of file iparith.cc.

3379{
3380 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3381 return FALSE;
3382}

◆ jjSTATUS2L()

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

Definition at line 3383 of file iparith.cc.

3384{
3385 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3386 //return (res->data== (void*)(long)-2);
3387 return FALSE;
3388}

◆ jjSTATUS3()

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

Definition at line 7113 of file iparith.cc.

7114{
7115 int yes;
7116 jjSTATUS2(res, u, v);
7117 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7118 omFreeBinAddr((ADDRESS) res->data);
7119 res->data = (void *)(long)yes;
7120 return FALSE;
7121}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3378

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8562 of file iparith.cc.

8563{
8564 if ((v->Typ() != LINK_CMD) ||
8565 (v->next->Typ() != STRING_CMD) ||
8566 (v->next->next->Typ() != STRING_CMD) ||
8567 (v->next->next->next->Typ() != INT_CMD))
8568 return TRUE;
8569 jjSTATUS3(res, v, v->next, v->next->next);
8570#if defined(HAVE_USLEEP)
8571 if (((long) res->data) == 0L)
8572 {
8573 int i_s = (int)(long) v->next->next->next->Data();
8574 if (i_s > 0)
8575 {
8576 usleep((int)(long) v->next->next->next->Data());
8577 jjSTATUS3(res, v, v->next, v->next->next);
8578 }
8579 }
8580#elif defined(HAVE_SLEEP)
8581 if (((int) res->data) == 0)
8582 {
8583 int i_s = (int) v->next->next->next->Data();
8584 if (i_s > 0)
8585 {
8586 si_sleep((is - 1)/1000000 + 1);
8587 jjSTATUS3(res, v, v->next, v->next->next);
8588 }
8589 }
8590#endif
8591 return FALSE;
8592}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:7113
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5093 of file iparith.cc.

5094{
5096 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5097 ideal result;
5098 ideal v_id=(ideal)v->Data();
5099 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5100 tHomog hom=testHomog;
5101 if (w!=NULL)
5102 {
5103 if (!idTestHomModule(v_id,currRing->qideal,w))
5104 {
5105 WarnS("wrong weights");
5106 w=NULL;
5107 }
5108 else
5109 {
5110 hom=isHomog;
5111 w=ivCopy(w);
5112 }
5113 }
5114 result=kStd(v_id,currRing->qideal,hom,&w);
5116 res->data = (char *)result;
5118 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5119 return FALSE;
5120}

◆ jjSTD_1()

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

Definition at line 3431 of file iparith.cc.

3432{
3433 ideal result;
3434 assumeStdFlag(u);
3435 ideal i1=(ideal)(u->Data());
3436 int ii1=idElem(i1); /* size of i1 */
3437 ideal i0;
3438 int r=v->Typ();
3439 if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3440 {
3441 poly p=(poly)v->Data();
3442 i0=idInit(1,i1->rank);
3443 i0->m[0]=p;
3444 i1=idSimpleAdd(i1,i0); //
3445 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3446 idDelete(&i0);
3447 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3448 tHomog hom=testHomog;
3449
3450 if (w!=NULL)
3451 {
3452 if (!idTestHomModule(i1,currRing->qideal,w))
3453 {
3454 // no warnung: this is legal, if i in std(i,p)
3455 // is homogeneous, but p not
3456 w=NULL;
3457 }
3458 else
3459 {
3460 w=ivCopy(w);
3461 hom=isHomog;
3462 }
3463 }
3464 BITSET save1;
3465 SI_SAVE_OPT1(save1);
3467 /* ii1 appears to be the position of the first element of il that
3468 does not belong to the old SB ideal */
3469 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3470 SI_RESTORE_OPT1(save1);
3471 idDelete(&i1);
3473 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3474 res->data = (char *)result;
3475 }
3476 else /*IDEAL/MODULE*/
3477 {
3478 i0=(ideal)v->CopyD();
3479 i1=idSimpleAdd(i1,i0); //
3480 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3481 idDelete(&i0);
3482 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3483 tHomog hom=testHomog;
3484
3485 if (w!=NULL)
3486 {
3487 if (!idTestHomModule(i1,currRing->qideal,w))
3488 {
3489 // no warnung: this is legal, if i in std(i,p)
3490 // is homogeneous, but p not
3491 w=NULL;
3492 hom=isNotHomog;
3493 }
3494 else
3495 {
3496 w=ivCopy(w);
3497 hom=isHomog;
3498 }
3499 }
3500 BITSET save1;
3501 SI_SAVE_OPT1(save1);
3503 /* ii1 appears to be the position of the first element of i1 that
3504 does not belong to the old SB ideal */
3505 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3506 SI_RESTORE_OPT1(save1);
3507 idDelete(&i1);
3509 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3510 res->data = (char *)result;
3511 }
3513 return FALSE;
3514}
#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 3405 of file iparith.cc.

3406{
3407 ideal result;
3408 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3409 tHomog hom=testHomog;
3410 ideal u_id=(ideal)(u->Data());
3411 if (w!=NULL)
3412 {
3413 if (!idTestHomModule(u_id,currRing->qideal,w))
3414 {
3415 WarnS("wrong weights:");w->show();PrintLn();
3416 w=NULL;
3417 }
3418 else
3419 {
3420 w=ivCopy(w);
3421 hom=isHomog;
3422 }
3423 }
3424 result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3426 res->data = (char *)result;
3428 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3429 return FALSE;
3430}

◆ jjSTD_HILB_W()

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

Definition at line 7122 of file iparith.cc.

7123{
7124 intvec *vw=(intvec *)w->Data(); // weights of vars
7125 if (vw->length()!=currRing->N)
7126 {
7127 Werror("%d weights for %d variables",vw->length(),currRing->N);
7128 return TRUE;
7129 }
7130 ideal result;
7131 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7132 tHomog hom=testHomog;
7133 ideal u_id=(ideal)(u->Data());
7134 if (ww!=NULL)
7135 {
7136 if (!idTestHomModule(u_id,currRing->qideal,ww))
7137 {
7138 WarnS("wrong weights");
7139 ww=NULL;
7140 }
7141 else
7142 {
7143 ww=ivCopy(ww);
7144 hom=isHomog;
7145 }
7146 }
7147 result=kStd(u_id,
7148 currRing->qideal,
7149 hom,
7150 &ww, // module weights
7151 (intvec *)v->Data(), // hilbert series
7152 0,0, // syzComp, newIdeal
7153 vw); // weights of vars
7155 res->data = (char *)result;
7157 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7158 return FALSE;
7159}

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8637 of file iparith.cc.

8638{ ideal result;
8639 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8640 leftv v = u->next; /* one additional polynomial or ideal */
8641 leftv h = v->next; /* Hilbert vector */
8642 leftv w = h->next; /* weight vector */
8643 assumeStdFlag(u);
8644 ideal i1=(ideal)(u->Data());
8645 ideal i0;
8646 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8647 || (h->Typ()!=INTVEC_CMD)
8648 || (w->Typ()!=INTVEC_CMD))
8649 {
8650 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8651 return TRUE;
8652 }
8653 intvec *vw=(intvec *)w->Data(); // weights of vars
8654 /* merging std_hilb_w and std_1 */
8655 if (vw->length()!=currRing->N)
8656 {
8657 Werror("%d weights for %d variables",vw->length(),currRing->N);
8658 return TRUE;
8659 }
8660 int r=v->Typ();
8661 BOOLEAN cleanup_i0=FALSE;
8662 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8663 {
8664 i0=idInit(1,i1->rank);
8665 i0->m[0]=(poly)v->Data();
8666 cleanup_i0=TRUE;
8667 }
8668 else if (r==IDEAL_CMD)/* IDEAL */
8669 {
8670 i0=(ideal)v->Data();
8671 }
8672 else
8673 {
8674 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8675 return TRUE;
8676 }
8677 int ii0=idElem(i0);
8678 i1 = idSimpleAdd(i1,i0);
8679 if (cleanup_i0)
8680 {
8681 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8682 idDelete(&i0);
8683 }
8684 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8685 tHomog hom=testHomog;
8686 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8687 if (ww!=NULL)
8688 {
8689 if (!idTestHomModule(i1,currRing->qideal,ww))
8690 {
8691 WarnS("wrong weights");
8692 ww=NULL;
8693 }
8694 else
8695 {
8696 ww=ivCopy(ww);
8697 hom=isHomog;
8698 }
8699 }
8700 BITSET save1;
8701 SI_SAVE_OPT1(save1);
8703 result=kStd(i1,
8704 currRing->qideal,
8705 hom,
8706 &ww, // module weights
8707 (intvec *)h->Data(), // hilbert series
8708 0, // syzComp, whatever it is...
8709 IDELEMS(i1)-ii0, // new ideal
8710 vw); // weights of vars
8711 SI_RESTORE_OPT1(save1);
8712 idDelete(&i1);
8714 res->data = (char *)result;
8716 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8717 return FALSE;
8718}

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8377 of file iparith.cc.

8378{
8379 if (v == NULL)
8380 {
8381 res->data = omStrDup("");
8382 return FALSE;
8383 }
8384 int n = v->listLength();
8385 if (n == 1)
8386 {
8387 res->data = v->String();
8388 return FALSE;
8389 }
8390
8391 char** slist = (char**) omAlloc(n*sizeof(char*));
8392 int i, j;
8393
8394 for (i=0, j=0; i<n; i++, v = v ->next)
8395 {
8396 slist[i] = v->String();
8397 assume(slist[i] != NULL);
8398 j+=strlen(slist[i]);
8399 }
8400 char* s = (char*) omAlloc((j+1)*sizeof(char));
8401 *s='\0';
8402 for (i=0;i<n;i++)
8403 {
8404 strcat(s, slist[i]);
8405 omFree(slist[i]);
8406 }
8407 omFreeSize(slist, n*sizeof(char*));
8408 res->data = s;
8409 return FALSE;
8410}

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5604 of file iparith.cc.

5605{
5606 res->data = (char *)strlen((char *)v->Data());
5607 return FALSE;
5608}

◆ jjSUBST_Bu()

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

Definition at line 6670 of file iparith.cc.

6671{
6672 // generic conversion from polyBucket to poly:
6673 // force this to be the first try everytime
6674 poly p; int l;
6675 sBucket_pt bu=(sBucket_pt)w->CopyD();
6676 sBucketDestroyAdd(bu,&p,&l);
6677 sleftv tmpw;
6678 tmpw.Init();
6679 tmpw.rtyp=POLY_CMD;
6680 tmpw.data=p;
6681 return iiExprArith3(res, iiOp, u, v, &tmpw);
6682}

◆ jjSUBST_Id()

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

Definition at line 6716 of file iparith.cc.

6717{
6718 int ringvar;
6719 poly monomexpr;
6720 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6721 if (nok) return TRUE;
6722 ideal id=(ideal)u->Data();
6723 if (ringvar>0)
6724 {
6725 BOOLEAN overflow=FALSE;
6726 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6727 {
6728 long deg_monexp=pTotaldegree(monomexpr);
6729 for(int i=IDELEMS(id)-1;i>=0;i--)
6730 {
6731 poly p=id->m[i];
6732 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6733 if ((p!=NULL) && (mm!=0) &&
6734 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6735 {
6736 overflow=TRUE;
6737 break;
6738 }
6739 }
6740 }
6741 if (overflow)
6742 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6743 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6744 {
6745 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6746 else id=id_Copy(id,currRing);
6747 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6748 }
6749 else
6750 res->data = idSubstPoly(id,ringvar,monomexpr);
6751 }
6752 else
6753 {
6754 if (rIsLPRing(currRing))
6755 {
6756 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6757 return TRUE;
6758 }
6759 res->data = idSubstPar(id,-ringvar,monomexpr);
6760 }
6761 return FALSE;
6762}
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:6642
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:426
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:387
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition: p_polys.cc:4992
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 6766 of file iparith.cc.

6767{
6768 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6769}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6774

◆ jjSUBST_Id_N()

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

Definition at line 6770 of file iparith.cc.

6771{
6772 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6773}

◆ jjSUBST_Id_X()

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

Definition at line 6774 of file iparith.cc.

6775{
6776 sleftv tmp;
6777 tmp.Init();
6778 // do not check the result, conversion from int/number to poly works always
6779 iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6780 BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6781 tmp.CleanUp();
6782 return b;
6783}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6716

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8593 of file iparith.cc.

8594{
8595 leftv v = u->next; // number of args > 0
8596 if (v==NULL) return TRUE;
8597 leftv w = v->next;
8598 if (w==NULL) return TRUE;
8599 leftv rest = w->next;
8600
8601 u->next = NULL;
8602 v->next = NULL;
8603 w->next = NULL;
8604 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8605 if ((rest!=NULL) && (!b))
8606 {
8607 leftv tmp_next=res->next;
8608 res->next=rest;
8609 sleftv tmp_res;
8610 tmp_res.Init();
8611 b = iiExprArithM(&tmp_res,res,iiOp);
8612 memcpy(res,&tmp_res,sizeof(tmp_res));
8613 res->next=tmp_next;
8614 }
8615 u->next = v;
8616 v->next = w;
8617 // rest was w->next, but is already cleaned
8618 return b;
8619}

◆ jjSUBST_P()

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

Definition at line 6683 of file iparith.cc.

6684{
6685 int ringvar;
6686 poly monomexpr;
6687 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6688 if (nok) return TRUE;
6689 poly p=(poly)u->Data();
6690 if (ringvar>0)
6691 {
6692 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6693 if (!rIsLPRing(currRing) &&
6694 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6695 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6696 {
6697 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6698 //return TRUE;
6699 }
6700 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6701 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6702 else
6703 res->data= pSubstPoly(p,ringvar,monomexpr);
6704 }
6705 else
6706 {
6707 if (rIsLPRing(currRing))
6708 {
6709 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6710 return TRUE;
6711 }
6712 res->data=pSubstPar(p,-ringvar,monomexpr);
6713 }
6714 return FALSE;
6715}
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:404
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:267

◆ jjSUBST_Test()

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

Definition at line 6642 of file iparith.cc.

6644{
6645 monomexpr=(poly)w->Data();
6646 poly p=(poly)v->Data();
6647#if 0
6648 if (pLength(monomexpr)>1)
6649 {
6650 Werror("`%s` substitutes a ringvar only by a term",
6652 return TRUE;
6653 }
6654#endif
6655 if ((ringvar=pVar(p))==0)
6656 {
6657 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6658 {
6659 number n = pGetCoeff(p);
6660 ringvar= -n_IsParam(n, currRing);
6661 }
6662 if(ringvar==0)
6663 {
6664 WerrorS("ringvar/par expected");
6665 return TRUE;
6666 }
6667 }
6668 return FALSE;
6669}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5834
@ SUBST_CMD
Definition: tok.h:186

◆ jjSYZ_2()

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

Definition at line 3515 of file iparith.cc.

3516{
3517 // see jjSYZYGY
3518 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3519 intvec *w=NULL;
3520 tHomog hom=testHomog;
3521 ideal I=(ideal)u->Data();
3522 GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3523 if (ww!=NULL)
3524 {
3525 if (idTestHomModule(I,currRing->qideal,ww))
3526 {
3527 w=ivCopy(ww);
3528 int add_row_shift=w->min_in();
3529 (*w)-=add_row_shift;
3530 hom=isHomog;
3531 }
3532 else
3533 {
3534 //WarnS("wrong weights");
3535 delete ww; ww=NULL;
3536 hom=testHomog;
3537 }
3538 }
3539 else
3540 {
3541 if (u->Typ()==IDEAL_CMD)
3542 if (idHomIdeal(I,currRing->qideal))
3543 hom=isHomog;
3544 }
3545 ideal S=idSyzygies(I,hom,&w,TRUE,FALSE,NULL,alg);
3546 if (w!=NULL) delete w;
3547 res->data = (char *)S;
3548 if (hom==isHomog)
3549 {
3550 int vl=S->rank;
3551 intvec *vv=new intvec(vl);
3552 if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3553 {
3554 for(int i=0;i<vl;i++)
3555 {
3556 if (I->m[i]!=NULL)
3557 (*vv)[i]=p_Deg(I->m[i],currRing);
3558 }
3559 }
3560 else
3561 {
3562 p_SetModDeg(ww, currRing);
3563 for(int i=0;i<vl;i++)
3564 {
3565 if (I->m[i]!=NULL)
3566 (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3567 }
3569 }
3570 if (idTestHomModule(S,currRing->qideal,vv))
3571 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3572 else
3573 delete vv;
3574 }
3576 return FALSE;
3577}
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:3673
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 5153 of file iparith.cc.

5154{
5155 ideal v_id=(ideal)v->Data();
5156#ifdef HAVE_SHIFTBBA
5157 if (rIsLPRing(currRing))
5158 {
5159 if (currRing->LPncGenCount < IDELEMS(v_id))
5160 {
5161 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5162 return TRUE;
5163 }
5164 }
5165#endif
5166 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5167 intvec *w=NULL;
5168 tHomog hom=testHomog;
5169 if (ww!=NULL)
5170 {
5171 if (idTestHomModule(v_id,currRing->qideal,ww))
5172 {
5173 w=ivCopy(ww);
5174 int add_row_shift=w->min_in();
5175 (*w)-=add_row_shift;
5176 hom=isHomog;
5177 }
5178 else
5179 {
5180 //WarnS("wrong weights");
5181 delete ww; ww=NULL;
5182 hom=testHomog;
5183 }
5184 }
5185 else
5186 {
5187 if (v->Typ()==IDEAL_CMD)
5188 if (idHomIdeal(v_id,currRing->qideal))
5189 hom=isHomog;
5190 }
5191 ideal S=idSyzygies(v_id,hom,&w);
5192 res->data = (char *)S;
5193 if (hom==isHomog)
5194 {
5195 int vl=S->rank;
5196 intvec *vv=new intvec(vl);
5197 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5198 {
5199 for(int i=0;i<vl;i++)
5200 {
5201 if (v_id->m[i]!=NULL)
5202 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5203 }
5204 }
5205 else
5206 {
5207 p_SetModDeg(ww, currRing);
5208 for(int i=0;i<vl;i++)
5209 {
5210 if (v_id->m[i]!=NULL)
5211 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5212 }
5214 }
5215 if (idTestHomModule(S,currRing->qideal,vv))
5216 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5217 else
5218 delete vv;
5219 }
5220 if (w!=NULL) delete w;
5221 return FALSE;
5222}

◆ jjTENSOR()

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

Definition at line 3578 of file iparith.cc.

3579{
3580 ideal A=(ideal)u->Data();
3581 ideal B=(ideal)v->Data();
3582 res->data = (char *)sm_Tensor(A,B,currRing);
3583 return FALSE;
3584}
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 3585 of file iparith.cc.

3586{
3587 sleftv tmp_u,tmp_v,tmp_res;
3591 tmp_res.Init();
3592 tmp_res.rtyp=SMATRIX_CMD;
3593 BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3594 if (!bo)
3595 {
3598 }
3599 tmp_u.CleanUp();
3600 tmp_v.CleanUp();
3601 tmp_res.CleanUp();
3602 return bo;
3603}
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition: iparith.cc:3578
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 8411 of file iparith.cc.

8412{
8413 do
8414 {
8415 if (v->Typ()!=INT_CMD)
8416 return TRUE;
8417 test_cmd((int)(long)v->Data());
8418 v=v->next;
8419 }
8420 while (v!=NULL);
8421 return FALSE;
8422}
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 991 of file iparith.cc.

992{
993 res->data = (char *)(n_Mult( (number)u->Data(), (number)v->Data(),coeffs_BIGINT));
994 if ((v->next!=NULL) || (u->next!=NULL))
995 return jjOP_REST(res,u,v);
996 return FALSE;
997}
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:633

◆ jjTIMES_BIM()

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

Definition at line 1074 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 979 of file iparith.cc.

980{
981 long a=(long)u->Data();
982 long b=(long)v->Data();
983 long c=a * b;
984 if ((a!=0)&&(c/a!=b))
985 WarnS("int overflow(*), result may be wrong");
986 res->data = (char *)c;
987 if ((u->Next()!=NULL) || (v->Next()!=NULL))
988 return jjOP_REST(res,u,v);
989 return FALSE;
990}

◆ jjTIMES_ID()

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

Definition at line 1055 of file iparith.cc.

1056{
1057 res->data = (char *)idMult((ideal)u->Data(),(ideal)v->Data());
1058 if ((v->next!=NULL) || (u->next!=NULL))
1059 return jjOP_REST(res,u,v);
1060 return FALSE;
1061}
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 1062 of file iparith.cc.

1063{
1064 res->data = (char *)ivMult((intvec*)(u->Data()), (intvec*)(v->Data()));
1065 if (res->data==NULL)
1066 {
1067 WerrorS("intmat size not compatible");
1068 return TRUE;
1069 }
1070 if ((v->next!=NULL) || (u->next!=NULL))
1071 return jjOP_REST(res,u,v);
1072 return FALSE;
1073}
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 1138 of file iparith.cc.

1139{
1140 matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
1141 res->data = (char *)mp_Mult(A,B,currRing);
1142 if (res->data==NULL)
1143 {
1144 Werror("matrix size not compatible(%dx%d, %dx%d) in *",
1146 return TRUE;
1147 }
1148 if ((v->next!=NULL) || (u->next!=NULL))
1149 return jjOP_REST(res,u,v);
1150 return FALSE;
1151}
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 1086 of file iparith.cc.

1087{
1089 if (nMap==NULL) return TRUE;
1090 number n=nMap((number)v->Data(),coeffs_BIGINT,currRing->cf);
1091 poly p=pNSet(n);
1092 ideal I= (ideal)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1093 res->data = (char *)I;
1094 return FALSE;
1095}
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 1096 of file iparith.cc.

1097{
1098 return jjTIMES_MA_BI1(res,v,u);
1099}
static BOOLEAN jjTIMES_MA_BI1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1086

◆ jjTIMES_MA_I1()

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

Definition at line 1129 of file iparith.cc.

1130{
1131 res->data = (char *)mp_MultI((matrix)u->CopyD(MATRIX_CMD),(int)(long)v->Data(),currRing);
1132 return FALSE;
1133}
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 1134 of file iparith.cc.

1135{
1136 return jjTIMES_MA_I1(res,v,u);
1137}
static BOOLEAN jjTIMES_MA_I1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1129

◆ jjTIMES_MA_N1()

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

Definition at line 1118 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1125 of file iparith.cc.

1126{
1127 return jjTIMES_MA_N1(res,v,u);
1128}
static BOOLEAN jjTIMES_MA_N1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1118

◆ jjTIMES_MA_P1()

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

Definition at line 1100 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1109 of file iparith.cc.

1110{
1111 poly p=(poly)u->CopyD(POLY_CMD);
1112 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1113 ideal I= (ideal)pMultMp(p,(matrix)v->CopyD(MATRIX_CMD),currRing);
1114 if (r>0) I->rank=r;
1115 res->data = (char *)I;
1116 return FALSE;
1117}
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 998 of file iparith.cc.

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

◆ jjTIMES_P()

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

Definition at line 1008 of file iparith.cc.

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

1153{
1154 ideal A=(ideal)u->Data(); ideal B=(ideal)v->Data();
1155 res->data = (char *)sm_Mult(A,B,currRing);
1156 if (res->data==NULL)
1157 {
1158 Werror("matrix size not compatible(%dx%d, %dx%d) in *",
1159 (int)A->rank,IDELEMS(A),(int)B->rank,IDELEMS(B));
1160 return TRUE;
1161 }
1162 if ((v->next!=NULL) || (u->next!=NULL))
1163 return jjOP_REST(res,u,v);
1164 return FALSE;
1165}
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 5224 of file iparith.cc.

5225{
5226 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5227 return FALSE;
5228}
int ivTrace(intvec *o)
Definition: intvec.cc:339

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5229 of file iparith.cc.

5230{
5231 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5232 return FALSE;
5233}

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5234 of file iparith.cc.

5235{
5236 res->data = (char *)ivTranp((intvec*)(v->Data()));
5237 return FALSE;
5238}
intvec * ivTranp(intvec *o)
Definition: intvec.cc:327

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5273 of file iparith.cc.

5274{
5275#ifdef HAVE_PLURAL
5276 ideal result;
5277 ideal v_id=(ideal)a->Data();
5279 result=(ideal)twostd(v_id);
5280 else /*commutative or shiftalgebra*/
5281 {
5282 return jjSTD(res,a);
5283 }
5284 res->data = (char *)result;
5287 return FALSE;
5288#else
5289 return TRUE;
5290#endif
5291}
#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 5353 of file iparith.cc.

5354{
5355 int t=(int)(long)v->data;
5356 switch (t)
5357 {
5358 case CRING_CMD:
5359 case INT_CMD:
5360 case POLY_CMD:
5361 case VECTOR_CMD:
5362 case STRING_CMD:
5363 case INTVEC_CMD:
5364 case IDEAL_CMD:
5365 case MATRIX_CMD:
5366 case MODUL_CMD:
5367 case MAP_CMD:
5368 case PROC_CMD:
5369 case RING_CMD:
5370 case SMATRIX_CMD:
5371 //case QRING_CMD:
5372 case INTMAT_CMD:
5373 case BIGINTMAT_CMD:
5374 case NUMBER_CMD:
5375 #ifdef SINGULAR_4_2
5376 case CNUMBER_CMD:
5377 #endif
5378 case BIGINT_CMD:
5379 case BUCKET_CMD:
5380 case LIST_CMD:
5381 case PACKAGE_CMD:
5382 case LINK_CMD:
5383 case RESOLUTION_CMD:
5384 res->data=omStrDup(Tok2Cmdname(t)); break;
5385 case DEF_CMD:
5386 case NONE: res->data=omStrDup("none"); break;
5387 default:
5388 {
5389 if (t>MAX_TOK)
5390 res->data=omStrDup(getBlackboxName(t));
5391 else
5392 res->data=omStrDup("?unknown type?");
5393 break;
5394 }
5395 }
5396 return FALSE;
5397}
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 3744 of file iparith.cc.

3745{
3746 number n=(number)u->CopyD(BIGINT_CMD);
3748 res->data = (char *)n;
3749 return FALSE;
3750}
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:554

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3781 of file iparith.cc.

3782{
3784 (*bim)*=(-1);
3785 res->data = (char *)bim;
3786 return FALSE;
3787}

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3751 of file iparith.cc.

3752{
3753 res->data = (char *)(-(long)u->Data());
3754 return FALSE;
3755}

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3774 of file iparith.cc.

3775{
3776 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3777 (*iv)*=(-1);
3778 res->data = (char *)iv;
3779 return FALSE;
3780}

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3768 of file iparith.cc.

3769{
3770 poly m1=pISet(-1);
3771 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3772 return FALSE;
3773}
#define pISet(i)
Definition: polys.h:312

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3756 of file iparith.cc.

3757{
3758 number n=(number)u->CopyD(NUMBER_CMD);
3759 n=nInpNeg(n);
3760 res->data = (char *)n;
3761 return FALSE;
3762}
#define nInpNeg(n)
Definition: numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3763 of file iparith.cc.

3764{
3765 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3766 return FALSE;
3767}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10266 of file iparith.cc.

10267{
10268 lists l=(lists)arg->Data();
10269 if (l->nr>0)
10270 {
10271 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10272 int i, j, len;
10273 len=l->nr;
10274 i=0;
10275 while(i<len)
10276 {
10277 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10278 {
10279 l->m[i].CleanUp();
10280 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10281 memset(&(l->m[len]),0,sizeof(sleftv));
10282 l->m[len].rtyp=DEF_CMD;
10283 len--;
10284 }
10285 else
10286 i++;
10287 }
10288 //Print("new len:%d\n",len);
10289 }
10290 return FALSE;
10291}

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5398 of file iparith.cc.

5399{
5400 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5401 return FALSE;
5402}
#define pIsUnivariate(p)
Definition: polys.h:249

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5403 of file iparith.cc.

5404{
5405 int i=(int)(long)v->Data();
5406 if ((0<i) && (i<=currRing->N))
5407 {
5408 poly p=pOne();
5409 pSetExp(p,i,1);
5410 pSetm(p);
5411 res->data=(char *)p;
5412 }
5413 else
5414 {
5415 Werror("var number %d out of range 1..%d",i,currRing->N);
5416 return TRUE;
5417 }
5418 return FALSE;
5419}

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5420 of file iparith.cc.

5421{
5422 if (currRing==NULL)
5423 {
5424 WerrorS("no ring active (2)");
5425 return TRUE;
5426 }
5427 int i=(int)(long)v->Data();
5428 if ((0<i) && (i<=currRing->N))
5429 res->data=omStrDup(currRing->names[i-1]);
5430 else
5431 {
5432 Werror("var number %d out of range 1..%d",i,currRing->N);
5433 return TRUE;
5434 }
5435 return FALSE;
5436}

◆ jjVARSTR2()

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

Definition at line 3604 of file iparith.cc.

3605{
3606 idhdl h=(idhdl)u->data;
3607 int i=(int)(long)v->Data();
3608 if ((0<i) && (i<=IDRING(h)->N))
3609 res->data=omStrDup(IDRING(h)->names[i-1]);
3610 else
3611 {
3612 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3613 return TRUE;
3614 }
3615 return FALSE;
3616}

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5437 of file iparith.cc.

5438{
5440#ifdef HAVE_SHIFTBBA
5441 if (rIsLPRing(currRing))
5442 {
5443#ifdef HAVE_RINGS
5445 {
5446 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5447 return TRUE;
5448 }
5449#endif
5450 if (currRing->qideal != NULL)
5451 {
5452 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5453 return TRUE;
5454 }
5455 int kDim = lp_kDim((ideal)(v->Data()));
5456 res->data = (char *)(long)kDim;
5457 return (kDim == -2);
5458 }
5459#endif
5460 long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5461 if (l<-1L)
5462 WerrorS("int overflow in vdim");
5463 res->data = (char *)l;
5464 return FALSE;
5465}
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 5466 of file iparith.cc.

5467{
5468// input: u: a list with links of type
5469// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5470// returns: -1: the read state of all links is eof
5471// i>0: (at least) u[i] is ready
5472 lists Lforks = (lists)u->Data();
5473 int i = slStatusSsiL(Lforks, -1);
5474 if(i == -2) /* error */
5475 {
5476 return TRUE;
5477 }
5478 res->data = (void*)(long)i;
5479 return FALSE;
5480}

◆ jjWAIT1ST2()

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

Definition at line 3617 of file iparith.cc.

3618{
3619// input: u: a list with links of type
3620// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3621// v: timeout for select in milliseconds
3622// or 0 for polling
3623// returns: ERROR (via Werror): timeout negative
3624// -1: the read state of all links is eof
3625// 0: timeout (or polling): none ready
3626// i>0: (at least) L[i] is ready
3627 lists Lforks = (lists)u->Data();
3628 int t = (int)(long)v->Data();
3629 if(t < 0)
3630 {
3631 WerrorS("negative timeout"); return TRUE;
3632 }
3633 int i = slStatusSsiL(Lforks, t*1000);
3634 if(i == -2) /* error */
3635 {
3636 return TRUE;
3637 }
3638 res->data = (void*)(long)i;
3639 return FALSE;
3640}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5481 of file iparith.cc.

5482{
5483// input: u: a list with links of type
5484// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5485// returns: -1: the read state of all links is eof
5486// 1: all links are ready
5487// (caution: at least one is ready, but some maybe dead)
5488 lists Lforks = (lists)u->CopyD();
5489 int i;
5490 int j = -1;
5491 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5492 {
5493 i = slStatusSsiL(Lforks, -1);
5494 if(i == -2) /* error */
5495 {
5496 return TRUE;
5497 }
5498 if(i == -1)
5499 {
5500 break;
5501 }
5502 j = 1;
5503 Lforks->m[i-1].CleanUp();
5504 Lforks->m[i-1].rtyp=DEF_CMD;
5505 Lforks->m[i-1].data=NULL;
5506 }
5507 res->data = (void*)(long)j;
5508 Lforks->Clean();
5509 return FALSE;
5510}

◆ jjWAITALL2()

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

Definition at line 3641 of file iparith.cc.

3642{
3643// input: u: a list with links of type
3644// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3645// v: timeout for select in milliseconds
3646// or 0 for polling
3647// returns: ERROR (via Werror): timeout negative
3648// -1: the read state of all links is eof
3649// 0: timeout (or polling): none ready
3650// 1: all links are ready
3651// (caution: at least one is ready, but some maybe dead)
3652 lists Lforks = (lists)u->CopyD();
3653 int timeout = 1000*(int)(long)v->Data();
3654 if(timeout < 0)
3655 {
3656 WerrorS("negative timeout"); return TRUE;
3657 }
3658 int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3659 int i;
3660 int ret = -1;
3661 for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3662 {
3663 i = slStatusSsiL(Lforks, timeout);
3664 if(i > 0) /* Lforks[i] is ready */
3665 {
3666 ret = 1;
3667 Lforks->m[i-1].CleanUp();
3668 Lforks->m[i-1].rtyp=DEF_CMD;
3669 Lforks->m[i-1].data=NULL;
3670 timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3671 }
3672 else /* terminate the for loop */
3673 {
3674 if(i == -2) /* error */
3675 {
3676 return TRUE;
3677 }
3678 if(i == 0) /* timeout */
3679 {
3680 ret = 0;
3681 }
3682 break;
3683 }
3684 }
3685 Lforks->Clean();
3686 res->data = (void*)(long)ret;
3687 return FALSE;
3688}
#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 3689 of file iparith.cc.

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

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3694 of file iparith.cc.

3695{
3696 return TRUE;
3697}

◆ jjWRONG2()

static BOOLEAN jjWRONG2 ( leftv  ,
leftv  ,
leftv   
)
static

Definition at line 3698 of file iparith.cc.

3699{
3700 return TRUE;
3701}

◆ jjWRONG3()

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

Definition at line 3702 of file iparith.cc.

3703{
3704 return TRUE;
3705}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int  tok)

Definition at line 9671 of file iparith.cc.

9672{
9673 if (tok <= 0)
9674 {
9675 return sArithBase.sCmds[0].name;
9676 }
9677 if (tok==ANY_TYPE) return "any_type";
9678 if (tok==COMMAND) return "command";
9679 if (tok==NONE) return "nothing";
9680 if (tok < 128)
9681 {
9682 Tok2Cmdname_buf[0]=(char)tok;
9683 return Tok2Cmdname_buf;
9684 }
9685 //if (tok==IFBREAK) return "if_break";
9686 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9687 //if (tok==ORDER_VECTOR) return "ordering";
9688 //if (tok==REF_VAR) return "ref";
9689 //if (tok==OBJECT) return "object";
9690 //if (tok==PRINT_EXPR) return "print_expr";
9691 if (tok==IDHDL) return "identifier";
9692 if (tok>MAX_TOK) return getBlackboxName(tok);
9693 unsigned i;
9694 for(i=0; i<sArithBase.nCmdUsed; i++)
9695 //while (sArithBase.sCmds[i].tokval!=0)
9696 {
9697 if ((sArithBase.sCmds[i].tokval == tok)&&
9698 (sArithBase.sCmds[i].alias==0))
9699 {
9700 return sArithBase.sCmds[i].name;
9701 }
9702 }
9703 // try gain for alias/old names:
9704 for(i=0; i<sArithBase.nCmdUsed; i++)
9705 {
9706 if (sArithBase.sCmds[i].tokval == tok)
9707 {
9708 return sArithBase.sCmds[i].name;
9709 }
9710 }
9711 return sArithBase.sCmds[0].name;
9712}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9670
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5584 of file iparith.cc.

5585{
5587}

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

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9670 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5583 of file iparith.cc.