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

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

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

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 111 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 103 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 106 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 109 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 113 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 105 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8662 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 217 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8664 of file iparith.cc.

◆ jjWRONG2

#define jjWRONG2   (proc2)jjWRONG

Definition at line 3644 of file iparith.cc.

◆ jjWRONG3

#define jjWRONG3   (proc3)jjWRONG

Definition at line 3645 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 91 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 119 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 104 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 107 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 108 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 8663 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 97 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3241 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3238 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3239 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3240 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3243 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3237 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3242 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 117 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 98 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 130 of file iparith.cc.

◆ proc2

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

Definition at line 150 of file iparith.cc.

◆ proc3

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

Definition at line 161 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9626 {
9627  cmdnames *pCmdL = (cmdnames*)a;
9628  cmdnames *pCmdR = (cmdnames*)b;
9629 
9630  if(a==NULL || b==NULL) return 0;
9631 
9632  /* empty entries goes to the end of the list for later reuse */
9633  if(pCmdL->name==NULL) return 1;
9634  if(pCmdR->name==NULL) return -1;
9635 
9636  /* $INVALID$ must come first */
9637  if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9638  if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9639 
9640  /* tokval=-1 are reserved names at the end */
9641  if (pCmdL->tokval==-1)
9642  {
9643  if (pCmdR->tokval==-1)
9644  return strcmp(pCmdL->name, pCmdR->name);
9645  /* pCmdL->tokval==-1, pCmdL goes at the end */
9646  return 1;
9647  }
9648  /* pCmdR->tokval==-1, pCmdR goes at the end */
9649  if(pCmdR->tokval==-1) return -1;
9650 
9651  return strcmp(pCmdL->name, pCmdR->name);
9652 }
CanonicalForm b
Definition: cfModGcd.cc:4105
#define NULL
Definition: omList.c:12

◆ check_valid()

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

Definition at line 9851 of file iparith.cc.

9852 {
9853  if (rIsPluralRing(currRing))
9854  {
9855  if ((p & NC_MASK)==NO_NC)
9856  {
9857  WerrorS("not implemented for non-commutative rings");
9858  return TRUE;
9859  }
9860  else if ((p & NC_MASK)==COMM_PLURAL)
9861  {
9862  Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9863  return FALSE;
9864  }
9865  /* else, ALLOW_PLURAL */
9866  }
9867  else if (rIsLPRing(currRing))
9868  {
9869  if ((p & ALLOW_LP)==0)
9870  {
9871  Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9872  return TRUE;
9873  }
9874  }
9875  if (rField_is_Ring(currRing))
9876  {
9877  if ((p & RING_MASK)==0 /*NO_RING*/)
9878  {
9879  WerrorS("not implemented for rings with rings as coeffients");
9880  return TRUE;
9881  }
9882  /* else ALLOW_RING */
9883  else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9884  &&(!rField_is_Domain(currRing)))
9885  {
9886  WerrorS("domain required as coeffients");
9887  return TRUE;
9888  }
9889  /* else ALLOW_ZERODIVISOR */
9890  else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9891  {
9892  WarnS("considering the image in Q[...]");
9893  }
9894  }
9895  return FALSE;
9896 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4080
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR char my_yylinebuf[80]
Definition: febase.cc:44
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:105
#define NO_ZERODIVISOR
Definition: iparith.cc:108
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9571
#define ALLOW_LP
Definition: iparith.cc:110
#define RING_MASK
Definition: iparith.cc:97
#define WARN_RING
Definition: iparith.cc:117
#define NC_MASK
Definition: iparith.cc:91
#define NO_NC
Definition: iparith.cc:104
#define ZERODIVISOR_MASK
Definition: iparith.cc:98
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:489
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:492
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411

◆ iiArithAddCmd()

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

Definition at line 9792 of file iparith.cc.

9799 {
9800  //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9801  // nTokval, nToktype, nPos);
9802  if(nPos>=0)
9803  {
9804  // no checks: we rely on a correct generated code in iparith.inc
9805  assume((unsigned)nPos < sArithBase.nCmdAllocated);
9806  assume(szName!=NULL);
9807  sArithBase.sCmds[nPos].name = omStrDup(szName);
9808  sArithBase.sCmds[nPos].alias = nAlias;
9809  sArithBase.sCmds[nPos].tokval = nTokval;
9810  sArithBase.sCmds[nPos].toktype = nToktype;
9811  sArithBase.nCmdUsed++;
9812  //if(nTokval>0) sArithBase.nLastIdentifier++;
9813  }
9814  else
9815  {
9816  if(szName==NULL) return -1;
9817  int nIndex = iiArithFindCmd(szName);
9818  if(nIndex>=0)
9819  {
9820  Print("'%s' already exists at %d\n", szName, nIndex);
9821  return -1;
9822  }
9823 
9825  {
9826  /* needs to create new slots */
9827  unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9828  sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
9829  if(sArithBase.sCmds==NULL) return -1;
9831  }
9832  /* still free slots available */
9833  sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
9834  sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9835  sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9836  sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9837  sArithBase.nCmdUsed++;
9838 
9839  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9840  (&_gentable_sort_cmds));
9843  {
9844  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9845  }
9846  //Print("L=%d\n", sArithBase.nLastIdentifier);
9847  }
9848  return 0;
9849 }
#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:9625
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9697
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:183
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:190
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:198
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:189
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:188
#define assume(x)
Definition: mod2.h:387
#define nSize(n)
Definition: numbers.h:39
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 9697 of file iparith.cc.

9698 {
9699  int an=0;
9700  int i = 0,v = 0;
9701  int en=sArithBase.nLastIdentifier;
9702 
9703  loop
9704  //for(an=0; an<sArithBase.nCmdUsed; )
9705  {
9706  if(an>=en-1)
9707  {
9708  if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9709  {
9710  //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9711  return an;
9712  }
9713  else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9714  {
9715  //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9716  return en;
9717  }
9718  else
9719  {
9720  //Print("RET- 1\n");
9721  return -1;
9722  }
9723  }
9724  i=(an+en)/2;
9725  if (*szName < *(sArithBase.sCmds[i].name))
9726  {
9727  en=i-1;
9728  }
9729  else if (*szName > *(sArithBase.sCmds[i].name))
9730  {
9731  an=i+1;
9732  }
9733  else
9734  {
9735  v=strcmp(szName,sArithBase.sCmds[i].name);
9736  if(v<0)
9737  {
9738  en=i-1;
9739  }
9740  else if(v>0)
9741  {
9742  an=i+1;
9743  }
9744  else /*v==0*/
9745  {
9746  //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9747  return i;
9748  }
9749  }
9750  }
9751  //if(i>=0 && i<sArithBase.nCmdUsed)
9752  // return i;
9753  //PrintS("RET-2\n");
9754  return -2;
9755 }
int i
Definition: cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define loop
Definition: structs.h:80

◆ iiArithGetCmd()

char* iiArithGetCmd ( int  nPos)

Definition at line 9757 of file iparith.cc.

9758 {
9759  if(nPos<0) return NULL;
9760  if(nPos<(int)sArithBase.nCmdUsed)
9761  return sArithBase.sCmds[nPos].name;
9762  return NULL;
9763 }

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9765 of file iparith.cc.

9766 {
9767  int nIndex;
9768  if(szName==NULL) return -1;
9769 
9770  nIndex = iiArithFindCmd(szName);
9771  if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9772  {
9773  Print("'%s' not found (%d)\n", szName, nIndex);
9774  return -1;
9775  }
9776  omFree(sArithBase.sCmds[nIndex].name);
9777  sArithBase.sCmds[nIndex].name=NULL;
9778  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9779  (&_gentable_sort_cmds));
9780  sArithBase.nCmdUsed--;
9781 
9782  /* fix last-identifier */
9785  {
9786  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9787  }
9788  //Print("L=%d\n", sArithBase.nLastIdentifier);
9789  return 0;
9790 }
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ iiExprArith1()

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

Definition at line 9035 of file iparith.cc.

9036 {
9037  res->Init();
9038 
9039  if (!errorreported)
9040  {
9041 #ifdef SIQ
9042  if (siq>0)
9043  {
9044  //Print("siq:%d\n",siq);
9046  memcpy(&d->arg1,a,sizeof(sleftv));
9047  a->Init();
9048  d->op=op;
9049  d->argc=1;
9050  res->data=(char *)d;
9051  res->rtyp=COMMAND;
9052  return FALSE;
9053  }
9054 #endif
9055  int at=a->Typ();
9056  // handling bb-objects ----------------------------------------------------
9057  if(op>MAX_TOK) // explicit type conversion to bb
9058  {
9059  blackbox *bb=getBlackboxStuff(op);
9060  if (bb!=NULL)
9061  {
9062  res->rtyp=op;
9063  res->data=bb->blackbox_Init(bb);
9064  if(!bb->blackbox_Assign(res,a)) return FALSE;
9065  }
9066  else
9067  return TRUE;
9068  }
9069  else if (at>MAX_TOK) // argument is of bb-type
9070  {
9071  blackbox *bb=getBlackboxStuff(at);
9072  if (bb!=NULL)
9073  {
9074  if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9075  // else: no op defined
9076  }
9077  else
9078  return TRUE;
9079  }
9080  if (errorreported) return TRUE;
9081 
9082  iiOp=op;
9083  int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9084  return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9085  }
9086  a->CleanUp();
9087  return TRUE;
9088 }
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1011
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:60
VAR short errorreported
Definition: feFopen.cc:23
VAR int iiOp
Definition: iparith.cc:219
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:8905
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9546
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1277
VAR omBin sip_command_bin
Definition: ipid.cc:45
ip_command * command
Definition: ipid.h:23
const struct sValCmd1 dArith1[]
Definition: table.h:37
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
VAR BOOLEAN siq
Definition: subexpr.cc:48
@ MAX_TOK
Definition: tok.h:218
#define COMMAND
Definition: tok.h:29

◆ iiExprArith1Tab()

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

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

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

Definition at line 8905 of file iparith.cc.

8906 {
8907  res->Init();
8908  BOOLEAN call_failed=FALSE;
8909 
8910  if (!errorreported)
8911  {
8912  BOOLEAN failed=FALSE;
8913  iiOp=op;
8914  int i = 0;
8915  while (dA1[i].cmd==op)
8916  {
8917  if (at==dA1[i].arg)
8918  {
8919  if (currRing!=NULL)
8920  {
8921  if (check_valid(dA1[i].valid_for,op)) break;
8922  }
8923  else
8924  {
8925  if (RingDependend(dA1[i].res))
8926  {
8927  WerrorS("no ring active (5)");
8928  break;
8929  }
8930  }
8931  if (traceit&TRACE_CALL)
8932  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8933  res->rtyp=dA1[i].res;
8934  if ((call_failed=dA1[i].p(res,a)))
8935  {
8936  break;// leave loop, goto error handling
8937  }
8938  if (a->Next()!=NULL)
8939  {
8940  res->next=(leftv)omAllocBin(sleftv_bin);
8941  failed=iiExprArith1(res->next,a->next,op);
8942  }
8943  a->CleanUp();
8944  return failed;
8945  }
8946  i++;
8947  }
8948  // implicite type conversion --------------------------------------------
8949  if (dA1[i].cmd!=op)
8950  {
8952  i=0;
8953  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8954  while (dA1[i].cmd==op)
8955  {
8956  int ai;
8957  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8958  if ((dA1[i].valid_for & NO_CONVERSION)==0)
8959  {
8960  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8961  {
8962  if (currRing!=NULL)
8963  {
8964  if (check_valid(dA1[i].valid_for,op)) break;
8965  }
8966  else
8967  {
8968  if (RingDependend(dA1[i].res))
8969  {
8970  WerrorS("no ring active (6)");
8971  break;
8972  }
8973  }
8974  if (traceit&TRACE_CALL)
8975  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8976  res->rtyp=dA1[i].res;
8977  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8978  || (call_failed=dA1[i].p(res,an)));
8979  // everything done, clean up temp. variables
8980  if (failed)
8981  {
8982  // leave loop, goto error handling
8983  break;
8984  }
8985  else
8986  {
8987  if (an->Next() != NULL)
8988  {
8989  res->next = (leftv)omAllocBin(sleftv_bin);
8990  failed=iiExprArith1(res->next,an->next,op);
8991  }
8992  // everything ok, clean up and return
8993  an->CleanUp();
8995  return failed;
8996  }
8997  }
8998  }
8999  i++;
9000  }
9001  an->CleanUp();
9003  }
9004  // error handling
9005  if (!errorreported)
9006  {
9007  if ((at==0) && (a->Fullname()!=sNoName_fe))
9008  {
9009  Werror("`%s` is not defined",a->Fullname());
9010  }
9011  else
9012  {
9013  i=0;
9014  const char *s = iiTwoOps(op);
9015  Werror("%s(`%s`) failed"
9016  ,s,Tok2Cmdname(at));
9017  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9018  {
9019  while (dA1[i].cmd==op)
9020  {
9021  if ((dA1[i].res!=0)
9022  && (dA1[i].p!=jjWRONG))
9023  Werror("expected %s(`%s`)"
9024  ,s,Tok2Cmdname(dA1[i].arg));
9025  i++;
9026  }
9027  }
9028  }
9029  }
9030  res->rtyp = UNKNOWN;
9031  }
9032  a->CleanUp();
9033  return TRUE;
9034 }
int BOOLEAN
Definition: auxiliary.h:87
void * ADDRESS
Definition: auxiliary.h:119
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:51
const char sNoName_fe[]
Definition: fevoices.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
const char * iiTwoOps(int t)
Definition: gentable.cc:261
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3646
#define NO_CONVERSION
Definition: iparith.cc:119
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:9035
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9851
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:435
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:145
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:34
#define V_SHOW_USE
Definition: options.h:51
EXTERN_VAR int traceit
Definition: reporter.h:24
#define TRACE_CALL
Definition: reporter.h:44
sleftv * leftv
Definition: structs.h:62
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142
#define UNKNOWN
Definition: tok.h:222

◆ iiExprArith2()

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

Definition at line 8846 of file iparith.cc.

8847 {
8848  res->Init();
8849 
8850  if (!errorreported)
8851  {
8852 #ifdef SIQ
8853  if (siq>0)
8854  {
8855  //Print("siq:%d\n",siq);
8857  memcpy(&d->arg1,a,sizeof(sleftv));
8858  a->Init();
8859  memcpy(&d->arg2,b,sizeof(sleftv));
8860  b->Init();
8861  d->argc=2;
8862  d->op=op;
8863  res->data=(char *)d;
8864  res->rtyp=COMMAND;
8865  return FALSE;
8866  }
8867 #endif
8868  int at=a->Typ();
8869  int bt=b->Typ();
8870  // handling bb-objects ----------------------------------------------------
8871  if (at>MAX_TOK)
8872  {
8873  blackbox *bb=getBlackboxStuff(at);
8874  if (bb!=NULL)
8875  {
8876  if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8877  //else: no op defined, try the default
8878  }
8879  else
8880  return TRUE;
8881  }
8882  else if ((bt>MAX_TOK)&&(op!='('))
8883  {
8884  blackbox *bb=getBlackboxStuff(bt);
8885  if (bb!=NULL)
8886  {
8887  if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8888  // else: no op defined
8889  }
8890  else
8891  return TRUE;
8892  }
8893  int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8894  return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8895  }
8896  a->CleanUp();
8897  b->CleanUp();
8898  return TRUE;
8899 }
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:8673
const struct sValCmd2 dArith2[]
Definition: table.h:318

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

8836 {
8837  res->Init();
8838  leftv b=a->next;
8839  a->next=NULL;
8840  int bt=b->Typ();
8841  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8842  a->next=b;
8843  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8844  return bo;
8845 }

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

