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

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 127 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 59 of file gentable.cc.

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

◆ sValCmd1

struct sValCmd1

Definition at line 78 of file gentable.cc.

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

◆ sValCmd2

struct sValCmd2

Definition at line 69 of file gentable.cc.

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

◆ sValCmd3

struct sValCmd3

Definition at line 86 of file gentable.cc.

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

◆ sValCmdM

struct sValCmdM

Definition at line 96 of file gentable.cc.

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

◆ SArithBase

struct SArithBase

Definition at line 184 of file iparith.cc.

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

Macro Definition Documentation

◆ ALLOW_LP

#define ALLOW_LP   64

Definition at line 111 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 112 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 104 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 107 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 110 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 114 of file iparith.cc.

◆ bit31

#define bit31   SIZEOF_LONG*8-1

Definition at line 124 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 106 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8742 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 220 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8744 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 92 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 120 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 105 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 108 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 109 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 8743 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 98 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3291 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3288 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3289 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3290 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3293 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3287 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3292 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 118 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 99 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 133 of file iparith.cc.

◆ proc2

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

Definition at line 153 of file iparith.cc.

◆ proc3

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

Definition at line 164 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9704 {
9705  cmdnames *pCmdL = (cmdnames*)a;
9706  cmdnames *pCmdR = (cmdnames*)b;
9707 
9708  if(a==NULL || b==NULL) return 0;
9709 
9710  /* empty entries goes to the end of the list for later reuse */
9711  if(pCmdL->name==NULL) return 1;
9712  if(pCmdR->name==NULL) return -1;
9713 
9714  /* $INVALID$ must come first */
9715  if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9716  if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9717 
9718  /* tokval=-1 are reserved names at the end */
9719  if (pCmdL->tokval==-1)
9720  {
9721  if (pCmdR->tokval==-1)
9722  return strcmp(pCmdL->name, pCmdR->name);
9723  /* pCmdL->tokval==-1, pCmdL goes at the end */
9724  return 1;
9725  }
9726  /* pCmdR->tokval==-1, pCmdR goes at the end */
9727  if(pCmdR->tokval==-1) return -1;
9728 
9729  return strcmp(pCmdL->name, pCmdR->name);
9730 }
CanonicalForm b
Definition: cfModGcd.cc:4103
#define NULL
Definition: omList.c:12

◆ check_valid()

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

Definition at line 9929 of file iparith.cc.

9930 {
9931  if (rIsPluralRing(currRing))
9932  {
9933  if ((p & NC_MASK)==NO_NC)
9934  {
9935  WerrorS("not implemented for non-commutative rings");
9936  return TRUE;
9937  }
9938  else if ((p & NC_MASK)==COMM_PLURAL)
9939  {
9940  Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9941  return FALSE;
9942  }
9943  /* else, ALLOW_PLURAL */
9944  }
9945  else if (rIsLPRing(currRing))
9946  {
9947  if ((p & ALLOW_LP)==0)
9948  {
9949  Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9950  return TRUE;
9951  }
9952  }
9953  if (rField_is_Ring(currRing))
9954  {
9955  if ((p & RING_MASK)==0 /*NO_RING*/)
9956  {
9957  WerrorS("not implemented for rings with rings as coeffients");
9958  return TRUE;
9959  }
9960  /* else ALLOW_RING */
9961  else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9962  &&(!rField_is_Domain(currRing)))
9963  {
9964  WerrorS("domain required as coeffients");
9965  return TRUE;
9966  }
9967  /* else ALLOW_ZERODIVISOR */
9968  else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9969  {
9970  WarnS("considering the image in Q[...]");
9971  }
9972  }
9973  return FALSE;
9974 }
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4078
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR char my_yylinebuf[80]
Definition: febase.cc:44
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:106
#define NO_ZERODIVISOR
Definition: iparith.cc:109
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9649
#define ALLOW_LP
Definition: iparith.cc:111
#define RING_MASK
Definition: iparith.cc:98
#define WARN_RING
Definition: iparith.cc:118
#define NC_MASK
Definition: iparith.cc:92
#define NO_NC
Definition: iparith.cc:105
#define ZERODIVISOR_MASK
Definition: iparith.cc:99
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:487
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411
#define rField_is_Ring(R)
Definition: ring.h:485

◆ iiArithAddCmd()

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

Definition at line 9870 of file iparith.cc.

9877 {
9878  //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9879  // nTokval, nToktype, nPos);
9880  if(nPos>=0)
9881  {
9882  // no checks: we rely on a correct generated code in iparith.inc
9883  assume((unsigned)nPos < sArithBase.nCmdAllocated);
9884  assume(szName!=NULL);
9885  sArithBase.sCmds[nPos].name = omStrDup(szName);
9886  sArithBase.sCmds[nPos].alias = nAlias;
9887  sArithBase.sCmds[nPos].tokval = nTokval;
9888  sArithBase.sCmds[nPos].toktype = nToktype;
9889  sArithBase.nCmdUsed++;
9890  //if(nTokval>0) sArithBase.nLastIdentifier++;
9891  }
9892  else
9893  {
9894  if(szName==NULL) return -1;
9895  int nIndex = iiArithFindCmd(szName);
9896  if(nIndex>=0)
9897  {
9898  Print("'%s' already exists at %d\n", szName, nIndex);
9899  return -1;
9900  }
9901 
9903  {
9904  /* needs to create new slots */
9905  unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9906  sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
9907  if(sArithBase.sCmds==NULL) return -1;
9909  }
9910  /* still free slots available */
9911  sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
9912  sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9913  sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9914  sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9915  sArithBase.nCmdUsed++;
9916 
9917  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9918  (&_gentable_sort_cmds));
9921  {
9922  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9923  }
9924  //Print("L=%d\n", sArithBase.nLastIdentifier);
9925  }
9926  return 0;
9927 }
#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:9703
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9775
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:186
unsigned nLastIdentifier
valid identifiers are slot 1..nLastIdentifier
Definition: iparith.cc:193
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:201
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:192
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:191
#define assume(x)
Definition: mod2.h:389
#define nSize(n)
Definition: numbers.h:39
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 9775 of file iparith.cc.

9776 {
9777  int an=0;
9778  int i = 0,v = 0;
9779  int en=sArithBase.nLastIdentifier;
9780 
9781  loop
9782  //for(an=0; an<sArithBase.nCmdUsed; )
9783  {
9784  if(an>=en-1)
9785  {
9786  if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9787  {
9788  //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9789  return an;
9790  }
9791  else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9792  {
9793  //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9794  return en;
9795  }
9796  else
9797  {
9798  //Print("RET- 1\n");
9799  return -1;
9800  }
9801  }
9802  i=(an+en)/2;
9803  if (*szName < *(sArithBase.sCmds[i].name))
9804  {
9805  en=i-1;
9806  }
9807  else if (*szName > *(sArithBase.sCmds[i].name))
9808  {
9809  an=i+1;
9810  }
9811  else
9812  {
9813  v=strcmp(szName,sArithBase.sCmds[i].name);
9814  if(v<0)
9815  {
9816  en=i-1;
9817  }
9818  else if(v>0)
9819  {
9820  an=i+1;
9821  }
9822  else /*v==0*/
9823  {
9824  //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9825  return i;
9826  }
9827  }
9828  }
9829  //if(i>=0 && i<sArithBase.nCmdUsed)
9830  // return i;
9831  //PrintS("RET-2\n");
9832  return -2;
9833 }
int i
Definition: cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define loop
Definition: structs.h:75

◆ iiArithGetCmd()

char* iiArithGetCmd ( int  nPos)

Definition at line 9835 of file iparith.cc.

9836 {
9837  if(nPos<0) return NULL;
9838  if(nPos<(int)sArithBase.nCmdUsed)
9839  return sArithBase.sCmds[nPos].name;
9840  return NULL;
9841 }

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9843 of file iparith.cc.

9844 {
9845  int nIndex;
9846  if(szName==NULL) return -1;
9847 
9848  nIndex = iiArithFindCmd(szName);
9849  if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9850  {
9851  Print("'%s' not found (%d)\n", szName, nIndex);
9852  return -1;
9853  }
9854  omFreeBinAddr(sArithBase.sCmds[nIndex].name);
9855  sArithBase.sCmds[nIndex].name=NULL;
9856  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9857  (&_gentable_sort_cmds));
9858  sArithBase.nCmdUsed--;
9859 
9860  /* fix last-identifier */
9863  {
9864  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9865  }
9866  //Print("L=%d\n", sArithBase.nLastIdentifier);
9867  return 0;
9868 }
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258

◆ iiExprArith1()

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

Definition at line 9115 of file iparith.cc.

9116 {
9117  if (!errorreported)
9118  {
9119  res->Init();
9120 #ifdef SIQ
9121  if (siq>0)
9122  {
9123  //Print("siq:%d\n",siq);
9125  memcpy(&d->arg1,a,sizeof(sleftv));
9126  a->Init();
9127  d->op=op;
9128  d->argc=1;
9129  res->data=(char *)d;
9130  res->rtyp=COMMAND;
9131  return FALSE;
9132  }
9133 #endif
9134  int at=a->Typ();
9135  // handling bb-objects ----------------------------------------------------
9136  if(op>MAX_TOK) // explicit type conversion to bb
9137  {
9138  blackbox *bb=getBlackboxStuff(op);
9139  if (bb!=NULL)
9140  {
9141  res->rtyp=op;
9142  res->data=bb->blackbox_Init(bb);
9143  return bb->blackbox_Assign(res,a);
9144  }
9145  else
9146  return TRUE;
9147  }
9148  else if (at>MAX_TOK) // argument is of bb-type
9149  {
9150  blackbox *bb=getBlackboxStuff(at);
9151  if (bb!=NULL)
9152  {
9153  if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9154  // if not defined, try generic routines (attrib, defined,..)
9155  }
9156  else
9157  return TRUE;
9158  }
9159  if (errorreported) return TRUE;
9160 
9161  int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9162  return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9163  }
9164  a->CleanUp();
9165  return TRUE;
9166 }
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1011
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:60
VAR short errorreported
Definition: feFopen.cc:23
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation 'op' to an argument a return TRUE on failure
Definition: iparith.cc:8985
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9624
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1284
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 8985 of file iparith.cc.

8986 {
8987  res->Init();
8988  BOOLEAN call_failed=FALSE;
8989 
8990  if (!errorreported)
8991  {
8992  BOOLEAN failed=FALSE;
8993  iiOp=op;
8994  int i = 0;
8995  while (dA1[i].cmd==op)
8996  {
8997  if (at==dA1[i].arg)
8998  {
8999  if (currRing!=NULL)
9000  {
9001  if (check_valid(dA1[i].valid_for,op)) break;
9002  }
9003  else
9004  {
9005  if (RingDependend(dA1[i].res))
9006  {
9007  WerrorS("no ring active (5)");
9008  break;
9009  }
9010  }
9011  if (traceit&TRACE_CALL)
9012  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9013  res->rtyp=dA1[i].res;
9014  if ((call_failed=dA1[i].p(res,a)))
9015  {
9016  break;// leave loop, goto error handling
9017  }
9018  if (a->Next()!=NULL)
9019  {
9020  res->next=(leftv)omAllocBin(sleftv_bin);
9021  failed=iiExprArith1(res->next,a->next,op);
9022  }
9023  a->CleanUp();
9024  return failed;
9025  }
9026  i++;
9027  }
9028  // implicite type conversion --------------------------------------------
9029  if (dA1[i].cmd!=op)
9030  {
9032  i=0;
9033  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9034  while (dA1[i].cmd==op)
9035  {
9036  int ai;
9037  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9038  if ((dA1[i].valid_for & NO_CONVERSION)==0)
9039  {
9040  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9041  {
9042  if (currRing!=NULL)
9043  {
9044  if (check_valid(dA1[i].valid_for,op)) break;
9045  }
9046  else
9047  {
9048  if (RingDependend(dA1[i].res))
9049  {
9050  WerrorS("no ring active (6)");
9051  break;
9052  }
9053  }
9054  if (traceit&TRACE_CALL)
9055  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9056  res->rtyp=dA1[i].res;
9057  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9058  || (call_failed=dA1[i].p(res,an)));
9059  // everything done, clean up temp. variables
9060  if (failed)
9061  {
9062  // leave loop, goto error handling
9063  break;
9064  }
9065  else
9066  {
9067  if (an->Next() != NULL)
9068  {
9069  res->next = (leftv)omAllocBin(sleftv_bin);
9070  failed=iiExprArith1(res->next,an->next,op);
9071  }
9072  // everything ok, clean up and return
9073  an->CleanUp();
9075  return failed;
9076  }
9077  }
9078  }
9079  i++;
9080  }
9081  an->CleanUp();
9083  }
9084  // error handling
9085  if (!errorreported)
9086  {
9087  if ((at==0) && (a->Fullname()!=sNoName_fe))
9088  {
9089  Werror("`%s` is not defined",a->Fullname());
9090  }
9091  else
9092  {
9093  i=0;
9094  const char *s = iiTwoOps(op);
9095  Werror("%s(`%s`) failed"
9096  ,s,Tok2Cmdname(at));
9097  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9098  {
9099  while (dA1[i].cmd==op)
9100  {
9101  if ((dA1[i].res!=0)
9102  && (dA1[i].p!=jjWRONG))
9103  Werror("expected %s(`%s`)"
9104  ,s,Tok2Cmdname(dA1[i].arg));
9105  i++;
9106  }
9107  }
9108  }
9109  }
9110  res->rtyp = UNKNOWN;
9111  }
9112  a->CleanUp();
9113  return TRUE;
9114 }
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:57
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
const char * iiTwoOps(int t)
Definition: gentable.cc:261
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3694
#define NO_CONVERSION
Definition: iparith.cc:120
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:9115
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9929
VAR int iiOp
Definition: iparith.cc:222
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:435
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:145
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:35
#define V_SHOW_USE
Definition: options.h:52
EXTERN_VAR int traceit
Definition: reporter.h:24
#define TRACE_CALL
Definition: reporter.h:44
sleftv * leftv
Definition: structs.h:57
BOOLEAN RingDependend(int t)
Definition: subexpr.h:142
#define UNKNOWN
Definition: tok.h:222

◆ iiExprArith2()

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

Definition at line 8926 of file iparith.cc.

8927 {
8928  res->Init();
8929 
8930  if (!errorreported)
8931  {
8932 #ifdef SIQ
8933  if (siq>0)
8934  {
8935  //Print("siq:%d\n",siq);
8937  memcpy(&d->arg1,a,sizeof(sleftv));
8938  a->Init();
8939  memcpy(&d->arg2,b,sizeof(sleftv));
8940  b->Init();
8941  d->argc=2;
8942  d->op=op;
8943  res->data=(char *)d;
8944  res->rtyp=COMMAND;
8945  return FALSE;
8946  }
8947 #endif
8948  int at=a->Typ();
8949  int bt=b->Typ();
8950  // handling bb-objects ----------------------------------------------------
8951  if (at>MAX_TOK)
8952  {
8953  blackbox *bb=getBlackboxStuff(at);
8954  if (bb!=NULL)
8955  {
8956  if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8957  // if not defined, try generic (attrib, ..)
8958  }
8959  else
8960  return TRUE;
8961  }
8962  else if ((bt>MAX_TOK)&&(op!='('))
8963  {
8964  blackbox *bb=getBlackboxStuff(bt);
8965  if (bb!=NULL)
8966  {
8967  if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8968  // if not defined, try generic (attrib, ..)
8969  }
8970  else
8971  return TRUE;
8972  }
8973  int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8974  return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8975  }
8976  a->CleanUp();
8977  b->CleanUp();
8978  return TRUE;
8979 }
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:8753
const struct sValCmd2 dArith2[]
Definition: table.h:320

◆ iiExprArith2Tab()

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

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

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

Definition at line 8912 of file iparith.cc.

8916 {
8917  res->Init();
8918  leftv b=a->next;
8919  a->next=NULL;
8920  int bt=b->Typ();
8921  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8922  a->next=b;
8923  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8924  return bo;
8925 }

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

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

◆ iiExprArith3()

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

Definition at line 9325 of file iparith.cc.

9326 {
9327  res->Init();
9328 
9329  if (!errorreported)
9330  {
9331 #ifdef SIQ
9332  if (siq>0)
9333  {
9334  //Print("siq:%d\n",siq);
9336  memcpy(&d->arg1,a,sizeof(sleftv));
9337  a->Init();
9338  memcpy(&d->arg2,b,sizeof(sleftv));
9339  b->Init();
9340  memcpy(&d->arg3,c,sizeof(sleftv));
9341  c->Init();
9342  d->op=op;
9343  d->argc=3;
9344  res->data=(char *)d;
9345  res->rtyp=COMMAND;
9346  return FALSE;
9347  }
9348 #endif
9349  int at=a->Typ();
9350  // handling bb-objects ----------------------------------------------
9351  if (at>MAX_TOK)
9352  {
9353  blackbox *bb=getBlackboxStuff(at);
9354  if (bb!=NULL)
9355  {
9356  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9357  // otherwise, try defaul (attrib,..)
9358  }
9359  else
9360  return TRUE;
9361  if (errorreported) return TRUE;
9362  }
9363  int bt=b->Typ();
9364  int ct=c->Typ();
9365 
9366  iiOp=op;
9367  int i=0;
9368  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9369  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9370  }
9371  a->CleanUp();
9372  b->CleanUp();
9373  c->CleanUp();
9374  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9375  return TRUE;
9376 }
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:9172
const struct sValCmd3 dArith3[]
Definition: table.h:776

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

