My Project  debian-1:4.1.2-p1+ds-2
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 "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/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/ipconv.h"
#include "Singular/ipprint.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/misc_ip.h"
#include "Singular/linearAlgebra_ip.h"
#include "Singular/number2.h"
#include "Singular/fglm.h"
#include "Singular/blackbox.h"
#include "Singular/newstruct.h"
#include "Singular/ipshell.h"
#include "reporter/si_signals.h"
#include <ctype.h>
#include "kernel/GBEngine/ratgring.h"
#include "kernel/GBEngine/nc.h"
#include "polys/nc/nc.h"
#include "polys/nc/sca.h"
#include "table.h"
#include "iparith.inc"

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

static BOOLEAN check_valid (const int p, const int op)
 
static int _gentable_sort_cmds (const void *a, const void *b)
 compares to entry of cmdsname-list More...
 
int iiArithRemoveCmd (char *szName)
 
int iiArithAddCmd (const char *szName, short nAlias, short nTokval, short nToktype, short nPos=-1)
 
static int iiTabIndex (const jjValCmdTab dArithTab, const int len, const int op)
 
static Subexpr jjMakeSub (leftv e)
 
static int iin_Int (number &n, coeffs cf)
 
poly pHeadProc (poly p)
 
int iiTokType (int op)
 