8678 {
8679  BOOLEAN call_failed=FALSE;
8680 
8681  if (!errorreported)
8682  {
8683  int i=0;
8684  iiOp=op;
8685  while (dA2[i].cmd==op)
8686  {
8687  if ((at==dA2[i].arg1)
8688  && (bt==dA2[i].arg2))
8689  {
8690  res->rtyp=dA2[i].res;
8691  if (currRing!=NULL)
8692  {
8693  if (check_valid(dA2[i].valid_for,op)) break;
8694  }
8695  else
8696  {
8697  if (RingDependend(dA2[i].res))
8698  {
8699  WerrorS("no ring active (3)");
8700  break;
8701  }
8702  }
8703  if (traceit&TRACE_CALL)
8704  Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
8705  if ((call_failed=dA2[i].p(res,a,b)))
8706  {
8707  break;// leave loop, goto error handling
8708  }
8709  a->CleanUp();
8710  b->CleanUp();
8711  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8712  return FALSE;
8713  }
8714  i++;
8715  }
8716  // implicite type conversion ----------------------------------------------
8717  if (dA2[i].cmd!=op)
8718  {
8719  int ai,bi;
8722  BOOLEAN failed=FALSE;
8723  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8724  //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
8725  while (dA2[i].cmd==op)
8726  {
8727  //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8728  if ((dA2[i].valid_for & NO_CONVERSION)==0)
8729  {
8730  if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
8731  {
8732  if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
8733  {
8734  res->rtyp=dA2[i].res;
8735  if (currRing!=NULL)
8736  {
8737  if (check_valid(dA2[i].valid_for,op)) break;
8738  }
8739  else
8740  {
8741  if (RingDependend(dA2[i].res))
8742  {
8743  WerrorS("no ring active (4)");
8744  break;
8745  }
8746  }
8747  if (traceit&TRACE_CALL)
8748  Print("call %s(%s,%s)\n",iiTwoOps(op),
8749  Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8750  failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
8751  || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
8752  || (call_failed=dA2[i].p(res,an,bn)));
8753  // everything done, clean up temp. variables
8754  if (failed)
8755  {
8756  // leave loop, goto error handling
8757  break;
8758  }
8759  else
8760  {
8761  // everything ok, clean up and return
8762  an->CleanUp();
8763  bn->CleanUp();
8766  return FALSE;
8767  }
8768  }
8769  }
8770  }
8771  i++;
8772  }
8773  an->CleanUp();
8774  bn->CleanUp();
8777  }
8778  // error handling ---------------------------------------------------
8779  const char *s=NULL;
8780  if (!errorreported)
8781  {
8782  if ((at==0) && (a->Fullname()!=sNoName_fe))
8783  {
8784  s=a->Fullname();
8785  }
8786  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8787  {
8788  s=b->Fullname();
8789  }
8790  if (s!=NULL)
8791  Werror("`%s` is not defined",s);
8792  else
8793  {
8794  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8795  s = iiTwoOps(op);
8796  if (proccall)
8797  {
8798  Werror("%s(`%s`,`%s`) failed"
8799  ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8800  }
8801  else
8802  {
8803  Werror("`%s` %s `%s` failed"
8804  ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8805  }
8806  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8807  {
8808  while (dA2[i].cmd==op)
8809  {
8810  if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8811  && (dA2[i].res!=0)
8812  && (dA2[i].p!=jjWRONG2))
8813  {
8814  if (proccall)
8815  Werror("expected %s(`%s`,`%s`)"
8816  ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8817  else
8818  Werror("expected `%s` %s `%s`"
8819  ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8820  }
8821  i++;
8822  }
8823  }
8824  }
8825  }
8826  a->CleanUp();
8827  b->CleanUp();
8828  res->rtyp = UNKNOWN;
8829  }
8830  return TRUE;
8831 }
#define jjWRONG2
Definition: iparith.cc:3644
short res
Definition: gentable.cc:73

◆ iiExprArith3()

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

Definition at line 9247 of file iparith.cc.

9248 {
9249  res->Init();
9250 
9251  if (!errorreported)
9252  {
9253 #ifdef SIQ
9254  if (siq>0)
9255  {
9256  //Print("siq:%d\n",siq);
9258  memcpy(&d->arg1,a,sizeof(sleftv));
9259  a->Init();
9260  memcpy(&d->arg2,b,sizeof(sleftv));
9261  b->Init();
9262  memcpy(&d->arg3,c,sizeof(sleftv));
9263  c->Init();
9264  d->op=op;
9265  d->argc=3;
9266  res->data=(char *)d;
9267  res->rtyp=COMMAND;
9268  return FALSE;
9269  }
9270 #endif
9271  int at=a->Typ();
9272  // handling bb-objects ----------------------------------------------
9273  if (at>MAX_TOK)
9274  {
9275  blackbox *bb=getBlackboxStuff(at);
9276  if (bb!=NULL)
9277  {
9278  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9279  // else: no op defined
9280  }
9281  else
9282  return TRUE;
9283  if (errorreported) return TRUE;
9284  }
9285  int bt=b->Typ();
9286  int ct=c->Typ();
9287 
9288  iiOp=op;
9289  int i=0;
9290  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9291  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9292  }
9293  a->CleanUp();
9294  b->CleanUp();
9295  c->CleanUp();
9296  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9297  return TRUE;
9298 }
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:9094
const struct sValCmd3 dArith3[]
Definition: table.h:770

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

9303 {
9304  res->Init();
9305  leftv b=a->next;
9306  a->next=NULL;
9307  int bt=b->Typ();
9308  leftv c=b->next;
9309  b->next=NULL;
9310  int ct=c->Typ();
9311  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9312  b->next=c;
9313  a->next=b;
9314  a->CleanUp(); // to cleanup the chain, content already done
9315  return bo;
9316 }

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

9097 {
9098  BOOLEAN call_failed=FALSE;
9099 
9100  assume(dA3[0].cmd==op);
9101 
9102  if (!errorreported)
9103  {
9104  int i=0;
9105  iiOp=op;
9106  while (dA3[i].cmd==op)
9107  {
9108  if ((at==dA3[i].arg1)
9109  && (bt==dA3[i].arg2)
9110  && (ct==dA3[i].arg3))
9111  {
9112  res->rtyp=dA3[i].res;
9113  if (currRing!=NULL)
9114  {
9115  if (check_valid(dA3[i].valid_for,op)) break;
9116  }
9117  if (traceit&TRACE_CALL)
9118  Print("call %s(%s,%s,%s)\n",
9119  iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9120  if ((call_failed=dA3[i].p(res,a,b,c)))
9121  {
9122  break;// leave loop, goto error handling
9123  }
9124  a->CleanUp();
9125  b->CleanUp();
9126  c->CleanUp();
9127  return FALSE;
9128  }
9129  i++;
9130  }
9131  // implicite type conversion ----------------------------------------------
9132  if (dA3[i].cmd!=op)
9133  {
9134  int ai,bi,ci;
9138  BOOLEAN failed=FALSE;
9139  i=0;
9140  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9141  while (dA3[i].cmd==op)
9142  {
9143  if ((dA3[i].valid_for & NO_CONVERSION)==0)
9144  {
9145  if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9146  {
9147  if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9148  {
9149  if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9150  {
9151  res->rtyp=dA3[i].res;
9152  if (currRing!=NULL)
9153  {
9154  if (check_valid(dA3[i].valid_for,op)) break;
9155  }
9156  if (traceit&TRACE_CALL)
9157  Print("call %s(%s,%s,%s)\n",
9158  iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9159  Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9160  failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9161  || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9162  || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9163  || (call_failed=dA3[i].p(res,an,bn,cn)));
9164  // everything done, clean up temp. variables
9165  if (failed)
9166  {
9167  // leave loop, goto error handling
9168  break;
9169  }
9170  else
9171  {
9172  // everything ok, clean up and return
9173  an->CleanUp();
9174  bn->CleanUp();
9175  cn->CleanUp();
9179  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9180  return FALSE;
9181  }
9182  }
9183  }
9184  }
9185  }
9186  i++;
9187  }
9188  an->CleanUp();
9189  bn->CleanUp();
9190  cn->CleanUp();
9194  }
9195  // error handling ---------------------------------------------------
9196  if (!errorreported)
9197  {
9198  const char *s=NULL;
9199  if ((at==0) && (a->Fullname()!=sNoName_fe))
9200  {
9201  s=a->Fullname();
9202  }
9203  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9204  {
9205  s=b->Fullname();
9206  }
9207  else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9208  {
9209  s=c->Fullname();
9210  }
9211  if (s!=NULL)
9212  Werror("`%s` is not defined",s);
9213  else
9214  {
9215  i=0;
9216  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9217  const char *s = iiTwoOps(op);
9218  Werror("%s(`%s`,`%s`,`%s`) failed"
9219  ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9220  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9221  {
9222  while (dA3[i].cmd==op)
9223  {
9224  if(((at==dA3[i].arg1)
9225  ||(bt==dA3[i].arg2)
9226  ||(ct==dA3[i].arg3))
9227  && (dA3[i].res!=0))
9228  {
9229  Werror("expected %s(`%s`,`%s`,`%s`)"
9230  ,s,Tok2Cmdname(dA3[i].arg1)
9231  ,Tok2Cmdname(dA3[i].arg2)
9232  ,Tok2Cmdname(dA3[i].arg3));
9233  }
9234  i++;
9235  }
9236  }
9237  }
9238  }
9239  res->rtyp = UNKNOWN;
9240  }
9241  a->CleanUp();
9242  b->CleanUp();
9243  c->CleanUp();
9244  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9245  return TRUE;
9246 }
short res
Definition: gentable.cc:90

◆ iiExprArithM()

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

Definition at line 9338 of file iparith.cc.

9339 {
9340  res->Init();
9341 
9342  if (!errorreported)
9343  {
9344 #ifdef SIQ
9345  if (siq>0)
9346  {
9347  //Print("siq:%d\n",siq);
9349  d->op=op;
9350  res->data=(char *)d;
9351  if (a!=NULL)
9352  {
9353  d->argc=a->listLength();
9354  // else : d->argc=0;
9355  memcpy(&d->arg1,a,sizeof(sleftv));
9356  switch(d->argc)
9357  {
9358  case 3:
9359  memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9360  a->next->next->Init();
9361  /* no break */
9362  case 2:
9363  memcpy(&d->arg2,a->next,sizeof(sleftv));
9364  a->next->Init();
9365  a->next->next=d->arg2.next;
9366  d->arg2.next=NULL;
9367  /* no break */
9368  case 1:
9369  a->Init();
9370  a->next=d->arg1.next;
9371  d->arg1.next=NULL;
9372  }
9373  if (d->argc>3) a->next=NULL;
9374  a->name=NULL;
9375  a->rtyp=0;
9376  a->data=NULL;
9377  a->e=NULL;
9378  a->attribute=NULL;
9379  a->CleanUp();
9380  }
9381  res->rtyp=COMMAND;
9382  return FALSE;
9383  }
9384 #endif
9385  if ((a!=NULL) && (a->Typ()>MAX_TOK))
9386  {
9387  blackbox *bb=getBlackboxStuff(a->Typ());
9388  if (bb!=NULL)
9389  {
9390  if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9391  // else: no op defined
9392  }
9393  else
9394  return TRUE;
9395  if (errorreported) return TRUE;
9396  }
9397  int args=0;
9398  if (a!=NULL) args=a->listLength();
9399 
9400  iiOp=op;
9401  int i=0;
9402  while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9403  while (dArithM[i].cmd==op)
9404  {
9405  if ((args==dArithM[i].number_of_args)
9406  || (dArithM[i].number_of_args==-1)
9407  || ((dArithM[i].number_of_args==-2)&&(args>0)))
9408  {
9409  res->rtyp=dArithM[i].res;
9410  if (currRing!=NULL)
9411  {
9412  if (check_valid(dArithM[i].valid_for,op)) break;
9413  }
9414  if (traceit&TRACE_CALL)
9415  Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9416  if (dArithM[i].p(res,a))
9417  {
9418  break;// leave loop, goto error handling
9419  }
9420  if (a!=NULL) a->CleanUp();
9421  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9422  return FALSE;
9423  }
9424  i++;
9425  }
9426  // error handling
9427  if (!errorreported)
9428  {
9429  if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9430  {
9431  Werror("`%s` is not defined",a->Fullname());
9432  }
9433  else
9434  {
9435  const char *s = iiTwoOps(op);
9436  Werror("%s(...) failed",s);
9437  }
9438  }
9439  res->rtyp = UNKNOWN;
9440  }
9441  if (a!=NULL) a->CleanUp();
9442  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9443  return TRUE;
9444 }
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:901

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9662 of file iparith.cc.

9663 {
9664  //printf("iiInitArithmetic()\n");
9665  memset(&sArithBase, 0, sizeof(sArithBase));
9666  iiInitCmdName();
9667  /* fix last-identifier */
9668 #if 0
9669  /* we expect that gentable allready did every thing */
9672  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9673  }
9674 #endif
9675  //Print("L=%d\n", sArithBase.nLastIdentifier);
9676 
9677  //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9678  //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9679 
9680  //iiArithAddCmd("Top", 0,-1,0);
9681 
9682 
9683  //for(i=0; i<sArithBase.nCmdUsed; i++) {
9684  // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9685  // sArithBase.sCmds[i].name,
9686  // sArithBase.sCmds[i].alias,
9687  // sArithBase.sCmds[i].tokval,
9688  // sArithBase.sCmds[i].toktype);
9689  //}
9690  //iiArithRemoveCmd("Top");
9691  //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9692  //iiArithRemoveCmd("mygcd");
9693  //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9694  return 0;
9695 }

◆ iin_Int()

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

Definition at line 222 of file iparith.cc.

223 {
224  long l=n_Int(n,cf);
225  int i=(int)l;
226  if ((long)i==l) return l;
227  return 0;
228 }
int l
Definition: cfEzgcd.cc:100
CanonicalForm cf
Definition: cfModGcd.cc:4085
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:548

◆ iiTabIndex()

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

Definition at line 9546 of file iparith.cc.

9547 {
9548  // user defined types are not in the pre-computed table:
9549  if (op>MAX_TOK) return 0;
9550 
9551  int a=0;
9552  int e=len;
9553  int p=len/2;
9554  do
9555  {
9556  if (op==dArithTab[p].cmd) return dArithTab[p].start;
9557  if (op<dArithTab[p].cmd) e=p-1;
9558  else a = p+1;
9559  p=a+(e-a)/2;
9560  }
9561  while ( a <= e);
9562 
9563  // catch missing a cmd:
9564  // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9565  // Print("op %d (%c) unknown",op,op);
9566  return 0;
9567 }

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 234 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9447 of file iparith.cc.

9448 {
9449  int i;
9450  int an=1;
9451  int en=sArithBase.nLastIdentifier;
9452 
9453  loop
9454  //for(an=0; an<sArithBase.nCmdUsed; )
9455  {
9456  if(an>=en-1)
9457  {
9458  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9459  {
9460  i=an;
9461  break;
9462  }
9463  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9464  {
9465  i=en;
9466  break;
9467  }
9468  else
9469  {
9470  // -- blackbox extensions:
9471  // return 0;
9472  return blackboxIsCmd(n,tok);
9473  }
9474  }
9475  i=(an+en)/2;
9476  if (*n < *(sArithBase.sCmds[i].name))
9477  {
9478  en=i-1;
9479  }
9480  else if (*n > *(sArithBase.sCmds[i].name))
9481  {
9482  an=i+1;
9483  }
9484  else
9485  {
9486  int v=strcmp(n,sArithBase.sCmds[i].name);
9487  if(v<0)
9488  {
9489  en=i-1;
9490  }
9491  else if(v>0)
9492  {
9493  an=i+1;
9494  }
9495  else /*v==0*/
9496  {
9497  break;
9498  }
9499  }
9500  }
9502  tok=sArithBase.sCmds[i].tokval;
9503  if(sArithBase.sCmds[i].alias==2)
9504  {
9505  Warn("outdated identifier `%s` used - please change your code",
9506  sArithBase.sCmds[i].name);
9507  sArithBase.sCmds[i].alias=1;
9508  }
9509  #if 0
9510  if (currRingHdl==NULL)
9511  {
9512  #ifdef SIQ
9513  if (siq<=0)
9514  {
9515  #endif
9516  if ((tok>=BEGIN_RING) && (tok<=END_RING))
9517  {
9518  WerrorS("no ring active");
9519  return 0;
9520  }
9521  #ifdef SIQ
9522  }
9523  #endif
9524  }
9525  #endif
9526  if (!expected_parms)
9527  {
9528  switch (tok)
9529  {
9530  case IDEAL_CMD:
9531  case INT_CMD:
9532  case INTVEC_CMD:
9533  case MAP_CMD:
9534  case MATRIX_CMD:
9535  case MODUL_CMD:
9536  case POLY_CMD:
9537  case PROC_CMD:
9538  case RING_CMD:
9539  case STRING_CMD:
9540  cmdtok = tok;
9541  break;
9542  }
9543  }
9544  return sArithBase.sCmds[i].toktype;
9545 }
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:218
@ END_RING
Definition: grammar.cc:310
@ IDEAL_CMD
Definition: grammar.cc:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ MAP_CMD
Definition: grammar.cc:285
@ PROC_CMD
Definition: grammar.cc:280
@ BEGIN_RING
Definition: grammar.cc:282
@ MODUL_CMD
Definition: grammar.cc:287
@ POLY_CMD
Definition: grammar.cc:289
@ RING_CMD
Definition: grammar.cc:281
EXTERN_VAR BOOLEAN expected_parms
Definition: iparith.cc:215
EXTERN_VAR int cmdtok
Definition: iparith.cc:214
VAR idhdl currRingHdl
Definition: ipid.cc:59
const char * lastreserved
Definition: ipshell.cc:80
@ INTVEC_CMD
Definition: tok.h:101
@ STRING_CMD
Definition: tok.h:185
@ INT_CMD
Definition: tok.h:96

◆ jjALIGN_M()

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

Definition at line 1769 of file iparith.cc.

1770 {
1771  ideal M=(ideal)u->CopyD();
1772  int s=(int)(long)v->Data();
1773  for(int i=IDELEMS(M)-1; i>=0;i--)
1774  {
1775  if (s+p_MinComp(M->m[i],currRing)<=0)
1776  { id_Delete(&M,currRing);return TRUE;}
1777  }
1778  id_Shift(M,s,currRing);
1779  res->data=M;
1780  return FALSE;
1781 }
void * CopyD(int t)
Definition: subexpr.cc:710
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:313
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void id_Shift(ideal M, int s, const ring r)
#define IDELEMS(i)
Definition: simpleideals.h:23
#define M
Definition: sirandom.c:25

◆ jjALIGN_V()

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

Definition at line 1759 of file iparith.cc.

1760 {
1761  poly p=(poly)u->CopyD();
1762  int s=(int)(long)v->Data();
1763  if (s+p_MinComp(p,currRing)<=0)
1764  { p_Delete(&p,currRing);return TRUE;}
1765  p_Shift(&p,s,currRing);
1766  res->data=p;
1767  return FALSE;
1768 }
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4732
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:861

◆ jjAND_I()

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

Definition at line 1370 of file iparith.cc.

1371 {
1372  res->data = (char *)((long)u->Data() && (long)v->Data());
1373  return FALSE;
1374 }
void * Data()
Definition: subexpr.cc:1154

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3757 of file iparith.cc.

3758 {
3759  //matrix m=(matrix)v->Data();
3760  //lists l=mpBareiss(m,FALSE);
3761  intvec *iv;
3762  ideal m;
3763  sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3765  l->Init(2);
3766  l->m[0].rtyp=MODUL_CMD;
3767  l->m[1].rtyp=INTVEC_CMD;
3768  l->m[0].data=(void *)m;
3769  l->m[1].data=(void *)iv;
3770  res->data = (char *)l;
3771  return FALSE;
3772 }
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
Definition: lists.h:24
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition: sparsmat.cc:347

◆ jjBAREISS3()

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

Definition at line 5947 of file iparith.cc.

5948 {
5949  intvec *iv;
5950  ideal m;
5952  int k=(int)(long)w->Data();
5953  if (k>=0)
5954  {
5955  sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
5956  l->Init(2);
5957  l->m[0].rtyp=MODUL_CMD;
5958  l->m[1].rtyp=INTVEC_CMD;
5959  l->m[0].data=(void *)m;
5960  l->m[1].data=(void *)iv;
5961  }
5962  else
5963  {
5964  m=sm_CallSolv((ideal)u->Data(), currRing);
5965  l->Init(1);
5966  l->m[0].rtyp=IDEAL_CMD;
5967  l->m[0].data=(void *)m;
5968  }
5969  res->data = (char *)l;
5970  return FALSE;
5971 }
int k
Definition: cfEzgcd.cc:99
const CanonicalForm & w
Definition: facAbsFact.cc:51
ideal sm_CallSolv(ideal I, const ring R)
Definition: sparsmat.cc:2316

◆ jjBAREISS_BIM()

static BOOLEAN jjBAREISS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3780 of file iparith.cc.

3781 {
3782  bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3783  b->hnf();
3784  res->data=(char*)b;
3785  return FALSE;
3786 }
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 3802 of file iparith.cc.

3803 {
3804  bigintmat *b=(bigintmat*)u->Data();
3805  res->data=(void *)bim2iv(b);
3806  return FALSE;
3807 }
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3787 of file iparith.cc.

3788 {
3789  BOOLEAN bo=FALSE;
3790  number n=(number)u->CopyD();
3792  if (nMap!=NULL)
3793  res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3794  else
3795  {
3796  Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3797  bo=TRUE;
3798  }
3799  n_Delete(&n,coeffs_BIGINT);
3800  return bo;
3801 }
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:987
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:723
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:74
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3808 of file iparith.cc.

3809 {
3810  sleftv tmp;
3811  BOOLEAN bo=jjBI2N(&tmp,u);
3812  if (!bo)
3813  {
3814  number n=(number) tmp.data;
3815  if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3816  else
3817  {
3818  res->data=(void *)pNSet(n);
3819  }
3820  }
3821  return bo;
3822 }
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3787
if(yy_init)
Definition: libparse.cc:1420
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define pNSet(n)
Definition: polys.h:313

◆ jjBRACK_Bim()

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

Definition at line 5692 of file iparith.cc.

5693 {
5694  bigintmat *bim = (bigintmat *)u->Data();
5695  int r = (int)(long)v->Data();
5696  int c = (int)(long)w->Data();
5697  if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5698  {
5699  Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5700  r,c,u->Fullname(),bim->rows(),bim->cols());
5701  return TRUE;
5702  }
5703  res->data=u->data; u->data=NULL;
5704  res->rtyp=u->rtyp; u->rtyp=0;
5705  res->name=u->name; u->name=NULL;
5706  Subexpr e=jjMakeSub(v);
5707  e->next=jjMakeSub(w);
5708  if (u->e==NULL)
5709  res->e=e;
5710  else
5711  {
5712  Subexpr h=u->e;
5713  while (h->next!=NULL) h=h->next;
5714  h->next=e;
5715  res->e=u->e;
5716  u->e=NULL;
5717  }
5718  return FALSE;
5719 }
int cols() const
Definition: bigintmat.h:144
int rows() const
Definition: bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:8640
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 5665 of file iparith.cc.

5666 {
5667  intvec *iv = (intvec *)u->Data();
5668  int r = (int)(long)v->Data();
5669  int c = (int)(long)w->Data();
5670  if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5671  {
5672  Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5673  r,c,u->Fullname(),iv->rows(),iv->cols());
5674  return TRUE;
5675  }
5676  res->data=u->data; u->data=NULL;
5677  res->rtyp=u->rtyp; u->rtyp=0;
5678  res->name=u->name; u->name=NULL;
5679  Subexpr e=jjMakeSub(v);
5680  e->next=jjMakeSub(w);
5681  if (u->e==NULL) res->e=e;
5682  else
5683  {
5684  Subexpr h=u->e;
5685  while (h->next!=NULL) h=h->next;
5686  h->next=e;
5687  res->e=u->e;
5688  u->e=NULL;
5689  }
5690  return FALSE;
5691 }
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 5720 of file iparith.cc.

5721 {
5722  matrix m= (matrix)u->Data();
5723  int r = (int)(long)v->Data();
5724  int c = (int)(long)w->Data();
5725  //Print("gen. elem %d, %d\n",r,c);
5726  if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5727  {
5728  Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5729  MATROWS(m),MATCOLS(m));
5730  return TRUE;
5731  }
5732  res->data=u->data; u->data=NULL;
5733  res->rtyp=u->rtyp; u->rtyp=0;
5734  res->name=u->name; u->name=NULL;
5735  Subexpr e=jjMakeSub(v);
5736  e->next=jjMakeSub(w);
5737  if (u->e==NULL)
5738  res->e=e;
5739  else
5740  {
5741  Subexpr h=u->e;
5742  while (h->next!=NULL) h=h->next;
5743  h->next=e;
5744  res->e=u->e;
5745  u->e=NULL;
5746  }
5747  return FALSE;
5748 }
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 5778 of file iparith.cc.

5779 {
5780  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5781  {
5782  WerrorS("cannot build expression lists from unnamed objects");
5783  return TRUE;
5784  }
5785 
5786  leftv p=NULL;
5787  intvec *iv=(intvec *)w->Data();
5788  int l;
5789  BOOLEAN nok;
5790  sleftv ut;
5791  memcpy(&ut,u,sizeof(ut));
5792  sleftv t;
5793  t.Init();
5794  t.rtyp=INT_CMD;
5795  for (l=0;l< iv->length(); l++)
5796  {
5797  t.data=(char *)(long)((*iv)[l]);
5798  if (p==NULL)
5799  {
5800  p=res;
5801  }
5802  else
5803  {
5804  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5805  p=p->next;
5806  }
5807  memcpy(u,&ut,sizeof(ut));
5808  if (u->Typ() == MATRIX_CMD)
5809  nok=jjBRACK_Ma(p,u,v,&t);
5810  else if (u->Typ() == BIGINTMAT_CMD)
5811  nok=jjBRACK_Bim(p,u,v,&t);
5812  else /* INTMAT_CMD */
5813  nok=jjBRACK_Im(p,u,v,&t);
5814  if (nok)
5815  {
5816  while (res->next!=NULL)
5817  {
5818  p=res->next->next;
5819  omFreeBin((ADDRESS)res->next, sleftv_bin);
5820  // res->e aufraeumen !!!!
5821  res->next=p;
5822  }
5823  return TRUE;
5824  }
5825  }
5826  return FALSE;
5827 }
int length() const
Definition: intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5692
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5665
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5720
#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 5828 of file iparith.cc.

5829 {
5830  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5831  {
5832  WerrorS("cannot build expression lists from unnamed objects");
5833  return TRUE;
5834  }
5835  leftv p=NULL;
5836  intvec *iv=(intvec *)v->Data();
5837  int l;
5838  BOOLEAN nok;
5839  sleftv ut;
5840  memcpy(&ut,u,sizeof(ut));
5841  sleftv t;
5842  t.Init();
5843  t.rtyp=INT_CMD;
5844  for (l=0;l< iv->length(); l++)
5845  {
5846  t.data=(char *)(long)((*iv)[l]);
5847  if (p==NULL)
5848  {
5849  p=res;
5850  }
5851  else
5852  {
5853  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5854  p=p->next;
5855  }
5856  memcpy(u,&ut,sizeof(ut));
5857  if (u->Typ() == MATRIX_CMD)
5858  nok=jjBRACK_Ma(p,u,&t,w);
5859  else if (u->Typ() == BIGINTMAT_CMD)
5860  nok=jjBRACK_Bim(p,u,&t,w);
5861  else /* INTMAT_CMD */
5862  nok=jjBRACK_Im(p,u,&t,w);
5863  if (nok)
5864  {
5865  while (res->next!=NULL)
5866  {
5867  p=res->next->next;
5868  omFreeBin((ADDRESS)res->next, sleftv_bin);
5869  // res->e aufraeumen !!
5870  res->next=p;
5871  }
5872  return TRUE;
5873  }
5874  }
5875  return FALSE;
5876 }

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5877 of file iparith.cc.

5878 {
5879  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5880  {
5881  WerrorS("cannot build expression lists from unnamed objects");
5882  return TRUE;
5883  }
5884  leftv p=NULL;
5885  intvec *vv=(intvec *)v->Data();
5886  intvec *wv=(intvec *)w->Data();
5887  int vl;
5888  int wl;
5889  BOOLEAN nok;
5890 
5891  sleftv t1,t2,ut;
5892  memcpy(&ut,u,sizeof(ut));
5893  t1.Init();
5894  t1.rtyp=INT_CMD;
5895  t2.Init();
5896  t2.rtyp=INT_CMD;
5897  for (vl=0;vl< vv->length(); vl++)
5898  {
5899  t1.data=(char *)(long)((*vv)[vl]);
5900  for (wl=0;wl< wv->length(); wl++)
5901  {
5902  t2.data=(char *)(long)((*wv)[wl]);
5903  if (p==NULL)
5904  {
5905  p=res;
5906  }
5907  else
5908  {
5909  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5910  p=p->next;
5911  }
5912  memcpy(u,&ut,sizeof(ut));
5913  if (u->Typ() == MATRIX_CMD)
5914  nok=jjBRACK_Ma(p,u,&t1,&t2);
5915  else if (u->Typ() == BIGINTMAT_CMD)
5916  nok=jjBRACK_Bim(p,u,&t1,&t2);
5917  else /* INTMAT_CMD */
5918  nok=jjBRACK_Im(p,u,&t1,&t2);
5919  if (nok)
5920  {
5921  res->CleanUp();
5922  return TRUE;
5923  }
5924  }
5925  }
5926  return FALSE;
5927 }

◆ jjBRACK_S()

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

Definition at line 5649 of file iparith.cc.

5650 {
5651  char *s= (char *)u->Data();
5652  int r = (int)(long)v->Data();
5653  int c = (int)(long)w->Data();
5654  int l = strlen(s);
5655 
5656  if ( (r<1) || (r>l) || (c<0) )
5657  {
5658  Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5659  return TRUE;
5660  }
5661  res->data = (char *)omAlloc((long)(c+1));
5662  sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5663  return FALSE;
5664 }
#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 5749 of file iparith.cc.

5750 {
5751  ideal m= (ideal)u->Data();
5752  int r = (int)(long)v->Data();
5753  int c = (int)(long)w->Data();
5754  //Print("gen. elem %d, %d\n",r,c);
5755  if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5756  {
5757  Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5758  (int)m->rank,IDELEMS(m));
5759  return TRUE;
5760  }
5761  res->data=u->data; u->data=NULL;
5762  res->rtyp=u->rtyp; u->rtyp=0;
5763  res->name=u->name; u->name=NULL;
5764  Subexpr e=jjMakeSub(v);
5765  e->next=jjMakeSub(w);
5766  if (u->e==NULL)
5767  res->e=e;
5768  else
5769  {
5770  Subexpr h=u->e;
5771  while (h->next!=NULL) h=h->next;
5772  h->next=e;
5773  res->e=u->e;
5774  u->e=NULL;
5775  }
5776  return FALSE;
5777 }

◆ jjBRACKET()

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

Definition at line 2858 of file iparith.cc.

2859 {
2860  res->data=NULL;
2861 
2863  {
2864  const poly q = (poly)b->Data();
2865 
2866  if( q != NULL )
2867  {
2868  if( (poly)a->Data() != NULL )
2869  {
2870  if (rIsPluralRing(currRing))
2871  {
2872  poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2873  res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2874  }
2875  else if (rIsLPRing(currRing))
2876  {
2877  const poly p = (poly)a->Data();
2878  res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2879  }
2880  }
2881  }
2882  }
2883  return FALSE;
2884 }
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
#define pAdd(p, q)
Definition: polys.h:203
#define pNeg(p)
Definition: polys.h:198
#define ppMult_qq(p, q)
Definition: polys.h:208

◆ jjBRACKET_REC()

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

Definition at line 2885 of file iparith.cc.

2886 {
2887  res->data=NULL;
2888 
2890  {
2891  const poly q = (poly)b->Data();
2892  if(q != NULL)
2893  {
2894  if((poly)a->Data() != NULL)
2895  {
2896  const poly p = (poly)a->Data();
2897  int k=(int)(long)c->Data();
2898  if (k > 0)
2899  {
2900  poly qq = pCopy(q);
2901  for (int i = 0; i < k; i++)
2902  {
2903  poly qq_ref = qq;
2904  if (rIsLPRing(currRing))
2905  {
2906  qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
2907  }
2908  else if (rIsPluralRing(currRing))
2909  {
2910  qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
2911  }
2912  pDelete(&qq_ref);
2913  if (qq == NULL) break;
2914  }
2915  res->data = qq;
2916  }
2917  else
2918  {
2919  Werror("invalid number of iterations");
2920  }
2921  }
2922  }
2923  }
2924  return FALSE;
2925 }
#define pDelete(p_ptr)
Definition: polys.h:186
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 7062 of file iparith.cc.

7063 {
7064 #ifdef HAVE_SDB
7065  sdb_show_bp();
7066 #endif
7067  return FALSE;
7068 }
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7069 of file iparith.cc.

7070 {
7071 #ifdef HAVE_SDB
7072  if(v->Typ()==PROC_CMD)
7073  {
7074  int lineno=0;
7075  if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7076  {
7077  lineno=(int)(long)v->next->Data();
7078  }
7079  return sdb_set_breakpoint(v->Name(),lineno);
7080  }
7081  return TRUE;
7082 #else
7083  return FALSE;
7084 #endif
7085 }
Variable next() const
Definition: factory.h:153
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 7086 of file iparith.cc.

7087 {
7088  return iiExprArith1(res,v,iiOp);
7089 }

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3823 of file iparith.cc.

3824 {
3825  return iiExprArithM(res,u,iiOp);
3826 }
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:9338

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7090 of file iparith.cc.

7091 {
7092  leftv v=u->next;
7093  u->next=NULL;
7094  BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7095  u->next=v;
7096  return b;
7097 }
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8846

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7098 of file iparith.cc.

7099 {
7100  leftv v = u->next;
7101  leftv w = v->next;
7102  u->next = NULL;
7103  v->next = NULL;
7104  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7105  u->next = v;
7106  v->next = w;
7107  return b;
7108 }
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:9247

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3827 of file iparith.cc.

3828 {
3829  res->data = (char *)(long)rChar((ring)v->Data());
3830  return FALSE;
3831 }
int rChar(ring r)
Definition: ring.cc:714

◆ jjCHINREM_BI()

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

Definition at line 1672 of file iparith.cc.

1673 {
1674  intvec *c=(intvec*)u->Data();
1675  intvec* p=(intvec*)v->Data();
1676  int rl=p->length();
1677  number *x=(number *)omAlloc(rl*sizeof(number));
1678  number *q=(number *)omAlloc(rl*sizeof(number));
1679  int i;
1680  for(i=rl-1;i>=0;i--)
1681  {
1682  q[i]=n_Init((*p)[i], coeffs_BIGINT);
1683  x[i]=n_Init((*c)[i], coeffs_BIGINT);
1684  }
1685  CFArray iv(rl);
1686  number n=n_ChineseRemainderSym(x,q,rl,FALSE,iv,coeffs_BIGINT);
1687  for(i=rl-1;i>=0;i--)
1688  {
1689  n_Delete(&(q[i]),coeffs_BIGINT);
1690  n_Delete(&(x[i]),coeffs_BIGINT);
1691  }
1692  omFree(x); omFree(q);
1693  res->data=(char *)n;
1694  return FALSE;
1695 }
Variable x
Definition: cfModGcd.cc:4084
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:788
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:539

◆ jjCHINREM_ID()

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

Definition at line 9898 of file iparith.cc.

9899 {
9900  if ((currRing!=NULL)
9902  && (!rField_is_Z(currRing)))
9903  {
9904  WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
9905  return TRUE;
9906  }
9907  coeffs cf;
9908  lists c=(lists)u->CopyD(); // list of ideal or bigint/int
9909  int rl=c->nr+1;
9910  int return_type=c->m[0].Typ();
9911  if ((return_type!=IDEAL_CMD)
9912  && (return_type!=MODUL_CMD)
9913  && (return_type!=MATRIX_CMD)
9914  && (return_type!=POLY_CMD))
9915  {
9916  if((return_type==BIGINT_CMD)
9917  ||(return_type==INT_CMD))
9918  return_type=BIGINT_CMD;
9919  else if (return_type==LIST_CMD)
9920  {
9921  // create a tmp list of the correct size
9922  lists res_l=(lists)omAllocBin(slists_bin);
9923  res_l->Init(rl /*c->nr+1*/);
9924  BOOLEAN bo=FALSE;
9925  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
9926  for (unsigned i=0;i<=(unsigned)c->nr;i++)
9927  {
9928  sleftv tmp;
9929  tmp.Copy(v);
9930  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9931  if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
9932  }
9933  c->Clean();
9934  res->data=res_l;
9935  res->rtyp=LIST_CMD;
9936  return bo;
9937  }
9938  else
9939  {
9940  c->Clean();
9941  WerrorS("poly/ideal/module/matrix/list expected");
9942  return TRUE;
9943  }
9944  }
9945  if (return_type==BIGINT_CMD)
9946  cf=coeffs_BIGINT;
9947  else
9948  {
9949  cf=currRing->cf;
9950  if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
9951  cf=cf->extRing->cf;
9952  }
9953  lists pl=NULL;
9954  intvec *p=NULL;
9955  if (v->Typ()==LIST_CMD)
9956  {
9957  pl=(lists)v->Data();
9958  if (pl->nr!=rl-1)
9959  {
9960  WerrorS("wromg number of primes");
9961  return TRUE;
9962  }
9963  }
9964  else
9965  {
9966  p=(intvec*)v->Data();
9967  if (p->length()!=rl)
9968  {
9969  WerrorS("wromg number of primes");
9970  return TRUE;
9971  }
9972  }
9973  ideal result;
9974  ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
9975  number *xx=NULL;
9977  int i;
9978  if (return_type!=BIGINT_CMD)
9979  {
9980  for(i=rl-1;i>=0;i--)
9981  {
9982  if (c->m[i].Typ()!=return_type)
9983  {
9984  Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
9985  omFree(x); // delete c
9986  return TRUE;
9987  }
9988  if (return_type==POLY_CMD)
9989  {
9990  x[i]=idInit(1,1);
9991  x[i]->m[0]=(poly)c->m[i].CopyD();
9992  }
9993  else
9994  {
9995  x[i]=(ideal)c->m[i].CopyD();
9996  }
9997  //c->m[i].Init();
9998  }
9999  }
10000  else
10001  {
10002  if (nMap==NULL)
10003  {
10004  Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10005  return TRUE;
10006  }
10007  xx=(number *)omAlloc(rl*sizeof(number));
10008  for(i=rl-1;i>=0;i--)
10009  {
10010  if (c->m[i].Typ()==INT_CMD)
10011  {
10012  xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10013  }
10014  else if (c->m[i].Typ()==BIGINT_CMD)
10015  {
10016  xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10017  }
10018  else
10019  {
10020  Werror("bigint expected at pos %d",i+1);
10021  omFree(x); // delete c
10022  omFree(xx); // delete c
10023  return TRUE;
10024  }
10025  }
10026  }
10027  number *q=(number *)omAlloc(rl*sizeof(number));
10028  if (p!=NULL)
10029  {
10030  for(i=rl-1;i>=0;i--)
10031  {
10032  q[i]=n_Init((*p)[i], cf);
10033  }
10034  }
10035  else
10036  {
10037  for(i=rl-1;i>=0;i--)
10038  {
10039  if (pl->m[i].Typ()==INT_CMD)
10040  {
10041  q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10042  }
10043  else if (pl->m[i].Typ()==BIGINT_CMD)
10044  {
10045  q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10046  }
10047  else
10048  {
10049  Werror("bigint expected at pos %d",i+1);
10050  for(i++;i<rl;i++)
10051  {
10052  n_Delete(&(q[i]),cf);
10053  }
10054  omFree(x); // delete c
10055  omFree(q); // delete pl
10056  if (xx!=NULL) omFree(xx); // delete c
10057  return TRUE;
10058  }
10059  }
10060  }
10061  if (return_type==BIGINT_CMD)
10062  {
10063  CFArray i_v(rl);
10064  number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
10065  res->data=(char *)n;
10066  }
10067  else
10068  {
10069  #if 0
10070  #ifdef HAVE_VSPACE
10071  int cpus = (long) feOptValue(FE_OPT_CPUS);
10072  if ((cpus>1) && (rField_is_Q(currRing)))
10073  result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10074  else
10075  #endif
10076  #endif
10077  result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10078  c->Clean();
10079  if ((return_type==POLY_CMD) &&(result!=NULL))
10080  {
10081  res->data=(char *)result->m[0];
10082  result->m[0]=NULL;
10083  idDelete(&result);
10084  }
10085  else
10086  res->data=(char *)result;
10087  }
10088  for(i=rl-1;i>=0;i--)
10089  {
10090  n_Delete(&(q[i]),cf);
10091  }
10092  omFree(q);
10093  res->rtyp=return_type;
10094  return result==NULL;
10095 }
void Copy(leftv e)
Definition: subexpr.cc:685
sleftv * m
Definition: lists.h:46
void Clean(ring r=currRing)
Definition: lists.h:26
INLINE_THIS void Init(int l=0)
int nr
Definition: lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:870
return result
Definition: facAbsBiFact.cc:75
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
Definition: kChinese.cc:195
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:514
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:511
ideal idInit(int idsize, int rank)
initialise an ideal / module
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 1783 of file iparith.cc.

1784 {
1785  poly p=(poly)v->Data();
1786  if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1787  res->data=(char *)mp_CoeffProc((poly)u->Data(),p /*(poly)v->Data()*/,currRing);
1788  return FALSE;
1789 }
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 1790 of file iparith.cc.

1791 {
1792  poly p=(poly)v->Data();
1793  if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1794  res->data=(char *)mp_CoeffProcId((ideal)u->Data(),p /*(poly)v->Data()*/,currRing);
1795  return FALSE;
1796 }
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 7110 of file iparith.cc.

7111 {
7112  const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7113  if (iiCheckTypes(v,t,1))
7114  {
7115  idhdl c=(idhdl)v->next->next->data;
7116  if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7117  idhdl m=(idhdl)v->next->next->next->data;
7118  idDelete((ideal *)&(c->data.uideal));
7119  idDelete((ideal *)&(m->data.uideal));
7120  mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7121  (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7122  return FALSE;
7123  }
7124  return TRUE;
7125 }
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:6564
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 1808 of file iparith.cc.

1809 {
1810  poly p = pInit();
1811  int i;
1812  for (i=1; i<=currRing->N; i++)
1813  {
1814  pSetExp(p, i, 1);
1815  }
1816  pSetm(p);
1817  res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1818  (ideal)(v->Data()), p);
1819  pLmFree(&p);
1820  return FALSE;
1821 }
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2605
#define pSetm(p)
Definition: polys.h:271
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:70
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pSetExp(p, i, v)
Definition: polys.h:42

◆ jjCOEFFS3_Id()

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

Definition at line 5972 of file iparith.cc.

5973 {
5974  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5975  {
5976  WerrorS("3rd argument must be a name of a matrix");
5977  return TRUE;
5978  }
5979  ideal i=(ideal)u->Data();
5980  int rank=(int)i->rank;
5981  BOOLEAN r=jjCOEFFS_Id(res,u,v);
5982  if (r) return TRUE;
5983  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
5984  return FALSE;
5985 }
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1797
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition: matpol.cc:362
#define pVar(m)
Definition: polys.h:381