9381 {
9382  res->Init();
9383  leftv b=a->next;
9384  a->next=NULL;
9385  int bt=b->Typ();
9386  leftv c=b->next;
9387  b->next=NULL;
9388  int ct=c->Typ();
9389  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9390  b->next=c;
9391  a->next=b;
9392  a->CleanUp(); // to cleanup the chain, content already done
9393  return bo;
9394 }

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

9175 {
9176  BOOLEAN call_failed=FALSE;
9177 
9178  assume(dA3[0].cmd==op);
9179 
9180  if (!errorreported)
9181  {
9182  int i=0;
9183  iiOp=op;
9184  while (dA3[i].cmd==op)
9185  {
9186  if ((at==dA3[i].arg1)
9187  && (bt==dA3[i].arg2)
9188  && (ct==dA3[i].arg3))
9189  {
9190  res->rtyp=dA3[i].res;
9191  if (currRing!=NULL)
9192  {
9193  if (check_valid(dA3[i].valid_for,op)) break;
9194  }
9195  if (traceit&TRACE_CALL)
9196  Print("call %s(%s,%s,%s)\n",
9197  iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9198  if ((call_failed=dA3[i].p(res,a,b,c)))
9199  {
9200  break;// leave loop, goto error handling
9201  }
9202  a->CleanUp();
9203  b->CleanUp();
9204  c->CleanUp();
9205  return FALSE;
9206  }
9207  i++;
9208  }
9209  // implicite type conversion ----------------------------------------------
9210  if (dA3[i].cmd!=op)
9211  {
9212  int ai,bi,ci;
9216  BOOLEAN failed=FALSE;
9217  i=0;
9218  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9219  while (dA3[i].cmd==op)
9220  {
9221  if ((dA3[i].valid_for & NO_CONVERSION)==0)
9222  {
9223  if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9224  {
9225  if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9226  {
9227  if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9228  {
9229  res->rtyp=dA3[i].res;
9230  if (currRing!=NULL)
9231  {
9232  if (check_valid(dA3[i].valid_for,op)) break;
9233  }
9234  if (traceit&TRACE_CALL)
9235  Print("call %s(%s,%s,%s)\n",
9236  iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9237  Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9238  failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9239  || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9240  || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9241  || (call_failed=dA3[i].p(res,an,bn,cn)));
9242  // everything done, clean up temp. variables
9243  if (failed)
9244  {
9245  // leave loop, goto error handling
9246  break;
9247  }
9248  else
9249  {
9250  // everything ok, clean up and return
9251  an->CleanUp();
9252  bn->CleanUp();
9253  cn->CleanUp();
9257  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9258  return FALSE;
9259  }
9260  }
9261  }
9262  }
9263  }
9264  i++;
9265  }
9266  an->CleanUp();
9267  bn->CleanUp();
9268  cn->CleanUp();
9272  }
9273  // error handling ---------------------------------------------------
9274  if (!errorreported)
9275  {
9276  const char *s=NULL;
9277  if ((at==0) && (a->Fullname()!=sNoName_fe))
9278  {
9279  s=a->Fullname();
9280  }
9281  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9282  {
9283  s=b->Fullname();
9284  }
9285  else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9286  {
9287  s=c->Fullname();
9288  }
9289  if (s!=NULL)
9290  Werror("`%s` is not defined",s);
9291  else
9292  {
9293  i=0;
9294  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9295  const char *s = iiTwoOps(op);
9296  Werror("%s(`%s`,`%s`,`%s`) failed"
9297  ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9298  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9299  {
9300  while (dA3[i].cmd==op)
9301  {
9302  if(((at==dA3[i].arg1)
9303  ||(bt==dA3[i].arg2)
9304  ||(ct==dA3[i].arg3))
9305  && (dA3[i].res!=0))
9306  {
9307  Werror("expected %s(`%s`,`%s`,`%s`)"
9308  ,s,Tok2Cmdname(dA3[i].arg1)
9309  ,Tok2Cmdname(dA3[i].arg2)
9310  ,Tok2Cmdname(dA3[i].arg3));
9311  }
9312  i++;
9313  }
9314  }
9315  }
9316  }
9317  res->rtyp = UNKNOWN;
9318  }
9319  a->CleanUp();
9320  b->CleanUp();
9321  c->CleanUp();
9322  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9323  return TRUE;
9324 }
short res
Definition: gentable.cc:90

◆ iiExprArithM()

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

Definition at line 9416 of file iparith.cc.

9417 {
9418  res->Init();
9419 
9420  if (!errorreported)
9421  {
9422 #ifdef SIQ
9423  if (siq>0)
9424  {
9425  //Print("siq:%d\n",siq);
9427  d->op=op;
9428  res->data=(char *)d;
9429  if (a!=NULL)
9430  {
9431  d->argc=a->listLength();
9432  // else : d->argc=0;
9433  memcpy(&d->arg1,a,sizeof(sleftv));
9434  switch(d->argc)
9435  {
9436  case 3:
9437  memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9438  a->next->next->Init();
9439  /* no break */
9440  case 2:
9441  memcpy(&d->arg2,a->next,sizeof(sleftv));
9442  a->next->Init();
9443  a->next->next=d->arg2.next;
9444  d->arg2.next=NULL;
9445  /* no break */
9446  case 1:
9447  a->Init();
9448  a->next=d->arg1.next;
9449  d->arg1.next=NULL;
9450  }
9451  if (d->argc>3) a->next=NULL;
9452  a->name=NULL;
9453  a->rtyp=0;
9454  a->data=NULL;
9455  a->e=NULL;
9456  a->attribute=NULL;
9457  a->CleanUp();
9458  }
9459  res->rtyp=COMMAND;
9460  return FALSE;
9461  }
9462 #endif
9463  if ((a!=NULL) && (a->Typ()>MAX_TOK))
9464  {
9465  blackbox *bb=getBlackboxStuff(a->Typ());
9466  if (bb!=NULL)
9467  {
9468  if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9469  // otherwise, try default
9470  }
9471  else
9472  return TRUE;
9473  if (errorreported) return TRUE;
9474  }
9475  int args=0;
9476  if (a!=NULL) args=a->listLength();
9477 
9478  iiOp=op;
9479  int i=0;
9480  while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9481  while (dArithM[i].cmd==op)
9482  {
9483  if ((args==dArithM[i].number_of_args)
9484  || (dArithM[i].number_of_args==-1)
9485  || ((dArithM[i].number_of_args==-2)&&(args>0)))
9486  {
9487  res->rtyp=dArithM[i].res;
9488  if (currRing!=NULL)
9489  {
9490  if (check_valid(dArithM[i].valid_for,op)) break;
9491  }
9492  if (traceit&TRACE_CALL)
9493  Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9494  if (dArithM[i].p(res,a))
9495  {
9496  break;// leave loop, goto error handling
9497  }
9498  if (a!=NULL) a->CleanUp();
9499  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9500  return FALSE;
9501  }
9502  i++;
9503  }
9504  // error handling
9505  if (!errorreported)
9506  {
9507  if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9508  {
9509  Werror("`%s` is not defined",a->Fullname());
9510  }
9511  else
9512  {
9513  const char *s = iiTwoOps(op);
9514  Werror("%s(...) failed",s);
9515  }
9516  }
9517  res->rtyp = UNKNOWN;
9518  }
9519  if (a!=NULL) a->CleanUp();
9520  //Print("op: %d,result typ:%d\n",op,res->rtyp);
9521  return TRUE;
9522 }
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:908

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9740 of file iparith.cc.

9741 {
9742  //printf("iiInitArithmetic()\n");
9743  memset(&sArithBase, 0, sizeof(sArithBase));
9744  iiInitCmdName();
9745  /* fix last-identifier */
9746 #if 0
9747  /* we expect that gentable allready did every thing */
9750  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9751  }
9752 #endif
9753  //Print("L=%d\n", sArithBase.nLastIdentifier);
9754 
9755  //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9756  //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9757 
9758  //iiArithAddCmd("Top", 0,-1,0);
9759 
9760 
9761  //for(i=0; i<sArithBase.nCmdUsed; i++) {
9762  // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9763  // sArithBase.sCmds[i].name,
9764  // sArithBase.sCmds[i].alias,
9765  // sArithBase.sCmds[i].tokval,
9766  // sArithBase.sCmds[i].toktype);
9767  //}
9768  //iiArithRemoveCmd("Top");
9769  //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9770  //iiArithRemoveCmd("mygcd");
9771  //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9772  return 0;
9773 }

◆ iin_Int()

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

Definition at line 225 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 9624 of file iparith.cc.

9625 {
9626  // user defined types are not in the pre-computed table:
9627  if (op>MAX_TOK) return 0;
9628 
9629  int a=0;
9630  int e=len;
9631  int p=len/2;
9632  do
9633  {
9634  if (op==dArithTab[p].cmd) return dArithTab[p].start;
9635  if (op<dArithTab[p].cmd) e=p-1;
9636  else a = p+1;
9637  p=a+(e-a)/2;
9638  }
9639  while ( a <= e);
9640 
9641  // catch missing a cmd:
9642  // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9643  // Print("op %d (%c) unknown",op,op);
9644  return 0;
9645 }

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 233 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9525 of file iparith.cc.

9526 {
9527  int i;
9528  int an=1;
9529  int en=sArithBase.nLastIdentifier;
9530 
9531  loop
9532  //for(an=0; an<sArithBase.nCmdUsed; )
9533  {
9534  if(an>=en-1)
9535  {
9536  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9537  {
9538  i=an;
9539  break;
9540  }
9541  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9542  {
9543  i=en;
9544  break;
9545  }
9546  else
9547  {
9548  // -- blackbox extensions:
9549  // return 0;
9550  return blackboxIsCmd(n,tok);
9551  }
9552  }
9553  i=(an+en)/2;
9554  if (*n < *(sArithBase.sCmds[i].name))
9555  {
9556  en=i-1;
9557  }
9558  else if (*n > *(sArithBase.sCmds[i].name))
9559  {
9560  an=i+1;
9561  }
9562  else
9563  {
9564  int v=strcmp(n,sArithBase.sCmds[i].name);
9565  if(v<0)
9566  {
9567  en=i-1;
9568  }
9569  else if(v>0)
9570  {
9571  an=i+1;
9572  }
9573  else /*v==0*/
9574  {
9575  break;
9576  }
9577  }
9578  }
9580  tok=sArithBase.sCmds[i].tokval;
9581  if(sArithBase.sCmds[i].alias==2)
9582  {
9583  Warn("outdated identifier `%s` used - please change your code",
9584  sArithBase.sCmds[i].name);
9585  sArithBase.sCmds[i].alias=1;
9586  }
9587  #if 0
9588  if (currRingHdl==NULL)
9589  {
9590  #ifdef SIQ
9591  if (siq<=0)
9592  {
9593  #endif
9594  if ((tok>=BEGIN_RING) && (tok<=END_RING))
9595  {
9596  WerrorS("no ring active");
9597  return 0;
9598  }
9599  #ifdef SIQ
9600  }
9601  #endif
9602  }
9603  #endif
9604  if (!expected_parms)
9605  {
9606  switch (tok)
9607  {
9608  case IDEAL_CMD:
9609  case INT_CMD:
9610  case INTVEC_CMD:
9611  case MAP_CMD:
9612  case MATRIX_CMD:
9613  case MODUL_CMD:
9614  case POLY_CMD:
9615  case PROC_CMD:
9616  case RING_CMD:
9617  case STRING_CMD:
9618  cmdtok = tok;
9619  break;
9620  }
9621  }
9622  return sArithBase.sCmds[i].toktype;
9623 }
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:218
EXTERN_VAR int cmdtok
Definition: iparith.cc:217
VAR idhdl currRingHdl
Definition: ipid.cc:59
const char * lastreserved
Definition: ipshell.cc:82
@ INTVEC_CMD
Definition: tok.h:101
@ STRING_CMD
Definition: tok.h:185
@ INT_CMD
Definition: tok.h:96

◆ jjALIGN_M()

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

Definition at line 1779 of file iparith.cc.

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

◆ jjALIGN_V()

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

Definition at line 1769 of file iparith.cc.

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

◆ jjAND_I()

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

Definition at line 1380 of file iparith.cc.

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

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3813 of file iparith.cc.

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

◆ jjBAREISS3()

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

Definition at line 6018 of file iparith.cc.

6019 {
6020  intvec *iv;
6021  ideal m;
6023  int k=(int)(long)w->Data();
6024  if (k>=0)
6025  {
6026  sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6027  l->Init(2);
6028  l->m[0].rtyp=MODUL_CMD;
6029  l->m[1].rtyp=INTVEC_CMD;
6030  l->m[0].data=(void *)m;
6031  l->m[1].data=(void *)iv;
6032  }
6033  else
6034  {
6035  m=sm_CallSolv((ideal)u->Data(), currRing);
6036  l->Init(1);
6037  l->m[0].rtyp=IDEAL_CMD;
6038  l->m[0].data=(void *)m;
6039  }
6040  res->data = (char *)l;
6041  return FALSE;
6042 }
int k
Definition: cfEzgcd.cc:99
const CanonicalForm & w
Definition: facAbsFact.cc:51
ideal sm_CallSolv(ideal I, const ring R)
Definition: sparsmat.cc:2316

◆ jjBAREISS_BIM()

static BOOLEAN jjBAREISS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3836 of file iparith.cc.

3837 {
3838  bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3839  b->hnf();
3840  res->data=(char*)b;
3841  return FALSE;
3842 }
Matrices of numbers.
Definition: bigintmat.h:51
@ BIGINTMAT_CMD
Definition: grammar.cc:278

◆ jjBI2IM()

static BOOLEAN jjBI2IM ( leftv  res,
leftv  u 
)
static

Definition at line 3858 of file iparith.cc.

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

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3843 of file iparith.cc.

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

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3864 of file iparith.cc.

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

◆ jjBRACK_Bim()

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

Definition at line 5763 of file iparith.cc.

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

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

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

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

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

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5948 of file iparith.cc.

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

◆ jjBRACK_S()

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

Definition at line 5720 of file iparith.cc.

5721 {
5722  char *s= (char *)u->Data();
5723  int r = (int)(long)v->Data();
5724  int c = (int)(long)w->Data();
5725  int l = strlen(s);
5726 
5727  if ( (r<1) || (r>l) || (c<0) )
5728  {
5729  Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5730  return TRUE;
5731  }
5732  res->data = (char *)omAlloc((long)(c+1));
5733  sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5734  return FALSE;
5735 }
#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 5820 of file iparith.cc.

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

◆ jjBRACKET()

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

Definition at line 2908 of file iparith.cc.

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

◆ jjBRACKET_REC()

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

Definition at line 2935 of file iparith.cc.

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

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 7142 of file iparith.cc.

7143 {
7144 #ifdef HAVE_SDB
7145  sdb_show_bp();
7146 #endif
7147  return FALSE;
7148 }
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7149 of file iparith.cc.

7150 {
7151 #ifdef HAVE_SDB
7152  if(v->Typ()==PROC_CMD)
7153  {
7154  int lineno=0;
7155  if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7156  {
7157  lineno=(int)(long)v->next->Data();
7158  }
7159  return sdb_set_breakpoint(v->Name(),lineno);
7160  }
7161  return TRUE;
7162 #else
7163  return FALSE;
7164 #endif
7165 }
Variable next() const
Definition: factory.h:146
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
Definition: sdb.cc:64

◆ jjCALL1ARG()

static BOOLEAN jjCALL1ARG ( leftv  res,
leftv  v 
)
static

Definition at line 7166 of file iparith.cc.

7167 {
7168  return iiExprArith1(res,v,iiOp);
7169 }

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3879 of file iparith.cc.

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

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7170 of file iparith.cc.

7171 {
7172  leftv v=u->next;
7173  u->next=NULL;
7174  BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7175  u->next=v;
7176  return b;
7177 }
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8926

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7178 of file iparith.cc.

7179 {
7180  leftv v = u->next;
7181  leftv w = v->next;
7182  u->next = NULL;
7183  v->next = NULL;
7184  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7185  u->next = v;
7186  v->next = w;
7187  return b;
7188 }
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:9325

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3883 of file iparith.cc.

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

◆ jjCHINREM_BI()

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

Definition at line 1682 of file iparith.cc.

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

◆ jjCHINREM_ID()

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

Definition at line 9976 of file iparith.cc.

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

◆ jjCOEF()

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

Definition at line 1793 of file iparith.cc.

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

◆ jjCOEF_Id()

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

Definition at line 1800 of file iparith.cc.

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

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 7190 of file iparith.cc.

7191 {
7192  const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7193  if (iiCheckTypes(v,t,1))
7194  {
7195  idhdl c=(idhdl)v->next->next->data;
7196  if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7197  idhdl m=(idhdl)v->next->next->next->data;
7198  idDelete((ideal *)&(c->data.uideal));
7199  idDelete((ideal *)&(m->data.uideal));
7200  mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7201  (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7202  return FALSE;
7203  }
7204  return TRUE;
7205 }
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:6572
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition: matpol.cc:581
idrec * idhdl
Definition: ring.h:21

◆ jjCOEFFS2_KB()

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

Definition at line 1818 of file iparith.cc.

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

6044 {
6045  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6046  {
6047  WerrorS("3rd argument must be a name of a matrix");
6048  return TRUE;
6049  }
6050  ideal i=(ideal)u->Data();
6051  int rank=(int)i->rank;
6052  BOOLEAN r=jjCOEFFS_Id(res,u,v);
6053  if (r) return TRUE;
6054  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6055  return FALSE;
6056 }
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1807
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition: matpol.cc:362
#define pVar(m)
Definition: polys.h:380

◆ jjCOEFFS3_KB()

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

Definition at line 6057 of file iparith.cc.

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

◆ jjCOEFFS3_P()

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

Definition at line 6063 of file iparith.cc.

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

◆ jjCOEFFS_Id()

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

Definition at line 1807 of file iparith.cc.

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

◆ jjCOLCOL()

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

Definition at line 694 of file iparith.cc.

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

◆ jjCOLON()

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

Definition at line 323 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3888 of file iparith.cc.

3889 {
3890  res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3891  return FALSE;
3892 }

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3893 of file iparith.cc.

3894 {
3895  res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3896  return FALSE;
3897 }

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3898 of file iparith.cc.

3899 {
3900  res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3901  return FALSE;
3902 }

◆ jjCOMPARE_ALL()

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

Definition at line 10194 of file iparith.cc.

10195 {
10196  leftv a=(leftv)aa;
10197  int at=a->Typ();
10198  leftv b=(leftv)bb;
10199  int bt=b->Typ();
10200  if (at < bt) return -1;
10201  if (at > bt) return 1;
10202  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10203  sleftv tmp;
10204  tmp.Init();
10205  iiOp='<';
10206  BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10207  if (bo)
10208  {
10209  Werror(" no `<` for %s",Tok2Cmdname(at));
10210  unsigned long ad=(unsigned long)a->Data();
10211  unsigned long bd=(unsigned long)b->Data();
10212  if (ad<bd) return -1;
10213  else if (ad==bd) return 0;
10214  else return 1;
10215  }
10216  else if (tmp.data==NULL) /* not < */
10217  {
10218  iiOp=EQUAL_EQUAL;
10219  tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10220  bo=iiExprArith2TabIntern(&tmp,a,EQUAL_EQUAL,b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10221  if (bo)
10222  {
10223  Werror(" no `==` for %s",Tok2Cmdname(at));
10224  unsigned long ad=(unsigned long)a->Data();
10225  unsigned long bd=(unsigned long)b->Data();
10226  if (ad<bd) return -1;
10227  else if (ad==bd) return 0;
10228  else return 1;
10229  }
10230  else if (tmp.data==NULL) /* not <,== */ return 1;
10231  else return 0;
10232  }
10233  else return -1;
10234 }
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 370 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 342 of file iparith.cc.

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

◆ jjCOMPARE_IV_I()

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

Definition at line 398 of file iparith.cc.

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

◆ jjCOMPARE_MA()

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

Definition at line 425 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 453 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 480 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3903 of file iparith.cc.

3904 {
3905  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3906  poly p=(poly)v->CopyD(POLY_CMD);
3907  if (p!=NULL) p_Cleardenom(p, currRing);
3908  res->data = (char *)p;
3909  return FALSE;
3910 }
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2841

◆ jjCONTRACT()

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

Definition at line 1832 of file iparith.cc.

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

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3911 of file iparith.cc.

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

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3916 of file iparith.cc.

3917 {
3918  bigintmat* aa= (bigintmat *)v->Data();
3919  res->data = (char *)(long)(aa->rows()*aa->cols());
3920  return FALSE;
3921 }

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3939 of file iparith.cc.

3940 {
3941  res->data = (char *)(long)((intvec*)(v->Data()))->length();
3942  return FALSE;
3943 }

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3927 of file iparith.cc.

3928 {
3929  lists l=(lists)v->Data();
3930  res->data = (char *)(long)(lSize(l)+1);
3931  return FALSE;
3932 }
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3933 of file iparith.cc.

3934 {
3935  matrix m=(matrix)v->Data();
3936  res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3937  return FALSE;
3938 }

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3922 of file iparith.cc.

3923 {
3924  res->data = (char *)(long)nSize((number)v->Data());
3925  return FALSE;
3926 }

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5689 of file iparith.cc.

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

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3944 of file iparith.cc.

3945 {
3946  ring r=(ring)v->Data();
3947  int elems=-1;
3948  if (rField_is_Zp(r)) elems=r->cf->ch;
3949  else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3950  else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3951  {
3952  extern int ipower ( int b, int n ); /* factory/cf_util */
3953  elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3954  }
3955  res->data = (char *)(long)elems;
3956  return FALSE;
3957 }
int ipower(int b, int m)
int ipower ( int b, int m )
Definition: cf_util.cc:27
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:35
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:529
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:500
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:521

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3996 of file iparith.cc.

3997 {
3998  if ((v->rtyp==IDHDL)
3999  && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
4000  {
4001  res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
4002  }
4003  else if (v->rtyp!=0) res->data=(void *)(-1);
4004  return FALSE;
4005 }
#define IDLEV(a)
Definition: ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3958 of file iparith.cc.

3959 {
3960  int dummy;
3961  poly p=(poly)v->Data();
3962  if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3963  else res->data=(char *)-1;
3964  return FALSE;
3965 }

◆ jjDEG_IV()

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

Definition at line 1848 of file iparith.cc.

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

◆ jjDEG_M()

static BOOLEAN jjDEG_M ( leftv  res,
leftv  u 
)
static

Definition at line 3966 of file iparith.cc.

3967 {
3968  ideal I=(ideal)u->Data();
3969  int d=-1;
3970  int dummy;
3971  int i;
3972  for(i=IDELEMS(I)-1;i>=0;i--)
3973  if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3974  res->data = (char *)(long)d;
3975  return FALSE;
3976 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:124

◆ jjDEG_M_IV()

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

Definition at line 1837 of file iparith.cc.

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

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3977 of file iparith.cc.

3978 {
3979  SPrintStart();
3980 #ifdef HAVE_RINGS
3981  if (rField_is_Z(currRing))
3982  {
3983  PrintS("// NOTE: computation of degree is being performed for\n");
3984  PrintS("// generic fibre, that is, over Q\n");
3985  }
3986 #endif
3987  assumeStdFlag(v);
3988  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3989  scDegree((ideal)v->Data(),module_w,currRing->qideal);
3990  char *s=SPrintEnd();
3991  int l=strlen(s)-1;
3992  s[l]='\0';
3993  res->data=(void*)s;
3994  return FALSE;
3995 }
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:926
void SPrintStart()
Definition: reporter.cc:246
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 1869 of file iparith.cc.

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

◆ jjDelete_ID_IV()

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

Definition at line 1876 of file iparith.cc.

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

◆ jjDelete_IV()

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

Definition at line 1862 of file iparith.cc.

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

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

Return the denominator of the input number.

Definition at line 4008 of file iparith.cc.

4009 {
4010  number n = reinterpret_cast<number>(v->CopyD());
4011  res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
4012  n_Delete(&n,currRing->cf);
4013  return FALSE;
4014 }
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:600

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 4025 of file iparith.cc.

4026 {
4027  matrix m=(matrix)v->Data();
4028  res ->data = mp_Det(m,currRing);
4029  return FALSE;
4030 }
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 1896 of file iparith.cc.

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

◆ jjDET2_S()

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

Definition at line 1903 of file iparith.cc.

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

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 4031 of file iparith.cc.

4032 {
4033  bigintmat * m=(bigintmat*)v->Data();
4034  int i,j;
4035  i=m->rows();j=m->cols();
4036  if(i==j)
4037  res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4038  else
4039  {
4040  Werror("det of %d x %d bigintmat",i,j);
4041  return TRUE;
4042  }
4043  return FALSE;
4044 }
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1798
int j
Definition: facHensel.cc:110

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4067 of file iparith.cc.

4068 {
4069  intvec * m=(intvec*)v->Data();
4070  int i,j;
4071  i=m->rows();j=m->cols();
4072  if(i==j)
4073  res->data = (char *)(long)singclap_det_i(m,currRing);
4074  else
4075  {
4076  Werror("det of %d x %d intmat",i,j);
4077  return TRUE;
4078  }
4079  return FALSE;
4080 }
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1780

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 4081 of file iparith.cc.

4082 {
4083  ideal I=(ideal)v->Data();
4084  res->data=(char*)sm_Det(I,currRing);
4085  return FALSE;
4086 }

◆ jjDIFF_COEF()

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

Definition at line 4451 of file iparith.cc.

4452 {
4453  if (!nCoeff_is_transExt(currRing->cf))
4454  {
4455  WerrorS("differentiation not defined in the coefficient ring");
4456  return TRUE;
4457  }
4458  number n = (number) u->Data();
4459  number k = (number) v->Data();
4460  res->data = ntDiff(n,k,currRing->cf);
4461  return FALSE;
4462 }
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:915
number ntDiff(number a, number d, const coeffs cf)
Definition: transext.cc:897

◆ jjDIFF_ID()

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

Definition at line 1921 of file iparith.cc.

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

◆ jjDIFF_ID_ID()

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

Definition at line 1932 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1910 of file iparith.cc.

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

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4087 of file iparith.cc.

4088 {
4089  assumeStdFlag(v);
4090 #ifdef HAVE_SHIFTBBA
4091  if (rIsLPRing(currRing))
4092  {
4093 #ifdef HAVE_RINGS
4094  if (rField_is_Ring(currRing))
4095  {
4096  WerrorS("`dim` is not implemented for letterplace rings over rings");
4097  return TRUE;
4098  }
4099 #endif
4100  if (currRing->qideal != NULL)
4101  {
4102  WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4103  return TRUE;
4104  }
4105  int gkDim = lp_gkDim((ideal)(v->Data()));
4106  res->data = (char *)(long)gkDim;
4107  return (gkDim == -2);
4108  }
4109 #endif
4111  {
4112  Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4113  }
4114  res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4115  return FALSE;
4116 }
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition: hdegree.cc:136
int lp_gkDim(const ideal _G)
Definition: hdegree.cc:1862
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:761

◆ jjDIM2()

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

Definition at line 1937 of file iparith.cc.

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

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5694 of file iparith.cc.

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

◆ jjDIV_BI()

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

Definition at line 1250 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1294 of file iparith.cc.

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

◆ jjDIV_N()

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

Definition at line 1263 of file iparith.cc.

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

◆ jjDIV_P()

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

Definition at line 1276 of file iparith.cc.

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

◆ jjDIVISION()

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

Definition at line 1954 of file iparith.cc.

1955 {
1956  ideal vi=(ideal)v->Data();
1957  int vl= IDELEMS(vi);
1958  ideal ui=(ideal)u->Data();
1959  unsigned ul= IDELEMS(ui);
1960  ideal R; matrix U;
1961  ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1962  if (m==NULL) return TRUE;
1963  // now make sure that all matrices have the correct size:
1965  assume (MATCOLS(U) == (int)ul);
1967  L->Init(3);
1968  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1969  L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1970  L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1971  res->data=(char *)L;
1972  return FALSE;
1973 }
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition: ideals.cc:1105
#define hasFlag(A, F)
Definition: ipid.h:112
#define FLAG_STD
Definition: ipid.h:106
STATIC_VAR jList * T
Definition: janet.cc:30
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition: sirandom.c:27

◆ jjDIVISION4()

static BOOLEAN jjDIVISION4 ( leftv  res,
leftv  v 
)
static

Definition at line 7207 of file iparith.cc.

7208 { // may have 3 or 4 arguments
7209  leftv v1=v;
7210  leftv v2=v1->next;
7211  leftv v3=v2->next;
7212  leftv v4=v3->next;
7213  assumeStdFlag(v2);
7214 
7215  int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7216  int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7217 
7218  if((i1==0)||(i2==0)
7219  ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7220  {
7221  WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7222  return TRUE;
7223  }
7224 
7225  sleftv w1,w2;
7226  iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7227  iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7228  ideal P=(ideal)w1.Data();
7229  ideal Q=(ideal)w2.Data();
7230 
7231  int n=(int)(long)v3->Data();
7232  int *w=NULL;
7233  if(v4!=NULL)
7234  {
7235  w = iv2array((intvec *)v4->Data(),currRing);
7236  int * w0 = w + 1;
7237  int i = currRing->N;
7238  while( (i > 0) && ((*w0) > 0) )
7239  {
7240  w0++;
7241  i--;
7242  }
7243  if(i>0)
7244  WarnS("not all weights are positive!");
7245  }
7246 
7247  matrix T;
7248  ideal R;
7249  idLiftW(P,Q,n,T,R,w);
7250 
7251  w1.CleanUp();
7252  w2.CleanUp();
7253  if(w!=NULL)
7254  omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7255 
7257  L->Init(2);
7258  L->m[1].rtyp=v1->Typ();
7259  if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7260  {
7261  if(v1->Typ()==POLY_CMD)
7262  p_Shift(&R->m[0],-1,currRing);
7263  L->m[1].data=(void *)R->m[0];
7264  R->m[0]=NULL;
7265  idDelete(&R);
7266  }
7267  else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7268  L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7269  else
7270  {
7271  L->m[1].rtyp=MODUL_CMD;
7272  L->m[1].data=(void *)R;
7273  }
7274  L->m[0].rtyp=MATRIX_CMD;
7275  L->m[0].data=(char *)T;
7276 
7277  res->data=L;
7278 
7279  return FALSE;
7280 }
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition: ideals.cc:1324
STATIC_VAR jList * Q
Definition: janet.cc:30
matrix id_Module2Matrix(ideal mod, const ring R)

◆ jjDIVMOD_I()

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

Definition at line 1227 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 336 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3711 of file iparith.cc.

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

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4117 of file iparith.cc.

4118 {
4119  si_link l = (si_link)v->Data();
4120  if (slDump(l))
4121  {
4122  const char *s;
4123  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4124  else s=sNoName_fe;
4125  Werror("cannot dump to `%s`",s);
4126  return TRUE;
4127  }
4128  else
4129  return FALSE;
4130 }

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4131 of file iparith.cc.

4132 {
4133  res->data = (char *)pOne();
4134  int co=(int)(long)v->Data();
4135  if (co>0)
4136  {
4137  pSetComp((poly)res->data,co);
4138  pSetm((poly)res->data);
4139  }
4140  else WerrorS("argument of gen must be positive");
4141  return (co<=0);
4142 }
#define pSetComp(p, v)
Definition: polys.h:38
#define pOne()
Definition: polys.h:315

◆ jjELIMIN()

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

Definition at line 1974 of file iparith.cc.

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

◆ jjELIMIN_ALG()

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

Definition at line 6090 of file iparith.cc.

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

◆ jjELIMIN_HILB()

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

Definition at line 6098 of file iparith.cc.

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

◆ jjELIMIN_IV()

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

Definition at line 1980 of file iparith.cc.

1981 {
1982  poly p=pOne();
1983  intvec *iv=(intvec*)v->Data();
1984  for(int i=iv->length()-1; i>=0; i--)
1985  {
1986  pSetExp(p,(*iv)[i],1);
1987  }
1988  pSetm(p);
1989  res->data=(char *)idElimination((ideal)u->Data(),p);
1990  pLmDelete(&p);
1991  //setFlag(res,FLAG_STD);
1992  return FALSE;
1993 }
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76

◆ jjENVELOPE()

static BOOLEAN jjENVELOPE ( leftv  res,
leftv  a 
)
static

Definition at line 5260 of file iparith.cc.

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

◆ jjEQUAL_BI()

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

Definition at line 1323 of file iparith.cc.

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

◆ jjEQUAL_I()

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

Definition at line 1329 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1335 of file iparith.cc.

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

◆ jjEQUAL_N()

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

Definition at line 1353 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1359 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1347 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1367 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1341 of file iparith.cc.

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

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 1999 of file iparith.cc.

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

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4143 of file iparith.cc.

4144 {
4145  char * d = (char *)v->Data();
4146  char * s = (char *)omAlloc(strlen(d) + 13);
4147  strcpy( s, (char *)d);
4148  strcat( s, "\n;RETURN();\n");
4150  return yyparse();
4151 }
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:166
@ BT_execute
Definition: fevoices.h:23
int yyparse(void)
Definition: grammar.cc:2111

◆ jjEXPORTTO()

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

Definition at line 1994 of file iparith.cc.

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

◆ jjEXTGCD_BI()

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

Definition at line 2006 of file iparith.cc.

2007 {
2008  number uu=(number)u->Data();number vv=(number)v->Data();
2010  number a,b;
2011  number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
2012  L->Init(3);
2013  L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
2014  L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
2015  L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
2016  res->rtyp=LIST_CMD;
2017  res->data=(char *)L;
2018  return FALSE;
2019 }
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:668

◆ jjEXTGCD_I()

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

Definition at line 2020 of file iparith.cc.

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

◆ jjEXTGCD_P()

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

Definition at line 2048 of file iparith.cc.

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

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4192 of file iparith.cc.

4193 {
4194  intvec *v=NULL;
4196  ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4197  if (f==NULL) return TRUE;
4198  ivTest(v);
4200  l->Init(2);
4201  l->m[0].rtyp=IDEAL_CMD;
4202  l->m[0].data=(void *)f;
4203  l->m[1].rtyp=INTVEC_CMD;
4204  l->m[1].data=(void *)v;
4205  res->data=(void *)l;
4206  return FALSE;
4207 }
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:948
#define ivTest(v)
Definition: intvec.h:169
EXTERN_VAR int singclap_factorize_retry
Definition: iparith.cc:2064

◆ jjFAC_P2()

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

Definition at line 2065 of file iparith.cc.

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

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4152 of file iparith.cc.

4153 {
4155  if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4156  {
4157  ideal_list p,h;
4158  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4159  if (h==NULL)
4160  {
4161  L->Init(1);
4162  L->m[0].data=(char *)idInit(1);
4163  L->m[0].rtyp=IDEAL_CMD;
4164  }
4165  else
4166  {
4167  p=h;
4168  int l=0;
4169  while (p!=NULL) { p=p->next;l++; }
4170  L->Init(l);
4171  l=0;
4172  while(h!=NULL)
4173  {
4174  L->m[l].data=(char *)h->d;
4175  L->m[l].rtyp=IDEAL_CMD;
4176  p=h->next;
4177  omFreeSize(h,sizeof(*h));
4178  h=p;
4179  l++;
4180  }
4181  }
4182  }
4183  else
4184  {
4185  WarnS("no factorization implemented");
4186  L->Init(1);
4187  iiExprArith1(&(L->m[0]),v,STD_CMD);
4188  }
4189  res->data=(void *)L;
4190  return FALSE;
4191 }
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition: kstdfac.cc:798
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:313
@ testHomog
Definition: structs.h:38
@ STD_CMD
Definition: tok.h:184

◆ jjFACSTD2()

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

Definition at line 2112 of file iparith.cc.

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

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8408 of file iparith.cc.

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

◆ jjFAREY_BI()

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

Definition at line 2134 of file iparith.cc.

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

◆ jjFAREY_ID()

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

Definition at line 2145 of file iparith.cc.

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

◆ jjFAREY_LI()

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

Definition at line 10175 of file iparith.cc.

10176 {
10177  lists c=(lists)u->CopyD();
10178  lists res_l=(lists)omAllocBin(slists_bin);
10179  res_l->Init(c->nr+1);
10180  BOOLEAN bo=FALSE;
10181  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10182  for (unsigned i=0;i<=(unsigned)c->nr;i++)
10183  {
10184  sleftv tmp;
10185  tmp.Copy(v);
10186  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10187  if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10188  }
10189  c->Clean();
10190  res->data=res_l;
10191  return bo;
10192 }
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2168 of file iparith.cc.

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

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7350 of file iparith.cc.

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

◆ jjFIND2()

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

Definition at line 2296 of file iparith.cc.

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

◆ jjFIND3()

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

Definition at line 6105 of file iparith.cc.

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

◆ jjFRES()

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

Definition at line 2351 of file iparith.cc.

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

◆ jjFRES3()

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

Definition at line 2314 of file iparith.cc.

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

◆ jjFWALK()

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

Definition at line 2361 of file iparith.cc.

2362 {
2363  res->data=(char *)fractalWalkProc(u,v);
2364  setFlag( res, FLAG_STD );
2365  return FALSE;
2366 }
#define setFlag(A, F)
Definition: ipid.h:113
ideal fractalWalkProc(leftv first, leftv second)
Definition: walk_ip.cc:161

◆ jjFWALK3()

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

Definition at line 6136 of file iparith.cc.

6137 {
6138  if ((int)(long)w->Data()==0)
6139  res->data=(char *)walkProc(u,v);
6140  else
6141  res->data=(char *)fractalWalkProc(u,v);
6142  setFlag( res, FLAG_STD );
6143  return FALSE;
6144 }
ideal walkProc(leftv first, leftv second)
Definition: walk_ip.cc:55

◆ jjGCD_BI()

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

Definition at line 2380 of file iparith.cc.

2381 {
2382  number n1 = (number) u->Data();
2383  number n2 = (number) v->Data();
2384  res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2385  return FALSE;
2386 }
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:661

◆ jjGCD_I()

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

Definition at line 2367 of file iparith.cc.

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

◆ jjGCD_N()

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

Definition at line 2387 of file iparith.cc.

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

◆ jjGCD_P()

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

Definition at line 2404 of file iparith.cc.

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

◆ jjGE_BI()

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

Definition at line 1166 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1173 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1178 of file iparith.cc.

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

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4208 of file iparith.cc.

4209 {
4210  si_link l = (si_link)v->Data();
4211  if (slGetDump(l))
4212  {
4213  const char *s;
4214  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4215  else s=sNoName_fe;
4216  Werror("cannot get dump from `%s`",s);
4217  return TRUE;
4218  }
4219  else
4220  return FALSE;
4221 }

◆ jjGT_BI()

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

Definition at line 1184 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1191 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1196 of file iparith.cc.

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

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4222 of file iparith.cc.

4223 {
4224  assumeStdFlag(v);
4225  ideal I=(ideal)v->Data();
4226  res->data=(void *)iiHighCorner(I,0);
4227  return FALSE;
4228 }
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1606

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4229 of file iparith.cc.

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

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

◆ jjHILBERT2()

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

Definition at line 2410 of file iparith.cc.

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

◆ jjHILBERT3()

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

Definition at line 6145 of file iparith.cc.

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

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4291 of file iparith.cc.

4292 {
4293 #ifdef HAVE_RINGS
4294  if (rField_is_Z(currRing))
4295  {
4296  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4297  PrintS("// performed for generic fibre, that is, over Q\n");
4298  }
4299 #endif
4300  res->data=(void *)hSecondSeries((intvec *)v->Data());
4301  return FALSE;
4302 }

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4303 of file iparith.cc.

4304 {
4305  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4306  ideal v_id=(ideal)v->Data();
4307  if (w==NULL)
4308  {
4309  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4310  if (res->data!=NULL)
4311  {
4312  if (v->rtyp==IDHDL)
4313  {
4314  char *s_isHomog=omStrDup("isHomog");
4315  if (v->e==NULL)
4316  atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4317  else
4318  atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4319  }
4320  else if (w!=NULL) delete w;
4321  } // if res->data==NULL then w==NULL
4322  }
4323  else
4324  {
4325  res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4326  if((res->data==NULL) && (v->rtyp==IDHDL))
4327  {
4328  if (v->e==NULL)
4329  atKill((idhdl)(v->data),"isHomog");
4330  else
4331  atKill((idhdl)(v->LData()),"isHomog");
4332  }
4333  }
4334  return FALSE;
4335 }
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:2069
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96

◆ jjHOMOG1_W()

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

Definition at line 2477 of file iparith.cc.

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

◆ jjHOMOG1_WI()

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

Definition at line 2497 of file iparith.cc.

2498 {
2499  intvec *vw=(intvec*)u->Data();
2500  ideal v_id=(ideal)v->Data();
2501  res->data=(void *)(long)id_HomIdealW(v_id,currRing->qideal,vw,currRing);
2502  return FALSE;
2503 }
BOOLEAN id_HomIdealW(ideal id, ideal Q, const intvec *w, const ring r)

◆ jjHOMOG_ID()

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

Definition at line 2455 of file iparith.cc.

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

6181 {
6182  PrintS("TODO\n");
6183  int i=pVar((poly)v->Data());
6184  if (i==0)
6185  {
6186  WerrorS("ringvar expected");
6187  return TRUE;
6188  }
6189  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6190  int d=pWTotaldegree(p);
6191  pLmDelete(p);
6192  if (d==1)
6193  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6194  else
6195  WerrorS("variable must have weight 1");
6196  return (d!=1);
6197 }
#define pWTotaldegree(p)
Definition: polys.h:283

◆ jjHOMOG_P()

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

Definition at line 2438 of file iparith.cc.

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

◆ jjHOMOG_P_W()

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

Definition at line 6198 of file iparith.cc.

6199 {
6200  PrintS("TODO\n");
6201  int i=pVar((poly)v->Data());
6202  if (i==0)
6203  {
6204  WerrorS("ringvar expected");
6205  return TRUE;
6206  }
6207  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6208  int d=pWTotaldegree(p);
6209  pLmDelete(p);
6210  if (d==1)
6211  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6212  else
6213  WerrorS("variable must have weight 1");
6214  return (d!=1);
6215 }

◆ jjHOMOG_W_M()

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

Definition at line 6216 of file iparith.cc.

6217 {
6218  intvec *w=(intvec *)v3->Data();
6219  intvec *vw=(intvec*)v2->Data();
6220  ideal v_id=(ideal)v1->Data();
6221  res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6222  return FALSE;
6223 }
BOOLEAN id_HomModuleW(ideal id, ideal Q, const intvec *w, const intvec *module_w, const ring r)

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4353 of file iparith.cc.

4354 {
4355  matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4356  IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4357  if (IDELEMS((ideal)mat)==0)
4358  {
4359  idDelete((ideal *)&mat);
4360  mat=(matrix)idInit(1,1);
4361  }
4362  else
4363  {
4364  MATROWS(mat)=1;
4365  mat->rank=1;
4366  idTest((ideal)mat);
4367  }
4368  res->data=(char *)mat;
4369  return FALSE;
4370 }

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4371 of file iparith.cc.

4372 {
4373  map m=(map)v->CopyD(MAP_CMD);
4374  omFreeBinAddr((ADDRESS)m->preimage);
4375  m->preimage=NULL;
4376  ideal I=(ideal)m;
4377  I->rank=1;
4378  res->data=(char *)I;
4379  return FALSE;
4380 }
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 7306 of file iparith.cc.

7307 {
7308  int s=1;
7309  leftv h=v;
7310  if (h!=NULL) s=exprlist_length(h);
7311  ideal id=idInit(s,1);
7312  int rank=1;
7313  int i=0;
7314  poly p;
7315  int dest_type=POLY_CMD;
7316  if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7317  while (h!=NULL)
7318  {
7319  // use standard type conversions to poly/vector
7320  int ri;
7321  int ht=h->Typ();
7322  if (ht==dest_type)
7323  {
7324  p=(poly)h->CopyD();
7325  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7326  }
7327  else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7328  {
7329  sleftv tmp;
7330  leftv hnext=h->next;
7331  h->next=NULL;
7332  iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7333  h->next=hnext;
7334  p=(poly)tmp.data;
7335  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7336  }
7337  else
7338  {
7339  idDelete(&id);
7340  return TRUE;
7341  }
7342  id->m[i]=p;
7343  i++;
7344  h=h->next;
7345  }
7346  id->rank=rank;
7347  res->data=(char *)id;
7348  return FALSE;
7349 }
int exprlist_length(leftv v)
Definition: ipshell.cc:552

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4381 of file iparith.cc.

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

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5616 of file iparith.cc.

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

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5621 of file iparith.cc.

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

5642 {
5643  res->data = (char *)id_Head((ideal)v->Data(),currRing);
5644  setFlag(res,FLAG_STD);
5645  return FALSE;
5646 }
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 4336 of file iparith.cc.

4337 {
4338 #ifdef HAVE_SHIFTBBA
4339  if (rIsLPRing(currRing))
4340  {
4341  int deg = (int)(long)v->Data();
4342  if (deg > currRing->N/currRing->isLPring)
4343  {
4344  WerrorS("degree bound of Letterplace ring is to small");
4345  return TRUE;
4346  }
4347  }
4348 #endif
4349  res->data = (char *)idMaxIdeal((int)(long)v->Data());
4350  setFlag(res,FLAG_STD);
4351  return FALSE;
4352 }
#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 5647 of file iparith.cc.

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

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5699 of file iparith.cc.

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

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5626 of file iparith.cc.

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

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4398 of file iparith.cc.

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

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4405 of file iparith.cc.

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

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4410 of file iparith.cc.

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

◆ jjINDEPSET2()

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

Definition at line 2504 of file iparith.cc.

2505 {
2506  assumeStdFlag(u);
2507  res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2508  currRing->qideal);
2509  return FALSE;
2510 }
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1103

◆ jjINDEX_I()

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

Definition at line 1390 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1412 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1448 of file iparith.cc.

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

◆ jjINDEX_P_IV()

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

Definition at line 1488 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1465 of file iparith.cc.

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

◆ jjINDEX_V()

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

Definition at line 1517 of file iparith.cc.

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

◆ jjINDEX_V_IV()

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

Definition at line 1524 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2517 of file iparith.cc.

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

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4416 of file iparith.cc.

4417 {
4418  ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4419  if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4420  res->data = result;
4421  return FALSE;
4422 }
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3761
#define TEST_OPT_PROT
Definition: options.h:104
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 6251 of file iparith.cc.

6252 {
6253  ideal I=(ideal)u->Data();
6254  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6255  res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6257  return FALSE;
6258 }
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:316
#define TEST_OPT_RETURN_SB
Definition: options.h:113

◆ jjINTERSECT()

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

Definition at line 2511 of file iparith.cc.

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

◆ jjINTERSECT3()

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

Definition at line 6238 of file iparith.cc.

6239 {
6240  ideal I1=(ideal)u->Data();
6241  ideal I2=(ideal)v->Data();
6242  ideal I3=(ideal)w->Data();
6243  resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6244  r[0]=I1;
6245  r[1]=I2;
6246  r[2]=I3;
6247  res->data=(char *)idMultSect(r,3);
6248  omFreeSize((ADDRESS)r,3*sizeof(ideal));
6249  return FALSE;
6250 }
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 7475 of file iparith.cc.

7476 {
7477  leftv h=v;
7478  int l=v->listLength();
7479  resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7480  BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7481  int t=0;
7482  // try to convert to IDEAL_CMD
7483  while (h!=NULL)
7484  {
7485  if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7486  {
7487  t=IDEAL_CMD;
7488  }
7489  else break;
7490  h=h->next;
7491  }
7492  // if failure, try MODUL_CMD
7493  if (t==0)
7494  {
7495  h=v;
7496  while (h!=NULL)
7497  {
7498  if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7499  {
7500  t=MODUL_CMD;
7501  }
7502  else break;
7503  h=h->next;
7504  }
7505  }
7506  // check for success in converting
7507  if (t==0)
7508  {
7509  WerrorS("cannot convert to ideal or module");
7510  return TRUE;
7511  }
7512  // call idMultSect
7513  h=v;
7514  int i=0;
7515  sleftv tmp;
7516  while (h!=NULL)
7517  {
7518  if (h->Typ()==t)
7519  {
7520  r[i]=(ideal)h->Data(); /*no copy*/
7521  h=h->next;
7522  }
7523  else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7524  {
7525  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7526  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7527  Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7528  return TRUE;
7529  }
7530  else
7531  {
7532  r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7533  copied[i]=TRUE;
7534  h=tmp.next;
7535  }
7536  i++;
7537  }
7538  res->rtyp=t;
7539  res->data=(char *)idMultSect(r,i);
7540  while(i>0)
7541  {
7542  i--;
7543  if (copied[i]) idDelete(&(r[i]));
7544  }
7545  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7546  omFreeSize((ADDRESS)r,l*sizeof(ideal));
7547  return FALSE;
7548 }

◆ jjINTMAT3()

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

Definition at line 6224 of file iparith.cc.

6225 {
6226  intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6227  intvec* arg = (intvec*) u->Data();
6228  int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6229 
6230  for (i=0; i<n; i++)
6231  {
6232  (*im)[i] = (*arg)[i];
6233  }
6234 
6235  res->data = (char *)im;
6236  return FALSE;
6237 }

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7711 of file iparith.cc.

7712 {
7713  int i=0;
7714  leftv h=v;
7715  if (h!=NULL) i=exprlist_length(h);
7716  intvec *iv=new intvec(i);
7717  i=0;
7718  while (h!=NULL)
7719  {
7720  if(h->Typ()==INT_CMD)
7721  {
7722  (*iv)[i]=(int)(long)h->Data();
7723  }
7724  else if (h->Typ()==INTVEC_CMD)
7725  {
7726  intvec *ivv=(intvec*)h->Data();
7727  for(int j=0;j<ivv->length();j++,i++)
7728  {
7729  (*iv)[i]=(*ivv)[j];
7730  }
7731  i--;
7732  }
7733  else
7734  {
7735  delete iv;
7736  return TRUE;
7737  }
7738  i++;
7739  h=h->next;
7740  }
7741  res->data=(char *)iv;
7742  return FALSE;
7743 }

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4434 of file iparith.cc.

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

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4423 of file iparith.cc.

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

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4428 of file iparith.cc.

4429 {
4430  res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4431  currRing->N)+1);
4432  return FALSE;
4433 }
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 4470 of file iparith.cc.

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

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4439 of file iparith.cc.

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

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2535 of file iparith.cc.

2536 {
2537  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2538  return jjStdJanetBasis(res,v,0);
2539 }
BOOLEAN jjStdJanetBasis(leftv res, leftv v, int flag)
flag: 0: JB, 1: SB
Definition: wrapper.cc:50

◆ jjJanetBasis2()

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

Definition at line 2529 of file iparith.cc.

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

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7744 of file iparith.cc.

7745 {
7746  const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7747  const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7748  const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7749  const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7750  leftv u1=u;
7751  leftv u2=u1->next;
7752  leftv u3=u2->next;
7753  leftv u4=u3->next;
7754  if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7755  {
7756  if(!pIsUnit((poly)u2->Data()))
7757  {
7758  WerrorS("2nd argument must be a unit");
7759  return TRUE;
7760  }
7761  res->rtyp=u1->Typ();
7762  res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7763  pCopy((poly)u2->Data()),(intvec*)u4->Data());
7764  return FALSE;
7765  }
7766  else
7767  if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7768  {
7769  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7770  {
7771  WerrorS("2nd argument must be a diagonal matrix of units");
7772  return TRUE;
7773  }
7774  res->rtyp=u1->Typ();
7775  res->data=(char*)idSeries(
7776  (int)(long)u3->Data(),
7777  idCopy((ideal)u1->Data()),
7778  mp_Copy((matrix)u2->Data(), currRing),
7779  (intvec*)u4->Data()
7780  );
7781  return FALSE;
7782  }
7783  else
7784  {
7785  Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7786  Tok2Cmdname(iiOp));
7787  return TRUE;
7788  }
7789 }
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2121
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:371

◆ jjJET_ID()

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

Definition at line 2545 of file iparith.cc.

2546 {
2547  res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2548  return FALSE;
2549 }
ideal id_Jet(const ideal i, int d, const ring R)

◆ jjJET_ID_IV()

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

Definition at line 6276 of file iparith.cc.

6277 {
6278  res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6279  (intvec *)w->Data(),currRing);
6280  return FALSE;
6281 }
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 6282 of file iparith.cc.