static BOOLEAN jjOP_BIM_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_BIM_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_BI_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_IV_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_IM_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_I_IM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOLON (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDOTDOT (leftv res, leftv u, leftv v)
 
static void jjEQUAL_REST (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_IV_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOMPARE_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOP_REST (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPOWER_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUSMINUS_Gen (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOLCOL (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_B (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_B_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_MA_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_P_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPLUS_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_B_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_B (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMINUS_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_BIM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_BI1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_BI2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_P1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_P2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_N1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_N2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_I1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA_I2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_MA (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTIMES_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGE_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGT_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLE_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLT_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIVMOD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIV_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_SM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_R (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEQUAL_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjAND_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjOR_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_PBu (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_P_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINDEX_V_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER_rest (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKLAMMER_IV (leftv res, leftv u, leftv v)
 
BOOLEAN jjPROC (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMAP (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRING_1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCHINREM_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjALIGN_V (leftv res, leftv u, leftv v)
 
static BOOLEAN jjALIGN_M (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCHINREM_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEF (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEF_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEFFS_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCOEFFS2_KB (leftv res, leftv u, leftv v)
 
static BOOLEAN jjCONTRACT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDEG_M_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDEG_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDelete_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDelete_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDET2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDET2_S (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIFF_ID_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjDIM2 (leftv res, leftv v, leftv w)
 
static BOOLEAN jjDIVISION (leftv res, leftv u, leftv v)
 
static BOOLEAN jjELIMIN (leftv res, leftv u, leftv v)
 
static BOOLEAN jjELIMIN_IV (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXPORTTO (leftv, leftv u, leftv v)
 
static BOOLEAN jjERROR (leftv, leftv u)
 
static BOOLEAN jjEXTGCD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXTGCD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjEXTGCD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAC_P2 (leftv res, leftv u, leftv dummy)
 
static BOOLEAN jjFACSTD2 (leftv res, leftv v, leftv w)
 
static BOOLEAN jjFAREY_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAREY_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFAREY_LI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFETCH (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFIND2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFRES3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFRES (leftv res, leftv u, leftv v)
 
static BOOLEAN jjFWALK (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_I (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjGCD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHILBERT2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjHOMOG1_W (leftv res, leftv v, leftv u)
 
static BOOLEAN jjINDEPSET2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINTERSECT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjINTERPOLATION (leftv res, leftv l, leftv v)
 
static BOOLEAN jjJanetBasis2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJanetBasis (leftv res, leftv v)
 
static BOOLEAN jjJET_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJET_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKBASE2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPREIMAGE (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjKERNEL (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKoszul (leftv res, leftv u, leftv v)
 
static BOOLEAN jjKoszul_Id (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLIFT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLIFTSTD (leftv res, leftv u, leftv v)
 
static BOOLEAN jjLOAD2 (leftv, leftv, leftv v)
 
static BOOLEAN jjLOAD_E (leftv, leftv v, leftv u)
 
static BOOLEAN jjMODULO (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_BI (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_N (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMOD_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMONITOR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjMONITOR1 (leftv res, leftv v)
 
static BOOLEAN jjMONOM (leftv res, leftv v)
 
static BOOLEAN jjNEWSTRUCT2 (leftv, leftv u, leftv v)
 
static BOOLEAN jjPARSTR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPlural_num_poly (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_num_mat (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_mat_poly (leftv res, leftv a, leftv b)
 
static BOOLEAN jjPlural_mat_mat (leftv res, leftv a, leftv b)
 
static BOOLEAN jjBRACKET (leftv res, leftv a, leftv b)
 
static BOOLEAN jjBRACKET_REC (leftv res, leftv a, leftv b, leftv c)
 
static BOOLEAN jjOPPOSE (leftv res, leftv a, leftv b)
 
static BOOLEAN jjQUOT (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRANDOM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRANK2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREAD2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREDUCE_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjREDUCE_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRES (leftv res, leftv u, leftv v)
 
static BOOLEAN jjPFAC2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRMINUS (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRPLUS (leftv res, leftv u, leftv v)
 
static BOOLEAN jjRSUM (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSIMPL_ID (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSQR_FREE2 (leftv res, leftv u, leftv dummy)
 
static BOOLEAN jjSTATUS2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTATUS2L (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSIMPL_P (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTD_HILB (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSTD_1 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjSYZ_2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTENSOR (leftv res, leftv u, leftv v)
 
static BOOLEAN jjTENSOR_Ma (leftv res, leftv u, leftv v)
 
static BOOLEAN jjVARSTR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAIT1ST2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAITALL2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWEDGE (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWRONG (leftv, leftv)
 
static BOOLEAN jjDUMMY (leftv res, leftv u)
 
static BOOLEAN jjNULL (leftv, leftv)
 
static BOOLEAN jjPLUSPLUS (leftv, leftv u)
 
static BOOLEAN jjUMINUS_BI (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_I (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_N (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_P (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_MA (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_IV (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_BIM (leftv res, leftv u)
 
static BOOLEAN jjSetRing (leftv, leftv u)
 
static BOOLEAN jjPROC1 (leftv res, leftv u)
 
static BOOLEAN jjBAREISS (leftv res, leftv v)
 
static BOOLEAN jjBAREISS_BIM (leftv res, leftv v)
 
static BOOLEAN jjBI2N (leftv res, leftv u)
 
static BOOLEAN jjBI2IM (leftv res, leftv u)
 
static BOOLEAN jjBI2P (leftv res, leftv u)
 
static BOOLEAN jjCALL1MANY (leftv res, leftv u)
 
static BOOLEAN jjCHAR (leftv res, leftv v)
 
static BOOLEAN jjCOLS (leftv res, leftv v)
 
static BOOLEAN jjCOLS_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOLS_IV (leftv res, leftv v)
 
static BOOLEAN jjCONTENT (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BI (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_N (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_L (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_M (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_IV (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RG (leftv res, leftv v)
 
static BOOLEAN jjDEG (leftv res, leftv v)
 
static BOOLEAN jjDEG_M (leftv res, leftv u)
 
static BOOLEAN jjDEGREE (leftv res, leftv v)
 
static BOOLEAN jjDEFINED (leftv res, leftv v)
 
static BOOLEAN jjDENOMINATOR (leftv res, leftv v)
 Return the denominator of the input number NOTE: the input number is normalized as a side effect. More...
 
static BOOLEAN jjNUMERATOR (leftv res, leftv v)
 Return the numerator of the input number NOTE: the input number is normalized as a side effect. 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 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 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 jjSLIM_GB (leftv res, leftv u)
 
static BOOLEAN jjSBA (leftv res, leftv v)
 
static BOOLEAN jjSBA_1 (leftv res, leftv v, leftv u)
 
static BOOLEAN jjSBA_2 (leftv res, leftv v, leftv u, leftv t)
 
static BOOLEAN jjSTD (leftv res, leftv v)
 
static BOOLEAN jjSort_Id (leftv res, leftv v)
 
static BOOLEAN jjSQR_FREE (leftv res, leftv u)
 
static BOOLEAN jjSYZYGY (leftv res, leftv v)
 
static BOOLEAN jjTRACE_IV (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_BIM (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_IV (leftv res, leftv v)
 
static BOOLEAN jjOPPOSITE (leftv res, leftv a)
 
static BOOLEAN jjENVELOPE (leftv res, leftv a)
 
static BOOLEAN jjTWOSTD (leftv res, leftv a)
 
static BOOLEAN jjRIGHTSTD (leftv res, leftv v)
 
static BOOLEAN jjTYPEOF (leftv res, leftv v)
 
static BOOLEAN jjUNIVARIATE (leftv res, leftv v)
 
static BOOLEAN jjVAR1 (leftv res, leftv v)
 
static BOOLEAN jjVARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjVDIM (leftv res, leftv v)
 
BOOLEAN jjWAIT1ST1 (leftv res, leftv u)
 
BOOLEAN jjWAITALL1 (leftv res, leftv u)
 
BOOLEAN jjLOAD (const char *s, BOOLEAN autoexport)
 load lib/module given in v More...
 
static void WerrorS_dummy (const char *)
 
BOOLEAN jjLOAD_TRY (const char *s)
 
static BOOLEAN jjstrlen (leftv res, leftv v)
 
static BOOLEAN jjpLength (leftv res, leftv v)
 
static BOOLEAN jjidElem (leftv res, leftv v)
 
static BOOLEAN jjidFreeModule (leftv res, leftv v)
 
static BOOLEAN jjidVec2Ideal (leftv res, leftv v)
 
static BOOLEAN jjrCharStr (leftv res, leftv v)
 
static BOOLEAN jjpHead (leftv res, leftv v)
 
static BOOLEAN jjidHead (leftv res, leftv v)
 
static BOOLEAN jjidMinBase (leftv res, leftv v)
 
static BOOLEAN jjpMaxComp (leftv res, leftv v)
 
static BOOLEAN jjmpTrace (leftv res, leftv v)
 
static BOOLEAN jjmpTransp (leftv res, leftv v)
 
static BOOLEAN jjrOrdStr (leftv res, leftv v)
 
static BOOLEAN jjrVarStr (leftv res, leftv v)
 
static BOOLEAN jjrParStr (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RES (leftv res, leftv v)
 
static BOOLEAN jjDIM_R (leftv res, leftv v)
 
static BOOLEAN jjidTransp (leftv res, leftv v)
 
static BOOLEAN jjnInt (leftv res, leftv u)
 
static BOOLEAN jjnlInt (leftv res, leftv u)
 
static BOOLEAN jjBRACK_S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Bim (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_SM (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_I_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBRACK_Ma_IV_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjPROC3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING_2 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBAREISS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_KB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjCOEFFS3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_ALG (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjELIMIN_HILB (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFIND3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjFWALK3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjHILBERT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjHOMOG_ID_W (leftv res, leftv u, leftv v, leftv)
 
static BOOLEAN jjHOMOG_P_W (leftv res, leftv u, leftv v, leftv)
 
static BOOLEAN jjINTMAT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjINTERSECT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjINTERSEC3S (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_P_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_P_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_ID_IV (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjJET_ID_M (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMINOR_M (leftv res, leftv v)
 
static BOOLEAN jjNEWSTRUCT3 (leftv, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRANDOM_Im (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Test (leftv v, leftv w, int &ringvar, poly &monomexpr)
 
static BOOLEAN jjSUBST_Bu (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_X (leftv res, leftv u, leftv v, leftv w, int input_type)
 
static BOOLEAN jjSUBST_Id_I (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSUBST_Id_N (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Id (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjMATRIX_Ma (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSMATRIX_Mo (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD3 (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_4 (leftv res, leftv U)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
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 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

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

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

Macro Definition Documentation

◆ ALLOW_LP

#define ALLOW_LP   64

Definition at line 107 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 108 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 100 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 103 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 106 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 110 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 102 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8222 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 214 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8224 of file iparith.cc.

◆ jjWRONG2

#define jjWRONG2   (proc2)jjWRONG

Definition at line 3605 of file iparith.cc.

◆ jjWRONG3

#define jjWRONG3   (proc3)jjWRONG

Definition at line 3606 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 88 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 116 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 101 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 104 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 105 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 8223 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 94 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3254 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3251 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3252 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3253 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3256 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3250 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3255 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 114 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 95 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 127 of file iparith.cc.

◆ proc2

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

Definition at line 147 of file iparith.cc.

◆ proc3

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

Definition at line 158 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9186 {
9187  cmdnames *pCmdL = (cmdnames*)a;
9188  cmdnames *pCmdR = (cmdnames*)b;
9189 
9190  if(a==NULL || b==NULL) return 0;
9191 
9192  /* empty entries goes to the end of the list for later reuse */
9193  if(pCmdL->name==NULL) return 1;
9194  if(pCmdR->name==NULL) return -1;
9195 
9196  /* $INVALID$ must come first */
9197  if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9198  if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9199 
9200  /* tokval=-1 are reserved names at the end */
9201  if (pCmdL->tokval==-1)
9202  {
9203  if (pCmdR->tokval==-1)
9204  return strcmp(pCmdL->name, pCmdR->name);
9205  /* pCmdL->tokval==-1, pCmdL goes at the end */
9206  return 1;
9207  }
9208  /* pCmdR->tokval==-1, pCmdR goes at the end */
9209  if(pCmdR->tokval==-1) return -1;
9210 
9211  return strcmp(pCmdL->name, pCmdR->name);
9212 }
CanonicalForm b
Definition: cfModGcd.cc:4044
#define NULL
Definition: omList.c:12

◆ check_valid()

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

Definition at line 9411 of file iparith.cc.

9412 {
9413  #ifdef HAVE_PLURAL
9414  if (rIsPluralRing(currRing))
9415  {
9416  if ((p & NC_MASK)==NO_NC)
9417  {
9418  WerrorS("not implemented for non-commutative rings");
9419  return TRUE;
9420  }
9421  else if ((p & NC_MASK)==COMM_PLURAL)
9422  {
9423  Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9424  return FALSE;
9425  }
9426  /* else, ALLOW_PLURAL */
9427  }
9428  #ifdef HAVE_SHIFTBBA
9429  else if (rIsLPRing(currRing))
9430  {
9431  if ((p & ALLOW_LP)==0)
9432  {
9433  Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9434  return TRUE;
9435  }
9436  }
9437  #endif
9438  #endif
9439 #ifdef HAVE_RINGS
9440  if (rField_is_Ring(currRing))
9441  {
9442  if ((p & RING_MASK)==0 /*NO_RING*/)
9443  {
9444  WerrorS("not implemented for rings with rings as coeffients");
9445  return TRUE;
9446  }
9447  /* else ALLOW_RING */
9448  else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9449  &&(!rField_is_Domain(currRing)))
9450  {
9451  WerrorS("domain required as coeffients");
9452  return TRUE;
9453  }
9454  /* else ALLOW_ZERODIVISOR */
9455  else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9456  {
9457  WarnS("considering the image in Q[...]");
9458  }
9459  }
9460 #endif
9461  return FALSE;
9462 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4019
#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:43
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:102
#define NO_ZERODIVISOR
Definition: iparith.cc:105
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9131
#define ALLOW_LP
Definition: iparith.cc:107
#define RING_MASK
Definition: iparith.cc:94
#define WARN_RING
Definition: iparith.cc:114
#define NC_MASK
Definition: iparith.cc:88
#define NO_NC
Definition: iparith.cc:101
#define ZERODIVISOR_MASK
Definition: iparith.cc:95
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 rField_is_Ring(const ring r)
Definition: ring.h:479
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:482
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408

◆ iiArithAddCmd()

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

Definition at line 9352 of file iparith.cc.

9359 {
9360  //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9361  // nTokval, nToktype, nPos);
9362  if(nPos>=0)
9363  {
9364  // no checks: we rely on a correct generated code in iparith.inc
9365  assume((unsigned)nPos < sArithBase.nCmdAllocated);
9366  assume(szName!=NULL);
9367  sArithBase.sCmds[nPos].name = omStrDup(szName);
9368  sArithBase.sCmds[nPos].alias = nAlias;
9369  sArithBase.sCmds[nPos].tokval = nTokval;
9370  sArithBase.sCmds[nPos].toktype = nToktype;
9371  sArithBase.nCmdUsed++;
9372  //if(nTokval>0) sArithBase.nLastIdentifier++;
9373  }
9374  else
9375  {
9376  if(szName==NULL) return -1;
9377  int nIndex = iiArithFindCmd(szName);
9378  if(nIndex>=0)
9379  {
9380  Print("'%s' already exists at %d\n", szName, nIndex);
9381  return -1;
9382  }
9383 
9385  {
9386  /* needs to create new slots */
9387  unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9388  sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
9389  if(sArithBase.sCmds==NULL) return -1;
9391  }
9392  /* still free slots available */
9393  sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
9394  sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9395  sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9396  sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9397  sArithBase.nCmdUsed++;
9398 
9399  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9400  (&_gentable_sort_cmds));
9403  {
9404  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9405  }
9406  //Print("L=%d\n", sArithBase.nLastIdentifier);
9407  }
9408  return 0;
9409 }
#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:9185
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9257
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:180
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:187
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:195
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:186
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:185
#define assume(x)
Definition: mod2.h:390
#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 9257 of file iparith.cc.

9258 {
9259  int an=0;
9260  int i = 0,v = 0;
9261  int en=sArithBase.nLastIdentifier;
9262 
9263  loop
9264  //for(an=0; an<sArithBase.nCmdUsed; )
9265  {
9266  if(an>=en-1)
9267  {
9268  if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9269  {
9270  //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9271  return an;
9272  }
9273  else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9274  {
9275  //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9276  return en;
9277  }
9278  else
9279  {
9280  //Print("RET- 1\n");
9281  return -1;
9282  }
9283  }
9284  i=(an+en)/2;
9285  if (*szName < *(sArithBase.sCmds[i].name))
9286  {
9287  en=i-1;
9288  }
9289  else if (*szName > *(sArithBase.sCmds[i].name))
9290  {
9291  an=i+1;
9292  }
9293  else
9294  {
9295  v=strcmp(szName,sArithBase.sCmds[i].name);
9296  if(v<0)
9297  {
9298  en=i-1;
9299  }
9300  else if(v>0)
9301  {
9302  an=i+1;
9303  }
9304  else /*v==0*/
9305  {
9306  //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9307  return i;
9308  }
9309  }
9310  }
9311  //if(i>=0 && i<sArithBase.nCmdUsed)
9312  // return i;
9313  //PrintS("RET-2\n");
9314  return -2;
9315 }
int i
Definition: cfEzgcd.cc:125
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define loop
Definition: structs.h:80

◆ iiArithGetCmd()

char* iiArithGetCmd ( int  nPos)

Definition at line 9317 of file iparith.cc.

9318 {
9319  if(nPos<0) return NULL;
9320  if(nPos<(int)sArithBase.nCmdUsed)
9321  return sArithBase.sCmds[nPos].name;
9322  return NULL;
9323 }

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9325 of file iparith.cc.

9326 {
9327  int nIndex;
9328  if(szName==NULL) return -1;
9329 
9330  nIndex = iiArithFindCmd(szName);
9331  if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9332  {
9333  Print("'%s' not found (%d)\n", szName, nIndex);
9334  return -1;
9335  }
9336  omFree(sArithBase.sCmds[nIndex].name);
9337  sArithBase.sCmds[nIndex].name=NULL;
9338  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9339  (&_gentable_sort_cmds));
9340  sArithBase.nCmdUsed--;
9341 
9342  /* fix last-identifier */
9345  {
9346  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9347  }
9348  //Print("L=%d\n", sArithBase.nLastIdentifier);
9349  return 0;
9350 }
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ iiExprArith1()

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

Definition at line 8595 of file iparith.cc.

8596 {
8597  memset(res,0,sizeof(sleftv));
8598 
8599  if (!errorreported)
8600  {
8601 #ifdef SIQ
8602  if (siq>0)
8603  {
8604  //Print("siq:%d\n",siq);
8606  memcpy(&d->arg1,a,sizeof(sleftv));
8607  a->Init();
8608  d->op=op;
8609  d->argc=1;
8610  res->data=(char *)d;
8611  res->rtyp=COMMAND;
8612  return FALSE;
8613  }
8614 #endif
8615  int at=a->Typ();
8616  // handling bb-objects ----------------------------------------------------
8617  if(op>MAX_TOK) // explicit type conversion to bb
8618  {
8619  blackbox *bb=getBlackboxStuff(op);
8620  if (bb!=NULL)
8621  {
8622  res->rtyp=op;
8623  res->data=bb->blackbox_Init(bb);
8624  if(!bb->blackbox_Assign(res,a)) return FALSE;
8625  }
8626  else
8627  return TRUE;
8628  }
8629  else if (at>MAX_TOK) // argument is of bb-type
8630  {
8631  blackbox *bb=getBlackboxStuff(at);
8632  if (bb!=NULL)
8633  {
8634  if(!bb->blackbox_Op1(op,res,a)) return FALSE;
8635  // else: no op defined
8636  }
8637  else
8638  return TRUE;
8639  }
8640  if (errorreported) return TRUE;
8641 
8642  iiOp=op;
8643  int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
8644  return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
8645  }
8646  a->CleanUp();
8647  return TRUE;
8648 }
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1033
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:64
VAR short errorreported
Definition: feFopen.cc:23
VAR int iiOp
Definition: iparith.cc:216
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:8465
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9106
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1267
VAR omBin sip_command_bin
Definition: ipid.cc:45
ip_command * command
Definition: ipid.h:22
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:217
#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 8465 of file iparith.cc.

8466 {
8467  memset(res,0,sizeof(sleftv));
8468  BOOLEAN call_failed=FALSE;
8469 
8470  if (!errorreported)
8471  {
8472  BOOLEAN failed=FALSE;
8473  iiOp=op;
8474  int i = 0;
8475  while (dA1[i].cmd==op)
8476  {
8477  if (at==dA1[i].arg)
8478  {
8479  if (currRing!=NULL)
8480  {
8481  if (check_valid(dA1[i].valid_for,op)) break;
8482  }
8483  else
8484  {
8485  if (RingDependend(dA1[i].res))
8486  {
8487  WerrorS("no ring active");
8488  break;
8489  }
8490  }
8491  if (traceit&TRACE_CALL)
8492  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8493  res->rtyp=dA1[i].res;
8494  if ((call_failed=dA1[i].p(res,a)))
8495  {
8496  break;// leave loop, goto error handling
8497  }
8498  if (a->Next()!=NULL)
8499  {
8500  res->next=(leftv)omAllocBin(sleftv_bin);
8501  failed=iiExprArith1(res->next,a->next,op);
8502  }
8503  a->CleanUp();
8504  return failed;
8505  }
8506  i++;
8507  }
8508  // implicite type conversion --------------------------------------------
8509  if (dA1[i].cmd!=op)
8510  {
8512  i=0;
8513  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8514  while (dA1[i].cmd==op)
8515  {
8516  int ai;
8517  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8518  if ((dA1[i].valid_for & NO_CONVERSION)==0)
8519  {
8520  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8521  {
8522  if (currRing!=NULL)
8523  {
8524  if (check_valid(dA1[i].valid_for,op)) break;
8525  }
8526  else
8527  {
8528  if (RingDependend(dA1[i].res))
8529  {
8530  WerrorS("no ring active");
8531  break;
8532  }
8533  }
8534  if (traceit&TRACE_CALL)
8535  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8536  res->rtyp=dA1[i].res;
8537  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8538  || (call_failed=dA1[i].p(res,an)));
8539  // everything done, clean up temp. variables
8540  if (failed)
8541  {
8542  // leave loop, goto error handling
8543  break;
8544  }
8545  else
8546  {
8547  if (an->Next() != NULL)
8548  {
8549  res->next = (leftv)omAllocBin(sleftv_bin);
8550  failed=iiExprArith1(res->next,an->next,op);
8551  }
8552  // everything ok, clean up and return
8553  an->CleanUp();
8555  return failed;
8556  }
8557  }
8558  }
8559  i++;
8560  }
8561  an->CleanUp();
8563  }
8564  // error handling
8565  if (!errorreported)
8566  {
8567  if ((at==0) && (a->Fullname()!=sNoName_fe))
8568  {
8569  Werror("`%s` is not defined",a->Fullname());
8570  }
8571  else
8572  {
8573  i=0;
8574  const char *s = iiTwoOps(op);
8575  Werror("%s(`%s`) failed"
8576  ,s,Tok2Cmdname(at));
8577  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8578  {
8579  while (dA1[i].cmd==op)
8580  {
8581  if ((dA1[i].res!=0)
8582  && (dA1[i].p!=jjWRONG))
8583  Werror("expected %s(`%s`)"
8584  ,s,Tok2Cmdname(dA1[i].arg));
8585  i++;
8586  }
8587  }
8588  }
8589  }
8590  res->rtyp = UNKNOWN;
8591  }
8592  a->CleanUp();
8593  return TRUE;
8594 }
int BOOLEAN
Definition: auxiliary.h:87
void * ADDRESS
Definition: auxiliary.h:135
leftv next
Definition: subexpr.h:86
const char * Fullname()
Definition: subexpr.h:125
leftv Next()
Definition: subexpr.h:136
const CanonicalForm int s
Definition: facAbsFact.cc:55
const char sNoName_fe[]
Definition: fevoices.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
int RingDependend(int t)
Definition: gentable.cc:28
const char * iiTwoOps(int t)
Definition: gentable.cc:261
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3607
#define NO_CONVERSION
Definition: iparith.cc:116
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8595
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9411
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:140
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:34
#define V_SHOW_USE
Definition: options.h:51
EXTERN_VAR int traceit
Definition: reporter.h:24
#define TRACE_CALL
Definition: reporter.h:43
sleftv * leftv
Definition: structs.h:62
#define UNKNOWN
Definition: tok.h:221

◆ iiExprArith2()

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

Definition at line 8406 of file iparith.cc.

8407 {
8408  memset(res,0,sizeof(sleftv));
8409 
8410  if (!errorreported)
8411  {
8412 #ifdef SIQ
8413  if (siq>0)
8414  {
8415  //Print("siq:%d\n",siq);
8417  memcpy(&d->arg1,a,sizeof(sleftv));
8418  a->Init();
8419  memcpy(&d->arg2,b,sizeof(sleftv));
8420  b->Init();
8421  d->argc=2;
8422  d->op=op;
8423  res->data=(char *)d;
8424  res->rtyp=COMMAND;
8425  return FALSE;
8426  }
8427 #endif
8428  int at=a->Typ();
8429  int bt=b->Typ();
8430  // handling bb-objects ----------------------------------------------------
8431  if (at>MAX_TOK)
8432  {
8433  blackbox *bb=getBlackboxStuff(at);
8434  if (bb!=NULL)
8435  {
8436  if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8437  //else: no op defined, try the default
8438  }
8439  else
8440  return TRUE;
8441  }
8442  else if ((bt>MAX_TOK)&&(op!='('))
8443  {
8444  blackbox *bb=getBlackboxStuff(bt);
8445  if (bb!=NULL)
8446  {
8447  if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8448  // else: no op defined
8449  }
8450  else
8451  return TRUE;
8452  }
8453  int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8454  return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8455  }
8456  a->CleanUp();
8457  b->CleanUp();
8458  return TRUE;
8459 }
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:8233
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 8393 of file iparith.cc.

8397 {
8398  leftv b=a->next;
8399  a->next=NULL;
8400  int bt=b->Typ();
8401  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8402  a->next=b;
8403  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8404  return bo;
8405 }

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

8238 {
8239  memset(res,0,sizeof(sleftv));
8240  BOOLEAN call_failed=FALSE;
8241 
8242  if (!errorreported)
8243  {
8244  int i=0;
8245  iiOp=op;
8246  while (dA2[i].cmd==op)
8247  {
8248  if ((at==dA2[i].arg1)
8249  && (bt==dA2[i].arg2))
8250  {
8251  res->rtyp=dA2[i].res;
8252  if (currRing!=NULL)
8253  {
8254  if (check_valid(dA2[i].valid_for,op)) break;
8255  }
8256  else
8257  {
8258  if (RingDependend(dA2[i].res))
8259  {
8260  WerrorS("no ring active");
8261  break;
8262  }
8263  }
8264  if (traceit&TRACE_CALL)
8265  Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
8266  if ((call_failed=dA2[i].p(res,a,b)))
8267  {
8268  break;// leave loop, goto error handling
8269  }
8270  a->CleanUp();
8271  b->CleanUp();
8272  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8273  return FALSE;
8274  }
8275  i++;
8276  }
8277  // implicite type conversion ----------------------------------------------
8278  if (dA2[i].cmd!=op)
8279  {
8280  int ai,bi;
8283  BOOLEAN failed=FALSE;
8284  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8285  //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
8286  while (dA2[i].cmd==op)
8287  {
8288  //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8289  if ((dA2[i].valid_for & NO_CONVERSION)==0)
8290  {
8291  if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
8292  {
8293  if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
8294  {
8295  res->rtyp=dA2[i].res;
8296  if (currRing!=NULL)
8297  {
8298  if (check_valid(dA2[i].valid_for,op)) break;
8299  }
8300  else
8301  {
8302  if (RingDependend(dA2[i].res))
8303  {
8304  WerrorS("no ring active");
8305  break;
8306  }
8307  }
8308  if (traceit&TRACE_CALL)
8309  Print("call %s(%s,%s)\n",iiTwoOps(op),
8310  Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8311  failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
8312  || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
8313  || (call_failed=dA2[i].p(res,an,bn)));
8314  // everything done, clean up temp. variables
8315  if (failed)
8316  {
8317  // leave loop, goto error handling
8318  break;
8319  }
8320  else
8321  {
8322  // everything ok, clean up and return
8323  an->CleanUp();
8324  bn->CleanUp();
8327  return FALSE;
8328  }
8329  }
8330  }
8331  }
8332  i++;
8333  }
8334  an->CleanUp();
8335  bn->CleanUp();
8338  }
8339  // error handling ---------------------------------------------------
8340  const char *s=NULL;
8341  if (!errorreported)
8342  {
8343  if ((at==0) && (a->Fullname()!=sNoName_fe))
8344  {
8345  s=a->Fullname();
8346  }
8347  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8348  {
8349  s=b->Fullname();
8350  }
8351  if (s!=NULL)
8352  Werror("`%s` is not defined",s);
8353  else
8354  {
8355  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8356  s = iiTwoOps(op);
8357  if (proccall)
8358  {
8359  Werror("%s(`%s`,`%s`) failed"
8360  ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8361  }
8362  else
8363  {
8364  Werror("`%s` %s `%s` failed"
8365  ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8366  }
8367  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8368  {
8369  while (dA2[i].cmd==op)
8370  {
8371  if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8372  && (dA2[i].res!=0)
8373  && (dA2[i].p!=jjWRONG2))
8374  {
8375  if (proccall)
8376  Werror("expected %s(`%s`,`%s`)"
8377  ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8378  else
8379  Werror("expected `%s` %s `%s`"
8380  ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8381  }
8382  i++;
8383  }
8384  }
8385  }
8386  }
8387  a->CleanUp();
8388  b->CleanUp();
8389  res->rtyp = UNKNOWN;
8390  }
8391  return TRUE;
8392 }
#define jjWRONG2
Definition: iparith.cc:3605
short res
Definition: gentable.cc:73

◆ iiExprArith3()

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

Definition at line 8808 of file iparith.cc.

8809 {
8810  memset(res,0,sizeof(sleftv));
8811 
8812  if (!errorreported)
8813  {
8814 #ifdef SIQ
8815  if (siq>0)
8816  {
8817  //Print("siq:%d\n",siq);
8819  memcpy(&d->arg1,a,sizeof(sleftv));
8820  a->Init();
8821  memcpy(&d->arg2,b,sizeof(sleftv));
8822  b->Init();
8823  memcpy(&d->arg3,c,sizeof(sleftv));
8824  c->Init();
8825  d->op=op;
8826  d->argc=3;
8827  res->data=(char *)d;
8828  res->rtyp=COMMAND;
8829  return FALSE;
8830  }
8831 #endif
8832  int at=a->Typ();
8833  // handling bb-objects ----------------------------------------------
8834  if (at>MAX_TOK)
8835  {
8836  blackbox *bb=getBlackboxStuff(at);
8837  if (bb!=NULL)
8838  {
8839  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8840  // else: no op defined
8841  }
8842  else
8843  return TRUE;
8844  if (errorreported) return TRUE;
8845  }
8846  int bt=b->Typ();
8847  int ct=c->Typ();
8848 
8849  iiOp=op;
8850  int i=0;
8851  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8852  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8853  }
8854  a->CleanUp();
8855  b->CleanUp();
8856  c->CleanUp();
8857  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8858  return TRUE;
8859 }
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:8654
const struct sValCmd3 dArith3[]
Definition: table.h:773

◆ iiExprArith3Tab()

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

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

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

Definition at line 8860 of file iparith.cc.

8864 {
8865  leftv b=a->next;
8866  a->next=NULL;
8867  int bt=b->Typ();
8868  leftv c=b->next;
8869  b->next=NULL;
8870  int ct=c->Typ();
8871  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8872  b->next=c;
8873  a->next=b;
8874  a->CleanUp(); // to cleanup the chain, content already done
8875  return bo;
8876 }

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

8657 {
8658  memset(res,0,sizeof(sleftv));
8659  BOOLEAN call_failed=FALSE;
8660 
8661  assume(dA3[0].cmd==op);
8662 
8663  if (!errorreported)
8664  {
8665  int i=0;
8666  iiOp=op;
8667  while (dA3[i].cmd==op)
8668  {
8669  if ((at==dA3[i].arg1)
8670  && (bt==dA3[i].arg2)
8671  && (ct==dA3[i].arg3))
8672  {
8673  res->rtyp=dA3[i].res;
8674  if (currRing!=NULL)
8675  {
8676  if (check_valid(dA3[i].valid_for,op)) break;
8677  }
8678  if (traceit&TRACE_CALL)
8679  Print("call %s(%s,%s,%s)\n",
8680  iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
8681  if ((call_failed=dA3[i].p(res,a,b,c)))
8682  {
8683  break;// leave loop, goto error handling
8684  }
8685  a->CleanUp();
8686  b->CleanUp();
8687  c->CleanUp();
8688  return FALSE;
8689  }
8690  i++;
8691  }
8692  // implicite type conversion ----------------------------------------------
8693  if (dA3[i].cmd!=op)
8694  {
8695  int ai,bi,ci;
8699  BOOLEAN failed=FALSE;
8700  i=0;
8701  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
8702  while (dA3[i].cmd==op)
8703  {
8704  if ((dA3[i].valid_for & NO_CONVERSION)==0)
8705  {
8706  if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
8707  {
8708  if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
8709  {
8710  if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
8711  {
8712  res->rtyp=dA3[i].res;
8713  if (currRing!=NULL)
8714  {
8715  if (check_valid(dA3[i].valid_for,op)) break;
8716  }
8717  if (traceit&TRACE_CALL)
8718  Print("call %s(%s,%s,%s)\n",
8719  iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
8720  Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
8721  failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
8722  || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
8723  || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
8724  || (call_failed=dA3[i].p(res,an,bn,cn)));
8725  // everything done, clean up temp. variables
8726  if (failed)
8727  {
8728  // leave loop, goto error handling
8729  break;
8730  }
8731  else
8732  {
8733  // everything ok, clean up and return
8734  an->CleanUp();
8735  bn->CleanUp();
8736  cn->CleanUp();
8740  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8741  return FALSE;
8742  }
8743  }
8744  }
8745  }
8746  }
8747  i++;
8748  }
8749  an->CleanUp();
8750  bn->CleanUp();
8751  cn->CleanUp();
8755  }
8756  // error handling ---------------------------------------------------
8757  if (!errorreported)
8758  {
8759  const char *s=NULL;
8760  if ((at==0) && (a->Fullname()!=sNoName_fe))
8761  {
8762  s=a->Fullname();
8763  }
8764  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8765  {
8766  s=b->Fullname();
8767  }
8768  else if ((ct==0) && (c->Fullname()!=sNoName_fe))
8769  {
8770  s=c->Fullname();
8771  }
8772  if (s!=NULL)
8773  Werror("`%s` is not defined",s);
8774  else
8775  {
8776  i=0;
8777  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
8778  const char *s = iiTwoOps(op);
8779  Werror("%s(`%s`,`%s`,`%s`) failed"
8780  ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
8781  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8782  {
8783  while (dA3[i].cmd==op)
8784  {
8785  if(((at==dA3[i].arg1)
8786  ||(bt==dA3[i].arg2)
8787  ||(ct==dA3[i].arg3))
8788  && (dA3[i].res!=0))
8789  {
8790  Werror("expected %s(`%s`,`%s`,`%s`)"
8791  ,s,Tok2Cmdname(dA3[i].arg1)
8792  ,Tok2Cmdname(dA3[i].arg2)
8793  ,Tok2Cmdname(dA3[i].arg3));
8794  }
8795  i++;
8796  }
8797  }
8798  }
8799  }
8800  res->rtyp = UNKNOWN;
8801  }
8802  a->CleanUp();
8803  b->CleanUp();
8804  c->CleanUp();
8805  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8806  return TRUE;
8807 }
short res
Definition: gentable.cc:90

◆ iiExprArithM()

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

Definition at line 8898 of file iparith.cc.

8899 {
8900  memset(res,0,sizeof(sleftv));
8901 
8902  if (!errorreported)
8903  {
8904 #ifdef SIQ
8905  if (siq>0)
8906  {
8907  //Print("siq:%d\n",siq);
8909  d->op=op;
8910  res->data=(char *)d;
8911  if (a!=NULL)
8912  {
8913  d->argc=a->listLength();
8914  // else : d->argc=0;
8915  memcpy(&d->arg1,a,sizeof(sleftv));
8916  switch(d->argc)
8917  {
8918  case 3:
8919  memcpy(&d->arg3,a->next->next,sizeof(sleftv));
8920  a->next->next->Init();
8921  /* no break */
8922  case 2:
8923  memcpy(&d->arg2,a->next,sizeof(sleftv));
8924  a->next->Init();
8925  a->next->next=d->arg2.next;
8926  d->arg2.next=NULL;
8927  /* no break */
8928  case 1:
8929  a->Init();
8930  a->next=d->arg1.next;
8931  d->arg1.next=NULL;
8932  }
8933  if (d->argc>3) a->next=NULL;
8934  a->name=NULL;
8935  a->rtyp=0;
8936  a->data=NULL;
8937  a->e=NULL;
8938  a->attribute=NULL;
8939  a->CleanUp();
8940  }
8941  res->rtyp=COMMAND;
8942  return FALSE;
8943  }
8944 #endif
8945  if ((a!=NULL) && (a->Typ()>MAX_TOK))
8946  {
8947  blackbox *bb=getBlackboxStuff(a->Typ());
8948  if (bb!=NULL)
8949  {
8950  if(!bb->blackbox_OpM(op,res,a)) return FALSE;
8951  // else: no op defined
8952  }
8953  else
8954  return TRUE;
8955  if (errorreported) return TRUE;
8956  }
8957  int args=0;
8958  if (a!=NULL) args=a->listLength();
8959 
8960  iiOp=op;
8961  int i=0;
8962  while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
8963  while (dArithM[i].cmd==op)
8964  {
8965  if ((args==dArithM[i].number_of_args)
8966  || (dArithM[i].number_of_args==-1)
8967  || ((dArithM[i].number_of_args==-2)&&(args>0)))
8968  {
8969  res->rtyp=dArithM[i].res;
8970  if (currRing!=NULL)
8971  {
8972  if (check_valid(dArithM[i].valid_for,op)) break;
8973  }
8974  if (traceit&TRACE_CALL)
8975  Print("call %s(... (%d args))\n", iiTwoOps(op),args);
8976  if (dArithM[i].p(res,a))
8977  {
8978  break;// leave loop, goto error handling
8979  }
8980  if (a!=NULL) a->CleanUp();
8981  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8982  return FALSE;
8983  }
8984  i++;
8985  }
8986  // error handling
8987  if (!errorreported)
8988  {
8989  if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
8990  {
8991  Werror("`%s` is not defined",a->Fullname());
8992  }
8993  else
8994  {
8995  const char *s = iiTwoOps(op);
8996  Werror("%s(...) failed",s);
8997  }
8998  }
8999  res->rtyp = UNKNOWN;
9000  }
9001  if (a!=NULL) a->CleanUp();
9002  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9003  return TRUE;
9004 }
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
int listLength()
Definition: subexpr.cc:51
void * data
Definition: subexpr.h:88
Subexpr e
Definition: subexpr.h:105
const char * Name()
Definition: subexpr.h:120
attr attribute
Definition: subexpr.h:89
short res
Definition: gentable.cc:100
const struct sValCmdM dArithM[]
Definition: table.h:898

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9222 of file iparith.cc.

9223 {
9224  //printf("iiInitArithmetic()\n");
9225  memset(&sArithBase, 0, sizeof(sArithBase));
9226  iiInitCmdName();
9227  /* fix last-identifier */
9228 #if 0
9229  /* we expect that gentable allready did every thing */
9232  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9233  }
9234 #endif
9235  //Print("L=%d\n", sArithBase.nLastIdentifier);
9236 
9237  //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9238  //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9239 
9240  //iiArithAddCmd("Top", 0,-1,0);
9241 
9242 
9243  //for(i=0; i<sArithBase.nCmdUsed; i++) {
9244  // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9245  // sArithBase.sCmds[i].name,
9246  // sArithBase.sCmds[i].alias,
9247  // sArithBase.sCmds[i].tokval,
9248  // sArithBase.sCmds[i].toktype);
9249  //}
9250  //iiArithRemoveCmd("Top");
9251  //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9252  //iiArithRemoveCmd("mygcd");
9253  //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9254  return 0;
9255 }

◆ iin_Int()

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

Definition at line 219 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 9106 of file iparith.cc.

9107 {
9108  // user defined types are not in the pre-computed table:
9109  if (op>MAX_TOK) return 0;
9110 
9111  int a=0;
9112  int e=len;
9113  int p=len/2;
9114  do
9115  {
9116  if (op==dArithTab[p].cmd) return dArithTab[p].start;
9117  if (op<dArithTab[p].cmd) e=p-1;
9118  else a = p+1;
9119  p=a+(e-a)/2;
9120  }
9121  while ( a <= e);
9122 
9123  // catch missing a cmd:
9124  // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9125  // Print("op %d (%c) unknown",op,op);
9126  return 0;
9127 }

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 231 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9007 of file iparith.cc.

9008 {
9009  int i;
9010  int an=1;
9011  int en=sArithBase.nLastIdentifier;
9012 
9013  loop
9014  //for(an=0; an<sArithBase.nCmdUsed; )
9015  {
9016  if(an>=en-1)
9017  {
9018  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9019  {
9020  i=an;
9021  break;
9022  }
9023  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9024  {
9025  i=en;
9026  break;
9027  }
9028  else
9029  {
9030  // -- blackbox extensions:
9031  // return 0;
9032  return blackboxIsCmd(n,tok);
9033  }
9034  }
9035  i=(an+en)/2;
9036  if (*n < *(sArithBase.sCmds[i].name))
9037  {
9038  en=i-1;
9039  }
9040  else if (*n > *(sArithBase.sCmds[i].name))
9041  {
9042  an=i+1;
9043  }
9044  else
9045  {
9046  int v=strcmp(n,sArithBase.sCmds[i].name);
9047  if(v<0)
9048  {
9049  en=i-1;
9050  }
9051  else if(v>0)
9052  {
9053  an=i+1;
9054  }
9055  else /*v==0*/
9056  {
9057  break;
9058  }
9059  }
9060  }
9062  tok=sArithBase.sCmds[i].tokval;
9063  if(sArithBase.sCmds[i].alias==2)
9064  {
9065  Warn("outdated identifier `%s` used - please change your code",
9066  sArithBase.sCmds[i].name);
9067  sArithBase.sCmds[i].alias=1;
9068  }
9069  #if 0
9070  if (currRingHdl==NULL)
9071  {
9072  #ifdef SIQ
9073  if (siq<=0)
9074  {
9075  #endif
9076  if ((tok>=BEGIN_RING) && (tok<=END_RING))
9077  {
9078  WerrorS("no ring active");
9079  return 0;
9080  }
9081  #ifdef SIQ
9082  }
9083  #endif
9084  }
9085  #endif
9086  if (!expected_parms)
9087  {
9088  switch (tok)
9089  {
9090  case IDEAL_CMD:
9091  case INT_CMD:
9092  case INTVEC_CMD:
9093  case MAP_CMD:
9094  case MATRIX_CMD:
9095  case MODUL_CMD:
9096  case POLY_CMD:
9097  case PROC_CMD:
9098  case RING_CMD:
9099  case STRING_CMD:
9100  cmdtok = tok;
9101  break;
9102  }
9103  }
9104  return sArithBase.sCmds[i].toktype;
9105 }
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:201
@ 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:212
EXTERN_VAR int cmdtok
Definition: iparith.cc:211
VAR idhdl currRingHdl
Definition: ipid.cc:59
const char * lastreserved
Definition: ipshell.cc:78
@ INTVEC_CMD
Definition: tok.h:101
@ STRING_CMD
Definition: tok.h:184
@ 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  }
1788  id_Shift(M,s,currRing);
1789  res->data=M;
1790  return FALSE;
1791 }
void * CopyD(int t)
Definition: subexpr.cc:739
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:312
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:4612
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860

◆ jjAND_I()

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

Definition at line 1379 of file iparith.cc.

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

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3717 of file iparith.cc.

3718 {
3719  //matrix m=(matrix)v->Data();
3720  //lists l=mpBareiss(m,FALSE);
3721  intvec *iv;
3722  ideal m;
3723  sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3725  l->Init(2);
3726  l->m[0].rtyp=MODUL_CMD;
3727  l->m[1].rtyp=INTVEC_CMD;
3728  l->m[0].data=(void *)m;
3729  l->m[1].data=(void *)iv;
3730  res->data = (char *)l;
3731  return FALSE;
3732 }
int m
Definition: cfEzgcd.cc:121
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 5867 of file iparith.cc.

5868 {
5869  intvec *iv;
5870  ideal m;
5872  int k=(int)(long)w->Data();
5873  if (k>=0)
5874  {
5875  sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
5876  l->Init(2);
5877  l->m[0].rtyp=MODUL_CMD;
5878  l->m[1].rtyp=INTVEC_CMD;
5879  l->m[0].data=(void *)m;
5880  l->m[1].data=(void *)iv;
5881  }
5882  else
5883  {
5884  m=sm_CallSolv((ideal)u->Data(), currRing);
5885  l->Init(1);
5886  l->m[0].rtyp=IDEAL_CMD;
5887  l->m[0].data=(void *)m;
5888  }
5889  res->data = (char *)l;
5890  return FALSE;
5891 }
int k
Definition: cfEzgcd.cc:92
const CanonicalForm & w
Definition: facAbsFact.cc:55
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 3740 of file iparith.cc.

3741 {
3742  bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3743  b->hnf();
3744  res->data=(char*)b;
3745  return FALSE;
3746 }
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 3762 of file iparith.cc.

3763 {
3764  bigintmat *b=(bigintmat*)u->Data();
3765  res->data=(void *)bim2iv(b);
3766  return FALSE;
3767 }
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3747 of file iparith.cc.

3748 {
3749  BOOLEAN bo=FALSE;
3750  number n=(number)u->CopyD();
3752  if (nMap!=NULL)
3753  res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3754  else
3755  {
3756  Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3757  bo=TRUE;
3758  }
3759  n_Delete(&n,coeffs_BIGINT);
3760  return bo;
3761 }
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:985
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:721
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
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 3768 of file iparith.cc.

3769 {
3770  sleftv tmp;
3771  BOOLEAN bo=jjBI2N(&tmp,u);
3772  if (!bo)
3773  {
3774  number n=(number) tmp.data;
3775  if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3776  else
3777  {
3778  res->data=(void *)pNSet(n);
3779  }
3780  }
3781  return bo;
3782 }
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3747
if(yy_init)
Definition: libparse.cc:1420
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define pNSet(n)
Definition: polys.h:309

◆ jjBRACK_Bim()

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

Definition at line 5611 of file iparith.cc.

5612 {
5613  bigintmat *bim = (bigintmat *)u->Data();
5614  int r = (int)(long)v->Data();
5615  int c = (int)(long)w->Data();
5616  if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5617  {
5618  Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5619  r,c,u->Fullname(),bim->rows(),bim->cols());
5620  return TRUE;
5621  }
5622  res->data=u->data; u->data=NULL;
5623  res->rtyp=u->rtyp; u->rtyp=0;
5624  res->name=u->name; u->name=NULL;
5625  Subexpr e=jjMakeSub(v);
5626  e->next=jjMakeSub(w);
5627  if (u->e==NULL)
5628  res->e=e;
5629  else
5630  {
5631  Subexpr h=u->e;
5632  while (h->next!=NULL) h=h->next;
5633  h->next=e;
5634  res->e=u->e;
5635  u->e=NULL;
5636  }
5637  return FALSE;
5638 }
int cols() const
Definition: bigintmat.h:144
int rows() const
Definition: bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:8200
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 5584 of file iparith.cc.

5585 {
5586  intvec *iv = (intvec *)u->Data();
5587  int r = (int)(long)v->Data();
5588  int c = (int)(long)w->Data();
5589  if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5590  {
5591  Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5592  r,c,u->Fullname(),iv->rows(),iv->cols());
5593  return TRUE;
5594  }
5595  res->data=u->data; u->data=NULL;
5596  res->rtyp=u->rtyp; u->rtyp=0;
5597  res->name=u->name; u->name=NULL;
5598  Subexpr e=jjMakeSub(v);
5599  e->next=jjMakeSub(w);
5600  if (u->e==NULL) res->e=e;
5601  else
5602  {
5603  Subexpr h=u->e;
5604  while (h->next!=NULL) h=h->next;
5605  h->next=e;
5606  res->e=u->e;
5607  u->e=NULL;
5608  }
5609  return FALSE;
5610 }
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 5639 of file iparith.cc.

5640 {
5641  matrix m= (matrix)u->Data();
5642  int r = (int)(long)v->Data();
5643  int c = (int)(long)w->Data();
5644  //Print("gen. elem %d, %d\n",r,c);
5645  if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5646  {
5647  Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5648  MATROWS(m),MATCOLS(m));
5649  return TRUE;
5650  }
5651  res->data=u->data; u->data=NULL;
5652  res->rtyp=u->rtyp; u->rtyp=0;
5653  res->name=u->name; u->name=NULL;
5654  Subexpr e=jjMakeSub(v);
5655  e->next=jjMakeSub(w);
5656  if (u->e==NULL)
5657  res->e=e;
5658  else
5659  {
5660  Subexpr h=u->e;
5661  while (h->next!=NULL) h=h->next;
5662  h->next=e;
5663  res->e=u->e;
5664  u->e=NULL;
5665  }
5666  return FALSE;
5667 }
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 5697 of file iparith.cc.

5698 {
5699  sleftv t;
5700  sleftv ut;
5701  leftv p=NULL;
5702  intvec *iv=(intvec *)w->Data();
5703  int l;
5704  BOOLEAN nok;
5705 
5706  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5707  {
5708  WerrorS("cannot build expression lists from unnamed objects");
5709  return TRUE;
5710  }
5711  memcpy(&ut,u,sizeof(ut));
5712  memset(&t,0,sizeof(t));
5713  t.rtyp=INT_CMD;
5714  for (l=0;l< iv->length(); l++)
5715  {
5716  t.data=(char *)(long)((*iv)[l]);
5717  if (p==NULL)
5718  {
5719  p=res;
5720  }
5721  else
5722  {
5723  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5724  p=p->next;
5725  }
5726  memcpy(u,&ut,sizeof(ut));
5727  if (u->Typ() == MATRIX_CMD)
5728  nok=jjBRACK_Ma(p,u,v,&t);
5729  else if (u->Typ() == BIGINTMAT_CMD)
5730  nok=jjBRACK_Bim(p,u,v,&t);
5731  else /* INTMAT_CMD */
5732  nok=jjBRACK_Im(p,u,v,&t);
5733  if (nok)
5734  {
5735  while (res->next!=NULL)
5736  {
5737  p=res->next->next;
5738  omFreeBin((ADDRESS)res->next, sleftv_bin);
5739  // res->e aufraeumen !!!!
5740  res->next=p;
5741  }
5742  return TRUE;
5743  }
5744  }
5745  return FALSE;
5746 }
int length() const
Definition: intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5611
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5584
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5639
#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 5747 of file iparith.cc.

5748 {
5749  sleftv t;
5750  sleftv ut;
5751  leftv p=NULL;
5752  intvec *iv=(intvec *)v->Data();
5753  int l;
5754  BOOLEAN nok;
5755 
5756  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5757  {
5758  WerrorS("cannot build expression lists from unnamed objects");
5759  return TRUE;
5760  }
5761  memcpy(&ut,u,sizeof(ut));
5762  memset(&t,0,sizeof(t));
5763  t.rtyp=INT_CMD;
5764  for (l=0;l< iv->length(); l++)
5765  {
5766  t.data=(char *)(long)((*iv)[l]);
5767  if (p==NULL)
5768  {
5769  p=res;
5770  }
5771  else
5772  {
5773  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5774  p=p->next;
5775  }
5776  memcpy(u,&ut,sizeof(ut));
5777  if (u->Typ() == MATRIX_CMD)
5778  nok=jjBRACK_Ma(p,u,&t,w);
5779  else if (u->Typ() == BIGINTMAT_CMD)
5780  nok=jjBRACK_Bim(p,u,&t,w);
5781  else /* INTMAT_CMD */
5782  nok=jjBRACK_Im(p,u,&t,w);
5783  if (nok)
5784  {
5785  while (res->next!=NULL)
5786  {
5787  p=res->next->next;
5788  omFreeBin((ADDRESS)res->next, sleftv_bin);
5789  // res->e aufraeumen !!
5790  res->next=p;
5791  }
5792  return TRUE;
5793  }
5794  }
5795  return FALSE;
5796 }

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5797 of file iparith.cc.

5798 {
5799  sleftv t1,t2,ut;
5800  leftv p=NULL;
5801  intvec *vv=(intvec *)v->Data();
5802  intvec *wv=(intvec *)w->Data();
5803  int vl;
5804  int wl;
5805  BOOLEAN nok;
5806 
5807  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5808  {
5809  WerrorS("cannot build expression lists from unnamed objects");
5810  return TRUE;
5811  }
5812  memcpy(&ut,u,sizeof(ut));
5813  memset(&t1,0,sizeof(sleftv));
5814  memset(&t2,0,sizeof(sleftv));
5815  t1.rtyp=INT_CMD;
5816  t2.rtyp=INT_CMD;
5817  for (vl=0;vl< vv->length(); vl++)
5818  {
5819  t1.data=(char *)(long)((*vv)[vl]);
5820  for (wl=0;wl< wv->length(); wl++)
5821  {
5822  t2.data=(char *)(long)((*wv)[wl]);
5823  if (p==NULL)
5824  {
5825  p=res;
5826  }
5827  else
5828  {
5829  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5830  p=p->next;
5831  }
5832  memcpy(u,&ut,sizeof(ut));
5833  if (u->Typ() == MATRIX_CMD)
5834  nok=jjBRACK_Ma(p,u,&t1,&t2);
5835  else if (u->Typ() == BIGINTMAT_CMD)
5836  nok=jjBRACK_Bim(p,u,&t1,&t2);
5837  else /* INTMAT_CMD */
5838  nok=jjBRACK_Im(p,u,&t1,&t2);
5839  if (nok)
5840  {
5841  res->CleanUp();
5842  return TRUE;
5843  }
5844  }
5845  }
5846  return FALSE;
5847 }

◆ jjBRACK_S()

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

Definition at line 5568 of file iparith.cc.

5569 {
5570  char *s= (char *)u->Data();
5571  int r = (int)(long)v->Data();
5572  int c = (int)(long)w->Data();
5573  int l = strlen(s);
5574 
5575  if ( (r<1) || (r>l) || (c<0) )
5576  {
5577  Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5578  return TRUE;
5579  }
5580  res->data = (char *)omAlloc((long)(c+1));
5581  sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5582  return FALSE;
5583 }
#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 5668 of file iparith.cc.

5669 {
5670  ideal m= (ideal)u->Data();
5671  int r = (int)(long)v->Data();
5672  int c = (int)(long)w->Data();
5673  //Print("gen. elem %d, %d\n",r,c);
5674  if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5675  {
5676  Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5677  (int)m->rank,IDELEMS(m));
5678  return TRUE;
5679  }
5680  res->data=u->data; u->data=NULL;
5681  res->rtyp=u->rtyp; u->rtyp=0;
5682  res->name=u->name; u->name=NULL;
5683  Subexpr e=jjMakeSub(v);
5684  e->next=jjMakeSub(w);
5685  if (u->e==NULL)
5686  res->e=e;
5687  else
5688  {
5689  Subexpr h=u->e;
5690  while (h->next!=NULL) h=h->next;
5691  h->next=e;
5692  res->e=u->e;
5693  u->e=NULL;
5694  }
5695  return FALSE;
5696 }

◆ jjBRACKET()

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

Definition at line 2873 of file iparith.cc.

2874 {
2875  res->data=NULL;
2876 
2878  {
2879  const poly q = (poly)b->Data();
2880 
2881  if( q != NULL )
2882  {
2883  if( (poly)a->Data() != NULL )
2884  {
2885  if (rIsPluralRing(currRing))
2886  {
2887  poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2888  res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2889  }
2890  else if (rIsLPRing(currRing))
2891  {
2892  const poly p = (poly)a->Data();
2893  res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2894  }
2895  }
2896  }
2897  }
2898  return FALSE;
2899 }
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
#define pAdd(p, q)
Definition: polys.h:199
#define pNeg(p)
Definition: polys.h:194
#define ppMult_qq(p, q)
Definition: polys.h:204

◆ jjBRACKET_REC()

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

Definition at line 2900 of file iparith.cc.

2901 {
2902  res->data=NULL;
2903 
2905  {
2906  const poly q = (poly)b->Data();
2907  if(q != NULL)
2908  {
2909  if((poly)a->Data() != NULL)
2910  {
2911  const poly p = (poly)a->Data();
2912  int k=(int)(long)c->Data();
2913  if (k > 0)
2914  {
2915  poly qq = pCopy(q);
2916  for (int i = 0; i < k; i++)
2917  {
2918  poly qq_ref = qq;
2919  if (rIsLPRing(currRing))
2920  {
2921  qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
2922  }
2923  else if (rIsPluralRing(currRing))
2924  {
2925  qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
2926  }
2927  pDelete(&qq_ref);
2928  if (qq == NULL) break;
2929  }
2930  res->data = qq;
2931  }
2932  else
2933  {
2934  Werror("invalid number of iterations");
2935  }
2936  }
2937  }
2938  }
2939  return FALSE;
2940 }
#define pDelete(p_ptr)
Definition: polys.h:182
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 6826 of file iparith.cc.

6827 {
6828 #ifdef HAVE_SDB
6829  sdb_show_bp();
6830 #endif
6831  return FALSE;
6832 }
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 6833 of file iparith.cc.

6834 {
6835 #ifdef HAVE_SDB
6836  if(v->Typ()==PROC_CMD)
6837  {
6838  int lineno=0;
6839  if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
6840  {
6841  lineno=(int)(long)v->next->Data();
6842  }
6843  return sdb_set_breakpoint(v->Name(),lineno);
6844  }
6845  return TRUE;
6846 #else
6847  return FALSE;
6848 #endif
6849 }
Variable next() const
Definition: factory.h:137
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 6850 of file iparith.cc.

6851 {
6852  return iiExprArith1(res,v,iiOp);
6853 }

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3783 of file iparith.cc.

3784 {
3785  return iiExprArithM(res,u,iiOp);
3786 }
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8898

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 6854 of file iparith.cc.

6855 {
6856  leftv v=u->next;
6857  u->next=NULL;
6858  BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
6859  u->next=v;
6860  return b;
6861 }
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8406

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 6862 of file iparith.cc.

6863 {
6864  leftv v = u->next;
6865  leftv w = v->next;
6866  u->next = NULL;
6867  v->next = NULL;
6868  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
6869  u->next = v;
6870  v->next = w;
6871  return b;
6872 }
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8808

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3787 of file iparith.cc.

3788 {
3789  res->data = (char *)(long)rChar((ring)v->Data());
3790  return FALSE;
3791 }
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);
1700  n_Delete(&(x[i]),coeffs_BIGINT);
1701  }
1702  omFree(x); omFree(q);
1703  res->data=(char *)n;
1704  return FALSE;
1705 }
Variable x
Definition: cfModGcd.cc:4023
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:786
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538

◆ jjCHINREM_ID()

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

Definition at line 9464 of file iparith.cc.

9465 {
9466  if ((currRing!=NULL)
9468  && (!rField_is_Z(currRing)))
9469  {
9470  WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
9471  return TRUE;
9472  }
9473  coeffs cf;
9474  lists c=(lists)u->CopyD(); // list of ideal or bigint/int
9475  int rl=c->nr+1;
9476  int return_type=c->m[0].Typ();
9477  if ((return_type!=IDEAL_CMD)
9478  && (return_type!=MODUL_CMD)
9479  && (return_type!=MATRIX_CMD)
9480  && (return_type!=POLY_CMD))
9481  {
9482  if((return_type==BIGINT_CMD)
9483  ||(return_type==INT_CMD))
9484  return_type=BIGINT_CMD;
9485  else if (return_type==LIST_CMD)
9486  {
9487  // create a tmp list of the correct size
9488  lists res_l=(lists)omAllocBin(slists_bin);
9489  res_l->Init(rl /*c->nr+1*/);
9490  BOOLEAN bo=FALSE;
9491  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
9492  for (unsigned i=0;i<=(unsigned)c->nr;i++)
9493  {
9494  sleftv tmp;
9495  tmp.Copy(v);
9496  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9497  if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
9498  }
9499  c->Clean();
9500  res->data=res_l;
9501  res->rtyp=LIST_CMD;
9502  return bo;
9503  }
9504  else
9505  {
9506  c->Clean();
9507  WerrorS("poly/ideal/module/matrix/list expected");
9508  return TRUE;
9509  }
9510  }
9511  if (return_type==BIGINT_CMD)
9512  cf=coeffs_BIGINT;
9513  else
9514  {
9515  cf=currRing->cf;
9516  if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
9517  cf=cf->extRing->cf;
9518  }
9519  lists pl=NULL;
9520  intvec *p=NULL;
9521  if (v->Typ()==LIST_CMD) pl=(lists)v->Data();
9522  else p=(intvec*)v->Data();
9523  ideal result;
9524  ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
9525  number *xx=NULL;
9527  int i;
9528  if (return_type!=BIGINT_CMD)
9529  {
9530  for(i=rl-1;i>=0;i--)
9531  {
9532  if (c->m[i].Typ()!=return_type)
9533  {
9534  Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
9535  omFree(x); // delete c
9536  return TRUE;
9537  }
9538  if (return_type==POLY_CMD)
9539  {
9540  x[i]=idInit(1,1);
9541  x[i]->m[0]=(poly)c->m[i].CopyD();
9542  }
9543  else
9544  {
9545  x[i]=(ideal)c->m[i].CopyD();
9546  }
9547  //c->m[i].Init();
9548  }
9549  }
9550  else
9551  {
9552  if (nMap==NULL)
9553  {
9554  Werror("not implemented: map bigint -> %s", nCoeffName(cf));
9555  return TRUE;
9556  }
9557  xx=(number *)omAlloc(rl*sizeof(number));
9558  for(i=rl-1;i>=0;i--)
9559  {
9560  if (c->m[i].Typ()==INT_CMD)
9561  {
9562  xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
9563  }
9564  else if (c->m[i].Typ()==BIGINT_CMD)
9565  {
9566  xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
9567  }
9568  else
9569  {
9570  Werror("bigint expected at pos %d",i+1);
9571  omFree(x); // delete c
9572  omFree(xx); // delete c
9573  return TRUE;
9574  }
9575  }
9576  }
9577  number *q=(number *)omAlloc(rl*sizeof(number));
9578  if (p!=NULL)
9579  {
9580  for(i=rl-1;i>=0;i--)
9581  {
9582  q[i]=n_Init((*p)[i], cf);
9583  }
9584  }
9585  else
9586  {
9587  for(i=rl-1;i>=0;i--)
9588  {
9589  if (pl->m[i].Typ()==INT_CMD)
9590  {
9591  q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
9592  }
9593  else if (pl->m[i].Typ()==BIGINT_CMD)
9594  {
9595  q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
9596  }
9597  else
9598  {
9599  Werror("bigint expected at pos %d",i+1);
9600  for(i++;i<rl;i++)
9601  {
9602  n_Delete(&(q[i]),cf);
9603  }
9604  omFree(x); // delete c
9605  omFree(q); // delete pl
9606  if (xx!=NULL) omFree(xx); // delete c
9607  return TRUE;
9608  }
9609  }
9610  }
9611  if (return_type==BIGINT_CMD)
9612  {
9613  CFArray i_v(rl);
9614  number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
9615  res->data=(char *)n;
9616  }
9617  else
9618  {
9619  result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
9620  c->Clean();
9621  if ((return_type==POLY_CMD) &&(result!=NULL))
9622  {
9623  res->data=(char *)result->m[0];
9624  result->m[0]=NULL;
9625  idDelete(&result);
9626  }
9627  else
9628  res->data=(char *)result;
9629  }
9630  for(i=rl-1;i>=0;i--)
9631  {
9632  n_Delete(&(q[i]),cf);
9633  }
9634  omFree(q);
9635  res->rtyp=return_type;
9636  return result==NULL;
9637 }
void Copy(leftv e)
Definition: subexpr.cc:714
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:868
return result
Definition: facAbsBiFact.cc:76
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:504
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:399
#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:476

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 6874 of file iparith.cc.

6875 {
6876  const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
6877  if (iiCheckTypes(v,t,1))
6878  {
6879  idhdl c=(idhdl)v->next->next->data;
6880  if (v->next->next->next->rtyp!=IDHDL) return TRUE;
6881  idhdl m=(idhdl)v->next->next->next->data;
6882  idDelete((ideal *)&(c->data.uideal));
6883  idDelete((ideal *)&(m->data.uideal));
6884  mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
6885  (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
6886  return FALSE;
6887  }
6888  return TRUE;
6889 }
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:6551
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition: matpol.cc:581
idrec * idhdl
Definition: ring.h:21

◆ jjCOEFFS2_KB()

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

Definition at line 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:2496
#define pSetm(p)
Definition: polys.h:267
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 5892 of file iparith.cc.

5893 {
5894  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5895  {
5896  WerrorS("3rd argument must be a name of a matrix");
5897  return TRUE;
5898  }
5899  ideal i=(ideal)u->Data();
5900  int rank=(int)i->rank;
5901  BOOLEAN r=jjCOEFFS_Id(res,u,v);
5902  if (r) return TRUE;
5903  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
5904  return FALSE;
5905 }
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:362
#define pVar(m)
Definition: polys.h:377

◆ jjCOEFFS3_KB()

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

Definition at line 5906 of file iparith.cc.

5907 {
5908  res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
5909  (ideal)(v->Data()),(poly)(w->Data()));
5910  return FALSE;
5911 }

◆ jjCOEFFS3_P()

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

Definition at line 5912 of file iparith.cc.

5913 {
5914  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5915  {
5916  WerrorS("3rd argument must be a name of a matrix");
5917  return TRUE;
5918  }
5919  // CopyD for POLY_CMD and VECTOR_CMD are identical:
5920  poly p=(poly)u->CopyD(POLY_CMD);
5921  ideal i=idInit(1,1);
5922  i->m[0]=p;
5923  sleftv t;
5924  memset(&t,0,sizeof(t));
5925  t.data=(char *)i;
5926  t.rtyp=IDEAL_CMD;
5927  int rank=1;
5928  if (u->Typ()==VECTOR_CMD)
5929  {
5930  i->rank=rank=pMaxComp(p);
5931  t.rtyp=MODUL_CMD;
5932  }
5933  BOOLEAN r=jjCOEFFS_Id(res,&t,v);
5934  t.CleanUp();
5935  if (r) return TRUE;
5936  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
5937  return FALSE;
5938 }
#define pMaxComp(p)
Definition: polys.h:295

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

◆ 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  memset(v, 0, sizeof(sleftv));
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
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4346
#define IDPACKAGE(a)
Definition: ipid.h:134
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition: iplib.cc:765
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1578
@ 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 321 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3792 of file iparith.cc.

3793 {
3794  res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3795  return FALSE;
3796 }

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3797 of file iparith.cc.

3798 {
3799  res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3800  return FALSE;
3801 }

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3802 of file iparith.cc.

3803 {
3804  res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3805  return FALSE;
3806 }

◆ jjCOMPARE_ALL()

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

Definition at line 9657 of file iparith.cc.

9658 {
9659  leftv a=(leftv)aa;
9660  int at=a->Typ();
9661  leftv b=(leftv)bb;
9662  int bt=b->Typ();;
9663  if (at < bt) return -1;
9664  if (at > bt) return 1;
9665  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
9666  sleftv tmp;
9667  memset(&tmp,0,sizeof(sleftv));
9668  iiOp='<';
9669  BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
9670  if (bo)
9671  {
9672  Werror(" no `<` for %s",Tok2Cmdname(at));
9673  unsigned long ad=(unsigned long)a->Data();
9674  unsigned long bd=(unsigned long)b->Data();
9675  if (ad<bd) return -1;
9676  else if (ad==bd) return 0;
9677  else return 1;
9678  }
9679  else if (tmp.data==NULL) /* not < */
9680  {
9681  iiOp=EQUAL_EQUAL;
9682  tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
9683  bo=iiExprArith2TabIntern(&tmp,a,EQUAL_EQUAL,b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
9684  if (bo)
9685  {
9686  Werror(" no `==` for %s",Tok2Cmdname(at));
9687  unsigned long ad=(unsigned long)a->Data();
9688  unsigned long bd=(unsigned long)b->Data();
9689  if (ad<bd) return -1;
9690  else if (ad==bd) return 0;
9691  else return 1;
9692  }
9693  else if (tmp.data==NULL) /* not <,== */ return 1;
9694  else return 0;
9695  }
9696  else return -1;
9697 }
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 368 of file iparith.cc.

369 {
370  bigintmat* a = (bigintmat * )(u->Data());
371  bigintmat* b = (bigintmat * )(v->Data());
372  int r=a->compare(b);
373  switch (iiOp)
374  {
375  case '<':
376  res->data = (char *) (r<0);
377  break;
378  case '>':
379  res->data = (char *) (r>0);
380  break;
381  case LE:
382  res->data = (char *) (r<=0);
383  break;
384  case GE:
385  res->data = (char *) (r>=0);
386  break;
387  case EQUAL_EQUAL:
388  case NOTEQUAL: /* negation handled by jjEQUAL_REST */
389  res->data = (char *) (r==0);
390  break;
391  }
392  jjEQUAL_REST(res,u,v);
393  if(r==-2) { WerrorS("size incompatible"); return TRUE; }
394  return FALSE;
395 }
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:1366

◆ jjCOMPARE_IV()

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

Definition at line 340 of file iparith.cc.

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

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

◆ jjCOMPARE_MA()

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

Definition at line 423 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 451 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 478 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3807 of file iparith.cc.

3808 {
3809  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3810  poly p=(poly)v->CopyD(POLY_CMD);
3811  if (p!=NULL) p_Cleardenom(p, currRing);
3812  res->data = (char *)p;
3813  return FALSE;
3814 }
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2791

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

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3815 of file iparith.cc.

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

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3820 of file iparith.cc.

3821 {
3822  bigintmat* aa= (bigintmat *)v->Data();
3823  res->data = (char *)(long)(aa->rows()*aa->cols());
3824  return FALSE;
3825 }

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3843 of file iparith.cc.

3844 {
3845  res->data = (char *)(long)((intvec*)(v->Data()))->length();
3846  return FALSE;
3847 }

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3831 of file iparith.cc.

3832 {
3833  lists l=(lists)v->Data();
3834  res->data = (char *)(long)(lSize(l)+1);
3835  return FALSE;
3836 }
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3837 of file iparith.cc.

3838 {
3839  matrix m=(matrix)v->Data();
3840  res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3841  return FALSE;
3842 }

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3826 of file iparith.cc.

3827 {
3828  res->data = (char *)(long)nSize((number)v->Data());
3829  return FALSE;
3830 }

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5537 of file iparith.cc.

5538 {
5539  res->data=(char *)(long)sySize((syStrategy)v->Data());
5540  return FALSE;
5541 }
int sySize(syStrategy syzstr)
Definition: syz1.cc:1829

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3848 of file iparith.cc.

3849 {
3850  ring r=(ring)v->Data();
3851  int elems=-1;
3852  if (rField_is_Zp(r)) elems=r->cf->ch;
3853  else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3854  else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3855  {
3856  extern int ipower ( int b, int n ); /* factory/cf_util */
3857  elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3858  }
3859  res->data = (char *)(long)elems;
3860  return FALSE;
3861 }
int ipower(int b, int m)
int ipower ( int b, int m )
Definition: cf_util.cc:26
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:524
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:516

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3900 of file iparith.cc.

3901 {
3902  if ((v->rtyp==IDHDL)
3903  && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
3904  {
3905  res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
3906  }
3907  else if (v->rtyp!=0) res->data=(void *)(-1);
3908  return FALSE;
3909 }
#define IDLEV(a)
Definition: ipid.h:116

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3862 of file iparith.cc.

3863 {
3864  int dummy;
3865  poly p=(poly)v->Data();
3866  if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3867  else res->data=(char *)-1;
3868  return FALSE;
3869 }

◆ 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  short *iv=iv2array((intvec *)v->Data(),currRing);
1854  const long d = p_DegW(p,iv,currRing);
1855  omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(short) );
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 short *w, const ring R)
Definition: p_polys.cc:680
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:587
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:200

◆ jjDEG_M()

static BOOLEAN jjDEG_M ( leftv  res,
leftv  u 
)
static

Definition at line 3870 of file iparith.cc.

3871 {
3872  ideal I=(ideal)u->Data();
3873  int d=-1;
3874  int dummy;
3875  int i;
3876  for(i=IDELEMS(I)-1;i>=0;i--)
3877  if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3878  res->data = (char *)(long)d;
3879  return FALSE;
3880 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:140

◆ 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  short *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(short) );
1845  res->data = (char *)((long)d);
1846  return FALSE;
1847 }

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3881 of file iparith.cc.

3882 {
3883  SPrintStart();
3884 #ifdef HAVE_RINGS
3885  if (rField_is_Z(currRing))
3886  {
3887  PrintS("// NOTE: computation of degree is being performed for\n");
3888  PrintS("// generic fibre, that is, over Q\n");
3889  }
3890 #endif
3891  assumeStdFlag(v);
3892  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3893  scDegree((ideal)v->Data(),module_w,currRing->qideal);
3894  char *s=SPrintEnd();
3895  int l=strlen(s)-1;
3896  s[l]='\0';
3897  res->data=(void*)s;
3898  return FALSE;
3899 }
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:129
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:821
void SPrintStart()
Definition: reporter.cc:246
char * SPrintEnd()
Definition: reporter.cc:273
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1552

◆ 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_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:824

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

Return the denominator of the input number NOTE: the input number is normalized as a side effect.

Definition at line 3913 of file iparith.cc.

3914 {
3915  number n = reinterpret_cast<number>(v->Data());
3916  res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
3917  return FALSE;
3918 }
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:603

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 3929 of file iparith.cc.

3930 {
3931  matrix m=(matrix)v->Data();
3932  res ->data = mp_Det(m,currRing);
3933  return FALSE;
3934 }
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition: matpol.cc:2143

◆ jjDET2()

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

Definition at line 1876 of file iparith.cc.

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

◆ jjDET2_S()

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

Definition at line 1883 of file iparith.cc.

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

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3935 of file iparith.cc.

3936 {
3937  bigintmat * m=(bigintmat*)v->Data();
3938  int i,j;
3939  i=m->rows();j=m->cols();
3940  if(i==j)
3941  res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
3942  else
3943  {
3944  Werror("det of %d x %d bigintmat",i,j);
3945  return TRUE;
3946  }
3947  return FALSE;
3948 }
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1680
int j
Definition: facHensel.cc:105

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 3971 of file iparith.cc.

3972 {
3973  intvec * m=(intvec*)v->Data();
3974  int i,j;
3975  i=m->rows();j=m->cols();
3976  if(i==j)
3977  res->data = (char *)(long)singclap_det_i(m,currRing);
3978  else
3979  {
3980  Werror("det of %d x %d intmat",i,j);
3981  return TRUE;
3982  }
3983  return FALSE;
3984 }
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1662

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 3985 of file iparith.cc.

3986 {
3987  ideal I=(ideal)v->Data();
3988  res->data=(char*)sm_Det(I,currRing);
3989  return FALSE;
3990 }

◆ jjDIFF_COEF()

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

Definition at line 4404 of file iparith.cc.

4405 {
4406  if (!nCoeff_is_transExt(currRing->cf))
4407  {
4408  WerrorS("differentiation not defined in the coefficient ring");
4409  return TRUE;
4410  }
4411  number n = (number) u->Data();
4412  number k = (number) v->Data();
4413  res->data = ntDiff(n,k,currRing->cf);
4414  return FALSE;
4415 }
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:940
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 1901 of file iparith.cc.

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

◆ jjDIFF_ID_ID()

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

Definition at line 1912 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1890 of file iparith.cc.

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

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 3991 of file iparith.cc.

3992 {
3993  assumeStdFlag(v);
3995  {
3996  Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
3997  }
3998 #ifdef HAVE_RINGS
3999  if (rField_is_Ring(currRing))
4000  {
4001  ideal vid = (ideal)v->Data();
4002  int i = idPosConstant(vid);
4003  if ((i != -1) && (n_IsUnit(pGetCoeff(vid->m[i]),currRing->cf)))
4004  { /* ideal v contains unit; dim = -1 */
4005  res->data = (char *)-1L;
4006  return FALSE;
4007  }
4008  ideal vv = id_Head(vid,currRing);
4009  idSkipZeroes(vv);
4010  int j = idPosConstant(vv);
4011  long d;
4012  if(j == -1)
4013  {
4014  d = (long)scDimInt(vv, currRing->qideal);
4015  if(rField_is_Z(currRing))
4016  d++;
4017  }
4018  else
4019  {
4020  if(n_IsUnit(pGetCoeff(vv->m[j]),currRing->cf))
4021  d = -1;
4022  else
4023  d = (long)scDimInt(vv, currRing->qideal);
4024  }
4025  //Anne's Idea for std(4,2x) = 0 bug
4026  long dcurr = d;
4027  for(unsigned ii=0;ii<(unsigned)IDELEMS(vv);ii++)
4028  {
4029  if(vv->m[ii] != NULL && !n_IsUnit(pGetCoeff(vv->m[ii]),currRing->cf))
4030  {
4031  ideal vc = idCopy(vv);
4032  poly c = pInit();
4033  pSetCoeff0(c,nCopy(pGetCoeff(vv->m[ii])));
4034  idInsertPoly(vc,c);
4035  idSkipZeroes(vc);
4036  for(unsigned jj = 0;jj<(unsigned)IDELEMS(vc)-1;jj++)
4037  {
4038  if((vc->m[jj]!=NULL)
4039  && (n_DivBy(pGetCoeff(vc->m[jj]),pGetCoeff(c),currRing->cf)))
4040  {
4041  pDelete(&vc->m[jj]);
4042  }
4043  }
4044  idSkipZeroes(vc);
4045  j = idPosConstant(vc);
4046  if (j != -1) pDelete(&vc->m[j]);
4047  dcurr = (long)scDimInt(vc, currRing->qideal);
4048  // the following assumes the ground rings to be either zero- or one-dimensional
4049  if((j==-1) && rField_is_Z(currRing))
4050  {
4051  // should also be activated for other euclidean domains as groundfield
4052  dcurr++;
4053  }
4054  idDelete(&vc);
4055  }
4056  if(dcurr > d)
4057  d = dcurr;
4058  }
4059  res->data = (char *)d;
4060  idDelete(&vv);
4061  return FALSE;
4062  }
4063 #endif
4064  res->data = (char *)(long)scDimInt((ideal)(v->Data()),currRing->qideal);
4065  return FALSE;
4066 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:775
int scDimInt(ideal S, ideal Q)
Definition: hdegree.cc:71
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
ideal idCopy(ideal A)
Definition: ideals.h:60
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
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 pSetCoeff0(p, n)
Definition: monomials.h:59
#define nCopy(n)
Definition: numbers.h:15
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ jjDIM2()

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

Definition at line 1917 of file iparith.cc.

1918 {
1919  assumeStdFlag(v);
1921  {
1922  Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1923  }
1924 #ifdef HAVE_RINGS
1925  if (rField_is_Ring(currRing))
1926  {
1927  ideal vid = (ideal)v->Data();
1928  int i = idPosConstant(vid);
1929  if ((i != -1) && (n_IsUnit(pGetCoeff(vid->m[i]),currRing->cf)))
1930  { /* ideal v contains unit; dim = -1 */
1931  res->data = (char *)-1;
1932  return FALSE;
1933  }
1934  ideal vv = id_Copy(vid, currRing);
1935  ideal ww = id_Copy((ideal)w->Data(), currRing);
1936  /* drop degree zero generator from vv (if any) */
1937  if (i != -1) pDelete(&vv->m[i]);
1938  long d = (long)scDimInt(vv, ww);
1939  if (rField_is_Z(currRing) && (i == -1)) d++;
1940  res->data = (char *)d;
1941  idDelete(&vv); idDelete(&ww);
1942  return FALSE;
1943  }
1944 #endif
1945  if(currRing->qideal==NULL)
1946  res->data = (char *)((long)scDimInt((ideal)(v->Data()),(ideal)w->Data()));
1947  else
1948  {
1949  ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1950  res->data = (char *)((long)scDimInt((ideal)(v->Data()),q));
1951  idDelete(&q);
1952  }
1953  return FALSE;
1954 }
#define idSimpleAdd(A, B)
Definition: ideals.h:42
ideal id_Copy(ideal h1, const ring r)
copy an ideal

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5542 of file iparith.cc.

5543 {
5544  res->data = (char *)(long)syDim((syStrategy)v->Data());
5545  return FALSE;
5546 }
int syDim(syStrategy syzstr)
Definition: syz1.cc:1849

◆ jjDIV_BI()

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

Definition at line 1257 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1292 of file iparith.cc.

1293 {
1294  poly q=(poly)v->Data();
1295  if (q==NULL)
1296  {
1298  return TRUE;
1299  }
1300  matrix m=(matrix)(u->Data());
1301  int r=m->rows();
1302  int c=m->cols();
1303  matrix mm=mpNew(r,c);
1304  unsigned i,j;
1305  for(i=r;i>0;i--)
1306  {
1307  for(j=c;j>0;j--)
1308  {
1309  if (pNext(q)!=NULL)
1310  {
1311  MATELEM(mm,i,j) = singclap_pdivide( MATELEM(m,i,j) ,
1312  q /*(poly)(v->Data())*/, currRing );
1313  }
1314  else
1315  MATELEM(mm,i,j) = pDivideM(pCopy(MATELEM(m,i,j)),pHead(q));
1316  }
1317  }
1318  id_Normalize((ideal)mm,currRing);
1319  res->data=(char *)mm;
1320  return FALSE;
1321 }
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:558
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
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pDivideM(a, b)
Definition: polys.h:290
void id_Normalize(ideal I, const ring r)
normialize all polys in id

◆ jjDIV_N()

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

Definition at line 1270 of file iparith.cc.

1271 {
1272  number q=(number)v->Data();
1273  if (nIsZero(q))
1274  {
1276  return TRUE;
1277  }
1278  q = nDiv((number)u->Data(),q);
1279  nNormalize(q);
1280  res->data = (char *)q;
1281  return FALSE;
1282 }
#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 1283 of file iparith.cc.

1284 {
1285  poly q=(poly)v->CopyD();
1286  poly p=(poly)(u->CopyD());
1287  res->data=(void*)(p_Divide(p /*(poly)(u->CopyD())*/ ,
1288  q /*(poly)(v->CopyD())*/ ,currRing));
1289  if (res->data!=NULL) pNormalize((poly)res->data);
1290  return errorreported; /*there may be errors in p_Divide: div. ny 0, etc.*/
1291 }
poly p_Divide(poly p, poly q, const ring r)
polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift destroyes a,...
Definition: polys.cc:31
#define pNormalize(p)
Definition: polys.h:313

◆ jjDIVISION()

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

Definition at line 1955 of file iparith.cc.

1956 {
1957  ideal vi=(ideal)v->Data();
1958  int vl= IDELEMS(vi);
1959  ideal ui=(ideal)u->Data();
1960  unsigned ul= IDELEMS(ui);
1961  ideal R; matrix U;
1962  ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1963  if (m==NULL) return TRUE;
1964  // now make sure that all matrices have the corect size:
1966  int i;
1967  if (MATCOLS(U) != (int)ul)
1968  {
1969  unsigned mul=si_min(ul,MATCOLS(U));
1970  matrix UU=mpNew(ul,ul);
1971  unsigned j;
1972  for(i=mul;i>0;i--)
1973  {
1974  for(j=mul;j>0;j--)
1975  {
1976  MATELEM(UU,i,j)=MATELEM(U,i,j);
1977  MATELEM(U,i,j)=NULL;
1978  }
1979  }
1980  idDelete((ideal *)&U);
1981  U=UU;
1982  }
1983  // make sure that U is a diagonal matrix of units
1984  for(i=ul;i>0;i--)
1985  {
1986  if(MATELEM(U,i,i)==NULL) MATELEM(U,i,i)=pOne();
1987  }
1989  L->Init(3);
1990  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1991  L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1992  L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1993  res->data=(char *)L;
1994  return FALSE;
1995 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:141
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
Definition: ideals.cc:1111
#define hasFlag(A, F)
Definition: ipid.h:107
#define FLAG_STD
Definition: ipid.h:104
STATIC_VAR jList * T
Definition: janet.cc:30
#define pOne()
Definition: polys.h:311
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 6891 of file iparith.cc.

6892 { // may have 3 or 4 arguments
6893  leftv v1=v;
6894  leftv v2=v1->next;
6895  leftv v3=v2->next;
6896  leftv v4=v3->next;
6897  assumeStdFlag(v2);
6898 
6899  int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
6900  int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
6901 
6902  if((i1==0)||(i2==0)
6903  ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
6904  {
6905  WarnS("<module>,<module>,<int>[,<intvec>] expected!");
6906  return TRUE;
6907  }
6908 
6909  sleftv w1,w2;
6910  iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
6911  iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
6912  ideal P=(ideal)w1.Data();
6913  ideal Q=(ideal)w2.Data();
6914 
6915  int n=(int)(long)v3->Data();
6916  short *w=NULL;
6917  if(v4!=NULL)
6918  {
6919  w = iv2array((intvec *)v4->Data(),currRing);
6920  short * w0 = w + 1;
6921  int i = currRing->N;
6922  while( (i > 0) && ((*w0) > 0) )
6923  {
6924  w0++;
6925  i--;
6926  }
6927  if(i>0)
6928  WarnS("not all weights are positive!");
6929  }
6930 
6931  matrix T;
6932  ideal R;
6933  idLiftW(P,Q,n,T,R,w);
6934 
6935  w1.CleanUp();
6936  w2.CleanUp();
6937  if(w!=NULL)
6938  omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(short) );
6939 
6941  L->Init(2);
6942  L->m[1].rtyp=v1->Typ();
6943  if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
6944  {
6945  if(v1->Typ()==POLY_CMD)
6946  p_Shift(&R->m[0],-1,currRing);
6947  L->m[1].data=(void *)R->m[0];
6948  R->m[0]=NULL;
6949  idDelete(&R);
6950  }
6951  else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
6952  L->m[1].data=(void *)id_Module2Matrix(R,currRing);
6953  else
6954  {
6955  L->m[1].rtyp=MODUL_CMD;
6956  L->m[1].data=(void *)R;
6957  }
6958  L->m[0].rtyp=MATRIX_CMD;
6959  L->m[0].data=(char *)T;
6960 
6961  res->data=L;
6962  res->rtyp=LIST_CMD;
6963 
6964  return FALSE;
6965 }
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, short *w)
Definition: ideals.cc:1306
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 1234 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 334 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3616 of file iparith.cc.

3617 {
3618  res->data = (char *)u->CopyD();
3619  return FALSE;
3620 }

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4067 of file iparith.cc.

4068 {
4069  si_link l = (si_link)v->Data();
4070  if (slDump(l))
4071  {
4072  const char *s;
4073  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4074  else s=sNoName_fe;
4075  Werror("cannot dump to `%s`",s);
4076  return TRUE;
4077  }
4078  else
4079  return FALSE;
4080 }

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4081 of file iparith.cc.

4082 {
4083  res->data = (char *)pOne();
4084  int co=(int)(long)v->Data();
4085  if (co>0)
4086  {
4087  pSetComp((poly)res->data,co);
4088  pSetm((poly)res->data);
4089  }
4090  else WerrorS("argument of gen must be positive");
4091  return (co<=0);
4092 }
#define pSetComp(p, v)
Definition: polys.h:38

◆ jjELIMIN()

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

Definition at line 1996 of file iparith.cc.

1997 {
1998  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1999  //setFlag(res,FLAG_STD);
2000  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
2001 }
ideal idElimination(ideal h1, poly delVar, intvec *hilb, GbVariant alg)
Definition: ideals.cc:1571

◆ jjELIMIN_ALG()

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

Definition at line 5939 of file iparith.cc.

5940 {
5941  ideal I=(ideal)u->Data();
5942  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
5943  res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
5944  //setFlag(res,FLAG_STD);
5945  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
5946 }
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3027
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 5947 of file iparith.cc.

5948 {
5949  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
5950  (intvec *)w->Data());
5951  //setFlag(res,FLAG_STD);
5952  return FALSE;
5953 }

◆ jjELIMIN_IV()

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

Definition at line 2002 of file iparith.cc.

2003 {
2004  poly p=pOne();
2005  intvec *iv=(intvec*)v->Data();
2006  for(int i=iv->length()-1; i>=0; i--)
2007  {
2008  pSetExp(p,(*iv)[i],1);
2009  }
2010  pSetm(p);
2011  res->data=(char *)idElimination((ideal)u->Data(),p);
2012  pLmDelete(&p);
2013  //setFlag(res,FLAG_STD);
2014  return FALSE;
2015 }
#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 5140 of file iparith.cc.

5141 {
5142  ring r = (ring)a->Data();
5143  if (rIsPluralRing(r))
5144  {
5145  ring s = rEnvelope(r);
5146  res->data = s;
5147  }
5148  else res->data = rCopy(r);
5149  return FALSE;
5150 }
ring rEnvelope(ring R)
Definition: ring.cc:5520
ring rCopy(ring r)
Definition: ring.cc:1645

◆ jjEQUAL_BI()

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

Definition at line 1322 of file iparith.cc.

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

◆ jjEQUAL_I()

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

Definition at line 1328 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1334 of file iparith.cc.

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

◆ jjEQUAL_N()

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

Definition at line 1352 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1358 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1346 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1366 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1340 of file iparith.cc.

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

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 2021 of file iparith.cc.

2022 {
2023  WerrorS((char *)u->Data());
2024  EXTERN_VAR int inerror;
2025  inerror=3;
2026  return TRUE;
2027 }
#define EXTERN_VAR
Definition: globaldefs.h:6
VAR int inerror
Definition: grammar.cc:175

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4093 of file iparith.cc.

4094 {
4095  char * d = (char *)v->Data();
4096  char * s = (char *)omAlloc(strlen(d) + 13);
4097  strcpy( s, (char *)d);
4098  strcat( s, "\n;RETURN();\n");
4100  return yyparse();
4101 }
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:156
@ 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 2016 of file iparith.cc.

2017 {
2018  //Print("exportto %s -> %s\n",v->Name(),u->Name() );
2019  return iiExport(v,0,IDPACKAGE((idhdl)u->data));
2020 }
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1417

◆ jjEXTGCD_BI()

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

Definition at line 2028 of file iparith.cc.

2029 {
2030  number uu=(number)u->Data();number vv=(number)v->Data();
2032  number a,b;
2033  number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
2034  L->Init(3);
2035  L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
2036  L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
2037  L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
2038  res->rtyp=LIST_CMD;
2039  res->data=(char *)L;
2040  return FALSE;
2041 }
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:693

◆ jjEXTGCD_I()

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

Definition at line 2042 of file iparith.cc.

2043 {
2044  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2045  int p0=ABS(uu),p1=ABS(vv);
2046  int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
2047 
2048  while ( p1!=0 )
2049  {
2050  q=p0 / p1;
2051  r=p0 % p1;
2052  p0 = p1; p1 = r;
2053  r = g0 - g1 * q;
2054  g0 = g1; g1 = r;
2055  r = f0 - f1 * q;
2056  f0 = f1; f1 = r;
2057  }
2058  int a = f0;
2059  int b = g0;
2060  if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
2061  if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
2063  L->Init(3);
2064  L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
2065  L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
2066  L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
2067  res->rtyp=LIST_CMD;
2068  res->data=(char *)L;
2069  return FALSE;
2070 }
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 2071 of file iparith.cc.

2072 {
2073  poly r,pa,pb;
2074  BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2075  if (ret) return TRUE;
2077  L->Init(3);
2078  res->data=(char *)L;
2079  L->m[0].data=(void *)r;
2080  L->m[0].rtyp=POLY_CMD;
2081  L->m[1].data=(void *)pa;
2082  L->m[1].rtyp=POLY_CMD;
2083  L->m[2].data=(void *)pb;
2084  L->m[2].rtyp=POLY_CMD;
2085  return FALSE;
2086 }
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition: clapsing.cc:423
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4373

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4142 of file iparith.cc.

4143 {
4144  intvec *v=NULL;
4146  ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4147  if (f==NULL) return TRUE;
4148  ivTest(v);
4150  l->Init(2);
4151  l->m[0].rtyp=IDEAL_CMD;
4152  l->m[0].data=(void *)f;
4153  l->m[1].rtyp=INTVEC_CMD;
4154  l->m[1].data=(void *)v;
4155  res->data=(void *)l;
4156  return FALSE;
4157 }
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:842
#define ivTest(v)
Definition: intvec.h:158
EXTERN_VAR int singclap_factorize_retry
Definition: iparith.cc:2087

◆ jjFAC_P2()

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

Definition at line 2088 of file iparith.cc.

2089 {
2090  intvec *v=NULL;
2091  int sw=(int)(long)dummy->Data();
2092  int fac_sw=sw;
2093  if ((sw<0)||(sw>2)) fac_sw=1;
2095  ideal f=singclap_factorize((poly)(u->CopyD()), &v, fac_sw,currRing);
2096  if (f==NULL)
2097  return TRUE;
2098  switch(sw)
2099  {
2100  case 0:
2101  case 2:
2102  {
2104  l->Init(2);
2105  l->m[0].rtyp=IDEAL_CMD;
2106  l->m[0].data=(void *)f;
2107  l->m[1].rtyp=INTVEC_CMD;
2108  l->m[1].data=(void *)v;
2109  res->data=(void *)l;
2110  res->rtyp=LIST_CMD;
2111  return FALSE;
2112  }
2113  case 1:
2114  res->data=(void *)f;
2115  return FALSE;
2116  case 3:
2117  {
2118  poly p=f->m[0];
2119  int i=IDELEMS(f);
2120  f->m[0]=NULL;
2121  while(i>1)
2122  {
2123  i--;
2124  p=pMult(p,f->m[i]);
2125  f->m[i]=NULL;
2126  }
2127  res->data=(void *)p;
2128  res->rtyp=POLY_CMD;
2129  }
2130  return FALSE;
2131  }
2132  WerrorS("invalid switch");
2133  return TRUE;
2134 }
#define pMult(p, q)
Definition: polys.h:203

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4102 of file iparith.cc.

4103 {
4105  if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4106  {
4107  ideal_list p,h;
4108  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4109  if (h==NULL)
4110  {
4111  L->Init(1);
4112  L->m[0].data=(char *)idInit(1);
4113  L->m[0].rtyp=IDEAL_CMD;
4114  }
4115  else
4116  {
4117  p=h;
4118  int l=0;
4119  while (p!=NULL) { p=p->next;l++; }
4120  L->Init(l);
4121  l=0;
4122  while(h!=NULL)
4123  {
4124  L->m[l].data=(char *)h->d;
4125  L->m[l].rtyp=IDEAL_CMD;
4126  p=h->next;
4127  omFreeSize(h,sizeof(*h));
4128  h=p;
4129  l++;
4130  }
4131  }
4132  }
4133  else
4134  {
4135  WarnS("no factorization implemented");
4136  L->Init(1);
4137  iiExprArith1(&(L->m[0]),v,STD_CMD);
4138  }
4139  res->data=(void *)L;
4140  return FALSE;
4141 }
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition: kstdfac.cc:800
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:272
@ testHomog
Definition: structs.h:43
@ STD_CMD
Definition: tok.h:183

◆ jjFACSTD2()

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

Definition at line 2135 of file iparith.cc.

2136 {
2137  ideal_list p,h;
2138  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2139  p=h;
2140  int l=0;
2141  while (p!=NULL) { p=p->next;l++; }
2143  L->Init(l);
2144  l=0;
2145  while(h!=NULL)
2146  {
2147  L->m[l].data=(char *)h->d;
2148  L->m[l].rtyp=IDEAL_CMD;
2149  p=h->next;
2150  omFreeSize(h,sizeof(*h));
2151  h=p;
2152  l++;
2153  }
2154  res->data=(void *)L;
2155  return FALSE;
2156 }

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 7888 of file iparith.cc.

7889 {
7890  /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
7891  see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
7892 
7893  valid argument lists:
7894  - (poly h, int d),
7895  - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
7896  - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
7897  in list of ring vars,
7898  - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
7899  optional: all 4 optional args
7900  (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
7901  by singclap_factorize and h(0, y)
7902  has exactly two distinct monic factors [possibly with exponent > 1].)
7903  result:
7904  - list with the two factors f and g such that
7905  h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
7906 
7907  poly h = NULL;
7908  int d = 1;
7909  poly f0 = NULL;
7910  poly g0 = NULL;
7911  int xIndex = 1; /* default index if none provided */
7912  int yIndex = 2; /* default index if none provided */
7913 
7914  leftv u = v; int factorsGiven = 0;
7915  if ((u == NULL) || (u->Typ() != POLY_CMD))
7916  {
7917  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7918  return TRUE;
7919  }
7920  else h = (poly)u->Data();
7921  u = u->next;
7922  if ((u == NULL) || (u->Typ() != INT_CMD))
7923  {
7924  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7925  return TRUE;
7926  }
7927  else d = (int)(long)u->Data();
7928  u = u->next;
7929  if ((u != NULL) && (u->Typ() == POLY_CMD))
7930  {
7931  if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
7932  {
7933  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7934  return TRUE;
7935  }
7936  else
7937  {
7938  f0 = (poly)u->Data();
7939  g0 = (poly)u->next->Data();
7940  factorsGiven = 1;
7941  u = u->next->next;
7942  }
7943  }
7944  if ((u != NULL) && (u->Typ() == INT_CMD))
7945  {
7946  if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
7947  {
7948  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7949  return TRUE;
7950  }
7951  else
7952  {
7953  xIndex = (int)(long)u->Data();
7954  yIndex = (int)(long)u->next->Data();
7955  u = u->next->next;
7956  }
7957  }
7958  if (u != NULL)
7959  {
7960  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7961  return TRUE;
7962  }
7963 
7964  /* checks for provided arguments */
7965  if (pIsConstant(h) || (factorsGiven && (pIsConstant(f0) || pIsConstant(g0))))
7966  {
7967  WerrorS("expected non-constant polynomial argument(s)");
7968  return TRUE;
7969  }
7970  int n = rVar(currRing);
7971  if ((xIndex < 1) || (n < xIndex))
7972  {
7973  Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
7974  return TRUE;
7975  }
7976  if ((yIndex < 1) || (n < yIndex))
7977  {
7978  Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
7979  return TRUE;
7980  }
7981  if (xIndex == yIndex)
7982  {
7983  WerrorS("expected distinct indices for variables x and y");
7984  return TRUE;
7985  }
7986 
7987  /* computation of f0 and g0 if missing */
7988  if (factorsGiven == 0)
7989  {
7990  poly h0 = pSubst(pCopy(h), xIndex, NULL);
7991  intvec* v = NULL;
7992  ideal i = singclap_factorize(h0, &v, 0,currRing);
7993 
7994  ivTest(v);
7995 
7996  if (i == NULL) return TRUE;
7997 
7998  idTest(i);
7999 
8000  if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
8001  {
8002  WerrorS("expected h(0,y) to have exactly two distinct monic factors");
8003  return TRUE;
8004  }
8005  f0 = pPower(pCopy(i->m[1]), (*v)[1]);
8006  g0 = pPower(pCopy(i->m[2]), (*v)[2]);
8007  idDelete(&i);
8008  }
8009 
8010  poly f; poly g;
8011  henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
8013  L->Init(2);
8014  L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
8015  L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
8016  res->rtyp = LIST_CMD;
8017  res->data = (char*)L;
8018  return FALSE;
8019 }
g
Definition: cfModGcd.cc:4031
#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,...
#define nIsOne(n)
Definition: numbers.h:25
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:234
#define pPower(p, q)
Definition: polys.h:200
#define pSubst(p, n, e)
Definition: polys.h:362

◆ jjFAREY_BI()

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

Definition at line 2157 of file iparith.cc.

2158 {
2159  if (rField_is_Q(currRing))
2160  {
2161  number uu=(number)u->Data();
2162  number vv=(number)v->Data();
2163  res->data=(char *)n_Farey(uu,vv,currRing->cf);
2164  return FALSE;
2165  }
2166  else return TRUE;
2167 }
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:789
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501

◆ jjFAREY_ID()

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

Definition at line 2168 of file iparith.cc.

2169 {
2170  ideal uu=(ideal)u->Data();
2171  number vv=(number)v->Data();
2172  //timespec buf1,buf2;
2173  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2174  res->data=(void*)id_Farey(uu,vv,currRing);
2175  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2176  //const unsigned long SEC = 1000L*1000L*1000L;
2177  //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2178  // buf2.tv_nsec-buf1.tv_nsec);
2179  //farey_cnt++;
2180  return FALSE;
2181 }
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2723

◆ jjFAREY_LI()

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

Definition at line 9638 of file iparith.cc.

9639 {
9640  lists c=(lists)u->CopyD();
9641  lists res_l=(lists)omAllocBin(slists_bin);
9642  res_l->Init(c->nr+1);
9643  BOOLEAN bo=FALSE;
9644  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
9645  for (unsigned i=0;i<=(unsigned)c->nr;i++)
9646  {
9647  sleftv tmp;
9648  tmp.Copy(v);
9649  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9650  if (bo) { Werror("farey failed for list entry %d",i+1); break;}
9651  }
9652  c->Clean();
9653  res->data=res_l;
9654  return bo;
9655 }
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2183 of file iparith.cc.

2184 {
2185  ring r=(ring)u->Data();
2186  idhdl w;
2187  int op=iiOp;
2188  nMapFunc nMap;
2189 
2190  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
2191  {
2192  int *perm=NULL;
2193  int *par_perm=NULL;
2194  int par_perm_size=0;
2195  BOOLEAN bo;
2196  if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
2197  {
2198  // Allow imap/fetch to be make an exception only for:
2199  if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2200  ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
2201  || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
2202  {
2203  par_perm_size=rPar(r);
2204  }
2205  else
2206  {
2207  goto err_fetch;
2208  }
2209  }
2210  if ((iiOp!=FETCH_CMD) || (r->N!=currRing->N) || (rPar(r)!=rPar(currRing)))
2211  {
2212  perm=(int *)omAlloc0((r->N+1)*sizeof(int));
2213  if (par_perm_size!=0)
2214  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2215  op=IMAP_CMD;
2216  if (iiOp==IMAP_CMD)
2217  {
2218  int r_par=0;
2219  char ** r_par_names=NULL;
2220  if (r->cf->extRing!=NULL)
2221  {
2222  r_par=r->cf->extRing->N;
2223  r_par_names=r->cf->extRing->names;
2224  }
2225  int c_par=0;
2226  char ** c_par_names=NULL;
2227  if (currRing->cf->extRing!=NULL)
2228  {
2229  c_par=currRing->cf->extRing->N;
2230  c_par_names=currRing->cf->extRing->names;
2231  }
2232  if (!rIsLPRing(r))
2233  {
2234  maFindPerm(r->names, r->N, r_par_names, r_par,
2235  currRing->names,currRing->N,c_par_names, c_par,
2236  perm,par_perm, currRing->cf->type);
2237  }
2238  #ifdef HAVE_SHIFTBBA
2239  else
2240  {
2241  maFindPermLP(r->names, r->N, r_par_names, r_par,
2242  currRing->names,currRing->N,c_par_names, c_par,
2243  perm,par_perm, currRing->cf->type,r->isLPring);
2244  }
2245  #endif
2246  }
2247  else
2248  {
2249  unsigned i;
2250  if (par_perm_size!=0)
2251  for(i=si_min(rPar(r),rPar(currRing));i>0;i--) par_perm[i-1]=-i;
2252  for(i=si_min(r->N,currRing->N);i>0;i--) perm[i]=i;
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",
2265  i,rParameter(r)[i],rParameter(currRing)[i]);
2266  }
2267  }
2268  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
2269  sleftv tmpW;
2270  memset(&tmpW,0,sizeof(sleftv));
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;
2289 err_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 FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: coeffs.h:981
@ IMAP_CMD
Definition: grammar.cc:298
@ FETCH_CMD
Definition: grammar.cc:295
#define IDDATA(a)
Definition: ipid.h:121
#define IDTYP(a)
Definition: ipid.h:114
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:163
void maFindPermLP(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch, int lV)
Definition: maps.cc:231
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:45
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define V_IMAP
Definition: options.h:52
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:620
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:594
@ ALIAS_CMD
Definition: tok.h:34

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7035 of file iparith.cc.

7036 {
7037  ring r=(ring)u->Data();
7038  leftv v=u->next;
7039  leftv perm_var_l=v->next;
7040  leftv perm_par_l=v->next->next;
7041  if ((perm_var_l->Typ()!=INTVEC_CMD)
7042  ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7043  ||(u->Typ()!=RING_CMD))
7044  {
7045  WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7046  return TRUE;
7047  }
7048  intvec *perm_var_v=(intvec*)perm_var_l->Data();
7049  intvec *perm_par_v=NULL;
7050  if (perm_par_l!=NULL)
7051  perm_par_v=(intvec*)perm_par_l->Data();
7052  idhdl w;
7053  nMapFunc nMap;
7054 
7055  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7056  {
7057  int *perm=NULL;
7058  int *par_perm=NULL;
7059  int par_perm_size=0;
7060  BOOLEAN bo;
7061  if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7062  {
7063  // Allow imap/fetch to be make an exception only for:
7064  if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7065  ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7066  || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7067  {
7068  par_perm_size=rPar(r);
7069  }
7070  else
7071  {
7072  goto err_fetch;
7073  }
7074  }
7075  else
7076  par_perm_size=rPar(r);
7077  perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7078  if (par_perm_size!=0)
7079  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7080  int i;
7081  if (perm_par_l==NULL)
7082  {
7083  if (par_perm_size!=0)
7084  for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7085  }
7086  else
7087  {
7088  if (par_perm_size==0) WarnS("source ring has no parameters");
7089  else
7090  {
7091  for(i=rPar(r)-1;i>=0;i--)
7092  {
7093  if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7094  if ((par_perm[i]<-rPar(currRing))
7095  || (par_perm[i]>rVar(currRing)))
7096  {
7097  Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7098  par_perm[i]=0;
7099  }
7100  }
7101  }
7102  }
7103  for(i=rVar(r)-1;i>=0;i--)
7104  {
7105  if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7106  if ((perm[i]<-rPar(currRing))
7107  || (perm[i]>rVar(currRing)))
7108  {
7109  Warn("invalid entry for var %d: %d\n",i,perm[i]);
7110  perm[i]=0;
7111  }
7112  }
7113  if (BVERBOSE(V_IMAP))
7114  {
7115  for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7116  {
7117  if (perm[i]>0)
7118  Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7119  else if (perm[i]<0)
7120  Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7121  }
7122  for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7123  {
7124  if (par_perm[i-1]<0)
7125  Print("// par nr %d: %s -> par %s\n",
7126  i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7127  else if (par_perm[i-1]>0)
7128  Print("// par nr %d: %s -> var %s\n",
7129  i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7130  }
7131  }
7132  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7133  sleftv tmpW;
7134  memset(&tmpW,0,sizeof(sleftv));
7135  tmpW.rtyp=IDTYP(w);
7136  tmpW.data=IDDATA(w);
7137  if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7138  perm,par_perm,par_perm_size,nMap)))
7139  {
7140  Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7141  }
7142  if (perm!=NULL)
7143  omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7144  if (par_perm!=NULL)
7145  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7146  return bo;
7147  }
7148  else
7149  {
7150  Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7151  }
7152  return TRUE;
7153 err_fetch:
7154  char *s1=nCoeffString(r->cf);
7155  char *s2=nCoeffString(currRing->cf);
7156  Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7157  omFree(s2);omFree(s1);
7158  return TRUE;
7159 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263

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

◆ jjFIND3()

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

Definition at line 5954 of file iparith.cc.

5955 {
5956  /*4
5957  * look for the substring what in the string where
5958  * starting at position n
5959  * return the position of the first char of what in where
5960  * or 0
5961  */
5962  int n=(int)(long)w->Data();
5963  char *where=(char *)u->Data();
5964  char *what=(char *)v->Data();
5965  char *found;
5966  if ((1>n)||(n>(int)strlen(where)))
5967  {
5968  Werror("start position %d out of range",n);
5969  return TRUE;
5970  }
5971  found = strchr(where+n-1,*what);
5972  if (*(what+1)!='\0')
5973  {
5974  while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
5975  {
5976  found=strchr(found+1,*what);
5977  }
5978  }
5979  if (found != NULL)
5980  {
5981  res->data=(char *)((found-where)+1);
5982  }
5983  return FALSE;
5984 }

◆ jjFRES()

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

Definition at line 2346 of file iparith.cc.

2347 {
2348  leftv w = (leftv)omAlloc0(sizeof(sleftv));
2349  w->rtyp = STRING_CMD;
2350  w->data = (char *)"complete"; // default
2351  BOOLEAN RES = jjFRES3(res, u, v, w);
2352  omFree(w);
2353  return RES;
2354 }
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  WerrorS("length for fres must not be negative");
2321  return TRUE;
2322  }
2323  if (max_length == 0) {
2324  max_length = currRing->N+1;
2325  if (currRing->qideal != NULL) {
2326  Warn("full resolution in a qring may be infinite, "
2327  "setting max length to %d", max_length);
2328  }
2329  }
2330  char *method = (char *)w->Data();
2331  /* For the moment, only "complete" (default), "frame", or "extended frame"
2332  * are allowed. Another useful option would be "linear strand".
2333  */
2334  if (strcmp(method, "complete") != 0
2335  && strcmp(method, "frame") != 0
2336  && strcmp(method, "extended frame") != 0
2337  && strcmp(method, "single module") != 0) {
2338  WerrorS("wrong optional argument for fres");
2339  }
2340  syStrategy r = syFrank(id, max_length, method);
2341  assume(r->fullres != NULL);
2342  res->data = (void *)r;
2343  return FALSE;
2344 }
resolvente fullres
Definition: syz.h:57
syStrategy syFrank(const ideal arg, const int length, const char *method, const bool use_cache=true, const bool use_tensor_trick=false)
Definition: syz4.cc:822

◆ jjFWALK()

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

Definition at line 2356 of file iparith.cc.

2357 {
2358  res->data=(char *)fractalWalkProc(u,v);
2359  setFlag( res, FLAG_STD );
2360  return FALSE;
2361 }
#define setFlag(A, F)
Definition: ipid.h:108
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 5985 of file iparith.cc.

5986 {
5987  if ((int)(long)w->Data()==0)
5988  res->data=(char *)walkProc(u,v);
5989  else
5990  res->data=(char *)fractalWalkProc(u,v);
5991  setFlag( res, FLAG_STD );
5992  return FALSE;
5993 }
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 2376 of file iparith.cc.

2377 {
2378  number n1 = (number) u->Data();
2379  number n2 = (number) v->Data();
2380  res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2381  return FALSE;
2382 }
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:686

◆ jjGCD_I()

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

Definition at line 2362 of file iparith.cc.

2363 {
2364  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2365  int p0=ABS(uu),p1=ABS(vv);
2366  int r;
2367  while ( p1!=0 )
2368  {
2369  r=p0 % p1;
2370  p0 = p1; p1 = r;
2371  }
2372  res->rtyp=INT_CMD;
2373  res->data=(char *)(long)p0;
2374  return FALSE;
2375 }

◆ jjGCD_N()

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

Definition at line 2383 of file iparith.cc.

2384 {
2385  number a=(number) u->Data();
2386  number b=(number) v->Data();
2387  if (nIsZero(a))
2388  {
2389  if (nIsZero(b)) res->data=(char *)nInit(1);
2390  else res->data=(char *)nCopy(b);
2391  }
2392  else
2393  {
2394  if (nIsZero(b)) res->data=(char *)nCopy(a);
2395  //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2396  else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2397  }
2398  return FALSE;
2399 }
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:688
#define nInit(i)
Definition: numbers.h:24

◆ jjGCD_P()

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

Definition at line 2400 of file iparith.cc.

2401 {
2402  res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2403  (poly)(v->CopyD(POLY_CMD)),currRing);
2404  return FALSE;
2405 }
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:251

◆ jjGE_BI()

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

Definition at line 1173 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1180 of file iparith.cc.

1181 {
1182  res->data = (char *)(long)((int)((long)u->Data()) >= (int)((long)v->Data()));
1183  return FALSE;
1184 }

◆ jjGE_N()

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

Definition at line 1185 of file iparith.cc.

1186 {
1187  res->data = (char *)(long) (nGreater((number)u->Data(),(number)v->Data())
1188  || nEqual((number)u->Data(),(number)v->Data()));
1189  return FALSE;
1190 }
#define nGreater(a, b)
Definition: numbers.h:28

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4158 of file iparith.cc.

4159 {
4160  si_link l = (si_link)v->Data();
4161  if (slGetDump(l))
4162  {
4163  const char *s;
4164  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4165  else s=sNoName_fe;
4166  Werror("cannot get dump from `%s`",s);
4167  return TRUE;
4168  }
4169  else
4170  return FALSE;
4171 }

◆ jjGT_BI()

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

Definition at line 1191 of file iparith.cc.

1192 {
1193  number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1194  res->data = (char *)(long) (n_GreaterZero(h,coeffs_BIGINT)&&(!n_IsZero(h,coeffs_BIGINT)));
1196  return FALSE;
1197 }

◆ jjGT_I()

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

Definition at line 1198 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1203 of file iparith.cc.

1204 {
1205  res->data = (char *)(long)(nGreater((number)u->Data(),(number)v->Data()));
1206  return FALSE;
1207 }

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4172 of file iparith.cc.

4173 {
4174  assumeStdFlag(v);
4175  ideal I=(ideal)v->Data();
4176  res->data=(void *)iiHighCorner(I,0);
4177  return FALSE;
4178 }
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1515

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4179 of file iparith.cc.

4180 {
4181  assumeStdFlag(v);
4182  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4183  BOOLEAN delete_w=FALSE;
4184  ideal I=(ideal)v->Data();
4185  int i;
4186  poly p=NULL,po=NULL;
4187  int rk=id_RankFreeModule(I,currRing);
4188  if (w==NULL)
4189  {
4190  w = new intvec(rk);
4191  delete_w=TRUE;
4192  }
4193  for(i=rk;i>0;i--)
4194  {
4195  p=iiHighCorner(I,i);
4196  if (p==NULL)
4197  {
4198  WerrorS("module must be zero-dimensional");
4199  if (delete_w) delete w;
4200  return TRUE;
4201  }
4202  if (po==NULL)
4203  {
4204  po=p;
4205  }
4206  else
4207  {
4208  // now po!=NULL, p!=NULL
4209  int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4210  if (d==0)
4211  d=pLmCmp(po,p);
4212  if (d > 0)
4213  {
4214  pDelete(&p);
4215  }
4216  else // (d < 0)
4217  {
4218  pDelete(&po); po=p;
4219  }
4220  }
4221  }
4222  if (delete_w) delete w;
4223  res->data=(void *)po;
4224  return FALSE;
4225 }
#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 4226 of file iparith.cc.

4227 {
4228 #ifdef HAVE_RINGS
4229  if (rField_is_Z(currRing))
4230  {
4231  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4232  PrintS("// performed for generic fibre, that is, over Q\n");
4233  }
4234 #endif
4235  assumeStdFlag(v);
4236  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4237  //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4238  hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4239  return FALSE;
4240 }
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1418

◆ jjHILBERT2()

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

Definition at line 2406 of file iparith.cc.

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

◆ jjHILBERT3()

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

Definition at line 5994 of file iparith.cc.

5995 {
5996  intvec *wdegree=(intvec*)w->Data();
5997  if (wdegree->length()!=currRing->N)
5998  {
5999  Werror("weight vector must have size %d, not %d",
6000  currRing->N,wdegree->length());
6001  return TRUE;
6002  }
6003 #ifdef HAVE_RINGS
6004  if (rField_is_Z(currRing))
6005  {
6006  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6007  PrintS("// performed for generic fibre, that is, over Q\n");
6008  }
6009 #endif
6010  assumeStdFlag(u);
6011  intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6012  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
6013  if (errorreported) return TRUE;
6014 
6015  switch((int)(long)v->Data())
6016  {
6017  case 1:
6018  res->data=(void *)iv;
6019  return FALSE;
6020  case 2:
6021  res->data=(void *)hSecondSeries(iv);
6022  delete iv;
6023  return FALSE;
6024  }
6025  delete iv;
6027  return TRUE;
6028 }

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4241 of file iparith.cc.

4242 {
4243 #ifdef HAVE_RINGS
4244  if (rField_is_Z(currRing))
4245  {
4246  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4247  PrintS("// performed for generic fibre, that is, over Q\n");
4248  }
4249 #endif
4250  res->data=(void *)hSecondSeries((intvec *)v->Data());
4251  return FALSE;
4252 }

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4253 of file iparith.cc.

4254 {
4255  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4256  ideal v_id=(ideal)v->Data();
4257  if (w==NULL)
4258  {
4259  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4260  if (res->data!=NULL)
4261  {
4262  if (v->rtyp==IDHDL)
4263  {
4264  char *s_isHomog=omStrDup("isHomog");
4265  if (v->e==NULL)
4266  atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4267  else
4268  atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4269  }
4270  else if (w!=NULL) delete w;
4271  } // if res->data==NULL then w==NULL
4272  }
4273  else
4274  {
4275  res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4276  if((res->data==NULL) && (v->rtyp==IDHDL))
4277  {
4278  if (v->e==NULL)
4279  atKill((idhdl)(v->data),"isHomog");
4280  else
4281  atKill((idhdl)(v->LData()),"isHomog");
4282  }
4283  }
4284  return FALSE;
4285 }
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:150
#define atKill(H, A)
Definition: attrib.h:49
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:2097
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 2473 of file iparith.cc.

2474 {
2475  intvec *w=new intvec(rVar(currRing));
2476  intvec *vw=(intvec*)u->Data();
2477  ideal v_id=(ideal)v->Data();
2478  pFDegProc save_FDeg=currRing->pFDeg;
2479  pLDegProc save_LDeg=currRing->pLDeg;
2480  BOOLEAN save_pLexOrder=currRing->pLexOrder;
2481  currRing->pLexOrder=FALSE;
2482  kHomW=vw;
2483  kModW=w;
2485  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2486  currRing->pLexOrder=save_pLexOrder;
2487  kHomW=NULL;
2488  kModW=NULL;
2489  pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2490  if (w!=NULL) delete w;
2491  return FALSE;
2492 }
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
VAR intvec * kHomW
Definition: kstd1.cc:2063
VAR intvec * kModW
Definition: kstd1.cc:2063
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:38
long(* pLDegProc)(poly p, int *length, ring r)
Definition: ring.h:37

◆ jjHOMOG_ID()

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

Definition at line 2451 of file iparith.cc.

2452 {
2453  int i=pVar((poly)v->Data());
2454  if (i==0)
2455  {
2456  WerrorS("ringvar expected");
2457  return TRUE;
2458  }
2459  pFDegProc deg;
2460  if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2461  deg=p_Totaldegree;
2462  else
2463  deg=currRing->pFDeg;
2464  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2465  int d=deg(p,currRing);
2466  pLmDelete(p);
2467  if (d==1)
2468  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2469  else
2470  WerrorS("variable must have weight 1");
2471  return (d!=1);
2472 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1446
@ 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 6029 of file iparith.cc.

6030 {
6031  PrintS("TODO\n");
6032  int i=pVar((poly)v->Data());
6033  if (i==0)
6034  {
6035  WerrorS("ringvar expected");
6036  return TRUE;
6037  }
6038  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6039  int d=pWTotaldegree(p);
6040  pLmDelete(p);
6041  if (d==1)
6042  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6043  else
6044  WerrorS("variable must have weight 1");
6045  return (d!=1);
6046 }
#define pWTotaldegree(p)
Definition: polys.h:279

◆ jjHOMOG_P()

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

Definition at line 2434 of file iparith.cc.

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

◆ jjHOMOG_P_W()

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

Definition at line 6047 of file iparith.cc.

6048 {
6049  PrintS("TODO\n");
6050  int i=pVar((poly)v->Data());
6051  if (i==0)
6052  {
6053  WerrorS("ringvar expected");
6054  return TRUE;
6055  }
6056  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6057  int d=pWTotaldegree(p);
6058  pLmDelete(p);
6059  if (d==1)
6060  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6061  else
6062  WerrorS("variable must have weight 1");
6063  return (d!=1);
6064 }

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4302 of file iparith.cc.

4303 {
4304  matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4305  IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4306  if (IDELEMS((ideal)mat)==0)
4307  {
4308  idDelete((ideal *)&mat);
4309  mat=(matrix)idInit(1,1);
4310  }
4311  else
4312  {
4313  MATROWS(mat)=1;
4314  mat->rank=1;
4315  idTest((ideal)mat);
4316  }
4317  res->data=(char *)mat;
4318  return FALSE;
4319 }

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4320 of file iparith.cc.

4321 {
4322  map m=(map)v->CopyD(MAP_CMD);
4323  omFree((ADDRESS)m->preimage);
4324  m->preimage=NULL;
4325  ideal I=(ideal)m;
4326  I->rank=1;
4327  res->data=(char *)I;
4328  return FALSE;
4329 }
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:400

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 6991 of file iparith.cc.

6992 {
6993  int s=1;
6994  leftv h=v;
6995  if (h!=NULL) s=exprlist_length(h);
6996  ideal id=idInit(s,1);
6997  int rank=1;
6998  int i=0;
6999  poly p;
7000  int dest_type=POLY_CMD;
7001  if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7002  while (h!=NULL)
7003  {
7004  // use standard type conversions to poly/vector
7005  int ri;
7006  int ht=h->Typ();
7007  if (ht==dest_type)
7008  {
7009  p=(poly)h->CopyD();
7010  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7011  }
7012  else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7013  {
7014  sleftv tmp;
7015  leftv hnext=h->next;
7016  h->next=NULL;
7017  iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7018  h->next=hnext;
7019  p=(poly)tmp.data;
7020  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7021  }
7022  else
7023  {
7024  idDelete(&id);
7025  return TRUE;
7026  }
7027  id->m[i]=p;
7028  i++;
7029  h=h->next;
7030  }
7031  id->rank=rank;
7032  res->data=(char *)id;
7033  return FALSE;
7034 }
int exprlist_length(leftv v)
Definition: ipshell.cc:547

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4330 of file iparith.cc.

4331 {
4332  if (currRing!=NULL)
4333  {
4334  ring q=(ring)v->Data();
4335  if (rSamePolyRep(currRing, q))
4336  {
4337  if (q->qideal==NULL)
4338  res->data=(char *)idInit(1,1);
4339  else
4340  res->data=(char *)idCopy(q->qideal);
4341  return FALSE;
4342  }
4343  }
4344  WerrorS("can only get ideal from identical qring");
4345  return TRUE;
4346 }
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:1712

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5464 of file iparith.cc.

5465 {
5466  res->data = (char *)(long)idElem((ideal)v->Data());
5467  return FALSE;
5468 }
int idElem(const ideal F)
count non-zero elements

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5469 of file iparith.cc.

5470 {
5471  res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5472  return FALSE;
5473 }
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 5489 of file iparith.cc.

5490 {
5491  res->data = (char *)id_Head((ideal)v->Data(),currRing);
5492  setFlag(res,FLAG_STD);
5493  return FALSE;
5494 }

◆ jjidMaxIdeal()

static BOOLEAN jjidMaxIdeal ( leftv  res,
leftv  v 
)
static

Definition at line 4286 of file iparith.cc.

4287 {
4288 #ifdef HAVE_SHIFTBBA
4289  if (currRing->isLPring)
4290  {
4291  int deg = (int)(long)v->Data();
4292  if (deg > currRing->N/currRing->isLPring) {
4293  WerrorS("degree bound of Letterplace ring is to small");
4294  return TRUE;
4295  }
4296  }
4297 #endif
4298  res->data = (char *)idMaxIdeal((int)(long)v->Data());
4299  setFlag(res,FLAG_STD);
4300  return FALSE;
4301 }
#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 5495 of file iparith.cc.

5496 {
5497  res->data = (char *)idMinBase((ideal)v->Data());
5498  return FALSE;
5499 }
ideal idMinBase(ideal h1)
Definition: ideals.cc:47

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5547 of file iparith.cc.

5548 {
5549  res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5550  return FALSE;
5551 }
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5474 of file iparith.cc.

5475 {
5476  res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5477  return FALSE;
5478 }
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4347 of file iparith.cc.

4348 {
4349  intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4350  iv->makeVector();
4351  res->data = iv;
4352  return FALSE;
4353 }
void makeVector()
Definition: intvec.h:102
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4354 of file iparith.cc.

4355 {
4356  res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4357  return FALSE;
4358 }
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:815

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4359 of file iparith.cc.

4360 {
4361  assumeStdFlag(v);
4362  res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4363  return FALSE;
4364 }
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:211

◆ jjINDEPSET2()

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

Definition at line 2493 of file iparith.cc.

2494 {
2495  assumeStdFlag(u);
2496  res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2497  currRing->qideal);
2498  return FALSE;
2499 }
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1025

◆ jjINDEX_I()

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

Definition at line 1389 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1411 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1447 of file iparith.cc.

1448 {
1449  poly p=(poly)u->Data();
1450  int i=(int)(long)v->Data();
1451  int j=0;
1452  while (p!=NULL)
1453  {
1454  j++;
1455  if (j==i)
1456  {
1457  res->data=(char *)pHead(p);
1458  return FALSE;
1459  }
1460  pIter(p);
1461  }
1462  return FALSE;
1463 }
#define pIter(p)
Definition: monomials.h:37

◆ jjINDEX_P_IV()

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

Definition at line 1487 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1464 of file iparith.cc.

1465 {
1466  sBucket_pt b=(sBucket_pt)u->CopyD();
1468  int l; poly p,pp;
1469  sBucketDestroyAdd(b, &pp, &l);
1470  int i=(int)(long)v->Data();
1471  int j=0;
1472  p=pp;
1473  while (p!=NULL)
1474  {
1475  j++;
1476  if (j==i)
1477  {
1478  res->data=(char *)pHead(p);
1479  p_Delete(&pp,currRing);
1480  return FALSE;
1481  }
1482  pIter(p);
1483  }
1484  p_Delete(&pp,currRing);
1485  return FALSE;
1486 }
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
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 1516 of file iparith.cc.

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

◆ jjINDEX_V_IV()

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

Definition at line 1523 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2506 of file iparith.cc.

2507 {
2508  const lists L = (lists)l->Data();
2509  const int n = L->nr; assume (n >= 0);
2510  std::vector<ideal> V(n + 1);
2511 
2512  for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2513 
2514  res->data=interpolation(V, (intvec*)v->Data());
2515  setFlag(res,FLAG_STD);
2516  return errorreported;
2517 }
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4365 of file iparith.cc.

4366 {
4367  ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4368 #ifdef HAVE_RINGS
4370  WarnS("interred: this command is experimental over the integers");
4371 #endif
4372  if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4373  res->data = result;
4374  return FALSE;
4375 }
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3400
#define TEST_OPT_PROT
Definition: options.h:101
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:57

◆ jjINTERSEC3S()

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

Definition at line 6092 of file iparith.cc.

6093 {
6094  ideal I=(ideal)u->Data();
6095  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6096  res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6098  return FALSE;
6099 }
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:199
#define TEST_OPT_RETURN_SB
Definition: options.h:110

◆ jjINTERSECT()

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

Definition at line 2500 of file iparith.cc.

2501 {
2502  res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2504  return FALSE;
2505 }

◆ jjINTERSECT3()

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

Definition at line 6079 of file iparith.cc.

6080 {
6081  ideal I1=(ideal)u->Data();
6082  ideal I2=(ideal)v->Data();
6083  ideal I3=(ideal)w->Data();
6084  resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6085  r[0]=I1;
6086  r[1]=I2;
6087  r[2]=I3;
6088  res->data=(char *)idMultSect(r,3);
6089  omFreeSize((ADDRESS)r,3*sizeof(ideal));
6090  return FALSE;
6091 }
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition: ideals.cc:419
ideal * resolvente
Definition: ideals.h:18

◆ jjINTERSECT_PL()

static BOOLEAN jjINTERSECT_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7160 of file iparith.cc.

7161 {
7162  leftv h=v;
7163  int l=v->listLength();
7164  resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7165  BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7166  int t=0;
7167  // try to convert to IDEAL_CMD
7168  while (h!=NULL)
7169  {
7170  if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7171  {
7172  t=IDEAL_CMD;
7173  }
7174  else break;
7175  h=h->next;
7176  }
7177  // if failure, try MODUL_CMD
7178  if (t==0)
7179  {
7180  h=v;
7181  while (h!=NULL)
7182  {
7183  if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7184  {
7185  t=MODUL_CMD;
7186  }
7187  else break;
7188  h=h->next;
7189  }
7190  }
7191  // check for success in converting
7192  if (t==0)
7193  {
7194  WerrorS("cannot convert to ideal or module");
7195  return TRUE;
7196  }
7197  // call idMultSect
7198  h=v;
7199  int i=0;
7200  sleftv tmp;
7201  while (h!=NULL)
7202  {
7203  if (h->Typ()==t)
7204  {
7205  r[i]=(ideal)h->Data(); /*no copy*/
7206  h=h->next;
7207  }
7208  else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7209  {
7210  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7211  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7212  Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7213  return TRUE;
7214  }
7215  else
7216  {
7217  r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7218  copied[i]=TRUE;
7219  h=tmp.next;
7220  }
7221  i++;
7222  }
7223  res->rtyp=t;
7224  res->data=(char *)idMultSect(r,i);
7225  while(i>0)
7226  {
7227  i--;
7228  if (copied[i]) idDelete(&(r[i]));
7229  }
7230  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7231  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7232  return FALSE;
7233 }

◆ jjINTMAT3()

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

Definition at line 6065 of file iparith.cc.

6066 {
6067  intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6068  intvec* arg = (intvec*) u->Data();
6069  int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6070 
6071  for (i=0; i<n; i++)
6072  {
6073  (*im)[i] = (*arg)[i];
6074  }
6075 
6076  res->data = (char *)im;
6077  return FALSE;
6078 }

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7396 of file iparith.cc.

7397 {
7398  int i=0;
7399  leftv h=v;
7400  if (h!=NULL) i=exprlist_length(h);
7401  intvec *iv=new intvec(i);
7402  i=0;
7403  while (h!=NULL)
7404  {
7405  if(h->Typ()==INT_CMD)
7406  {
7407  (*iv)[i]=(int)(long)h->Data();
7408  }
7409  else if (h->Typ()==INTVEC_CMD)
7410  {
7411  intvec *ivv=(intvec*)h->Data();
7412  for(int j=0;j<ivv->length();j++,i++)
7413  {
7414  (*iv)[i]=(*ivv)[j];
7415  }
7416  i--;
7417  }
7418  else
7419  {
7420  delete iv;
7421  return TRUE;
7422  }
7423  i++;
7424  h=h->next;
7425  }
7426  res->data=(char *)iv;
7427  return FALSE;
7428 }

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4387 of file iparith.cc.

4388 {
4389  res->data = (char *)0;
4390  return FALSE;
4391 }

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4376 of file iparith.cc.

4377 {
4378  res->data = (char *)(long)pVar((poly)v->Data());
4379  return FALSE;
4380 }

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4381 of file iparith.cc.

4382 {
4383  res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4384  currRing->N)+1);
4385  return FALSE;
4386 }
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 4423 of file iparith.cc.

4424 {
4425  ideal id = (ideal)a->Data();
4426  id = id_Transp(id,currRing);
4427  int W = IDELEMS(id);
4428 
4429  ideal result = idInit(W * currRing->N, id->rank);
4430  poly *p = result->m;
4431 
4432  for( int v = 1; v <= currRing->N; v++ )
4433  {
4434  poly* q = id->m;
4435  for( int i = 0; i < W; i++, p++, q++ )
4436  *p = pDiff( *q, v );
4437  }
4438  idDelete(&id);
4439 
4440  res->data = (char *)result;
4441  return FALSE;
4442 }

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4392 of file iparith.cc.

4393 {
4394  ideal i=idInit(currRing->N,1);
4395  int k;
4396  poly p=(poly)(v->Data());
4397  for (k=currRing->N;k>0;k--)
4398  {
4399  i->m[k-1]=pDiff(p,k);
4400  }
4401  res->data = (char *)i;
4402  return FALSE;
4403 }

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2524 of file iparith.cc.

2525 {
2526  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2527  return jjStdJanetBasis(res,v,0);
2528 }
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 2518 of file iparith.cc.

2519 {
2520  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2521  return jjStdJanetBasis(res,u,(int)(long)v->Data());
2522 }

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7429 of file iparith.cc.

7430 {
7431  const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7432  const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7433  const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7434  const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7435  leftv u1=u;
7436  leftv u2=u1->next;
7437  leftv u3=u2->next;
7438  leftv u4=u3->next;
7439  if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7440  {
7441  if(!pIsUnit((poly)u2->Data()))
7442  {
7443  WerrorS("2nd argument must be a unit");
7444  return TRUE;
7445  }
7446  res->rtyp=u1->Typ();
7447  res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7448  pCopy((poly)u2->Data()),(intvec*)u4->Data());
7449  return FALSE;
7450  }
7451  else
7452  if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7453  {
7454  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7455  {
7456  WerrorS("2nd argument must be a diagonal matrix of units");
7457  return TRUE;
7458  }
7459  res->rtyp=u1->Typ();
7460  res->data=(char*)idSeries(
7461  (int)(long)u3->Data(),
7462  idCopy((ideal)u1->Data()),
7463  mp_Copy((matrix)u2->Data(), currRing),
7464  (intvec*)u4->Data()
7465  );
7466  return FALSE;
7467  }
7468  else
7469  {
7470  Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7471  Tok2Cmdname(iiOp));
7472  return TRUE;
7473  }
7474 }
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2149
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition: matpol.cc:816
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition: polys.h:236
#define pSeries(n, p, u, w)
Definition: polys.h:368

◆ jjJET_ID()

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

Definition at line 2534 of file iparith.cc.

2535 {
2536  res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2537  return FALSE;
2538 }
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 6117 of file iparith.cc.

6118 {
6119  res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6120  (intvec *)w->Data(),currRing);
6121  return FALSE;
6122 }
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 6123 of file iparith.cc.

6124 {
6125  if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6126  {
6127  WerrorS("2nd argument must be a diagonal matrix of units");
6128  return TRUE;
6129  }
6130  res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6131  (matrix)v->CopyD());
6132  return FALSE;
6133 }

◆ jjJET_P()

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

Definition at line 2529 of file iparith.cc.

2530 {
2531  res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2532  return FALSE;
2533 }
#define pJet(p, m)
Definition: polys.h:364

◆ jjJET_P_IV()

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

Definition at line 6100 of file iparith.cc.

6101 {
6102  short *iw=iv2array((intvec *)w->Data(),currRing);
6103  res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6104  omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(short) );
6105  return FALSE;
6106 }
#define ppJetW(p, m, iv)
Definition: polys.h:365

◆ jjJET_P_P()

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

Definition at line 6107 of file iparith.cc.

6108 {
6109  if (!pIsUnit((poly)v->Data()))
6110  {
6111  WerrorS("2nd argument must be a unit");
6112  return TRUE;
6113  }
6114  res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6115  return FALSE;
6116 }
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4404

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4445 of file iparith.cc.

4446 {
4447  assumeStdFlag(v);
4448  res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4449  return FALSE;
4450 }
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1352

◆ jjKBASE2()

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

Definition at line 2539 of file iparith.cc.

2540 {
2541  assumeStdFlag(u);
2542  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2543  res->data = (char *)scKBase((int)(long)v->Data(),
2544  (ideal)(u->Data()),currRing->qideal, w_u);
2545  if (w_u!=NULL)
2546  {
2547  atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2548  }
2549  return FALSE;
2550 }
intvec * ivCopy(const intvec *o)
Definition: intvec.h:135

◆ jjKERNEL()

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

Definition at line 2552 of file iparith.cc.

2553 {
2554  return jjPREIMAGE(res,u,v,NULL);
2555 }
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6343

◆ jjKLAMMER()

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

Definition at line 1559 of file iparith.cc.

1560 {
1561  if(u->name==NULL) return TRUE;
1562  char * nn = (char *)omAlloc(strlen(u->name) + 14);
1563  sprintf(nn,"%s(%d)",u->name,(int)(long)v->Data());
1564  omFree((ADDRESS)u->name);
1565  u->name=NULL;
1566  char *n=omStrDup(nn);
1567  omFree((ADDRESS)nn);
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:1600

◆ jjKLAMMER_IV()

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

Definition at line 1572 of file iparith.cc.

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

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7512 of file iparith.cc.

7513 {
7514  if ((yyInRingConstruction)
7515  && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7516  {
7517  memcpy(res,u,sizeof(sleftv));
7518  memset(u,0,sizeof(sleftv));
7519  return FALSE;
7520  }
7521  leftv v=u->next;
7522  BOOLEAN b;
7523  if(v==NULL) // p()
7524  b=iiExprArith1(res,u,iiOp);
7525  else if ((v->next==NULL) // p(1)
7526  || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7527  {
7528  u->next=NULL;
7529  b=iiExprArith2(res,u,iiOp,v);
7530  u->next=v;
7531  }
7532  else // p(1,2), p undefined
7533  {
7534  if (v->Typ()!=INT_CMD)
7535  {
7536  Werror("`int` expected while building `%s(`",u->name);
7537  return TRUE;
7538  }
7539  int l=u->listLength();
7540  char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7541  sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7542  char *s=nn;
7543  do
7544  {
7545  while (*s!='\0') s++;
7546  v=v->next;
7547  if (v->Typ()!=INT_CMD)
7548  {
7549  Werror("`int` expected while building `%s`",nn);
7550  omFree((ADDRESS)nn);
7551  return TRUE;
7552  }
7553  sprintf(s,",%d",(int)(long)v->Data());
7554  } while (v->next!=NULL);
7555  while (*s!='\0') s++;
7556  nn=strcat(nn,")");
7557  char *n=omStrDup(nn);
7558  omFree((ADDRESS)nn);
7559  syMake(res,n);
7560  b=FALSE;
7561  }
7562  return b;
7563 }
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1600 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2556 of file iparith.cc.

2557 {
2558  return mpKoszul(res, u,v,NULL);
2559 }
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3067

◆ jjKoszul_Id()

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

Definition at line 2560 of file iparith.cc.

2561 {
2562  sleftv h;
2563  memset(&h,0,sizeof(sleftv));
2564  h.rtyp=INT_CMD;
2565  h.data=(void *)(long)IDELEMS((ideal)v->Data());
2566  return mpKoszul(res, u, &h, v);
2567 }

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4451 of file iparith.cc.

4452 {
4453  res->data=(char *)syConvList((lists)v->Data());
4454  if (res->data != NULL)
4455  return FALSE;
4456  else
4457  return TRUE;
4458 }
syStrategy syConvList(lists li)
Definition: ipshell.cc:3230

◆ jjLE_BI()

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

Definition at line 1208 of file iparith.cc.

1209 {
1210  return jjGE_BI(res,v,u);
1211 }
static BOOLEAN jjGE_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1173

◆ jjLE_I()

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

Definition at line 1212 of file iparith.cc.

1213 {
1214  res->data = (char *)(long)((int)((long)u->Data()) <= (int)((long)v->Data()));
1215  return FALSE;
1216 }

◆ jjLE_N()

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

Definition at line 1217 of file iparith.cc.

1218 {
1219  return jjGE_N(res,v,u);
1220 }
static BOOLEAN jjGE_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1185

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4459 of file iparith.cc.

4460 {
4461  poly p=(poly)v->Data();
4462  if (p==NULL)
4463  {
4464  res->data=(char *)nInit(0);
4465  }
4466  else
4467  {
4468  res->data=(char *)nCopy(pGetCoeff(p));
4469  }
4470  return FALSE;
4471 }

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4472 of file iparith.cc.

4473 {
4474  poly p=(poly)v->Data();
4475  int s=currRing->N;
4476  if (v->Typ()==VECTOR_CMD) s++;
4477  intvec *iv=new intvec(s);
4478  if (p!=NULL)
4479  {
4480  for(int i = currRing->N;i;i--)
4481  {
4482  (*iv)[i-1]=pGetExp(p,i);
4483  }
4484  if (s!=currRing->N)
4485  (*iv)[currRing->N]=pGetComp(p);
4486  }
4487  res->data=(char *)iv;
4488  return FALSE;
4489 }
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4490 of file iparith.cc.

4491 {
4492  poly p=(poly)v->Data();
4493  if (p == NULL)
4494  {
4495  res->data = (char*) NULL;
4496  }
4497  else
4498  {
4499  poly lm = pLmInit(p);
4500  pSetCoeff0(lm, nInit(1));
4501  res->data = (char*) lm;
4502  }
4503  return FALSE;
4504 }
#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 2568 of file iparith.cc.

2569 {
2570  int ul= IDELEMS((ideal)u->Data());
2571  int vl= IDELEMS((ideal)v->Data());
2572  ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2573  hasFlag(u,FLAG_STD));
2574  if (m==NULL) return TRUE;
2575  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2576  return FALSE;
2577 }

◆ jjLIFT3()

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

Definition at line 6668 of file iparith.cc.

6669 {
6670  if (w->rtyp!=IDHDL) return TRUE;
6671  int ul= IDELEMS((ideal)u->Data());
6672  int vl= IDELEMS((ideal)v->Data());
6673  ideal m
6674  = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6675  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6676  if (m==NULL) return TRUE;
6677  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6678  return FALSE;
6679 }
#define IDMATRIX(a)
Definition: ipid.h:129

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7564 of file iparith.cc.

7565 {
7566  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7567  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7568  leftv u=U;
7569  leftv v=u->next;
7570  leftv w=v->next;
7571  leftv u4=w->next;
7572  if (w->rtyp!=IDHDL) return TRUE;
7573  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7574  {
7575  // see jjLIFT3
7576  ideal I=(ideal)u->Data();
7577  int ul= IDELEMS(I /*(ideal)u->Data()*/);
7578  int vl= IDELEMS((ideal)v->Data());
7579  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7580  ideal m
7581  = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7582  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7583  if (m==NULL) return TRUE;
7584  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7585  return FALSE;
7586  }
7587  else
7588  {
7589  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7590  "or (`module`,`module`,`matrix`,`string`)expected",
7591  Tok2Cmdname(iiOp));
7592  return TRUE;
7593  }
7594 }

◆ jjLIFTSTD()

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

Definition at line 2578 of file iparith.cc.

2579 {
2580  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2581  idhdl h=(idhdl)v->data;
2582  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2583  res->data = (char *)idLiftStd((ideal)u->Data(),
2584  &(h->data.umatrix),testHomog);
2585  setFlag(res,FLAG_STD); v->flag=0;
2586  return FALSE;
2587 }
ideal idLiftStd(ideal h1, matrix *ma, tHomog hi, ideal *syz, GbVariant alg)
Definition: ideals.cc:923

◆ jjLIFTSTD3()

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

Definition at line 6680 of file iparith.cc.

6681 {
6682  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6683  if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6684  idhdl hv=(idhdl)v->data;
6685  idhdl hw=(idhdl)w->data;
6686  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6687  res->data = (char *)idLiftStd((ideal)u->Data(),
6688  &(hv->data.umatrix),testHomog,
6689  &(hw->data.uideal));
6690  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
6691  return FALSE;
6692 }

◆ jjLIFTSTD_4()

static BOOLEAN jjLIFTSTD_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7595 of file iparith.cc.

7596 {
7597  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7598  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7599  leftv u=U;
7600  leftv v=u->next;
7601  leftv w=v->next;
7602  leftv u4=w->next;
7603  if (v->rtyp!=IDHDL) return TRUE;
7604  if (w->rtyp!=IDHDL) return TRUE;
7605  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7606  {
7607  // see jjLIFTSTD3
7608  ideal I=(ideal)u->Data();
7609  idhdl hv=(idhdl)v->data;
7610  idhdl hw=(idhdl)w->data;
7611  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7612  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7613  res->data = (char *)idLiftStd((ideal)u->Data(),
7614  &(hv->data.umatrix),testHomog,
7615  &(hw->data.uideal),alg);
7616  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7617  return FALSE;
7618  }
7619  else
7620  {
7621  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7622  "or (`module`,`module`,`matrix`,`string`)expected",
7623  Tok2Cmdname(iiOp));
7624  return TRUE;
7625  }
7626 }

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7627 of file iparith.cc.

7628 {
7629  int sl=0;
7630  if (v!=NULL) sl = v->listLength();
7631  lists L;
7632  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7633  {
7634  int add_row_shift = 0;
7635  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7636  if (weights!=NULL) add_row_shift=weights->min_in();
7637  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7638  }
7639  else
7640  {
7642  leftv h=NULL;
7643  int i;
7644  int rt;
7645 
7646  L->Init(sl);
7647  for (i=0;i<sl;i++)
7648  {
7649  if (h!=NULL)
7650  { /* e.g. not in the first step:
7651  * h is the pointer to the old sleftv,
7652  * v is the pointer to the next sleftv
7653  * (in this moment) */
7654  h->next=v;
7655  }
7656  h=v;
7657  v=v->next;
7658  h->next=NULL;
7659  rt=h->Typ();
7660  if (rt==0)
7661  {
7662  L->Clean();
7663  Werror("`%s` is undefined",h->Fullname());
7664  return TRUE;
7665  }
7666  if (rt==RING_CMD)
7667  {
7668  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7669  ((ring)L->m[i].data)->ref++;
7670  }
7671  else
7672  L->m[i].Copy(h);
7673  }
7674  }
7675  res->data=(char *)L;
7676  return FALSE;
7677 }
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:3158

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4509 of file iparith.cc.

4510 {
4511  lists l=(lists)v->Data();
4512  long mm=(long)atGet(v,"maxExp",INT_CMD);
4513  if (mm==0) mm=0x7fff;
4514  int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4515  ring r=rCompose(l,TRUE,mm,isLetterplace);
4516  res->data=(char *)r;
4517  return (r==NULL);
4518 }
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2758

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5362 of file iparith.cc.

5363 {
5364  char libnamebuf[1024];
5366 
5367 #ifdef HAVE_DYNAMIC_LOADING
5368  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5369 #endif /* HAVE_DYNAMIC_LOADING */
5370  switch(LT)
5371  {
5372  default:
5373  case LT_NONE:
5374  Werror("%s: unknown type", s);
5375  break;
5376  case LT_NOTFOUND:
5377  Werror("cannot open %s", s);
5378  break;
5379 
5380  case LT_SINGULAR:
5381  {
5382  char *plib = iiConvName(s);
5383  idhdl pl = IDROOT->get(plib,0);
5384  if (pl==NULL)
5385  {
5386  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5387  IDPACKAGE(pl)->language = LANG_SINGULAR;
5388  IDPACKAGE(pl)->libname=omStrDup(s);
5389  }
5390  else if (IDTYP(pl)!=PACKAGE_CMD)
5391  {
5392  Werror("can not create package `%s`",plib);
5393  omFree(plib);
5394  return TRUE;
5395  }
5396  else /* package */
5397  {
5398  package pa=IDPACKAGE(pl);
5399  if ((pa->language==LANG_C)
5400  || (pa->language==LANG_MIX))
5401  {
5402  Werror("can not create package `%s` - binaries exists",plib);
5403  omfree(plib);
5404  return TRUE;
5405  }
5406  }
5407  omFree(plib);
5408  package savepack=currPack;
5409  currPack=IDPACKAGE(pl);
5410  IDPACKAGE(pl)->loaded=TRUE;
5411  char libnamebuf[1024];
5412  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5413  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5414  currPack=savepack;
5415  IDPACKAGE(pl)->loaded=(!bo);
5416  return bo;
5417  }
5418  case LT_BUILTIN:
5419  SModulFunc_t iiGetBuiltinModInit(const char*);
5420  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5421  case LT_MACH_O:
5422  case LT_ELF:
5423  case LT_HPUX:
5424 #ifdef HAVE_DYNAMIC_LOADING
5425  return load_modules(s, libnamebuf, autoexport);
5426 #else /* HAVE_DYNAMIC_LOADING */
5427  WerrorS("Dynamic modules are not supported by this version of Singular");
5428  break;
5429 #endif /* HAVE_DYNAMIC_LOADING */
5430  }
5431  return TRUE;
5432 }
CanonicalForm fp
Definition: cfModGcd.cc:4043
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:265
VAR package basePack
Definition: ipid.cc:58
VAR package currPack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:18
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1240
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:80
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:916
char * iiConvName(const char *libname)
Definition: iplib.cc:1374
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1231
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:752
VAR char libnamebuf[1024]
Definition: libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:22
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
#define omfree(addr)
Definition: omAllocDecl.h:237
@ 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 4505 of file iparith.cc.

4506 {
4507  return jjLOAD((char*)v->Data(),FALSE);
4508 }
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5362

◆ jjLOAD2()

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

Definition at line 2588 of file iparith.cc.

2589 {
2590  return jjLOAD((char*)v->Data(),TRUE);
2591 }

◆ jjLOAD_E()

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

Definition at line 2592 of file iparith.cc.

2593 {
2594  char * s=(char *)u->Data();
2595  if(strcmp(s, "with")==0)
2596  return jjLOAD((char*)v->Data(), TRUE);
2597  if (strcmp(s,"try")==0)
2598  return jjLOAD_TRY((char*)v->Data());
2599  WerrorS("invalid second argument");
2600  WerrorS("load(\"libname\" [,option]);");
2601  return TRUE;
2602 }
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5438

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5438 of file iparith.cc.

5439 {
5440  if (!iiGetLibStatus(s))
5441  {
5442  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5445  BOOLEAN bo=jjLOAD(s,TRUE);
5446  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5447  Print("loading of >%s< failed\n",s);
5448  WerrorS_callback=WerrorS_save;
5449  errorreported=0;
5450  }
5451  return FALSE;
5452 }
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5433
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5434
BOOLEAN iiGetLibStatus(const char *lib)
Definition: iplib.cc:73

◆ jjLT_BI()

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

Definition at line 1221 of file iparith.cc.

1222 {
1223  return jjGT_BI(res,v,u);
1224 }
static BOOLEAN jjGT_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1191

◆ jjLT_I()

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

Definition at line 1225 of file iparith.cc.

1226 {
1227  res->data = (char *)(long)((int)((long)u->Data()) < (int)((long)v->Data()));
1228  return FALSE;
1229 }

◆ jjLT_N()

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

Definition at line 1230 of file iparith.cc.

1231 {
1232  return jjGT_N(res,v,u);
1233 }
static BOOLEAN jjGT_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1203

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4528 of file iparith.cc.

4529 {
4530  /* computes the LU-decomposition of a matrix M;
4531  i.e., M = P * L * U, where
4532  - P is a row permutation matrix,
4533  - L is in lower triangular form,
4534  - U is in upper row echelon form
4535  Then, we also have P * M = L * U.
4536  A list [P, L, U] is returned. */
4537  matrix mat = (const matrix)v->Data();
4538  if (!idIsConstant((ideal)mat))
4539  {
4540  WerrorS("matrix must be constant");
4541  return TRUE;
4542  }
4543  matrix pMat;
4544  matrix lMat;
4545  matrix uMat;
4546 
4547  luDecomp(mat, pMat, lMat, uMat);
4548 
4550  ll->Init(3);
4551  ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4552  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4553  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4554  res->data=(char*)ll;
4555 
4556  return FALSE;
4557 }
#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 7234 of file iparith.cc.

7235 {
7236  /* computation of the inverse of a quadratic matrix A
7237  using the L-U-decomposition of A;
7238  There are two valid parametrisations:
7239  1) exactly one argument which is just the matrix A,
7240  2) exactly three arguments P, L, U which already
7241  realise the L-U-decomposition of A, that is,
7242  P * A = L * U, and P, L, and U satisfy the
7243  properties decribed in method 'jjLU_DECOMP';
7244  see there;
7245  If A is invertible, the list [1, A^(-1)] is returned,
7246  otherwise the list [0] is returned. Thus, the user may
7247  inspect the first entry of the returned list to see
7248  whether A is invertible. */
7249  matrix iMat; int invertible;
7250  const short t1[]={1,MATRIX_CMD};
7251  const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7252  if (iiCheckTypes(v,t1))
7253  {
7254  matrix aMat = (matrix)v->Data();
7255  int rr = aMat->rows();
7256  int cc = aMat->cols();
7257  if (rr != cc)
7258  {
7259  Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7260  return TRUE;
7261  }
7262  if (!idIsConstant((ideal)aMat))
7263  {
7264  WerrorS("matrix must be constant");
7265  return TRUE;
7266  }
7267  invertible = luInverse(aMat, iMat);
7268  }
7269  else if (iiCheckTypes(v,t2))
7270  {
7271  matrix pMat = (matrix)v->Data();
7272  matrix lMat = (matrix)v->next->Data();
7273  matrix uMat = (matrix)v->next->next->Data();
7274  int rr = uMat->rows();
7275  int cc = uMat->cols();
7276  if (rr != cc)
7277  {
7278  Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7279  rr, cc);
7280  return TRUE;
7281  }
7282  if (!idIsConstant((ideal)pMat)
7283  || (!idIsConstant((ideal)lMat))
7284  || (!idIsConstant((ideal)uMat))
7285  )
7286  {
7287  WerrorS("matricesx must be constant");
7288  return TRUE;
7289  }
7290  invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7291  }
7292  else
7293  {
7294  Werror("expected either one or three matrices");
7295  return TRUE;
7296  }
7297 
7298  /* build the return structure; a list with either one or two entries */
7300  if (invertible)
7301  {
7302  ll->Init(2);
7303  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7304  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7305  }
7306  else
7307  {
7308  ll->Init(1);
7309  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7310  }
7311 
7312  res->data=(char*)ll;
7313  return FALSE;
7314 }
int & rows()
Definition: matpol.h:23
int & cols()
Definition: matpol.h:24
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 7315 of file iparith.cc.

7316 {
7317  /* for solving a linear equation system A * x = b, via the
7318  given LU-decomposition of the matrix A;
7319  There is one valid parametrisation:
7320  1) exactly four arguments P, L, U, b;
7321  P, L, and U realise the L-U-decomposition of A, that is,
7322  P * A = L * U, and P, L, and U satisfy the
7323  properties decribed in method 'jjLU_DECOMP';
7324  see there;
7325  b is the right-hand side vector of the equation system;
7326  The method will return a list of either 1 entry or three entries:
7327  1) [0] if there is no solution to the system;
7328  2) [1, x, H] if there is at least one solution;
7329  x is any solution of the given linear system,
7330  H is the matrix with column vectors spanning the homogeneous
7331  solution space.
7332  The method produces an error if matrix and vector sizes do not fit. */
7333  const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7334  if (!iiCheckTypes(v,t))
7335  {
7336  WerrorS("expected exactly three matrices and one vector as input");
7337  return TRUE;
7338  }
7339  matrix pMat = (matrix)v->Data();
7340  matrix lMat = (matrix)v->next->Data();
7341  matrix uMat = (matrix)v->next->next->Data();
7342  matrix bVec = (matrix)v->next->next->next->Data();
7343  matrix xVec; int solvable; matrix homogSolSpace;
7344  if (pMat->rows() != pMat->cols())
7345  {
7346  Werror("first matrix (%d x %d) is not quadratic",
7347  pMat->rows(), pMat->cols());
7348  return TRUE;
7349  }
7350  if (lMat->rows() != lMat->cols())
7351  {
7352  Werror("second matrix (%d x %d) is not quadratic",
7353  lMat->rows(), lMat->cols());
7354  return TRUE;
7355  }
7356  if (lMat->rows() != uMat->rows())
7357  {
7358  Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7359  lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7360  return TRUE;
7361  }
7362  if (uMat->rows() != bVec->rows())
7363  {
7364  Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7365  uMat->rows(), uMat->cols(), bVec->rows());
7366  return TRUE;
7367  }
7368  if (!idIsConstant((ideal)pMat)
7369  ||(!idIsConstant((ideal)lMat))
7370  ||(!idIsConstant((ideal)uMat))
7371  )
7372  {
7373  WerrorS("matrices must be constant");
7374  return TRUE;
7375  }
7376  solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7377 
7378  /* build the return structure; a list with either one or three entries */
7380  if (solvable)
7381  {
7382  ll->Init(3);
7383  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7384  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7385  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7386  }
7387  else
7388  {
7389  ll->Init(1);
7390  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7391  }
7392 
7393  res->data=(char*)ll;
7394  return FALSE;
7395 }
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 8200 of file iparith.cc.

8201 {
8202  assume( e->Typ()==INT_CMD );
8203  Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8204  r->start =(int)(long)e->Data();
8205  return r;
8206 }
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

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

Definition at line 1655 of file iparith.cc.

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

◆ jjMATRIX_Id()

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

Definition at line 6593 of file iparith.cc.

6594 {
6595  int mi=(int)(long)v->Data();
6596  int ni=(int)(long)w->Data();
6597  if ((mi<1)||(ni<1))
6598  {
6599  Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6600  return TRUE;
6601  }
6602  matrix m=mpNew(mi,ni);
6603  ideal I=(ideal)u->CopyD(IDEAL_CMD);
6604  int i=si_min(IDELEMS(I),mi*ni);
6605  //for(i=i-1;i>=0;i--)
6606  //{
6607  // m->m[i]=I->m[i];
6608  // I->m[i]=NULL;
6609  //}
6610  memcpy(m->m,I->m,i*sizeof(poly));
6611  memset(I->m,0,i*sizeof(poly));
6612  id_Delete(&I,currRing);
6613  res->data = (char *)m;
6614  return FALSE;
6615 }

◆ jjMATRIX_Ma()

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

Definition at line 6629 of file iparith.cc.

6630 {
6631  int mi=(int)(long)v->Data();
6632  int ni=(int)(long)w->Data();
6633  if ((mi<1)||(ni<1))
6634  {
6635  Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6636  return TRUE;
6637  }
6638  matrix m=mpNew(mi,ni);
6639  matrix I=(matrix)u->CopyD(MATRIX_CMD);
6640  int r=si_min(MATROWS(I),mi);
6641  int c=si_min(MATCOLS(I),ni);
6642  int i,j;
6643  for(i=r;i>0;i--)
6644  {
6645  for(j=c;j>0;j--)
6646  {
6647  MATELEM(m,i,j)=MATELEM(I,i,j);
6648  MATELEM(I,i,j)=NULL;
6649  }
6650  }
6651  id_Delete((ideal *)&I,currRing);
6652  res->data = (char *)m;
6653  return FALSE;
6654 }

◆ jjMATRIX_Mo()

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

Definition at line 6616 of file iparith.cc.

6617 {
6618  int mi=(int)(long)v->Data();
6619  int ni=(int)(long)w->Data();
6620  if ((mi<0)||(ni<1))
6621  {
6622  Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6623  return TRUE;
6624  }
6625  res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6626  mi,ni,currRing);
6627  return FALSE;
6628 }

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4558 of file iparith.cc.

4559 {
4560  // clean out "_":
4562  memset(&sLastPrinted,0,sizeof(sleftv));
4563  // collect all info:
4564  omUpdateInfo();
4565  switch(((int)(long)v->Data()))
4566  {
4567  case 0:
4568  res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4569  break;
4570  case 1:
4571  res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4572  break;
4573  case 2:
4574  res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4575  break;
4576  default:
4577  omPrintStats(stdout);
4578  omPrintInfo(stdout);
4579  omPrintBinStats(stdout);
4580  res->data = (char *)0;
4581  res->rtyp = NONE;
4582  }
4583  return FALSE;
4584  res->data = (char *)0;
4585  return FALSE;
4586 }
omInfo_t om_Info
Definition: omStats.c:16
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
#define NONE
Definition: tok.h:220
#define omPrintStats(F)
Definition: xalloc.h:271
#define omPrintInfo(F)
Definition: xalloc.h:272
#define omPrintBinStats(F)
Definition: xalloc.h:273
#define omUpdateInfo()
Definition: xalloc.h:270

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6134 of file iparith.cc.

6135 {
6136  /* Here's the use pattern for the minor command:
6137  minor ( matrix_expression m, int_expression minorSize,
6138  optional ideal_expression IasSB, optional int_expression k,
6139  optional string_expression algorithm,
6140  optional int_expression cachedMinors,
6141  optional int_expression cachedMonomials )
6142  This method here assumes that there are at least two arguments.
6143  - If IasSB is present, it must be a std basis. All minors will be
6144  reduced w.r.t. IasSB.
6145  - If k is absent, all non-zero minors will be computed.
6146  If k is present and k > 0, the first k non-zero minors will be
6147  computed.
6148  If k is present and k < 0, the first |k| minors (some of which
6149  may be zero) will be computed.
6150  If k is present and k = 0, an error is reported.
6151  - If algorithm is absent, all the following arguments must be absent too.
6152  In this case, a heuristic picks the best-suited algorithm (among
6153  Bareiss, Laplace, and Laplace with caching).
6154  If algorithm is present, it must be one of "Bareiss", "bareiss",
6155  "Laplace", "laplace", "Cache", "cache". In the cases "Cache" and
6156  "cache" two more arguments may be given, determining how many entries
6157  the cache may have at most, and how many cached monomials there are at
6158  most. (Cached monomials are counted over all cached polynomials.)
6159  If these two additional arguments are not provided, 200 and 100000
6160  will be used as defaults.
6161  */
6162  matrix m;
6163  leftv u=v->next;
6164  v->next=NULL;
6165  int v_typ=v->Typ();
6166  if (v_typ==MATRIX_CMD)
6167  {
6168  m = (const matrix)v->Data();
6169  }
6170  else
6171  {
6172  if (v_typ==0)
6173  {
6174  Werror("`%s` is undefined",v->Fullname());
6175  return TRUE;
6176  }
6177  // try to convert to MATRIX:
6178  int ii=iiTestConvert(v_typ,MATRIX_CMD);
6179  BOOLEAN bo;
6180  sleftv tmp;
6181  if (ii>0) bo=iiConvert(v_typ,MATRIX_CMD,ii,v,&tmp);
6182  else bo=TRUE;
6183  if (bo)
6184  {
6185  Werror("cannot convert %s to matrix",Tok2Cmdname(v_typ));
6186  return TRUE;
6187  }
6188  m=(matrix)tmp.data;
6189  }
6190  const int mk = (const int)(long)u->Data();
6191  bool noIdeal = true; bool noK = true; bool noAlgorithm = true;
6192  bool noCacheMinors = true; bool noCacheMonomials = true;
6193  ideal IasSB; int k; char* algorithm; int cacheMinors; int cacheMonomials;
6194 
6195  /* here come the different cases of correct argument sets */
6196  if ((u->next != NULL) && (u->next->Typ() == IDEAL_CMD))
6197  {
6198  IasSB = (ideal)u->next->Data();
6199  noIdeal = false;
6200  if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6201  {
6202  k = (int)(long)u->next->next->Data();
6203  noK = false;
6204  assume(k != 0);
6205  if ((u->next->next->next != NULL) &&
6206  (u->next->next->next->Typ() == STRING_CMD))
6207  {
6208  algorithm = (char*)u->next->next->next->Data();
6209  noAlgorithm = false;
6210  if ((u->next->next->next->next != NULL) &&
6211  (u->next->next->next->next->Typ() == INT_CMD))
6212  {
6213  cacheMinors = (int)(long)u->next->next->next->next->Data();
6214  noCacheMinors = false;
6215  if ((u->next->next->next->next->next != NULL) &&
6216  (u->next->next->next->next->next->Typ() == INT_CMD))
6217  {
6218  cacheMonomials =
6219  (int)(long)u->next->next->next->next->next->Data();
6220  noCacheMonomials = false;
6221  }
6222  }
6223  }
6224  }
6225  }
6226  else if ((u->next != NULL) && (u->next->Typ() == INT_CMD))
6227  {
6228  k = (int)(long)u->next->Data();
6229  noK = false;
6230  assume(k != 0);
6231  if ((u->next->next != NULL) && (u->next->next->Typ() == STRING_CMD))
6232  {
6233  algorithm = (char*)u->next->next->Data();
6234  noAlgorithm = false;
6235  if ((u->next->next->next != NULL) &&
6236  (u->next->next->next->Typ() == INT_CMD))
6237  {
6238  cacheMinors = (int)(long)u->next->next->next->Data();
6239  noCacheMinors = false;
6240  if ((u->next->next->next->next != NULL) &&
6241  (u->next->next->next->next->Typ() == INT_CMD))
6242  {
6243  cacheMonomials = (int)(long)u->next->next->next->next->Data();
6244  noCacheMonomials = false;
6245  }
6246  }
6247  }
6248  }
6249  else if ((u->next != NULL) && (u->next->Typ() == STRING_CMD))
6250  {
6251  algorithm = (char*)u->next->Data();
6252  noAlgorithm = false;
6253  if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
6254  {
6255  cacheMinors = (int)(long)u->next->next->Data();
6256  noCacheMinors = false;
6257  if ((u->next->next->next != NULL) &&
6258  (u->next->next->next->Typ() == INT_CMD))
6259  {
6260  cacheMonomials = (int)(long)u->next->next->next->Data();
6261  noCacheMonomials = false;
6262  }
6263  }
6264  }
6265 
6266  /* upper case conversion for the algorithm if present */
6267  if (!noAlgorithm)
6268  {
6269  if (strcmp(algorithm, "bareiss") == 0)
6270  algorithm = (char*)"Bareiss";
6271  if (strcmp(algorithm, "laplace") == 0)
6272  algorithm = (char*)"Laplace";
6273  if (strcmp(algorithm, "cache") == 0)
6274  algorithm = (char*)"Cache";
6275  }
6276 
6277  v->next=u;
6278  /* here come some tests */
6279  if (!noIdeal)
6280  {
6281  assumeStdFlag(u->next);
6282  }
6283  if ((!noK) && (k == 0))
6284  {
6285  WerrorS("Provided number of minors to be computed is zero.");
6286  return TRUE;
6287  }
6288  if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") != 0)
6289  && (strcmp(algorithm, "Laplace") != 0)
6290  && (strcmp(algorithm, "Cache") != 0))
6291  {
6292  WerrorS("Expected as algorithm one of 'B/bareiss', 'L/laplace', or 'C/cache'.");
6293  return TRUE;
6294  }
6295  if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") == 0)
6296  && (!rField_is_Domain(currRing)))
6297  {
6298  Werror("Bareiss algorithm not defined over coefficient rings %s",
6299  "with zero divisors.");
6300  return TRUE;
6301  }
6302  res->rtyp=IDEAL_CMD;
6303  if ((mk < 1) || (mk > m->rows()) || (mk > m->cols()))
6304  {
6305  ideal I=idInit(1,1);
6306  if (mk<1) I->m[0]=p_One(currRing);
6307  //Werror("invalid size of minors: %d (matrix is (%d x %d))", mk,
6308  // m->rows(), m->cols());
6309  res->data=(void*)I;
6310  return FALSE;
6311  }
6312  if ((!noAlgorithm) && (strcmp(algorithm, "Cache") == 0)
6313  && (noCacheMinors || noCacheMonomials))
6314  {
6315  cacheMinors = 200;
6316  cacheMonomials = 100000;
6317  }
6318 
6319  /* here come the actual procedure calls */
6320  if (noAlgorithm)
6321  res->data = getMinorIdealHeuristic(m, mk, (noK ? 0 : k),
6322  (noIdeal ? 0 : IasSB), false);
6323  else if (strcmp(algorithm, "Cache") == 0)
6324  res->data = getMinorIdealCache(m, mk, (noK ? 0 : k),
6325  (noIdeal ? 0 : IasSB), 3, cacheMinors,
6326  cacheMonomials, false);
6327  else
6328  res->data = getMinorIdeal(m, mk, (noK ? 0 : k), algorithm,
6329  (noIdeal ? 0 : IasSB), false);
6330  if (v_typ!=MATRIX_CMD) idDelete((ideal *)&m);
6331  return FALSE;
6332 }
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:1303

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4612 of file iparith.cc.

4613 {
4614  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4615 
4616  syStrategy tmp=(syStrategy)v->Data();
4617  tmp = syMinimize(tmp); // enrich itself!
4618 
4619  res->data=(char *)tmp;
4620 
4621  if (weights!=NULL)
4622  atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4623 
4624  return FALSE;
4625 }
syStrategy syMinimize(syStrategy syzstr)
Definition: syz1.cc:2394
ssyStrategy * syStrategy
Definition: syz.h:35

◆ 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);
925  sBucket_Add_p(b,p,l);
926  p= (poly)v->CopyD(POLY_CMD);
927  p=p_Neg(p,currRing);
928  l=pLength(p);
929  sBucket_Add_p(b,p,l);
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:1046
static unsigned pLength(poly a)
Definition: p_polys.h:191
void sBucket_Add_p(sBucket_pt bucket, poly p, int length)
adds poly p to bucket destroys p!
Definition: sbuckets.cc:203
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96

◆ jjMINUS_B_P()

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

Definition at line 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);
916  sBucket_Add_p(b,p,l);
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  int aa=(int)(long)ap;
883  int bb=(int)(long)bp;
884  int cc=aa-bb;
885  unsigned int a=(unsigned int)(unsigned long)ap;
886  unsigned int b=(unsigned int)(unsigned long)bp;
887  unsigned int c=a-b;
888  if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
889  {
890  WarnS("int overflow(-), result may be wrong");
891  }
892  res->data = (char *)((long)cc);
893  return jjPLUSMINUS_Gen(res,u,v);
894 }
Definition: ap.h:40
#define Sy_bit(x)
Definition: options.h:31

◆ jjMINUS_IV()

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

Definition at line 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:279

◆ 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:196
#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:1881

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

◆ jjMOD_BI()

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

Definition at line 2652 of file iparith.cc.

2653 {
2654  number q=(number)v->Data();
2655  if (n_IsZero(q,coeffs_BIGINT))
2656  {
2658  return TRUE;
2659  }
2660  res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2661  return FALSE;
2662 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628

◆ jjMOD_N()

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

Definition at line 2663 of file iparith.cc.

2664 {
2665  number q=(number)v->Data();
2666  if (nIsZero(q))
2667  {
2669  return TRUE;
2670  }
2671  res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2672  return FALSE;
2673 }

◆ jjMOD_P()

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

Definition at line 2674 of file iparith.cc.

2675 {
2676  poly q=(poly)v->Data();
2677  if (q==NULL)
2678  {
2680  return TRUE;
2681  }
2682  poly p=(poly)(u->Data());
2683  if (p==NULL)
2684  {
2685  res->data=NULL;
2686  return FALSE;
2687  }
2688  res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2689  q /*(poly)(v->Data())*/ ,currRing));
2690  return FALSE;
2691 }
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:605

◆ jjMODULO()

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

Definition at line 2603 of file iparith.cc.

2604 {
2605  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2606  tHomog hom=testHomog;
2607  if (w_u!=NULL)
2608  {
2609  w_u=ivCopy(w_u);
2610  hom=isHomog;
2611  }
2612  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2613  if (w_v!=NULL)
2614  {
2615  w_v=ivCopy(w_v);
2616  hom=isHomog;
2617  }
2618  if ((w_u!=NULL) && (w_v==NULL))
2619  w_v=ivCopy(w_u);
2620  if ((w_v!=NULL) && (w_u==NULL))
2621  w_u=ivCopy(w_v);
2622  ideal u_id=(ideal)u->Data();
2623  ideal v_id=(ideal)v->Data();
2624  if (w_u!=NULL)
2625  {
2626  if ((*w_u).compare((w_v))!=0)
2627  {
2628  WarnS("incompatible weights");
2629  delete w_u; w_u=NULL;
2630  hom=testHomog;
2631  }
2632  else
2633  {
2634  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2635  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2636  {
2637  WarnS("wrong weights");
2638  delete w_u; w_u=NULL;
2639  hom=testHomog;
2640  }
2641  }
2642  }
2643  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2644  if (w_u!=NULL)
2645  {
2646  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2647  }
2648  delete w_v;
2649  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2650  return FALSE;
2651 }
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w)
Definition: ideals.cc:2251
tHomog
Definition: structs.h:40
@ isHomog
Definition: structs.h:42

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2693 of file iparith.cc.

2694 {
2695  return jjMONITOR2(res,v,NULL);
2696 }
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2697

◆ jjMONITOR2()

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

Definition at line 2697 of file iparith.cc.

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

◆ jjMONOM()

static BOOLEAN jjMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 2738 of file iparith.cc.

2739 {
2740  intvec *iv=(intvec *)v->Data();
2741  poly p=pOne();
2742  int e;
2743  BOOLEAN err=FALSE;
2744  for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2745  {
2746  e=(*iv)[i-1];
2747  if (e>=0) pSetExp(p,i,e);
2748  else err=TRUE;
2749  }
2750  if (iv->length()==(currRing->N+1))
2751  {
2752  res->rtyp=VECTOR_CMD;
2753  e=(*iv)[currRing->N];
2754  if (e>=0) pSetComp(p,e);
2755  else err=TRUE;
2756  }
2757  pSetm(p);
2758  res->data=(char*)p;
2759  if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2760  return err;
2761 }

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5512 of file iparith.cc.

5513 {
5514  res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5515  return FALSE;
5516 }
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:275

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5517 of file iparith.cc.

5518 {
5519  res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5520  return FALSE;
5521 }
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:254

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4591 of file iparith.cc.

4592 {
4593  int t=v->Typ();
4594  ideal r,m;
4595  r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4597  l->Init(2);
4598  l->m[0].rtyp=t;
4599  l->m[0].data=(char *)r;
4600  setFlag(&(l->m[0]),FLAG_STD);
4601  l->m[1].rtyp=t;
4602  l->m[1].data=(char *)m;
4603  res->data=(char *)l;
4604  return FALSE;
4605 }
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2675

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4606 of file iparith.cc.

4607 {
4608  assumeStdFlag(v);
4609  res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4610  return FALSE;
4611 }
int scMultInt(ideal S, ideal Q)
Definition: hdegree.cc:798

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4626 of file iparith.cc.

4627 {
4628  number n,i; i=(number)v->Data();
4630  if (nMap!=NULL)
4631  n=nMap(i,currRing->cf,coeffs_BIGINT);
4632  else goto err;
4633  res->data=(void *)n;
4634  return FALSE;
4635 err:
4636  WerrorS("cannot convert to bigint"); return TRUE;
4637 }

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4638 of file iparith.cc.

4639 {
4640  if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4641  res->data=omStrDup(v->name);
4642  else if (v->name==NULL)
4643  res->data=omStrDup("");
4644  else
4645  {
4646  res->data = (char *)v->name;
4647  v->name=NULL;
4648  }
4649  return FALSE;
4650 }

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4651 of file iparith.cc.

4652 {
4653  res->data=ipNameList(((ring)v->Data())->idroot);
4654  return FALSE;
4655 }
lists ipNameList(idhdl root)
Definition: ipid.cc:544

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 7678 of file iparith.cc.

7679 {
7680  res->data=(void *)ipNameList(IDROOT);
7681  return FALSE;
7682 }

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4656 of file iparith.cc.

4657 {
4658  res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4659  return FALSE;
4660 }
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:567

◆ jjNEWSTRUCT2()

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

Definition at line 2762 of file iparith.cc.

2763 {
2764  // u: the name of the new type
2765  // v: the elements
2766  const char *s=(const char *)u->Data();
2767  newstruct_desc d=NULL;
2768  if (strlen(s)>=2)
2769  {
2770  d=newstructFromString((const char *)v->Data());
2771  if (d!=NULL) newstruct_setup(s,d);
2772  }
2773  else WerrorS("name of newstruct must be longer than 1 character");
2774  return d==NULL;
2775 }
void newstruct_setup(const char *n, newstruct_desc d)
Definition: newstruct.cc:705
newstruct_desc newstructFromString(const char *s)
Definition: newstruct.cc:809

◆ jjNEWSTRUCT3()

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

Definition at line 6333 of file iparith.cc.

6334 {
6335  // u: the name of the new type
6336  // v: the parent type
6337  // w: the elements
6338  newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6339  (const char *)w->Data());
6340  if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6341  return (d==NULL);
6342 }
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition: newstruct.cc:816

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5552 of file iparith.cc.

5553 {
5554  number n=(number)u->CopyD(); // n_Int may call n_Normalize
5555  res->data=(char *)(long)iin_Int(n,currRing->cf);
5556  n_Delete(&n,currRing->cf);
5557  return FALSE;
5558 }
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:219

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5559 of file iparith.cc.

5560 {
5561  number n=(number)u->Data();
5562  res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5563  return FALSE;
5564 }

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4661 of file iparith.cc.

4662 {
4663  res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4664  return FALSE;
4665 }

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3621 of file iparith.cc.

3622 {
3623  return FALSE;
3624 }

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number NOTE: the input number is normalized as a side effect.

Definition at line 3922 of file iparith.cc.

3923 {
3924  number n = reinterpret_cast<number>(v->Data());
3925  res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
3926  return FALSE;
3927 }
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4666 of file iparith.cc.

4667 {
4668  res->data = (char *)(long)(((ring)(v->Data()))->N);
4669  return FALSE;
4670 }

◆ jjOP_BI_BIM()

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

Definition at line 277 of file iparith.cc.

278 {
279  return jjOP_BIM_BI(res, v, u);
280 }
static BOOLEAN jjOP_BIM_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:264

◆ jjOP_BIM_BI()

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

Definition at line 264 of file iparith.cc.

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

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

261 {
262  return jjOP_BIM_I(res, v, u);
263 }
static BOOLEAN jjOP_BIM_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:245

◆ jjOP_I_IM()

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

Definition at line 317 of file iparith.cc.

318 {
319  return jjOP_IM_I(res,v,u);
320 }
static BOOLEAN jjOP_IM_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:302

◆ jjOP_I_IV()

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

Definition at line 298 of file iparith.cc.

299 {
300  return jjOP_IV_I(res,v,u);
301 }
static BOOLEAN jjOP_IV_I(leftv res, leftv u, leftv v)
Definition: iparith.cc:281

◆ jjOP_IM_I()

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

Definition at line 302 of file iparith.cc.

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

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

◆ jjOP_REST()

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

Definition at line 505 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4671 of file iparith.cc.

4672 {
4673  si_link l=(si_link)v->Data();
4674  if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4675  else { slPrepClose(l); return slClose(l);}
4676 }
@ OPEN_CMD
Definition: tok.h:144

◆ jjOPPOSE()

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

Definition at line 2941 of file iparith.cc.

2942 {
2943  /* number, poly, vector, ideal, module, matrix */
2944  ring r = (ring)a->Data();
2945  if (r == currRing)
2946  {
2947  res->data = b->Data();
2948  res->rtyp = b->rtyp;
2949  return FALSE;
2950  }
2951  if (!rIsLikeOpposite(currRing, r))
2952  {
2953  Werror("%s is not an opposite ring to current ring",a->Fullname());
2954  return TRUE;
2955  }
2956  idhdl w;
2957  if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
2958  {
2959  int argtype = IDTYP(w);
2960  switch (argtype)
2961  {
2962  case NUMBER_CMD:
2963  {
2964  /* since basefields are equal, we can apply nCopy */
2965  res->data = nCopy((number)IDDATA(w));
2966  res->rtyp = argtype;
2967  break;
2968  }
2969  case POLY_CMD:
2970  case VECTOR_CMD:
2971  {
2972  poly q = (poly)IDDATA(w);
2973  res->data = pOppose(r,q,currRing);
2974  res->rtyp = argtype;
2975  break;
2976  }
2977  case IDEAL_CMD:
2978  case MODUL_CMD:
2979  {
2980  ideal Q = (ideal)IDDATA(w);
2981  res->data = idOppose(r,Q,currRing);
2982  res->rtyp = argtype;
2983  break;
2984  }
2985  case MATRIX_CMD:
2986  {
2987  ring save = currRing;
2988  rChangeCurrRing(r);
2989  matrix m = (matrix)IDDATA(w);
2991  rChangeCurrRing(save);
2992  ideal S = idOppose(r,Q,currRing);
2993  id_Delete(&Q, r);
2994  res->data = id_Module2Matrix(S,currRing);
2995  res->rtyp = argtype;
2996  break;
2997  }
2998  default:
2999  {
3000  WerrorS("unsupported type in oppose");
3001  return TRUE;
3002  }
3003  }
3004  }
3005  else
3006  {
3007  Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
3008  return TRUE;
3009  }
3010  return FALSE;
3011 }
@ 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:3407
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3368
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:3341
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 5125 of file iparith.cc.

5126 {
5127  ring r = (ring)a->Data();
5128  //if (rIsPluralRing(r))
5129  if (r->OrdSgn==1)
5130  {
5131  res->data = rOpposite(r);
5132  }
5133  else
5134  {
5135  WarnS("opposite only for global orderings");
5136  res->data = rCopy(r);
5137  }
5138  return FALSE;
5139 }
ring rOpposite(ring src)
Definition: ring.cc:5190

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7683 of file iparith.cc.

7684 {
7685  if(v==NULL)
7686  {
7687  res->data=(char *)showOption();
7688  return FALSE;
7689  }
7690  res->rtyp=NONE;
7691  return setOption(res,v);
7692 }
BOOLEAN setOption(leftv res, leftv v)
Definition: misc_ip.cc:581
char * showOption()
Definition: misc_ip.cc:723

◆ jjOR_I()

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

Definition at line 1384 of file iparith.cc.

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

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4677 of file iparith.cc.

4678 {
4679  poly p=(poly)v->Data();
4680  res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4681  return FALSE;
4682 }

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4723 of file iparith.cc.

4724 {
4725  poly p=(poly)v->Data();
4726  if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4727  if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4728  {
4729  WerrorS("poly must be constant");
4730  return TRUE;
4731  }
4732  number i=pGetCoeff(p);
4733  number n;
4735  if (nMap!=NULL)
4736  n=nMap(i,currRing->cf,coeffs_BIGINT);
4737  else goto err;
4738  res->data=(void *)n;
4739  return FALSE;
4740 err:
4741  WerrorS("cannot convert to bigint"); return TRUE;
4742 }

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4743 of file iparith.cc.

4744 {
4745  poly p=(poly)v->Data();
4746  if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4747  if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4748  {
4749  WerrorS("poly must be constant");
4750  return TRUE;
4751  }
4752  res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4753  return FALSE;
4754 }

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4791 of file iparith.cc.

4792 {
4793  number n;
4794  poly p;
4795  if (((p=(poly)v->Data())!=NULL)
4796  && (pIsConstant(p)))
4797  {
4798  n=nCopy(pGetCoeff(p));
4799  }
4800  else
4801  {
4802  n=nInit(0);
4803  }
4804  res->data = (char *)n;
4805  return FALSE;
4806 }

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4683 of file iparith.cc.

4684 {
4685  int i=(int)(long)v->Data();
4686  int p=0;
4687  p=rPar(currRing);
4688  if ((0<i) && (i<=p))
4689  {
4690  res->data=(char *)n_Param(i,currRing);
4691  }
4692  else
4693  {
4694  Werror("par number %d out of range 1..%d",i,p);
4695  return TRUE;
4696  }
4697  return FALSE;
4698 }
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:805

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4699 of file iparith.cc.

4700 {
4701  number nn=(number)v->Data();
4702  res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4703  return FALSE;
4704 }
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition: coeffs.h:792

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4705 of file iparith.cc.

4706 {
4707  if (currRing==NULL)
4708  {
4709  WerrorS("no ring active");
4710  return TRUE;
4711  }
4712  int i=(int)(long)v->Data();
4713  int p=0;
4714  if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4715  res->data=omStrDup(rParameter(currRing)[i-1]);
4716  else
4717  {
4718  Werror("par number %d out of range 1..%d",i,p);
4719  return TRUE;
4720  }
4721  return FALSE;
4722 }

◆ jjPARSTR2()

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

Definition at line 2776 of file iparith.cc.

2777 {
2778  idhdl h=(idhdl)u->data;
2779  int i=(int)(long)v->Data();
2780  int p=0;
2781  if ((0<i)
2782  && (rParameter(IDRING(h))!=NULL)
2783  && (i<=(p=rPar(IDRING(h)))))
2784  res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2785  else
2786  {
2787  Werror("par number %d out of range 1..%d",i,p);
2788  return TRUE;
2789  }
2790  return FALSE;
2791 }
#define IDRING(a)
Definition: ipid.h:122

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4519 of file iparith.cc.

4520 {
4521  /* call method jjPFAC2 with second argument = 0 (meaning that no
4522  valid bound for the prime factors has been given) */
4523  sleftv tmp;
4524  memset(&tmp, 0, sizeof(tmp));
4525  tmp.rtyp = INT_CMD;
4526  return jjPFAC2(res, v, &tmp);
4527 }
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3198

◆ jjPFAC2()

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

Definition at line 3198 of file iparith.cc.

3199 {
3200  number n1; int i;
3201 
3202  if ((u->Typ() == BIGINT_CMD) ||
3203  ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3204  {
3205  n1 = (number)u->CopyD();
3206  }
3207  else if (u->Typ() == INT_CMD)
3208  {
3209  i = (int)(long)u->Data();
3210  n1 = n_Init(i, coeffs_BIGINT);
3211  }
3212  else
3213  {
3214  return TRUE;
3215  }
3216 
3217  i = (int)(long)v->Data();
3218 
3219  lists l = primeFactorisation(n1, i);
3220  n_Delete(&n1, coeffs_BIGINT);
3221  res->data = (char*)l;
3222  return FALSE;
3223 }
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:367

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5484 of file iparith.cc.

5485 {
5486  res->data = (char *)pHead((poly)v->Data());
5487  return FALSE;
5488 }

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5459 of file iparith.cc.

5460 {
5461  res->data = (char *)(long)pLength((poly)v->Data());
5462  return FALSE;
5463 }

◆ jjPlural_mat_mat()

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

Definition at line 2853 of file iparith.cc.

2854 {
2855  if( currRing->qideal != NULL )
2856  {
2857  WerrorS("basering must NOT be a qring!");
2858  return TRUE;
2859  }
2860 
2861  if (iiOp==NCALGEBRA_CMD)
2862  {
2863  return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2864  }
2865  else
2866  {
2867  ring r=rCopy(currRing);
2868  BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2869  res->data=r;
2870  return result;
2871  }
2872 }
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2682
@ NCALGEBRA_CMD
Definition: tok.h:137

◆ jjPlural_mat_poly()

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

Definition at line 2833 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2813 of file iparith.cc.

2814 {
2815  if( currRing->qideal != NULL )
2816  {
2817  WerrorS("basering must NOT be a qring!");
2818  return TRUE;
2819  }
2820 
2821  if (iiOp==NCALGEBRA_CMD)
2822  {
2823  return nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,currRing,false,true,false,currRing);
2824  }
2825  else
2826  {
2827  ring r=rCopy(currRing);
2828  BOOLEAN result=nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,r,false,true,false,currRing);
2829  res->data=r;
2830  return result;
2831  }
2832 }

◆ jjPlural_num_poly()

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

Definition at line 2793 of file iparith.cc.

2794 {
2795  if( currRing->qideal != NULL )
2796  {
2797  WerrorS("basering must NOT be a qring!");
2798  return TRUE;
2799  }
2800 
2801  if (iiOp==NCALGEBRA_CMD)
2802  {
2803  return nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),currRing,false,true,false,currRing);
2804  }
2805  else
2806  {
2807  ring r=rCopy(currRing);
2808  BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),r,false,true,false,currRing);
2809  res->data=r;
2810  return result;
2811  }
2812 }

◆ 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);
789  sBucket_Add_p(b,p,l);
790  p= (poly)v->CopyD(POLY_CMD);
791  l=pLength(p);
792  sBucket_Add_p(b,p,l);
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);
801  sBucket_Add_p(b,p,l);
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:656

◆ 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 int a=(unsigned int)(unsigned long)u->Data();
759  unsigned int b=(unsigned int)(unsigned long)v->Data();
760  unsigned int c=a+b;
761  res->data = (char *)((long)c);
762  if (((Sy_bit(31)&a)==(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&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:179

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

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

◆ 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)
644  res->next = (leftv)omAlloc0Bin(sleftv_bin);
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  {
658  res->next = (leftv)omAlloc0Bin(sleftv_bin);
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  {
670  res->next = (leftv)omAlloc0Bin(sleftv_bin);
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  {
686  res->next = (leftv)omAlloc0Bin(sleftv_bin);
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 3635 of file iparith.cc.

3636 {
3637  if (IDTYP((idhdl)u->data)==INT_CMD)
3638  {
3639  int i=IDINT((idhdl)u->data);
3640  if (iiOp==PLUSPLUS) i++;
3641  else i--;
3642  IDDATA((idhdl)u->data)=(char *)(long)i;
3643  return FALSE;
3644  }
3645  return TRUE;
3646 }
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:120

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5507 of file iparith.cc.

5508 {
5509  res->data = (char *)pMaxComp((poly)v->Data());
5510  return FALSE;
5511 }

◆ jjPOWER_BI()

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

Definition at line 567 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 521 of file iparith.cc.

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

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

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

602 {
603  int v_i=(int)(long)v->Data();
604  if (v_i<0)
605  {
606  WerrorS("exponent must be non-negative");
607  return TRUE;
608  }
609  poly u_p=(poly)u->CopyD(POLY_CMD);
610  if ((u_p!=NULL)
611  #ifdef HAVE_SHIFTBBA
612  && (!rIsLPRing(currRing))
613  #endif
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:278

◆ jjPREIMAGE()

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

Definition at line 6343 of file iparith.cc.

6344 {
6345  // handles preimage(r,phi,i) and kernel(r,phi)
6346  idhdl h;
6347  ring rr;
6348  map mapping;
6349  BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6350 
6351  if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6352  {
6353  WerrorS("2nd/3rd arguments must have names");
6354  return TRUE;
6355  }
6356  rr=(ring)u->Data();
6357  const char *ring_name=u->Name();
6358  if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6359  {
6360  if (h->typ==MAP_CMD)
6361  {
6362  mapping=IDMAP(h);
6363  idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6364  if ((preim_ring==NULL)
6365  || (IDRING(preim_ring)!=currRing))
6366  {
6367  Werror("preimage ring `%s` is not the basering",mapping->preimage);
6368  return TRUE;
6369  }
6370  }
6371  else if (h->typ==IDEAL_CMD)
6372  {
6373  mapping=IDMAP(h);
6374  }
6375  else
6376  {
6377  Werror("`%s` is no map nor ideal",IDID(h));
6378  return TRUE;
6379  }
6380  }
6381  else
6382  {
6383  Werror("`%s` is not defined in `%s`",v->name,ring_name);
6384  return TRUE;
6385  }
6386  ideal image;
6387  if (kernel_cmd) image=idInit(1,1);
6388  else
6389  {
6390  if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6391  {
6392  if (h->typ==IDEAL_CMD)
6393  {
6394  image=IDIDEAL(h);
6395  }
6396  else
6397  {
6398  Werror("`%s` is no ideal",IDID(h));
6399  return TRUE;
6400  }
6401  }
6402  else
6403  {
6404  Werror("`%s` is not defined in `%s`",w->name,ring_name);
6405  return TRUE;
6406  }
6407  }
6408  if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6409  || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6410  {
6411  WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6412  }
6413  res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6414  if (kernel_cmd) idDelete(&image);
6415  return (res->data==NULL/* is of type ideal, should not be NULL*/);
6416 }
#define IDMAP(a)
Definition: ipid.h:130
#define IDIDEAL(a)
Definition: ipid.h:128
#define IDID(a)
Definition: ipid.h:117
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:60
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4755 of file iparith.cc.

4756 {
4757  map mapping=(map)v->Data();
4758  syMake(res,omStrDup(mapping->preimage));
4759  return FALSE;
4760 }

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4761 of file iparith.cc.

4762 {
4763  int i = IsPrime((int)(long)(v->Data()));
4764  res->data = (char *)(long)(i > 1 ? i : 2);
4765  return FALSE;
4766 }
int IsPrime(int p)
Definition: prime.cc:61

◆ jjPROC()

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

Definition at line 1619 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3713 of file iparith.cc.

3714 {
3715  return jjPROC(res,u,NULL);
3716 }
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1619

◆ jjPROC3()

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

Definition at line 5848 of file iparith.cc.

5849 {
5851  memcpy(v->next,w,sizeof(sleftv));
5852  memset(w,0,sizeof(sleftv));
5853  return jjPROC(res,u,v);
5854 }

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4767 of file iparith.cc.

4768 {
4769  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4770  ideal v_id=(ideal)v->Data();
4771  if (w!=NULL)
4772  {
4773  if (!idTestHomModule(v_id,currRing->qideal,w))
4774  {
4775  WarnS("wrong weights");
4776  w=NULL;
4777  // and continue at the non-homog case below
4778  }
4779  else
4780  {
4781  w=ivCopy(w);
4782  intvec **ww=&w;
4783  res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4784  atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4785  return FALSE;
4786  }
4787  }
4788  res->data = (char *)idMinEmbedding(v_id);
4789  return FALSE;
4790 }
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2562

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8078 of file iparith.cc.

8079 {
8080  if ((INPUT->Typ() != MATRIX_CMD) ||
8081  (INPUT->next->Typ() != NUMBER_CMD) ||
8082  (INPUT->next->next->Typ() != NUMBER_CMD) ||
8083  (INPUT->next->next->next->Typ() != NUMBER_CMD))
8084  {
8085  WerrorS("expected (matrix, number, number, number) as arguments");
8086  return TRUE;
8087  }
8088  leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8089  res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8090  (number)(v->Data()),
8091  (number)(w->Data()),
8092  (number)(x->Data()));
8093  return FALSE;
8094 }
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 3014 of file iparith.cc.

3015 {
3016  res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3017  hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3018  id_DelMultiples((ideal)(res->data),currRing);
3020  return FALSE;
3021 }
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1476
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

◆ jjRANDOM()

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

Definition at line 3022 of file iparith.cc.

3023 {
3024  int i=(int)(long)u->Data();
3025  int j=(int)(long)v->Data();
3026  if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3027  res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3028  return FALSE;
3029 }
int siRand()
Definition: sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6417 of file iparith.cc.

6418 {
6419  int di, k;
6420  int i=(int)(long)u->Data();
6421  int r=(int)(long)v->Data();
6422  int c=(int)(long)w->Data();
6423  if ((r<=0) || (c<=0)) return TRUE;
6424  intvec *iv = new intvec(r, c, 0);
6425  if (iv->rows()==0)
6426  {
6427  delete iv;
6428  return TRUE;
6429  }
6430  if (i!=0)
6431  {
6432  if (i<0) i = -i;
6433  di = 2 * i + 1;
6434  for (k=0; k<iv->length(); k++)
6435  {
6436  (*iv)[k] = ((siRand() % di) - i);
6437  }
6438  }
6439  res->data = (char *)iv;
6440  return FALSE;
6441 }

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4829 of file iparith.cc.

4830 {
4831  matrix m =(matrix)v->Data();
4832  int rank = luRank(m, 0);
4833  res->data =(char *)(long)rank;
4834  return FALSE;
4835 }
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 3030 of file iparith.cc.

3031 {
3032  matrix m =(matrix)u->Data();
3033  int isRowEchelon = (int)(long)v->Data();
3034  if (isRowEchelon != 1) isRowEchelon = 0;
3035  int rank = luRank(m, isRowEchelon);
3036  res->data =(char *)(long)rank;
3037  return FALSE;
3038 }

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5479 of file iparith.cc.

5480 {
5481  res->data = rCharStr((ring)v->Data());
5482  return FALSE;
5483 }
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 4836 of file iparith.cc.

4837 {
4838  return jjREAD2(res,v,NULL);
4839 }
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3039

◆ jjREAD2()

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

Definition at line 3039 of file iparith.cc.

3040 {
3041  si_link l=(si_link)u->Data();
3042  leftv r=slRead(l,v);
3043  if (r==NULL)
3044  {
3045  const char *s;
3046  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3047  else s=sNoName_fe;
3048  Werror("cannot read from `%s`",s);
3049  return TRUE;
3050  }
3051  memcpy(res,r,sizeof(sleftv));
3053  return FALSE;
3054 }

◆ jjREDUCE3_CID()

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

Definition at line 6705 of file iparith.cc.

6706 {
6707  assumeStdFlag(v);
6708  if (!idIsZeroDim((ideal)v->Data()))
6709  {
6710  Werror("`%s` must be 0-dimensional",v->Name());
6711  return TRUE;
6712  }
6713  res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
6714  (matrix)w->CopyD());
6715  return FALSE;
6716 }
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:178
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1866

◆ jjREDUCE3_CP()

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

Definition at line 6693 of file iparith.cc.

6694 {
6695  assumeStdFlag(v);
6696  if (!idIsZeroDim((ideal)v->Data()))
6697  {
6698  Werror("`%s` must be 0-dimensional",v->Name());
6699  return TRUE;
6700  }
6701  res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
6702  (poly)w->CopyD());
6703  return FALSE;
6704 }

◆ jjREDUCE3_ID()

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

Definition at line 6724 of file iparith.cc.

6725 {
6726  assumeStdFlag(v);
6727  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
6728  0,(int)(long)w->Data());
6729  return FALSE;
6730 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2824

◆ jjREDUCE3_P()

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

Definition at line 6717 of file iparith.cc.

6718 {
6719  assumeStdFlag(v);
6720  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
6721  0,(int)(long)w->Data());
6722  return FALSE;
6723 }

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 7693 of file iparith.cc.

7694 {
7695  leftv u1=u;
7696  leftv u2=u1->next;
7697  leftv u3=u2->next;
7698  leftv u4=u3->next;
7699  int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
7700  int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
7701  if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
7702  {
7703  int save_d=Kstd1_deg;
7704  Kstd1_deg=(int)(long)u3->Data();
7705  kModW=(intvec *)u4->Data();
7706  BITSET save2;
7707  SI_SAVE_OPT2(save2);
7709  u2->next=NULL;
7710  BOOLEAN r=jjCALL2ARG(res,u);
7711  kModW=NULL;
7712  Kstd1_deg=save_d;
7713  SI_RESTORE_OPT2(save2);
7714  u->next->next=u3;
7715  return r;
7716  }
7717  else
7718  if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7719  (u4->Typ()==INT_CMD))
7720  {
7721  assumeStdFlag(u3);
7722  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7723  {
7724  WerrorS("2nd argument must be a diagonal matrix of units");
7725  return TRUE;
7726  }
7727  res->rtyp=IDEAL_CMD;
7728  res->data=(char*)redNF(
7729  idCopy((ideal)u3->Data()),
7730  idCopy((ideal)u1->Data()),
7731  mp_Copy((matrix)u2->Data(), currRing),
7732  (int)(long)u4->Data()
7733  );
7734  return FALSE;
7735  }
7736  else
7737  if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7738  (u4->Typ()==INT_CMD))
7739  {
7740  poly u1p;
7741  if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
7742  else u1p=(poly)u1->Data();
7743  poly u2p;
7744  if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
7745  else u2p=(poly)u2->Data();
7746  assumeStdFlag(u3);
7747  if(!pIsUnit(u2p))
7748  {
7749  WerrorS("2nd argument must be a unit");
7750  return TRUE;
7751  }
7752  res->rtyp=POLY_CMD;
7753  res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
7754  pCopy(u2p),(int)(long)u4->Data());
7755  return FALSE;
7756  }
7757  else
7758  {
7759  Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
7760  Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
7761  Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
7762  return TRUE;
7763  }
7764 }
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:6854
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
VAR unsigned si_opt_2
Definition: options.c:6
#define SI_SAVE_OPT2(A)
Definition: options.h:22
#define SI_RESTORE_OPT2(A)
Definition: options.h:25
#define V_DEG_STOP
Definition: options.h:70
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
#define BITSET
Definition: structs.h:20

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 7765 of file iparith.cc.

7766 {
7767  leftv u1=u;
7768  leftv u2=u1->next;
7769  leftv u3=u2->next;
7770  leftv u4=u3->next;
7771  leftv u5=u4->next;
7772  if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7773  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
7774  {
7775  assumeStdFlag(u3);
7776  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7777  {
7778  WerrorS("2nd argument must be a diagonal matrix of units");
7779  return TRUE;
7780  }
7781  res->rtyp=IDEAL_CMD;
7782  res->data=(char*)redNF(
7783  idCopy((ideal)u3->Data()),
7784  idCopy((ideal)u1->Data()),
7785  mp_Copy((matrix)u2->Data(),currRing),
7786  (int)(long)u4->Data(),
7787  (intvec*)u5->Data()
7788  );
7789  return FALSE;
7790  }
7791  else
7792  if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7793  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
7794  {
7795  assumeStdFlag(u3);
7796  if(!pIsUnit((poly)u2->Data()))
7797  {
7798  WerrorS("2nd argument must be a unit");
7799  return TRUE;
7800  }
7801  res->rtyp=POLY_CMD;
7802  res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
7803  pCopy((poly)u2->Data()),
7804  (int)(long)u4->Data(),(intvec*)u5->Data());
7805  return FALSE;
7806  }
7807  else
7808  {
7809  Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
7810  Tok2Cmdname(iiOp));
7811  return TRUE;
7812  }
7813 }

◆ jjREDUCE_ID()

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

Definition at line 3063 of file iparith.cc.

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

◆ jjREDUCE_P()

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

Definition at line 3055 of file iparith.cc.

3056 {
3057  ideal vi=(ideal)v->Data();
3058  if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3059  assumeStdFlag(v);
3060  res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3061  return FALSE;
3062 }

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4840 of file iparith.cc.

4841 {
4842  res->data = (char *)(long)iiRegularity((lists)v->Data());
4843  return FALSE;
4844 }
int iiRegularity(lists L)
Definition: ipshell.cc:959

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4845 of file iparith.cc.

4846 {
4847  res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4848  return FALSE;
4849 }
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition: coeffs.h:812

◆ jjRES()

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

Definition at line 3072 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 6732 of file iparith.cc.

6733 {
6734  int maxl=(int)v->Data();
6735  ideal u_id=(ideal)u->Data();
6736  int l=0;
6737  resolvente r;
6738  intvec **weights=NULL;
6739  int wmaxl=maxl;
6740  maxl--;
6741  if ((maxl==-1) && (iiOp!=MRES_CMD))
6742  maxl = currRing->N-1;
6743  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
6744  {
6745  intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6746  if (iv!=NULL)
6747  {
6748  l=1;
6749  if (!idTestHomModule(u_id,currRing->qideal,iv))
6750  {
6751  WarnS("wrong weights");
6752  iv=NULL;
6753  }
6754  else
6755  {
6756  weights = (intvec**)omAlloc0Bin(char_ptr_bin);
6757  weights[0] = ivCopy(iv);
6758  }
6759  }
6760  r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
6761  }
6762  else
6763  r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
6764  if (r==NULL) return TRUE;
6765  int t3=u->Typ();
6766  iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
6767  return FALSE;
6768 }
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:769
EXTERN_VAR omBin char_ptr_bin
Definition: structs.h:82
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 7814 of file iparith.cc.

7815 {
7816  unsigned i=1;
7817  unsigned nCount = (sArithBase.nCmdUsed-1)/3;
7818  if((3*nCount)<sArithBase.nCmdUsed) nCount++;
7819  //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
7820  // sArithBase.nCmdAllocated);
7821  for(i=0; i<nCount; i++)
7822  {
7823  Print("%-20s",sArithBase.sCmds[i+1].name);
7824  if(i+1+nCount<sArithBase.nCmdUsed)
7825  Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
7826  if(i+1+2*nCount<sArithBase.nCmdUsed)
7827  Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
7828  //if ((i%3)==1) PrintLn();
7829  PrintLn();
7830  }
7831  PrintLn();
7833  return FALSE;
7834 }
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:218

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4807 of file iparith.cc.

4808 {
4809  char *s= (char *)v->Data();
4810  // try system keywords
4811  for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4812  {
4813  //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4814  if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4815  {
4816  res->data = (char *)1;
4817  return FALSE;
4818  }
4819  }
4820  // try blackbox names
4821  int id;
4822  blackboxIsCmd(s,id);
4823  if (id>0)
4824  {
4825  res->data = (char *)1;
4826  }
4827  return FALSE;
4828 }

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8207 of file iparith.cc.

8208 {
8209  int c=(int)(long)u->Data();
8210  switch(c)
8211  {
8212  case 0:{
8213  PrintS("delete all variables\n");
8214  killlocals(0);
8215  WerrorS("restarting...");
8216  break;
8217  };
8218  default: WerrorS("not implemented");
8219  }
8220  return FALSE;
8221 }
void killlocals(int v)
Definition: ipshell.cc:381

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5168 of file iparith.cc.

5169 {
5170  if (rIsLPRing(currRing))
5171  {
5173  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5174  ideal result;
5175  ideal v_id=(ideal)v->Data();
5176  /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5177  /* tHomog hom=testHomog; */
5178  /* if (w!=NULL) */
5179  /* { */
5180  /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5181  /* { */
5182  /* WarnS("wrong weights"); */
5183  /* w=NULL; */
5184  /* } */
5185  /* else */
5186  /* { */
5187  /* hom=isHomog; */
5188  /* w=ivCopy(w); */
5189  /* } */
5190  /* } */
5191  /* result=kStd(v_id,currRing->qideal,hom,&w); */
5192  result = rightgb(v_id, currRing->qideal);
5194  res->data = (char *)result;
5196  /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5197  return FALSE;
5198  }
5199  else if (rIsPluralRing(currRing))
5200  {
5201  ideal I=(ideal)v->Data();
5202 
5203  ring A = currRing;
5204  ring Aopp = rOpposite(A);
5205  currRing = Aopp;
5206  ideal Iopp = idOppose(A, I, Aopp);
5207  ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
5208  currRing = A;
5209  ideal J = idOppose(Aopp, Jopp, A);
5210 
5211  id_Delete(&Iopp, Aopp);
5212  id_Delete(&Jopp, Aopp);
5213  rDelete(Aopp);
5214 
5215  idSkipZeroes(J);
5216  res->data = (char *)J;
5218  return FALSE;
5219  }
5220  else
5221  {
5222  return jjSTD(res, v);
5223  }
5224 }
static BOOLEAN jjSTD(leftv res, leftv v)
Definition: iparith.cc:5021
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:2088
ideal rightgb(ideal F, ideal Q)
Definition: kstd2.cc:4471
#define TEST_OPT_DEGBOUND
Definition: options.h:111
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:510

◆ jjRING3()

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

Definition at line 6770 of file iparith.cc.

6771 {
6772  res->data=(void *)rInit(u,v,w);
6773  return (res->data==NULL);
6774 }
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5579

◆ 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  memset(v,0,sizeof(sleftv));
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 5855 of file iparith.cc.

5856 {
5857  u->next=(leftv)omAlloc(sizeof(sleftv));
5858  memcpy(u->next,v,sizeof(sleftv));
5859  memset(v,0,sizeof(sleftv));
5860  u->next->next=(leftv)omAlloc(sizeof(sleftv));
5861  memcpy(u->next->next,w,sizeof(sleftv));
5862  memset(w,0,sizeof(sleftv));
5863  BOOLEAN bo=iiExprArithM(res,u,'[');
5864  u->next=NULL;
5865  return bo;
5866 }

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4873 of file iparith.cc.

4874 {
4875  ring r=(ring)v->Data();
4876  if (r!=NULL)
4877  res->data = (char *)rDecompose_list_cf((ring)v->Data());
4878  return (r==NULL)||(res->data==NULL);
4879 }
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:1925

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8178 of file iparith.cc.

8179 {
8180  //Print("construct ring\n");
8181  if (a->Typ()!=CRING_CMD)
8182  {
8183  WerrorS("expected `cring` [ `id` ... ]");
8184  return TRUE;
8185  }
8186  assume(a->next!=NULL);
8187  leftv names=a->next;
8188  int N=names->listLength();
8189  char **n=(char**)omAlloc0(N*sizeof(char*));
8190  for(int i=0; i<N;i++,names=names->next)
8191  {
8192  n[i]=(char *)names->Name();
8193  }
8194  coeffs cf=(coeffs)a->CopyD();
8195  res->data=rDefault(cf,N,n, ringorder_dp);
8196  omFreeSize(n,N*sizeof(char*));
8197  return FALSE;
8198 }
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
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 4850 of file iparith.cc.

4851 {
4852  ring r=(ring)v->Data();
4853  if (r!=NULL)
4854  {
4855  res->data = (char *)rDecompose((ring)v->Data());
4856  if (res->data!=NULL)
4857  {
4858  long mm=r->bitmask/2;
4859  if (mm>MAX_INT_VAL) mm=MAX_INT_VAL;
4860  atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4861  return FALSE;
4862  }
4863  }
4864  return TRUE;
4865 }
lists rDecompose(const ring r)
Definition: ipshell.cc:2056
const int MAX_INT_VAL
Definition: mylimits.h:12

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4866 of file iparith.cc.

4867 {
4868  coeffs r=(coeffs)v->Data();
4869  if (r!=NULL)
4870  return rDecompose_CF(res,r);
4871  return TRUE;
4872 }
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1854

◆ jjRMINUS()

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

Definition at line 3224 of file iparith.cc.

3225 {
3226  ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3227  res->data = (char *)r;
3228  return r==NULL;
3229 }
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition: ring.cc:5748

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5522 of file iparith.cc.

5523 {
5524  res->data = rOrdStr((ring)v->Data());
5525  return FALSE;
5526 }
char * rOrdStr(ring r)
Definition: ring.cc:522

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4880 of file iparith.cc.

4881 {
4882  ideal i = (ideal)v->Data();
4883  res->data = (char *)i->rank;
4884  return FALSE;
4885 }

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4886 of file iparith.cc.

4887 {
4888  res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
4889  return FALSE;
4890 }

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4891 of file iparith.cc.

4892 {
4893  res->data = (char *)(long)((intvec*)(v->Data()))->rows();
4894  return FALSE;
4895 }

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4896 of file iparith.cc.

4897 {
4898  res->data = (char *)(long)rPar(((ring)v->Data()));
4899  return FALSE;
4900 }

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5532 of file iparith.cc.

5533 {
5534  res->data = rParStr((ring)v->Data());
5535  return FALSE;
5536 }
char * rParStr(ring r)
Definition: ring.cc:649

◆ jjRPLUS()

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

Definition at line 3230 of file iparith.cc.

3231 {
3232  int left;
3233  if (u->Typ()==RING_CMD) left=0;
3234  else
3235  {
3236  leftv h=u;u=v;v=h;
3237  left=1;
3238  }
3239  ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3240  res->data = (char *)r;
3241  return r==NULL;
3242 }
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5666

◆ jjRSUM()

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

Definition at line 3243 of file iparith.cc.

3244 {
3245  ring r;
3246  int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3247  res->data = (char *)r;
3248  return (i==-1);
3249 }
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1346

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5527 of file iparith.cc.

5528 {
5529  res->data = rVarStr((ring)v->Data());
5530  return FALSE;
5531 }
char * rVarStr(ring r)
Definition: ring.cc:623

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 4943 of file iparith.cc.

4944 {
4945  ideal result;
4946  ideal v_id=(ideal)v->Data();
4947  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4948  tHomog hom=testHomog;
4949  if (w!=NULL)
4950  {
4951  if (!idTestHomModule(v_id,currRing->qideal,w))
4952  {
4953  WarnS("wrong weights");
4954  w=NULL;
4955  }
4956  else
4957  {
4958  hom=isHomog;
4959  w=ivCopy(w);
4960  }
4961  }
4962  result=kSba(v_id,currRing->qideal,hom,&w,1,0);
4964  res->data = (char *)result;
4966  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4967  return FALSE;
4968 }
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:2273

◆ jjSBA_1()

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

Definition at line 4969 of file iparith.cc.

4970 {
4971  ideal result;
4972  ideal v_id=(ideal)v->Data();
4973  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4974  tHomog hom=testHomog;
4975  if (w!=NULL)
4976  {
4977  if (!idTestHomModule(v_id,currRing->qideal,w))
4978  {
4979  WarnS("wrong weights");
4980  w=NULL;
4981  }
4982  else
4983  {
4984  hom=isHomog;
4985  w=ivCopy(w);
4986  }
4987  }
4988  result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0);
4990  res->data = (char *)result;
4992  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4993  return FALSE;
4994 }

◆ jjSBA_2()

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

Definition at line 4995 of file iparith.cc.

4996 {
4997  ideal result;
4998  ideal v_id=(ideal)v->Data();
4999  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5000  tHomog hom=testHomog;
5001  if (w!=NULL)
5002  {
5003  if (!idTestHomModule(v_id,currRing->qideal,w))
5004  {
5005  WarnS("wrong weights");
5006  w=NULL;
5007  }
5008  else
5009  {
5010  hom=isHomog;
5011  w=ivCopy(w);
5012  }
5013  }
5014  result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
5016  res->data = (char *)result;
5018  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5019  return FALSE;
5020 }

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3692 of file iparith.cc.

3693 {
3694  if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3695  else
3696  {
3697  ring r=(ring)u->Data();
3698  idhdl h=rFindHdl(r,NULL);
3699  if (h==NULL)
3700  {
3701  char name_buffer[100];
3702  STATIC_VAR int ending=1000000;
3703  ending++;
3704  sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3705  h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3706  IDRING(h)=r;
3707  r->ref++;
3708  }
3709  rSetHdl(h);
3710  }
3711  return FALSE;
3712 }
#define STATIC_VAR
Definition: globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1610
void rSetHdl(idhdl h)
Definition: ipshell.cc:5086

◆ jjSIMPL_ID()

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

Definition at line 3257 of file iparith.cc.

3258 {
3259  int sw = (int)(long)v->Data();
3260  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3261  ideal id = (ideal)u->CopyD(IDEAL_CMD);
3262  if (sw & SIMPL_LMDIV)
3263  {
3264  id_DelDiv(id,currRing);
3265  }
3266  if (sw & SIMPL_LMEQ)
3267  {
3269  }
3270  if (sw & SIMPL_MULT)
3271  {
3273  }
3274  else if(sw & SIMPL_EQU)
3275  {
3276  id_DelEquals(id,currRing);
3277  }
3278  if (sw & SIMPL_NULL)
3279  {
3280  idSkipZeroes(id);
3281  }
3282  if (sw & SIMPL_NORM)
3283  {
3284  id_Norm(id,currRing);
3285  }
3286  if (sw & SIMPL_NORMALIZE)
3287  {
3288  id_Normalize(id,currRing);
3289  }
3290  res->data = (char * )id;
3291  return FALSE;
3292 }
#define SIMPL_EQU
Definition: iparith.cc:3254
#define SIMPL_NORM
Definition: iparith.cc:3256
#define SIMPL_LMEQ
Definition: iparith.cc:3252
#define SIMPL_NULL
Definition: iparith.cc:3255
#define SIMPL_MULT
Definition: iparith.cc:3253
#define SIMPL_NORMALIZE
Definition: iparith.cc:3250
#define SIMPL_LMDIV
Definition: iparith.cc:3251
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
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_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 3352 of file iparith.cc.

3353 {
3354  int sw = (int)(long)v->Data();
3355  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3356  poly p = (poly)u->CopyD(POLY_CMD);
3357  if (sw & SIMPL_NORM)
3358  {
3359  pNorm(p);
3360  }
3361  if (sw & SIMPL_NORMALIZE)
3362  {
3364  }
3365  res->data = (char * )p;
3366  return FALSE;
3367 }
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3732
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:359

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4901 of file iparith.cc.

4902 {
4903  const bool bIsSCA = rIsSCA(currRing);
4904 
4905  if ((currRing->qideal!=NULL) && !bIsSCA)
4906  {
4907  WerrorS("qring not supported by slimgb at the moment");
4908  return TRUE;
4909  }
4911  {
4912  WerrorS("ordering must be global for slimgb");
4913  return TRUE;
4914  }
4916  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4917  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4918  // tHomog hom=testHomog;
4919  ideal u_id=(ideal)u->Data();
4920  if (w!=NULL)
4921  {
4922  if (!idTestHomModule(u_id,currRing->qideal,w))
4923  {
4924  WarnS("wrong weights");
4925  w=NULL;
4926  }
4927  else
4928  {
4929  w=ivCopy(w);
4930  // hom=isHomog;
4931  }
4932  }
4933 
4934  assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
4935  res->data=(char *)t_rep_gb(currRing,
4936  u_id,u_id->rank);
4937  //res->data=(char *)t_rep_gb(currRing, u_id);
4938 
4940  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4941  return FALSE;
4942 }
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:3520

◆ jjSMATRIX_Mo()

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

Definition at line 6655 of file iparith.cc.

6656 {
6657  int mi=(int)(long)v->Data();
6658  int ni=(int)(long)w->Data();
6659  if ((mi<0)||(ni<1))
6660  {
6661  Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6662  return TRUE;
6663  }
6664  res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6665  mi,ni,currRing);
6666  return FALSE;
6667 }
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 5049 of file iparith.cc.

5050 {
5051  res->data = (char *)idSort((ideal)v->Data());
5052  return FALSE;
5053 }
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:186

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 9698 of file iparith.cc.

9699 {
9700  lists l=(lists)arg->Data();
9701  if (l->nr>0)
9702  {
9703  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
9704  }
9705  return FALSE;
9706 }
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:9657

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5054 of file iparith.cc.

5055 {
5057  intvec *v=NULL;
5058  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5059  if (f==NULL) return TRUE;
5060  ivTest(v);
5062  l->Init(2);
5063  l->m[0].rtyp=IDEAL_CMD;
5064  l->m[0].data=(void *)f;
5065  l->m[1].rtyp=INTVEC_CMD;
5066  l->m[1].data=(void *)v;
5067  res->data=(void *)l;
5068  return FALSE;
5069 }
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1220

◆ jjSQR_FREE2()

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

Definition at line 3294 of file iparith.cc.

3295 {
3296  intvec *v=NULL;
3297  int sw=(int)(long)dummy->Data();
3298  int fac_sw=sw;
3299  if (sw<0) fac_sw=1;
3301  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3302  if (f==NULL)
3303  return TRUE;
3304  switch(sw)
3305  {
3306  case 0:
3307  case 2:
3308  {
3310  l->Init(2);
3311  l->m[0].rtyp=IDEAL_CMD;
3312  l->m[0].data=(void *)f;
3313  l->m[1].rtyp=INTVEC_CMD;
3314  l->m[1].data=(void *)v;
3315  res->data=(void *)l;
3316  res->rtyp=LIST_CMD;
3317  return FALSE;
3318  }
3319  case 1:
3320  res->data=(void *)f;
3321  return FALSE;
3322  case 3:
3323  {
3324  poly p=f->m[0];
3325  int i=IDELEMS(f);
3326  f->m[0]=NULL;
3327  while(i>1)
3328  {
3329  i--;
3330  p=pMult(p,f->m[i]);
3331  f->m[i]=NULL;
3332  }
3333  res->data=(void *)p;
3334  res->rtyp=POLY_CMD;
3335  }
3336  return FALSE;
3337  }
3338  WerrorS("invalid switch");
3339  return FALSE;
3340 }

◆ jjSTATUS2()

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

Definition at line 3341 of file iparith.cc.

3342 {
3343  res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3344  return FALSE;
3345 }

◆ jjSTATUS2L()

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

Definition at line 3346 of file iparith.cc.

3347 {
3348  res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3349  //return (res->data== (void*)(long)-2);
3350  return FALSE;
3351 }

◆ jjSTATUS3()

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

Definition at line 6775 of file iparith.cc.

6776 {
6777  int yes;
6778  jjSTATUS2(res, u, v);
6779  yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
6780  omFree((ADDRESS) res->data);
6781  res->data = (void *)(long)yes;
6782  return FALSE;
6783 }
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3341

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8020 of file iparith.cc.

8021 {
8022  if ((v->Typ() != LINK_CMD) ||
8023  (v->next->Typ() != STRING_CMD) ||
8024  (v->next->next->Typ() != STRING_CMD) ||
8025  (v->next->next->next->Typ() != INT_CMD))
8026  return TRUE;
8027  jjSTATUS3(res, v, v->next, v->next->next);
8028 #if defined(HAVE_USLEEP)
8029  if (((long) res->data) == 0L)
8030  {
8031  int i_s = (int)(long) v->next->next->next->Data();
8032  if (i_s > 0)
8033  {
8034  usleep((int)(long) v->next->next->next->Data());
8035  jjSTATUS3(res, v, v->next, v->next->next);
8036  }
8037  }
8038 #elif defined(HAVE_SLEEP)
8039  if (((int) res->data) == 0)
8040  {
8041  int i_s = (int) v->next->next->next->Data();
8042  if (i_s > 0)
8043  {
8044  si_sleep((is - 1)/1000000 + 1);
8045  jjSTATUS3(res, v, v->next, v->next->next);
8046  }
8047  }
8048 #endif
8049  return FALSE;
8050 }
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6775
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5021 of file iparith.cc.

5022 {
5024  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5025  ideal result;
5026  ideal v_id=(ideal)v->Data();
5027  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5028  tHomog hom=testHomog;
5029  if (w!=NULL)
5030  {
5031  if (!idTestHomModule(v_id,currRing->qideal,w))
5032  {
5033  WarnS("wrong weights");
5034  w=NULL;
5035  }
5036  else
5037  {
5038  hom=isHomog;
5039  w=ivCopy(w);
5040  }
5041  }
5042  result=kStd(v_id,currRing->qideal,hom,&w);
5044  res->data = (char *)result;
5046  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5047  return FALSE;
5048 }

◆ jjSTD_1()

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

Definition at line 3394 of file iparith.cc.

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

◆ jjSTD_HILB()

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

Definition at line 3368 of file iparith.cc.

3369 {
3370  ideal result;
3371  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3372  tHomog hom=testHomog;
3373  ideal u_id=(ideal)(u->Data());
3374  if (w!=NULL)
3375  {
3376  if (!idTestHomModule(u_id,currRing->qideal,w))
3377  {
3378  WarnS("wrong weights:");w->show();PrintLn();
3379  w=NULL;
3380  }
3381  else
3382  {
3383  w=ivCopy(w);
3384  hom=isHomog;
3385  }
3386  }
3387  result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3389  res->data = (char *)result;
3390  setFlag(res,FLAG_STD);
3391  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3392  return FALSE;
3393 }

◆ jjSTD_HILB_W()

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

Definition at line 6784 of file iparith.cc.

6785 {
6786  intvec *vw=(intvec *)w->Data(); // weights of vars
6787  if (vw->length()!=currRing->N)
6788  {
6789  Werror("%d weights for %d variables",vw->length(),currRing->N);
6790  return TRUE;
6791  }
6792  ideal result;
6793  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6794  tHomog hom=testHomog;
6795  ideal u_id=(ideal)(u->Data());
6796  if (ww!=NULL)
6797  {
6798  if (!idTestHomModule(u_id,currRing->qideal,ww))
6799  {
6800  WarnS("wrong weights");
6801  ww=NULL;
6802  }
6803  else
6804  {
6805  ww=ivCopy(ww);
6806  hom=isHomog;
6807  }
6808  }
6809  result=kStd(u_id,
6810  currRing->qideal,
6811  hom,
6812  &ww, // module weights
6813  (intvec *)v->Data(), // hilbert series
6814  0,0, // syzComp, newIdeal
6815  vw); // weights of vars
6817  res->data = (char *)result;
6818  setFlag(res,FLAG_STD);
6819  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
6820  return FALSE;
6821 }

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8095 of file iparith.cc.

8096 { ideal result;
8097  leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8098  leftv v = u->next; /* one additional polynomial or ideal */
8099  leftv h = v->next; /* Hilbert vector */
8100  leftv w = h->next; /* weight vector */
8101  assumeStdFlag(u);
8102  ideal i1=(ideal)(u->Data());
8103  ideal i0;
8104  if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8105  || (h->Typ()!=INTVEC_CMD)
8106  || (w->Typ()!=INTVEC_CMD))
8107  {
8108  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8109  return TRUE;
8110  }
8111  intvec *vw=(intvec *)w->Data(); // weights of vars
8112  /* merging std_hilb_w and std_1 */
8113  if (vw->length()!=currRing->N)
8114  {
8115  Werror("%d weights for %d variables",vw->length(),currRing->N);
8116  return TRUE;
8117  }
8118  int r=v->Typ();
8119  BOOLEAN cleanup_i0=FALSE;
8120  if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8121  {
8122  i0=idInit(1,i1->rank);
8123  i0->m[0]=(poly)v->Data();
8124  cleanup_i0=TRUE;
8125  }
8126  else if (r==IDEAL_CMD)/* IDEAL */
8127  {
8128  i0=(ideal)v->Data();
8129  }
8130  else
8131  {
8132  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8133  return TRUE;
8134  }
8135  int ii0=idElem(i0);
8136  i1 = idSimpleAdd(i1,i0);
8137  if (cleanup_i0)
8138  {
8139  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8140  idDelete(&i0);
8141  }
8142  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8143  tHomog hom=testHomog;
8144  /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8145  if (ww!=NULL)
8146  {
8147  if (!idTestHomModule(i1,currRing->qideal,ww))
8148  {
8149  WarnS("wrong weights");
8150  ww=NULL;
8151  }
8152  else
8153  {
8154  ww=ivCopy(ww);
8155  hom=isHomog;
8156  }
8157  }
8158  BITSET save1;
8159  SI_SAVE_OPT1(save1);
8161  result=kStd(i1,
8162  currRing->qideal,
8163  hom,
8164  &ww, // module weights
8165  (intvec *)h->Data(), // hilbert series
8166  0, // syzComp, whatever it is...
8167  IDELEMS(i1)-ii0, // new ideal
8168  vw); // weights of vars
8169  SI_RESTORE_OPT1(save1);
8170  idDelete(&i1);
8172  res->data = (char *)result;
8174  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8175  return FALSE;
8176 }

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7835 of file iparith.cc.

7836 {
7837  if (v == NULL)
7838  {
7839  res->data = omStrDup("");
7840  return FALSE;
7841  }
7842  int n = v->listLength();
7843  if (n == 1)
7844  {
7845  res->data = v->String();
7846  return FALSE;
7847  }
7848 
7849  char** slist = (char**) omAlloc(n*sizeof(char*));
7850  int i, j;
7851 
7852  for (i=0, j=0; i<n; i++, v = v ->next)
7853  {
7854  slist[i] = v->String();
7855  assume(slist[i] != NULL);
7856  j+=strlen(slist[i]);
7857  }
7858  char* s = (char*) omAlloc((j+1)*sizeof(char));
7859  *s='\0';
7860  for (i=0;i<n;i++)
7861  {
7862  strcat(s, slist[i]);
7863  omFree(slist[i]);
7864  }
7865  omFreeSize(slist, n*sizeof(char*));
7866  res->data = s;
7867  return FALSE;
7868 }

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5454 of file iparith.cc.

5455 {
5456  res->data = (char *)strlen((char *)v->Data());
5457  return FALSE;
5458 }

◆ jjSUBST_Bu()

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

Definition at line 6492 of file iparith.cc.

6493 {
6494  // generic conversion from polyBucket to poly:
6495  // force this to be the first try everytime
6496  poly p; int l;
6497  sBucket_pt bu=(sBucket_pt)w->CopyD();
6498  sBucketDestroyAdd(bu,&p,&l);
6499  sleftv tmpw;
6500  tmpw.Init();
6501  tmpw.rtyp=POLY_CMD;
6502  tmpw.data=p;
6503  return iiExprArith3(res, iiOp, u, v, &tmpw);
6504 }

◆ jjSUBST_Id()

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

Definition at line 6531 of file iparith.cc.

6532 {
6533  int ringvar;
6534  poly monomexpr;
6535  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6536  if (nok) return TRUE;
6537  ideal id=(ideal)u->Data();
6538  if (ringvar>0)
6539  {
6540  BOOLEAN overflow=FALSE;
6541  if (monomexpr!=NULL)
6542  {
6543  long deg_monexp=pTotaldegree(monomexpr);
6544  for(int i=IDELEMS(id)-1;i>=0;i--)
6545  {
6546  poly p=id->m[i];
6547  if ((p!=NULL) && (pTotaldegree(p)!=0) &&
6548  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)pTotaldegree(p)/2)))
6549  {
6550  overflow=TRUE;
6551  break;
6552  }
6553  }
6554  }
6555  if (overflow)
6556  Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6557  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6558  {
6559  if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6560  else id=id_Copy(id,currRing);
6561  res->data = id_Subst(id, ringvar, monomexpr, currRing);
6562  }
6563  else
6564  res->data = idSubstPoly(id,ringvar,monomexpr);
6565  }
6566  else
6567  {
6568  res->data = idSubstPar(id,-ringvar,monomexpr);
6569  }
6570  return FALSE;
6571 }
static BOOLEAN jjSUBST_Test(leftv v, leftv w, int &ringvar, poly &monomexpr)
Definition: iparith.cc:6464
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:413
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:380
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 6575 of file iparith.cc.

6576 {
6577  return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6578 }
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6583

◆ jjSUBST_Id_N()

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

Definition at line 6579 of file iparith.cc.

6580 {
6581  return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6582 }

◆ jjSUBST_Id_X()

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

Definition at line 6583 of file iparith.cc.

6584 {
6585  sleftv tmp;
6586  memset(&tmp,0,sizeof(tmp));
6587  // do not check the result, conversion from int/number to poly works always
6588  iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6589  BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6590  tmp.CleanUp();
6591  return b;
6592 }
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6531

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8051 of file iparith.cc.

8052 {
8053  leftv v = u->next; // number of args > 0
8054  if (v==NULL) return TRUE;
8055  leftv w = v->next;
8056  if (w==NULL) return TRUE;
8057  leftv rest = w->next;;
8058 
8059  u->next = NULL;
8060  v->next = NULL;
8061  w->next = NULL;
8062  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8063  if ((rest!=NULL) && (!b))
8064  {
8065  sleftv tmp_res;
8066  leftv tmp_next=res->next;
8067  res->next=rest;
8068  memset(&tmp_res,0,sizeof(tmp_res));
8069  b = iiExprArithM(&tmp_res,res,iiOp);
8070  memcpy(res,&tmp_res,sizeof(tmp_res));
8071  res->next=tmp_next;
8072  }
8073  u->next = v;
8074  v->next = w;
8075  // rest was w->next, but is already cleaned
8076  return b;
8077 }

◆ jjSUBST_P()

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

Definition at line 6505 of file iparith.cc.

6506 {
6507  int ringvar;
6508  poly monomexpr;
6509  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6510  if (nok) return TRUE;
6511  poly p=(poly)u->Data();
6512  if (ringvar>0)
6513  {
6514  if ((monomexpr!=NULL) && (p!=NULL) && (pTotaldegree(p)!=0) &&
6515  ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)pTotaldegree(p)/2)))
6516  {
6517  Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), pTotaldegree(p));
6518  //return TRUE;
6519  }
6520  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6521  res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6522  else
6523  res->data= pSubstPoly(p,ringvar,monomexpr);
6524  }
6525  else
6526  {
6527  res->data=pSubstPar(p,-ringvar,monomexpr);
6528  }
6529  return FALSE;
6530 }
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:397
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:260

◆ jjSUBST_Test()

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

Definition at line 6464 of file iparith.cc.

6466 {
6467  monomexpr=(poly)w->Data();
6468  poly p=(poly)v->Data();
6469 #if 0
6470  if (pLength(monomexpr)>1)
6471  {
6472  Werror("`%s` substitutes a ringvar only by a term",
6474  return TRUE;
6475  }
6476 #endif
6477  if ((ringvar=pVar(p))==0)
6478  {
6479  if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6480  {
6481  number n = pGetCoeff(p);
6482  ringvar= -n_IsParam(n, currRing);
6483  }
6484  if(ringvar==0)
6485  {
6486  WerrorS("ringvar/par expected");
6487  return TRUE;
6488  }
6489  }
6490  return FALSE;
6491 }
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5645
@ SUBST_CMD
Definition: tok.h:185

◆ jjSYZ_2()

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

Definition at line 3478 of file iparith.cc.

3479 {
3480  // see jjSYZYGY
3481  intvec *w=NULL;
3482  ideal I=(ideal)u->Data();
3483  GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3484  res->data = (char *)idSyzygies(I,testHomog,&w,TRUE,FALSE,NULL,alg);
3485  if (w!=NULL) delete w;
3487  return FALSE;
3488 }
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:728

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5071 of file iparith.cc.

5072 {
5073  intvec *w=NULL;
5074  res->data = (char *)idSyzygies((ideal)v->Data(),testHomog,&w);
5075  if (w!=NULL) delete w;
5077  return FALSE;
5078 }

◆ jjTENSOR()

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

Definition at line 3489 of file iparith.cc.

3490 {
3491  ideal A=(ideal)u->Data();
3492  ideal B=(ideal)v->Data();
3493  res->data = (char *)sm_Tensor(A,B,currRing);
3494  return FALSE;
3495 }
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition: matpol.cc:1831

◆ jjTENSOR_Ma()

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

Definition at line 3496 of file iparith.cc.

3497 {
3498  sleftv tmp_u,tmp_v,tmp_res;
3502  tmp_res.Init();
3503  tmp_res.rtyp=SMATRIX_CMD;
3504  BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3505  if (!bo)
3506  {
3509  }
3510  tmp_u.CleanUp();
3511  tmp_v.CleanUp();
3512  tmp_res.CleanUp();
3513  return bo;
3514 }
@ SMATRIX_CMD
Definition: grammar.cc:291
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition: iparith.cc:3489
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 7869 of file iparith.cc.

7870 {
7871  do
7872  {
7873  if (v->Typ()!=INT_CMD)
7874  return TRUE;
7875  test_cmd((int)(long)v->Data());
7876  v=v->next;
7877  }
7878  while (v!=NULL);
7879  return FALSE;
7880 }
void test_cmd(int i)
Definition: ipshell.cc:509

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

◆ jjTIMES_BIM()

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

Definition at line 1075 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 979 of file iparith.cc.

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

◆ 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  id_Normalize((ideal)res->data,currRing);
1059  if ((v->next!=NULL) || (u->next!=NULL))
1060  return jjOP_REST(res,u,v);
1061  return FALSE;
1062 }
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 1063 of file iparith.cc.

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

◆ jjTIMES_MA()

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

Definition at line 1143 of file iparith.cc.

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

◆ jjTIMES_MA_BI1()

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

Definition at line 1087 of file iparith.cc.

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

◆ jjTIMES_MA_BI2()

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

Definition at line 1097 of file iparith.cc.

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

◆ jjTIMES_MA_I1()

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

Definition at line 1133 of file iparith.cc.

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

◆ jjTIMES_MA_I2()

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

Definition at line 1139 of file iparith.cc.

1140 {
1141  return jjTIMES_MA_I1(res,v,u);
1142 }
static BOOLEAN jjTIMES_MA_I1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1133

◆ jjTIMES_MA_N1()

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

Definition at line 1121 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1129 of file iparith.cc.

1130 {
1131  return jjTIMES_MA_N1(res,v,u);
1132 }
static BOOLEAN jjTIMES_MA_N1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1121

◆ jjTIMES_MA_P1()

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

Definition at line 1101 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1111 of file iparith.cc.

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

◆ jjTIMES_N()

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

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

◆ jjTIMES_SM()

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

Definition at line 1158 of file iparith.cc.

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

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5109 of file iparith.cc.

5110 {
5111  res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5112  return FALSE;
5113 }
int ivTrace(intvec *o)
Definition: intvec.cc:321

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5114 of file iparith.cc.

5115 {
5116  res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5117  return FALSE;
5118 }

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5119 of file iparith.cc.

5120 {
5121  res->data = (char *)ivTranp((intvec*)(v->Data()));
5122  return FALSE;
5123 }
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5151 of file iparith.cc.

5152 {
5153  ideal result;
5154  ideal v_id=(ideal)a->Data();
5155  if (rIsPluralRing(currRing))
5156  result=(ideal)twostd(v_id);
5157  else /*commutative or shiftalgebra*/
5158  {
5159  return jjSTD(res,a);
5160  }
5161  res->data = (char *)result;
5162  setFlag(res,FLAG_STD);
5164  return FALSE;
5165 }
#define FLAG_TWOSTD
Definition: ipid.h:105
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18

◆ jjTYPEOF()

static BOOLEAN jjTYPEOF ( leftv  res,
leftv  v 
)
static

Definition at line 5226 of file iparith.cc.

5227 {
5228  int t=(int)(long)v->data;
5229  switch (t)
5230  {
5231  case CRING_CMD:
5232  case INT_CMD:
5233  case POLY_CMD:
5234  case VECTOR_CMD:
5235  case STRING_CMD:
5236  case INTVEC_CMD:
5237  case IDEAL_CMD:
5238  case MATRIX_CMD:
5239  case MODUL_CMD:
5240  case MAP_CMD:
5241  case PROC_CMD:
5242  case RING_CMD:
5243  case SMATRIX_CMD:
5244  //case QRING_CMD:
5245  case INTMAT_CMD:
5246  case BIGINTMAT_CMD:
5247  case NUMBER_CMD:
5248  #ifdef SINGULAR_4_2
5249  case CNUMBER_CMD:
5250  #endif
5251  case BIGINT_CMD:
5252  case BUCKET_CMD:
5253  case LIST_CMD:
5254  case PACKAGE_CMD:
5255  case LINK_CMD:
5256  case RESOLUTION_CMD:
5257  res->data=omStrDup(Tok2Cmdname(t)); break;
5258  case DEF_CMD:
5259  case NONE: res->data=omStrDup("none"); break;
5260  default:
5261  {
5262  if (t>MAX_TOK)
5263  res->data=omStrDup(getBlackboxName(t));
5264  else
5265  res->data=omStrDup("?unknown type?");
5266  break;
5267  }
5268  }
5269  return FALSE;
5270 }
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition: blackbox.cc:195
@ CNUMBER_CMD
Definition: tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3647 of file iparith.cc.

3648 {
3649  number n=(number)u->CopyD(BIGINT_CMD);
3650  n=n_InpNeg(n,coeffs_BIGINT);
3651  res->data = (char *)n;
3652  return FALSE;
3653 }
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3684 of file iparith.cc.

3685 {
3686  bigintmat *bim=(bigintmat *)u->CopyD(BIGINTMAT_CMD);
3687  (*bim)*=(-1);
3688  res->data = (char *)bim;
3689  return FALSE;
3690 }

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3654 of file iparith.cc.

3655 {
3656  res->data = (char *)(-(long)u->Data());
3657  return FALSE;
3658 }

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3677 of file iparith.cc.

3678 {
3679  intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3680  (*iv)*=(-1);
3681  res->data = (char *)iv;
3682  return FALSE;
3683 }

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3671 of file iparith.cc.

3672 {
3673  poly m1=pISet(-1);
3674  res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3675  return FALSE;
3676 }
#define pISet(i)
Definition: polys.h:308

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3659 of file iparith.cc.

3660 {
3661  number n=(number)u->CopyD(NUMBER_CMD);
3662  n=nInpNeg(n);
3663  res->data = (char *)n;
3664  return FALSE;
3665 }
#define nInpNeg(n)
Definition: numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3666 of file iparith.cc.

3667 {
3668  res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3669  return FALSE;
3670 }

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 9707 of file iparith.cc.

9708 {
9709  lists l=(lists)arg->Data();
9710  if (l->nr>0)
9711  {
9712  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
9713  int i, j, len;
9714  len=l->nr;
9715  i=0;
9716  while(i<len)
9717  {
9718  if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
9719  {
9720  l->m[i].CleanUp();
9721  for(j=i; j<len;j++) l->m[j]=l->m[j+1];
9722  memset(&(l->m[len]),0,sizeof(sleftv));
9723  l->m[len].rtyp=DEF_CMD;
9724  len--;
9725  }
9726  else
9727  i++;
9728  }
9729  //Print("new len:%d\n",len);
9730  }
9731  return FALSE;
9732 }

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5271 of file iparith.cc.

5272 {
5273  res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5274  return FALSE;
5275 }
#define pIsUnivariate(p)
Definition: polys.h:245

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5276 of file iparith.cc.

5277 {
5278  int i=(int)(long)v->Data();
5279  if ((0<i) && (i<=currRing->N))
5280  {
5281  poly p=pOne();
5282  pSetExp(p,i,1);
5283  pSetm(p);
5284  res->data=(char *)p;
5285  }
5286  else
5287  {
5288  Werror("var number %d out of range 1..%d",i,currRing->N);
5289  return TRUE;
5290  }
5291  return FALSE;
5292 }

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5293 of file iparith.cc.

5294 {
5295  if (currRing==NULL)
5296  {
5297  WerrorS("no ring active");
5298  return TRUE;
5299  }
5300  int i=(int)(long)v->Data();
5301  if ((0<i) && (i<=currRing->N))
5302  res->data=omStrDup(currRing->names[i-1]);
5303  else
5304  {
5305  Werror("var number %d out of range 1..%d",i,currRing->N);
5306  return TRUE;
5307  }
5308  return FALSE;
5309 }

◆ jjVARSTR2()

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

Definition at line 3515 of file iparith.cc.

3516 {
3517  idhdl h=(idhdl)u->data;
3518  int i=(int)(long)v->Data();
3519  if ((0<i) && (i<=IDRING(h)->N))
3520  res->data=omStrDup(IDRING(h)->names[i-1]);
3521  else
3522  {
3523  Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3524  return TRUE;
3525  }
3526  return FALSE;
3527 }

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5310 of file iparith.cc.

5311 {
5312  assumeStdFlag(v);
5313  res->data = (char *)(long)scMult0Int((ideal)v->Data(),currRing->qideal);
5314  return FALSE;
5315 }
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:918

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5316 of file iparith.cc.

5317 {
5318 // input: u: a list with links of type
5319 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5320 // returns: -1: the read state of all links is eof
5321 // i>0: (at least) u[i] is ready
5322  lists Lforks = (lists)u->Data();
5323  int i = slStatusSsiL(Lforks, -1);
5324  if(i == -2) /* error */
5325  {
5326  return TRUE;
5327  }
5328  res->data = (void*)(long)i;
5329  return FALSE;
5330 }

◆ jjWAIT1ST2()

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

Definition at line 3528 of file iparith.cc.

3529 {
3530 // input: u: a list with links of type
3531 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3532 // v: timeout for select in milliseconds
3533 // or 0 for polling
3534 // returns: ERROR (via Werror): timeout negative
3535 // -1: the read state of all links is eof
3536 // 0: timeout (or polling): none ready
3537 // i>0: (at least) L[i] is ready
3538  lists Lforks = (lists)u->Data();
3539  int t = (int)(long)v->Data();
3540  if(t < 0)
3541  {
3542  WerrorS("negative timeout"); return TRUE;
3543  }
3544  int i = slStatusSsiL(Lforks, t*1000);
3545  if(i == -2) /* error */
3546  {
3547  return TRUE;
3548  }
3549  res->data = (void*)(long)i;
3550  return FALSE;
3551 }

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5331 of file iparith.cc.

5332 {
5333 // input: u: a list with links of type
5334 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5335 // returns: -1: the read state of all links is eof
5336 // 1: all links are ready
5337 // (caution: at least one is ready, but some maybe dead)
5338  lists Lforks = (lists)u->CopyD();
5339  int i;
5340  int j = -1;
5341  for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5342  {
5343  i = slStatusSsiL(Lforks, -1);
5344  if(i == -2) /* error */
5345  {
5346  return TRUE;
5347  }
5348  if(i == -1)
5349  {
5350  break;
5351  }
5352  j = 1;
5353  Lforks->m[i-1].CleanUp();
5354  Lforks->m[i-1].rtyp=DEF_CMD;
5355  Lforks->m[i-1].data=NULL;
5356  }
5357  res->data = (void*)(long)j;
5358  Lforks->Clean();
5359  return FALSE;
5360 }

◆ jjWAITALL2()

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

Definition at line 3552 of file iparith.cc.

3553 {
3554 // input: u: a list with links of type
3555 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3556 // v: timeout for select in milliseconds
3557 // or 0 for polling
3558 // returns: ERROR (via Werror): timeout negative
3559 // -1: the read state of all links is eof
3560 // 0: timeout (or polling): none ready
3561 // 1: all links are ready
3562 // (caution: at least one is ready, but some maybe dead)
3563  lists Lforks = (lists)u->CopyD();
3564  int timeout = 1000*(int)(long)v->Data();
3565  if(timeout < 0)
3566  {
3567  WerrorS("negative timeout"); return TRUE;
3568  }
3569  int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3570  int i;
3571  int ret = -1;
3572  for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3573  {
3574  i = slStatusSsiL(Lforks, timeout);
3575  if(i > 0) /* Lforks[i] is ready */
3576  {
3577  ret = 1;
3578  Lforks->m[i-1].CleanUp();
3579  Lforks->m[i-1].rtyp=DEF_CMD;
3580  Lforks->m[i-1].data=NULL;
3581  timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3582  }
3583  else /* terminate the for loop */
3584  {
3585  if(i == -2) /* error */
3586  {
3587  return TRUE;
3588  }
3589  if(i == 0) /* timeout */
3590  {
3591  ret = 0;
3592  }
3593  break;
3594  }
3595  }
3596  Lforks->Clean();
3597  res->data = (void*)(long)ret;
3598  return FALSE;
3599 }
#define TIMER_RESOLUTION
Definition: mod2.h:34
int getRTimer()
Definition: timer.cc:170

◆ jjWEDGE()

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

Definition at line 3600 of file iparith.cc.

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

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3607 of file iparith.cc.

3608 {
3609  return TRUE;
3610 }

◆ pHeadProc()

poly pHeadProc ( poly  p)

Definition at line 226 of file iparith.cc.

227 {
228  return pHead(p);
229 }

◆ Tok2Cmdname()

const char* Tok2Cmdname ( int  tok)

Definition at line 9131 of file iparith.cc.

9132 {
9133  if (tok <= 0)
9134  {
9135  return sArithBase.sCmds[0].name;
9136  }
9137  if (tok==ANY_TYPE) return "any_type";
9138  if (tok==COMMAND) return "command";
9139  if (tok==NONE) return "nothing";
9140  if (tok < 128)
9141  {
9142  Tok2Cmdname_buf[1]=(char)tok;
9143  return Tok2Cmdname_buf;
9144  }
9145  //if (tok==IFBREAK) return "if_break";
9146  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9147  //if (tok==ORDER_VECTOR) return "ordering";
9148  //if (tok==REF_VAR) return "ref";
9149  //if (tok==OBJECT) return "object";
9150  //if (tok==PRINT_EXPR) return "print_expr";
9151  if (tok==IDHDL) return "identifier";
9152  if (tok>MAX_TOK) return getBlackboxName(tok);
9153  unsigned i;
9154  for(i=0; i<sArithBase.nCmdUsed; i++)
9155  //while (sArithBase.sCmds[i].tokval!=0)
9156  {
9157  if ((sArithBase.sCmds[i].tokval == tok)&&
9158  (sArithBase.sCmds[i].alias==0))
9159  {
9160  return sArithBase.sCmds[i].name;
9161  }
9162  }
9163  // try gain for alias/old names:
9164  for(i=0; i<sArithBase.nCmdUsed; i++)
9165  {
9166  if (sArithBase.sCmds[i].tokval == tok)
9167  {
9168  return sArithBase.sCmds[i].name;
9169  }
9170  }
9171  return sArithBase.sCmds[0].name;
9172 }
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9130
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5434 of file iparith.cc.

5435 {
5437 }

Variable Documentation

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 211 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 212 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 216 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 195 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2087 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9130 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5433 of file iparith.cc.