◆ jjCOEFFS3_KB()

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

Definition at line 5986 of file iparith.cc.

5987 {
5988  res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
5989  (ideal)(v->Data()),(poly)(w->Data()));
5990  return FALSE;
5991 }

◆ jjCOEFFS3_P()

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

Definition at line 5992 of file iparith.cc.

5993 {
5994  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5995  {
5996  WerrorS("3rd argument must be a name of a matrix");
5997  return TRUE;
5998  }
5999  // CopyD for POLY_CMD and VECTOR_CMD are identical:
6000  poly p=(poly)u->CopyD(POLY_CMD);
6001  ideal i=idInit(1,1);
6002  i->m[0]=p;
6003  sleftv t;
6004  t.Init();
6005  t.data=(char *)i;
6006  t.rtyp=IDEAL_CMD;
6007  int rank=1;
6008  if (u->Typ()==VECTOR_CMD)
6009  {
6010  i->rank=rank=pMaxComp(p);
6011  t.rtyp=MODUL_CMD;
6012  }
6013  BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6014  t.CleanUp();
6015  if (r) return TRUE;
6016  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6017  return FALSE;
6018 }
#define pMaxComp(p)
Definition: polys.h:299

◆ jjCOEFFS_Id()

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

Definition at line 1797 of file iparith.cc.

1798 {
1799  int i=pVar((poly)v->Data());
1800  if (i==0)
1801  {
1802  WerrorS("ringvar expected");
1803  return TRUE;
1804  }
1805  res->data=(char *)mp_Coeffs((ideal)u->CopyD(),i,currRing);
1806  return FALSE;
1807 }
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 695 of file iparith.cc.

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

◆ jjCOLON()

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

Definition at line 324 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3832 of file iparith.cc.

3833 {
3834  res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3835  return FALSE;
3836 }

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3837 of file iparith.cc.

3838 {
3839  res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3840  return FALSE;
3841 }

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3842 of file iparith.cc.

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

◆ jjCOMPARE_ALL()

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

Definition at line 10115 of file iparith.cc.

10116 {
10117  leftv a=(leftv)aa;
10118  int at=a->Typ();
10119  leftv b=(leftv)bb;
10120  int bt=b->Typ();
10121  if (at < bt) return -1;
10122  if (at > bt) return 1;
10123  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10124  sleftv tmp;
10125  tmp.Init();
10126  iiOp='<';
10127  BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10128  if (bo)
10129  {
10130  Werror(" no `<` for %s",Tok2Cmdname(at));
10131  unsigned long ad=(unsigned long)a->Data();
10132  unsigned long bd=(unsigned long)b->Data();
10133  if (ad<bd) return -1;
10134  else if (ad==bd) return 0;
10135  else return 1;
10136  }
10137  else if (tmp.data==NULL) /* not < */
10138  {
10139  iiOp=EQUAL_EQUAL;
10140  tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10141  bo=iiExprArith2TabIntern(&tmp,a,EQUAL_EQUAL,b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10142  if (bo)
10143  {
10144  Werror(" no `==` for %s",Tok2Cmdname(at));
10145  unsigned long ad=(unsigned long)a->Data();
10146  unsigned long bd=(unsigned long)b->Data();
10147  if (ad<bd) return -1;
10148  else if (ad==bd) return 0;
10149  else return 1;
10150  }
10151  else if (tmp.data==NULL) /* not <,== */ return 1;
10152  else return 0;
10153  }
10154  else return -1;
10155 }
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 371 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 343 of file iparith.cc.

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

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

◆ jjCOMPARE_MA()

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

Definition at line 426 of file iparith.cc.

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

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

◆ jjCOMPARE_S()

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

Definition at line 481 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3847 of file iparith.cc.

3848 {
3849  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3850  poly p=(poly)v->CopyD(POLY_CMD);
3851  if (p!=NULL) p_Cleardenom(p, currRing);
3852  res->data = (char *)p;
3853  return FALSE;
3854 }
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2900

◆ jjCONTRACT()

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

Definition at line 1822 of file iparith.cc.

1823 {
1824  res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data(),FALSE);
1825  return FALSE;
1826 }
matrix idDiffOp(ideal I, ideal J, BOOLEAN multiply)
Definition: ideals.cc:2135

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3855 of file iparith.cc.

3856 {
3857  res->data = (char *)(long)n_Size((number)v->Data(),coeffs_BIGINT);
3858  return FALSE;
3859 }
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:571

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3860 of file iparith.cc.

3861 {
3862  bigintmat* aa= (bigintmat *)v->Data();
3863  res->data = (char *)(long)(aa->rows()*aa->cols());
3864  return FALSE;
3865 }

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3883 of file iparith.cc.

3884 {
3885  res->data = (char *)(long)((intvec*)(v->Data()))->length();
3886  return FALSE;
3887 }

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3871 of file iparith.cc.

3872 {
3873  lists l=(lists)v->Data();
3874  res->data = (char *)(long)(lSize(l)+1);
3875  return FALSE;
3876 }
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3877 of file iparith.cc.

3878 {
3879  matrix m=(matrix)v->Data();
3880  res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3881  return FALSE;
3882 }

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3866 of file iparith.cc.

3867 {
3868  res->data = (char *)(long)nSize((number)v->Data());
3869  return FALSE;
3870 }

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5618 of file iparith.cc.

5619 {
5620  res->data=(char *)(long)sySize((syStrategy)v->Data());
5621  return FALSE;
5622 }
int sySize(syStrategy syzstr)
Definition: syz1.cc:1829

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3888 of file iparith.cc.

3889 {
3890  ring r=(ring)v->Data();
3891  int elems=-1;
3892  if (rField_is_Zp(r)) elems=r->cf->ch;
3893  else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3894  else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3895  {
3896  extern int ipower ( int b, int n ); /* factory/cf_util */
3897  elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3898  }
3899  res->data = (char *)(long)elems;
3900  return FALSE;
3901 }
int ipower(int b, int m)
int ipower ( int b, int m )
Definition: cf_util.cc:27
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:534
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:505
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:526

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3940 of file iparith.cc.

3941 {
3942  if ((v->rtyp==IDHDL)
3943  && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
3944  {
3945  res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
3946  }
3947  else if (v->rtyp!=0) res->data=(void *)(-1);
3948  return FALSE;
3949 }
#define IDLEV(a)
Definition: ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3902 of file iparith.cc.

3903 {
3904  int dummy;
3905  poly p=(poly)v->Data();
3906  if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3907  else res->data=(char *)-1;
3908  return FALSE;
3909 }

◆ jjDEG_IV()

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

Definition at line 1838 of file iparith.cc.

1839 {
1840  poly p=(poly)u->Data();
1841  if (p!=NULL)
1842  {
1843  int *iv=iv2array((intvec *)v->Data(),currRing);
1844  const long d = p_DegW(p,iv,currRing);
1845  omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(int) );
1846  res->data = (char *)(d);
1847  }
1848  else
1849  res->data=(char *)(long)(-1);
1850  return FALSE;
1851 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long p_DegW(poly p, const int *w, const ring R)
Definition: p_polys.cc:685
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:597
int * iv2array(intvec *iv, const ring R)
Definition: weight.cc:200

◆ jjDEG_M()

static BOOLEAN jjDEG_M ( leftv  res,
leftv  u 
)
static

Definition at line 3910 of file iparith.cc.

3911 {
3912  ideal I=(ideal)u->Data();
3913  int d=-1;
3914  int dummy;
3915  int i;
3916  for(i=IDELEMS(I)-1;i>=0;i--)
3917  if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3918  res->data = (char *)(long)d;
3919  return FALSE;
3920 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:124

◆ jjDEG_M_IV()

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

Definition at line 1827 of file iparith.cc.

1828 {
1829  int *iv=iv2array((intvec *)v->Data(),currRing);
1830  ideal I=(ideal)u->Data();
1831  int d=-1;
1832  int i;
1833  for(i=IDELEMS(I);i>=0;i--) d=si_max(d,(int)p_DegW(I->m[i],iv,currRing));
1834  omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(int) );
1835  res->data = (char *)((long)d);
1836  return FALSE;
1837 }

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3921 of file iparith.cc.

3922 {
3923  SPrintStart();
3924 #ifdef HAVE_RINGS
3925  if (rField_is_Z(currRing))
3926  {
3927  PrintS("// NOTE: computation of degree is being performed for\n");
3928  PrintS("// generic fibre, that is, over Q\n");
3929  }
3930 #endif
3931  assumeStdFlag(v);
3932  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3933  scDegree((ideal)v->Data(),module_w,currRing->qideal);
3934  char *s=SPrintEnd();
3935  int l=strlen(s)-1;
3936  s[l]='\0';
3937  res->data=(void*)s;
3938  return FALSE;
3939 }
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:895
void SPrintStart()
Definition: reporter.cc:246
char * SPrintEnd()
Definition: reporter.cc:273
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1536

◆ jjDelete_ID()

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

Definition at line 1859 of file iparith.cc.

1860 {
1861  int pos=(int)(long)v->Data();
1862  ideal I=(ideal)u->Data();
1863  res->data=(void*)id_Delete_Pos(I,pos-1,currRing);
1864  return res->data==NULL;
1865 }
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 1852 of file iparith.cc.

1853 {
1854  int pos=(int)(long)v->Data();
1855  intvec *iv=(intvec*)u->Data();
1856  res->data=(void*)iv->delete_pos(pos-1);
1857  return res->data==NULL;
1858 }
intvec * delete_pos(int p)
Definition: intvec.cc:824

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

Return the denominator of the input number.

Definition at line 3952 of file iparith.cc.

3953 {
3954  number n = reinterpret_cast<number>(v->CopyD());
3955  res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
3956  n_Delete(&n,currRing);
3957  return FALSE;
3958 }
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:604

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 3969 of file iparith.cc.

3970 {
3971  matrix m=(matrix)v->Data();
3972  res ->data = mp_Det(m,currRing);
3973  return FALSE;
3974 }
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 1866 of file iparith.cc.

1867 {
1868  matrix m=(matrix)u->Data();
1869  DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1870  res ->data = mp_Det(m,currRing,d);
1871  return FALSE;
1872 }
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 1873 of file iparith.cc.

1874 {
1875  DetVariant d=mp_GetAlgorithmDet((char*)v->Data());
1876  ideal m=(ideal)u->Data();
1877  res ->data = sm_Det(m,currRing,d);
1878  return FALSE;
1879 }
poly sm_Det(ideal a, const ring r, DetVariant d)
Definition: matpol.cc:2167

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3975 of file iparith.cc.

3976 {
3977  bigintmat * m=(bigintmat*)v->Data();
3978  int i,j;
3979  i=m->rows();j=m->cols();
3980  if(i==j)
3981  res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
3982  else
3983  {
3984  Werror("det of %d x %d bigintmat",i,j);
3985  return TRUE;
3986  }
3987  return FALSE;
3988 }
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1764
int j
Definition: facHensel.cc:110

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4011 of file iparith.cc.

4012 {
4013  intvec * m=(intvec*)v->Data();
4014  int i,j;
4015  i=m->rows();j=m->cols();
4016  if(i==j)
4017  res->data = (char *)(long)singclap_det_i(m,currRing);
4018  else
4019  {
4020  Werror("det of %d x %d intmat",i,j);
4021  return TRUE;
4022  }
4023  return FALSE;
4024 }
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1746

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 4025 of file iparith.cc.

4026 {
4027  ideal I=(ideal)v->Data();
4028  res->data=(char*)sm_Det(I,currRing);
4029  return FALSE;
4030 }

◆ jjDIFF_COEF()

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

Definition at line 4399 of file iparith.cc.

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

1892 {
1893  int i=pVar((poly)v->Data());
1894  if (i==0)
1895  {
1896  WerrorS("ringvar expected");
1897  return TRUE;
1898  }
1899  res->data=(char *)idDiff((matrix)(u->Data()),i);
1900  return FALSE;
1901 }
matrix idDiff(matrix i, int k)
Definition: ideals.cc:2122

◆ jjDIFF_ID_ID()

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

Definition at line 1902 of file iparith.cc.

1903 {
1904  res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data());
1905  return FALSE;
1906 }

◆ jjDIFF_P()

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

Definition at line 1880 of file iparith.cc.

1881 {
1882  int i=pVar((poly)v->Data());
1883  if (i==0)
1884  {
1885  WerrorS("ringvar expected");
1886  return TRUE;
1887  }
1888  res->data=(char *)pDiff((poly)(u->Data()),i);
1889  return FALSE;
1890 }
#define pDiff(a, b)
Definition: polys.h:296

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4031 of file iparith.cc.

4032 {
4033  assumeStdFlag(v);
4034 #ifdef HAVE_SHIFTBBA
4035  if (rIsLPRing(currRing))
4036  {
4037 #ifdef HAVE_RINGS
4038  if (rField_is_Ring(currRing))
4039  {
4040  WerrorS("`dim` is not implemented for letterplace rings over rings");
4041  return TRUE;
4042  }
4043 #endif
4044  if (currRing->qideal != NULL)
4045  {
4046  WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4047  return TRUE;
4048  }
4049  int gkDim = lp_gkDim((ideal)(v->Data()));
4050  res->data = (char *)(long)gkDim;
4051  return (gkDim == -2);
4052  }
4053 #endif
4055  {
4056  Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4057  }
4058  res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4059  return FALSE;
4060 }
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition: hdegree.cc:135
int lp_gkDim(const ideal _G)
Definition: hdegree.cc:1839
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:766

◆ jjDIM2()

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

Definition at line 1907 of file iparith.cc.

1908 {
1909  assumeStdFlag(v);
1911  {
1912  Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1913  }
1914  if(currRing->qideal==NULL)
1915  res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),(ideal)w->Data()));
1916  else
1917  {
1918  ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1919  res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),q));
1920  idDelete(&q);
1921  }
1922  return FALSE;
1923 }
#define idSimpleAdd(A, B)
Definition: ideals.h:42

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5623 of file iparith.cc.

5624 {
5625  res->data = (char *)(long)syDim((syStrategy)v->Data());
5626  return FALSE;
5627 }
int syDim(syStrategy syzstr)
Definition: syz1.cc:1849

◆ jjDIV_BI()

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

Definition at line 1249 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1284 of file iparith.cc.

1285 {
1286  poly q=(poly)v->Data();
1287  if (q==NULL)
1288  {
1290  return TRUE;
1291  }
1292  matrix m=(matrix)(u->Data());
1293  int r=m->rows();
1294  int c=m->cols();
1295  matrix mm=mpNew(r,c);
1296  unsigned i,j;
1297  for(i=r;i>0;i--)
1298  {
1299  for(j=c;j>0;j--)
1300  {
1301  if (pNext(q)!=NULL)
1302  {
1303  MATELEM(mm,i,j) = singclap_pdivide( MATELEM(m,i,j) ,
1304  q /*(poly)(v->Data())*/, currRing );
1305  }
1306  else
1307  MATELEM(mm,i,j) = pp_DivideM(MATELEM(m,i,j),q,currRing);
1308  }
1309  }
1310  res->data=(char *)mm;
1311  return FALSE;
1312 }
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:590
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
poly pp_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1620

◆ jjDIV_N()

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

Definition at line 1262 of file iparith.cc.

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

1276 {
1277  poly q=(poly)v->Data();
1278  poly p=(poly)(u->Data());
1279  res->data=(void*)(pp_Divide(p /*(poly)(u->Data())*/ ,
1280  q /*(poly)(v->Data())*/ ,currRing));
1281  if (res->data!=NULL) pNormalize((poly)res->data);
1282  return errorreported; /*there may be errors in p_Divide: div. ny 0, etc.*/
1283 }
poly pp_Divide(poly p, poly q, const ring r)
polynomial division a/b, ignoring the rest via singclap_pdivide resp. idLift does not destroy a,...
Definition: polys.cc:174
#define pNormalize(p)
Definition: polys.h:317

◆ jjDIVISION()

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

Definition at line 1924 of file iparith.cc.

1925 {
1926  ideal vi=(ideal)v->Data();
1927  int vl= IDELEMS(vi);
1928  ideal ui=(ideal)u->Data();
1929  unsigned ul= IDELEMS(ui);
1930  ideal R; matrix U;
1931  ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1932  if (m==NULL) return TRUE;
1933  // now make sure that all matrices have the correct size:
1935  int i;
1936  assume (MATCOLS(U) == (int)ul);
1938  L->Init(3);
1939  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1940  L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1941  L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1942  res->data=(char *)L;
1943  return FALSE;
1944 }
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
Definition: ideals.cc:1099
#define hasFlag(A, F)
Definition: ipid.h:112
#define FLAG_STD
Definition: ipid.h:106
STATIC_VAR jList * T
Definition: janet.cc:30
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition: sirandom.c:27

◆ jjDIVISION4()

static BOOLEAN jjDIVISION4 ( leftv  res,
leftv  v 
)
static

Definition at line 7127 of file iparith.cc.

7128 { // may have 3 or 4 arguments
7129  leftv v1=v;
7130  leftv v2=v1->next;
7131  leftv v3=v2->next;
7132  leftv v4=v3->next;
7133  assumeStdFlag(v2);
7134 
7135  int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7136  int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7137 
7138  if((i1==0)||(i2==0)
7139  ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7140  {
7141  WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7142  return TRUE;
7143  }
7144 
7145  sleftv w1,w2;
7146  iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7147  iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7148  ideal P=(ideal)w1.Data();
7149  ideal Q=(ideal)w2.Data();
7150 
7151  int n=(int)(long)v3->Data();
7152  int *w=NULL;
7153  if(v4!=NULL)
7154  {
7155  w = iv2array((intvec *)v4->Data(),currRing);
7156  int * w0 = w + 1;
7157  int i = currRing->N;
7158  while( (i > 0) && ((*w0) > 0) )
7159  {
7160  w0++;
7161  i--;
7162  }
7163  if(i>0)
7164  WarnS("not all weights are positive!");
7165  }
7166 
7167  matrix T;
7168  ideal R;
7169  idLiftW(P,Q,n,T,R,w);
7170 
7171  w1.CleanUp();
7172  w2.CleanUp();
7173  if(w!=NULL)
7174  omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7175 
7177  L->Init(2);
7178  L->m[1].rtyp=v1->Typ();
7179  if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7180  {
7181  if(v1->Typ()==POLY_CMD)
7182  p_Shift(&R->m[0],-1,currRing);
7183  L->m[1].data=(void *)R->m[0];
7184  R->m[0]=NULL;
7185  idDelete(&R);
7186  }
7187  else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7188  L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7189  else
7190  {
7191  L->m[1].rtyp=MODUL_CMD;
7192  L->m[1].data=(void *)R;
7193  }
7194  L->m[0].rtyp=MATRIX_CMD;
7195  L->m[0].data=(char *)T;
7196 
7197  res->data=L;
7198 
7199  return FALSE;
7200 }
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition: ideals.cc:1318
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 1226 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 337 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3655 of file iparith.cc.

3656 {
3657 // res->data = (char *)u->CopyD();
3658 // also copy attributes:
3659  res->Copy(u);
3660  return FALSE;
3661 }

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4061 of file iparith.cc.

4062 {
4063  si_link l = (si_link)v->Data();
4064  if (slDump(l))
4065  {
4066  const char *s;
4067  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4068  else s=sNoName_fe;
4069  Werror("cannot dump to `%s`",s);
4070  return TRUE;
4071  }
4072  else
4073  return FALSE;
4074 }

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4075 of file iparith.cc.

4076 {
4077  res->data = (char *)pOne();
4078  int co=(int)(long)v->Data();
4079  if (co>0)
4080  {
4081  pSetComp((poly)res->data,co);
4082  pSetm((poly)res->data);
4083  }
4084  else WerrorS("argument of gen must be positive");
4085  return (co<=0);
4086 }
#define pSetComp(p, v)
Definition: polys.h:38
#define pOne()
Definition: polys.h:315

◆ jjELIMIN()

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

Definition at line 1945 of file iparith.cc.

1946 {
1947  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1948  //setFlag(res,FLAG_STD);
1949  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
1950 }
ideal idElimination(ideal h1, poly delVar, intvec *hilb, GbVariant alg)
Definition: ideals.cc:1587

◆ jjELIMIN_ALG()

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

Definition at line 6019 of file iparith.cc.

6020 {
6021  ideal I=(ideal)u->Data();
6022  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6023  res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6024  //setFlag(res,FLAG_STD);
6025  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6026 }
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3138
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6027 of file iparith.cc.

6028 {
6029  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6030  (intvec *)w->Data());
6031  //setFlag(res,FLAG_STD);
6032  return FALSE;
6033 }

◆ jjELIMIN_IV()

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

Definition at line 1951 of file iparith.cc.

1952 {
1953  poly p=pOne();
1954  intvec *iv=(intvec*)v->Data();
1955  for(int i=iv->length()-1; i>=0; i--)
1956  {
1957  pSetExp(p,(*iv)[i],1);
1958  }
1959  pSetm(p);
1960  res->data=(char *)idElimination((ideal)u->Data(),p);
1961  pLmDelete(&p);
1962  //setFlag(res,FLAG_STD);
1963  return FALSE;
1964 }
#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 5192 of file iparith.cc.

5193 {
5194 #ifdef HAVE_PLURAL
5195  ring r = (ring)a->Data();
5196  if (rIsPluralRing(r))
5197  {
5198  ring s = rEnvelope(r);
5199  res->data = s;
5200  }
5201  else res->data = rCopy(r);
5202  return FALSE;
5203 #else
5204  return TRUE;
5205 #endif
5206 }
ring rEnvelope(ring R)
Definition: ring.cc:5643
ring rCopy(ring r)
Definition: ring.cc:1648

◆ jjEQUAL_BI()

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

Definition at line 1313 of file iparith.cc.

1314 {
1315  res->data = (char *)((long)n_Equal((number)u->Data(),(number)v->Data(),coeffs_BIGINT));
1316  jjEQUAL_REST(res,u,v);
1317  return FALSE;
1318 }
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:461

◆ jjEQUAL_I()

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

Definition at line 1319 of file iparith.cc.

1320 {
1321  res->data = (char *)((int)((long)u->Data()) == (int)((long)v->Data()));
1322  jjEQUAL_REST(res,u,v);
1323  return FALSE;
1324 }

◆ jjEQUAL_Ma()

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

Definition at line 1325 of file iparith.cc.

1326 {
1327  res->data = (char *)((long)mp_Equal((matrix)u->Data(),(matrix)v->Data(),currRing));
1328  jjEQUAL_REST(res,u,v);
1329  return FALSE;
1330 }
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 1343 of file iparith.cc.

1344 {
1345  res->data = (char *)((long)nEqual((number)u->Data(),(number)v->Data()));
1346  jjEQUAL_REST(res,u,v);
1347  return FALSE;
1348 }
#define nEqual(n1, n2)
Definition: numbers.h:20

◆ jjEQUAL_P()

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

Definition at line 1349 of file iparith.cc.

1350 {
1351  poly p=(poly)u->Data();
1352  poly q=(poly)v->Data();
1353  res->data = (char *) ((long)pEqualPolys(p,q));
1354  jjEQUAL_REST(res,u,v);
1355  return FALSE;
1356 }
#define pEqualPolys(p1, p2)
Definition: polys.h:400

◆ jjEQUAL_R()

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

Definition at line 1337 of file iparith.cc.

1338 {
1339  res->data = (char *)(long)(u->Data()==v->Data());
1340  jjEQUAL_REST(res,u,v);
1341  return FALSE;
1342 }

◆ jjEQUAL_REST()

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

Definition at line 1357 of file iparith.cc.

1358 {
1359  if ((res->data) && (u->next!=NULL) && (v->next!=NULL))
1360  {
1361  int save_iiOp=iiOp;
1362  if (iiOp==NOTEQUAL)
1364  else
1365  iiExprArith2(res,u->next,iiOp,v->next);
1366  iiOp=save_iiOp;
1367  }
1368  if (iiOp==NOTEQUAL) res->data=(char *)(!(long)res->data);
1369 }

◆ jjEQUAL_SM()

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

Definition at line 1331 of file iparith.cc.

1332 {
1333  res->data = (char *)((long)sm_Equal((ideal)u->Data(),(ideal)v->Data(),currRing));
1334  jjEQUAL_REST(res,u,v);
1335  return FALSE;
1336 }
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 1970 of file iparith.cc.

1971 {
1972  WerrorS((char *)u->Data());
1973  EXTERN_VAR int inerror;
1974  inerror=3;
1975  return TRUE;
1976 }
#define EXTERN_VAR
Definition: globaldefs.h:6
EXTERN_VAR int inerror

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4087 of file iparith.cc.

4088 {
4089  char * d = (char *)v->Data();
4090  char * s = (char *)omAlloc(strlen(d) + 13);
4091  strcpy( s, (char *)d);
4092  strcat( s, "\n;RETURN();\n");
4094  return yyparse();
4095 }
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:164
@ BT_execute
Definition: fevoices.h:23
int yyparse(void)
Definition: grammar.cc:2111

◆ jjEXPORTTO()

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

Definition at line 1965 of file iparith.cc.

1966 {
1967  //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1968  return iiExport(v,0,IDPACKAGE((idhdl)u->data));
1969 }
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1439

◆ jjEXTGCD_BI()

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

Definition at line 1977 of file iparith.cc.

1978 {
1979  number uu=(number)u->Data();number vv=(number)v->Data();
1981  number a,b;
1982  number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
1983  L->Init(3);
1984  L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
1985  L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
1986  L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
1987  res->rtyp=LIST_CMD;
1988  res->data=(char *)L;
1989  return FALSE;
1990 }
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:694

◆ jjEXTGCD_I()

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

Definition at line 1991 of file iparith.cc.

1992 {
1993  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
1994  int p0=ABS(uu),p1=ABS(vv);
1995  int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
1996 
1997  while ( p1!=0 )
1998  {
1999  q=p0 / p1;
2000  r=p0 % p1;
2001  p0 = p1; p1 = r;
2002  r = g0 - g1 * q;
2003  g0 = g1; g1 = r;
2004  r = f0 - f1 * q;
2005  f0 = f1; f1 = r;
2006  }
2007  int a = f0;
2008  int b = g0;
2009  if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
2010  if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
2012  L->Init(3);
2013  L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
2014  L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
2015  L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
2016  res->data=(char *)L;
2017  return FALSE;
2018 }
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 2019 of file iparith.cc.

2020 {
2021  poly r,pa,pb;
2022  BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2023  if (ret) return TRUE;
2025  L->Init(3);
2026  res->data=(char *)L;
2027  L->m[0].data=(void *)r;
2028  L->m[0].rtyp=POLY_CMD;
2029  L->m[1].data=(void *)pa;
2030  L->m[1].rtyp=POLY_CMD;
2031  L->m[2].data=(void *)pb;
2032  L->m[2].rtyp=POLY_CMD;
2033  return FALSE;
2034 }
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition: clapsing.cc:455
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4371

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4136 of file iparith.cc.

4137 {
4138  intvec *v=NULL;
4140  ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4141  if (f==NULL) return TRUE;
4142  ivTest(v);
4144  l->Init(2);
4145  l->m[0].rtyp=IDEAL_CMD;
4146  l->m[0].data=(void *)f;
4147  l->m[1].rtyp=INTVEC_CMD;
4148  l->m[1].data=(void *)v;
4149  res->data=(void *)l;
4150  return FALSE;
4151 }
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:914
#define ivTest(v)
Definition: intvec.h:158
EXTERN_VAR int singclap_factorize_retry
Definition: iparith.cc:2035

◆ jjFAC_P2()

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

Definition at line 2036 of file iparith.cc.

2037 {
2038  intvec *v=NULL;
2039  int sw=(int)(long)dummy->Data();
2040  int fac_sw=sw;
2041  if ((sw<0)||(sw>2)) fac_sw=1;
2043  ideal f=singclap_factorize((poly)(u->CopyD()), &v, fac_sw,currRing);
2044  if (f==NULL)
2045  return TRUE;
2046  switch(sw)
2047  {
2048  case 0:
2049  case 2:
2050  {
2052  l->Init(2);
2053  l->m[0].rtyp=IDEAL_CMD;
2054  l->m[0].data=(void *)f;
2055  l->m[1].rtyp=INTVEC_CMD;
2056  l->m[1].data=(void *)v;
2057  res->data=(void *)l;
2058  res->rtyp=LIST_CMD;
2059  return FALSE;
2060  }
2061  case 1:
2062  res->data=(void *)f;
2063  return FALSE;
2064  case 3:
2065  {
2066  poly p=f->m[0];
2067  int i=IDELEMS(f);
2068  f->m[0]=NULL;
2069  while(i>1)
2070  {
2071  i--;
2072  p=pMult(p,f->m[i]);
2073  f->m[i]=NULL;
2074  }
2075  res->data=(void *)p;
2076  res->rtyp=POLY_CMD;
2077  }
2078  return FALSE;
2079  }
2080  WerrorS("invalid switch");
2081  return TRUE;
2082 }
#define pMult(p, q)
Definition: polys.h:207

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4096 of file iparith.cc.

4097 {
4099  if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4100  {
4101  ideal_list p,h;
4102  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4103  if (h==NULL)
4104  {
4105  L->Init(1);
4106  L->m[0].data=(char *)idInit(1);
4107  L->m[0].rtyp=IDEAL_CMD;
4108  }
4109  else
4110  {
4111  p=h;
4112  int l=0;
4113  while (p!=NULL) { p=p->next;l++; }
4114  L->Init(l);
4115  l=0;
4116  while(h!=NULL)
4117  {
4118  L->m[l].data=(char *)h->d;
4119  L->m[l].rtyp=IDEAL_CMD;
4120  p=h->next;
4121  omFreeSize(h,sizeof(*h));
4122  h=p;
4123  l++;
4124  }
4125  }
4126  }
4127  else
4128  {
4129  WarnS("no factorization implemented");
4130  L->Init(1);
4131  iiExprArith1(&(L->m[0]),v,STD_CMD);
4132  }
4133  res->data=(void *)L;
4134  return FALSE;
4135 }
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:275
@ testHomog
Definition: structs.h:43
@ STD_CMD
Definition: tok.h:184