6283 {
6284  if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6285  {
6286  WerrorS("2nd argument must be a diagonal matrix of units");
6287  return TRUE;
6288  }
6289  res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6290  (matrix)v->CopyD());
6291  return FALSE;
6292 }

◆ jjJET_P()

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

Definition at line 2540 of file iparith.cc.

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

◆ jjJET_P_IV()

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

Definition at line 6259 of file iparith.cc.

6260 {
6261  int *iw=iv2array((intvec *)w->Data(),currRing);
6262  res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6263  omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6264  return FALSE;
6265 }
#define ppJetW(p, m, iv)
Definition: polys.h:368

◆ jjJET_P_P()

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

Definition at line 6266 of file iparith.cc.

6267 {
6268  if (!pIsUnit((poly)v->Data()))
6269  {
6270  WerrorS("2nd argument must be a unit");
6271  return TRUE;
6272  }
6273  res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6274  return FALSE;
6275 }
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4494

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4509 of file iparith.cc.

4510 {
4511  assumeStdFlag(v);
4512  res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4513  return FALSE;
4514 }
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1449

◆ jjKBASE2()

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

Definition at line 2550 of file iparith.cc.

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

◆ jjKERNEL()

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

Definition at line 2563 of file iparith.cc.

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

◆ jjKERNEL_M()