◆ jjFACSTD2()

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

Definition at line 2083 of file iparith.cc.

2084 {
2085  ideal_list p,h;
2086  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2087  p=h;
2088  int l=0;
2089  while (p!=NULL) { p=p->next;l++; }
2091  L->Init(l);
2092  l=0;
2093  while(h!=NULL)
2094  {
2095  L->m[l].data=(char *)h->d;
2096  L->m[l].rtyp=IDEAL_CMD;
2097  p=h->next;
2098  omFreeSize(h,sizeof(*h));
2099  h=p;
2100  l++;
2101  }
2102  res->data=(void *)L;
2103  return FALSE;
2104 }

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8328 of file iparith.cc.

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

◆ jjFAREY_BI()

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

Definition at line 2105 of file iparith.cc.

2106 {
2107  if (rField_is_Q(currRing))
2108  {
2109  number uu=(number)u->Data();
2110  number vv=(number)v->Data();
2111  res->data=(char *)n_Farey(uu,vv,currRing->cf);
2112  return FALSE;
2113  }
2114  else return TRUE;
2115 }
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:791

◆ jjFAREY_ID()

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

Definition at line 2116 of file iparith.cc.

2117 {
2118  ideal uu=(ideal)u->Data();
2119  number vv=(number)v->Data();
2120  //timespec buf1,buf2;
2121  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2122  #if 1
2123  #ifdef HAVE_VSPACE
2124  int cpus = (long) feOptValue(FE_OPT_CPUS);
2125  if ((cpus>1) && (rField_is_Q(currRing)))
2126  res->data=(void*)id_Farey_0(uu,vv,currRing);
2127  else
2128  #endif
2129  #endif
2130  res->data=(void*)id_Farey(uu,vv,currRing);
2131  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2132  //const unsigned long SEC = 1000L*1000L*1000L;
2133  //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2134  // buf2.tv_nsec-buf1.tv_nsec);
2135  //farey_cnt++;
2136  return FALSE;
2137 }
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2832
ideal id_Farey_0(ideal x, number N, const ring r)
Definition: kChinese.cc:294

◆ jjFAREY_LI()

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

Definition at line 10096 of file iparith.cc.

10097 {
10098  lists c=(lists)u->CopyD();
10099  lists res_l=(lists)omAllocBin(slists_bin);
10100  res_l->Init(c->nr+1);
10101  BOOLEAN bo=FALSE;
10102  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10103  for (unsigned i=0;i<=(unsigned)c->nr;i++)
10104  {
10105  sleftv tmp;
10106  tmp.Copy(v);
10107  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10108  if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10109  }
10110  c->Clean();
10111  res->data=res_l;
10112  return bo;
10113 }
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2139 of file iparith.cc.

2140 {
2141  ring r=(ring)u->Data();
2142  idhdl w;
2143  int op=iiOp;
2144  nMapFunc nMap;
2145 
2146  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
2147  {
2148  int *perm=NULL;
2149  int *par_perm=NULL;
2150  int par_perm_size=0;
2151  BOOLEAN bo;
2152  nMap=n_SetMap(r->cf,currRing->cf);
2153  if (nMap==NULL)
2154  {
2155  // Allow imap/fetch to be make an exception only for:
2156  if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2157  ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
2158  || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
2159  {
2160  par_perm_size=rPar(r);
2161  }
2162  else
2163  {
2164  goto err_fetch;
2165  }
2166  }
2167  if ((iiOp!=FETCH_CMD) || (r->N!=currRing->N) || (rPar(r)!=rPar(currRing)))
2168  {
2169  perm=(int *)omAlloc0((r->N+1)*sizeof(int));
2170  if (par_perm_size!=0)
2171  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2172  op=IMAP_CMD;
2173  if (iiOp==IMAP_CMD)
2174  {
2175  int r_par=0;
2176  char ** r_par_names=NULL;
2177  if (r->cf->extRing!=NULL)
2178  {
2179  r_par=r->cf->extRing->N;
2180  r_par_names=r->cf->extRing->names;
2181  }
2182  int c_par=0;
2183  char ** c_par_names=NULL;
2184  if (currRing->cf->extRing!=NULL)
2185  {
2186  c_par=currRing->cf->extRing->N;
2187  c_par_names=currRing->cf->extRing->names;
2188  }
2189  if (!rIsLPRing(r))
2190  {
2191  maFindPerm(r->names, r->N, r_par_names, r_par,
2192  currRing->names,currRing->N,c_par_names, c_par,
2193  perm,par_perm, currRing->cf->type);
2194  }
2195  #ifdef HAVE_SHIFTBBA
2196  else
2197  {
2198  maFindPermLP(r->names, r->N, r_par_names, r_par,
2199  currRing->names,currRing->N,c_par_names, c_par,
2200  perm,par_perm, currRing->cf->type,r->isLPring);
2201  }
2202  #endif
2203  }
2204  else
2205  {
2206  unsigned i;
2207  if (par_perm_size!=0)
2208  for(i=si_min(rPar(r),rPar(currRing));i>0;i--) par_perm[i-1]=-i;
2209  for(i=si_min(r->N,currRing->N);i>0;i--) perm[i]=i;
2210  }
2211  }
2212  if ((iiOp==FETCH_CMD) && (BVERBOSE(V_IMAP)))
2213  {
2214  unsigned i;
2215  for(i=0;i<(unsigned)si_min(r->N,currRing->N);i++)
2216  {
2217  Print("// var nr %d: %s -> %s\n",i,r->names[i],currRing->names[i]);
2218  }
2219  for(i=0;i<(unsigned)si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
2220  {
2221  Print("// par nr %d: %s -> %s\n",
2222  i,rParameter(r)[i],rParameter(currRing)[i]);
2223  }
2224  }
2225  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
2226  sleftv tmpW;
2227  tmpW.Init();
2228  tmpW.rtyp=IDTYP(w);
2229  tmpW.data=IDDATA(w);
2230  if ((bo=maApplyFetch(op,NULL,res,&tmpW, r,
2231  perm,par_perm,par_perm_size,nMap)))
2232  {
2233  Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
2234  }
2235  if (perm!=NULL)
2236  omFreeSize((ADDRESS)perm,(r->N+1)*sizeof(int));
2237  if (par_perm!=NULL)
2238  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
2239  return bo;
2240  }
2241  else
2242  {
2243  Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
2244  }
2245  return TRUE;
2246 err_fetch:
2247  char *s1=nCoeffString(r->cf);
2248  char *s2=nCoeffString(currRing->cf);
2249  Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
2250  omFree(s2); omFree(s1);
2251  return TRUE;
2252 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: coeffs.h:983
@ IMAP_CMD
Definition: grammar.cc:298
@ FETCH_CMD
Definition: grammar.cc:295
#define IDDATA(a)
Definition: ipid.h:126
#define IDTYP(a)
Definition: ipid.h:119
void 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:630
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:604
@ ALIAS_CMD
Definition: tok.h:34

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7270 of file iparith.cc.

7271 {
7272  ring r=(ring)u->Data();
7273  leftv v=u->next;
7274  leftv perm_var_l=v->next;
7275  leftv perm_par_l=v->next->next;
7276  if ((perm_var_l->Typ()!=INTVEC_CMD)
7277  ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7278  ||(u->Typ()!=RING_CMD))
7279  {
7280  WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7281  return TRUE;
7282  }
7283  intvec *perm_var_v=(intvec*)perm_var_l->Data();
7284  intvec *perm_par_v=NULL;
7285  if (perm_par_l!=NULL)
7286  perm_par_v=(intvec*)perm_par_l->Data();
7287  idhdl w;
7288  nMapFunc nMap;
7289 
7290  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7291  {
7292  int *perm=NULL;
7293  int *par_perm=NULL;
7294  int par_perm_size=0;
7295  BOOLEAN bo;
7296  if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7297  {
7298  // Allow imap/fetch to be make an exception only for:
7299  if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7300  ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7301  || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7302  {
7303  par_perm_size=rPar(r);
7304  }
7305  else
7306  {
7307  goto err_fetch;
7308  }
7309  }
7310  else
7311  par_perm_size=rPar(r);
7312  perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7313  if (par_perm_size!=0)
7314  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7315  int i;
7316  if (perm_par_l==NULL)
7317  {
7318  if (par_perm_size!=0)
7319  for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7320  }
7321  else
7322  {
7323  if (par_perm_size==0) WarnS("source ring has no parameters");
7324  else
7325  {
7326  for(i=rPar(r)-1;i>=0;i--)
7327  {
7328  if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7329  if ((par_perm[i]<-rPar(currRing))
7330  || (par_perm[i]>rVar(currRing)))
7331  {
7332  Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7333  par_perm[i]=0;
7334  }
7335  }
7336  }
7337  }
7338  for(i=rVar(r)-1;i>=0;i--)
7339  {
7340  if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7341  if ((perm[i]<-rPar(currRing))
7342  || (perm[i]>rVar(currRing)))
7343  {
7344  Warn("invalid entry for var %d: %d\n",i,perm[i]);
7345  perm[i]=0;
7346  }
7347  }
7348  if (BVERBOSE(V_IMAP))
7349  {
7350  for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7351  {
7352  if (perm[i]>0)
7353  Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7354  else if (perm[i]<0)
7355  Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7356  }
7357  for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7358  {
7359  if (par_perm[i-1]<0)
7360  Print("// par nr %d: %s -> par %s\n",
7361  i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7362  else if (par_perm[i-1]>0)
7363  Print("// par nr %d: %s -> var %s\n",
7364  i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7365  }
7366  }
7367  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7368  sleftv tmpW;
7369  tmpW.Init();
7370  tmpW.rtyp=IDTYP(w);
7371  tmpW.data=IDDATA(w);
7372  if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7373  perm,par_perm,par_perm_size,nMap)))
7374  {
7375  Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7376  }
7377  if (perm!=NULL)
7378  omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7379  if (par_perm!=NULL)
7380  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7381  return bo;
7382  }
7383  else
7384  {
7385  Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7386  }
7387  return TRUE;
7388 err_fetch:
7389  char *s1=nCoeffString(r->cf);
7390  char *s2=nCoeffString(currRing->cf);
7391  Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7392  omFree(s2);omFree(s1);
7393  return TRUE;
7394 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257

◆ jjFIND2()

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

Definition at line 2253 of file iparith.cc.

2254 {
2255  /*4
2256  * look for the substring what in the string where
2257  * return the position of the first char of what in where
2258  * or 0
2259  */
2260  char *where=(char *)u->Data();
2261  char *what=(char *)v->Data();
2262  char *found = strstr(where,what);
2263  if (found != NULL)
2264  {
2265  res->data=(char *)((found-where)+1);
2266  }
2267  /*else res->data=NULL;*/
2268  return FALSE;
2269 }
bool found
Definition: facFactorize.cc:55

◆ jjFIND3()

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

Definition at line 6034 of file iparith.cc.

6035 {
6036  /*4
6037  * look for the substring what in the string where
6038  * starting at position n
6039  * return the position of the first char of what in where
6040  * or 0
6041  */
6042  int n=(int)(long)w->Data();
6043  char *where=(char *)u->Data();
6044  char *what=(char *)v->Data();
6045  char *found;
6046  if ((1>n)||(n>(int)strlen(where)))
6047  {
6048  Werror("start position %d out of range",n);
6049  return TRUE;
6050  }
6051  found = strchr(where+n-1,*what);
6052  if (*(what+1)!='\0')
6053  {
6054  while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6055  {
6056  found=strchr(found+1,*what);
6057  }
6058  }
6059  if (found != NULL)
6060  {
6061  res->data=(char *)((found-where)+1);
6062  }
6063  return FALSE;
6064 }

◆ jjFRES()

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

Definition at line 2308 of file iparith.cc.

2309 {
2310  leftv w = (leftv)omAlloc0(sizeof(sleftv));
2311  w->rtyp = STRING_CMD;
2312  w->data = (char *)"complete"; // default
2313  BOOLEAN RES = jjFRES3(res, u, v, w);
2314  omFree(w);
2315  return RES;
2316 }
static BOOLEAN jjFRES3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:2271

◆ jjFRES3()

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

Definition at line 2271 of file iparith.cc.

2272 {
2273  assumeStdFlag(u);
2274  ideal id = (ideal)u->Data();
2275  int max_length = (int)(long)v->Data();
2276  if (max_length < 0)
2277  {
2278  WerrorS("length for fres must not be negative");
2279  return TRUE;
2280  }
2281  if (max_length == 0)
2282  {
2283  max_length = currRing->N+1;
2284  if (currRing->qideal != NULL)
2285  {
2286  Warn("full resolution in a qring may be infinite, "
2287  "setting max length to %d", max_length);
2288  }
2289  }
2290  char *method = (char *)w->Data();
2291  /* For the moment, only "complete" (default), "frame", or "extended frame"
2292  * are allowed. Another useful option would be "linear strand".
2293  */
2294  if (strcmp(method, "complete") != 0
2295  && strcmp(method, "frame") != 0
2296  && strcmp(method, "extended frame") != 0
2297  && strcmp(method, "single module") != 0)
2298  {
2299  WerrorS("wrong optional argument for fres");
2300  return TRUE;
2301  }
2302  syStrategy r = syFrank(id, max_length, method);
2303  assume(r->fullres != NULL);
2304  res->data = (void *)r;
2305  return FALSE;
2306 }
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 2318 of file iparith.cc.

2319 {
2320  res->data=(char *)fractalWalkProc(u,v);
2321  setFlag( res, FLAG_STD );
2322  return FALSE;
2323 }
#define setFlag(A, F)
Definition: ipid.h:113
ideal fractalWalkProc(leftv first, leftv second)
Definition: walk_ip.cc:161

◆ jjFWALK3()

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

Definition at line 6065 of file iparith.cc.

6066 {
6067  if ((int)(long)w->Data()==0)
6068  res->data=(char *)walkProc(u,v);
6069  else
6070  res->data=(char *)fractalWalkProc(u,v);
6071  setFlag( res, FLAG_STD );
6072  return FALSE;
6073 }
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 2337 of file iparith.cc.

2338 {
2339  number n1 = (number) u->Data();
2340  number n2 = (number) v->Data();
2341  res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2342  return FALSE;
2343 }
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:687

◆ jjGCD_I()

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

Definition at line 2324 of file iparith.cc.

2325 {
2326  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2327  int p0=ABS(uu),p1=ABS(vv);
2328  int r;
2329  while ( p1!=0 )
2330  {
2331  r=p0 % p1;
2332  p0 = p1; p1 = r;
2333  }
2334  res->data=(char *)(long)p0;
2335  return FALSE;
2336 }

◆ jjGCD_N()

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

Definition at line 2344 of file iparith.cc.

2345 {
2346  number a=(number) u->Data();
2347  number b=(number) v->Data();
2348  if (nIsZero(a))
2349  {
2350  if (nIsZero(b)) res->data=(char *)nInit(1);
2351  else res->data=(char *)nCopy(b);
2352  }
2353  else
2354  {
2355  if (nIsZero(b)) res->data=(char *)nCopy(a);
2356  //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2357  else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2358  }
2359  return FALSE;
2360 }
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:689
#define nCopy(n)
Definition: numbers.h:15
#define nInit(i)
Definition: numbers.h:24

◆ jjGCD_P()

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

Definition at line 2361 of file iparith.cc.

2362 {
2363  res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2364  (poly)(v->CopyD(POLY_CMD)),currRing);
2365  return FALSE;
2366 }
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:382

◆ jjGE_BI()

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

Definition at line 1165 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1172 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1177 of file iparith.cc.

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

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4152 of file iparith.cc.

4153 {
4154  si_link l = (si_link)v->Data();
4155  if (slGetDump(l))
4156  {
4157  const char *s;
4158  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4159  else s=sNoName_fe;
4160  Werror("cannot get dump from `%s`",s);
4161  return TRUE;
4162  }
4163  else
4164  return FALSE;
4165 }

◆ jjGT_BI()

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

Definition at line 1183 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1190 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1195 of file iparith.cc.

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

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4166 of file iparith.cc.

4167 {
4168  assumeStdFlag(v);
4169  ideal I=(ideal)v->Data();
4170  res->data=(void *)iiHighCorner(I,0);
4171  return FALSE;
4172 }
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1537

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4173 of file iparith.cc.

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

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

◆ jjHILBERT2()

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

Definition at line 2367 of file iparith.cc.

2368 {
2369 #ifdef HAVE_RINGS
2370  if (rField_is_Z(currRing))
2371  {
2372  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2373  PrintS("// performed for generic fibre, that is, over Q\n");
2374  }
2375 #endif
2376  assumeStdFlag(u);
2377  intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2378  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2379  if (errorreported) return TRUE;
2380 
2381  switch((int)(long)v->Data())
2382  {
2383  case 1:
2384  res->data=(void *)iv;
2385  return FALSE;
2386  case 2:
2387  res->data=(void *)hSecondSeries(iv);
2388  delete iv;
2389  return FALSE;
2390  }
2391  delete iv;
2393  return TRUE;
2394 }
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 6074 of file iparith.cc.

6075 {
6076  intvec *wdegree=(intvec*)w->Data();
6077  if (wdegree->length()!=currRing->N)
6078  {
6079  Werror("weight vector must have size %d, not %d",
6080  currRing->N,wdegree->length());
6081  return TRUE;
6082  }
6083 #ifdef HAVE_RINGS
6084  if (rField_is_Z(currRing))
6085  {
6086  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6087  PrintS("// performed for generic fibre, that is, over Q\n");
6088  }
6089 #endif
6090  assumeStdFlag(u);
6091  intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6092  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
6093  if (errorreported) return TRUE;
6094 
6095  switch((int)(long)v->Data())
6096  {
6097  case 1:
6098  res->data=(void *)iv;
6099  return FALSE;
6100  case 2:
6101  res->data=(void *)hSecondSeries(iv);
6102  delete iv;
6103  return FALSE;
6104  }
6105  delete iv;
6107  return TRUE;
6108 }

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4235 of file iparith.cc.

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

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4247 of file iparith.cc.

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

2435 {
2436  intvec *w=new intvec(rVar(currRing));
2437  intvec *vw=(intvec*)u->Data();
2438  ideal v_id=(ideal)v->Data();
2439  pFDegProc save_FDeg=currRing->pFDeg;
2440  pLDegProc save_LDeg=currRing->pLDeg;
2441  BOOLEAN save_pLexOrder=currRing->pLexOrder;
2442  currRing->pLexOrder=FALSE;
2443  kHomW=vw;
2444  kModW=w;
2446  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2447  currRing->pLexOrder=save_pLexOrder;
2448  kHomW=NULL;
2449  kModW=NULL;
2450  pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2451  if (w!=NULL) delete w;
2452  return FALSE;
2453 }
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2406
VAR intvec * kHomW
Definition: kstd1.cc:2394
VAR intvec * kModW
Definition: kstd1.cc:2394
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3719
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3707
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 2412 of file iparith.cc.

2413 {
2414  int i=pVar((poly)v->Data());
2415  if (i==0)
2416  {
2417  WerrorS("ringvar expected");
2418  return TRUE;
2419  }
2420  pFDegProc deg;
2421  if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2422  deg=p_Totaldegree;
2423  else
2424  deg=currRing->pFDeg;
2425  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2426  int d=deg(p,currRing);
2427  pLmDelete(p);
2428  if (d==1)
2429  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2430  else
2431  WerrorS("variable must have weight 1");
2432  return (d!=1);
2433 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1467
@ 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 6109 of file iparith.cc.

6110 {
6111  PrintS("TODO\n");
6112  int i=pVar((poly)v->Data());
6113  if (i==0)
6114  {
6115  WerrorS("ringvar expected");
6116  return TRUE;
6117  }
6118  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6119  int d=pWTotaldegree(p);
6120  pLmDelete(p);
6121  if (d==1)
6122  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6123  else
6124  WerrorS("variable must have weight 1");
6125  return (d!=1);
6126 }
#define pWTotaldegree(p)
Definition: polys.h:283

◆ jjHOMOG_P()

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

Definition at line 2395 of file iparith.cc.

2396 {
2397  int i=pVar((poly)v->Data());
2398  if (i==0)
2399  {
2400  WerrorS("ringvar expected");
2401  return TRUE;
2402  }
2403  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2404  int d=pWTotaldegree(p);
2405  pLmDelete(p);
2406  if (d==1)
2407  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2408  else
2409  WerrorS("variable must have weight 1");
2410  return (d!=1);
2411 }
poly p_Homogen(poly p, int varnum, const ring r)
Definition: p_polys.cc:3327

◆ jjHOMOG_P_W()

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

Definition at line 6127 of file iparith.cc.

6128 {
6129  PrintS("TODO\n");
6130  int i=pVar((poly)v->Data());
6131  if (i==0)
6132  {
6133  WerrorS("ringvar expected");
6134  return TRUE;
6135  }
6136  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6137  int d=pWTotaldegree(p);
6138  pLmDelete(p);
6139  if (d==1)
6140  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6141  else
6142  WerrorS("variable must have weight 1");
6143  return (d!=1);
6144 }

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4297 of file iparith.cc.

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

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4315 of file iparith.cc.

4316 {
4317  map m=(map)v->CopyD(MAP_CMD);
4318  omFree((ADDRESS)m->preimage);
4319  m->preimage=NULL;
4320  ideal I=(ideal)m;
4321  I->rank=1;
4322  res->data=(char *)I;
4323  return FALSE;
4324 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:504

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7226 of file iparith.cc.

7227 {
7228  int s=1;
7229  leftv h=v;
7230  if (h!=NULL) s=exprlist_length(h);
7231  ideal id=idInit(s,1);
7232  int rank=1;
7233  int i=0;
7234  poly p;
7235  int dest_type=POLY_CMD;
7236  if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7237  while (h!=NULL)
7238  {
7239  // use standard type conversions to poly/vector
7240  int ri;
7241  int ht=h->Typ();
7242  if (ht==dest_type)
7243  {
7244  p=(poly)h->CopyD();
7245  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7246  }
7247  else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7248  {
7249  sleftv tmp;
7250  leftv hnext=h->next;
7251  h->next=NULL;
7252  iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7253  h->next=hnext;
7254  p=(poly)tmp.data;
7255  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7256  }
7257  else
7258  {
7259  idDelete(&id);
7260  return TRUE;
7261  }
7262  id->m[i]=p;
7263  i++;
7264  h=h->next;
7265  }
7266  id->rank=rank;
7267  res->data=(char *)id;
7268  return FALSE;
7269 }
int exprlist_length(leftv v)
Definition: ipshell.cc:550

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4325 of file iparith.cc.

4326 {
4327  if (currRing!=NULL)
4328  {
4329  ring q=(ring)v->Data();
4330  if (rSamePolyRep(currRing, q))
4331  {
4332  if (q->qideal==NULL)
4333  res->data=(char *)idInit(1,1);
4334  else
4335  res->data=(char *)idCopy(q->qideal);
4336  return FALSE;
4337  }
4338  }
4339  WerrorS("can only get ideal from identical qring");
4340  return TRUE;
4341 }
ideal idCopy(ideal A)
Definition: ideals.h:60
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1716

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5545 of file iparith.cc.

5546 {
5547  res->data = (char *)(long)idElem((ideal)v->Data());
5548  return FALSE;
5549 }
int idElem(const ideal F)
count non-zero elements

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5550 of file iparith.cc.

5551 {
5552  res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5553  return FALSE;
5554 }
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 5570 of file iparith.cc.

5571 {
5572  res->data = (char *)id_Head((ideal)v->Data(),currRing);
5573  setFlag(res,FLAG_STD);
5574  return FALSE;
5575 }
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms

◆ jjidMaxIdeal()

static BOOLEAN jjidMaxIdeal ( leftv  res,
leftv  v 
)
static

Definition at line 4280 of file iparith.cc.

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

5577 {
5578  res->data = (char *)idMinBase((ideal)v->Data());
5579  return FALSE;
5580 }
ideal idMinBase(ideal h1)
Definition: ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5628 of file iparith.cc.

5629 {
5630  res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5631  return FALSE;
5632 }
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5555 of file iparith.cc.

5556 {
5557  res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5558  return FALSE;
5559 }
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4342 of file iparith.cc.

4343 {
4344  intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4345  iv->makeVector();
4346  res->data = iv;
4347  return FALSE;
4348 }
void makeVector()
Definition: intvec.h:102
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4349 of file iparith.cc.

4350 {
4351  res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4352  return FALSE;
4353 }
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:817

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4354 of file iparith.cc.

4355 {
4356  assumeStdFlag(v);
4357  res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4358  return FALSE;
4359 }
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:285

◆ jjINDEPSET2()

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

Definition at line 2454 of file iparith.cc.

2455 {
2456  assumeStdFlag(u);
2457  res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2458  currRing->qideal);
2459  return FALSE;
2460 }
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1028

◆ jjINDEX_I()

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

Definition at line 1380 of file iparith.cc.

1381 {
1382  res->rtyp=u->rtyp; u->rtyp=0;
1383  res->data=u->data; u->data=NULL;
1384  res->name=u->name; u->name=NULL;
1385  res->e=u->e; u->e=NULL;
1386  if (res->e==NULL) res->e=jjMakeSub(v);
1387  else
1388  {
1389  Subexpr sh=res->e;
1390  while (sh->next != NULL) sh=sh->next;
1391  sh->next=jjMakeSub(v);
1392  }
1393  if (u->next!=NULL)
1394  {
1396  BOOLEAN bo=iiExprArith2(rn,u->next,iiOp,v);
1397  res->next=rn;
1398  return bo;
1399  }
1400  return FALSE;
1401 }

◆ jjINDEX_IV()

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

Definition at line 1402 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1438 of file iparith.cc.

1439 {
1440  poly p=(poly)u->Data();
1441  int i=(int)(long)v->Data();
1442  int j=0;
1443  while (p!=NULL)
1444  {
1445  j++;
1446  if (j==i)
1447  {
1448  res->data=(char *)pHead(p);
1449  return FALSE;
1450  }
1451  pIter(p);
1452  }
1453  return FALSE;
1454 }
#define pIter(p)
Definition: monomials.h:37
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67

◆ jjINDEX_P_IV()

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

Definition at line 1478 of file iparith.cc.

1479 {
1480  poly p=(poly)u->Data();
1481  poly r=NULL;
1482  intvec *iv=(intvec *)v->CopyD(INTVEC_CMD);
1483  int i;
1484  int sum=0;
1485  for(i=iv->length()-1;i>=0;i--)
1486  sum+=(*iv)[i];
1487  int j=0;
1488  while ((p!=NULL) && (sum>0))
1489  {
1490  j++;
1491  for(i=iv->length()-1;i>=0;i--)
1492  {
1493  if (j==(*iv)[i])
1494  {
1495  r=pAdd(r,pHead(p));
1496  sum-=j;
1497  (*iv)[i]=0;
1498  break;
1499  }
1500  }
1501  pIter(p);
1502  }
1503  delete iv;
1504  res->data=(char *)r;
1505  return FALSE;
1506 }

◆ jjINDEX_PBu()

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

Definition at line 1455 of file iparith.cc.

1456 {
1457  sBucket_pt b=(sBucket_pt)u->CopyD();
1459  int l; poly p,pp;
1460  sBucketDestroyAdd(b, &pp, &l);
1461  int i=(int)(long)v->Data();
1462  int j=0;
1463  p=pp;
1464  while (p!=NULL)
1465  {
1466  j++;
1467  if (j==i)
1468  {
1469  res->data=(char *)pHead(p);
1470  p_Delete(&pp,currRing);
1471  return FALSE;
1472  }
1473  pIter(p);
1474  }
1475  p_Delete(&pp,currRing);
1476  return FALSE;
1477 }
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:676
void sBucketCanonicalize(sBucket_pt bucket)
Definition: sbuckets.cc:401
sBucket * sBucket_pt
Definition: sbuckets.h:16
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68

◆ jjINDEX_V()

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

Definition at line 1507 of file iparith.cc.

1508 {
1509  poly p=(poly)u->Data();
1510  int i=(int)(long)v->Data();
1511  res->data=(char *)p_Vec2Poly(p,i,currRing);
1512  return FALSE;
1513 }
poly p_Vec2Poly(poly v, int k, const ring r)
Definition: p_polys.cc:3641

◆ jjINDEX_V_IV()

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

Definition at line 1514 of file iparith.cc.

1515 {
1516  poly p=(poly)u->CopyD(VECTOR_CMD);
1517  if (p!=NULL)
1518  {
1519  poly r=pOne();
1520  poly hp=r;
1521  intvec *iv=(intvec *)v->Data();
1522  int i;
1523  loop
1524  {
1525  for(i=0;i<iv->length();i++)
1526  {
1527  if (((int)pGetComp(p))==(*iv)[i])
1528  {
1529  poly h;
1530  pSplit(p,&h);
1531  pNext(hp)=p;
1532  p=h;
1533  pIter(hp);
1534  break;
1535  }
1536  }
1537  if (p==NULL) break;
1538  if (i==iv->length())
1539  {
1540  pLmDelete(&p);
1541  if (p==NULL) break;
1542  }
1543  }
1544  pLmDelete(&r);
1545  res->data=(char *)r;
1546  }
1547  return FALSE;
1548 }
#define pSplit(p, r)
Definition: polys.h:265

◆ jjINTERPOLATION()

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

Definition at line 2467 of file iparith.cc.

2468 {
2469  const lists L = (lists)l->Data();
2470  const int n = L->nr; assume (n >= 0);
2471  std::vector<ideal> V(n + 1);
2472 
2473  for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2474 
2475  res->data=interpolation(V, (intvec*)v->Data());
2476  setFlag(res,FLAG_STD);
2477  return errorreported;
2478 }
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4360 of file iparith.cc.

4361 {
4362  ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4363 #ifdef HAVE_RINGS
4365  WarnS("interred: this command is experimental over the integers");
4366 #endif
4367  if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4368  res->data = result;
4369  return FALSE;
4370 }
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3734
#define TEST_OPT_PROT
Definition: options.h:102
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:58

◆ jjINTERSEC3S()

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

Definition at line 6172 of file iparith.cc.

6173 {
6174  ideal I=(ideal)u->Data();
6175  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6176  res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6178  return FALSE;
6179 }
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:316
#define TEST_OPT_RETURN_SB
Definition: options.h:111

◆ jjINTERSECT()

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

Definition at line 2461 of file iparith.cc.

2462 {
2463  res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2465  return FALSE;
2466 }

◆ jjINTERSECT3()

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

Definition at line 6159 of file iparith.cc.

6160 {
6161  ideal I1=(ideal)u->Data();
6162  ideal I2=(ideal)v->Data();
6163  ideal I3=(ideal)w->Data();
6164  resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6165  r[0]=I1;
6166  r[1]=I2;
6167  r[2]=I3;
6168  res->data=(char *)idMultSect(r,3);
6169  omFreeSize((ADDRESS)r,3*sizeof(ideal));
6170  return FALSE;
6171 }
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition: ideals.cc:472
ideal * resolvente
Definition: ideals.h:18

◆ jjINTERSECT_PL()

static BOOLEAN jjINTERSECT_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7395 of file iparith.cc.

7396 {
7397  leftv h=v;
7398  int l=v->listLength();
7399  resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7400  BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7401  int t=0;
7402  // try to convert to IDEAL_CMD
7403  while (h!=NULL)
7404  {
7405  if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7406  {
7407  t=IDEAL_CMD;
7408  }
7409  else break;
7410  h=h->next;
7411  }
7412  // if failure, try MODUL_CMD
7413  if (t==0)
7414  {
7415  h=v;
7416  while (h!=NULL)
7417  {
7418  if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7419  {
7420  t=MODUL_CMD;
7421  }
7422  else break;
7423  h=h->next;
7424  }
7425  }
7426  // check for success in converting
7427  if (t==0)
7428  {
7429  WerrorS("cannot convert to ideal or module");
7430  return TRUE;
7431  }
7432  // call idMultSect
7433  h=v;
7434  int i=0;
7435  sleftv tmp;
7436  while (h!=NULL)
7437  {
7438  if (h->Typ()==t)
7439  {
7440  r[i]=(ideal)h->Data(); /*no copy*/
7441  h=h->next;
7442  }
7443  else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7444  {
7445  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7446  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7447  Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7448  return TRUE;
7449  }
7450  else
7451  {
7452  r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7453  copied[i]=TRUE;
7454  h=tmp.next;
7455  }
7456  i++;
7457  }
7458  res->rtyp=t;
7459  res->data=(char *)idMultSect(r,i);
7460  while(i>0)
7461  {
7462  i--;
7463  if (copied[i]) idDelete(&(r[i]));
7464  }
7465  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7466  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7467  return FALSE;
7468 }

◆ jjINTMAT3()

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

Definition at line 6145 of file iparith.cc.

6146 {
6147  intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6148  intvec* arg = (intvec*) u->Data();
6149  int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6150 
6151  for (i=0; i<n; i++)
6152  {
6153  (*im)[i] = (*arg)[i];
6154  }
6155 
6156  res->data = (char *)im;
6157  return FALSE;
6158 }

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7631 of file iparith.cc.

7632 {
7633  int i=0;
7634  leftv h=v;
7635  if (h!=NULL) i=exprlist_length(h);
7636  intvec *iv=new intvec(i);
7637  i=0;
7638  while (h!=NULL)
7639  {
7640  if(h->Typ()==INT_CMD)
7641  {
7642  (*iv)[i]=(int)(long)h->Data();
7643  }
7644  else if (h->Typ()==INTVEC_CMD)
7645  {
7646  intvec *ivv=(intvec*)h->Data();
7647  for(int j=0;j<ivv->length();j++,i++)
7648  {
7649  (*iv)[i]=(*ivv)[j];
7650  }
7651  i--;
7652  }
7653  else
7654  {
7655  delete iv;
7656  return TRUE;
7657  }
7658  i++;
7659  h=h->next;
7660  }
7661  res->data=(char *)iv;
7662  return FALSE;
7663 }

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4382 of file iparith.cc.

4383 {
4384  res->data = (char *)0;
4385  return FALSE;
4386 }

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4371 of file iparith.cc.

4372 {
4373  res->data = (char *)(long)pVar((poly)v->Data());
4374  return FALSE;
4375 }

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4376 of file iparith.cc.

4377 {
4378  res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4379  currRing->N)+1);
4380  return FALSE;
4381 }
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 4418 of file iparith.cc.

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

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4387 of file iparith.cc.

4388 {
4389  ideal i=idInit(currRing->N,1);
4390  int k;
4391  poly p=(poly)(v->Data());
4392  for (k=currRing->N;k>0;k--)
4393  {
4394  i->m[k-1]=pDiff(p,k);
4395  }
4396  res->data = (char *)i;
4397  return FALSE;
4398 }

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2485 of file iparith.cc.

2486 {
2487  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2488  return jjStdJanetBasis(res,v,0);
2489 }
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 2479 of file iparith.cc.

2480 {
2481  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2482  return jjStdJanetBasis(res,u,(int)(long)v->Data());
2483 }

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7664 of file iparith.cc.

7665 {
7666  const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7667  const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7668  const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7669  const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7670  leftv u1=u;
7671  leftv u2=u1->next;
7672  leftv u3=u2->next;
7673  leftv u4=u3->next;
7674  if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7675  {
7676  if(!pIsUnit((poly)u2->Data()))
7677  {
7678  WerrorS("2nd argument must be a unit");
7679  return TRUE;
7680  }
7681  res->rtyp=u1->Typ();
7682  res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7683  pCopy((poly)u2->Data()),(intvec*)u4->Data());
7684  return FALSE;
7685  }
7686  else
7687  if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7688  {
7689  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7690  {
7691  WerrorS("2nd argument must be a diagonal matrix of units");
7692  return TRUE;
7693  }
7694  res->rtyp=u1->Typ();
7695  res->data=(char*)idSeries(
7696  (int)(long)u3->Data(),
7697  idCopy((ideal)u1->Data()),
7698  mp_Copy((matrix)u2->Data(), currRing),
7699  (intvec*)u4->Data()
7700  );
7701  return FALSE;
7702  }
7703  else
7704  {
7705  Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7706  Tok2Cmdname(iiOp));
7707  return TRUE;
7708  }
7709 }
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2105
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition: matpol.cc:816
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition: polys.h:240
#define pSeries(n, p, u, w)
Definition: polys.h:372

◆ jjJET_ID()

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

Definition at line 2495 of file iparith.cc.

2496 {
2497  res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2498  return FALSE;
2499 }
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 6197 of file iparith.cc.

6198 {
6199  res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6200  (intvec *)w->Data(),currRing);
6201  return FALSE;
6202 }
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 6203 of file iparith.cc.

6204 {
6205  if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6206  {
6207  WerrorS("2nd argument must be a diagonal matrix of units");
6208  return TRUE;
6209  }
6210  res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6211  (matrix)v->CopyD());
6212  return FALSE;
6213 }

◆ jjJET_P()

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

Definition at line 2490 of file iparith.cc.

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

◆ jjJET_P_IV()

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

Definition at line 6180 of file iparith.cc.

6181 {
6182  int *iw=iv2array((intvec *)w->Data(),currRing);
6183  res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6184  omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6185  return FALSE;
6186 }
#define ppJetW(p, m, iv)
Definition: polys.h:369

◆ jjJET_P_P()

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

Definition at line 6187 of file iparith.cc.

6188 {
6189  if (!pIsUnit((poly)v->Data()))
6190  {
6191  WerrorS("2nd argument must be a unit");
6192  return TRUE;
6193  }
6194  res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6195  return FALSE;
6196 }
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4524

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4439 of file iparith.cc.

4440 {
4441  assumeStdFlag(v);
4442  res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4443  return FALSE;
4444 }
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1426

◆ jjKBASE2()

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

Definition at line 2500 of file iparith.cc.

2501 {
2502  assumeStdFlag(u);
2503  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2504  res->data = (char *)scKBase((int)(long)v->Data(),
2505  (ideal)(u->Data()),currRing->qideal, w_u);
2506  if (w_u!=NULL)
2507  {
2508  atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2509  }
2510  return FALSE;
2511 }
intvec * ivCopy(const intvec *o)
Definition: intvec.h:135

◆ jjKERNEL()

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

Definition at line 2513 of file iparith.cc.

2514 {
2515  return jjPREIMAGE(res,u,v,NULL);
2516 }
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6420

◆ jjKLAMMER()

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

Definition at line 1550 of file iparith.cc.

1551 {
1552  if(u->name==NULL) return TRUE;
1553  long slen = strlen(u->name) + 14;
1554  char *nn = (char*) omAlloc(slen);
1555  sprintf(nn,"%s(%d)",u->name,(int)(long)v->Data());
1556  char *n=omStrDup(nn);
1557  omFreeSize((ADDRESS)nn,slen);
1558  syMake(res,n);
1559  if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1560  return FALSE;
1561 }
static BOOLEAN jjKLAMMER_rest(leftv res, leftv u, leftv v)
Definition: iparith.cc:1589

◆ jjKLAMMER_IV()

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

Definition at line 1562 of file iparith.cc.

1563 {
1564  if(u->name==NULL) return TRUE;
1565  intvec * iv=(intvec *)v->Data();
1566  leftv p=NULL;
1567  int i;
1568  long slen = strlen(u->name) + 14;
1569  char *n = (char*) omAlloc(slen);
1570 
1571  for (i=0;i<iv->length(); i++)
1572  {
1573  if (p==NULL)
1574  {
1575  p=res;
1576  }
1577  else
1578  {
1579  p->next=(leftv)omAlloc0Bin(sleftv_bin);
1580  p=p->next;
1581  }
1582  sprintf(n,"%s(%d)",u->name,(*iv)[i]);
1583  syMake(p,omStrDup(n));
1584  }
1585  omFreeSize(n, slen);
1586  if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1587  return FALSE;
1588 }

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7747 of file iparith.cc.

7748 {
7749  if ((yyInRingConstruction)
7750  && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7751  {
7752  memcpy(res,u,sizeof(sleftv));
7753  u->Init();
7754  return FALSE;
7755  }
7756  leftv v=u->next;
7757  BOOLEAN b;
7758  if(v==NULL) // p()
7759  b=iiExprArith1(res,u,iiOp);
7760  else if ((v->next==NULL) // p(1)
7761  || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7762  {
7763  u->next=NULL;
7764  b=iiExprArith2(res,u,iiOp,v);
7765  u->next=v;
7766  }
7767  else // p(1,2), p undefined
7768  {
7769  if (v->Typ()!=INT_CMD)
7770  {
7771  Werror("`int` expected while building `%s(`",u->name);
7772  return TRUE;
7773  }
7774  int l=u->listLength();
7775  char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7776  sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7777  char *s=nn;
7778  do
7779  {
7780  while (*s!='\0') s++;
7781  v=v->next;
7782  if (v->Typ()!=INT_CMD)
7783  {
7784  Werror("`int` expected while building `%s`",nn);
7785  omFree((ADDRESS)nn);
7786  return TRUE;
7787  }
7788  sprintf(s,",%d",(int)(long)v->Data());
7789  } while (v->next!=NULL);
7790  while (*s!='\0') s++;
7791  nn=strcat(nn,")");
7792  char *n=omStrDup(nn);
7793  omFree((ADDRESS)nn);
7794  syMake(res,n);
7795  b=FALSE;
7796  }
7797  return b;
7798 }
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1589 of file iparith.cc.

1590 {
1592  BOOLEAN b;
1593  if (v->Typ()==INTVEC_CMD)
1594  b=jjKLAMMER_IV(tmp,u,v);
1595  else
1596  b=jjKLAMMER(tmp,u,v);
1597  if (b)
1598  {
1599  omFreeBin(tmp,sleftv_bin);
1600  return TRUE;
1601  }
1602  leftv h=res;
1603  while (h->next!=NULL) h=h->next;
1604  h->next=tmp;
1605  return FALSE;
1606 }
static BOOLEAN jjKLAMMER_IV(leftv res, leftv u, leftv v)
Definition: iparith.cc:1562
static BOOLEAN jjKLAMMER(leftv res, leftv u, leftv v)
Definition: iparith.cc:1550

◆ jjKoszul()

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

Definition at line 2517 of file iparith.cc.

2518 {
2519  return mpKoszul(res, u,v,NULL);
2520 }
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3102

◆ jjKoszul_Id()

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

Definition at line 2521 of file iparith.cc.

2522 {
2523  sleftv h;
2524  h.Init();
2525  h.rtyp=INT_CMD;
2526  h.data=(void *)(long)IDELEMS((ideal)v->Data());
2527  return mpKoszul(res, u, &h, v);
2528 }

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4445 of file iparith.cc.

4446 {
4447  res->data=(char *)syConvList((lists)v->Data());
4448  if (res->data != NULL)
4449  return FALSE;
4450  else
4451  return TRUE;
4452 }
syStrategy syConvList(lists li)
Definition: ipshell.cc:3265

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4522 of file iparith.cc.

4523 {
4524  sleftv a2,a3;
4525  memset(&a2,0,sizeof(a2));
4526  memset(&a3,0,sizeof(a3));
4527  a2.rtyp=INT_CMD; a2.data=(void*)10;
4528  a3.rtyp=INT_CMD; a3.data=(void*)1;
4529  return nuLagSolve(res,v,&a2,&a3);
4530 }
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
Definition: ipshell.cc:4687

◆ jjLE_BI()

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

Definition at line 1200 of file iparith.cc.

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

◆ jjLE_I()

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

Definition at line 1204 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1209 of file iparith.cc.

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

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4453 of file iparith.cc.

4454 {
4455  poly p=(poly)v->Data();
4456  if (p==NULL)
4457  {
4458  res->data=(char *)nInit(0);
4459  }
4460  else
4461  {
4463  res->data=(char *)nCopy(pGetCoeff(p));
4464  }
4465  return FALSE;
4466 }

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4467 of file iparith.cc.

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

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4485 of file iparith.cc.

4486 {
4487  poly p=(poly)v->Data();
4488  if (p == NULL)
4489  {
4490  res->data = (char*) NULL;
4491  }
4492  else
4493  {
4494  poly lm = pLmInit(p);
4495  pSetCoeff0(lm, nInit(1));
4496  res->data = (char*) lm;
4497  }
4498  return FALSE;
4499 }
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64

◆ jjLIFT()

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

Definition at line 2529 of file iparith.cc.

2530 {
2531  int ul= IDELEMS((ideal)u->Data());
2532  int vl= IDELEMS((ideal)v->Data());
2533 #ifdef HAVE_SHIFTBBA
2534  if (rIsLPRing(currRing))
2535  {
2536  if (currRing->LPncGenCount < ul)
2537  {
2538  Werror("At least %d ncgen variables are needed for this computation.", ul);
2539  return TRUE;
2540  }
2541  }
2542 #endif
2543  ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2544  hasFlag(u,FLAG_STD));
2545  if (m==NULL) return TRUE;
2546  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2547  return FALSE;
2548 }

◆ jjLIFT3()

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

Definition at line 6859 of file iparith.cc.

6860 {
6861  if (w->rtyp!=IDHDL) return TRUE;
6862  int ul= IDELEMS((ideal)u->Data());
6863  int vl= IDELEMS((ideal)v->Data());
6864 #ifdef HAVE_SHIFTBBA
6865  if (rIsLPRing(currRing))
6866  {
6867  if (currRing->LPncGenCount < ul)
6868  {
6869  Werror("At least %d ncgen variables are needed for this computation.", ul);
6870  return TRUE;
6871  }
6872  }
6873 #endif
6874  ideal m
6875  = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6876  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6877  if (m==NULL) return TRUE;
6878  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6879  return FALSE;
6880 }
#define IDMATRIX(a)
Definition: ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7799 of file iparith.cc.

7800 {
7801  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7802  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7803  leftv u=U;
7804  leftv v=u->next;
7805  leftv w=v->next;
7806  leftv u4=w->next;
7807  if (w->rtyp!=IDHDL) return TRUE;
7808  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7809  {
7810  // see jjLIFT3
7811  ideal I=(ideal)u->Data();
7812  int ul= IDELEMS(I /*(ideal)u->Data()*/);
7813  int vl= IDELEMS((ideal)v->Data());
7814  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7815  ideal m
7816  = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7817  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7818  if (m==NULL) return TRUE;
7819  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7820  return FALSE;
7821  }
7822  else
7823  {
7824  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7825  "or (`module`,`module`,`matrix`,`string`) expected",
7826  Tok2Cmdname(iiOp));
7827  return TRUE;
7828  }
7829 }

◆ jjLIFTSTD()

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

Definition at line 2549 of file iparith.cc.

2550 {
2551  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2552  idhdl h=(idhdl)v->data;
2553 #ifdef HAVE_SHIFTBBA
2554  if (rIsLPRing(currRing))
2555  {
2556  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2557  {
2558  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2559  return TRUE;
2560  }
2561  }
2562 #endif
2563  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2564  res->data = (char *)idLiftStd((ideal)u->Data(),
2565  &(h->data.umatrix),testHomog);
2566  setFlag(res,FLAG_STD); v->flag=0;
2567  return FALSE;
2568 }
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition: ideals.cc:976

◆ jjLIFTSTD_ALG()

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

Definition at line 6904 of file iparith.cc.

6905 {
6906  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6907  idhdl hv=(idhdl)v->data;
6908  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
6909 #ifdef HAVE_SHIFTBBA
6910  if (rIsLPRing(currRing))
6911  {
6912  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6913  {
6914  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6915  return TRUE;
6916  }
6917  }
6918 #endif
6919  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6920  res->data = (char *)idLiftStd((ideal)u->Data(),
6921  &(hv->data.umatrix),testHomog,
6922  NULL,alg);
6923  setFlag(res,FLAG_STD); v->flag=0;
6924  return FALSE;
6925 }

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 7830 of file iparith.cc.

7831 {
7832  // we have 4 or 5 arguments
7833  leftv u=U;
7834  leftv v=u->next;
7835  leftv u3=v->next;
7836  leftv u4=u3->next;
7837  leftv u5=u4->next; // might be NULL
7838 
7839  ideal *syz=NULL;
7840  GbVariant alg=GbDefault;
7841  ideal h11=NULL;
7842 
7843  if(u5==NULL)
7844  {
7845  // test all three possibilities for 4 arguments
7846  const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7847  const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7848  const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
7849  const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
7850  const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
7851  const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
7852 
7853  if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7854  {
7855  if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7856  idhdl hw=(idhdl)u3->data;
7857  syz=&(hw->data.uideal);
7858  alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7859  }
7860  else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
7861  {
7862  if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7863  idhdl hw=(idhdl)u3->data;
7864  syz=&(hw->data.uideal);
7865  h11=(ideal)u4->Data();
7866  }
7867  else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
7868  {
7869  alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
7870  h11=(ideal)u4->Data();
7871  }
7872  else
7873  {
7874  Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7875  return TRUE;
7876  }
7877  }
7878  else
7879  {
7880  // we have 5 arguments
7881  const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
7882  const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
7883  if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7884  {
7885  idhdl hw=(idhdl)u3->data;
7886  syz=&(hw->data.uideal);
7887  alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7888  h11=(ideal)u5->Data();
7889  }
7890  else
7891  {
7892  Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7893  return TRUE;
7894  }
7895  }
7896 
7897 #ifdef HAVE_SHIFTBBA
7898  if (rIsLPRing(currRing))
7899  {
7900  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7901  {
7902  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7903  return TRUE;
7904  }
7905  }
7906 #endif
7907 
7908  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7909  idhdl hv=(idhdl)v->data;
7910  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7911  res->rtyp = u->Typ();
7912  res->data = (char *)idLiftStd((ideal)u->Data(),
7913  &(hv->data.umatrix),testHomog,
7914  syz,alg,h11);
7915  setFlag(res,FLAG_STD); v->flag=0;
7916  if(syz!=NULL)
7917  u3->flag=0;
7918  return FALSE;
7919 }
@ GbDefault
Definition: ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 6881 of file iparith.cc.

6882 {
6883  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6884  if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6885  idhdl hv=(idhdl)v->data;
6886  idhdl hw=(idhdl)w->data;
6887 #ifdef HAVE_SHIFTBBA
6888  if (rIsLPRing(currRing))
6889  {
6890  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6891  {
6892  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6893  return TRUE;
6894  }
6895  }
6896 #endif
6897  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6898  res->data = (char *)idLiftStd((ideal)u->Data(),
6899  &(hv->data.umatrix),testHomog,
6900  &(hw->data.uideal));
6901  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
6902  return FALSE;
6903 }

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7920 of file iparith.cc.

7921 {
7922  int sl=0;
7923  if (v!=NULL) sl = v->listLength();
7924  lists L;
7925  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7926  {
7927  int add_row_shift = 0;
7928  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7929  if (weights!=NULL) add_row_shift=weights->min_in();
7930  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7931  }
7932  else
7933  {
7935  leftv h=NULL;
7936  int i;
7937  int rt;
7938 
7939  L->Init(sl);
7940  for (i=0;i<sl;i++)
7941  {
7942  if (h!=NULL)
7943  { /* e.g. not in the first step:
7944  * h is the pointer to the old sleftv,
7945  * v is the pointer to the next sleftv
7946  * (in this moment) */
7947  h->next=v;
7948  }
7949  h=v;
7950  v=v->next;
7951  h->next=NULL;
7952  rt=h->Typ();
7953  if (rt==0)
7954  {
7955  L->Clean();
7956  Werror("`%s` is undefined",h->Fullname());
7957  return TRUE;
7958  }
7959  if (rt==RING_CMD)
7960  {
7961  L->m[i].rtyp=rt;
7962  L->m[i].data=rIncRefCnt(((ring)h->Data()));
7963  }
7964  else
7965  L->m[i].Copy(h);
7966  }
7967  }
7968  res->data=(char *)L;
7969  return FALSE;
7970 }
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:3193
static ring rIncRefCnt(ring r)
Definition: ring.h:847

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4504 of file iparith.cc.

4505 {
4506  lists l=(lists)v->Data();
4507  long mm=(long)atGet(v,"maxExp",INT_CMD);
4508  int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4509  ring r=rCompose(l,TRUE,mm,isLetterplace);
4510  res->data=(char *)r;
4511  return (r==NULL);
4512 }
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2793

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5443 of file iparith.cc.

5444 {
5445  char libnamebuf[1024];
5447 
5448 #ifdef HAVE_DYNAMIC_LOADING
5449  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5450 #endif /* HAVE_DYNAMIC_LOADING */
5451  switch(LT)
5452  {
5453  default:
5454  case LT_NONE:
5455  Werror("%s: unknown type", s);
5456  break;
5457  case LT_NOTFOUND:
5458  Werror("cannot open %s", s);
5459  break;
5460 
5461  case LT_SINGULAR:
5462  {
5463  char *plib = iiConvName(s);
5464  idhdl pl = IDROOT->get_level(plib,0);
5465  if (pl==NULL)
5466  {
5467  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5468  IDPACKAGE(pl)->language = LANG_SINGULAR;
5469  IDPACKAGE(pl)->libname=omStrDup(s);
5470  }
5471  else if (IDTYP(pl)!=PACKAGE_CMD)
5472  {
5473  Werror("can not create package `%s`",plib);
5474  omFree(plib);
5475  return TRUE;
5476  }
5477  else /* package */
5478  {
5479  package pa=IDPACKAGE(pl);
5480  if ((pa->language==LANG_C)
5481  || (pa->language==LANG_MIX))
5482  {
5483  Werror("can not create package `%s` - binaries exists",plib);
5484  omfree(plib);
5485  return TRUE;
5486  }
5487  }
5488  omFree(plib);
5489  package savepack=currPack;
5490  currPack=IDPACKAGE(pl);
5491  IDPACKAGE(pl)->loaded=TRUE;
5492  char libnamebuf[1024];
5493  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5494  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5495  currPack=savepack;
5496  IDPACKAGE(pl)->loaded=(!bo);
5497  return bo;
5498  }
5499  case LT_BUILTIN:
5500  SModulFunc_t iiGetBuiltinModInit(const char*);
5501  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5502  case LT_MACH_O:
5503  case LT_ELF:
5504  case LT_HPUX:
5505 #ifdef HAVE_DYNAMIC_LOADING
5506  return load_modules(s, libnamebuf, autoexport);
5507 #else /* HAVE_DYNAMIC_LOADING */
5508  WerrorS("Dynamic modules are not supported by this version of Singular");
5509  break;
5510 #endif /* HAVE_DYNAMIC_LOADING */
5511  }
5512  return TRUE;
5513 }
CanonicalForm fp
Definition: cfModGcd.cc:4104
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:278
VAR package basePack
Definition: ipid.cc:58
VAR package currPack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:19
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1294
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:81
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:969
char * iiConvName(const char *libname)
Definition: iplib.cc:1429
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1284
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:803
VAR char libnamebuf[1024]
Definition: libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:27
lib_types
Definition: mod_raw.h:16
@ LT_MACH_O
Definition: mod_raw.h:16
@ LT_HPUX
Definition: mod_raw.h:16
@ LT_SINGULAR
Definition: mod_raw.h:16
@ LT_BUILTIN
Definition: mod_raw.h:16
@ LT_ELF
Definition: mod_raw.h:16
@ LT_NONE
Definition: mod_raw.h:16
@ LT_NOTFOUND
Definition: mod_raw.h:16
#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 4500 of file iparith.cc.

4501 {
4502  return jjLOAD((char*)v->Data(),FALSE);
4503 }
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5443

◆ jjLOAD2()

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

Definition at line 2569 of file iparith.cc.

2570 {
2571  return jjLOAD((char*)v->Data(),TRUE);
2572 }

◆ jjLOAD_E()

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

Definition at line 2573 of file iparith.cc.

2574 {
2575  char * s=(char *)u->Data();
2576  if(strcmp(s, "with")==0)
2577  return jjLOAD((char*)v->Data(), TRUE);
2578  if (strcmp(s,"try")==0)
2579  return jjLOAD_TRY((char*)v->Data());
2580  WerrorS("invalid second argument");
2581  WerrorS("load(\"libname\" [,option]);");
2582  return TRUE;
2583 }
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5519

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5519 of file iparith.cc.

5520 {
5521  if (!iiGetLibStatus(s))
5522  {
5523  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5526  BOOLEAN bo=jjLOAD(s,TRUE);
5527  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5528  Print("loading of >%s< failed\n",s);
5529  WerrorS_callback=WerrorS_save;
5530  errorreported=0;
5531  }
5532  return FALSE;
5533 }
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5514
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5515
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 1213 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1217 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1222 of file iparith.cc.

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

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4531 of file iparith.cc.

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

7470 {
7471  /* computation of the inverse of a quadratic matrix A
7472  using the L-U-decomposition of A;
7473  There are two valid parametrisations:
7474  1) exactly one argument which is just the matrix A,
7475  2) exactly three arguments P, L, U which already
7476  realise the L-U-decomposition of A, that is,
7477  P * A = L * U, and P, L, and U satisfy the
7478  properties decribed in method 'jjLU_DECOMP';
7479  see there;
7480  If A is invertible, the list [1, A^(-1)] is returned,
7481  otherwise the list [0] is returned. Thus, the user may
7482  inspect the first entry of the returned list to see
7483  whether A is invertible. */
7484  matrix iMat; int invertible;
7485  const short t1[]={1,MATRIX_CMD};
7486  const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7487  if (iiCheckTypes(v,t1))
7488  {
7489  matrix aMat = (matrix)v->Data();
7490  int rr = aMat->rows();
7491  int cc = aMat->cols();
7492  if (rr != cc)
7493  {
7494  Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7495  return TRUE;
7496  }
7497  if (!idIsConstant((ideal)aMat))
7498  {
7499  WerrorS("matrix must be constant");
7500  return TRUE;
7501  }
7502  invertible = luInverse(aMat, iMat);
7503  }
7504  else if (iiCheckTypes(v,t2))
7505  {
7506  matrix pMat = (matrix)v->Data();
7507  matrix lMat = (matrix)v->next->Data();
7508  matrix uMat = (matrix)v->next->next->Data();
7509  int rr = uMat->rows();
7510  int cc = uMat->cols();
7511  if (rr != cc)
7512  {
7513  Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7514  rr, cc);
7515  return TRUE;
7516  }
7517  if (!idIsConstant((ideal)pMat)
7518  || (!idIsConstant((ideal)lMat))
7519  || (!idIsConstant((ideal)uMat))
7520  )
7521  {
7522  WerrorS("matricesx must be constant");
7523  return TRUE;
7524  }
7525  invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7526  }
7527  else
7528  {
7529  Werror("expected either one or three matrices");
7530  return TRUE;
7531  }
7532 
7533  /* build the return structure; a list with either one or two entries */
7535  if (invertible)
7536  {
7537  ll->Init(2);
7538  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7539  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7540  }
7541  else
7542  {
7543  ll->Init(1);
7544  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7545  }
7546 
7547  res->data=(char*)ll;
7548  return FALSE;
7549 }
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 7550 of file iparith.cc.