static BOOLEAN jjKERNEL_M ( leftv  res,
leftv  v 
)
static

Definition at line 4491 of file iparith.cc.

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

◆ jjKERNEL_SM()

static BOOLEAN jjKERNEL_SM ( leftv  res,
leftv  v 
)
static

Definition at line 4500 of file iparith.cc.

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

◆ jjKLAMMER()

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

Definition at line 1560 of file iparith.cc.

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

◆ jjKLAMMER_IV()

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

Definition at line 1572 of file iparith.cc.

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

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7827 of file iparith.cc.

7828 {
7829  if ((yyInRingConstruction)
7830  && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7831  {
7832  memcpy(res,u,sizeof(sleftv));
7833  u->Init();
7834  return FALSE;
7835  }
7836  leftv v=u->next;
7837  BOOLEAN b;
7838  if(v==NULL) // p()
7839  b=iiExprArith1(res,u,iiOp);
7840  else if ((v->next==NULL) // p(1)
7841  || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7842  {
7843  u->next=NULL;
7844  b=iiExprArith2(res,u,iiOp,v);
7845  u->next=v;
7846  }
7847  else // p(1,2), p undefined
7848  {
7849  if (v->Typ()!=INT_CMD)
7850  {
7851  Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
7852  return TRUE;
7853  }
7854  int l=u->listLength();
7855  char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7856  sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7857  char *s=nn;
7858  do
7859  {
7860  while (*s!='\0') s++;
7861  v=v->next;
7862  if (v->Typ()!=INT_CMD)
7863  {
7864  Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
7865  omFree((ADDRESS)nn);
7866  return TRUE;
7867  }
7868  sprintf(s,",%d",(int)(long)v->Data());
7869  } while (v->next!=NULL);
7870  while (*s!='\0') s++;
7871  nn=strcat(nn,")");
7872  char *n=omStrDup(nn);
7873  omFree((ADDRESS)nn);
7874  syMake(res,n);
7875  b=FALSE;
7876  }
7877  return b;
7878 }
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1599 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2567 of file iparith.cc.

2568 {
2569  return mpKoszul(res, u,v,NULL);
2570 }
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3091

◆ jjKoszul_Id()

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

Definition at line 2571 of file iparith.cc.

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

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4515 of file iparith.cc.

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

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4592 of file iparith.cc.

4593 {
4594  sleftv a2,a3;
4595  memset(&a2,0,sizeof(a2));
4596  memset(&a3,0,sizeof(a3));
4597  a2.rtyp=INT_CMD; a2.data=(void*)10;
4598  a3.rtyp=INT_CMD; a3.data=(void*)1;
4599  return nuLagSolve(res,v,&a2,&a3);
4600 }
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:4678

◆ jjLE_BI()

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

Definition at line 1201 of file iparith.cc.

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

◆ jjLE_I()

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

Definition at line 1205 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1210 of file iparith.cc.

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

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4523 of file iparith.cc.

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

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4537 of file iparith.cc.

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

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4555 of file iparith.cc.

4556 {
4557  poly p=(poly)v->Data();
4558  if (p == NULL)
4559  {
4560  res->data = (char*) NULL;
4561  }
4562  else
4563  {
4564  poly lm = pLmInit(p);
4565  pSetCoeff0(lm, nInit(1));
4566  res->data = (char*) lm;
4567  }
4568  return FALSE;
4569 }
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64

◆ jjLIFT()

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

Definition at line 2579 of file iparith.cc.

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

◆ jjLIFT3()

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

Definition at line 6939 of file iparith.cc.

6940 {
6941  if (w->rtyp!=IDHDL) return TRUE;
6942  int ul= IDELEMS((ideal)u->Data());
6943  int vl= IDELEMS((ideal)v->Data());
6944 #ifdef HAVE_SHIFTBBA
6945  if (rIsLPRing(currRing))
6946  {
6947  if (currRing->LPncGenCount < ul)
6948  {
6949  Werror("At least %d ncgen variables are needed for this computation.", ul);
6950  return TRUE;
6951  }
6952  }
6953 #endif
6954  ideal m
6955  = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6956  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6957  if (m==NULL) return TRUE;
6958  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6959  return FALSE;
6960 }
#define IDMATRIX(a)
Definition: ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7879 of file iparith.cc.

7880 {
7881  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7882  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7883  leftv u=U;
7884  leftv v=u->next;
7885  leftv w=v->next;
7886  leftv u4=w->next;
7887  if (w->rtyp!=IDHDL) return TRUE;
7888  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7889  {
7890  // see jjLIFT3
7891  ideal I=(ideal)u->Data();
7892  int ul= IDELEMS(I /*(ideal)u->Data()*/);
7893  int vl= IDELEMS((ideal)v->Data());
7894  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7895  ideal m
7896  = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7897  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7898  if (m==NULL) return TRUE;
7899  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7900  return FALSE;
7901  }
7902  else
7903  {
7904  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7905  "or (`module`,`module`,`matrix`,`string`) expected",
7906  Tok2Cmdname(iiOp));
7907  return TRUE;
7908  }
7909 }

◆ jjLIFTSTD()

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

Definition at line 2599 of file iparith.cc.

2600 {
2601  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2602  idhdl h=(idhdl)v->data;
2603 #ifdef HAVE_SHIFTBBA
2604  if (rIsLPRing(currRing))
2605  {
2606  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2607  {
2608  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2609  return TRUE;
2610  }
2611  }
2612 #endif
2613  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2614  res->data = (char *)idLiftStd((ideal)u->Data(),
2615  &(h->data.umatrix),testHomog);
2616  setFlag(res,FLAG_STD); v->flag=0;
2617  return FALSE;
2618 }
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition: ideals.cc:976

◆ jjLIFTSTD_ALG()

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

Definition at line 6984 of file iparith.cc.

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

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 7910 of file iparith.cc.

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

◆ jjLIFTSTD_SYZ()

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

Definition at line 6961 of file iparith.cc.

6962 {
6963  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6964  if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6965  idhdl hv=(idhdl)v->data;
6966  idhdl hw=(idhdl)w->data;
6967 #ifdef HAVE_SHIFTBBA
6968  if (rIsLPRing(currRing))
6969  {
6970  if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6971  {
6972  Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6973  return TRUE;
6974  }
6975  }
6976 #endif
6977  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6978  res->data = (char *)idLiftStd((ideal)u->Data(),
6979  &(hv->data.umatrix),testHomog,
6980  &(hw->data.uideal));
6981  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
6982  return FALSE;
6983 }

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 8000 of file iparith.cc.

8001 {
8002  int sl=0;
8003  if (v!=NULL) sl = v->listLength();
8004  lists L;
8005  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
8006  {
8007  int add_row_shift = 0;
8008  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
8009  if (weights!=NULL) add_row_shift=weights->min_in();
8010  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
8011  }
8012  else
8013  {
8015  leftv h=NULL;
8016  int i;
8017  int rt;
8018 
8019  L->Init(sl);
8020  for (i=0;i<sl;i++)
8021  {
8022  if (h!=NULL)
8023  { /* e.g. not in the first step:
8024  * h is the pointer to the old sleftv,
8025  * v is the pointer to the next sleftv
8026  * (in this moment) */
8027  h->next=v;
8028  }
8029  h=v;
8030  v=v->next;
8031  h->next=NULL;
8032  rt=h->Typ();
8033  if (rt==0)
8034  {
8035  L->Clean();
8036  Werror("`%s` is undefined",h->Fullname());
8037  return TRUE;
8038  }
8039  if (rt==RING_CMD)
8040  {
8041  L->m[i].rtyp=rt;
8042  L->m[i].data=rIncRefCnt(((ring)h->Data()));
8043  }
8044  else
8045  L->m[i].Copy(h);
8046  }
8047  }
8048  res->data=(char *)L;
8049  return FALSE;
8050 }
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:3182
static ring rIncRefCnt(ring r)
Definition: ring.h:837

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4574 of file iparith.cc.

4575 {
4576  lists l=(lists)v->Data();
4577  long mm=(long)atGet(v,"maxExp",INT_CMD);
4578  int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4579  ring r=rCompose(l,TRUE,mm,isLetterplace);
4580  res->data=(char *)r;
4581  return (r==NULL);
4582 }
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2783

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5514 of file iparith.cc.

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

◆ jjLOAD1()

static BOOLEAN jjLOAD1 ( leftv  ,
leftv  v 
)
static

Definition at line 4570 of file iparith.cc.

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

◆ jjLOAD2()

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

Definition at line 2619 of file iparith.cc.

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

◆ jjLOAD_E()

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

Definition at line 2623 of file iparith.cc.

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

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5590 of file iparith.cc.

5591 {
5592  if (!iiGetLibStatus(s))
5593  {
5594  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5597  BOOLEAN bo=jjLOAD(s,TRUE);
5598  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5599  Print("loading of >%s< failed\n",s);
5600  WerrorS_callback=WerrorS_save;
5601  errorreported=0;
5602  }
5603  return FALSE;
5604 }
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5585
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5586
BOOLEAN iiGetLibStatus(const char *lib)
Definition: iplib.cc:77

◆ jjLT_BI()

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

Definition at line 1214 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1218 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1223 of file iparith.cc.

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

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4601 of file iparith.cc.

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

7550 {
7551  /* computation of the inverse of a quadratic matrix A
7552  using the L-U-decomposition of A;
7553  There are two valid parametrisations:
7554  1) exactly one argument which is just the matrix A,
7555  2) exactly three arguments P, L, U which already
7556  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  If A is invertible, the list [1, A^(-1)] is returned,
7561  otherwise the list [0] is returned. Thus, the user may
7562  inspect the first entry of the returned list to see
7563  whether A is invertible. */
7564  matrix iMat; int invertible;
7565  const short t1[]={1,MATRIX_CMD};
7566  const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7567  if (iiCheckTypes(v,t1))
7568  {
7569  matrix aMat = (matrix)v->Data();
7570  int rr = aMat->rows();
7571  int cc = aMat->cols();
7572  if (rr != cc)
7573  {
7574  Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7575  return TRUE;
7576  }
7577  if (!idIsConstant((ideal)aMat))
7578  {
7579  WerrorS("matrix must be constant");
7580  return TRUE;
7581  }
7582  invertible = luInverse(aMat, iMat);
7583  }
7584  else if (iiCheckTypes(v,t2))
7585  {
7586  matrix pMat = (matrix)v->Data();
7587  matrix lMat = (matrix)v->next->Data();
7588  matrix uMat = (matrix)v->next->next->Data();
7589  int rr = uMat->rows();
7590  int cc = uMat->cols();
7591  if (rr != cc)
7592  {
7593  Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7594  rr, cc);
7595  return TRUE;
7596  }
7597  if (!idIsConstant((ideal)pMat)
7598  || (!idIsConstant((ideal)lMat))
7599  || (!idIsConstant((ideal)uMat))
7600  )
7601  {
7602  WerrorS("matricesx must be constant");
7603  return TRUE;
7604  }
7605  invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7606  }
7607  else
7608  {
7609  Werror("expected either one or three matrices");
7610  return TRUE;
7611  }
7612 
7613  /* build the return structure; a list with either one or two entries */
7615  if (invertible)
7616  {
7617  ll->Init(2);
7618  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7619  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7620  }
7621  else
7622  {
7623  ll->Init(1);
7624  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7625  }
7626 
7627  res->data=(char*)ll;
7628  return FALSE;
7629 }
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 7630 of file iparith.cc.

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

8721 {
8722  assume( e->Typ()==INT_CMD );
8723  Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8724  r->start =(int)(long)e->Data();
8725  return r;
8726 }
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

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

Definition at line 1653 of file iparith.cc.

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

◆ jjMATRIX_Id()

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

Definition at line 6762 of file iparith.cc.

6763 {
6764  int mi=(int)(long)v->Data();
6765  int ni=(int)(long)w->Data();
6766  if ((mi<1)||(ni<1))
6767  {
6768  Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6769  return TRUE;
6770  }
6771  matrix m=mpNew(mi,ni);
6772  ideal I=(ideal)u->CopyD(IDEAL_CMD);
6773  int i=si_min(IDELEMS(I),mi*ni);
6774  //for(i=i-1;i>=0;i--)
6775  //{
6776  // m->m[i]=I->m[i];
6777  // I->m[i]=NULL;
6778  //}
6779  memcpy(m->m,I->m,i*sizeof(poly));
6780  memset(I->m,0,i*sizeof(poly));
6781  id_Delete(&I,currRing);
6782  res->data = (char *)m;
6783  return FALSE;
6784 }

◆ jjMATRIX_Ma()

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

Definition at line 6798 of file iparith.cc.

6799 {
6800  int mi=(int)(long)v->Data();
6801  int ni=(int)(long)w->Data();
6802  if ((mi<1)||(ni<1))
6803  {
6804  Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6805  return TRUE;
6806  }
6807  matrix m=mpNew(mi,ni);
6808  matrix I=(matrix)u->CopyD(MATRIX_CMD);
6809  int r=si_min(MATROWS(I),mi);
6810  int c=si_min(MATCOLS(I),ni);
6811  int i,j;
6812  for(i=r;i>0;i--)
6813  {
6814  for(j=c;j>0;j--)
6815  {
6816  MATELEM(m,i,j)=MATELEM(I,i,j);
6817  MATELEM(I,i,j)=NULL;
6818  }
6819  }
6820  id_Delete((ideal *)&I,currRing);
6821  res->data = (char *)m;
6822  return FALSE;
6823 }