7551 {
7552  /* for solving a linear equation system A * x = b, via the
7553  given LU-decomposition of the matrix A;
7554  There is one valid parametrisation:
7555  1) exactly four arguments P, L, U, b;
7556  P, L, and U realise the L-U-decomposition of A, that is,
7557  P * A = L * U, and P, L, and U satisfy the
7558  properties decribed in method 'jjLU_DECOMP';
7559  see there;
7560  b is the right-hand side vector of the equation system;
7561  The method will return a list of either 1 entry or three entries:
7562  1) [0] if there is no solution to the system;
7563  2) [1, x, H] if there is at least one solution;
7564  x is any solution of the given linear system,
7565  H is the matrix with column vectors spanning the homogeneous
7566  solution space.
7567  The method produces an error if matrix and vector sizes do not fit. */
7568  const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7569  if (!iiCheckTypes(v,t))
7570  {
7571  WerrorS("expected exactly three matrices and one vector as input");
7572  return TRUE;
7573  }
7574  matrix pMat = (matrix)v->Data();
7575  matrix lMat = (matrix)v->next->Data();
7576  matrix uMat = (matrix)v->next->next->Data();
7577  matrix bVec = (matrix)v->next->next->next->Data();
7578  matrix xVec; int solvable; matrix homogSolSpace;
7579  if (pMat->rows() != pMat->cols())
7580  {
7581  Werror("first matrix (%d x %d) is not quadratic",
7582  pMat->rows(), pMat->cols());
7583  return TRUE;
7584  }
7585  if (lMat->rows() != lMat->cols())
7586  {
7587  Werror("second matrix (%d x %d) is not quadratic",
7588  lMat->rows(), lMat->cols());
7589  return TRUE;
7590  }
7591  if (lMat->rows() != uMat->rows())
7592  {
7593  Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7594  lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7595  return TRUE;
7596  }
7597  if (uMat->rows() != bVec->rows())
7598  {
7599  Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7600  uMat->rows(), uMat->cols(), bVec->rows());
7601  return TRUE;
7602  }
7603  if (!idIsConstant((ideal)pMat)
7604  ||(!idIsConstant((ideal)lMat))
7605  ||(!idIsConstant((ideal)uMat))
7606  )
7607  {
7608  WerrorS("matrices must be constant");
7609  return TRUE;
7610  }
7611  solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7612 
7613  /* build the return structure; a list with either one or three entries */
7615  if (solvable)
7616  {
7617  ll->Init(3);
7618  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7619  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7620  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7621  }
7622  else
7623  {
7624  ll->Init(1);
7625  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7626  }
7627 
7628  res->data=(char*)ll;
7629  return FALSE;
7630 }
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 8640 of file iparith.cc.

8641 {
8642  assume( e->Typ()==INT_CMD );
8643  Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8644  r->start =(int)(long)e->Data();
8645  return r;
8646 }
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

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

Definition at line 1643 of file iparith.cc.

1644 {
1645  //Print("try to map %s with %s\n",$3.Name(),$1.Name());
1646  if ((v->e==NULL)&&(v->name!=NULL)&&(v->next==NULL))
1647  {
1648  map m=(map)u->Data();
1649  leftv sl=iiMap(m,v->name);
1650  if (sl!=NULL)
1651  {
1652  memcpy(res,sl,sizeof(sleftv));
1654  return FALSE;
1655  }
1656  }
1657  else
1658  {
1659  Werror("%s(<name>) expected",u->Name());
1660  }
1661  return TRUE; /*sl==NULL or Werror*/
1662 }
leftv iiMap(map theMap, const char *what)
Definition: ipshell.cc:613

◆ jjMATRIX_Id()

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

Definition at line 6682 of file iparith.cc.

6683 {
6684  int mi=(int)(long)v->Data();
6685  int ni=(int)(long)w->Data();
6686  if ((mi<1)||(ni<1))
6687  {
6688  Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6689  return TRUE;
6690  }
6691  matrix m=mpNew(mi,ni);
6692  ideal I=(ideal)u->CopyD(IDEAL_CMD);
6693  int i=si_min(IDELEMS(I),mi*ni);
6694  //for(i=i-1;i>=0;i--)
6695  //{
6696  // m->m[i]=I->m[i];
6697  // I->m[i]=NULL;
6698  //}
6699  memcpy(m->m,I->m,i*sizeof(poly));
6700  memset(I->m,0,i*sizeof(poly));
6701  id_Delete(&I,currRing);
6702  res->data = (char *)m;
6703  return FALSE;
6704 }

◆ jjMATRIX_Ma()

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

Definition at line 6718 of file iparith.cc.

6719 {
6720  int mi=(int)(long)v->Data();
6721  int ni=(int)(long)w->Data();
6722  if ((mi<1)||(ni<1))
6723  {
6724  Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6725  return TRUE;
6726  }
6727  matrix m=mpNew(mi,ni);
6728  matrix I=(matrix)u->CopyD(MATRIX_CMD);
6729  int r=si_min(MATROWS(I),mi);
6730  int c=si_min(MATCOLS(I),ni);
6731  int i,j;
6732  for(i=r;i>0;i--)
6733  {
6734  for(j=c;j>0;j--)
6735  {
6736  MATELEM(m,i,j)=MATELEM(I,i,j);
6737  MATELEM(I,i,j)=NULL;
6738  }
6739  }
6740  id_Delete((ideal *)&I,currRing);
6741  res->data = (char *)m;
6742  return FALSE;
6743 }

◆ jjMATRIX_Mo()

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

Definition at line 6705 of file iparith.cc.

6706 {
6707  int mi=(int)(long)v->Data();
6708  int ni=(int)(long)w->Data();
6709  if ((mi<0)||(ni<1))
6710  {
6711  Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6712  return TRUE;
6713  }
6714  res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6715  mi,ni,currRing);
6716  return FALSE;
6717 }

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4561 of file iparith.cc.

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

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6214 of file iparith.cc.

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

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4614 of file iparith.cc.

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

◆ jjMINUS_B()

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

Definition at line 921 of file iparith.cc.

922 {
924  poly p=(poly)u->CopyD(POLY_CMD);
925  int l=pLength(p);
926  sBucket_Add_p(b,p,l);
927  p= (poly)v->CopyD(POLY_CMD);
928  p=p_Neg(p,currRing);
929  l=pLength(p);
930  sBucket_Add_p(b,p,l);
931  res->data=(void*)b;
932  return jjPLUSMINUS_Gen(res,u,v);
933 }
static BOOLEAN jjPLUSMINUS_Gen(leftv res, leftv u, leftv v)
Definition: iparith.cc:633
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1067
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 911 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 896 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 944 of file iparith.cc.

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

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

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

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

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

◆ jjMINUS_SM()

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

Definition at line 967 of file iparith.cc.

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

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

◆ jjMOD_BI()

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

Definition at line 2637 of file iparith.cc.

2638 {
2639  number q=(number)v->Data();
2640  if (n_IsZero(q,coeffs_BIGINT))
2641  {
2643  return TRUE;
2644  }
2645  res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2646  return FALSE;
2647 }
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:629

◆ jjMOD_N()

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

Definition at line 2648 of file iparith.cc.

2649 {
2650  number q=(number)v->Data();
2651  if (nIsZero(q))
2652  {
2654  return TRUE;
2655  }
2656  res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2657  return FALSE;
2658 }

◆ jjMOD_P()

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

Definition at line 2659 of file iparith.cc.

2660 {
2661  poly q=(poly)v->Data();
2662  if (q==NULL)
2663  {
2665  return TRUE;
2666  }
2667  poly p=(poly)(u->Data());
2668  if (p==NULL)
2669  {
2670  res->data=NULL;
2671  return FALSE;
2672  }
2673  res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2674  q /*(poly)(v->Data())*/ ,currRing));
2675  return FALSE;
2676 }
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:668

◆ jjMODULO()

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

Definition at line 2584 of file iparith.cc.

2585 {
2586  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2587  tHomog hom=testHomog;
2588  if (w_u!=NULL)
2589  {
2590  //PrintS("modulo: wu:");w_u->show(INTVEC_CMD);PrintLn();
2591  w_u=ivCopy(w_u);
2592  hom=isHomog;
2593  }
2594  //else PrintS("modulo: wu:none\n");
2595  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2596  if (w_v!=NULL)
2597  {
2598  //PrintS("modulo: wv:");w_v->show(INTVEC_CMD);PrintLn();
2599  w_v=ivCopy(w_v);
2600  hom=isHomog;
2601  }
2602  //else PrintS("modulo: wv:none\n");
2603  if ((w_u!=NULL) && (w_v==NULL))
2604  w_v=ivCopy(w_u);
2605  if ((w_v!=NULL) && (w_u==NULL))
2606  w_u=ivCopy(w_v);
2607  ideal u_id=(ideal)u->Data();
2608  ideal v_id=(ideal)v->Data();
2609  if (w_u!=NULL)
2610  {
2611  if ((*w_u).compare((w_v))!=0)
2612  {
2613  WarnS("incompatible weights");
2614  delete w_u; w_u=NULL;
2615  hom=testHomog;
2616  }
2617  else
2618  {
2619  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2620  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2621  {
2622  WarnS("wrong weights");
2623  delete w_u; w_u=NULL;
2624  hom=testHomog;
2625  }
2626  }
2627  }
2628  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2629  if (w_u!=NULL)
2630  {
2631  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2632  }
2633  delete w_v;
2634  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2635  return FALSE;
2636 }
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w, matrix *T, GbVariant alg)
Definition: ideals.cc:2398
tHomog
Definition: structs.h:40
@ isHomog
Definition: structs.h:42

◆ jjMODULO3()

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

Definition at line 6744 of file iparith.cc.

6745 {
6746  if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6747  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6748  tHomog hom=testHomog;
6749  if (w_u!=NULL)
6750  {
6751  w_u=ivCopy(w_u);
6752  hom=isHomog;
6753  }
6754  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6755  if (w_v!=NULL)
6756  {
6757  w_v=ivCopy(w_v);
6758  hom=isHomog;
6759  }
6760  if ((w_u!=NULL) && (w_v==NULL))
6761  w_v=ivCopy(w_u);
6762  if ((w_v!=NULL) && (w_u==NULL))
6763  w_u=ivCopy(w_v);
6764  ideal u_id=(ideal)u->Data();
6765  ideal v_id=(ideal)v->Data();
6766  if (w_u!=NULL)
6767  {
6768  if ((*w_u).compare((w_v))!=0)
6769  {
6770  WarnS("incompatible weights");
6771  delete w_u; w_u=NULL;
6772  hom=testHomog;
6773  }
6774  else
6775  {
6776  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6777  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6778  {
6779  WarnS("wrong weights");
6780  delete w_u; w_u=NULL;
6781  hom=testHomog;
6782  }
6783  }
6784  }
6785  idhdl h=(idhdl)w->data;
6786  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
6787  if (w_u!=NULL)
6788  {
6789  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6790  }
6791  delete w_v;
6792  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6793  return FALSE;
6794 }

◆ jjMODULO3S()

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

Definition at line 6795 of file iparith.cc.

6796 {
6797  if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6798  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6799  tHomog hom=testHomog;
6800  if (w_u!=NULL)
6801  {
6802  w_u=ivCopy(w_u);
6803  hom=isHomog;
6804  }
6805  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6806  if (w_v!=NULL)
6807  {
6808  w_v=ivCopy(w_v);
6809  hom=isHomog;
6810  }
6811  if ((w_u!=NULL) && (w_v==NULL))
6812  w_v=ivCopy(w_u);
6813  if ((w_v!=NULL) && (w_u==NULL))
6814  w_u=ivCopy(w_v);
6815  ideal u_id=(ideal)u->Data();
6816  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
6817  ideal v_id=(ideal)v->Data();
6818  if (w_u!=NULL)
6819  {
6820  if ((*w_u).compare((w_v))!=0)
6821  {
6822  WarnS("incompatible weights");
6823  delete w_u; w_u=NULL;
6824  hom=testHomog;
6825  }
6826  else
6827  {
6828  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6829  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6830  {
6831  WarnS("wrong weights");
6832  delete w_u; w_u=NULL;
6833  hom=testHomog;
6834  }
6835  }
6836  }
6837  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
6838  if (w_u!=NULL)
6839  {
6840  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6841  }
6842  delete w_v;
6843  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6844  return FALSE;
6845 }

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 7971 of file iparith.cc.

7972 {
7973  leftv v=u->next;
7974  leftv w=v->next;
7975  leftv u4=w->next;
7976  GbVariant alg;
7977  ideal u_id,v_id;
7978  // we have 4 arguments
7979  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7980  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7981  if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
7982  {
7983  u_id=(ideal)u->Data();
7984  v_id=(ideal)v->Data();
7985  alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
7986  }
7987  else
7988  {
7989  Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
7990  return TRUE;
7991  }
7992  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7993  tHomog hom=testHomog;
7994  if (w_u!=NULL)
7995  {
7996  w_u=ivCopy(w_u);
7997  hom=isHomog;
7998  }
7999  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8000  if (w_v!=NULL)
8001  {
8002  w_v=ivCopy(w_v);
8003  hom=isHomog;
8004  }
8005  if ((w_u!=NULL) && (w_v==NULL))
8006  w_v=ivCopy(w_u);
8007  if ((w_v!=NULL) && (w_u==NULL))
8008  w_u=ivCopy(w_v);
8009  if (w_u!=NULL)
8010  {
8011  if ((*w_u).compare((w_v))!=0)
8012  {
8013  WarnS("incompatible weights");
8014  delete w_u; w_u=NULL;
8015  hom=testHomog;
8016  }
8017  else
8018  {
8019  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8020  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8021  {
8022  WarnS("wrong weights");
8023  delete w_u; w_u=NULL;
8024  hom=testHomog;
8025  }
8026  }
8027  }
8028  idhdl h=(idhdl)w->data;
8029  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8030  if (w_u!=NULL)
8031  {
8032  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8033  }
8034  delete w_v;
8035  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8036  return FALSE;
8037 }

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2678 of file iparith.cc.

2679 {
2680  return jjMONITOR2(res,v,NULL);
2681 }
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2682

◆ jjMONITOR2()

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

Definition at line 2682 of file iparith.cc.

2683 {
2684 #if 0
2685  char *opt=(char *)v->Data();
2686  int mode=0;
2687  while(*opt!='\0')
2688  {
2689  if (*opt=='i') mode |= SI_PROT_I;
2690  else if (*opt=='o') mode |= SI_PROT_O;
2691  opt++;
2692  }
2693  monitor((char *)(u->Data()),mode);
2694 #else
2695  si_link l=(si_link)u->Data();
2696  if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2697  if(strcmp(l->m->type,"ASCII")!=0)
2698  {
2699  Werror("ASCII link required, not `%s`",l->m->type);
2700  slClose(l);
2701  return TRUE;
2702  }
2703  SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2704  if ( l->name[0]!='\0') // "" is the stop condition
2705  {
2706  const char *opt;
2707  int mode=0;
2708  if (v==NULL) opt=(const char*)"i";
2709  else opt=(const char *)v->Data();
2710  while(*opt!='\0')
2711  {
2712  if (*opt=='i') mode |= SI_PROT_I;
2713  else if (*opt=='o') mode |= SI_PROT_O;
2714  opt++;
2715  }
2716  monitor((FILE *)l->data,mode);
2717  }
2718  else
2719  monitor(NULL,0);
2720  return FALSE;
2721 #endif
2722 }
void monitor(void *F, int mode)
Definition: febase.cc:68
#define SI_PROT_O
Definition: reporter.h:54
#define SI_PROT_I
Definition: reporter.h:53

◆ jjMONOM()

static BOOLEAN jjMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 2723 of file iparith.cc.

2724 {
2725  intvec *iv=(intvec *)v->Data();
2726  poly p=pOne();
2727  int e;
2728  BOOLEAN err=FALSE;
2729  for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2730  {
2731  e=(*iv)[i-1];
2732  if (e>=0) pSetExp(p,i,e);
2733  else err=TRUE;
2734  }
2735  if (iv->length()==(currRing->N+1))
2736  {
2737  res->rtyp=VECTOR_CMD;
2738  e=(*iv)[currRing->N];
2739  if (e>=0) pSetComp(p,e);
2740  else err=TRUE;
2741  }
2742  pSetm(p);
2743  res->data=(char*)p;
2744  if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2745  return err;
2746 }

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5593 of file iparith.cc.

5594 {
5595  res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5596  return FALSE;
5597 }
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:275

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5598 of file iparith.cc.

5599 {
5600  res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5601  return FALSE;
5602 }
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:254

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4593 of file iparith.cc.

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

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4608 of file iparith.cc.

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

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4628 of file iparith.cc.

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

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4640 of file iparith.cc.

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

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4653 of file iparith.cc.

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

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8038 of file iparith.cc.

8039 {
8040  res->data=(void *)ipNameList(IDROOT);
8041  return FALSE;
8042 }

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4658 of file iparith.cc.

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

◆ jjNEWSTRUCT2()

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

Definition at line 2747 of file iparith.cc.

2748 {
2749  // u: the name of the new type
2750  // v: the elements
2751  const char *s=(const char *)u->Data();
2752  newstruct_desc d=NULL;
2753  if (strlen(s)>=2)
2754  {
2755  d=newstructFromString((const char *)v->Data());
2756  if (d!=NULL) newstruct_setup(s,d);
2757  }
2758  else WerrorS("name of newstruct must be longer than 1 character");
2759  return d==NULL;
2760 }
void newstruct_setup(const char *n, newstruct_desc d)
Definition: newstruct.cc:688
newstruct_desc newstructFromString(const char *s)
Definition: newstruct.cc:792

◆ jjNEWSTRUCT3()

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

Definition at line 6410 of file iparith.cc.

6411 {
6412  // u: the name of the new type
6413  // v: the parent type
6414  // w: the elements
6415  newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6416  (const char *)w->Data());
6417  if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6418  return (d==NULL);
6419 }
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition: newstruct.cc:799

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5633 of file iparith.cc.

5634 {
5635  number n=(number)u->CopyD(); // n_Int may call n_Normalize
5636  res->data=(char *)(long)iin_Int(n,currRing->cf);
5637  n_Delete(&n,currRing->cf);
5638  return FALSE;
5639 }
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:222

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5640 of file iparith.cc.

5641 {
5642  number n=(number)u->Data();
5643  res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5644  return FALSE;
5645 }

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4663 of file iparith.cc.

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

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3662 of file iparith.cc.

3663 {
3664  return FALSE;
3665 }

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 3961 of file iparith.cc.

3962 {
3963  number n = reinterpret_cast<number>(v->CopyD());
3964  res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
3965  n_Delete(&n,currRing);
3966  return FALSE;
3967 }
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:609

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4668 of file iparith.cc.

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

◆ jjOP_BI_BIM()

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

Definition at line 280 of file iparith.cc.

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

◆ jjOP_BIM_BI()

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

Definition at line 267 of file iparith.cc.

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

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

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

◆ jjOP_I_IM()

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

Definition at line 320 of file iparith.cc.

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

◆ jjOP_I_IV()

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

Definition at line 301 of file iparith.cc.

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

◆ jjOP_IM_I()

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

Definition at line 305 of file iparith.cc.

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

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

◆ jjOP_REST()

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

Definition at line 508 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4673 of file iparith.cc.

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

◆ jjOPPOSE()

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

Definition at line 2926 of file iparith.cc.

2927 {
2928  /* number, poly, vector, ideal, module, matrix */
2929  ring r = (ring)a->Data();
2930  if (r == currRing)
2931  {
2932  res->data = b->Data();
2933  res->rtyp = b->rtyp;
2934  return FALSE;
2935  }
2936  if (!rIsLikeOpposite(currRing, r))
2937  {
2938  Werror("%s is not an opposite ring to current ring",a->Fullname());
2939  return TRUE;
2940  }
2941  idhdl w;
2942  if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
2943  {
2944  int argtype = IDTYP(w);
2945  switch (argtype)
2946  {
2947  case NUMBER_CMD:
2948  {
2949  /* since basefields are equal, we can apply nCopy */
2950  res->data = nCopy((number)IDDATA(w));
2951  res->rtyp = argtype;
2952  break;
2953  }
2954  case POLY_CMD:
2955  case VECTOR_CMD:
2956  {
2957  poly q = (poly)IDDATA(w);
2958  res->data = pOppose(r,q,currRing);
2959  res->rtyp = argtype;
2960  break;
2961  }
2962  case IDEAL_CMD:
2963  case MODUL_CMD:
2964  {
2965  ideal Q = (ideal)IDDATA(w);
2966  res->data = idOppose(r,Q,currRing);
2967  res->rtyp = argtype;
2968  break;
2969  }
2970  case MATRIX_CMD:
2971  {
2972  ring save = currRing;
2973  rChangeCurrRing(r);
2974  matrix m = (matrix)IDDATA(w);
2976  rChangeCurrRing(save);
2977  ideal S = idOppose(r,Q,currRing);
2978  id_Delete(&Q, r);
2979  res->data = id_Module2Matrix(S,currRing);
2980  res->rtyp = argtype;
2981  break;
2982  }
2983  default:
2984  {
2985  WerrorS("unsupported type in oppose");
2986  return TRUE;
2987  }
2988  }
2989  }
2990  else
2991  {
2992  Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
2993  return TRUE;
2994  }
2995  return FALSE;
2996 }
@ NUMBER_CMD
Definition: grammar.cc:288
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3381
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3342
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
Definition: old.gring.cc:3315
void rChangeCurrRing(ring r)
Definition: polys.cc:15
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat

◆ jjOPPOSITE()

static BOOLEAN jjOPPOSITE ( leftv  res,
leftv  a 
)
static

Definition at line 5173 of file iparith.cc.

5174 {
5175 #ifdef HAVE_PLURAL
5176  ring r = (ring)a->Data();
5177  //if (rIsPluralRing(r))
5178  if (r->OrdSgn==1)
5179  {
5180  res->data = rOpposite(r);
5181  }
5182  else
5183  {
5184  WarnS("opposite only for global orderings");
5185  res->data = rCopy(r);
5186  }
5187  return FALSE;
5188 #else
5189  return TRUE;
5190 #endif
5191 }
ring rOpposite(ring src)
Definition: ring.cc:5253

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8043 of file iparith.cc.

8044 {
8045  if(v==NULL)
8046  {
8047  res->data=(char *)showOption();
8048  return FALSE;
8049  }
8050  res->rtyp=NONE;
8051  return setOption(res,v);
8052 }
char * showOption()
Definition: misc_ip.cc:721
void setOption(int ch)
Definition: shared.cc:1368

◆ jjOR_I()

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

Definition at line 1375 of file iparith.cc.

1376 {
1377  res->data = (char *)((long)u->Data() || (long)v->Data());
1378  return FALSE;
1379 }

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4679 of file iparith.cc.

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

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4725 of file iparith.cc.

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

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4745 of file iparith.cc.

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

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4793 of file iparith.cc.

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

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4685 of file iparith.cc.

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

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4701 of file iparith.cc.

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

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4707 of file iparith.cc.

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

◆ jjPARSTR2()

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

Definition at line 2761 of file iparith.cc.

2762 {
2763  idhdl h=(idhdl)u->data;
2764  int i=(int)(long)v->Data();
2765  int p=0;
2766  if ((0<i)
2767  && (rParameter(IDRING(h))!=NULL)
2768  && (i<=(p=rPar(IDRING(h)))))
2769  res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2770  else
2771  {
2772  Werror("par number %d out of range 1..%d",i,p);
2773  return TRUE;
2774  }
2775  return FALSE;
2776 }
#define IDRING(a)
Definition: ipid.h:127

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4513 of file iparith.cc.

4514 {
4515  /* call method jjPFAC2 with second argument = 0 (meaning that no
4516  valid bound for the prime factors has been given) */
4517  sleftv tmp;
4518  tmp.Init();
4519  tmp.rtyp = INT_CMD;
4520  return jjPFAC2(res, v, &tmp);
4521 }
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3185

◆ jjPFAC2()

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

Definition at line 3185 of file iparith.cc.

3186 {
3187  number n1; int i;
3188 
3189  if ((u->Typ() == BIGINT_CMD) ||
3190  ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3191  {
3192  n1 = (number)u->CopyD();
3193  }
3194  else if (u->Typ() == INT_CMD)
3195  {
3196  i = (int)(long)u->Data();
3197  n1 = n_Init(i, coeffs_BIGINT);
3198  }
3199  else
3200  {
3201  return TRUE;
3202  }
3203 
3204  i = (int)(long)v->Data();
3205 
3206  lists l = primeFactorisation(n1, i);
3207  n_Delete(&n1, coeffs_BIGINT);
3208  res->data = (char*)l;
3209  return FALSE;
3210 }
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:365

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5565 of file iparith.cc.

5566 {
5567  res->data = (char *)pHead((poly)v->Data());
5568  return FALSE;
5569 }

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5540 of file iparith.cc.

5541 {
5542  res->data = (char *)(long)pLength((poly)v->Data());
5543  return FALSE;
5544 }

◆ jjPlural_mat_mat()

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

Definition at line 2838 of file iparith.cc.

2839 {
2840  if( currRing->qideal != NULL )
2841  {
2842  WerrorS("basering must NOT be a qring!");
2843  return TRUE;
2844  }
2845 
2846  if (iiOp==NCALGEBRA_CMD)
2847  {
2848  return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2849  }
2850  else
2851  {
2852  ring r=rCopy(currRing);
2853  BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2854  res->data=r;
2855  return result;
2856  }
2857 }
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 2818 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2798 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2778 of file iparith.cc.

2779 {
2780  if( currRing->qideal != NULL )
2781  {
2782  WerrorS("basering must NOT be a qring!");
2783  return TRUE;
2784  }
2785 
2786  if (iiOp==NCALGEBRA_CMD)
2787  {
2788  return nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),currRing,false,true,false,currRing);
2789  }
2790  else
2791  {
2792  ring r=rCopy(currRing);
2793  BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),r,false,true,false,currRing);
2794  res->data=r;
2795  return result;
2796  }
2797 }

◆ jjPLUS_B()

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

Definition at line 784 of file iparith.cc.

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

◆ jjPLUS_B_P()

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

Definition at line 797 of file iparith.cc.

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

◆ jjPLUS_BI()

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

Definition at line 769 of file iparith.cc.

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

◆ jjPLUS_BIM()

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

Definition at line 816 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 757 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 875 of file iparith.cc.

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

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

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

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

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

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

◆ jjPLUS_S()

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

Definition at line 865 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 838 of file iparith.cc.

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

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

◆ jjPLUSMINUS_Gen()

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

Definition at line 633 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3676 of file iparith.cc.

3677 {
3678  if (IDTYP((idhdl)u->data)==INT_CMD)
3679  {
3680  int i=IDINT((idhdl)u->data);
3681  if (iiOp==PLUSPLUS) i++;
3682  else i--;
3683  IDDATA((idhdl)u->data)=(char *)(long)i;
3684  return FALSE;
3685  }
3686  return TRUE;
3687 }
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5588 of file iparith.cc.

5589 {
5590  res->data = (char *)pMaxComp((poly)v->Data());
5591  return FALSE;
5592 }

◆ jjPOWER_BI()

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

Definition at line 570 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 524 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 627 of file iparith.cc.

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

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

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

◆ jjPREIMAGE()

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

Definition at line 6420 of file iparith.cc.

6421 {
6422  // handles preimage(r,phi,i) and kernel(r,phi)
6423  idhdl h;
6424  ring rr;
6425  map mapping;
6426  BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6427 
6428  if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6429  {
6430  WerrorS("2nd/3rd arguments must have names");
6431  return TRUE;
6432  }
6433  rr=(ring)u->Data();
6434  const char *ring_name=u->Name();
6435  if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6436  {
6437  if (h->typ==MAP_CMD)
6438  {
6439  mapping=IDMAP(h);
6440  idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6441  if ((preim_ring==NULL)
6442  || (IDRING(preim_ring)!=currRing))
6443  {
6444  Werror("preimage ring `%s` is not the basering",mapping->preimage);
6445  return TRUE;
6446  }
6447  }
6448  else if (h->typ==IDEAL_CMD)
6449  {
6450  mapping=IDMAP(h);
6451  }
6452  else
6453  {
6454  Werror("`%s` is no map nor ideal",IDID(h));
6455  return TRUE;
6456  }
6457  }
6458  else
6459  {
6460  Werror("`%s` is not defined in `%s`",v->name,ring_name);
6461  return TRUE;
6462  }
6463  ideal image;
6464  if (kernel_cmd) image=idInit(1,1);
6465  else
6466  {
6467  if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6468  {
6469  if (h->typ==IDEAL_CMD)
6470  {
6471  image=IDIDEAL(h);
6472  }
6473  else
6474  {
6475  Werror("`%s` is no ideal",IDID(h));
6476  return TRUE;
6477  }
6478  }
6479  else
6480  {
6481  Werror("`%s` is not defined in `%s`",w->name,ring_name);
6482  return TRUE;
6483  }
6484  }
6485  if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6486  || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6487  {
6488  WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6489  }
6490  res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6491  if (kernel_cmd) idDelete(&image);
6492  return (res->data==NULL/* is of type ideal, should not be NULL*/);
6493 }
#define IDMAP(a)
Definition: ipid.h:135
#define IDIDEAL(a)
Definition: ipid.h:133
#define IDID(a)
Definition: ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:60
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:765
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4757 of file iparith.cc.

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

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4763 of file iparith.cc.

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

◆ jjPROC()

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