◆ jjMATRIX_Mo()

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

Definition at line 6785 of file iparith.cc.

6786 {
6787  int mi=(int)(long)v->Data();
6788  int ni=(int)(long)w->Data();
6789  if ((mi<0)||(ni<1))
6790  {
6791  Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6792  return TRUE;
6793  }
6794  res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6795  mi,ni,currRing);
6796  return FALSE;
6797 }

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4631 of file iparith.cc.

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

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6293 of file iparith.cc.

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

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4682 of file iparith.cc.

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

◆ jjMINUS_B()

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

Definition at line 920 of file iparith.cc.

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

◆ jjMINUS_B_P()

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

Definition at line 910 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 895 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 943 of file iparith.cc.

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

◆ jjMINUS_I()

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

Definition at line 879 of file iparith.cc.

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

◆ jjMINUS_IV()

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

Definition at line 933 of file iparith.cc.

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

◆ jjMINUS_MA()

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

Definition at line 953 of file iparith.cc.

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

◆ jjMINUS_N()

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

Definition at line 900 of file iparith.cc.

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

◆ jjMINUS_SM()

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

Definition at line 966 of file iparith.cc.

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

◆ jjMINUS_V()

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

Definition at line 905 of file iparith.cc.

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

◆ jjMOD_BI()

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

Definition at line 2687 of file iparith.cc.

2688 {
2689  number q=(number)v->Data();
2690  if (n_IsZero(q,coeffs_BIGINT))
2691  {
2693  return TRUE;
2694  }
2695  res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2696  return FALSE;
2697 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:625

◆ jjMOD_N()

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

Definition at line 2698 of file iparith.cc.

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

◆ jjMOD_P()

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

Definition at line 2709 of file iparith.cc.

2710 {
2711  poly q=(poly)v->Data();
2712  if (q==NULL)
2713  {
2715  return TRUE;
2716  }
2717  poly p=(poly)(u->Data());
2718  if (p==NULL)
2719  {
2720  res->data=NULL;
2721  return FALSE;
2722  }
2723  res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2724  q /*(poly)(v->Data())*/ ,currRing));
2725  return FALSE;
2726 }
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:702

◆ jjMODULO()

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

Definition at line 2634 of file iparith.cc.

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

◆ jjMODULO3()

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

Definition at line 6824 of file iparith.cc.

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

◆ jjMODULO3S()

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

Definition at line 6875 of file iparith.cc.

6876 {
6877  if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6878  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6879  tHomog hom=testHomog;
6880  if (w_u!=NULL)
6881  {
6882  w_u=ivCopy(w_u);
6883  hom=isHomog;
6884  }
6885  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6886  if (w_v!=NULL)
6887  {
6888  w_v=ivCopy(w_v);
6889  hom=isHomog;
6890  }
6891  if ((w_u!=NULL) && (w_v==NULL))
6892  w_v=ivCopy(w_u);
6893  if ((w_v!=NULL) && (w_u==NULL))
6894  w_u=ivCopy(w_v);
6895  ideal u_id=(ideal)u->Data();
6896  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
6897  ideal v_id=(ideal)v->Data();
6898  if (w_u!=NULL)
6899  {
6900  if ((*w_u).compare((w_v))!=0)
6901  {
6902  WarnS("incompatible weights");
6903  delete w_u; w_u=NULL;
6904  hom=testHomog;
6905  }
6906  else
6907  {
6908  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6909  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6910  {
6911  WarnS("wrong weights");
6912  delete w_u; w_u=NULL;
6913  hom=testHomog;
6914  }
6915  }
6916  }
6917  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
6918  if (w_u!=NULL)
6919  {
6920  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6921  }
6922  delete w_v;
6923  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6924  return FALSE;
6925 }

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 8051 of file iparith.cc.

8052 {
8053  leftv v=u->next;
8054  leftv w=v->next;
8055  leftv u4=w->next;
8056  GbVariant alg;
8057  ideal u_id,v_id;
8058  // we have 4 arguments
8059  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8060  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8061  if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8062  {
8063  u_id=(ideal)u->Data();
8064  v_id=(ideal)v->Data();
8065  alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8066  }
8067  else
8068  {
8069  Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8070  return TRUE;
8071  }
8072  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8073  tHomog hom=testHomog;
8074  if (w_u!=NULL)
8075  {
8076  w_u=ivCopy(w_u);
8077  hom=isHomog;
8078  }
8079  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8080  if (w_v!=NULL)
8081  {
8082  w_v=ivCopy(w_v);
8083  hom=isHomog;
8084  }
8085  if ((w_u!=NULL) && (w_v==NULL))
8086  w_v=ivCopy(w_u);
8087  if ((w_v!=NULL) && (w_u==NULL))
8088  w_u=ivCopy(w_v);
8089  if (w_u!=NULL)
8090  {
8091  if ((*w_u).compare((w_v))!=0)
8092  {
8093  WarnS("incompatible weights");
8094  delete w_u; w_u=NULL;
8095  hom=testHomog;
8096  }
8097  else
8098  {
8099  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8100  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8101  {
8102  WarnS("wrong weights");
8103  delete w_u; w_u=NULL;
8104  hom=testHomog;
8105  }
8106  }
8107  }
8108  idhdl h=(idhdl)w->data;
8109  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8110  if (w_u!=NULL)
8111  {
8112  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8113  }
8114  delete w_v;
8115  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8116  return FALSE;
8117 }

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2728 of file iparith.cc.

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

◆ jjMONITOR2()

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

Definition at line 2732 of file iparith.cc.

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

◆ jjMONOM()

static BOOLEAN jjMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 2773 of file iparith.cc.

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

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5664 of file iparith.cc.

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

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5669 of file iparith.cc.

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

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4661 of file iparith.cc.

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

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4676 of file iparith.cc.

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

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4696 of file iparith.cc.

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

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4708 of file iparith.cc.

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

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4721 of file iparith.cc.

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

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8118 of file iparith.cc.

8119 {
8120  res->data=(void *)ipNameList(IDROOT);
8121  return FALSE;
8122 }

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4726 of file iparith.cc.

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

◆ jjNEWSTRUCT2()

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

Definition at line 2797 of file iparith.cc.

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

◆ jjNEWSTRUCT3()

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

Definition at line 6489 of file iparith.cc.

6490 {
6491  // u: the name of the new type
6492  // v: the parent type
6493  // w: the elements
6494  newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6495  (const char *)w->Data());
6496  if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6497  return (d==NULL);
6498 }
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 5704 of file iparith.cc.

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

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5711 of file iparith.cc.

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

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4731 of file iparith.cc.

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

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3718 of file iparith.cc.

3719 {
3720  return FALSE;
3721 }

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 4017 of file iparith.cc.

4018 {
4019  number n = reinterpret_cast<number>(v->CopyD());
4020  res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
4021  n_Delete(&n,currRing->cf);
4022  return FALSE;
4023 }
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:605

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4736 of file iparith.cc.

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

◆ jjOP_BI_BIM()

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

Definition at line 279 of file iparith.cc.

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

◆ jjOP_BIM_BI()

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

Definition at line 266 of file iparith.cc.

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

◆ jjOP_BIM_I()

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

Definition at line 247 of file iparith.cc.

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

◆ jjOP_I_BIM()

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

Definition at line 262 of file iparith.cc.

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

◆ jjOP_I_IM()

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

Definition at line 319 of file iparith.cc.

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

◆ jjOP_I_IV()

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

Definition at line 300 of file iparith.cc.

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

◆ jjOP_IM_I()

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

Definition at line 304 of file iparith.cc.

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

◆ jjOP_IV_I()

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

Definition at line 283 of file iparith.cc.

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

◆ jjOP_REST()

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

Definition at line 507 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4741 of file iparith.cc.

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

◆ jjOPPOSE()

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

Definition at line 2976 of file iparith.cc.

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

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

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8123 of file iparith.cc.

8124 {
8125  if(v==NULL)
8126  {
8127  res->data=(char *)showOption();
8128  return FALSE;
8129  }
8130  res->rtyp=NONE;
8131  return setOption(res,v);
8132 }
char * showOption()
Definition: misc_ip.cc:709
void setOption(int ch)
Definition: shared.cc:1368

◆ jjOR_I()

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

Definition at line 1385 of file iparith.cc.

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

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4747 of file iparith.cc.

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

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4793 of file iparith.cc.

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

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4813 of file iparith.cc.

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

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4861 of file iparith.cc.

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

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4753 of file iparith.cc.

4754 {
4755  int i=(int)(long)v->Data();
4756  int p=0;
4757  p=rPar(currRing);
4758  if ((0<i) && (i<=p))
4759  {
4760  res->data=(char *)n_Param(i,currRing);
4761  }
4762  else
4763  {
4764  Werror("par number %d out of range 1..%d",i,p);
4765  return TRUE;
4766  }
4767  return FALSE;
4768 }
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1....
Definition: coeffs.h:780

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4769 of file iparith.cc.

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

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4775 of file iparith.cc.

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

◆ jjPARSTR2()

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

Definition at line 2811 of file iparith.cc.

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

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4583 of file iparith.cc.

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

◆ jjPFAC2()

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

Definition at line 3235 of file iparith.cc.

3236 {
3237  number n1; int i;
3238 
3239  if ((u->Typ() == BIGINT_CMD) ||
3240  ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3241  {
3242  n1 = (number)u->CopyD();
3243  }
3244  else if (u->Typ() == INT_CMD)
3245  {
3246  i = (int)(long)u->Data();
3247  n1 = n_Init(i, coeffs_BIGINT);
3248  }
3249  else
3250  {
3251  return TRUE;
3252  }
3253 
3254  i = (int)(long)v->Data();
3255 
3256  lists l = primeFactorisation(n1, i);
3257  n_Delete(&n1, coeffs_BIGINT);
3258  res->data = (char*)l;
3259  return FALSE;
3260 }
lists primeFactorisation(const number n, const int pBound)
Factorises a given bigint number n into its prime factors less than or equal to a given bound,...
Definition: misc_ip.cc:357

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5636 of file iparith.cc.

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

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5611 of file iparith.cc.

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

◆ jjPlural_mat_mat()

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

Definition at line 2888 of file iparith.cc.

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

◆ jjPlural_mat_poly()

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

Definition at line 2868 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2848 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2828 of file iparith.cc.

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

◆ jjPLUS_B()

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

Definition at line 783 of file iparith.cc.

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

◆ jjPLUS_B_P()

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

Definition at line 796 of file iparith.cc.

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

◆ jjPLUS_BI()

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

Definition at line 768 of file iparith.cc.

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

◆ jjPLUS_BIM()

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

Definition at line 815 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 756 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 874 of file iparith.cc.

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

◆ jjPLUS_IV()

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

Definition at line 805 of file iparith.cc.

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

◆ jjPLUS_MA()

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

Definition at line 825 of file iparith.cc.

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

◆ jjPLUS_MA_P()

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

Definition at line 849 of file iparith.cc.

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

◆ jjPLUS_N()

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

Definition at line 773 of file iparith.cc.

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

◆ jjPLUS_P_MA()

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

Definition at line 860 of file iparith.cc.

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

◆ jjPLUS_S()

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

Definition at line 864 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 837 of file iparith.cc.

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

◆ jjPLUS_V()

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

Definition at line 778 of file iparith.cc.

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

◆ jjPLUSMINUS_Gen()

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

Definition at line 632 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3732 of file iparith.cc.

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

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5659 of file iparith.cc.

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

◆ jjPOWER_BI()

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

Definition at line 569 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 523 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 626 of file iparith.cc.

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

◆ jjPOWER_N()

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

Definition at line 585 of file iparith.cc.

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

◆ jjPOWER_P()

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

Definition at line 603 of file iparith.cc.

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

◆ jjPREIMAGE()

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

Definition at line 6499 of file iparith.cc.

6500 {
6501  // handles preimage(r,phi,i) and kernel(r,phi)
6502  idhdl h;
6503  ring rr;
6504  map mapping;
6505  BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6506 
6507  if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6508  {
6509  WerrorS("2nd/3rd arguments must have names");
6510  return TRUE;
6511  }
6512  rr=(ring)u->Data();
6513  const char *ring_name=u->Name();
6514  if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6515  {
6516  if (h->typ==MAP_CMD)
6517  {
6518  mapping=IDMAP(h);
6519  idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6520  if ((preim_ring==NULL)
6521  || (IDRING(preim_ring)!=currRing))
6522  {
6523  Werror("preimage ring `%s` is not the basering",mapping->preimage);
6524  return TRUE;
6525  }
6526  }
6527  else if (h->typ==IDEAL_CMD)
6528  {
6529  mapping=IDMAP(h);
6530  }
6531  else
6532  {
6533  Werror("`%s` is no map nor ideal",IDID(h));
6534  return TRUE;
6535  }
6536  }
6537  else
6538  {
6539  Werror("`%s` is not defined in `%s`",v->name,ring_name);
6540  return TRUE;
6541  }
6542  ideal image;
6543  if (kernel_cmd) image=idInit(1,1);
6544  else
6545  {
6546  if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6547  {
6548  if (h->typ==IDEAL_CMD)
6549  {
6550  image=IDIDEAL(h);
6551  }
6552  else
6553  {
6554  Werror("`%s` is no ideal",IDID(h));
6555  return TRUE;
6556  }
6557  }
6558  else
6559  {
6560  Werror("`%s` is not defined in `%s`",w->name,ring_name);
6561  return TRUE;
6562  }
6563  }
6564  if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6565  || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6566  {
6567  WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6568  }
6569  res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6570  if (kernel_cmd) idDelete(&image);
6571  return (res->data==NULL/* is of type ideal, should not be NULL*/);
6572 }
#define IDMAP(a)
Definition: ipid.h:135
#define IDIDEAL(a)
Definition: ipid.h:133
#define IDID(a)
Definition: ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:57
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:760
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4825 of file iparith.cc.

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

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4831 of file iparith.cc.

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

◆ jjPROC()

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

Definition at line 1617 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3809 of file iparith.cc.

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

◆ jjPROC3()

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

Definition at line 5999 of file iparith.cc.

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

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4837 of file iparith.cc.

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

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8598 of file iparith.cc.

8599 {
8600  if ((INPUT->Typ() != MATRIX_CMD) ||
8601  (INPUT->next->Typ() != NUMBER_CMD) ||
8602  (INPUT->next->next->Typ() != NUMBER_CMD) ||
8603  (INPUT->next->next->next->Typ() != NUMBER_CMD))
8604  {
8605  WerrorS("expected (matrix, number, number, number) as arguments");
8606  return TRUE;
8607  }
8608  leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8609  res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8610  (number)(v->Data()),
8611  (number)(w->Data()),
8612  (number)(x->Data()));
8613  return FALSE;
8614 }
lists qrDoubleShift(const matrix A, const number tol1, const number tol2, const number tol3, const ring r=currRing)
Computes all eigenvalues of a given real quadratic matrix with multiplicites.

◆ jjQUOT()

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

Definition at line 3049 of file iparith.cc.

3050 {
3051  res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3052  hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3054  return FALSE;
3055 }
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1494

◆ jjRANDOM()

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

Definition at line 3056 of file iparith.cc.

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

◆ jjRANDOM_Im()

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

Definition at line 6573 of file iparith.cc.

6574 {
6575  int di, k;
6576  int i=(int)(long)u->Data();
6577  int r=(int)(long)v->Data();
6578  int c=(int)(long)w->Data();
6579  if ((r<=0) || (c<=0)) return TRUE;
6580  intvec *iv = new intvec(r, c, 0);
6581  if (iv->rows()==0)
6582  {
6583  delete iv;
6584  return TRUE;
6585  }
6586  if (i!=0)
6587  {
6588  if (i<0) i = -i;
6589  di = 2 * i + 1;
6590  for (k=0; k<iv->length(); k++)
6591  {
6592  (*iv)[k] = ((siRand() % di) - i);
6593  }
6594  }
6595  res->data = (char *)iv;
6596  return FALSE;
6597 }

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4899 of file iparith.cc.

4900 {
4901  matrix m =(matrix)v->Data();
4902  int rank = luRank(m, 0);
4903  res->data =(char *)(long)rank;
4904  return FALSE;
4905 }
int luRank(const matrix aMat, const bool isRowEchelon, const ring R)
Computes the rank of a given (m x n)-matrix.

◆ jjRANK2()

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

Definition at line 3064 of file iparith.cc.

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

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5631 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4906 of file iparith.cc.

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

◆ jjREAD2()

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

Definition at line 3073 of file iparith.cc.

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

◆ jjREDUCE3_CID()

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

Definition at line 7018 of file iparith.cc.

7019 {
7020  assumeStdFlag(v);
7021  if (!idIsZeroDim((ideal)v->Data()))
7022  {
7023  Werror("`%s` must be 0-dimensional",v->Name());
7024  return TRUE;
7025  }
7026  res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7027  (matrix)w->CopyD());
7028  return FALSE;
7029 }
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:176
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:2325

◆ jjREDUCE3_CP()

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

Definition at line 7006 of file iparith.cc.

7007 {
7008  assumeStdFlag(v);
7009  if (!idIsZeroDim((ideal)v->Data()))
7010  {
7011  Werror("`%s` must be 0-dimensional",v->Name());
7012  return TRUE;
7013  }
7014  res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
7015  (poly)w->CopyD());
7016  return FALSE;
7017 }

◆ jjREDUCE3_ID()

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

Definition at line 7037 of file iparith.cc.

7038 {
7039  assumeStdFlag(v);
7040  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
7041  0,(int)(long)w->Data());
7042  return FALSE;
7043 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3182

◆ jjREDUCE3_P()

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

Definition at line 7030 of file iparith.cc.

7031 {
7032  assumeStdFlag(v);
7033  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
7034  0,(int)(long)w->Data());
7035  return FALSE;
7036 }

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8133 of file iparith.cc.

8134 {
8135  leftv u1=u;
8136  leftv u2=u1->next;
8137  leftv u3=u2->next;
8138  leftv u4=u3->next;
8139  int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8140  int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8141  if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8142  {
8143  int save_d=Kstd1_deg;
8144  Kstd1_deg=(int)(long)u3->Data();
8145  kModW=(intvec *)u4->Data();
8146  BITSET save2;
8147  SI_SAVE_OPT2(save2);
8149  u2->next=NULL;
8150  BOOLEAN r=jjCALL2ARG(res,u);
8151  kModW=NULL;
8152  Kstd1_deg=save_d;
8153  SI_RESTORE_OPT2(save2);
8154  u->next->next=u3;
8155  return r;
8156  }
8157  else
8158  if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8159  (u4->Typ()==INT_CMD))
8160  {
8161  assumeStdFlag(u3);
8162  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8163  {
8164  WerrorS("2nd argument must be a diagonal matrix of units");
8165  return TRUE;
8166  }
8167  res->data=(char*)redNF(
8168  idCopy((ideal)u3->Data()),
8169  idCopy((ideal)u1->Data()),
8170  mp_Copy((matrix)u2->Data(), currRing),
8171  (int)(long)u4->Data()
8172  );
8173  return FALSE;
8174  }
8175  else
8176  if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8177  (u4->Typ()==INT_CMD))
8178  {
8179  poly u1p;
8180  if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8181  else u1p=(poly)u1->Data();
8182  poly u2p;
8183  if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8184  else u2p=(poly)u2->Data();
8185  assumeStdFlag(u3);
8186  if(!pIsUnit(u2p))
8187  {
8188  WerrorS("2nd argument must be a unit");
8189  return TRUE;
8190  }
8191  res->rtyp=POLY_CMD;
8192  res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8193  pCopy(u2p),(int)(long)u4->Data());
8194  return FALSE;
8195  }
8196  else
8197  {
8198  Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8199  Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8200  Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8201  return TRUE;
8202  }
8203 }
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:7170
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 Sy_bit(x)
Definition: options.h:31
#define V_DEG_STOP
Definition: options.h:73
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
#define BITSET
Definition: structs.h:16

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 8204 of file iparith.cc.

8205 {
8206  leftv u1=u;
8207  leftv u2=u1->next;
8208  leftv u3=u2->next;
8209  leftv u4=u3->next;
8210  leftv u5=u4->next;
8211  if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8212  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8213  {
8214  assumeStdFlag(u3);
8215  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8216  {
8217  WerrorS("2nd argument must be a diagonal matrix of units");
8218  return TRUE;
8219  }
8220  res->data=(char*)redNF(
8221  idCopy((ideal)u3->Data()),
8222  idCopy((ideal)u1->Data()),
8223  mp_Copy((matrix)u2->Data(),currRing),
8224  (int)(long)u4->Data(),
8225  (intvec*)u5->Data()
8226  );
8227  return FALSE;
8228  }
8229  else
8230  if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8231  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8232  {
8233  assumeStdFlag(u3);
8234  if(!pIsUnit((poly)u2->Data()))
8235  {
8236  WerrorS("2nd argument must be a unit");
8237  return TRUE;
8238  }
8239  res->rtyp=POLY_CMD;
8240  res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8241  pCopy((poly)u2->Data()),
8242  (int)(long)u4->Data(),(intvec*)u5->Data());
8243  return FALSE;
8244  }
8245  else
8246  {
8247  Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8248  Tok2Cmdname(iiOp));
8249  return TRUE;
8250  }
8251 }

◆ jjREDUCE_ID()

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

Definition at line 3097 of file iparith.cc.

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

◆ jjREDUCE_P()

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

Definition at line 3089 of file iparith.cc.

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

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4910 of file iparith.cc.

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

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4915 of file iparith.cc.

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

◆ jjRES()

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

Definition at line 3106 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 7045 of file iparith.cc.

7046 {
7047  int maxl=(int)v->Data();
7048  ideal u_id=(ideal)u->Data();
7049  int l=0;
7050  resolvente r;
7051  intvec **weights=NULL;
7052  int wmaxl=maxl;
7053  maxl--;
7054  unsigned save_opt=si_opt_1;
7056  if ((maxl==-1) && (iiOp!=MRES_CMD))
7057  maxl = currRing->N-1;
7058  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7059  {
7060  intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7061  if (iv!=NULL)
7062  {
7063  l=1;
7064  if (!idTestHomModule(u_id,currRing->qideal,iv))
7065  {
7066  WarnS("wrong weights");
7067  iv=NULL;
7068  }
7069  else
7070  {
7071  weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7072  weights[0] = ivCopy(iv);
7073  }
7074  }
7075  r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7076  }
7077  else
7078  r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7079  if (r==NULL) return TRUE;
7080  int t3=u->Typ();
7081  iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7082  si_opt_1=save_opt;
7083  return FALSE;
7084 }
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:847
EXTERN_VAR omBin char_ptr_bin
Definition: structs.h:77
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:389
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:855

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 8252 of file iparith.cc.

8253 {
8254  unsigned i=1;
8255  unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8256  if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8257  //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8258  // sArithBase.nCmdAllocated);
8259  for(i=0; i<nCount; i++)
8260  {
8261  Print("%-20s",sArithBase.sCmds[i+1].name);
8262  if(i+1+nCount<sArithBase.nCmdUsed)
8263  Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8264  if(i+1+2*nCount<sArithBase.nCmdUsed)
8265  Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8266  //if ((i%3)==1) PrintLn();
8267  PrintLn();
8268  }
8269  PrintLn();
8271  return FALSE;
8272 }
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8274 of file iparith.cc.