Definition at line 1607 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3753 of file iparith.cc.

3754 {
3755  return jjPROC(res,u,NULL);
3756 }
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1607

◆ jjPROC3()

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

Definition at line 5928 of file iparith.cc.

5929 {
5931  memcpy(v->next,w,sizeof(sleftv));
5932  w->Init();
5933  return jjPROC(res,u,v);
5934 }

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4769 of file iparith.cc.

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

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8518 of file iparith.cc.

8519 {
8520  if ((INPUT->Typ() != MATRIX_CMD) ||
8521  (INPUT->next->Typ() != NUMBER_CMD) ||
8522  (INPUT->next->next->Typ() != NUMBER_CMD) ||
8523  (INPUT->next->next->next->Typ() != NUMBER_CMD))
8524  {
8525  WerrorS("expected (matrix, number, number, number) as arguments");
8526  return TRUE;
8527  }
8528  leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8529  res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8530  (number)(v->Data()),
8531  (number)(w->Data()),
8532  (number)(x->Data()));
8533  return FALSE;
8534 }
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 2999 of file iparith.cc.

3000 {
3001  res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3002  hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3004  return FALSE;
3005 }
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1488

◆ jjRANDOM()

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

Definition at line 3006 of file iparith.cc.

3007 {
3008  int i=(int)(long)u->Data();
3009  int j=(int)(long)v->Data();
3010  if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3011  res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3012  return FALSE;
3013 }
int siRand()
Definition: sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6494 of file iparith.cc.

6495 {
6496  int di, k;
6497  int i=(int)(long)u->Data();
6498  int r=(int)(long)v->Data();
6499  int c=(int)(long)w->Data();
6500  if ((r<=0) || (c<=0)) return TRUE;
6501  intvec *iv = new intvec(r, c, 0);
6502  if (iv->rows()==0)
6503  {
6504  delete iv;
6505  return TRUE;
6506  }
6507  if (i!=0)
6508  {
6509  if (i<0) i = -i;
6510  di = 2 * i + 1;
6511  for (k=0; k<iv->length(); k++)
6512  {
6513  (*iv)[k] = ((siRand() % di) - i);
6514  }
6515  }
6516  res->data = (char *)iv;
6517  return FALSE;
6518 }

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4831 of file iparith.cc.

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

3015 {
3016  matrix m =(matrix)u->Data();
3017  int isRowEchelon = (int)(long)v->Data();
3018  if (isRowEchelon != 1) isRowEchelon = 0;
3019  int rank = luRank(m, isRowEchelon);
3020  res->data =(char *)(long)rank;
3021  return FALSE;
3022 }

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5560 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4838 of file iparith.cc.

4839 {
4840  return jjREAD2(res,v,NULL);
4841 }
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3023

◆ jjREAD2()

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

Definition at line 3023 of file iparith.cc.

3024 {
3025  si_link l=(si_link)u->Data();
3026  leftv r=slRead(l,v);
3027  if (r==NULL)
3028  {
3029  const char *s;
3030  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3031  else s=sNoName_fe;
3032  Werror("cannot read from `%s`",s);
3033  return TRUE;
3034  }
3035  memcpy(res,r,sizeof(sleftv));
3037  return FALSE;
3038 }

◆ jjREDUCE3_CID()

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

Definition at line 6938 of file iparith.cc.

6939 {
6940  assumeStdFlag(v);
6941  if (!idIsZeroDim((ideal)v->Data()))
6942  {
6943  Werror("`%s` must be 0-dimensional",v->Name());
6944  return TRUE;
6945  }
6946  res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
6947  (matrix)w->CopyD());
6948  return FALSE;
6949 }
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:176
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:2071

◆ jjREDUCE3_CP()

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

Definition at line 6926 of file iparith.cc.

6927 {
6928  assumeStdFlag(v);
6929  if (!idIsZeroDim((ideal)v->Data()))
6930  {
6931  Werror("`%s` must be 0-dimensional",v->Name());
6932  return TRUE;
6933  }
6934  res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
6935  (poly)w->CopyD());
6936  return FALSE;
6937 }

◆ jjREDUCE3_ID()

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

Definition at line 6957 of file iparith.cc.

6958 {
6959  assumeStdFlag(v);
6960  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
6961  0,(int)(long)w->Data());
6962  return FALSE;
6963 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3158

◆ jjREDUCE3_P()

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

Definition at line 6950 of file iparith.cc.

6951 {
6952  assumeStdFlag(v);
6953  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
6954  0,(int)(long)w->Data());
6955  return FALSE;
6956 }

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8053 of file iparith.cc.

8054 {
8055  leftv u1=u;
8056  leftv u2=u1->next;
8057  leftv u3=u2->next;
8058  leftv u4=u3->next;
8059  int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8060  int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8061  if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8062  {
8063  int save_d=Kstd1_deg;
8064  Kstd1_deg=(int)(long)u3->Data();
8065  kModW=(intvec *)u4->Data();
8066  BITSET save2;
8067  SI_SAVE_OPT2(save2);
8069  u2->next=NULL;
8070  BOOLEAN r=jjCALL2ARG(res,u);
8071  kModW=NULL;
8072  Kstd1_deg=save_d;
8073  SI_RESTORE_OPT2(save2);
8074  u->next->next=u3;
8075  return r;
8076  }
8077  else
8078  if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8079  (u4->Typ()==INT_CMD))
8080  {
8081  assumeStdFlag(u3);
8082  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8083  {
8084  WerrorS("2nd argument must be a diagonal matrix of units");
8085  return TRUE;
8086  }
8087  res->data=(char*)redNF(
8088  idCopy((ideal)u3->Data()),
8089  idCopy((ideal)u1->Data()),
8090  mp_Copy((matrix)u2->Data(), currRing),
8091  (int)(long)u4->Data()
8092  );
8093  return FALSE;
8094  }
8095  else
8096  if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8097  (u4->Typ()==INT_CMD))
8098  {
8099  poly u1p;
8100  if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8101  else u1p=(poly)u1->Data();
8102  poly u2p;
8103  if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8104  else u2p=(poly)u2->Data();
8105  assumeStdFlag(u3);
8106  if(!pIsUnit(u2p))
8107  {
8108  WerrorS("2nd argument must be a unit");
8109  return TRUE;
8110  }
8111  res->rtyp=POLY_CMD;
8112  res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8113  pCopy(u2p),(int)(long)u4->Data());
8114  return FALSE;
8115  }
8116  else
8117  {
8118  Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8119  Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8120  Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8121  return TRUE;
8122  }
8123 }
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:7090
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:49
VAR unsigned si_opt_2
Definition: options.c:6
#define SI_SAVE_OPT2(A)
Definition: options.h:22
#define SI_RESTORE_OPT2(A)
Definition: options.h:25
#define V_DEG_STOP
Definition: options.h:71
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 8124 of file iparith.cc.

8125 {
8126  leftv u1=u;
8127  leftv u2=u1->next;
8128  leftv u3=u2->next;
8129  leftv u4=u3->next;
8130  leftv u5=u4->next;
8131  if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8132  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8133  {
8134  assumeStdFlag(u3);
8135  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8136  {
8137  WerrorS("2nd argument must be a diagonal matrix of units");
8138  return TRUE;
8139  }
8140  res->data=(char*)redNF(
8141  idCopy((ideal)u3->Data()),
8142  idCopy((ideal)u1->Data()),
8143  mp_Copy((matrix)u2->Data(),currRing),
8144  (int)(long)u4->Data(),
8145  (intvec*)u5->Data()
8146  );
8147  return FALSE;
8148  }
8149  else
8150  if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8151  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8152  {
8153  assumeStdFlag(u3);
8154  if(!pIsUnit((poly)u2->Data()))
8155  {
8156  WerrorS("2nd argument must be a unit");
8157  return TRUE;
8158  }
8159  res->rtyp=POLY_CMD;
8160  res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8161  pCopy((poly)u2->Data()),
8162  (int)(long)u4->Data(),(intvec*)u5->Data());
8163  return FALSE;
8164  }
8165  else
8166  {
8167  Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8168  Tok2Cmdname(iiOp));
8169  return TRUE;
8170  }
8171 }

◆ jjREDUCE_ID()

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

Definition at line 3047 of file iparith.cc.

3048 {
3049  ideal ui=(ideal)u->Data();
3050  ideal vi=(ideal)v->Data();
3051  if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3052  assumeStdFlag(v);
3053  res->data = (char *)kNF(vi,currRing->qideal,ui);
3054  return FALSE;
3055 }

◆ jjREDUCE_P()

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

Definition at line 3039 of file iparith.cc.

3040 {
3041  ideal vi=(ideal)v->Data();
3042  if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3043  assumeStdFlag(v);
3044  res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3045  return FALSE;
3046 }

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4842 of file iparith.cc.

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

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4847 of file iparith.cc.

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

◆ jjRES()

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

Definition at line 3056 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 6965 of file iparith.cc.

6966 {
6967  int maxl=(int)v->Data();
6968  ideal u_id=(ideal)u->Data();
6969  int l=0;
6970  resolvente r;
6971  intvec **weights=NULL;
6972  int wmaxl=maxl;
6973  maxl--;
6974  unsigned save_opt=si_opt_1;
6976  if ((maxl==-1) && (iiOp!=MRES_CMD))
6977  maxl = currRing->N-1;
6978  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
6979  {
6980  intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6981  if (iv!=NULL)
6982  {
6983  l=1;
6984  if (!idTestHomModule(u_id,currRing->qideal,iv))
6985  {
6986  WarnS("wrong weights");
6987  iv=NULL;
6988  }
6989  else
6990  {
6991  weights = (intvec**)omAlloc0Bin(char_ptr_bin);
6992  weights[0] = ivCopy(iv);
6993  }
6994  }
6995  r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
6996  }
6997  else
6998  r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
6999  if (r==NULL) return TRUE;
7000  int t3=u->Typ();
7001  iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7002  si_opt_1=save_opt;
7003  return FALSE;
7004 }
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:772
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 8172 of file iparith.cc.

8173 {
8174  unsigned i=1;
8175  unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8176  if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8177  //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8178  // sArithBase.nCmdAllocated);
8179  for(i=0; i<nCount; i++)
8180  {
8181  Print("%-20s",sArithBase.sCmds[i+1].name);
8182  if(i+1+nCount<sArithBase.nCmdUsed)
8183  Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8184  if(i+1+2*nCount<sArithBase.nCmdUsed)
8185  Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8186  //if ((i%3)==1) PrintLn();
8187  PrintLn();
8188  }
8189  PrintLn();
8191  return FALSE;
8192 }
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8194 of file iparith.cc.

8195 {
8196  unsigned i=1;
8197  int l = 0;
8198  int k = 0;
8200  struct blackbox_list *bb_list = NULL;
8201  unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8202 
8203  if ((3*nCount) < sArithBase.nCmdUsed)
8204  {
8205  nCount++;
8206  }
8207  bb_list = getBlackboxTypes();
8208  // count the number of entries;
8209  for (i=0; i<nCount; i++)
8210  {
8211  l++;
8212  if (i + 1 + nCount < sArithBase.nCmdUsed)
8213  {
8214  l++;
8215  }
8216  if(i+1+2*nCount<sArithBase.nCmdUsed)
8217  {
8218  l++;
8219  }
8220  }
8221  for (i = 0; i < bb_list->count; i++)
8222  {
8223  if (bb_list->list[i] != NULL)
8224  {
8225  l++;
8226  }
8227  }
8228  // initiate list
8229  L->Init(l);
8230  k = 0;
8231  for (i=0; i<nCount; i++)
8232  {
8233  L->m[k].rtyp = STRING_CMD;
8234  L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8235  k++;
8236  // Print("%-20s", sArithBase.sCmds[i+1].name);
8237  if (i + 1 + nCount < sArithBase.nCmdUsed)
8238  {
8239  L->m[k].rtyp = STRING_CMD;
8240  L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8241  k++;
8242  // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8243  }
8244  if(i+1+2*nCount<sArithBase.nCmdUsed)
8245  {
8246  L->m[k].rtyp = STRING_CMD;
8247  L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8248  k++;
8249  // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8250  }
8251  // PrintLn();
8252  }
8253 
8254  // assign blackbox types
8255  for (i = 0; i < bb_list->count; i++)
8256  {
8257  if (bb_list->list[i] != NULL)
8258  {
8259  L->m[k].rtyp = STRING_CMD;
8260  // already used strdup in getBlackBoxTypes
8261  L->m[k].data = bb_list->list[i];
8262  k++;
8263  }
8264  }
8265  // free the struct (not the list entries itself, which were allocated
8266  // by strdup)
8267  omfree(bb_list->list);
8268  omfree(bb_list);
8269 
8270  // pass the resultant list to the res datastructure
8271  res->data=(void *)L;
8272 
8273  return FALSE;
8274 }
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition: blackbox.cc:244
void ** list
Definition: blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition: blackbox.h:84

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4809 of file iparith.cc.

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

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8647 of file iparith.cc.

8648 {
8649  int c=(int)(long)u->Data();
8650  switch(c)
8651  {
8652  case 0:{
8653  PrintS("delete all variables\n");
8654  killlocals(0);
8655  WerrorS("restarting...");
8656  break;
8657  };
8658  default: WerrorS("not implemented");
8659  }
8660  return FALSE;
8661 }
void killlocals(int v)
Definition: ipshell.cc:384

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5226 of file iparith.cc.

5227 {
5228 #if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5229  if (rIsLPRing(currRing))
5230  {
5232  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5233  ideal result;
5234  ideal v_id=(ideal)v->Data();
5235  /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5236  /* tHomog hom=testHomog; */
5237  /* if (w!=NULL) */
5238  /* { */
5239  /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5240  /* { */
5241  /* WarnS("wrong weights"); */
5242  /* w=NULL; */
5243  /* } */
5244  /* else */
5245  /* { */
5246  /* hom=isHomog; */
5247  /* w=ivCopy(w); */
5248  /* } */
5249  /* } */
5250  /* result=kStd(v_id,currRing->qideal,hom,&w); */
5251  result = rightgb(v_id, currRing->qideal);
5253  res->data = (char *)result;
5255  /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5256  return FALSE;
5257  }
5258  else if (rIsPluralRing(currRing))
5259  {
5260  ideal I=(ideal)v->Data();
5261 
5262  ring A = currRing;
5263  ring Aopp = rOpposite(A);
5264  currRing = Aopp;
5265  ideal Iopp = idOppose(A, I, Aopp);
5266  ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
5267  currRing = A;
5268  ideal J = idOppose(Aopp, Jopp, A);
5269 
5270  id_Delete(&Iopp, Aopp);
5271  id_Delete(&Jopp, Aopp);
5272  rDelete(Aopp);
5273 
5274  idSkipZeroes(J);
5275  res->data = (char *)J;
5277  return FALSE;
5278  }
5279  else
5280  {
5281  return jjSTD(res, v);
5282  }
5283 #else
5284  return TRUE;
5285 #endif
5286 }
static BOOLEAN jjSTD(leftv res, leftv v)
Definition: iparith.cc:5027
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:2419
ideal rightgb(ideal F, ideal Q)
Definition: kstd2.cc:4703
#define TEST_OPT_DEGBOUND
Definition: options.h:112
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:449
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:520

◆ jjRING3()

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

Definition at line 7006 of file iparith.cc.

7007 {
7008  res->data=(void *)rInit(u,v,w);
7009  return (res->data==NULL);
7010 }
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5634

◆ jjRING_1()

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

Definition at line 1663 of file iparith.cc.

1664 {
1665  u->next=(leftv)omAlloc(sizeof(sleftv));
1666  memcpy(u->next,v,sizeof(sleftv));
1667  v->Init();
1668  BOOLEAN bo=iiExprArithM(res,u,'[');
1669  u->next=NULL;
1670  return bo;
1671 }

◆ jjRING_2()

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

Definition at line 5935 of file iparith.cc.

5936 {
5937  u->next=(leftv)omAlloc(sizeof(sleftv));
5938  memcpy(u->next,v,sizeof(sleftv));
5939  v->Init();
5940  u->next->next=(leftv)omAlloc(sizeof(sleftv));
5941  memcpy(u->next->next,w,sizeof(sleftv));
5942  w->Init();
5943  BOOLEAN bo=iiExprArithM(res,u,'[');
5944  u->next=NULL;
5945  return bo;
5946 }

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4874 of file iparith.cc.

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

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8618 of file iparith.cc.

8619 {
8620  //Print("construct ring\n");
8621  if (a->Typ()!=CRING_CMD)
8622  {
8623  WerrorS("expected `cring` [ `id` ... ]");
8624  return TRUE;
8625  }
8626  assume(a->next!=NULL);
8627  leftv names=a->next;
8628  int N=names->listLength();
8629  char **n=(char**)omAlloc0(N*sizeof(char*));
8630  for(int i=0; i<N;i++,names=names->next)
8631  {
8632  n[i]=(char *)names->Name();
8633  }
8634  coeffs cf=(coeffs)a->CopyD();
8635  res->data=rDefault(cf,N,n, ringorder_dp);
8636  omFreeSize(n,N*sizeof(char*));
8637  return FALSE;
8638 }
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102
@ ringorder_dp
Definition: ring.h:78
@ CRING_CMD
Definition: tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4852 of file iparith.cc.

4853 {
4854  ring r=(ring)v->Data();
4855  if (r!=NULL)
4856  {
4857  res->data = (char *)rDecompose((ring)v->Data());
4858  if (res->data!=NULL)
4859  {
4860  long mm=r->wanted_maxExp;
4861  if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4862  return FALSE;
4863  }
4864  }
4865  return TRUE;
4866 }
lists rDecompose(const ring r)
Definition: ipshell.cc:2082

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4867 of file iparith.cc.

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

◆ jjRMINUS()

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

Definition at line 3211 of file iparith.cc.

3212 {
3213  ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3214  res->data = (char *)r;
3215  return r==NULL;
3216 }
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition: ring.cc:5871

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5603 of file iparith.cc.

5604 {
5605  res->data = rOrdStr((ring)v->Data());
5606  return FALSE;
5607 }
char * rOrdStr(ring r)
Definition: ring.cc:523

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4881 of file iparith.cc.

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

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4887 of file iparith.cc.

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

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4892 of file iparith.cc.

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

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4897 of file iparith.cc.

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

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5613 of file iparith.cc.

5614 {
5615  res->data = rParStr((ring)v->Data());
5616  return FALSE;
5617 }
char * rParStr(ring r)
Definition: ring.cc:650

◆ jjRPLUS()

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

Definition at line 3217 of file iparith.cc.

3218 {
3219  int left;
3220  if (u->Typ()==RING_CMD) left=0;
3221  else
3222  {
3223  leftv h=u;u=v;v=h;
3224  left=1;
3225  }
3226  ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3227  res->data = (char *)r;
3228  return r==NULL;
3229 }
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5789

◆ jjRSUM()

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

Definition at line 3230 of file iparith.cc.

3231 {
3232  ring r;
3233  int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3234  res->data = (char *)r;
3235  return (i==-1);
3236 }
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1347

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5608 of file iparith.cc.

5609 {
5610  res->data = rVarStr((ring)v->Data());
5611  return FALSE;
5612 }
char * rVarStr(ring r)
Definition: ring.cc:624

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 4902 of file iparith.cc.

4903 {
4904  res->data = (char *)(long)atoi((char*)v->Data());
4905  return FALSE;
4906 }

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 4949 of file iparith.cc.

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

◆ jjSBA_1()

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

Definition at line 4975 of file iparith.cc.

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

◆ jjSBA_2()

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

Definition at line 5001 of file iparith.cc.

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

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3733 of file iparith.cc.

3734 {
3735  if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3736  else
3737  {
3738  ring r=(ring)u->Data();
3739  idhdl h=rFindHdl(r,NULL);
3740  if (h==NULL)
3741  {
3742  char name_buffer[100];
3743  STATIC_VAR int ending=1000000;
3744  ending++;
3745  sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3746  h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3747  IDRING(h)=rIncRefCnt(r);
3748  }
3749  rSetHdl(h);
3750  }
3751  return FALSE;
3752 }
#define STATIC_VAR
Definition: globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1632
void rSetHdl(idhdl h)
Definition: ipshell.cc:5135

◆ jjSIMPL_ID()

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

Definition at line 3244 of file iparith.cc.

3245 {
3246  int sw = (int)(long)v->Data();
3247  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3248  ideal id = (ideal)u->CopyD(IDEAL_CMD);
3249  if (sw & SIMPL_LMDIV)
3250  {
3251  id_DelDiv(id,currRing);
3252  }
3253  if (sw & SIMPL_LMEQ)
3254  {
3256  }
3257  if (sw & SIMPL_MULT)
3258  {
3260  }
3261  else if(sw & SIMPL_EQU)
3262  {
3263  id_DelEquals(id,currRing);
3264  }
3265  if (sw & SIMPL_NULL)
3266  {
3267  idSkipZeroes(id);
3268  }
3269  if (sw & SIMPL_NORM)
3270  {
3271  id_Norm(id,currRing);
3272  }
3273  if (sw & SIMPL_NORMALIZE)
3274  {
3275  id_Normalize(id,currRing);
3276  }
3277  res->data = (char * )id;
3278  return FALSE;
3279 }
#define SIMPL_EQU
Definition: iparith.cc:3241
#define SIMPL_NORM
Definition: iparith.cc:3243
#define SIMPL_LMEQ
Definition: iparith.cc:3239
#define SIMPL_NULL
Definition: iparith.cc:3242
#define SIMPL_MULT
Definition: iparith.cc:3240
#define SIMPL_NORMALIZE
Definition: iparith.cc:3237
#define SIMPL_LMDIV
Definition: iparith.cc:3238
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
void id_Normalize(ideal I, const ring r)
normialize all polys in id
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.

◆ jjSIMPL_P()

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

Definition at line 3339 of file iparith.cc.

3340 {
3341  int sw = (int)(long)v->Data();
3342  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3343  poly p = (poly)u->CopyD(POLY_CMD);
3344  if (sw & SIMPL_NORM)
3345  {
3346  pNorm(p);
3347  }
3348  if (sw & SIMPL_NORMALIZE)
3349  {
3351  }
3352  res->data = (char * )p;
3353  return FALSE;
3354 }
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3842
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:363

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4907 of file iparith.cc.

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

◆ jjSMATRIX_Mo()

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

Definition at line 6846 of file iparith.cc.

6847 {
6848  int mi=(int)(long)v->Data();
6849  int ni=(int)(long)w->Data();
6850  if ((mi<0)||(ni<1))
6851  {
6852  Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6853  return TRUE;
6854  }
6855  res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6856  mi,ni,currRing);
6857  return FALSE;
6858 }
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 5055 of file iparith.cc.

5056 {
5057  res->data = (char *)idSort((ideal)v->Data());
5058  return FALSE;
5059 }
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:184

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10156 of file iparith.cc.

10157 {
10158  lists l=(lists)arg->Data();
10159  if (l->nr>0)
10160  {
10161  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10162  }
10163  return FALSE;
10164 }
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:10115

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5060 of file iparith.cc.

5061 {
5063  intvec *v=NULL;
5064  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5065  if (f==NULL) return TRUE;
5066  ivTest(v);
5068  l->Init(2);
5069  l->m[0].rtyp=IDEAL_CMD;
5070  l->m[0].data=(void *)f;
5071  l->m[1].rtyp=INTVEC_CMD;
5072  l->m[1].data=(void *)v;
5073  res->data=(void *)l;
5074  return FALSE;
5075 }
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1304

◆ jjSQR_FREE2()

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

Definition at line 3281 of file iparith.cc.

3282 {
3283  intvec *v=NULL;
3284  int sw=(int)(long)dummy->Data();
3285  int fac_sw=sw;
3286  if (sw<0) fac_sw=1;
3288  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3289  if (f==NULL)
3290  return TRUE;
3291  switch(sw)
3292  {
3293  case 0:
3294  case 2:
3295  {
3297  l->Init(2);
3298  l->m[0].rtyp=IDEAL_CMD;
3299  l->m[0].data=(void *)f;
3300  l->m[1].rtyp=INTVEC_CMD;
3301  l->m[1].data=(void *)v;
3302  res->data=(void *)l;
3303  res->rtyp=LIST_CMD;
3304  return FALSE;
3305  }
3306  case 1:
3307  res->data=(void *)f;
3308  return FALSE;
3309  case 3:
3310  {
3311  poly p=f->m[0];
3312  int i=IDELEMS(f);
3313  f->m[0]=NULL;
3314  while(i>1)
3315  {
3316  i--;
3317  p=pMult(p,f->m[i]);
3318  f->m[i]=NULL;
3319  }
3320  res->data=(void *)p;
3321  res->rtyp=POLY_CMD;
3322  }
3323  return FALSE;
3324  }
3325  WerrorS("invalid switch");
3326  return FALSE;
3327 }

◆ jjSTATUS2()

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

Definition at line 3328 of file iparith.cc.

3329 {
3330  res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3331  return FALSE;
3332 }

◆ jjSTATUS2L()

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

Definition at line 3333 of file iparith.cc.

3334 {
3335  res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3336  //return (res->data== (void*)(long)-2);
3337  return FALSE;
3338 }

◆ jjSTATUS3()

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

Definition at line 7011 of file iparith.cc.

7012 {
7013  int yes;
7014  jjSTATUS2(res, u, v);
7015  yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7016  omFree((ADDRESS) res->data);
7017  res->data = (void *)(long)yes;
7018  return FALSE;
7019 }
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3328

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8460 of file iparith.cc.

8461 {
8462  if ((v->Typ() != LINK_CMD) ||
8463  (v->next->Typ() != STRING_CMD) ||
8464  (v->next->next->Typ() != STRING_CMD) ||
8465  (v->next->next->next->Typ() != INT_CMD))
8466  return TRUE;
8467  jjSTATUS3(res, v, v->next, v->next->next);
8468 #if defined(HAVE_USLEEP)
8469  if (((long) res->data) == 0L)
8470  {
8471  int i_s = (int)(long) v->next->next->next->Data();
8472  if (i_s > 0)
8473  {
8474  usleep((int)(long) v->next->next->next->Data());
8475  jjSTATUS3(res, v, v->next, v->next->next);
8476  }
8477  }
8478 #elif defined(HAVE_SLEEP)
8479  if (((int) res->data) == 0)
8480  {
8481  int i_s = (int) v->next->next->next->Data();
8482  if (i_s > 0)
8483  {
8484  si_sleep((is - 1)/1000000 + 1);
8485  jjSTATUS3(res, v, v->next, v->next->next);
8486  }
8487  }
8488 #endif
8489  return FALSE;
8490 }
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:7011
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5027 of file iparith.cc.

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

◆ jjSTD_1()

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

Definition at line 3381 of file iparith.cc.

3382 {
3383  ideal result;
3384  assumeStdFlag(u);
3385  ideal i1=(ideal)(u->Data());
3386  int ii1=idElem(i1); /* size of i1 */
3387  ideal i0;
3388  int r=v->Typ();
3389  if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3390  {
3391  poly p=(poly)v->Data();
3392  i0=idInit(1,i1->rank);
3393  i0->m[0]=p;
3394  i1=idSimpleAdd(i1,i0); //
3395  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3396  idDelete(&i0);
3397  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3398  tHomog hom=testHomog;
3399 
3400  if (w!=NULL)
3401  {
3402  if (!idTestHomModule(i1,currRing->qideal,w))
3403  {
3404  // no warnung: this is legal, if i in std(i,p)
3405  // is homogeneous, but p not
3406  w=NULL;
3407  }
3408  else
3409  {
3410  w=ivCopy(w);
3411  hom=isHomog;
3412  }
3413  }
3414  BITSET save1;
3415  SI_SAVE_OPT1(save1);
3417  /* ii1 appears to be the position of the first element of il that
3418  does not belong to the old SB ideal */
3419  result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3420  SI_RESTORE_OPT1(save1);
3421  idDelete(&i1);
3423  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3424  res->data = (char *)result;
3425  }
3426  else /*IDEAL/MODULE*/
3427  {
3428  i0=(ideal)v->CopyD();
3429  i1=idSimpleAdd(i1,i0); //
3430  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3431  idDelete(&i0);
3432  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3433  tHomog hom=testHomog;
3434 
3435  if (w!=NULL)
3436  {
3437  if (!idTestHomModule(i1,currRing->qideal,w))
3438  {
3439  // no warnung: this is legal, if i in std(i,p)
3440  // is homogeneous, but p not
3441  w=NULL;
3442  hom=isNotHomog;
3443  }
3444  else
3445  {
3446  w=ivCopy(w);
3447  hom=isHomog;
3448  }
3449  }
3450  BITSET save1;
3451  SI_SAVE_OPT1(save1);
3453  /* ii1 appears to be the position of the first element of i1 that
3454  does not belong to the old SB ideal */
3455  result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3456  SI_RESTORE_OPT1(save1);
3457  idDelete(&i1);
3459  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3460  res->data = (char *)result;
3461  }
3463  return FALSE;
3464 }
#define OPT_SB_1
Definition: options.h:94
#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 3355 of file iparith.cc.

3356 {
3357  ideal result;
3358  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3359  tHomog hom=testHomog;
3360  ideal u_id=(ideal)(u->Data());
3361  if (w!=NULL)
3362  {
3363  if (!idTestHomModule(u_id,currRing->qideal,w))
3364  {
3365  WarnS("wrong weights:");w->show();PrintLn();
3366  w=NULL;
3367  }
3368  else
3369  {
3370  w=ivCopy(w);
3371  hom=isHomog;
3372  }
3373  }
3374  result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3376  res->data = (char *)result;
3377  setFlag(res,FLAG_STD);
3378  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3379  return FALSE;
3380 }

◆ jjSTD_HILB_W()

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

Definition at line 7020 of file iparith.cc.

7021 {
7022  intvec *vw=(intvec *)w->Data(); // weights of vars
7023  if (vw->length()!=currRing->N)
7024  {
7025  Werror("%d weights for %d variables",vw->length(),currRing->N);
7026  return TRUE;
7027  }
7028  ideal result;
7029  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7030  tHomog hom=testHomog;
7031  ideal u_id=(ideal)(u->Data());
7032  if (ww!=NULL)
7033  {
7034  if (!idTestHomModule(u_id,currRing->qideal,ww))
7035  {
7036  WarnS("wrong weights");
7037  ww=NULL;
7038  }
7039  else
7040  {
7041  ww=ivCopy(ww);
7042  hom=isHomog;
7043  }
7044  }
7045  result=kStd(u_id,
7046  currRing->qideal,
7047  hom,
7048  &ww, // module weights
7049  (intvec *)v->Data(), // hilbert series
7050  0,0, // syzComp, newIdeal
7051  vw); // weights of vars
7053  res->data = (char *)result;
7054  setFlag(res,FLAG_STD);
7055  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7056  return FALSE;
7057 }

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8535 of file iparith.cc.

8536 { ideal result;
8537  leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8538  leftv v = u->next; /* one additional polynomial or ideal */
8539  leftv h = v->next; /* Hilbert vector */
8540  leftv w = h->next; /* weight vector */
8541  assumeStdFlag(u);
8542  ideal i1=(ideal)(u->Data());
8543  ideal i0;
8544  if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8545  || (h->Typ()!=INTVEC_CMD)
8546  || (w->Typ()!=INTVEC_CMD))
8547  {
8548  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8549  return TRUE;
8550  }
8551  intvec *vw=(intvec *)w->Data(); // weights of vars
8552  /* merging std_hilb_w and std_1 */
8553  if (vw->length()!=currRing->N)
8554  {
8555  Werror("%d weights for %d variables",vw->length(),currRing->N);
8556  return TRUE;
8557  }
8558  int r=v->Typ();
8559  BOOLEAN cleanup_i0=FALSE;
8560  if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8561  {
8562  i0=idInit(1,i1->rank);
8563  i0->m[0]=(poly)v->Data();
8564  cleanup_i0=TRUE;
8565  }
8566  else if (r==IDEAL_CMD)/* IDEAL */
8567  {
8568  i0=(ideal)v->Data();
8569  }
8570  else
8571  {
8572  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8573  return TRUE;
8574  }
8575  int ii0=idElem(i0);
8576  i1 = idSimpleAdd(i1,i0);
8577  if (cleanup_i0)
8578  {
8579  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8580  idDelete(&i0);
8581  }
8582  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8583  tHomog hom=testHomog;
8584  /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8585  if (ww!=NULL)
8586  {
8587  if (!idTestHomModule(i1,currRing->qideal,ww))
8588  {
8589  WarnS("wrong weights");
8590  ww=NULL;
8591  }
8592  else
8593  {
8594  ww=ivCopy(ww);
8595  hom=isHomog;
8596  }
8597  }
8598  BITSET save1;
8599  SI_SAVE_OPT1(save1);
8601  result=kStd(i1,
8602  currRing->qideal,
8603  hom,
8604  &ww, // module weights
8605  (intvec *)h->Data(), // hilbert series
8606  0, // syzComp, whatever it is...
8607  IDELEMS(i1)-ii0, // new ideal
8608  vw); // weights of vars
8609  SI_RESTORE_OPT1(save1);
8610  idDelete(&i1);
8612  res->data = (char *)result;
8614  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8615  return FALSE;
8616 }

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8275 of file iparith.cc.