8275 {
8276  int i=1;
8277  int l = 0;
8278  int k = 0;
8280  struct blackbox_list *bb_list = NULL;
8281  unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8282 
8283  if ((3*nCount) < sArithBase.nCmdUsed)
8284  {
8285  nCount++;
8286  }
8287  bb_list = getBlackboxTypes();
8288  // count the number of entries;
8289  for (i=0; i<nCount; i++)
8290  {
8291  l++;
8292  if (i + 1 + nCount < sArithBase.nCmdUsed)
8293  {
8294  l++;
8295  }
8296  if(i+1+2*nCount<sArithBase.nCmdUsed)
8297  {
8298  l++;
8299  }
8300  }
8301  for (i = 0; i < bb_list->count; i++)
8302  {
8303  if (bb_list->list[i] != NULL)
8304  {
8305  l++;
8306  }
8307  }
8308  // initiate list
8309  L->Init(l);
8310  k = 0;
8311  for (i=0; i<nCount; i++)
8312  {
8313  L->m[k].rtyp = STRING_CMD;
8314  L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8315  k++;
8316  // Print("%-20s", sArithBase.sCmds[i+1].name);
8317  if (i + 1 + nCount < sArithBase.nCmdUsed)
8318  {
8319  L->m[k].rtyp = STRING_CMD;
8320  L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8321  k++;
8322  // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8323  }
8324  if(i+1+2*nCount<sArithBase.nCmdUsed)
8325  {
8326  L->m[k].rtyp = STRING_CMD;
8327  L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8328  k++;
8329  // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8330  }
8331  // PrintLn();
8332  }
8333 
8334  // assign blackbox types
8335  for (i = 0; i < bb_list->count; i++)
8336  {
8337  if (bb_list->list[i] != NULL)
8338  {
8339  L->m[k].rtyp = STRING_CMD;
8340  // already used strdup in getBlackBoxTypes
8341  L->m[k].data = bb_list->list[i];
8342  k++;
8343  }
8344  }
8345  // free the struct (not the list entries itself, which were allocated
8346  // by strdup)
8347  omfree(bb_list->list);
8348  omfree(bb_list);
8349 
8350  // pass the resultant list to the res datastructure
8351  res->data=(void *)L;
8352 
8353  return FALSE;
8354 }
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition: blackbox.cc:244
void ** list
Definition: blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition: blackbox.h:84
#define omfree(addr)
Definition: omAllocDecl.h:237

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4877 of file iparith.cc.

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

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8727 of file iparith.cc.

8728 {
8729  int c=(int)(long)u->Data();
8730  switch(c)
8731  {
8732  case 0:{
8733  PrintS("delete all variables\n");
8734  killlocals(0);
8735  WerrorS("restarting...");
8736  break;
8737  };
8738  default: WerrorS("not implemented");
8739  }
8740  return FALSE;
8741 }
void killlocals(int v)
Definition: ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5294 of file iparith.cc.

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

◆ jjRING3()

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

Definition at line 7086 of file iparith.cc.

7087 {
7088  res->data=(void *)rInit(u,v,w);
7089  return (res->data==NULL);
7090 }
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5625

◆ jjRING_1()

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

Definition at line 1673 of file iparith.cc.

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

◆ jjRING_2()

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

Definition at line 6006 of file iparith.cc.

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

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4942 of file iparith.cc.

4943 {
4944  ring r=(ring)v->Data();
4945  if (r!=NULL)
4946  res->data = (char *)rDecompose_list_cf((ring)v->Data());
4947  return (r==NULL)||(res->data==NULL);
4948 }
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:2122

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8698 of file iparith.cc.

8699 {
8700  //Print("construct ring\n");
8701  if (a->Typ()!=CRING_CMD)
8702  {
8703  WerrorS("expected `cring` [ `id` ... ]");
8704  return TRUE;
8705  }
8706  assume(a->next!=NULL);
8707  leftv names=a->next;
8708  int N=names->listLength();
8709  char **n=(char**)omAlloc0(N*sizeof(char*));
8710  for(int i=0; i<N;i++,names=names->next)
8711  {
8712  n[i]=(char *)names->Name();
8713  }
8714  coeffs cf=(coeffs)a->CopyD();
8715  res->data=rDefault(cf,N,n, ringorder_dp);
8716  omFreeSize(n,N*sizeof(char*));
8717  return FALSE;
8718 }
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 4920 of file iparith.cc.

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

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4935 of file iparith.cc.

4936 {
4937  coeffs r=(coeffs)v->Data();
4938  if (r!=NULL)
4939  return rDecompose_CF(res,r);
4940  return TRUE;
4941 }
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1949

◆ jjRMINUS()

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

Definition at line 3261 of file iparith.cc.

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

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5674 of file iparith.cc.

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

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4949 of file iparith.cc.

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

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4955 of file iparith.cc.

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

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4960 of file iparith.cc.

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

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4965 of file iparith.cc.

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

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5684 of file iparith.cc.

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

◆ jjRPLUS()

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

Definition at line 3267 of file iparith.cc.

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

◆ jjRSUM()

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

Definition at line 3280 of file iparith.cc.

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

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5679 of file iparith.cc.

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

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 4970 of file iparith.cc.

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

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 5017 of file iparith.cc.

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

◆ jjSBA_1()

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

Definition at line 5043 of file iparith.cc.

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

◆ jjSBA_2()

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

Definition at line 5069 of file iparith.cc.

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

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3789 of file iparith.cc.

3790 {
3791  if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3792  else
3793  {
3794  ring r=(ring)u->Data();
3795  idhdl h=rFindHdl(r,NULL);
3796  if (h==NULL)
3797  {
3798  char name_buffer[100];
3799  STATIC_VAR int ending=1000000;
3800  ending++;
3801  sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3802  h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3803  IDRING(h)=rIncRefCnt(r);
3804  }
3805  rSetHdl(h);
3806  }
3807  return FALSE;
3808 }
#define STATIC_VAR
Definition: globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1701
void rSetHdl(idhdl h)
Definition: ipshell.cc:5126

◆ jjSIMPL_ID()

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

Definition at line 3294 of file iparith.cc.

3295 {
3296  int sw = (int)(long)v->Data();
3297  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3298  ideal id = (ideal)u->CopyD(IDEAL_CMD);
3299  if (sw & SIMPL_LMDIV)
3300  {
3301  id_DelDiv(id,currRing);
3302  }
3303  if (sw & SIMPL_LMEQ)
3304  {
3306  }
3307  if (sw & SIMPL_MULT)
3308  {
3310  }
3311  else if(sw & SIMPL_EQU)
3312  {
3313  id_DelEquals(id,currRing);
3314  }
3315  if (sw & SIMPL_NULL)
3316  {
3317  idSkipZeroes(id);
3318  }
3319  if (sw & SIMPL_NORM)
3320  {
3321  id_Norm(id,currRing);
3322  }
3323  if (sw & SIMPL_NORMALIZE)
3324  {
3325  id_Normalize(id,currRing);
3326  }
3327  res->data = (char * )id;
3328  return FALSE;
3329 }
#define SIMPL_EQU
Definition: iparith.cc:3291
#define SIMPL_NORM
Definition: iparith.cc:3293
#define SIMPL_LMEQ
Definition: iparith.cc:3289
#define SIMPL_NULL
Definition: iparith.cc:3292
#define SIMPL_MULT
Definition: iparith.cc:3290
#define SIMPL_NORMALIZE
Definition: iparith.cc:3287
#define SIMPL_LMDIV
Definition: iparith.cc:3288
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
void id_Normalize(ideal I, const ring r)
normialize all polys in id
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.

◆ jjSIMPL_P()

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

Definition at line 3389 of file iparith.cc.

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

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4975 of file iparith.cc.

4976 {
4977  const bool bIsSCA = rIsSCA(currRing);
4978 
4979  if ((currRing->qideal!=NULL) && !bIsSCA)
4980  {
4981  WerrorS("qring not supported by slimgb at the moment");
4982  return TRUE;
4983  }
4985  {
4986  WerrorS("ordering must be global for slimgb");
4987  return TRUE;
4988  }
4990  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4991  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4992  // tHomog hom=testHomog;
4993  ideal u_id=(ideal)u->Data();
4994  if (w!=NULL)
4995  {
4996  if (!idTestHomModule(u_id,currRing->qideal,w))
4997  {
4998  WarnS("wrong weights");
4999  w=NULL;
5000  }
5001  else
5002  {
5003  w=ivCopy(w);
5004  // hom=isHomog;
5005  }
5006  }
5007 
5008  assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
5009  res->data=(char *)t_rep_gb(currRing,
5010  u_id,u_id->rank);
5011  //res->data=(char *)t_rep_gb(currRing, u_id);
5012 
5014  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5015  return FALSE;
5016 }
static bool rIsSCA(const ring r)
Definition: nc.h:190
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition: tgb.cc:3571

◆ jjSMATRIX_Mo()

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

Definition at line 6926 of file iparith.cc.

6927 {
6928  int mi=(int)(long)v->Data();
6929  int ni=(int)(long)w->Data();
6930  if ((mi<0)||(ni<1))
6931  {
6932  Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6933  return TRUE;
6934  }
6935  res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6936  mi,ni,currRing);
6937  return FALSE;
6938 }
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 5123 of file iparith.cc.

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

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10235 of file iparith.cc.

10236 {
10237  lists l=(lists)arg->Data();
10238  if (l->nr>0)
10239  {
10240  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10241  }
10242  return FALSE;
10243 }
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:10194

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5128 of file iparith.cc.

5129 {
5131  intvec *v=NULL;
5132  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5133  if (f==NULL) return TRUE;
5134  ivTest(v);
5136  l->Init(2);
5137  l->m[0].rtyp=IDEAL_CMD;
5138  l->m[0].data=(void *)f;
5139  l->m[1].rtyp=INTVEC_CMD;
5140  l->m[1].data=(void *)v;
5141  res->data=(void *)l;
5142  return FALSE;
5143 }
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1338

◆ jjSQR_FREE2()

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

Definition at line 3331 of file iparith.cc.

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

◆ jjSTATUS2()

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

Definition at line 3378 of file iparith.cc.

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

◆ jjSTATUS2L()

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

Definition at line 3383 of file iparith.cc.

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

◆ jjSTATUS3()

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

Definition at line 7091 of file iparith.cc.

7092 {
7093  int yes;
7094  jjSTATUS2(res, u, v);
7095  yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7096  omFreeBinAddr((ADDRESS) res->data);
7097  res->data = (void *)(long)yes;
7098  return FALSE;
7099 }
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3378

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8540 of file iparith.cc.

8541 {
8542  if ((v->Typ() != LINK_CMD) ||
8543  (v->next->Typ() != STRING_CMD) ||
8544  (v->next->next->Typ() != STRING_CMD) ||
8545  (v->next->next->next->Typ() != INT_CMD))
8546  return TRUE;
8547  jjSTATUS3(res, v, v->next, v->next->next);
8548 #if defined(HAVE_USLEEP)
8549  if (((long) res->data) == 0L)
8550  {
8551  int i_s = (int)(long) v->next->next->next->Data();
8552  if (i_s > 0)
8553  {
8554  usleep((int)(long) v->next->next->next->Data());
8555  jjSTATUS3(res, v, v->next, v->next->next);
8556  }
8557  }
8558 #elif defined(HAVE_SLEEP)
8559  if (((int) res->data) == 0)
8560  {
8561  int i_s = (int) v->next->next->next->Data();
8562  if (i_s > 0)
8563  {
8564  si_sleep((is - 1)/1000000 + 1);
8565  jjSTATUS3(res, v, v->next, v->next->next);
8566  }
8567  }
8568 #endif
8569  return FALSE;
8570 }
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:7091
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5095 of file iparith.cc.

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

◆ jjSTD_1()

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

Definition at line 3431 of file iparith.cc.

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

◆ jjSTD_HILB()

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

Definition at line 3405 of file iparith.cc.

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

◆ jjSTD_HILB_W()

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

Definition at line 7100 of file iparith.cc.

7101 {
7102  intvec *vw=(intvec *)w->Data(); // weights of vars
7103  if (vw->length()!=currRing->N)
7104  {
7105  Werror("%d weights for %d variables",vw->length(),currRing->N);
7106  return TRUE;
7107  }
7108  ideal result;
7109  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7110  tHomog hom=testHomog;
7111  ideal u_id=(ideal)(u->Data());
7112  if (ww!=NULL)
7113  {
7114  if (!idTestHomModule(u_id,currRing->qideal,ww))
7115  {
7116  WarnS("wrong weights");
7117  ww=NULL;
7118  }
7119  else
7120  {
7121  ww=ivCopy(ww);
7122  hom=isHomog;
7123  }
7124  }
7125  result=kStd(u_id,
7126  currRing->qideal,
7127  hom,
7128  &ww, // module weights
7129  (intvec *)v->Data(), // hilbert series
7130  0,0, // syzComp, newIdeal
7131  vw); // weights of vars
7133  res->data = (char *)result;
7134  setFlag(res,FLAG_STD);
7135  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7136  return FALSE;
7137 }

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8615 of file iparith.cc.

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

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8355 of file iparith.cc.

8356 {
8357  if (v == NULL)
8358  {
8359  res->data = omStrDup("");
8360  return FALSE;
8361  }
8362  int n = v->listLength();
8363  if (n == 1)
8364  {
8365  res->data = v->String();
8366  return FALSE;
8367  }
8368 
8369  char** slist = (char**) omAlloc(n*sizeof(char*));
8370  int i, j;
8371 
8372  for (i=0, j=0; i<n; i++, v = v ->next)
8373  {
8374  slist[i] = v->String();
8375  assume(slist[i] != NULL);
8376  j+=strlen(slist[i]);
8377  }
8378  char* s = (char*) omAlloc((j+1)*sizeof(char));
8379  *s='\0';
8380  for (i=0;i<n;i++)
8381  {
8382  strcat(s, slist[i]);
8383  omFree(slist[i]);
8384  }
8385  omFreeSize(slist, n*sizeof(char*));
8386  res->data = s;
8387  return FALSE;
8388 }

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5606 of file iparith.cc.

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

◆ jjSUBST_Bu()

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

Definition at line 6648 of file iparith.cc.

6649 {
6650  // generic conversion from polyBucket to poly:
6651  // force this to be the first try everytime
6652  poly p; int l;
6653  sBucket_pt bu=(sBucket_pt)w->CopyD();
6654  sBucketDestroyAdd(bu,&p,&l);
6655  sleftv tmpw;
6656  tmpw.Init();
6657  tmpw.rtyp=POLY_CMD;
6658  tmpw.data=p;
6659  return iiExprArith3(res, iiOp, u, v, &tmpw);
6660 }

◆ jjSUBST_Id()

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

Definition at line 6694 of file iparith.cc.

6695 {
6696  int ringvar;
6697  poly monomexpr;
6698  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6699  if (nok) return TRUE;
6700  ideal id=(ideal)u->Data();
6701  if (ringvar>0)
6702  {
6703  BOOLEAN overflow=FALSE;
6704  if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6705  {
6706  long deg_monexp=pTotaldegree(monomexpr);
6707  for(int i=IDELEMS(id)-1;i>=0;i--)
6708  {
6709  poly p=id->m[i];
6710  int mm=p_MaxExpPerVar(p,ringvar,currRing);
6711  if ((p!=NULL) && (mm!=0) &&
6712  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6713  {
6714  overflow=TRUE;
6715  break;
6716  }
6717  }
6718  }
6719  if (overflow)
6720  Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6721  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6722  {
6723  if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6724  else id=id_Copy(id,currRing);
6725  res->data = id_Subst(id, ringvar, monomexpr, currRing);
6726  }
6727  else
6728  res->data = idSubstPoly(id,ringvar,monomexpr);
6729  }
6730  else
6731  {
6732  if (rIsLPRing(currRing))
6733  {
6734  WerrorS("Substituting parameters not implemented for Letterplace rings.");
6735  return TRUE;
6736  }
6737  res->data = idSubstPar(id,-ringvar,monomexpr);
6738  }
6739  return FALSE;
6740 }
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:6620
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:426
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:387
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition: p_polys.cc:4941
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 6744 of file iparith.cc.

6745 {
6746  return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6747 }
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6752

◆ jjSUBST_Id_N()

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

Definition at line 6748 of file iparith.cc.

6749 {
6750  return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6751 }

◆ jjSUBST_Id_X()

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

Definition at line 6752 of file iparith.cc.

6753 {
6754  sleftv tmp;
6755  tmp.Init();
6756  // do not check the result, conversion from int/number to poly works always
6757  iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6758  BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6759  tmp.CleanUp();
6760  return b;
6761 }
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6694

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8571 of file iparith.cc.

8572 {
8573  leftv v = u->next; // number of args > 0
8574  if (v==NULL) return TRUE;
8575  leftv w = v->next;
8576  if (w==NULL) return TRUE;
8577  leftv rest = w->next;
8578 
8579  u->next = NULL;
8580  v->next = NULL;
8581  w->next = NULL;
8582  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8583  if ((rest!=NULL) && (!b))
8584  {
8585  leftv tmp_next=res->next;
8586  res->next=rest;
8587  sleftv tmp_res;
8588  tmp_res.Init();
8589  b = iiExprArithM(&tmp_res,res,iiOp);
8590  memcpy(res,&tmp_res,sizeof(tmp_res));
8591  res->next=tmp_next;
8592  }
8593  u->next = v;
8594  v->next = w;
8595  // rest was w->next, but is already cleaned
8596  return b;
8597 }

◆ jjSUBST_P()

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

Definition at line 6661 of file iparith.cc.

6662 {
6663  int ringvar;
6664  poly monomexpr;
6665  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6666  if (nok) return TRUE;
6667  poly p=(poly)u->Data();
6668  if (ringvar>0)
6669  {
6670  int mm=p_MaxExpPerVar(p,ringvar,currRing);
6671  if (!rIsLPRing(currRing) &&
6672  (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6673  ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6674  {
6675  Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6676  //return TRUE;
6677  }
6678  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6679  res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6680  else
6681  res->data= pSubstPoly(p,ringvar,monomexpr);
6682  }
6683  else
6684  {
6685  if (rIsLPRing(currRing))
6686  {
6687  WerrorS("Substituting parameters not implemented for Letterplace rings.");
6688  return TRUE;
6689  }
6690  res->data=pSubstPar(p,-ringvar,monomexpr);
6691  }
6692  return FALSE;
6693 }
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:404
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:267

◆ jjSUBST_Test()

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

Definition at line 6620 of file iparith.cc.

6622 {
6623  monomexpr=(poly)w->Data();
6624  poly p=(poly)v->Data();
6625 #if 0
6626  if (pLength(monomexpr)>1)
6627  {
6628  Werror("`%s` substitutes a ringvar only by a term",
6630  return TRUE;
6631  }
6632 #endif
6633  if ((ringvar=pVar(p))==0)
6634  {
6635  if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6636  {
6637  number n = pGetCoeff(p);
6638  ringvar= -n_IsParam(n, currRing);
6639  }
6640  if(ringvar==0)
6641  {
6642  WerrorS("ringvar/par expected");
6643  return TRUE;
6644  }
6645  }
6646  return FALSE;
6647 }
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5773
@ SUBST_CMD
Definition: tok.h:186

◆ jjSYZ_2()

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

Definition at line 3515 of file iparith.cc.

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

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5155 of file iparith.cc.

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

◆ jjTENSOR()

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

Definition at line 3578 of file iparith.cc.

3579 {
3580  ideal A=(ideal)u->Data();
3581  ideal B=(ideal)v->Data();
3582  res->data = (char *)sm_Tensor(A,B,currRing);
3583  return FALSE;
3584 }
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition: matpol.cc:1831

◆ jjTENSOR_Ma()

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

Definition at line 3585 of file iparith.cc.

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

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 8389 of file iparith.cc.

8390 {
8391  do
8392  {
8393  if (v->Typ()!=INT_CMD)
8394  return TRUE;
8395  test_cmd((int)(long)v->Data());
8396  v=v->next;
8397  }
8398  while (v!=NULL);
8399  return FALSE;
8400 }
void test_cmd(int i)
Definition: ipshell.cc:514

◆ jjTIMES_BI()

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

Definition at line 991 of file iparith.cc.

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

◆ jjTIMES_BIM()

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

Definition at line 1074 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 979 of file iparith.cc.

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

◆ jjTIMES_ID()

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

Definition at line 1055 of file iparith.cc.

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

◆ jjTIMES_IV()

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

Definition at line 1062 of file iparith.cc.

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

◆ jjTIMES_MA()

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

Definition at line 1138 of file iparith.cc.

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

◆ jjTIMES_MA_BI1()

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

Definition at line 1086 of file iparith.cc.

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

◆ jjTIMES_MA_BI2()

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

Definition at line 1096 of file iparith.cc.

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

◆ jjTIMES_MA_I1()

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

Definition at line 1129 of file iparith.cc.

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

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

◆ jjTIMES_MA_N1()

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

Definition at line 1118 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1125 of file iparith.cc.

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

◆ jjTIMES_MA_P1()

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

Definition at line 1100 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1109 of file iparith.cc.

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

◆ jjTIMES_N()

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

Definition at line 998 of file iparith.cc.

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

◆ jjTIMES_P()

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

Definition at line 1008 of file iparith.cc.

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

◆ jjTIMES_SM()

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

Definition at line 1152 of file iparith.cc.

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

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5226 of file iparith.cc.

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

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5231 of file iparith.cc.

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

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5236 of file iparith.cc.

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

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5275 of file iparith.cc.

5276 {
5277 #ifdef HAVE_PLURAL
5278  ideal result;
5279  ideal v_id=(ideal)a->Data();
5280  if (rIsPluralRing(currRing))
5281  result=(ideal)twostd(v_id);
5282  else /*commutative or shiftalgebra*/
5283  {
5284  return jjSTD(res,a);
5285  }
5286  res->data = (char *)result;
5287  setFlag(res,FLAG_STD);
5289  return FALSE;
5290 #else
5291  return TRUE;
5292 #endif
5293 }
#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 5355 of file iparith.cc.

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

3745 {
3746  number n=(number)u->CopyD(BIGINT_CMD);
3747  n=n_InpNeg(n,coeffs_BIGINT);
3748  res->data = (char *)n;
3749  return FALSE;
3750 }
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:554

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3781 of file iparith.cc.

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

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3751 of file iparith.cc.

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

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3774 of file iparith.cc.

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

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3768 of file iparith.cc.

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

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3756 of file iparith.cc.

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

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3763 of file iparith.cc.

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

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10244 of file iparith.cc.

10245 {
10246  lists l=(lists)arg->Data();
10247  if (l->nr>0)
10248  {
10249  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10250  int i, j, len;
10251  len=l->nr;
10252  i=0;
10253  while(i<len)
10254  {
10255  if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10256  {
10257  l->m[i].CleanUp();
10258  for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10259  memset(&(l->m[len]),0,sizeof(sleftv));
10260  l->m[len].rtyp=DEF_CMD;
10261  len--;
10262  }
10263  else
10264  i++;
10265  }
10266  //Print("new len:%d\n",len);
10267  }
10268  return FALSE;
10269 }

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5400 of file iparith.cc.

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

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5405 of file iparith.cc.

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

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5422 of file iparith.cc.

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

◆ jjVARSTR2()

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

Definition at line 3604 of file iparith.cc.

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

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5439 of file iparith.cc.

5440 {
5441  assumeStdFlag(v);
5442 #ifdef HAVE_SHIFTBBA
5443  if (rIsLPRing(currRing))
5444  {
5445 #ifdef HAVE_RINGS
5446  if (rField_is_Ring(currRing))
5447  {
5448  WerrorS("`vdim` is not implemented for letterplace rings over rings");
5449  return TRUE;
5450  }
5451 #endif
5452  if (currRing->qideal != NULL)
5453  {
5454  WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5455  return TRUE;
5456  }
5457  int kDim = lp_kDim((ideal)(v->Data()));
5458  res->data = (char *)(long)kDim;
5459  return (kDim == -2);
5460  }
5461 #endif
5462  long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5463  if (l<-1L)
5464  WerrorS("int overflow in vdim");
5465  res->data = (char *)l;
5466  return FALSE;
5467 }
long scMult0Int(ideal S, ideal Q)
Definition: hdegree.cc:950
int lp_kDim(const ideal _G)
Definition: hdegree.cc:2112

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5468 of file iparith.cc.

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

◆ jjWAIT1ST2()

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

Definition at line 3617 of file iparith.cc.

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

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5483 of file iparith.cc.

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

◆ jjWAITALL2()

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

Definition at line 3641 of file iparith.cc.

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

◆ jjWEDGE()

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

Definition at line 3689 of file iparith.cc.

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

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3694 of file iparith.cc.

3695 {
3696  return TRUE;
3697 }

◆ jjWRONG2()

static BOOLEAN jjWRONG2 ( leftv  ,
leftv  ,
leftv   
)
static

Definition at line 3698 of file iparith.cc.

3699 {
3700  return TRUE;
3701 }

◆ jjWRONG3()

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

Definition at line 3702 of file iparith.cc.

3703 {
3704  return TRUE;
3705 }

◆ Tok2Cmdname()

const char* Tok2Cmdname ( int  tok)

Definition at line 9649 of file iparith.cc.

9650 {
9651  if (tok <= 0)
9652  {
9653  return sArithBase.sCmds[0].name;
9654  }
9655  if (tok==ANY_TYPE) return "any_type";
9656  if (tok==COMMAND) return "command";
9657  if (tok==NONE) return "nothing";
9658  if (tok < 128)
9659  {
9660  Tok2Cmdname_buf[0]=(char)tok;
9661  return Tok2Cmdname_buf;
9662  }
9663  //if (tok==IFBREAK) return "if_break";
9664  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9665  //if (tok==ORDER_VECTOR) return "ordering";
9666  //if (tok==REF_VAR) return "ref";
9667  //if (tok==OBJECT) return "object";
9668  //if (tok==PRINT_EXPR) return "print_expr";
9669  if (tok==IDHDL) return "identifier";
9670  if (tok>MAX_TOK) return getBlackboxName(tok);
9671  unsigned i;
9672  for(i=0; i<sArithBase.nCmdUsed; i++)
9673  //while (sArithBase.sCmds[i].tokval!=0)
9674  {
9675  if ((sArithBase.sCmds[i].tokval == tok)&&
9676  (sArithBase.sCmds[i].alias==0))
9677  {
9678  return sArithBase.sCmds[i].name;
9679  }
9680  }
9681  // try gain for alias/old names:
9682  for(i=0; i<sArithBase.nCmdUsed; i++)
9683  {
9684  if (sArithBase.sCmds[i].tokval == tok)
9685  {
9686  return sArithBase.sCmds[i].name;
9687  }
9688  }
9689  return sArithBase.sCmds[0].name;
9690 }
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9648
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5586 of file iparith.cc.

5587 {
5589 }

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 217 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 218 of file iparith.cc.

◆ farey_cnt

long farey_cnt =0L

Definition at line 9 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 222 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 201 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2064 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9648 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5585 of file iparith.cc.