8276 {
8277  if (v == NULL)
8278  {
8279  res->data = omStrDup("");
8280  return FALSE;
8281  }
8282  int n = v->listLength();
8283  if (n == 1)
8284  {
8285  res->data = v->String();
8286  return FALSE;
8287  }
8288 
8289  char** slist = (char**) omAlloc(n*sizeof(char*));
8290  int i, j;
8291 
8292  for (i=0, j=0; i<n; i++, v = v ->next)
8293  {
8294  slist[i] = v->String();
8295  assume(slist[i] != NULL);
8296  j+=strlen(slist[i]);
8297  }
8298  char* s = (char*) omAlloc((j+1)*sizeof(char));
8299  *s='\0';
8300  for (i=0;i<n;i++)
8301  {
8302  strcat(s, slist[i]);
8303  omFree(slist[i]);
8304  }
8305  omFreeSize(slist, n*sizeof(char*));
8306  res->data = s;
8307  return FALSE;
8308 }

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5535 of file iparith.cc.

5536 {
5537  res->data = (char *)strlen((char *)v->Data());
5538  return FALSE;
5539 }

◆ jjSUBST_Bu()

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

Definition at line 6569 of file iparith.cc.

6570 {
6571  // generic conversion from polyBucket to poly:
6572  // force this to be the first try everytime
6573  poly p; int l;
6574  sBucket_pt bu=(sBucket_pt)w->CopyD();
6575  sBucketDestroyAdd(bu,&p,&l);
6576  sleftv tmpw;
6577  tmpw.Init();
6578  tmpw.rtyp=POLY_CMD;
6579  tmpw.data=p;
6580  return iiExprArith3(res, iiOp, u, v, &tmpw);
6581 }

◆ jjSUBST_Id()

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

Definition at line 6614 of file iparith.cc.

6615 {
6616  int ringvar;
6617  poly monomexpr;
6618  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6619  if (nok) return TRUE;
6620  ideal id=(ideal)u->Data();
6621  if (ringvar>0)
6622  {
6623  BOOLEAN overflow=FALSE;
6624  if (monomexpr!=NULL)
6625  {
6626  long deg_monexp=pTotaldegree(monomexpr);
6627  for(int i=IDELEMS(id)-1;i>=0;i--)
6628  {
6629  poly p=id->m[i];
6630  int mm=p_MaxExpPerVar(p,ringvar,currRing);
6631  if ((p!=NULL) && (mm!=0) &&
6632  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6633  {
6634  overflow=TRUE;
6635  break;
6636  }
6637  }
6638  }
6639  if (overflow)
6640  Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6641  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6642  {
6643  if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6644  else id=id_Copy(id,currRing);
6645  res->data = id_Subst(id, ringvar, monomexpr, currRing);
6646  }
6647  else
6648  res->data = idSubstPoly(id,ringvar,monomexpr);
6649  }
6650  else
6651  {
6652  if (rIsLPRing(currRing))
6653  {
6654  WerrorS("Substituting parameters not implemented for Letterplace rings.");
6655  return TRUE;
6656  }
6657  res->data = idSubstPar(id,-ringvar,monomexpr);
6658  }
6659  return FALSE;
6660 }
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static BOOLEAN jjSUBST_Test(leftv v, leftv w, int &ringvar, poly &monomexpr)
Definition: iparith.cc:6541
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:411
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:372
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition: p_polys.cc:5017
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 6664 of file iparith.cc.

6665 {
6666  return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6667 }
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6672

◆ jjSUBST_Id_N()

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

Definition at line 6668 of file iparith.cc.

6669 {
6670  return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6671 }

◆ jjSUBST_Id_X()

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

Definition at line 6672 of file iparith.cc.

6673 {
6674  sleftv tmp;
6675  tmp.Init();
6676  // do not check the result, conversion from int/number to poly works always
6677  iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6678  BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6679  tmp.CleanUp();
6680  return b;
6681 }
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6614

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8491 of file iparith.cc.

8492 {
8493  leftv v = u->next; // number of args > 0
8494  if (v==NULL) return TRUE;
8495  leftv w = v->next;
8496  if (w==NULL) return TRUE;
8497  leftv rest = w->next;
8498 
8499  u->next = NULL;
8500  v->next = NULL;
8501  w->next = NULL;
8502  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8503  if ((rest!=NULL) && (!b))
8504  {
8505  leftv tmp_next=res->next;
8506  res->next=rest;
8507  sleftv tmp_res;
8508  tmp_res.Init();
8509  b = iiExprArithM(&tmp_res,res,iiOp);
8510  memcpy(res,&tmp_res,sizeof(tmp_res));
8511  res->next=tmp_next;
8512  }
8513  u->next = v;
8514  v->next = w;
8515  // rest was w->next, but is already cleaned
8516  return b;
8517 }

◆ jjSUBST_P()

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

Definition at line 6582 of file iparith.cc.

6583 {
6584  int ringvar;
6585  poly monomexpr;
6586  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6587  if (nok) return TRUE;
6588  poly p=(poly)u->Data();
6589  if (ringvar>0)
6590  {
6591  int mm=p_MaxExpPerVar(p,ringvar,currRing);
6592  if ((monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6593  ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6594  {
6595  Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6596  //return TRUE;
6597  }
6598  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6599  res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6600  else
6601  res->data= pSubstPoly(p,ringvar,monomexpr);
6602  }
6603  else
6604  {
6605  if (rIsLPRing(currRing))
6606  {
6607  WerrorS("Substituting parameters not implemented for Letterplace rings.");
6608  return TRUE;
6609  }
6610  res->data=pSubstPar(p,-ringvar,monomexpr);
6611  }
6612  return FALSE;
6613 }
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:389
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:252

◆ jjSUBST_Test()

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

Definition at line 6541 of file iparith.cc.

6543 {
6544  monomexpr=(poly)w->Data();
6545  poly p=(poly)v->Data();
6546 #if 0
6547  if (pLength(monomexpr)>1)
6548  {
6549  Werror("`%s` substitutes a ringvar only by a term",
6551  return TRUE;
6552  }
6553 #endif
6554  if ((ringvar=pVar(p))==0)
6555  {
6556  if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6557  {
6558  number n = pGetCoeff(p);
6559  ringvar= -n_IsParam(n, currRing);
6560  }
6561  if(ringvar==0)
6562  {
6563  WerrorS("ringvar/par expected");
6564  return TRUE;
6565  }
6566  }
6567  return FALSE;
6568 }
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5768
@ SUBST_CMD
Definition: tok.h:186

◆ jjSYZ_2()

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

Definition at line 3465 of file iparith.cc.

3466 {
3467  // see jjSYZYGY
3468  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3469  intvec *w=NULL;
3470  tHomog hom=testHomog;
3471  ideal I=(ideal)u->Data();
3472  GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3473  if (ww!=NULL)
3474  {
3475  if (idTestHomModule(I,currRing->qideal,ww))
3476  {
3477  w=ivCopy(ww);
3478  int add_row_shift=w->min_in();
3479  (*w)-=add_row_shift;
3480  hom=isHomog;
3481  }
3482  else
3483  {
3484  //WarnS("wrong weights");
3485  delete ww; ww=NULL;
3486  hom=testHomog;
3487  }
3488  }
3489  else
3490  {
3491  if (u->Typ()==IDEAL_CMD)
3492  if (idHomIdeal(I,currRing->qideal))
3493  hom=isHomog;
3494  }
3495  ideal S=idSyzygies(I,hom,&w,TRUE,FALSE,NULL,alg);
3496  if (w!=NULL) delete w;
3497  res->data = (char *)S;
3498  if (hom==isHomog)
3499  {
3500  int vl=S->rank;
3501  intvec *vv=new intvec(vl);
3502  if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3503  {
3504  for(int i=0;i<vl;i++)
3505  {
3506  if (I->m[i]!=NULL)
3507  (*vv)[i]=p_Deg(I->m[i],currRing);
3508  }
3509  }
3510  else
3511  {
3512  p_SetModDeg(ww, currRing);
3513  for(int i=0;i<vl;i++)
3514  {
3515  if (I->m[i]!=NULL)
3516  (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3517  }
3519  }
3520  if (idTestHomModule(S,currRing->qideal,vv))
3521  atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3522  else
3523  delete vv;
3524  }
3526  return FALSE;
3527 }
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:830
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3743
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:582

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5087 of file iparith.cc.

5088 {
5089  ideal v_id=(ideal)v->Data();
5090 #ifdef HAVE_SHIFTBBA
5091  if (rIsLPRing(currRing))
5092  {
5093  if (currRing->LPncGenCount < IDELEMS(v_id))
5094  {
5095  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5096  return TRUE;
5097  }
5098  }
5099 #endif
5100  intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5101  intvec *w=NULL;
5102  tHomog hom=testHomog;
5103  if (ww!=NULL)
5104  {
5105  if (idTestHomModule(v_id,currRing->qideal,ww))
5106  {
5107  w=ivCopy(ww);
5108  int add_row_shift=w->min_in();
5109  (*w)-=add_row_shift;
5110  hom=isHomog;
5111  }
5112  else
5113  {
5114  //WarnS("wrong weights");
5115  delete ww; ww=NULL;
5116  hom=testHomog;
5117  }
5118  }
5119  else
5120  {
5121  if (v->Typ()==IDEAL_CMD)
5122  if (idHomIdeal(v_id,currRing->qideal))
5123  hom=isHomog;
5124  }
5125  ideal S=idSyzygies(v_id,hom,&w);
5126  res->data = (char *)S;
5127  if (hom==isHomog)
5128  {
5129  int vl=S->rank;
5130  intvec *vv=new intvec(vl);
5131  if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5132  {
5133  for(int i=0;i<vl;i++)
5134  {
5135  if (v_id->m[i]!=NULL)
5136  (*vv)[i]=p_Deg(v_id->m[i],currRing);
5137  }
5138  }
5139  else
5140  {
5141  p_SetModDeg(ww, currRing);
5142  for(int i=0;i<vl;i++)
5143  {
5144  if (v_id->m[i]!=NULL)
5145  (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5146  }
5148  }
5149  if (idTestHomModule(S,currRing->qideal,vv))
5150  atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5151  else
5152  delete vv;
5153  }
5154  if (w!=NULL) delete w;
5155  return FALSE;
5156 }

◆ jjTENSOR()

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

Definition at line 3528 of file iparith.cc.

3529 {
3530  ideal A=(ideal)u->Data();
3531  ideal B=(ideal)v->Data();
3532  res->data = (char *)sm_Tensor(A,B,currRing);
3533  return FALSE;
3534 }
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 3535 of file iparith.cc.

3536 {
3537  sleftv tmp_u,tmp_v,tmp_res;
3541  tmp_res.Init();
3542  tmp_res.rtyp=SMATRIX_CMD;
3543  BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3544  if (!bo)
3545  {
3548  }
3549  tmp_u.CleanUp();
3550  tmp_v.CleanUp();
3551  tmp_res.CleanUp();
3552  return bo;
3553 }
@ SMATRIX_CMD
Definition: grammar.cc:291
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition: iparith.cc:3528
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 8309 of file iparith.cc.

8310 {
8311  do
8312  {
8313  if (v->Typ()!=INT_CMD)
8314  return TRUE;
8315  test_cmd((int)(long)v->Data());
8316  v=v->next;
8317  }
8318  while (v!=NULL);
8319  return FALSE;
8320 }
void test_cmd(int i)
Definition: ipshell.cc:512

◆ jjTIMES_BI()

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

Definition at line 992 of file iparith.cc.

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

◆ jjTIMES_BIM()

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

Definition at line 1073 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 980 of file iparith.cc.

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

◆ jjTIMES_ID()

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

Definition at line 1054 of file iparith.cc.

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

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

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

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

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

◆ jjTIMES_MA_I1()

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

Definition at line 1128 of file iparith.cc.

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

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

◆ jjTIMES_MA_N1()

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

Definition at line 1117 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1124 of file iparith.cc.

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

◆ jjTIMES_MA_P1()

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

Definition at line 1099 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1108 of file iparith.cc.

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

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

◆ jjTIMES_P()

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

Definition at line 1009 of file iparith.cc.

1010 {
1011  poly a;
1012  poly b;
1013  if (v->next==NULL)
1014  {
1015  if (u->next==NULL)
1016  {
1017  a=(poly)u->Data(); // works also for VECTOR_CMD
1018  b=(poly)v->Data(); // works also for VECTOR_CMD
1019  if ((a!=NULL) && (b!=NULL)
1020  && ((long)pTotaldegree(a)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)-(long)pTotaldegree(b)))
1021  {
1022  Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
1023  pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
1024  }
1025  res->data = (char *)(pp_Mult_qq( a, b, currRing));
1026  return FALSE;
1027  }
1028  // u->next exists: copy v
1029  a=(poly)u->CopyD(POLY_CMD); // works also for VECTOR_CMD
1030  b=pCopy((poly)v->Data());
1031  if ((a!=NULL) && (b!=NULL)
1032  && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)))
1033  {
1034  Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
1035  pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
1036  }
1037  res->data = (char *)(pMult( a, b));
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  return jjOP_REST(res,u,v);
1053 }
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1111

◆ jjTIMES_SM()

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

Definition at line 1151 of file iparith.cc.

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

5159 {
5160  res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5161  return FALSE;
5162 }
int ivTrace(intvec *o)
Definition: intvec.cc:321

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5163 of file iparith.cc.

5164 {
5165  res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5166  return FALSE;
5167 }

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5168 of file iparith.cc.

5169 {
5170  res->data = (char *)ivTranp((intvec*)(v->Data()));
5171  return FALSE;
5172 }
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5207 of file iparith.cc.

5208 {
5209 #ifdef HAVE_PLURAL
5210  ideal result;
5211  ideal v_id=(ideal)a->Data();
5212  if (rIsPluralRing(currRing))
5213  result=(ideal)twostd(v_id);
5214  else /*commutative or shiftalgebra*/
5215  {
5216  return jjSTD(res,a);
5217  }
5218  res->data = (char *)result;
5219  setFlag(res,FLAG_STD);
5221  return FALSE;
5222 #else
5223  return TRUE;
5224 #endif
5225 }
#define FLAG_TWOSTD
Definition: ipid.h:107
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18

◆ jjTYPEOF()

static BOOLEAN jjTYPEOF ( leftv  res,
leftv  v 
)
static

Definition at line 5287 of file iparith.cc.

5288 {
5289  int t=(int)(long)v->data;
5290  switch (t)
5291  {
5292  case CRING_CMD:
5293  case INT_CMD:
5294  case POLY_CMD:
5295  case VECTOR_CMD:
5296  case STRING_CMD:
5297  case INTVEC_CMD:
5298  case IDEAL_CMD:
5299  case MATRIX_CMD:
5300  case MODUL_CMD:
5301  case MAP_CMD:
5302  case PROC_CMD:
5303  case RING_CMD:
5304  case SMATRIX_CMD:
5305  //case QRING_CMD:
5306  case INTMAT_CMD:
5307  case BIGINTMAT_CMD:
5308  case NUMBER_CMD:
5309  #ifdef SINGULAR_4_2
5310  case CNUMBER_CMD:
5311  #endif
5312  case BIGINT_CMD:
5313  case BUCKET_CMD:
5314  case LIST_CMD:
5315  case PACKAGE_CMD:
5316  case LINK_CMD:
5317  case RESOLUTION_CMD:
5318  res->data=omStrDup(Tok2Cmdname(t)); break;
5319  case DEF_CMD:
5320  case NONE: res->data=omStrDup("none"); break;
5321  default:
5322  {
5323  if (t>MAX_TOK)
5324  res->data=omStrDup(getBlackboxName(t));
5325  else
5326  res->data=omStrDup("?unknown type?");
5327  break;
5328  }
5329  }
5330  return FALSE;
5331 }
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition: blackbox.cc:212
@ CNUMBER_CMD
Definition: tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3688 of file iparith.cc.

3689 {
3690  number n=(number)u->CopyD(BIGINT_CMD);
3691  n=n_InpNeg(n,coeffs_BIGINT);
3692  res->data = (char *)n;
3693  return FALSE;
3694 }
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:558

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3725 of file iparith.cc.

3726 {
3727  bigintmat *bim=(bigintmat *)u->CopyD(BIGINTMAT_CMD);
3728  (*bim)*=(-1);
3729  res->data = (char *)bim;
3730  return FALSE;
3731 }

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3695 of file iparith.cc.

3696 {
3697  res->data = (char *)(-(long)u->Data());
3698  return FALSE;
3699 }

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3718 of file iparith.cc.

3719 {
3720  intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3721  (*iv)*=(-1);
3722  res->data = (char *)iv;
3723  return FALSE;
3724 }

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3712 of file iparith.cc.

3713 {
3714  poly m1=pISet(-1);
3715  res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3716  return FALSE;
3717 }
#define pISet(i)
Definition: polys.h:312

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3700 of file iparith.cc.

3701 {
3702  number n=(number)u->CopyD(NUMBER_CMD);
3703  n=nInpNeg(n);
3704  res->data = (char *)n;
3705  return FALSE;
3706 }
#define nInpNeg(n)
Definition: numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3707 of file iparith.cc.

3708 {
3709  res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3710  return FALSE;
3711 }

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10165 of file iparith.cc.

10166 {
10167  lists l=(lists)arg->Data();
10168  if (l->nr>0)
10169  {
10170  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10171  int i, j, len;
10172  len=l->nr;
10173  i=0;
10174  while(i<len)
10175  {
10176  if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10177  {
10178  l->m[i].CleanUp();
10179  for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10180  memset(&(l->m[len]),0,sizeof(sleftv));
10181  l->m[len].rtyp=DEF_CMD;
10182  len--;
10183  }
10184  else
10185  i++;
10186  }
10187  //Print("new len:%d\n",len);
10188  }
10189  return FALSE;
10190 }

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5332 of file iparith.cc.

5333 {
5334  res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5335  return FALSE;
5336 }
#define pIsUnivariate(p)
Definition: polys.h:249

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5337 of file iparith.cc.

5338 {
5339  int i=(int)(long)v->Data();
5340  if ((0<i) && (i<=currRing->N))
5341  {
5342  poly p=pOne();
5343  pSetExp(p,i,1);
5344  pSetm(p);
5345  res->data=(char *)p;
5346  }
5347  else
5348  {
5349  Werror("var number %d out of range 1..%d",i,currRing->N);
5350  return TRUE;
5351  }
5352  return FALSE;
5353 }

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5354 of file iparith.cc.

5355 {
5356  if (currRing==NULL)
5357  {
5358  WerrorS("no ring active (2)");
5359  return TRUE;
5360  }
5361  int i=(int)(long)v->Data();
5362  if ((0<i) && (i<=currRing->N))
5363  res->data=omStrDup(currRing->names[i-1]);
5364  else
5365  {
5366  Werror("var number %d out of range 1..%d",i,currRing->N);
5367  return TRUE;
5368  }
5369  return FALSE;
5370 }

◆ jjVARSTR2()

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

Definition at line 3554 of file iparith.cc.

3555 {
3556  idhdl h=(idhdl)u->data;
3557  int i=(int)(long)v->Data();
3558  if ((0<i) && (i<=IDRING(h)->N))
3559  res->data=omStrDup(IDRING(h)->names[i-1]);
3560  else
3561  {
3562  Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3563  return TRUE;
3564  }
3565  return FALSE;
3566 }

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5371 of file iparith.cc.

5372 {
5373  assumeStdFlag(v);
5374 #ifdef HAVE_SHIFTBBA
5375  if (rIsLPRing(currRing))
5376  {
5377 #ifdef HAVE_RINGS
5378  if (rField_is_Ring(currRing))
5379  {
5380  WerrorS("`vdim` is not implemented for letterplace rings over rings");
5381  return TRUE;
5382  }
5383 #endif
5384  if (currRing->qideal != NULL)
5385  {
5386  WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5387  return TRUE;
5388  }
5389  int kDim = lp_kDim((ideal)(v->Data()));
5390  res->data = (char *)(long)kDim;
5391  return (kDim == -2);
5392  }
5393 #endif
5394  res->data = (char *)(long)scMult0Int((ideal)v->Data(),currRing->qideal);
5395  return FALSE;
5396 }
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:992
int lp_kDim(const ideal _G)
Definition: hdegree.cc:2089

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5397 of file iparith.cc.

5398 {
5399 // input: u: a list with links of type
5400 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5401 // returns: -1: the read state of all links is eof
5402 // i>0: (at least) u[i] is ready
5403  lists Lforks = (lists)u->Data();
5404  int i = slStatusSsiL(Lforks, -1);
5405  if(i == -2) /* error */
5406  {
5407  return TRUE;
5408  }
5409  res->data = (void*)(long)i;
5410  return FALSE;
5411 }

◆ jjWAIT1ST2()

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

Definition at line 3567 of file iparith.cc.

3568 {
3569 // input: u: a list with links of type
3570 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3571 // v: timeout for select in milliseconds
3572 // or 0 for polling
3573 // returns: ERROR (via Werror): timeout negative
3574 // -1: the read state of all links is eof
3575 // 0: timeout (or polling): none ready
3576 // i>0: (at least) L[i] is ready
3577  lists Lforks = (lists)u->Data();
3578  int t = (int)(long)v->Data();
3579  if(t < 0)
3580  {
3581  WerrorS("negative timeout"); return TRUE;
3582  }
3583  int i = slStatusSsiL(Lforks, t*1000);
3584  if(i == -2) /* error */
3585  {
3586  return TRUE;
3587  }
3588  res->data = (void*)(long)i;
3589  return FALSE;
3590 }

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5412 of file iparith.cc.

5413 {
5414 // input: u: a list with links of type
5415 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5416 // returns: -1: the read state of all links is eof
5417 // 1: all links are ready
5418 // (caution: at least one is ready, but some maybe dead)
5419  lists Lforks = (lists)u->CopyD();
5420  int i;
5421  int j = -1;
5422  for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5423  {
5424  i = slStatusSsiL(Lforks, -1);
5425  if(i == -2) /* error */
5426  {
5427  return TRUE;
5428  }
5429  if(i == -1)
5430  {
5431  break;
5432  }
5433  j = 1;
5434  Lforks->m[i-1].CleanUp();
5435  Lforks->m[i-1].rtyp=DEF_CMD;
5436  Lforks->m[i-1].data=NULL;
5437  }
5438  res->data = (void*)(long)j;
5439  Lforks->Clean();
5440  return FALSE;
5441 }

◆ jjWAITALL2()

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

Definition at line 3591 of file iparith.cc.

3592 {
3593 // input: u: a list with links of type
3594 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3595 // v: timeout for select in milliseconds
3596 // or 0 for polling
3597 // returns: ERROR (via Werror): timeout negative
3598 // -1: the read state of all links is eof
3599 // 0: timeout (or polling): none ready
3600 // 1: all links are ready
3601 // (caution: at least one is ready, but some maybe dead)
3602  lists Lforks = (lists)u->CopyD();
3603  int timeout = 1000*(int)(long)v->Data();
3604  if(timeout < 0)
3605  {
3606  WerrorS("negative timeout"); return TRUE;
3607  }
3608  int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3609  int i;
3610  int ret = -1;
3611  for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3612  {
3613  i = slStatusSsiL(Lforks, timeout);
3614  if(i > 0) /* Lforks[i] is ready */
3615  {
3616  ret = 1;
3617  Lforks->m[i-1].CleanUp();
3618  Lforks->m[i-1].rtyp=DEF_CMD;
3619  Lforks->m[i-1].data=NULL;
3620  timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3621  }
3622  else /* terminate the for loop */
3623  {
3624  if(i == -2) /* error */
3625  {
3626  return TRUE;
3627  }
3628  if(i == 0) /* timeout */
3629  {
3630  ret = 0;
3631  }
3632  break;
3633  }
3634  }
3635  Lforks->Clean();
3636  res->data = (void*)(long)ret;
3637  return FALSE;
3638 }
#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 3639 of file iparith.cc.

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

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3646 of file iparith.cc.

3647 {
3648  return TRUE;
3649 }

◆ pHeadProc()

poly pHeadProc ( poly  p)

Definition at line 229 of file iparith.cc.

230 {
231  return pHead(p);
232 }

◆ Tok2Cmdname()

const char* Tok2Cmdname ( int  tok)

Definition at line 9571 of file iparith.cc.

9572 {
9573  if (tok <= 0)
9574  {
9575  return sArithBase.sCmds[0].name;
9576  }
9577  if (tok==ANY_TYPE) return "any_type";
9578  if (tok==COMMAND) return "command";
9579  if (tok==NONE) return "nothing";
9580  if (tok < 128)
9581  {
9582  Tok2Cmdname_buf[0]=(char)tok;
9583  return Tok2Cmdname_buf;
9584  }
9585  //if (tok==IFBREAK) return "if_break";
9586  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9587  //if (tok==ORDER_VECTOR) return "ordering";
9588  //if (tok==REF_VAR) return "ref";
9589  //if (tok==OBJECT) return "object";
9590  //if (tok==PRINT_EXPR) return "print_expr";
9591  if (tok==IDHDL) return "identifier";
9592  if (tok>MAX_TOK) return getBlackboxName(tok);
9593  unsigned i;
9594  for(i=0; i<sArithBase.nCmdUsed; i++)
9595  //while (sArithBase.sCmds[i].tokval!=0)
9596  {
9597  if ((sArithBase.sCmds[i].tokval == tok)&&
9598  (sArithBase.sCmds[i].alias==0))
9599  {
9600  return sArithBase.sCmds[i].name;
9601  }
9602  }
9603  // try gain for alias/old names:
9604  for(i=0; i<sArithBase.nCmdUsed; i++)
9605  {
9606  if (sArithBase.sCmds[i].tokval == tok)
9607  {
9608  return sArithBase.sCmds[i].name;
9609  }
9610  }
9611  return sArithBase.sCmds[0].name;
9612 }
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9570
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5515 of file iparith.cc.

5516 {
5518 }

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 214 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 215 of file iparith.cc.

◆ farey_cnt

long farey_cnt =0L

Definition at line 9 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 219 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 198 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2035 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9570 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5514 of file iparith.cc.