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

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 123 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 56 of file gentable.cc.

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

◆ sValCmd1

struct sValCmd1

Definition at line 75 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 66 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 83 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 93 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 180 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 106 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 108 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 99 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 102 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 105 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 110 of file iparith.cc.

◆ bit31

#define bit31   SIZEOF_LONG*8-1

Definition at line 120 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 101 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8959 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 216 of file iparith.cc.

◆ IPARITH

#define IPARITH

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

◆ NO_LRING

#define NO_LRING   128

Definition at line 107 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 100 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 103 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 104 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 8960 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 97 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3343 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3340 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3341 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3342 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3345 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3339 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3344 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 114 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 98 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 129 of file iparith.cc.

◆ proc2

Definition at line 149 of file iparith.cc.

◆ proc3

Definition at line 160 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9919{
9920 cmdnames *pCmdL = (cmdnames*)a;
9921 cmdnames *pCmdR = (cmdnames*)b;
9922
9923 if(a==NULL || b==NULL) return 0;
9924
9925 /* empty entries goes to the end of the list for later reuse */
9926 if(pCmdL->name==NULL) return 1;
9927 if(pCmdR->name==NULL) return -1;
9928
9929 /* $INVALID$ must come first */
9930 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9931 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9932
9933 /* tokval=-1 are reserved names at the end */
9934 if (pCmdL->tokval==-1)
9935 {
9936 if (pCmdR->tokval==-1)
9937 return strcmp(pCmdL->name, pCmdR->name);
9938 /* pCmdL->tokval==-1, pCmdL goes at the end */
9939 return 1;
9940 }
9941 /* pCmdR->tokval==-1, pCmdR goes at the end */
9942 if(pCmdR->tokval==-1) return -1;
9943
9944 return strcmp(pCmdL->name, pCmdR->name);
9945}
CanonicalForm b
Definition cfModGcd.cc:4111
#define NULL
Definition omList.c:12

◆ check_valid()

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

Definition at line 10144 of file iparith.cc.

10145{
10147 {
10148 if ((p & NC_MASK)==NO_NC)
10149 {
10150 WerrorS("not implemented for non-commutative rings");
10151 return TRUE;
10152 }
10153 else if ((p & NC_MASK)==COMM_PLURAL)
10154 {
10155 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10156 return FALSE;
10157 }
10158 /* else, ALLOW_PLURAL */
10159 }
10160 else if (rIsLPRing(currRing))
10161 {
10162 if ((p & ALLOW_LP)==0)
10163 {
10164 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10165 return TRUE;
10166 }
10167 }
10169 {
10170 if ((p & RING_MASK)==0 /*NO_RING*/)
10171 {
10172 WerrorS("not implemented for rings with rings as coeffients");
10173 return TRUE;
10174 }
10176 {
10177 WerrorS("not implemented for rings with rings as coeffients and non-global orderings");
10178 return TRUE;
10179 }
10180 /* else ALLOW_RING */
10181 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
10183 {
10184 WerrorS("domain required as coeffients");
10185 return TRUE;
10186 }
10187 /* else ALLOW_ZERODIVISOR */
10188 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
10189 {
10190 WarnS("considering the image in Q[...]");
10191 }
10192 }
10193 return FALSE;
10194}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int p
Definition cfModGcd.cc:4086
#define Warn
Definition emacs.cc:77
#define WarnS
Definition emacs.cc:78
void WerrorS(const char *s)
Definition feFopen.cc:24
VAR char my_yylinebuf[80]
Definition febase.cc:44
VAR int myynest
Definition febase.cc:41
#define COMM_PLURAL
Definition iparith.cc:101
#define NO_ZERODIVISOR
Definition iparith.cc:104
#define NO_LRING
Definition iparith.cc:107
#define ALLOW_LP
Definition iparith.cc:106
#define RING_MASK
Definition iparith.cc:97
#define WARN_RING
Definition iparith.cc:114
#define NC_MASK
Definition iparith.cc:92
const char * Tok2Cmdname(int tok)
Definition iparith.cc:9864
#define NO_NC
Definition iparith.cc:100
#define ZERODIVISOR_MASK
Definition iparith.cc:98
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
#define rField_is_Ring(R)
Definition ring.h:491

◆ iiArithAddCmd()

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

Definition at line 10085 of file iparith.cc.

10092{
10093 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
10094 // nTokval, nToktype, nPos);
10095 if(nPos>=0)
10096 {
10097 // no checks: we rely on a correct generated code in iparith.inc
10098 assume((unsigned)nPos < sArithBase.nCmdAllocated);
10099 assume(szName!=NULL);
10101 sArithBase.sCmds[nPos].alias = nAlias;
10102 sArithBase.sCmds[nPos].tokval = nTokval;
10103 sArithBase.sCmds[nPos].toktype = nToktype;
10105 //if(nTokval>0) sArithBase.nLastIdentifier++;
10106 }
10107 else
10108 {
10109 if(szName==NULL) return -1;
10111 if(nIndex>=0)
10112 {
10113 Print("'%s' already exists at %d\n", szName, nIndex);
10114 return -1;
10115 }
10116
10118 {
10119 /* needs to create new slots */
10120 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
10122 if(sArithBase.sCmds==NULL) return -1;
10124 }
10125 /* still free slots available */
10131
10136 {
10137 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10138 }
10139 //Print("L=%d\n", sArithBase.nLastIdentifier);
10140 }
10141 return 0;
10142}
#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:9918
int iiArithFindCmd(const char *szName)
Definition iparith.cc:9990
cmdnames * sCmds
array of existing commands
Definition iparith.cc:182
unsigned nLastIdentifier
valid identifiers are slot 1..nLastIdentifier
Definition iparith.cc:189
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition iparith.cc:197
unsigned nCmdAllocated
number of commands-slots allocated
Definition iparith.cc:188
unsigned nCmdUsed
number of commands used
Definition iparith.cc:187
#define assume(x)
Definition mod2.h:389
#define nSize(n)
Definition numbers.h:39
#define omStrDup(s)
#define omRealloc(addr, size)

◆ iiArithFindCmd()

int iiArithFindCmd ( const char szName)

Definition at line 9990 of file iparith.cc.

9991{
9992 int an=0;
9993 int i = 0,v = 0;
9995
9996 loop
9997 //for(an=0; an<sArithBase.nCmdUsed; )
9998 {
9999 if(an>=en-1)
10000 {
10001 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
10002 {
10003 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
10004 return an;
10005 }
10006 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
10007 {
10008 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
10009 return en;
10010 }
10011 else
10012 {
10013 //Print("RET- 1\n");
10014 return -1;
10015 }
10016 }
10017 i=(an+en)/2;
10018 if (*szName < *(sArithBase.sCmds[i].name))
10019 {
10020 en=i-1;
10021 }
10022 else if (*szName > *(sArithBase.sCmds[i].name))
10023 {
10024 an=i+1;
10025 }
10026 else
10027 {
10029 if(v<0)
10030 {
10031 en=i-1;
10032 }
10033 else if(v>0)
10034 {
10035 an=i+1;
10036 }
10037 else /*v==0*/
10038 {
10039 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
10040 return i;
10041 }
10042 }
10043 }
10044 //if(i>=0 && i<sArithBase.nCmdUsed)
10045 // return i;
10046 //PrintS("RET-2\n");
10047 return -2;
10048}
int i
Definition cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
#define loop
Definition structs.h:71

◆ iiArithGetCmd()

char * iiArithGetCmd ( int  nPos)

Definition at line 10050 of file iparith.cc.

10051{
10052 if(nPos<0) return NULL;
10053 if(nPos<(int)sArithBase.nCmdUsed)
10054 return sArithBase.sCmds[nPos].name;
10055 return NULL;
10056}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char szName)
extern

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char szName)

Definition at line 10058 of file iparith.cc.

10059{
10060 int nIndex;
10061 if(szName==NULL) return -1;
10062
10065 {
10066 Print("'%s' not found (%d)\n", szName, nIndex);
10067 return -1;
10068 }
10074
10075 /* fix last-identifier */
10078 {
10079 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10080 }
10081 //Print("L=%d\n", sArithBase.nLastIdentifier);
10082 return 0;
10083}
#define omFreeBinAddr(addr)

◆ iiExprArith1()

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

Definition at line 9332 of file iparith.cc.

9333{
9334 if (!errorreported)
9335 {
9336 res->Init();
9337#ifdef SIQ
9338 if (siq>0)
9339 {
9340 //Print("siq:%d\n",siq);
9342 memcpy(&d->arg1,a,sizeof(sleftv));
9343 a->Init();
9344 d->op=op;
9345 d->argc=1;
9346 res->data=(char *)d;
9347 res->rtyp=COMMAND;
9348 return FALSE;
9349 }
9350#endif
9351 int at=a->Typ();
9352 // handling bb-objects ----------------------------------------------------
9353 if(op>MAX_TOK) // explicit type conversion to bb
9354 {
9356 if (bb!=NULL)
9357 {
9358 res->rtyp=op;
9359 res->data=bb->blackbox_Init(bb);
9360 return bb->blackbox_Assign(res,a);
9361 }
9362 else
9363 return TRUE;
9364 }
9365 else if (at>MAX_TOK) // argument is of bb-type
9366 {
9368 if (bb!=NULL)
9369 {
9370 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9371 // if not defined, try generic routines (attrib, defined,..)
9372 }
9373 else
9374 return TRUE;
9375 }
9376 if (errorreported) return TRUE;
9377
9380 }
9381 a->CleanUp();
9382 return TRUE;
9383}
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:1048
void Init()
Definition subexpr.h:107
void CleanUp(ring r=currRing)
Definition subexpr.cc:351
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:9202
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition iparith.cc:9839
const struct sConvertTypes dConvertTypes[]
Definition table.h:1321
VAR omBin sip_command_bin
Definition ipid.cc:45
ip_command * command
Definition ipid.h:23
const struct sValCmd1 dArith1[]
Definition table.h:38
#define omAlloc0Bin(bin)
VAR BOOLEAN siq
Definition subexpr.cc:48
@ MAX_TOK
Definition tok.h:220
#define COMMAND
Definition tok.h:29

◆ iiExprArith1Tab()

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

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

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

Definition at line 9202 of file iparith.cc.

9203{
9204 res->Init();
9206
9207 if (!errorreported)
9208 {
9210 iiOp=op;
9211 int i = 0;
9212 while (dA1[i].cmd==op)
9213 {
9214 if (at==dA1[i].arg)
9215 {
9216 if (currRing!=NULL)
9217 {
9218 if (check_valid(dA1[i].valid_for,op)) break;
9219 }
9220 else
9221 {
9222 if (RingDependend(dA1[i].res))
9223 {
9224 WerrorS("no ring active (5)");
9225 break;
9226 }
9227 }
9228 if (traceit&TRACE_CALL)
9229 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9230 res->rtyp=dA1[i].res;
9231 if ((call_failed=dA1[i].p(res,a)))
9232 {
9233 break;// leave loop, goto error handling
9234 }
9235 if (a->Next()!=NULL)
9236 {
9238 failed=iiExprArith1(res->next,a->next,op);
9239 }
9240 a->CleanUp();
9241 return failed;
9242 }
9243 i++;
9244 }
9245 // implicite type conversion --------------------------------------------
9246 if (dA1[i].cmd!=op)
9247 {
9249 i=0;
9250 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9251 while (dA1[i].cmd==op)
9252 {
9253 int ai;
9254 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9255 if ((dA1[i].valid_for & NO_CONVERSION)==0)
9256 {
9257 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9258 {
9259 if (currRing!=NULL)
9260 {
9261 if (check_valid(dA1[i].valid_for,op)) break;
9262 }
9263 else
9264 {
9265 if (RingDependend(dA1[i].res))
9266 {
9267 WerrorS("no ring active (6)");
9268 break;
9269 }
9270 }
9271 if (traceit&TRACE_CALL)
9272 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9273 res->rtyp=dA1[i].res;
9275 || (call_failed=dA1[i].p(res,an)));
9276 // everything done, clean up temp. variables
9277 if (failed)
9278 {
9279 // leave loop, goto error handling
9280 break;
9281 }
9282 else
9283 {
9284 if (an->Next() != NULL)
9285 {
9286 res->next = (leftv)omAllocBin(sleftv_bin);
9287 failed=iiExprArith1(res->next,an->next,op);
9288 }
9289 // everything ok, clean up and return
9290 an->CleanUp();
9292 return failed;
9293 }
9294 }
9295 }
9296 i++;
9297 }
9298 an->CleanUp();
9300 }
9301 // error handling
9302 if (!errorreported)
9303 {
9304 if ((at==0) && (a->Fullname()!=sNoName_fe))
9305 {
9306 Werror("`%s` is not defined",a->Fullname());
9307 }
9308 else
9309 {
9310 i=0;
9311 const char *s = iiTwoOps(op);
9312 Werror("%s(`%s`) failed"
9313 ,s,Tok2Cmdname(at));
9314 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9315 {
9316 while (dA1[i].cmd==op)
9317 {
9318 if ((dA1[i].res!=0)
9319 && (dA1[i].p!=jjWRONG))
9320 Werror("expected %s(`%s`)"
9321 ,s,Tok2Cmdname(dA1[i].arg));
9322 i++;
9323 }
9324 }
9325 }
9326 }
9327 res->rtyp = UNKNOWN;
9328 }
9329 a->CleanUp();
9330 return TRUE;
9331}
int BOOLEAN
Definition auxiliary.h:88
leftv next
Definition subexpr.h:86
leftv Next()
Definition subexpr.h:136
const char * Fullname()
Definition subexpr.h:125
const CanonicalForm int s
Definition facAbsFact.cc:51
const char sNoName_fe[]
Definition fevoices.cc:57
int iiTestConvert(int inputType, int outputType)
Definition gentable.cc:298
const char * iiTwoOps(int t)
Definition gentable.cc:258
#define jjWRONG
Definition gentable.cc:124
static int RingDependend(int t)
Definition gentable.cc:23
#define NO_CONVERSION
Definition iparith.cc:116
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9332
static BOOLEAN check_valid(const int p, const int op)
Definition iparith.cc:10144
VAR int iiOp
Definition iparith.cc:218
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition ipconv.cc:457
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
#define omAllocBin(bin)
#define omFreeBin(addr, bin)
#define BVERBOSE(a)
Definition options.h:35
#define V_SHOW_USE
Definition options.h:52
EXTERN_VAR int traceit
Definition reporter.h:24
#define TRACE_CALL
Definition reporter.h:44
sleftv * leftv
Definition structs.h:53
#define UNKNOWN
Definition tok.h:224

◆ iiExprArith2()

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

Definition at line 9143 of file iparith.cc.

9144{
9145 res->Init();
9146
9147 if (!errorreported)
9148 {
9149#ifdef SIQ
9150 if (siq>0)
9151 {
9152 //Print("siq:%d\n",siq);
9154 memcpy(&d->arg1,a,sizeof(sleftv));
9155 a->Init();
9156 memcpy(&d->arg2,b,sizeof(sleftv));
9157 b->Init();
9158 d->argc=2;
9159 d->op=op;
9160 res->data=(char *)d;
9161 res->rtyp=COMMAND;
9162 return FALSE;
9163 }
9164#endif
9165 int at=a->Typ();
9166 int bt=b->Typ();
9167 // handling bb-objects ----------------------------------------------------
9168 if (at>MAX_TOK)
9169 {
9171 if (bb!=NULL)
9172 {
9173 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9174 // if not defined, try generic (attrib, ..)
9175 }
9176 else
9177 return TRUE;
9178 }
9179 else if ((bt>MAX_TOK)&&(op!='('))
9180 {
9182 if (bb!=NULL)
9183 {
9184 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9185 // if not defined, try generic (attrib, ..)
9186 }
9187 else
9188 return TRUE;
9189 }
9192 }
9193 a->CleanUp();
9194 b->CleanUp();
9195 return TRUE;
9196}
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:8970
const struct sValCmd2 dArith2[]
Definition table.h:325

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

9133{
9134 res->Init();
9135 leftv b=a->next;
9136 a->next=NULL;
9137 int bt=b->Typ();
9139 a->next=b;
9140 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
9141 return bo;
9142}

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

8975{
8977
8978 if (!errorreported)
8979 {
8980 int i=0;
8981 iiOp=op;
8982 while (dA2[i].cmd==op)
8983 {
8984 if ((at==dA2[i].arg1)
8985 && (bt==dA2[i].arg2))
8986 {
8987 res->rtyp=dA2[i].res;
8988 if (currRing!=NULL)
8989 {
8990 if (check_valid(dA2[i].valid_for,op)) break;
8991 }
8992 else
8993 {
8994 if (RingDependend(dA2[i].res))
8995 {
8996 WerrorS("no ring active (3)");
8997 break;
8998 }
8999 }
9000 if (traceit&TRACE_CALL)
9001 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
9002 if ((call_failed=dA2[i].p(res,a,b)))
9003 {
9004 break;// leave loop, goto error handling
9005 }
9006 a->CleanUp();
9007 b->CleanUp();
9008 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9009 return FALSE;
9010 }
9011 i++;
9012 }
9013 // implicite type conversion ----------------------------------------------
9014 if (dA2[i].cmd!=op)
9015 {
9016 int ai,bi;
9020 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9021 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
9022 while (dA2[i].cmd==op)
9023 {
9024 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9025 if ((dA2[i].valid_for & NO_CONVERSION)==0)
9026 {
9027 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
9028 {
9029 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
9030 {
9031 res->rtyp=dA2[i].res;
9032 if (currRing!=NULL)
9033 {
9034 if (check_valid(dA2[i].valid_for,op)) break;
9035 }
9036 else
9037 {
9038 if (RingDependend(dA2[i].res))
9039 {
9040 WerrorS("no ring active (4)");
9041 break;
9042 }
9043 }
9044 if (traceit&TRACE_CALL)
9045 Print("call %s(%s,%s)\n",iiTwoOps(op),
9046 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9047 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
9048 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
9049 || (call_failed=dA2[i].p(res,an,bn)));
9050 // everything done, clean up temp. variables
9051 if (failed)
9052 {
9053 // leave loop, goto error handling
9054 break;
9055 }
9056 else
9057 {
9058 // everything ok, clean up and return
9059 an->CleanUp();
9060 bn->CleanUp();
9063 return FALSE;
9064 }
9065 }
9066 }
9067 }
9068 i++;
9069 }
9070 an->CleanUp();
9071 bn->CleanUp();
9074 }
9075 // error handling ---------------------------------------------------
9076 const char *s=NULL;
9077 if (!errorreported)
9078 {
9079 if ((at==0) && (a->Fullname()!=sNoName_fe))
9080 {
9081 s=a->Fullname();
9082 }
9083 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9084 {
9085 s=b->Fullname();
9086 }
9087 if (s!=NULL)
9088 Werror("`%s` is not defined",s);
9089 else
9090 {
9091 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9092 s = iiTwoOps(op);
9093 if (proccall)
9094 {
9095 Werror("%s(`%s`,`%s`) failed"
9097 }
9098 else
9099 {
9100 Werror("`%s` %s `%s` failed"
9102 }
9103 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9104 {
9105 while (dA2[i].cmd==op)
9106 {
9107 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
9108 && (dA2[i].res!=0)
9109 && (dA2[i].p!=jjWRONG2))
9110 {
9111 if (proccall)
9112 Werror("expected %s(`%s`,`%s`)"
9113 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9114 else
9115 Werror("expected `%s` %s `%s`"
9116 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
9117 }
9118 i++;
9119 }
9120 }
9121 }
9122 }
9123 a->CleanUp();
9124 b->CleanUp();
9125 res->rtyp = UNKNOWN;
9126 }
9127 return TRUE;
9128}
#define jjWRONG2
Definition gentable.cc:125

◆ iiExprArith3()

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

Definition at line 9542 of file iparith.cc.

9543{
9544 res->Init();
9545
9546 if (!errorreported)
9547 {
9548#ifdef SIQ
9549 if (siq>0)
9550 {
9551 //Print("siq:%d\n",siq);
9553 memcpy(&d->arg1,a,sizeof(sleftv));
9554 a->Init();
9555 memcpy(&d->arg2,b,sizeof(sleftv));
9556 b->Init();
9557 memcpy(&d->arg3,c,sizeof(sleftv));
9558 c->Init();
9559 d->op=op;
9560 d->argc=3;
9561 res->data=(char *)d;
9562 res->rtyp=COMMAND;
9563 return FALSE;
9564 }
9565#endif
9566 int at=a->Typ();
9567 // handling bb-objects ----------------------------------------------
9568 if (at>MAX_TOK)
9569 {
9571 if (bb!=NULL)
9572 {
9573 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9574 // otherwise, try defaul (attrib,..)
9575 }
9576 else
9577 return TRUE;
9578 if (errorreported) return TRUE;
9579 }
9580 int bt=b->Typ();
9581 int ct=c->Typ();
9582
9583 iiOp=op;
9584 int i=0;
9585 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9587 }
9588 a->CleanUp();
9589 b->CleanUp();
9590 c->CleanUp();
9591 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9592 return TRUE;
9593}
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:9389
const struct sValCmd3 dArith3[]
Definition table.h:801

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

9598{
9599 res->Init();
9600 leftv b=a->next;
9601 a->next=NULL;
9602 int bt=b->Typ();
9603 leftv c=b->next;
9604 b->next=NULL;
9605 int ct=c->Typ();
9607 b->next=c;
9608 a->next=b;
9609 a->CleanUp(); // to cleanup the chain, content already done
9610 return bo;
9611}

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

9392{
9394
9395 assume(dA3[0].cmd==op);
9396
9397 if (!errorreported)
9398 {
9399 int i=0;
9400 iiOp=op;
9401 while (dA3[i].cmd==op)
9402 {
9403 if ((at==dA3[i].arg1)
9404 && (bt==dA3[i].arg2)
9405 && (ct==dA3[i].arg3))
9406 {
9407 res->rtyp=dA3[i].res;
9408 if (currRing!=NULL)
9409 {
9410 if (check_valid(dA3[i].valid_for,op)) break;
9411 }
9412 if (traceit&TRACE_CALL)
9413 Print("call %s(%s,%s,%s)\n",
9415 if ((call_failed=dA3[i].p(res,a,b,c)))
9416 {
9417 break;// leave loop, goto error handling
9418 }
9419 a->CleanUp();
9420 b->CleanUp();
9421 c->CleanUp();
9422 return FALSE;
9423 }
9424 i++;
9425 }
9426 // implicite type conversion ----------------------------------------------
9427 if (dA3[i].cmd!=op)
9428 {
9429 int ai,bi,ci;
9434 i=0;
9435 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9436 while (dA3[i].cmd==op)
9437 {
9438 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9439 {
9440 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9441 {
9442 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9443 {
9444 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9445 {
9446 res->rtyp=dA3[i].res;
9447 if (currRing!=NULL)
9448 {
9449 if (check_valid(dA3[i].valid_for,op)) break;
9450 }
9451 if (traceit&TRACE_CALL)
9452 Print("call %s(%s,%s,%s)\n",
9453 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9454 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9455 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9456 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9457 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9458 || (call_failed=dA3[i].p(res,an,bn,cn)));
9459 // everything done, clean up temp. variables
9460 if (failed)
9461 {
9462 // leave loop, goto error handling
9463 break;
9464 }
9465 else
9466 {
9467 // everything ok, clean up and return
9468 an->CleanUp();
9469 bn->CleanUp();
9470 cn->CleanUp();
9474 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9475 return FALSE;
9476 }
9477 }
9478 }
9479 }
9480 }
9481 i++;
9482 }
9483 an->CleanUp();
9484 bn->CleanUp();
9485 cn->CleanUp();
9489 }
9490 // error handling ---------------------------------------------------
9491 if (!errorreported)
9492 {
9493 const char *s=NULL;
9494 if ((at==0) && (a->Fullname()!=sNoName_fe))
9495 {
9496 s=a->Fullname();
9497 }
9498 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9499 {
9500 s=b->Fullname();
9501 }
9502 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9503 {
9504 s=c->Fullname();
9505 }
9506 if (s!=NULL)
9507 Werror("`%s` is not defined",s);
9508 else
9509 {
9510 i=0;
9511 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9512 const char *s = iiTwoOps(op);
9513 Werror("%s(`%s`,`%s`,`%s`) failed"
9515 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9516 {
9517 while (dA3[i].cmd==op)
9518 {
9519 if(((at==dA3[i].arg1)
9520 ||(bt==dA3[i].arg2)
9521 ||(ct==dA3[i].arg3))
9522 && (dA3[i].res!=0))
9523 {
9524 Werror("expected %s(`%s`,`%s`,`%s`)"
9525 ,s,Tok2Cmdname(dA3[i].arg1)
9526 ,Tok2Cmdname(dA3[i].arg2)
9527 ,Tok2Cmdname(dA3[i].arg3));
9528 }
9529 i++;
9530 }
9531 }
9532 }
9533 }
9534 res->rtyp = UNKNOWN;
9535 }
9536 a->CleanUp();
9537 b->CleanUp();
9538 c->CleanUp();
9539 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9540 return TRUE;
9541}

◆ iiExprArithM()

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

Definition at line 9633 of file iparith.cc.

9634{
9635 res->Init();
9636
9637 if (!errorreported)
9638 {
9639#ifdef SIQ
9640 if (siq>0)
9641 {
9642 //Print("siq:%d\n",siq);
9644 d->op=op;
9645 res->data=(char *)d;
9646 if (a!=NULL)
9647 {
9648 d->argc=a->listLength();
9649 // else : d->argc=0;
9650 memcpy(&d->arg1,a,sizeof(sleftv));
9651 switch(d->argc)
9652 {
9653 case 3:
9654 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9655 a->next->next->Init(); /* no break */
9656 case 2:
9657 memcpy(&d->arg2,a->next,sizeof(sleftv));
9658 a->next->Init();
9659 a->next->next=d->arg2.next;
9660 d->arg2.next=NULL; /* no break */
9661 case 1:
9662 a->Init();
9663 a->next=d->arg1.next;
9664 d->arg1.next=NULL;
9665 }
9666 if (d->argc>3) a->next=NULL;
9667 a->name=NULL;
9668 a->rtyp=0;
9669 a->data=NULL;
9670 a->e=NULL;
9671 a->attribute=NULL;
9672 a->CleanUp();
9673 }
9674 res->rtyp=COMMAND;
9675 return FALSE;
9676 }
9677#endif
9678 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9679 {
9681 if (bb!=NULL)
9682 {
9683 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9684 // otherwise, try default
9685 }
9686 else
9687 return TRUE;
9688 if (errorreported) return TRUE;
9689 }
9690 int args=0;
9691 if (a!=NULL) args=a->listLength();
9692
9693 iiOp=op;
9694 int i=0;
9695 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9696 while (dArithM[i].cmd==op)
9697 {
9698 if ((args==dArithM[i].number_of_args)
9699 || (dArithM[i].number_of_args==-1)
9700 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9701 {
9702 res->rtyp=dArithM[i].res;
9703 if (currRing!=NULL)
9704 {
9705 if (check_valid(dArithM[i].valid_for,op)) break;
9706 }
9707 if (traceit&TRACE_CALL)
9708 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9709 if (dArithM[i].p(res,a))
9710 {
9711 break;// leave loop, goto error handling
9712 }
9713 if (a!=NULL) a->CleanUp();
9714 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9715 return FALSE;
9716 }
9717 i++;
9718 }
9719 // error handling
9720 if (!errorreported)
9721 {
9722 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9723 {
9724 Werror("`%s` is not defined",a->Fullname());
9725 }
9726 else
9727 {
9728 const char *s = iiTwoOps(op);
9729 Werror("%s(...) failed",s);
9730 }
9731 }
9732 res->rtyp = UNKNOWN;
9733 }
9734 if (a!=NULL) a->CleanUp();
9735 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9736 return TRUE;
9737}
const char * name
Definition subexpr.h:87
int rtyp
Definition subexpr.h:91
const char * Name()
Definition subexpr.h:120
int listLength()
Definition subexpr.cc:51
void * data
Definition subexpr.h:88
Subexpr e
Definition subexpr.h:105
attr attribute
Definition subexpr.h:89
const struct sValCmdM dArithM[]
Definition table.h:937

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9955 of file iparith.cc.

9956{
9957 //printf("iiInitArithmetic()\n");
9958 memset(&sArithBase, 0, sizeof(sArithBase));
9959 iiInitCmdName();
9960 /* fix last-identifier */
9961#if 0
9962 /* we expect that gentable allready did every thing */
9965 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9966 }
9967#endif
9968 //Print("L=%d\n", sArithBase.nLastIdentifier);
9969
9970 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9971 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9972
9973 //iiArithAddCmd("Top", 0,-1,0);
9974
9975
9976 //for(i=0; i<sArithBase.nCmdUsed; i++) {
9977 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9978 // sArithBase.sCmds[i].name,
9979 // sArithBase.sCmds[i].alias,
9980 // sArithBase.sCmds[i].tokval,
9981 // sArithBase.sCmds[i].toktype);
9982 //}
9983 //iiArithRemoveCmd("Top");
9984 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9985 //iiArithRemoveCmd("mygcd");
9986 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9987 return 0;
9988}

◆ iin_Int()

static int iin_Int ( number n,
coeffs  cf 
)
static

Definition at line 221 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 9839 of file iparith.cc.

9840{
9841 // user defined types are not in the pre-computed table:
9842 if (op>MAX_TOK) return 0;
9843
9844 int a=0;
9845 int e=len;
9846 int p=len/2;
9847 do
9848 {
9849 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9850 if (op<dArithTab[p].cmd) e=p-1;
9851 else a = p+1;
9852 p=a+(e-a)/2;
9853 }
9854 while ( a <= e);
9855
9856 // catch missing a cmd:
9857 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9858 // Print("op %d (%c) unknown",op,op);
9859 return 0;
9860}

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 229 of file iparith.cc.

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

◆ IsCmd()

int IsCmd ( const char n,
int tok 
)

Definition at line 9740 of file iparith.cc.

9741{
9742 int i;
9743 int an=1;
9745
9746 loop
9747 //for(an=0; an<sArithBase.nCmdUsed; )
9748 {
9749 if(an>=en-1)
9750 {
9751 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9752 {
9753 i=an;
9754 break;
9755 }
9756 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9757 {
9758 i=en;
9759 break;
9760 }
9761 else
9762 {
9763 // -- blackbox extensions:
9764 // return 0;
9765 return blackboxIsCmd(n,tok);
9766 }
9767 }
9768 i=(an+en)/2;
9769 if (*n < *(sArithBase.sCmds[i].name))
9770 {
9771 en=i-1;
9772 }
9773 else if (*n > *(sArithBase.sCmds[i].name))
9774 {
9775 an=i+1;
9776 }
9777 else
9778 {
9779 int v=strcmp(n,sArithBase.sCmds[i].name);
9780 if(v<0)
9781 {
9782 en=i-1;
9783 }
9784 else if(v>0)
9785 {
9786 an=i+1;
9787 }
9788 else /*v==0*/
9789 {
9790 break;
9791 }
9792 }
9793 }
9795 tok=sArithBase.sCmds[i].tokval;
9796 if(sArithBase.sCmds[i].alias==2)
9797 {
9798 Warn("outdated identifier `%s` used - please change your code",
9799 sArithBase.sCmds[i].name);
9800 sArithBase.sCmds[i].alias=1;
9801 }
9802 #if 0
9803 if (currRingHdl==NULL)
9804 {
9805 #ifdef SIQ
9806 if (siq<=0)
9807 {
9808 #endif
9809 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9810 {
9811 WerrorS("no ring active");
9812 return 0;
9813 }
9814 #ifdef SIQ
9815 }
9816 #endif
9817 }
9818 #endif
9819 if (!expected_parms)
9820 {
9821 switch (tok)
9822 {
9823 case IDEAL_CMD:
9824 case INT_CMD:
9825 case INTVEC_CMD:
9826 case MAP_CMD:
9827 case MATRIX_CMD:
9828 case MODUL_CMD:
9829 case POLY_CMD:
9830 case PROC_CMD:
9831 case RING_CMD:
9832 case STRING_CMD:
9833 cmdtok = tok;
9834 break;
9835 }
9836 }
9837 return sArithBase.sCmds[i].toktype;
9838}
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition blackbox.cc:219
@ END_RING
Definition grammar.cc:311
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ MAP_CMD
Definition grammar.cc:286
@ PROC_CMD
Definition grammar.cc:281
@ BEGIN_RING
Definition grammar.cc:283
@ MODUL_CMD
Definition grammar.cc:288
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
EXTERN_VAR BOOLEAN expected_parms
Definition iparith.cc:214
EXTERN_VAR int cmdtok
Definition iparith.cc:213
VAR idhdl currRingHdl
Definition ipid.cc:57
const char * lastreserved
Definition ipshell.cc:82
@ INTVEC_CMD
Definition tok.h:101
@ STRING_CMD
Definition tok.h:187
@ INT_CMD
Definition tok.h:96

◆ jjALIGN_M()

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

Definition at line 1777 of file iparith.cc.

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

◆ jjALIGN_V()

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

Definition at line 1767 of file iparith.cc.

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

◆ jjAND_I()

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

Definition at line 1378 of file iparith.cc.

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

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3866 of file iparith.cc.

3867{
3868 //matrix m=(matrix)v->Data();
3869 //lists l=mpBareiss(m,FALSE);
3870 intvec *iv;
3871 ideal m;
3872 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3874 l->Init(2);
3875 l->m[0].rtyp=MODUL_CMD;
3876 l->m[1].rtyp=INTVEC_CMD;
3877 l->m[0].data=(void *)m;
3878 l->m[1].data=(void *)iv;
3879 res->data = (char *)l;
3880 return FALSE;
3881}
int m
Definition cfEzgcd.cc:128
Definition lists.h:24
VAR omBin slists_bin
Definition lists.cc:23
slists * lists
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition sparsmat.cc:347

◆ jjBAREISS3()

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

Definition at line 6073 of file iparith.cc.

6074{
6075 intvec *iv;
6076 ideal m;
6078 int k=(int)(long)w->Data();
6079 if (k>=0)
6080 {
6081 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6082 l->Init(2);
6083 l->m[0].rtyp=MODUL_CMD;
6084 l->m[1].rtyp=INTVEC_CMD;
6085 l->m[0].data=(void *)m;
6086 l->m[1].data=(void *)iv;
6087 }
6088 else
6089 {
6091 l->Init(1);
6092 l->m[0].rtyp=IDEAL_CMD;
6093 l->m[0].data=(void *)m;
6094 }
6095 res->data = (char *)l;
6096 return FALSE;
6097}
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 3889 of file iparith.cc.

3890{
3891 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3892 b->hnf();
3893 res->data=(char*)b;
3894 return FALSE;
3895}
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 3911 of file iparith.cc.

3912{
3913 bigintmat *b=(bigintmat*)u->Data();
3914 res->data=(void *)bim2iv(b);
3915 return FALSE;
3916}
intvec * bim2iv(bigintmat *b)
Definition bigintmat.cc:339

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3896 of file iparith.cc.

3897{
3899 number n=(number)u->CopyD();
3901 if (nMap!=NULL)
3902 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3903 else
3904 {
3905 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3906 bo=TRUE;
3907 }
3909 return bo;
3910}
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:701
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:459
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition coeffs.h:960
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3917 of file iparith.cc.

3918{
3919 sleftv tmp;
3920 BOOLEAN bo=jjBI2N(&tmp,u);
3921 if (!bo)
3922 {
3923 number n=(number) tmp.data;
3924 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3925 else
3926 {
3927 res->data=(void *)pNSet(n);
3928 }
3929 }
3930 return bo;
3931}
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition iparith.cc:3896
#define nDelete(n)
Definition numbers.h:16
#define nIsZero(n)
Definition numbers.h:19
#define pNSet(n)
Definition polys.h:314

◆ jjBIGINTVEC_PL()

static BOOLEAN jjBIGINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7900 of file iparith.cc.

7901{
7902 leftv h=v;
7903 int l=0;
7904 while (h!=NULL)
7905 {
7906 if(h->Typ()==INT_CMD) l++;
7907 else if (h->Typ()==BIGINT_CMD) l++;
7908 else if (h->Typ()==INTVEC_CMD)
7909 {
7910 intvec *ivv=(intvec*)h->Data();
7911 l+=ivv->rows();
7912 }
7913 else if (h->Typ()==BIGINTVEC_CMD)
7914 {
7915 bigintmat *ivv=(bigintmat *)h->Data();
7916 l+=ivv->rows();
7917 }
7918 else return TRUE;
7919 h=h->next;
7920 }
7921 bigintmat *bim=new bigintmat(1,l,coeffs_BIGINT);
7922 h=v;
7923 int i=0;
7924 while (h!=NULL)
7925 {
7926 if(h->Typ()==INT_CMD)
7927 {
7928 number tp = n_Init((long)(h->Data()), coeffs_BIGINT);
7929 bim->set(i++, tp);
7931 }
7932 else if (h->Typ()==INTVEC_CMD)
7933 {
7934 intvec *ivv=(intvec*)h->Data();
7935 for(int j=0;j<ivv->length();j++)
7936 {
7937 number tp = n_Init((long)(*ivv)[j], coeffs_BIGINT);
7938 bim->set(i++, tp);
7940 }
7941 }
7942 else if(h->Typ()==BIGINT_CMD)
7943 {
7944 number tp = (number)h->Data();
7945 bim->set(i++, tp);
7946 }
7947 else if(h->Typ()==BIGINTVEC_CMD)
7948 {
7949 bigintmat *b=(bigintmat*)h->Data();
7950 for(int j=0;j<b->cols();j++)
7951 {
7952 number tp=BIMATELEM((*b),1,j);
7953 bim->set(i++, tp);
7954 }
7955 }
7956 h=h->next;
7957 }
7958 res->data=(char *)bim;
7959 return FALSE;
7960}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int length() const
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition bigintmat.cc:93
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:539
int j
Definition facHensel.cc:110
@ BIGINTVEC_CMD
Definition grammar.cc:279
STATIC_VAR Poly * h
Definition janet.cc:971
@ BIGINT_CMD
Definition tok.h:38

◆ jjBIV2IV()

static BOOLEAN jjBIV2IV ( leftv  res,
leftv  v 
)
static

Definition at line 4466 of file iparith.cc.

4467{
4468 bigintmat* aa= (bigintmat *)v->Data();
4469 int l=aa->cols();
4470 intvec *iv=new intvec(l);
4471 for(int i=0;i<l;i++) (*iv)[i]=iin_Int(BIMATELEM((*aa),1,i+1),coeffs_BIGINT);
4472 res->data = (void*)iv;
4473 return FALSE;
4474}
static int iin_Int(number &n, coeffs cf)
Definition iparith.cc:221

◆ jjBRACK_Bim()

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

Definition at line 5818 of file iparith.cc.

5819{
5820 bigintmat *bim = (bigintmat *)u->Data();
5821 int r = (int)(long)v->Data();
5822 int c = (int)(long)w->Data();
5823 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5824 {
5825 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5826 r,c,u->Fullname(),bim->rows(),bim->cols());
5827 return TRUE;
5828 }
5829 res->data=u->data; u->data=NULL;
5830 res->rtyp=u->rtyp; u->rtyp=0;
5831 res->name=u->name; u->name=NULL;
5832 Subexpr e=jjMakeSub(v);
5833 e->next=jjMakeSub(w);
5834 if (u->e==NULL)
5835 res->e=e;
5836 else
5837 {
5838 Subexpr h=u->e;
5839 while (h->next!=NULL) h=h->next;
5840 h->next=e;
5841 res->e=u->e;
5842 u->e=NULL;
5843 }
5844 return FALSE;
5845}
int cols() const
Definition bigintmat.h:144
int rows() const
Definition bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition iparith.cc:8937

◆ jjBRACK_Im()

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

Definition at line 5791 of file iparith.cc.

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

5847{
5848 matrix m= (matrix)u->Data();
5849 int r = (int)(long)v->Data();
5850 int c = (int)(long)w->Data();
5851 //Print("gen. elem %d, %d\n",r,c);
5852 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5853 {
5854 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5855 MATROWS(m),MATCOLS(m));
5856 return TRUE;
5857 }
5858 res->data=u->data; u->data=NULL;
5859 res->rtyp=u->rtyp; u->rtyp=0;
5860 res->name=u->name; u->name=NULL;
5861 Subexpr e=jjMakeSub(v);
5862 e->next=jjMakeSub(w);
5863 if (u->e==NULL)
5864 res->e=e;
5865 else
5866 {
5867 Subexpr h=u->e;
5868 while (h->next!=NULL) h=h->next;
5869 h->next=e;
5870 res->e=u->e;
5871 u->e=NULL;
5872 }
5873 return FALSE;
5874}
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 5904 of file iparith.cc.

5905{
5906 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5907 {
5908 WerrorS("cannot build expression lists from unnamed objects");
5909 return TRUE;
5910 }
5911
5912 leftv p=NULL;
5913 intvec *iv=(intvec *)w->Data();
5914 int l;
5915 BOOLEAN nok;
5916 sleftv ut;
5917 memcpy(&ut,u,sizeof(ut));
5918 sleftv t;
5919 t.Init();
5920 t.rtyp=INT_CMD;
5921 for (l=0;l< iv->length(); l++)
5922 {
5923 t.data=(char *)(long)((*iv)[l]);
5924 if (p==NULL)
5925 {
5926 p=res;
5927 }
5928 else
5929 {
5930 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5931 p=p->next;
5932 }
5933 memcpy(u,&ut,sizeof(ut));
5934 if (u->Typ() == MATRIX_CMD)
5935 nok=jjBRACK_Ma(p,u,v,&t);
5936 else if (u->Typ() == BIGINTMAT_CMD)
5937 nok=jjBRACK_Bim(p,u,v,&t);
5938 else /* INTMAT_CMD */
5939 nok=jjBRACK_Im(p,u,v,&t);
5940 if (nok)
5941 {
5942 while (res->next!=NULL)
5943 {
5944 p=res->next->next;
5946 // res->e aufraeumen !!!!
5947 res->next=p;
5948 }
5949 return TRUE;
5950 }
5951 }
5952 return FALSE;
5953}
int length() const
Definition intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5818
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5791
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5846
#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 5954 of file iparith.cc.

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

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 6003 of file iparith.cc.

6004{
6005 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
6006 {
6007 WerrorS("cannot build expression lists from unnamed objects");
6008 return TRUE;
6009 }
6010 leftv p=NULL;
6011 intvec *vv=(intvec *)v->Data();
6012 intvec *wv=(intvec *)w->Data();
6013 int vl;
6014 int wl;
6015 BOOLEAN nok;
6016
6017 sleftv t1,t2,ut;
6018 memcpy(&ut,u,sizeof(ut));
6019 t1.Init();
6020 t1.rtyp=INT_CMD;
6021 t2.Init();
6022 t2.rtyp=INT_CMD;
6023 for (vl=0;vl< vv->length(); vl++)
6024 {
6025 t1.data=(char *)(long)((*vv)[vl]);
6026 for (wl=0;wl< wv->length(); wl++)
6027 {
6028 t2.data=(char *)(long)((*wv)[wl]);
6029 if (p==NULL)
6030 {
6031 p=res;
6032 }
6033 else
6034 {
6035 p->next=(leftv)omAlloc0Bin(sleftv_bin);
6036 p=p->next;
6037 }
6038 memcpy(u,&ut,sizeof(ut));
6039 if (u->Typ() == MATRIX_CMD)
6040 nok=jjBRACK_Ma(p,u,&t1,&t2);
6041 else if (u->Typ() == BIGINTMAT_CMD)
6042 nok=jjBRACK_Bim(p,u,&t1,&t2);
6043 else /* INTMAT_CMD */
6044 nok=jjBRACK_Im(p,u,&t1,&t2);
6045 if (nok)
6046 {
6047 res->CleanUp();
6048 return TRUE;
6049 }
6050 }
6051 }
6052 return FALSE;
6053}

◆ jjBRACK_S()

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

Definition at line 5775 of file iparith.cc.

5776{
5777 char *s= (char *)u->Data();
5778 int r = (int)(long)v->Data();
5779 int c = (int)(long)w->Data();
5780 int l = strlen(s);
5781
5782 if ( (r<1) || (r>l) || (c<0) )
5783 {
5784 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5785 return TRUE;
5786 }
5787 res->data = (char *)omAlloc((long)(c+1));
5788 snprintf((char *)res->data,c+1,"%-*.*s",c,c,s+r-1);
5789 return FALSE;
5790}
#define omAlloc(size)

◆ jjBRACK_SM()

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

Definition at line 5875 of file iparith.cc.

5876{
5877 ideal m= (ideal)u->Data();
5878 int r = (int)(long)v->Data();
5879 int c = (int)(long)w->Data();
5880 //Print("gen. elem %d, %d\n",r,c);
5881 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5882 {
5883 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5884 (int)m->rank,IDELEMS(m));
5885 return TRUE;
5886 }
5887 res->data=u->data; u->data=NULL;
5888 res->rtyp=u->rtyp; u->rtyp=0;
5889 res->name=u->name; u->name=NULL;
5890 Subexpr e=jjMakeSub(v);
5891 e->next=jjMakeSub(w);
5892 if (u->e==NULL)
5893 res->e=e;
5894 else
5895 {
5896 Subexpr h=u->e;
5897 while (h->next!=NULL) h=h->next;
5898 h->next=e;
5899 res->e=u->e;
5900 u->e=NULL;
5901 }
5902 return FALSE;
5903}

◆ jjBRACKET()

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

Definition at line 2916 of file iparith.cc.

2917{
2918 res->data=NULL;
2919
2921 {
2922 const poly q = (poly)b->Data();
2923
2924 if( q != NULL )
2925 {
2926 if( (poly)a->Data() != NULL )
2927 {
2929 {
2930 poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2931 res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2932 }
2933 else if (rIsLPRing(currRing))
2934 {
2935 const poly p = (poly)a->Data();
2936 res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2937 }
2938 }
2939 }
2940 }
2941 return FALSE;
2942}
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
#define pAdd(p, q)
Definition polys.h:204
#define pNeg(p)
Definition polys.h:199
#define ppMult_qq(p, q)
Definition polys.h:209

◆ jjBRACKET_REC()

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

Definition at line 2943 of file iparith.cc.

2944{
2945 res->data=NULL;
2946
2948 {
2949 const poly q = (poly)b->Data();
2950 if(q != NULL)
2951 {
2952 if((poly)a->Data() != NULL)
2953 {
2954 const poly p = (poly)a->Data();
2955 int k=(int)(long)c->Data();
2956 if (k > 0)
2957 {
2958 poly qq = pCopy(q);
2959 for (int i = 0; i < k; i++)
2960 {
2961 poly qq_ref = qq;
2962 if (rIsLPRing(currRing))
2963 {
2965 }
2966 else if (rIsPluralRing(currRing))
2967 {
2969 }
2970 pDelete(&qq_ref);
2971 if (qq == NULL) break;
2972 }
2973 res->data = qq;
2974 }
2975 else
2976 {
2977 Werror("invalid number of iterations");
2978 }
2979 }
2980 }
2981 }
2982 return FALSE;
2983}
#define pDelete(p_ptr)
Definition polys.h:187
#define pCopy(p)
return a copy of the poly
Definition polys.h:186

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 7300 of file iparith.cc.

7301{
7302#ifdef HAVE_SDB
7303 sdb_show_bp();
7304#endif
7305 return FALSE;
7306}
void sdb_show_bp()
Definition sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7307 of file iparith.cc.

7308{
7309#ifdef HAVE_SDB
7310 if(v->Typ()==PROC_CMD)
7311 {
7312 int lineno=0;
7313 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7314 {
7315 lineno=(int)(long)v->next->Data();
7316 }
7317 return sdb_set_breakpoint(v->Name(),lineno);
7318 }
7319 return TRUE;
7320#else
7321 return FALSE;
7322#endif
7323}
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 7324 of file iparith.cc.

7325{
7326 return iiExprArith1(res,v,iiOp);
7327}

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3932 of file iparith.cc.

3933{
3934 return iiExprArithM(res,u,iiOp);
3935}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9633

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7328 of file iparith.cc.

7329{
7330 leftv v=u->next;
7331 u->next=NULL;
7332 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7333 u->next=v;
7334 return b;
7335}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition iparith.cc:9143

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7336 of file iparith.cc.

7337{
7338 leftv v = u->next;
7339 leftv w = v->next;
7340 u->next = NULL;
7341 v->next = NULL;
7342 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7343 u->next = v;
7344 v->next = w;
7345 return b;
7346}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9542

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3936 of file iparith.cc.

3937{
3938 res->data = (char *)(long)rChar((ring)v->Data());
3939 return FALSE;
3940}
int rChar(ring r)
Definition ring.cc:716

◆ jjCHINREM_BI()

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

Definition at line 1680 of file iparith.cc.

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

◆ jjCHINREM_ID()

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

Definition at line 10196 of file iparith.cc.

10197{
10198 if ((currRing!=NULL)
10200 && (!rField_is_Z(currRing)))
10201 {
10202 WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
10203 return TRUE;
10204 }
10205 coeffs cf;
10206 lists c=(lists)u->CopyD(); // list of ideal or bigint/int
10207 int rl=c->nr+1;
10208 int return_type=c->m[0].Typ();
10209 if ((return_type!=IDEAL_CMD)
10213 && (return_type!=POLY_CMD))
10214 {
10216 ||(return_type==INT_CMD))
10218 else if (return_type==LIST_CMD)
10219 {
10220 // create a tmp list of the correct size
10222 res_l->Init(rl /*c->nr+1*/);
10225 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10226 {
10227 sleftv tmp;
10228 tmp.Copy(v);
10230 if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
10231 }
10232 c->Clean();
10233 res->data=res_l;
10234 res->rtyp=LIST_CMD;
10235 return bo;
10236 }
10237 else
10238 {
10239 c->Clean();
10240 WerrorS("poly/ideal/module/matrix/list expected");
10241 return TRUE;
10242 }
10243 }
10246 else
10247 {
10248 cf=currRing->cf;
10249 if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
10250 cf=cf->extRing->cf;
10251 }
10252 lists pl=NULL;
10253 intvec *p=NULL;
10254 if (v->Typ()==LIST_CMD)
10255 {
10256 pl=(lists)v->Data();
10257 if (pl->nr!=rl-1)
10258 {
10259 Werror("wromg number of primes (%d:%d) for chinrem",pl->nr+1,rl);
10260 return TRUE;
10261 }
10262 }
10263 else
10264 {
10265 p=(intvec*)v->Data();
10266 if (p->length()!=rl)
10267 {
10268 Werror("wromg number of primes (%d:%d) for chinrem",p->length(),rl);
10269 return TRUE;
10270 }
10271 }
10272 ideal result;
10273 ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
10274 number *xx=NULL;
10276 int i;
10278 {
10279 for(i=rl-1;i>=0;i--)
10280 {
10281 if (c->m[i].Typ()!=return_type)
10282 {
10283 Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
10284 omFree(x); // delete c
10285 return TRUE;
10286 }
10287 if (return_type==POLY_CMD)
10288 {
10289 x[i]=idInit(1,1);
10290 x[i]->m[0]=(poly)c->m[i].CopyD();
10291 }
10292 else
10293 {
10294 x[i]=(ideal)c->m[i].CopyD();
10295 }
10296 //c->m[i].Init();
10297 }
10298 }
10299 else
10300 {
10301 if (nMap==NULL)
10302 {
10303 Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10304 return TRUE;
10305 }
10306 xx=(number *)omAlloc(rl*sizeof(number));
10307 for(i=rl-1;i>=0;i--)
10308 {
10309 if (c->m[i].Typ()==INT_CMD)
10310 {
10311 xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10312 }
10313 else if (c->m[i].Typ()==BIGINT_CMD)
10314 {
10315 xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10316 }
10317 else
10318 {
10319 Werror("bigint expected at pos %d",i+1);
10320 omFree(x); // delete c
10321 omFree(xx); // delete c
10322 return TRUE;
10323 }
10324 }
10325 }
10326 number *q=(number *)omAlloc(rl*sizeof(number));
10327 if (p!=NULL)
10328 {
10329 for(i=rl-1;i>=0;i--)
10330 {
10331 q[i]=n_Init((*p)[i], cf);
10332 }
10333 }
10334 else
10335 {
10336 for(i=rl-1;i>=0;i--)
10337 {
10338 if (pl->m[i].Typ()==INT_CMD)
10339 {
10340 q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10341 }
10342 else if (pl->m[i].Typ()==BIGINT_CMD)
10343 {
10344 q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10345 }
10346 else
10347 {
10348 Werror("bigint expected at pos %d",i+1);
10349 for(i++;i<rl;i++)
10350 {
10351 n_Delete(&(q[i]),cf);
10352 }
10353 omFree(x); // delete c
10354 omFree(q); // delete pl
10355 if (xx!=NULL) omFree(xx); // delete c
10356 return TRUE;
10357 }
10358 }
10359 }
10361 {
10362 CFArray i_v(rl);
10364 res->data=(char *)n;
10365 }
10366 else
10367 {
10368 #if 0
10369 #ifdef HAVE_VSPACE
10371 if ((cpus>1) && (rField_is_Q(currRing)))
10372 result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10373 else
10374 #endif
10375 #endif
10376 result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10377 c->Clean();
10378 if ((return_type==POLY_CMD) &&(result!=NULL))
10379 {
10380 res->data=(char *)result->m[0];
10381 result->m[0]=NULL;
10382 idDelete(&result);
10383 }
10384 else
10385 res->data=(char *)result;
10386 }
10387 for(i=rl-1;i>=0;i--)
10388 {
10389 n_Delete(&(q[i]),cf);
10390 }
10391 omFree(q);
10392 res->rtyp=return_type;
10393 return result==NULL;
10394}
sleftv * m
Definition lists.h:46
void Clean(ring r=currRing)
Definition lists.h:26
int nr
Definition lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:839
return result
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
@ SMATRIX_CMD
Definition grammar.cc:292
#define idDelete(H)
delete an ideal
Definition ideals.h:29
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
Definition kChinese.cc:199
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:515
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:512
ideal idInit(int idsize, int rank)
initialise an ideal / module
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
@ LIST_CMD
Definition tok.h:118
@ CHINREM_CMD
Definition tok.h:45

◆ jjCOEF()

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

Definition at line 1791 of file iparith.cc.

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

◆ jjCOEF_Id()

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

Definition at line 1798 of file iparith.cc.

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

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 7348 of file iparith.cc.

7349{
7350 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7351 if (iiCheckTypes(v,t,1))
7352 {
7353 idhdl c=(idhdl)v->next->next->data;
7354 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7355 idhdl m=(idhdl)v->next->next->next->data;
7356 idDelete((ideal *)&(c->data.uideal));
7357 idDelete((ideal *)&(m->data.uideal));
7358 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7359 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7360 return FALSE;
7361 }
7362 return TRUE;
7363}
Definition idrec.h:35
@ VECTOR_CMD
Definition grammar.cc:293
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition ipshell.cc:6565
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition matpol.cc:574
idrec * idhdl
Definition ring.h:22

◆ jjCOEFFS1()

static BOOLEAN jjCOEFFS1 ( leftv  res,
leftv  v 
)
static

Definition at line 3941 of file iparith.cc.

3942{
3943 ring r=(ring)v->Data();
3944 r->cf->ref++;
3945 res->data = (char *)r->cf;
3946 return FALSE;
3947}

◆ jjCOEFFS2_KB()

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

Definition at line 1816 of file iparith.cc.

1817{
1818 poly p = pInit();
1819 int i;
1820 for (i=1; i<=currRing->N; i++)
1821 {
1822 pSetExp(p, i, 1);
1823 }
1824 pSetm(p);
1825 res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1826 (ideal)(v->Data()), p);
1827 pLmFree(&p);
1828 return FALSE;
1829}
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition ideals.cc:2631
#define pSetm(p)
Definition polys.h:272
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:71
#define pInit()
allocates a new monomial and initializes everything to 0
Definition polys.h:62
#define pSetExp(p, i, v)
Definition polys.h:43

◆ jjCOEFFS3_Id()

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

Definition at line 6098 of file iparith.cc.

6099{
6100 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6101 {
6102 WerrorS("3rd argument must be a name of a matrix");
6103 return TRUE;
6104 }
6105 ideal i=(ideal)u->Data();
6106 int rank=(int)i->rank;
6107 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6108 if (r) return TRUE;
6109 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6110 return FALSE;
6111}
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition iparith.cc:1805
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition matpol.cc:355
#define pVar(m)
Definition polys.h:381

◆ jjCOEFFS3_KB()

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

Definition at line 6112 of file iparith.cc.

6113{
6114 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6115 (ideal)(v->Data()),(poly)(w->Data()));
6116 return FALSE;
6117}

◆ jjCOEFFS3_P()

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

Definition at line 6118 of file iparith.cc.

6119{
6120 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6121 {
6122 WerrorS("3rd argument must be a name of a matrix");
6123 return TRUE;
6124 }
6125 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6126 poly p=(poly)u->CopyD(POLY_CMD);
6127 ideal i=idInit(1,1);
6128 i->m[0]=p;
6129 sleftv t;
6130 t.Init();
6131 t.data=(char *)i;
6132 t.rtyp=IDEAL_CMD;
6133 int rank=1;
6134 if (u->Typ()==VECTOR_CMD)
6135 {
6136 i->rank=rank=pMaxComp(p);
6137 t.rtyp=MODUL_CMD;
6138 }
6139 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6140 t.CleanUp();
6141 if (r) return TRUE;
6142 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6143 return FALSE;
6144}
#define pMaxComp(p)
Definition polys.h:300

◆ jjCOEFFS_Id()

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

Definition at line 1805 of file iparith.cc.

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

◆ jjCOLCOL()

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

Definition at line 692 of file iparith.cc.

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

◆ jjCOLON()

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

Definition at line 319 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3948 of file iparith.cc.

3949{
3950 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3951 return FALSE;
3952}

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3953 of file iparith.cc.

3954{
3955 res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3956 return FALSE;
3957}

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3958 of file iparith.cc.

3959{
3960 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3961 return FALSE;
3962}

◆ jjCOMPARE_ALL()

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

Definition at line 10414 of file iparith.cc.

10415{
10416 leftv a=(leftv)aa;
10417 int at=a->Typ();
10418 leftv b=(leftv)bb;
10419 int bt=b->Typ();
10420 if (at < bt) return -1;
10421 if (at > bt) return 1;
10423 sleftv tmp;
10424 tmp.Init();
10425 iiOp='<';
10427 if (bo)
10428 {
10429 Werror(" no `<` for %s",Tok2Cmdname(at));
10430 unsigned long ad=(unsigned long)a->Data();
10431 unsigned long bd=(unsigned long)b->Data();
10432 if (ad<bd) return -1;
10433 else if (ad==bd) return 0;
10434 else return 1;
10435 }
10436 else if (tmp.data==NULL) /* not < */
10437 {
10441 if (bo)
10442 {
10443 Werror(" no `==` for %s",Tok2Cmdname(at));
10444 unsigned long ad=(unsigned long)a->Data();
10445 unsigned long bd=(unsigned long)b->Data();
10446 if (ad<bd) return -1;
10447 else if (ad==bd) return 0;
10448 else return 1;
10449 }
10450 else if (tmp.data==NULL) /* not <,== */ return 1;
10451 else return 0;
10452 }
10453 else return -1;
10454}
@ EQUAL_EQUAL
Definition grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 366 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 338 of file iparith.cc.

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

◆ jjCOMPARE_IV_I()

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

Definition at line 396 of file iparith.cc.

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

◆ jjCOMPARE_MA()

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

Definition at line 423 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 451 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 478 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3963 of file iparith.cc.

3964{
3965 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3966 poly p=(poly)v->CopyD(POLY_CMD);
3967 if (p!=NULL) p_Cleardenom(p, currRing);
3968 res->data = (char *)p;
3969 return FALSE;
3970}
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2849

◆ jjCONTRACT()

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

Definition at line 1830 of file iparith.cc.

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

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3971 of file iparith.cc.

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

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3976 of file iparith.cc.

3977{
3978 bigintmat* aa= (bigintmat *)v->Data();
3979 res->data = (char *)(long)(aa->rows()*aa->cols());
3980 return FALSE;
3981}

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3999 of file iparith.cc.

4000{
4001 res->data = (char *)(long)((intvec*)(v->Data()))->length();
4002 return FALSE;
4003}

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3987 of file iparith.cc.

3988{
3989 lists l=(lists)v->Data();
3990 res->data = (char *)(long)(lSize(l)+1);
3991 return FALSE;
3992}
int lSize(lists L)
Definition lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3993 of file iparith.cc.

3994{
3995 matrix m=(matrix)v->Data();
3996 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3997 return FALSE;
3998}

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3982 of file iparith.cc.

3983{
3984 res->data = (char *)(long)nSize((number)v->Data());
3985 return FALSE;
3986}

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5744 of file iparith.cc.

5745{
5746 res->data=(char *)(long)sySize((syStrategy)v->Data());
5747 return FALSE;
5748}
int sySize(syStrategy syzstr)
Definition syz1.cc:1830

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 4004 of file iparith.cc.

4005{
4006 ring r=(ring)v->Data();
4007 int elems=-1;
4008 if (rField_is_Zp(r)) elems=r->cf->ch;
4009 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
4010 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
4011 {
4012 extern int ipower ( int b, int n ); /* factory/cf_util */
4013 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
4014 }
4015 res->data = (char *)(long)elems;
4016 return FALSE;
4017}
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:535
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:527

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 4054 of file iparith.cc.

4055{
4056 if ((v->rtyp==IDHDL)
4057 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
4058 {
4059 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
4060 }
4061 else if (v->rtyp!=0) res->data=(void *)(-1);
4062 return FALSE;
4063}
#define IDLEV(a)
Definition ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4018 of file iparith.cc.

4019{
4020 int dummy;
4021 poly p=(poly)v->Data();
4022 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
4023 else res->data=(char *)-1;
4024 return FALSE;
4025}

◆ jjDEG_IV()

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

Definition at line 1846 of file iparith.cc.

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

4027{
4028 ideal I=(ideal)u->Data();
4029 int d=-1;
4030 int dummy;
4031 int i;
4032 for(i=IDELEMS(I)-1;i>=0;i--)
4033 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
4034 res->data = (char *)(long)d;
4035 return FALSE;
4036}
static int si_max(const int a, const int b)
Definition auxiliary.h:125

◆ jjDEG_M_IV()

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

Definition at line 1835 of file iparith.cc.

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

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 4037 of file iparith.cc.

4038{
4039 SPrintStart();
4040 if (rField_is_Z(currRing))
4041 {
4042 PrintS("// NOTE: computation of degree is being performed for\n");
4043 PrintS("// generic fibre, that is, over Q\n");
4044 }
4046 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4047 scDegree((ideal)v->Data(),module_w,currRing->qideal);
4048 char *s=SPrintEnd();
4049 int l=strlen(s)-1;
4050 s[l]='\0';
4051 res->data=(void*)s;
4052 return FALSE;
4053}
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition hilb.cc:2693
void SPrintStart()
Definition reporter.cc:246
void PrintS(const char *s)
Definition reporter.cc:284
char * SPrintEnd()
Definition reporter.cc:273
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587

◆ jjDelete_ID()

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

Definition at line 1867 of file iparith.cc.

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

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

◆ jjDelete_IV()

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

Definition at line 1860 of file iparith.cc.

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

4067{
4068 number n = reinterpret_cast<number>(v->CopyD());
4069 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
4070 n_Delete(&n,currRing->cf);
4071 return FALSE;
4072}
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition coeffs.h:604

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 4083 of file iparith.cc.

4084{
4085 matrix m=(matrix)v->Data();
4086 res ->data = mp_Det(m,currRing);
4087 return FALSE;
4088}
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition matpol.cc:2139

◆ jjDET2()

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

Definition at line 1894 of file iparith.cc.

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

◆ jjDET2_S()

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

Definition at line 1901 of file iparith.cc.

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

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 4089 of file iparith.cc.

4090{
4091 bigintmat * m=(bigintmat*)v->Data();
4092 int i,j;
4093 i=m->rows();j=m->cols();
4094 if(i==j)
4095 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4096 else
4097 {
4098 Werror("det of %d x %d bigintmat",i,j);
4099 return TRUE;
4100 }
4101 return FALSE;
4102}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition clapsing.cc:1801

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4125 of file iparith.cc.

4126{
4127 intvec * m=(intvec*)v->Data();
4128 int i,j;
4129 i=m->rows();j=m->cols();
4130 if(i==j)
4131 res->data = (char *)(long)singclap_det_i(m,currRing);
4132 else
4133 {
4134 Werror("det of %d x %d intmat",i,j);
4135 return TRUE;
4136 }
4137 return FALSE;
4138}
int singclap_det_i(intvec *m, const ring)
Definition clapsing.cc:1783

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 4139 of file iparith.cc.

4140{
4141 ideal I=(ideal)v->Data();
4142 res->data=(char*)sm_Det(I,currRing);
4143 return FALSE;
4144}

◆ jjDIFF_COEF()

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

Definition at line 4503 of file iparith.cc.

4504{
4505 if (!nCoeff_is_transExt(currRing->cf))
4506 {
4507 WerrorS("differentiation not defined in the coefficient ring");
4508 return TRUE;
4509 }
4510 number n = (number) u->Data();
4511 number k = (number) v->Data();
4512 res->data = ntDiff(n,k,currRing->cf);
4513 return FALSE;
4514}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:911
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 1919 of file iparith.cc.

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

◆ jjDIFF_ID_ID()

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

Definition at line 1930 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1908 of file iparith.cc.

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

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4145 of file iparith.cc.

4146{
4148#ifdef HAVE_SHIFTBBA
4149 if (rIsLPRing(currRing))
4150 {
4152 {
4153 WerrorS("`dim` is not implemented for letterplace rings over rings");
4154 return TRUE;
4155 }
4156 if (currRing->qideal != NULL)
4157 {
4158 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4159 return TRUE;
4160 }
4161 int gkDim = lp_gkDim((ideal)(v->Data()));
4162 res->data = (char *)(long)gkDim;
4163 return (gkDim == -2);
4164 }
4165#endif
4167 {
4168 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4169 }
4170 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4171 return FALSE;
4172}
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition hdegree.cc:136
int lp_gkDim(const ideal _G)
Definition hdegree.cc:1826
static BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:770

◆ jjDIM2()

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

Definition at line 1935 of file iparith.cc.

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

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5749 of file iparith.cc.

5750{
5751 res->data = (char *)(long)syDim((syStrategy)v->Data());
5752 return FALSE;
5753}
int syDim(syStrategy syzstr)
Definition syz1.cc:1850

◆ jjDIV_BI()

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

Definition at line 1248 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1292 of file iparith.cc.

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

◆ jjDIV_N()

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

Definition at line 1261 of file iparith.cc.

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

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

◆ jjDIVISION()

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

Definition at line 1952 of file iparith.cc.

1953{
1954 ideal vi=(ideal)v->Data();
1955 int vl= IDELEMS(vi);
1956 ideal ui=(ideal)u->Data();
1957 unsigned ul= IDELEMS(ui);
1958 ideal R; matrix U;
1960 if (m==NULL) return TRUE;
1961 // now make sure that all matrices have the correct size:
1963 assume (MATCOLS(U) == (int)ul);
1965 L->Init(3);
1966 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1967 L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1968 L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1969 res->data=(char *)L;
1970 return FALSE;
1971}
INLINE_THIS void Init(int l=0)
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition ideals.cc:1111
#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 7365 of file iparith.cc.

7366{ // may have 3 or 4 arguments
7367 leftv v1=v;
7368 leftv v2=v1->next;
7369 leftv v3=v2->next;
7370 leftv v4=v3->next;
7372
7373 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7374 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7375
7376 if((i1==0)||(i2==0)
7377 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7378 {
7379 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7380 return TRUE;
7381 }
7382
7383 sleftv w1,w2;
7384 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7385 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7386 ideal P=(ideal)w1.Data();
7387 ideal Q=(ideal)w2.Data();
7388
7389 int n=(int)(long)v3->Data();
7390 int *w=NULL;
7391 if(v4!=NULL)
7392 {
7393 w = iv2array((intvec *)v4->Data(),currRing);
7394 int * w0 = w + 1;
7395 int i = currRing->N;
7396 while( (i > 0) && ((*w0) > 0) )
7397 {
7398 w0++;
7399 i--;
7400 }
7401 if(i>0)
7402 WarnS("not all weights are positive!");
7403 }
7404
7405 matrix T;
7406 ideal R;
7407 idLiftW(P,Q,n,T,R,w);
7408
7409 w1.CleanUp();
7410 w2.CleanUp();
7411 if(w!=NULL)
7412 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7413
7415 L->Init(2);
7416 L->m[1].rtyp=v1->Typ();
7417 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7418 {
7419 if(v1->Typ()==POLY_CMD)
7420 p_Shift(&R->m[0],-1,currRing);
7421 L->m[1].data=(void *)R->m[0];
7422 R->m[0]=NULL;
7423 idDelete(&R);
7424 }
7425 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7426 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7427 else
7428 {
7429 L->m[1].rtyp=MODUL_CMD;
7430 L->m[1].data=(void *)R;
7431 }
7432 L->m[0].rtyp=MATRIX_CMD;
7433 L->m[0].data=(char *)T;
7434
7435 res->data=L;
7436
7437 return FALSE;
7438}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition ideals.cc:1342
matrix id_Module2Matrix(ideal mod, const ring R)
#define Q
Definition sirandom.c:26

◆ jjDIVMOD_I()

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

Definition at line 1225 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 332 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3764 of file iparith.cc.

3765{
3766// res->data = (char *)u->CopyD();
3767// also copy attributes:
3768 res->Copy(u);
3769 return FALSE;
3770}

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4173 of file iparith.cc.

4174{
4175 si_link l = (si_link)v->Data();
4176 if (slDump(l))
4177 {
4178 const char *s;
4179 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4180 else s=sNoName_fe;
4181 Werror("cannot dump to `%s`",s);
4182 return TRUE;
4183 }
4184 else
4185 return FALSE;
4186}

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4187 of file iparith.cc.

4188{
4189 res->data = (char *)pOne();
4190 int co=(int)(long)v->Data();
4191 if (co>0)
4192 {
4193 pSetComp((poly)res->data,co);
4194 pSetm((poly)res->data);
4195 }
4196 else WerrorS("argument of gen must be positive");
4197 return (co<=0);
4198}
#define pSetComp(p, v)
Definition polys.h:39
#define pOne()
Definition polys.h:316

◆ jjELIMIN()

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

Definition at line 1972 of file iparith.cc.

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

◆ jjELIMIN_ALG()

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

Definition at line 6145 of file iparith.cc.

6146{
6147 ideal I=(ideal)u->Data();
6148 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6149 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6150 //setFlag(res,FLAG_STD);
6151 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6152}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition ideals.cc:3658
GbVariant
Definition ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6153 of file iparith.cc.

6154{
6155 bigintmat *ww=(bigintmat*)w->Data();
6156
6157 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6158 ww);
6159 //setFlag(res,FLAG_STD);
6160 return FALSE;
6161}

◆ jjELIMIN_IV()

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

Definition at line 1978 of file iparith.cc.

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

◆ jjENVELOPE()

static BOOLEAN jjENVELOPE ( leftv  res,
leftv  a 
)
static

Definition at line 5312 of file iparith.cc.

5313{
5314#ifdef HAVE_PLURAL
5315 ring r = (ring)a->Data();
5316 if (rIsPluralRing(r))
5317 {
5318 ring s = rEnvelope(r);
5319 res->data = s;
5320 }
5321 else res->data = rCopy(r);
5322 return FALSE;
5323#else
5324 return TRUE;
5325#endif
5326}
ring rEnvelope(ring R)
Definition ring.cc:5811
ring rCopy(ring r)
Definition ring.cc:1734

◆ jjEQUAL_BI()

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

Definition at line 1321 of file iparith.cc.

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

◆ jjEQUAL_I()

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

Definition at line 1327 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1333 of file iparith.cc.

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

◆ jjEQUAL_N()

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

Definition at line 1351 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1357 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1345 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1365 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1339 of file iparith.cc.

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

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 1997 of file iparith.cc.

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

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4199 of file iparith.cc.

4200{
4201 char * d = (char *)v->Data();
4202 char * s = (char *)omAlloc(strlen(d) + 13);
4203 strcpy( s, (char *)d);
4204 strcat( s, "\n;RETURN();\n");
4206 return yyparse();
4207}
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition fevoices.cc:166
@ BT_execute
Definition fevoices.h:23
int yyparse(void)
Definition grammar.cc:2149

◆ jjEXPORTTO()

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

Definition at line 1992 of file iparith.cc.

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

◆ jjEXTGCD_BI()

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

Definition at line 2004 of file iparith.cc.

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

◆ jjEXTGCD_I()

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

Definition at line 2018 of file iparith.cc.

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

◆ jjEXTGCD_P()

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

Definition at line 2046 of file iparith.cc.

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

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4248 of file iparith.cc.

4249{
4250 intvec *v=NULL;
4252 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4253 if (f==NULL) return TRUE;
4254 ivTest(v);
4256 l->Init(2);
4257 l->m[0].rtyp=IDEAL_CMD;
4258 l->m[0].data=(void *)f;
4259 l->m[1].rtyp=INTVEC_CMD;
4260 l->m[1].data=(void *)v;
4261 res->data=(void *)l;
4262 return FALSE;
4263}
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:2062

◆ jjFAC_P2()

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

Definition at line 2063 of file iparith.cc.

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

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4208 of file iparith.cc.

4209{
4211 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4212 {
4213 ideal_list p,h;
4214 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4215 if (h==NULL)
4216 {
4217 L->Init(1);
4218 L->m[0].data=(char *)idInit(1);
4219 L->m[0].rtyp=IDEAL_CMD;
4220 }
4221 else
4222 {
4223 p=h;
4224 int l=0;
4225 while (p!=NULL) { p=p->next;l++; }
4226 L->Init(l);
4227 l=0;
4228 while(h!=NULL)
4229 {
4230 L->m[l].data=(char *)h->d;
4231 L->m[l].rtyp=IDEAL_CMD;
4232 p=h->next;
4233 omFreeSize(h,sizeof(*h));
4234 h=p;
4235 l++;
4236 }
4237 }
4238 }
4239 else
4240 {
4241 WarnS("no factorization implemented");
4242 L->Init(1);
4243 iiExprArith1(&(L->m[0]),v,STD_CMD);
4244 }
4245 res->data=(void *)L;
4246 return FALSE;
4247}
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition kstdfac.cc:800
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition numbers.cc:307
@ testHomog
Definition structs.h:34
@ STD_CMD
Definition tok.h:186

◆ jjFACSTD2()

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

Definition at line 2110 of file iparith.cc.

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

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8625 of file iparith.cc.

8626{
8627 /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
8628 see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
8629
8630 valid argument lists:
8631 - (poly h, int d),
8632 - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
8633 - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
8634 in list of ring vars,
8635 - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
8636 optional: all 4 optional args
8637 (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
8638 by singclap_factorize and h(0, y)
8639 has exactly two distinct monic factors [possibly with exponent > 1].)
8640 result:
8641 - list with the two factors f and g such that
8642 h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
8643
8644 poly h = NULL;
8645 int d = 1;
8646 poly f0 = NULL;
8647 poly g0 = NULL;
8648 int xIndex = 1; /* default index if none provided */
8649 int yIndex = 2; /* default index if none provided */
8650
8651 leftv u = v; int factorsGiven = 0;
8652 if ((u == NULL) || (u->Typ() != POLY_CMD))
8653 {
8654 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8655 return TRUE;
8656 }
8657 else h = (poly)u->Data();
8658 u = u->next;
8659 if ((u == NULL) || (u->Typ() != INT_CMD))
8660 {
8661 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8662 return TRUE;
8663 }
8664 else d = (int)(long)u->Data();
8665 u = u->next;
8666 if ((u != NULL) && (u->Typ() == POLY_CMD))
8667 {
8668 if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
8669 {
8670 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8671 return TRUE;
8672 }
8673 else
8674 {
8675 f0 = (poly)u->Data();
8676 g0 = (poly)u->next->Data();
8677 factorsGiven = 1;
8678 u = u->next->next;
8679 }
8680 }
8681 if ((u != NULL) && (u->Typ() == INT_CMD))
8682 {
8683 if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
8684 {
8685 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8686 return TRUE;
8687 }
8688 else
8689 {
8690 xIndex = (int)(long)u->Data();
8691 yIndex = (int)(long)u->next->Data();
8692 u = u->next->next;
8693 }
8694 }
8695 if (u != NULL)
8696 {
8697 WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
8698 return TRUE;
8699 }
8700
8701 /* checks for provided arguments */
8703 {
8704 WerrorS("expected non-constant polynomial argument(s)");
8705 return TRUE;
8706 }
8707 int n = rVar(currRing);
8708 if ((xIndex < 1) || (n < xIndex))
8709 {
8710 Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
8711 return TRUE;
8712 }
8713 if ((yIndex < 1) || (n < yIndex))
8714 {
8715 Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
8716 return TRUE;
8717 }
8718 if (xIndex == yIndex)
8719 {
8720 WerrorS("expected distinct indices for variables x and y");
8721 return TRUE;
8722 }
8723
8724 /* computation of f0 and g0 if missing */
8725 if (factorsGiven == 0)
8726 {
8727 poly h0 = pSubst(pCopy(h), xIndex, NULL);
8728 intvec* v = NULL;
8730
8731 ivTest(v);
8732
8733 if (i == NULL) return TRUE;
8734
8735 idTest(i);
8736
8737 if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
8738 {
8739 WerrorS("expected h(0,y) to have exactly two distinct monic factors");
8740 return TRUE;
8741 }
8742 f0 = pPower(pCopy(i->m[1]), (*v)[1]);
8743 g0 = pPower(pCopy(i->m[2]), (*v)[2]);
8744 idDelete(&i);
8745 }
8746
8747 poly f; poly g;
8748 henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
8750 L->Init(2);
8751 L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
8752 L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
8753 res->rtyp = LIST_CMD;
8754 res->data = (char*)L;
8755 return FALSE;
8756}
g
Definition cfModGcd.cc:4098
#define idTest(id)
Definition ideals.h:47
VAR idhdl h0
Definition libparse.cc:1143
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x,...
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
#define nIsOne(n)
Definition numbers.h:25
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
#define pPower(p, q)
Definition polys.h:205
#define pSubst(p, n, e)
Definition polys.h:366

◆ jjFAREY_BI()

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

Definition at line 2132 of file iparith.cc.

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

◆ jjFAREY_ID()

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

Definition at line 2143 of file iparith.cc.

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

◆ jjFAREY_LI()

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

Definition at line 10395 of file iparith.cc.

10396{
10397 lists c=(lists)u->CopyD();
10399 res_l->Init(c->nr+1);
10402 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10403 {
10404 sleftv tmp;
10405 tmp.Copy(v);
10407 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10408 }
10409 c->Clean();
10410 res->data=res_l;
10411 return bo;
10412}
@ FAREY_CMD
Definition tok.h:77

◆ jjFETCH()

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

Definition at line 2166 of file iparith.cc.

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

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7507 of file iparith.cc.

7508{
7509 ring r=(ring)u->Data();
7510 leftv v=u->next;
7513 if ((perm_var_l->Typ()!=INTVEC_CMD)
7514 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7515 ||(u->Typ()!=RING_CMD))
7516 {
7517 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7518 return TRUE;
7519 }
7522 if (perm_par_l!=NULL)
7523 perm_par_v=(intvec*)perm_par_l->Data();
7524 idhdl w;
7525 nMapFunc nMap;
7526
7527 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7528 {
7529 int *perm=NULL;
7530 int *par_perm=NULL;
7531 int par_perm_size=0;
7532 BOOLEAN bo;
7533 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7534 {
7535 // Allow imap/fetch to be make an exception only for:
7536 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7537 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7538 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7539 {
7541 }
7542 else
7543 {
7544 goto err_fetch;
7545 }
7546 }
7547 else
7549 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7550 if (par_perm_size!=0)
7551 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7552 int i;
7553 if (perm_par_l==NULL)
7554 {
7555 if (par_perm_size!=0)
7556 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7557 }
7558 else
7559 {
7560 if (par_perm_size==0) WarnS("source ring has no parameters");
7561 else
7562 {
7563 for(i=rPar(r)-1;i>=0;i--)
7564 {
7565 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7566 if ((par_perm[i]<-rPar(currRing))
7567 || (par_perm[i]>rVar(currRing)))
7568 {
7569 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7570 par_perm[i]=0;
7571 }
7572 }
7573 }
7574 }
7575 for(i=rVar(r)-1;i>=0;i--)
7576 {
7577 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7578 if ((perm[i]<-rPar(currRing))
7579 || (perm[i]>rVar(currRing)))
7580 {
7581 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7582 perm[i]=0;
7583 }
7584 }
7585 if (BVERBOSE(V_IMAP))
7586 {
7587 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7588 {
7589 if (perm[i]>0)
7590 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7591 else if (perm[i]<0)
7592 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7593 }
7594 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7595 {
7596 if (par_perm[i-1]<0)
7597 Print("// par nr %d: %s -> par %s\n",
7598 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7599 else if (par_perm[i-1]>0)
7600 Print("// par nr %d: %s -> var %s\n",
7601 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7602 }
7603 }
7604 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7605 sleftv tmpW;
7606 tmpW.Init();
7607 tmpW.rtyp=IDTYP(w);
7608 tmpW.data=IDDATA(w);
7611 {
7612 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7613 }
7614 if (perm!=NULL)
7615 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7616 if (par_perm!=NULL)
7618 return bo;
7619 }
7620 else
7621 {
7622 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7623 }
7624 return TRUE;
7625err_fetch:
7626 char *s1=nCoeffString(r->cf);
7627 char *s2=nCoeffString(currRing->cf);
7628 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7630 return TRUE;
7631}
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 2294 of file iparith.cc.

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

◆ jjFIND3()

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

Definition at line 6162 of file iparith.cc.

6163{
6164 /*4
6165 * look for the substring what in the string where
6166 * starting at position n
6167 * return the position of the first char of what in where
6168 * or 0
6169 */
6170 int n=(int)(long)w->Data();
6171 char *where=(char *)u->Data();
6172 char *what=(char *)v->Data();
6173 char *found;
6174 if ((1>n)||(n>(int)strlen(where)))
6175 {
6176 Werror("start position %d out of range",n);
6177 return TRUE;
6178 }
6179 found = strchr(where+n-1,*what);
6180 if (*(what+1)!='\0')
6181 {
6182 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6183 {
6184 found=strchr(found+1,*what);
6185 }
6186 }
6187 if (found != NULL)
6188 {
6189 res->data=(char *)((found-where)+1);
6190 }
6191 return FALSE;
6192}

◆ jjFRES()

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

Definition at line 2349 of file iparith.cc.

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

◆ jjFRES3()

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

Definition at line 2312 of file iparith.cc.

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

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

6194{
6195 if ((int)(long)w->Data()==0)
6196 res->data=(char *)walkProc(u,v);
6197 else
6198 res->data=(char *)fractalWalkProc(u,v);
6199 setFlag( res, FLAG_STD );
6200 return FALSE;
6201}
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 2378 of file iparith.cc.

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

◆ jjGCD_I()

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

Definition at line 2365 of file iparith.cc.

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

◆ jjGCD_N()

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

Definition at line 2385 of file iparith.cc.

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

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

◆ jjGE_BI()

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

Definition at line 1164 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1171 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1176 of file iparith.cc.

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

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4264 of file iparith.cc.

4265{
4266 si_link l = (si_link)v->Data();
4267 if (slGetDump(l))
4268 {
4269 const char *s;
4270 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4271 else s=sNoName_fe;
4272 Werror("cannot get dump from `%s`",s);
4273 return TRUE;
4274 }
4275 else
4276 return FALSE;
4277}

◆ jjGT_BI()

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

Definition at line 1182 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1189 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1194 of file iparith.cc.

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

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4278 of file iparith.cc.

4279{
4281 ideal I=(ideal)v->Data();
4282 res->data=(void *)iiHighCorner(I,0);
4283 return FALSE;
4284}
poly iiHighCorner(ideal I, int ak)
Definition ipshell.cc:1597

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4285 of file iparith.cc.

4286{
4288 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4290 ideal I=(ideal)v->Data();
4291 int i;
4292 poly p=NULL,po=NULL;
4294 if (w==NULL)
4295 {
4296 w = new intvec(rk);
4297 delete_w=TRUE;
4298 }
4299 for(i=rk;i>0;i--)
4300 {
4301 p=iiHighCorner(I,i);
4302 if (p==NULL)
4303 {
4304 WerrorS("module must be zero-dimensional");
4305 if (delete_w) delete w;
4306 return TRUE;
4307 }
4308 if (po==NULL)
4309 {
4310 po=p;
4311 }
4312 else
4313 {
4314 // now po!=NULL, p!=NULL
4315 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4316 if (d==0)
4317 d=pLmCmp(po,p);
4318 if (d > 0)
4319 {
4320 pDelete(&p);
4321 }
4322 else // (d < 0)
4323 {
4324 pDelete(&po); po=p;
4325 }
4326 }
4327 }
4328 if (delete_w) delete w;
4329 res->data=(void *)po;
4330 return FALSE;
4331}
#define pGetComp(p)
Component.
Definition polys.h:38
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:106
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 4332 of file iparith.cc.

4333{
4334 if (rField_is_Z(currRing))
4335 {
4336 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4337 PrintS("// performed for generic fibre, that is, over Q\n");
4338 }
4340 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4341 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4342 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4343 return FALSE;
4344}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:856

◆ jjHILBERT2()

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

Definition at line 2408 of file iparith.cc.

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

◆ jjHILBERT3()

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

Definition at line 6202 of file iparith.cc.

6203{
6204 intvec *wdegree=(intvec*)w->Data();
6205 if (wdegree->length()!=currRing->N)
6206 {
6207 Werror("weight vector must have size %d, not %d",
6208 currRing->N,wdegree->length());
6209 return TRUE;
6210 }
6211 if (rField_is_Z(currRing))
6212 {
6213 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6214 PrintS("// performed for generic fibre, that is, over Q\n");
6215 }
6216 assumeStdFlag(u);
6217 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6218 if (errorreported) return TRUE;
6219
6220 switch((int)(long)v->Data())
6221 {
6222 case 1:
6224 return FALSE;
6225 case 2:
6227 return FALSE;
6228 }
6230 return TRUE;
6231}

◆ jjHILBERT3Qt()

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

Definition at line 6232 of file iparith.cc.

6233{
6234 if (rField_is_Z(currRing))
6235 {
6236 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6237 PrintS("// performed for generic fibre, that is, over Q\n");
6238 }
6239 assumeStdFlag(u);
6240 ring Qt =(ring)v->Data();
6241 char *name=(char*)w->Data();
6242 poly h;
6243 if (u->Typ()==IDEAL_CMD)
6245 else
6246 {
6247 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6249 }
6251 IDPOLY(hh)=h;
6252 return FALSE;
6253}
char name(const Variable &v)
Definition factory.h:189
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:2063
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:2020
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:279
#define IDPOLY(a)
Definition ipid.h:130

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4345 of file iparith.cc.

4346{
4347 if (rField_is_Z(currRing))
4348 {
4349 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4350 PrintS("// performed for generic fibre, that is, over Q\n");
4351 }
4352 res->data=(void *)hSecondSeries((intvec *)v->Data());
4353 return FALSE;
4354}

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4355 of file iparith.cc.

4356{
4357 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4358 ideal v_id=(ideal)v->Data();
4359 if (w==NULL)
4360 {
4361 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4362 if (res->data!=NULL)
4363 {
4364 if (v->rtyp==IDHDL)
4365 {
4366 char *s_isHomog=omStrDup("isHomog");
4367 if (v->e==NULL)
4368 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4369 else
4370 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4371 }
4372 else if (w!=NULL) delete w;
4373 } // if res->data==NULL then w==NULL
4374 }
4375 else
4376 {
4377 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4378 if((res->data==NULL) && (v->rtyp==IDHDL))
4379 {
4380 if (v->e==NULL)
4381 atKill((idhdl)(v->data),"isHomog");
4382 else
4383 atKill((idhdl)(v->LData()),"isHomog");
4384 }
4385 }
4386 return FALSE;
4387}
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:2083
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 2485 of file iparith.cc.

2486{
2487 intvec *w=new intvec(rVar(currRing));
2488 intvec *vw=(intvec*)u->Data();
2489 ideal v_id=(ideal)v->Data();
2492 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2493 currRing->pLexOrder=FALSE;
2494 kHomW=vw;
2495 kModW=w;
2497 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2498 currRing->pLexOrder=save_pLexOrder;
2499 kHomW=NULL;
2500 kModW=NULL;
2502 if (w!=NULL) delete w;
2503 return FALSE;
2504}
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2418
VAR intvec * kHomW
Definition kstd1.cc:2406
VAR intvec * kModW
Definition kstd1.cc:2406
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3729
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3717
long(* pFDegProc)(poly p, ring r)
Definition ring.h:39
long(* pLDegProc)(poly p, int *length, ring r)
Definition ring.h:38

◆ jjHOMOG1_WI()

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

Definition at line 2505 of file iparith.cc.

2506{
2507 intvec *vw=(intvec*)u->Data();
2508 ideal v_id=(ideal)v->Data();
2509 res->data=(void *)(long)id_HomIdealW(v_id,currRing->qideal,vw,currRing);
2510 return FALSE;
2511}
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 2463 of file iparith.cc.

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

6255{
6256 PrintS("TODO\n");
6257 int i=pVar((poly)v->Data());
6258 if (i==0)
6259 {
6260 WerrorS("ringvar expected");
6261 return TRUE;
6262 }
6263 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6264 int d=pWTotaldegree(p);
6265 pLmDelete(p);
6266 if (d==1)
6267 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6268 else
6269 WerrorS("variable must have weight 1");
6270 return (d!=1);
6271}
#define pWTotaldegree(p)
Definition polys.h:284

◆ jjHOMOG_P()

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

Definition at line 2446 of file iparith.cc.

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

◆ jjHOMOG_P_W()

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

Definition at line 6272 of file iparith.cc.

6273{
6274 PrintS("TODO\n");
6275 int i=pVar((poly)v->Data());
6276 if (i==0)
6277 {
6278 WerrorS("ringvar expected");
6279 return TRUE;
6280 }
6281 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6282 int d=pWTotaldegree(p);
6283 pLmDelete(p);
6284 if (d==1)
6285 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6286 else
6287 WerrorS("variable must have weight 1");
6288 return (d!=1);
6289}

◆ jjHOMOG_W_M()

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

Definition at line 6290 of file iparith.cc.

6291{
6292 intvec *w=(intvec *)v3->Data();
6293 intvec *vw=(intvec*)v2->Data();
6294 ideal v_id=(ideal)v1->Data();
6295 res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6296 return FALSE;
6297}
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 4405 of file iparith.cc.

4406{
4407 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4409 MATROWS(mat)=1;
4410 mat->rank=1;
4411 res->data=(char *)mat;
4412 return FALSE;
4413}

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4414 of file iparith.cc.

4415{
4416 map m=(map)v->CopyD(MAP_CMD);
4417 omFreeBinAddr((ADDRESS)m->preimage);
4418 m->preimage=NULL;
4419 ideal I=(ideal)m;
4420 I->rank=1;
4421 res->data=(char *)I;
4422 return FALSE;
4423}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7464 of file iparith.cc.

7465{
7466 leftv h=v;
7467 int s=exprlist_length(h);
7468 ideal id=idInit(s,1);
7469 int rank=1;
7470 int i=0;
7471 poly p;
7472 int dest_type=POLY_CMD;
7474 while (h!=NULL)
7475 {
7476 // use standard type conversions to poly/vector
7477 int ri;
7478 int ht=h->Typ();
7479 if (ht==dest_type)
7480 {
7481 p=(poly)h->CopyD();
7482 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7483 }
7484 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7485 {
7486 sleftv tmp;
7487 leftv hnext=h->next;
7488 h->next=NULL;
7490 h->next=hnext;
7491 p=(poly)tmp.data;
7492 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7493 }
7494 else
7495 {
7496 idDelete(&id);
7497 return TRUE;
7498 }
7499 id->m[i]=p;
7500 i++;
7501 h=h->next;
7502 }
7503 id->rank=rank;
7504 res->data=(char *)id;
7505 return FALSE;
7506}
int exprlist_length(leftv v)
Definition ipshell.cc:550

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4424 of file iparith.cc.

4425{
4426 if (currRing!=NULL)
4427 {
4428 ring q=(ring)v->Data();
4429 if (rSamePolyRep(currRing, q))
4430 {
4431 if (q->qideal==NULL)
4432 res->data=(char *)idInit(1,1);
4433 else
4434 res->data=(char *)idCopy(q->qideal);
4435 return FALSE;
4436 }
4437 }
4438 WerrorS("can only get ideal from identical qring");
4439 return TRUE;
4440}
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:1802

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5671 of file iparith.cc.

5672{
5673 res->data = (char *)(long)idElem((ideal)v->Data());
5674 return FALSE;
5675}
static int idElem(const ideal F)
number of non-zero polys in F

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5676 of file iparith.cc.

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

5697{
5698 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5700 return FALSE;
5701}
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 4388 of file iparith.cc.

4389{
4390#ifdef HAVE_SHIFTBBA
4391 if (rIsLPRing(currRing))
4392 {
4393 int deg = (int)(long)v->Data();
4394 if (deg > currRing->N/currRing->isLPring)
4395 {
4396 WerrorS("degree bound of Letterplace ring is to small");
4397 return TRUE;
4398 }
4399 }
4400#endif
4401 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4403 return FALSE;
4404}
#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 5702 of file iparith.cc.

5703{
5704 res->data = (char *)idMinBase((ideal)v->Data());
5705 return FALSE;
5706}
ideal idMinBase(ideal h1, ideal *SB)
Definition ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5754 of file iparith.cc.

5755{
5756 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5757 return FALSE;
5758}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5681 of file iparith.cc.

5682{
5683 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5684 return FALSE;
5685}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4441 of file iparith.cc.

4442{
4443 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4444 iv->makeVector();
4445 res->data = iv;
4446 return FALSE;
4447}
void makeVector()
Definition intvec.h:102
@ INTMAT_CMD
Definition grammar.cc:280

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4448 of file iparith.cc.

4449{
4450 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4451 return FALSE;
4452}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition coeffs.h:786

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4453 of file iparith.cc.

4454{
4456 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4457 return FALSE;
4458}
intvec * scIndIntvec(ideal S, ideal Q)
Definition hdegree.cc:284

◆ jjINDEPSET2()

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

Definition at line 2512 of file iparith.cc.

2513{
2514 assumeStdFlag(u);
2515 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2516 currRing->qideal);
2517 return FALSE;
2518}
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 1388 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1410 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1446 of file iparith.cc.

1447{
1448 poly p=(poly)u->Data();
1449 long i=(long)v->Data();
1450 long j=0;
1451 while (p!=NULL)
1452 {
1453 j++;
1454 if (j==i)
1455 {
1456 res->data=(char *)pHead(p);
1457 return FALSE;
1458 }
1459 pIter(p);
1460 }
1461 return FALSE;
1462}
#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:68

◆ jjINDEX_P_IV()

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

Definition at line 1486 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1463 of file iparith.cc.

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

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

◆ jjINDEX_V_IV()

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

Definition at line 1522 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2525 of file iparith.cc.

2526{
2527 const lists L = (lists)l->Data();
2528 const int n = L->nr; assume (n >= 0);
2529 std::vector<ideal> V(n + 1);
2530
2531 for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2532
2533 res->data=interpolation(V, (intvec*)v->Data());
2535 return errorreported;
2536}
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4459 of file iparith.cc.

4460{
4461 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4462 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4463 res->data = result;
4464 return FALSE;
4465}
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3782
#define TEST_OPT_PROT
Definition options.h:105
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 6325 of file iparith.cc.

6326{
6327 ideal I=(ideal)u->Data();
6328 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6329 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6331 return FALSE;
6332}
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition ideals.cc:315
#define TEST_OPT_RETURN_SB
Definition options.h:114

◆ jjINTERSECT()

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

Definition at line 2519 of file iparith.cc.

2520{
2521 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2523 return FALSE;
2524}

◆ jjINTERSECT3()

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

Definition at line 6312 of file iparith.cc.

6313{
6314 ideal I1=(ideal)u->Data();
6315 ideal I2=(ideal)v->Data();
6316 ideal I3=(ideal)w->Data();
6317 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6318 r[0]=I1;
6319 r[1]=I2;
6320 r[2]=I3;
6321 res->data=(char *)idMultSect(r,3);
6322 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6323 return FALSE;
6324}
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 7632 of file iparith.cc.

7633{
7634 leftv h=v;
7635 int l=v->listLength();
7636 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7637 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7638 int t=0;
7639 // try to convert to IDEAL_CMD
7640 while (h!=NULL)
7641 {
7642 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7643 {
7644 t=IDEAL_CMD;
7645 }
7646 else break;
7647 h=h->next;
7648 }
7649 // if failure, try MODUL_CMD
7650 if (t==0)
7651 {
7652 h=v;
7653 while (h!=NULL)
7654 {
7655 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7656 {
7657 t=MODUL_CMD;
7658 }
7659 else break;
7660 h=h->next;
7661 }
7662 }
7663 // check for success in converting
7664 if (t==0)
7665 {
7666 WerrorS("cannot convert to ideal or module");
7667 return TRUE;
7668 }
7669 // call idMultSect
7670 h=v;
7671 int i=0;
7672 sleftv tmp;
7673 while (h!=NULL)
7674 {
7675 if (h->Typ()==t)
7676 {
7677 r[i]=(ideal)h->Data(); /*no copy*/
7678 h=h->next;
7679 }
7680 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7681 {
7682 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7683 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7684 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7685 return TRUE;
7686 }
7687 else
7688 {
7689 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7690 copied[i]=TRUE;
7691 h=tmp.next;
7692 }
7693 i++;
7694 }
7695 res->rtyp=t;
7696 res->data=(char *)idMultSect(r,i);
7697 while(i>0)
7698 {
7699 i--;
7700 if (copied[i]) idDelete(&(r[i]));
7701 }
7702 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7703 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7704 return FALSE;
7705}

◆ jjINTMAT3()

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

Definition at line 6298 of file iparith.cc.

6299{
6300 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6301 intvec* arg = (intvec*) u->Data();
6302 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6303
6304 for (i=0; i<n; i++)
6305 {
6306 (*im)[i] = (*arg)[i];
6307 }
6308
6309 res->data = (char *)im;
6310 return FALSE;
6311}

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7868 of file iparith.cc.

7869{
7870 leftv h=v;
7871 int i=exprlist_length(h);
7872 intvec *iv=new intvec(i);
7873 i=0;
7874 while (h!=NULL)
7875 {
7876 if(h->Typ()==INT_CMD)
7877 {
7878 (*iv)[i]=(int)(long)h->Data();
7879 }
7880 else if (h->Typ()==INTVEC_CMD)
7881 {
7882 intvec *ivv=(intvec*)h->Data();
7883 for(int j=0;j<ivv->length();j++,i++)
7884 {
7885 (*iv)[i]=(*ivv)[j];
7886 }
7887 i--;
7888 }
7889 else
7890 {
7891 delete iv;
7892 return TRUE;
7893 }
7894 i++;
7895 h=h->next;
7896 }
7897 res->data=(char *)iv;
7898 return FALSE;
7899}

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4486 of file iparith.cc.

4487{
4488 res->data = (char *)0;
4489 return FALSE;
4490}

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4475 of file iparith.cc.

4476{
4477 res->data = (char *)(long)pVar((poly)v->Data());
4478 return FALSE;
4479}

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4480 of file iparith.cc.

4481{
4482 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4483 currRing->N)+1);
4484 return FALSE;
4485}
int r_IsRingVar(const char *n, char **names, int N)
Definition ring.cc:213

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv  res,
leftv  a 
)
static

Definition at line 4522 of file iparith.cc.

4523{
4524 ideal id = (ideal)a->Data();
4525 id = id_Transp(id,currRing);
4526 int W = IDELEMS(id);
4527
4528 ideal result = idInit(W * currRing->N, id->rank);
4529 poly *p = result->m;
4530
4531 for( int v = 1; v <= currRing->N; v++ )
4532 {
4533 poly* q = id->m;
4534 for( int i = 0; i < W; i++, p++, q++ )
4535 *p = pDiff( *q, v );
4536 }
4537 idDelete(&id);
4538
4539 res->data = (char *)result;
4540 return FALSE;
4541}

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4491 of file iparith.cc.

4492{
4493 ideal i=idInit(currRing->N,1);
4494 int k;
4495 poly p=(poly)(v->Data());
4496 for (k=currRing->N;k>0;k--)
4497 {
4498 i->m[k-1]=pDiff(p,k);
4499 }
4500 res->data = (char *)i;
4501 return FALSE;
4502}

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2543 of file iparith.cc.

2544{
2545 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2546 return jjStdJanetBasis(res,v,0);
2547}
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 2537 of file iparith.cc.

2538{
2539 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2540 return jjStdJanetBasis(res,u,(int)(long)v->Data());
2541}

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7961 of file iparith.cc.

7962{
7963 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7964 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7965 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7966 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7967 leftv u1=u;
7968 leftv u2=u1->next;
7969 leftv u3=u2->next;
7970 leftv u4=u3->next;
7971 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7972 {
7973 if(!pIsUnit((poly)u2->Data()))
7974 {
7975 WerrorS("2nd argument must be a unit");
7976 return TRUE;
7977 }
7978 res->rtyp=u1->Typ();
7979 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7980 pCopy((poly)u2->Data()),(intvec*)u4->Data());
7981 return FALSE;
7982 }
7983 else
7984 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7985 {
7986 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7987 {
7988 WerrorS("2nd argument must be a diagonal matrix of units");
7989 return TRUE;
7990 }
7991 res->rtyp=u1->Typ();
7992 res->data=(char*)idSeries(
7993 (int)(long)u3->Data(),
7994 idCopy((ideal)u1->Data()),
7995 mp_Copy((matrix)u2->Data(), currRing),
7996 (intvec*)u4->Data()
7997 );
7998 return FALSE;
7999 }
8000 else
8001 {
8002 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
8003 Tok2Cmdname(iiOp));
8004 return TRUE;
8005 }
8006}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition ideals.cc:2135
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition matpol.cc:810
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition matpol.cc:57
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition polys.h:241
#define pSeries(n, p, u, w)
Definition polys.h:372

◆ jjJET_ID()

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

Definition at line 2553 of file iparith.cc.

2554{
2555 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2556 return FALSE;
2557}
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 6350 of file iparith.cc.

6351{
6352 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6353 (intvec *)w->Data(),currRing);
6354 return FALSE;
6355}
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 6356 of file iparith.cc.

6357{
6358 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6359 {
6360 WerrorS("2nd argument must be a diagonal matrix of units");
6361 return TRUE;
6362 }
6363 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6364 (matrix)v->CopyD());
6365 return FALSE;
6366}

◆ jjJET_P()

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

Definition at line 2548 of file iparith.cc.

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

◆ jjJET_P_IV()

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

Definition at line 6333 of file iparith.cc.

6334{
6335 int *iw=iv2array((intvec *)w->Data(),currRing);
6336 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6337 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6338 return FALSE;
6339}
#define ppJetW(p, m, iv)
Definition polys.h:369

◆ jjJET_P_P()

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

Definition at line 6340 of file iparith.cc.

6341{
6342 if (!pIsUnit((poly)v->Data()))
6343 {
6344 WerrorS("2nd argument must be a unit");
6345 return TRUE;
6346 }
6347 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6348 return FALSE;
6349}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition p_polys.cc:4607

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4561 of file iparith.cc.

4562{
4564 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4565 return FALSE;
4566}
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition hdegree.cc:1413

◆ jjKBASE2()

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

Definition at line 2558 of file iparith.cc.

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

◆ jjKERNEL()

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

Definition at line 2571 of file iparith.cc.

2572{
2573 return jjPREIMAGE(res,u,v,NULL);
2574}
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:6656

◆ jjKERNEL_M()

static BOOLEAN jjKERNEL_M ( leftv  res,
leftv  v 
)
static

Definition at line 4543 of file iparith.cc.

4544{
4545#ifdef HAVE_FLINT
4546 res->data = (char *)singflint_kernel((matrix)(v->Data()),currRing);
4547 return res->data==NULL;
4548#else
4549 return TRUE;
4550#endif
4551}
matrix singflint_kernel(matrix m, const ring R)

◆ jjKERNEL_SM()

static BOOLEAN jjKERNEL_SM ( leftv  res,
leftv  v 
)
static

Definition at line 4552 of file iparith.cc.

4553{
4554#ifdef HAVE_FLINT
4555 res->data = (char *)singflint_kernel((ideal)(v->Data()),currRing);
4556 return res->data==NULL;
4557#else
4558 return TRUE;
4559#endif
4560}

◆ jjKLAMMER()

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

Definition at line 1558 of file iparith.cc.

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

◆ jjKLAMMER_IV()

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

Definition at line 1570 of file iparith.cc.

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

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 8044 of file iparith.cc.

8045{
8047 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
8048 {
8049 memcpy(res,u,sizeof(sleftv));
8050 u->Init();
8051 return FALSE;
8052 }
8053 leftv v=u->next;
8054 BOOLEAN b;
8055 if(v==NULL) // p()
8057 else if ((v->next==NULL) // p(1)
8058 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
8059 {
8060 u->next=NULL;
8061 b=iiExprArith2(res,u,iiOp,v);
8062 u->next=v;
8063 }
8064 else // p(1,2), p undefined
8065 {
8066 if (v->Typ()!=INT_CMD)
8067 {
8068 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8069 return TRUE;
8070 }
8071 int l=u->listLength();
8072 size_t len=strlen(u->name) + 12*l;
8073 char * nn = (char *)omAlloc(len);
8074 snprintf(nn,len,"%s(%d",u->name,(int)(long)v->Data());
8075 char *s=nn;
8076 do
8077 {
8078 while (*s!='\0') s++;
8079 v=v->next;
8080 if (v->Typ()!=INT_CMD)
8081 {
8082 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8083 omFree((ADDRESS)nn);
8084 return TRUE;
8085 }
8086 snprintf(s,len-(nn-s),",%d",(int)(long)v->Data());
8087 } while (v->next!=NULL);
8088 while (*s!='\0') s++;
8089 nn=strcat(nn,")");
8090 char *n=omStrDup(nn);
8091 omFree((ADDRESS)nn);
8092 syMake(res,n);
8093 b=FALSE;
8094 }
8095 return b;
8096}
BOOLEAN yyInRingConstruction
Definition grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1597 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2575 of file iparith.cc.

2576{
2577 return mpKoszul(res, u,v,NULL);
2578}
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition ipshell.cc:3076

◆ jjKoszul_Id()

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

Definition at line 2579 of file iparith.cc.

2580{
2581 sleftv h;
2582 h.Init();
2583 h.rtyp=INT_CMD;
2584 h.data=(void *)(long)IDELEMS((ideal)v->Data());
2585 return mpKoszul(res, u, &h, v);
2586}

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4567 of file iparith.cc.

4568{
4569 res->data=(char *)syConvList((lists)v->Data());
4570 if (res->data != NULL)
4571 return FALSE;
4572 else
4573 return TRUE;
4574}
syStrategy syConvList(lists li)
Definition ipshell.cc:3240

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4644 of file iparith.cc.

4645{
4646 sleftv a2,a3;
4647 memset(&a2,0,sizeof(a2));
4648 memset(&a3,0,sizeof(a3));
4649 a2.rtyp=INT_CMD; a2.data=(void*)10;
4650 a3.rtyp=INT_CMD; a3.data=(void*)1;
4651 return nuLagSolve(res,v,&a2,&a3);
4652}
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:4670

◆ jjLE_BI()

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

Definition at line 1199 of file iparith.cc.

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

◆ jjLE_I()

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

Definition at line 1203 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1208 of file iparith.cc.

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

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4575 of file iparith.cc.

4576{
4577 poly p=(poly)v->Data();
4578 if (p==NULL)
4579 {
4580 res->data=(char *)nInit(0);
4581 }
4582 else
4583 {
4585 res->data=(char *)nCopy(pGetCoeff(p));
4586 }
4587 return FALSE;
4588}

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4589 of file iparith.cc.

4590{
4591 poly p=(poly)v->Data();
4592 int s=currRing->N;
4593 if (v->Typ()==VECTOR_CMD) s++;
4594 intvec *iv=new intvec(s);
4595 if (p!=NULL)
4596 {
4597 for(int i = currRing->N;i;i--)
4598 {
4599 (*iv)[i-1]=pGetExp(p,i);
4600 }
4601 if (s!=currRing->N)
4602 (*iv)[currRing->N]=pGetComp(p);
4603 }
4604 res->data=(char *)iv;
4605 return FALSE;
4606}
#define pGetExp(p, i)
Exponent.
Definition polys.h:42

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4607 of file iparith.cc.

4608{
4609 poly p=(poly)v->Data();
4610 if (p == NULL)
4611 {
4612 res->data = (char*) NULL;
4613 }
4614 else
4615 {
4616 poly lm = pLmInit(p);
4617 pSetCoeff0(lm, nInit(1));
4618 res->data = (char*) lm;
4619 }
4620 return FALSE;
4621}
#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:65

◆ jjLIFT()

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

Definition at line 2587 of file iparith.cc.

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

◆ jjLIFT3()

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

Definition at line 7096 of file iparith.cc.

7097{
7098 if (w->rtyp!=IDHDL) return TRUE;
7099 int ul= IDELEMS((ideal)u->Data());
7100 int vl= IDELEMS((ideal)v->Data());
7101#ifdef HAVE_SHIFTBBA
7102 if (rIsLPRing(currRing))
7103 {
7104 if (currRing->LPncGenCount < ul)
7105 {
7106 Werror("At least %d ncgen variables are needed for this computation.", ul);
7107 return TRUE;
7108 }
7109 }
7110#endif
7111 ideal m
7112 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7113 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
7114 if (m==NULL) return TRUE;
7115 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7116 return FALSE;
7117}
#define IDMATRIX(a)
Definition ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 8097 of file iparith.cc.

8098{
8099 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8100 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8101 leftv u=U;
8102 leftv v=u->next;
8103 leftv w=v->next;
8104 leftv u4=w->next;
8105 if (w->rtyp!=IDHDL) return TRUE;
8106 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8107 {
8108 // see jjLIFT3
8109 ideal I=(ideal)u->Data();
8110 int ul= IDELEMS(I /*(ideal)u->Data()*/);
8111 int vl= IDELEMS((ideal)v->Data());
8112 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
8113 ideal m
8114 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
8115 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
8116 if (m==NULL) return TRUE;
8117 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
8118 return FALSE;
8119 }
8120 else
8121 {
8122 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
8123 "or (`module`,`module`,`matrix`,`string`) expected",
8124 Tok2Cmdname(iiOp));
8125 return TRUE;
8126 }
8127}

◆ jjLIFTSTD()

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

Definition at line 2607 of file iparith.cc.

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

◆ jjLIFTSTD_ALG()

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

Definition at line 7141 of file iparith.cc.

7142{
7143 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7144 idhdl hv=(idhdl)v->data;
7145 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
7146#ifdef HAVE_SHIFTBBA
7147 if (rIsLPRing(currRing))
7148 {
7149 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7150 {
7151 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7152 return TRUE;
7153 }
7154 }
7155#endif
7156 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7157 res->data = (char *)idLiftStd((ideal)u->Data(),
7158 &(hv->data.umatrix),testHomog,
7159 NULL,alg);
7160 setFlag(res,FLAG_STD); v->flag=0;
7161 return FALSE;
7162}

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 8128 of file iparith.cc.

8129{
8130 // we have 4 or 5 arguments
8131 leftv u=U;
8132 leftv v=u->next;
8133 leftv u3=v->next;
8134 leftv u4=u3->next;
8135 leftv u5=u4->next; // might be NULL
8136
8137 ideal *syz=NULL;
8139 ideal h11=NULL;
8140
8141 if(u5==NULL)
8142 {
8143 // test all three possibilities for 4 arguments
8144 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8145 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8146 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
8147 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
8148 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
8149 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
8150
8151 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8152 {
8153 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8154 idhdl hw=(idhdl)u3->data;
8155 syz=&(hw->data.uideal);
8156 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8157 }
8158 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
8159 {
8160 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8161 idhdl hw=(idhdl)u3->data;
8162 syz=&(hw->data.uideal);
8163 h11=(ideal)u4->Data();
8164 }
8165 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
8166 {
8167 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
8168 h11=(ideal)u4->Data();
8169 }
8170 else
8171 {
8172 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8173 return TRUE;
8174 }
8175 }
8176 else
8177 {
8178 // we have 5 arguments
8179 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
8180 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
8181 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8182 {
8183 idhdl hw=(idhdl)u3->data;
8184 syz=&(hw->data.uideal);
8185 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8186 h11=(ideal)u5->Data();
8187 }
8188 else
8189 {
8190 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8191 return TRUE;
8192 }
8193 }
8194
8195#ifdef HAVE_SHIFTBBA
8196 if (rIsLPRing(currRing))
8197 {
8198 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
8199 {
8200 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
8201 return TRUE;
8202 }
8203 }
8204#endif
8205
8206 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
8207 idhdl hv=(idhdl)v->data;
8208 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
8209 res->rtyp = u->Typ();
8210 res->data = (char *)idLiftStd((ideal)u->Data(),
8211 &(hv->data.umatrix),testHomog,
8212 syz,alg,h11);
8213 setFlag(res,FLAG_STD); v->flag=0;
8214 if(syz!=NULL)
8215 u3->flag=0;
8216 return FALSE;
8217}
@ GbDefault
Definition ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 7118 of file iparith.cc.

7119{
7120 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7121 if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
7122 idhdl hv=(idhdl)v->data;
7123 idhdl hw=(idhdl)w->data;
7124#ifdef HAVE_SHIFTBBA
7125 if (rIsLPRing(currRing))
7126 {
7127 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7128 {
7129 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7130 return TRUE;
7131 }
7132 }
7133#endif
7134 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7135 res->data = (char *)idLiftStd((ideal)u->Data(),
7136 &(hv->data.umatrix),testHomog,
7137 &(hw->data.uideal));
7138 setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7139 return FALSE;
7140}

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 8218 of file iparith.cc.

8219{
8220 int sl=0;
8221 if (v!=NULL) sl = v->listLength();
8222 lists L;
8223 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
8224 {
8225 int add_row_shift = 0;
8226 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
8227 if (weights!=NULL) add_row_shift=weights->min_in();
8229 }
8230 else
8231 {
8233 leftv h=NULL;
8234 int i;
8235 int rt;
8236
8237 L->Init(sl);
8238 for (i=0;i<sl;i++)
8239 {
8240 if (h!=NULL)
8241 { /* e.g. not in the first step:
8242 * h is the pointer to the old sleftv,
8243 * v is the pointer to the next sleftv
8244 * (in this moment) */
8245 h->next=v;
8246 }
8247 h=v;
8248 v=v->next;
8249 h->next=NULL;
8250 rt=h->Typ();
8251 if (rt==0)
8252 {
8253 L->Clean();
8254 Werror("`%s` is undefined",h->Fullname());
8255 return TRUE;
8256 }
8257 if (rt==RING_CMD)
8258 {
8259 L->m[i].rtyp=rt;
8260 L->m[i].data=rIncRefCnt(((ring)h->Data()));
8261 }
8262 else
8263 L->m[i].Copy(h);
8264 }
8265 }
8266 res->data=(char *)L;
8267 return FALSE;
8268}
int min_in()
Definition intvec.h:121
void Copy(leftv e)
Definition subexpr.cc:689
@ RESOLUTION_CMD
Definition grammar.cc:291
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3168
static ring rIncRefCnt(ring r)
Definition ring.h:849

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4626 of file iparith.cc.

4627{
4628 lists l=(lists)v->Data();
4629 long mm=(long)atGet(v,"maxExp",INT_CMD);
4630 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4632 res->data=(char *)r;
4633 return (r==NULL);
4634}
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition ipshell.cc:2772

◆ jjLOAD()

BOOLEAN jjLOAD ( const char s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5569 of file iparith.cc.

5570{
5571 char libnamebuf[1024];
5573
5574#ifdef HAVE_DYNAMIC_LOADING
5575 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5576#endif /* HAVE_DYNAMIC_LOADING */
5577 switch(LT)
5578 {
5579 default:
5580 case LT_NONE:
5581 Werror("%s: unknown type", s);
5582 break;
5583 case LT_NOTFOUND:
5584 Werror("cannot open %s", s);
5585 break;
5586
5587 case LT_SINGULAR:
5588 {
5589 char *plib = iiConvName(s);
5590 idhdl pl = IDROOT->get_level(plib,0);
5591 if (pl==NULL)
5592 {
5593 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5594 IDPACKAGE(pl)->language = LANG_SINGULAR;
5595 IDPACKAGE(pl)->libname=omStrDup(s);
5596 }
5597 else if (IDTYP(pl)!=PACKAGE_CMD)
5598 {
5599 Werror("can not create package `%s`",plib);
5601 return TRUE;
5602 }
5603 else /* package */
5604 {
5605 package pa=IDPACKAGE(pl);
5606 if ((pa->language==LANG_C)
5607 || (pa->language==LANG_MIX))
5608 {
5609 Werror("can not create package `%s` - binaries exists",plib);
5611 return TRUE;
5612 }
5613 }
5615 package savepack=currPack;
5616 currPack=IDPACKAGE(pl);
5617 IDPACKAGE(pl)->loaded=TRUE;
5618 char libnamebuf[1024];
5619 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5622 IDPACKAGE(pl)->loaded=(!bo);
5623 return bo;
5624 }
5625 case LT_BUILTIN:
5626 SModulFunc_t iiGetBuiltinModInit(const char*);
5628 case LT_MACH_O:
5629 case LT_ELF:
5630 case LT_HPUX:
5631#ifdef HAVE_DYNAMIC_LOADING
5633#else /* HAVE_DYNAMIC_LOADING */
5634 WerrorS("Dynamic modules are not supported by this version of Singular");
5635 break;
5636#endif /* HAVE_DYNAMIC_LOADING */
5637 }
5638 return TRUE;
5639}
CanonicalForm fp
Definition cfModGcd.cc:4110
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition feFopen.cc:47
VAR package basePack
Definition ipid.cc:56
VAR package currPack
Definition ipid.cc:55
#define IDROOT
Definition ipid.h:19
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition iplib.cc:1304
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:983
char * iiConvName(const char *libname)
Definition iplib.cc:1439
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition iplib.cc:1294
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition iplib.cc:816
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 4622 of file iparith.cc.

4623{
4624 return jjLOAD((char*)v->Data(),FALSE);
4625}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition iparith.cc:5569

◆ jjLOAD2()

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

Definition at line 2627 of file iparith.cc.

2628{
2629 return jjLOAD((char*)v->Data(),TRUE);
2630}

◆ jjLOAD_E()

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

Definition at line 2631 of file iparith.cc.

2632{
2633 char * s=(char *)u->Data();
2634 if(strcmp(s, "with")==0)
2635 return jjLOAD((char*)v->Data(), TRUE);
2636 if (strcmp(s,"try")==0)
2637 return jjLOAD_TRY((char*)v->Data());
2638 WerrorS("invalid second argument");
2639 WerrorS("load(\"libname\" [,option]);");
2640 return TRUE;
2641}
BOOLEAN jjLOAD_TRY(const char *s)
Definition iparith.cc:5645

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char s)

Definition at line 5645 of file iparith.cc.

5646{
5647 if (!iiGetLibStatus(s))
5648 {
5649 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5653 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5654 Print("loading of >%s< failed\n",s);
5656 errorreported=0;
5657 }
5658 return FALSE;
5659}
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition iparith.cc:5640
static void WerrorS_dummy(const char *)
Definition iparith.cc:5641
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 1212 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1216 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1221 of file iparith.cc.

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

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4653 of file iparith.cc.

4654{
4655 /* computes the LU-decomposition of a matrix M;
4656 i.e., M = P * L * U, where
4657 - P is a row permutation matrix,
4658 - L is in lower triangular form,
4659 - U is in upper row echelon form
4660 Then, we also have P * M = L * U.
4661 A list [P, L, U] is returned. */
4662 matrix mat = (matrix)v->Data();
4663 if (!idIsConstant((ideal)mat))
4664 {
4665 WerrorS("matrix must be constant");
4666 return TRUE;
4667 }
4668 matrix pMat;
4669 matrix lMat;
4670 matrix uMat;
4671
4673
4675 ll->Init(3);
4676 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4677 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4678 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4679 res->data=(char*)ll;
4680
4681 return FALSE;
4682}
#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 7706 of file iparith.cc.

7707{
7708 /* computation of the inverse of a quadratic matrix A
7709 using the L-U-decomposition of A;
7710 There are two valid parametrisations:
7711 1) exactly one argument which is just the matrix A,
7712 2) exactly three arguments P, L, U which already
7713 realise the L-U-decomposition of A, that is,
7714 P * A = L * U, and P, L, and U satisfy the
7715 properties decribed in method 'jjLU_DECOMP';
7716 see there;
7717 If A is invertible, the list [1, A^(-1)] is returned,
7718 otherwise the list [0] is returned. Thus, the user may
7719 inspect the first entry of the returned list to see
7720 whether A is invertible. */
7721 matrix iMat; int invertible;
7722 const short t1[]={1,MATRIX_CMD};
7723 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7724 if (iiCheckTypes(v,t1))
7725 {
7726 matrix aMat = (matrix)v->Data();
7727 int rr = aMat->rows();
7728 int cc = aMat->cols();
7729 if (rr != cc)
7730 {
7731 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7732 return TRUE;
7733 }
7734 if (!idIsConstant((ideal)aMat))
7735 {
7736 WerrorS("matrix must be constant");
7737 return TRUE;
7738 }
7740 }
7741 else if (iiCheckTypes(v,t2))
7742 {
7743 matrix pMat = (matrix)v->Data();
7744 matrix lMat = (matrix)v->next->Data();
7745 matrix uMat = (matrix)v->next->next->Data();
7746 int rr = uMat->rows();
7747 int cc = uMat->cols();
7748 if (rr != cc)
7749 {
7750 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7751 rr, cc);
7752 return TRUE;
7753 }
7754 if (!idIsConstant((ideal)pMat)
7755 || (!idIsConstant((ideal)lMat))
7756 || (!idIsConstant((ideal)uMat))
7757 )
7758 {
7759 WerrorS("matricesx must be constant");
7760 return TRUE;
7761 }
7763 }
7764 else
7765 {
7766 Werror("expected either one or three matrices");
7767 return TRUE;
7768 }
7769
7770 /* build the return structure; a list with either one or two entries */
7772 if (invertible)
7773 {
7774 ll->Init(2);
7775 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7776 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7777 }
7778 else
7779 {
7780 ll->Init(1);
7781 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7782 }
7783
7784 res->data=(char*)ll;
7785 return FALSE;
7786}
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 7787 of file iparith.cc.

7788{
7789 /* for solving a linear equation system A * x = b, via the
7790 given LU-decomposition of the matrix A;
7791 There is one valid parametrisation:
7792 1) exactly four arguments P, L, U, b;
7793 P, L, and U realise the L-U-decomposition of A, that is,
7794 P * A = L * U, and P, L, and U satisfy the
7795 properties decribed in method 'jjLU_DECOMP';
7796 see there;
7797 b is the right-hand side vector of the equation system;
7798 The method will return a list of either 1 entry or three entries:
7799 1) [0] if there is no solution to the system;
7800 2) [1, x, H] if there is at least one solution;
7801 x is any solution of the given linear system,
7802 H is the matrix with column vectors spanning the homogeneous
7803 solution space.
7804 The method produces an error if matrix and vector sizes do not fit. */
7805 const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7806 if (!iiCheckTypes(v,t))
7807 {
7808 WerrorS("expected exactly three matrices and one vector as input");
7809 return TRUE;
7810 }
7811 matrix pMat = (matrix)v->Data();
7812 matrix lMat = (matrix)v->next->Data();
7813 matrix uMat = (matrix)v->next->next->Data();
7814 matrix bVec = (matrix)v->next->next->next->Data();
7816 if (pMat->rows() != pMat->cols())
7817 {
7818 Werror("first matrix (%d x %d) is not quadratic",
7819 pMat->rows(), pMat->cols());
7820 return TRUE;
7821 }
7822 if (lMat->rows() != lMat->cols())
7823 {
7824 Werror("second matrix (%d x %d) is not quadratic",
7825 lMat->rows(), lMat->cols());
7826 return TRUE;
7827 }
7828 if (lMat->rows() != uMat->rows())
7829 {
7830 Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7831 lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7832 return TRUE;
7833 }
7834 if (uMat->rows() != bVec->rows())
7835 {
7836 Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7837 uMat->rows(), uMat->cols(), bVec->rows());
7838 return TRUE;
7839 }
7840 if (!idIsConstant((ideal)pMat)
7841 ||(!idIsConstant((ideal)lMat))
7842 ||(!idIsConstant((ideal)uMat))
7843 )
7844 {
7845 WerrorS("matrices must be constant");
7846 return TRUE;
7847 }
7849
7850 /* build the return structure; a list with either one or three entries */
7852 if (solvable)
7853 {
7854 ll->Init(3);
7855 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7856 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7857 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7858 }
7859 else
7860 {
7861 ll->Init(1);
7862 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7863 }
7864
7865 res->data=(char*)ll;
7866 return FALSE;
7867}
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 8937 of file iparith.cc.

8938{
8939 assume( e->Typ()==INT_CMD );
8941 r->start =(int)(long)e->Data();
8942 return r;
8943}
VAR omBin sSubexpr_bin
Definition subexpr.cc:40

◆ jjMAP()

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

Definition at line 1651 of file iparith.cc.

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

◆ jjMATRIX_Id()

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

Definition at line 6919 of file iparith.cc.

6920{
6921 int mi=(int)(long)v->Data();
6922 int ni=(int)(long)w->Data();
6923 if ((mi<1)||(ni<1))
6924 {
6925 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6926 return TRUE;
6927 }
6928 matrix m=mpNew(mi,ni);
6930 int i=si_min(IDELEMS(I),mi*ni);
6931 //for(i=i-1;i>=0;i--)
6932 //{
6933 // m->m[i]=I->m[i];
6934 // I->m[i]=NULL;
6935 //}
6936 memcpy(m->m,I->m,i*sizeof(poly));
6937 memset(I->m,0,i*sizeof(poly));
6939 res->data = (char *)m;
6940 return FALSE;
6941}

◆ jjMATRIX_Ma()

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

Definition at line 6955 of file iparith.cc.

6956{
6957 int mi=(int)(long)v->Data();
6958 int ni=(int)(long)w->Data();
6959 if ((mi<1)||(ni<1))
6960 {
6961 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6962 return TRUE;
6963 }
6964 matrix m=mpNew(mi,ni);
6966 int r=si_min(MATROWS(I),mi);
6967 int c=si_min(MATCOLS(I),ni);
6968 int i,j;
6969 for(i=r;i>0;i--)
6970 {
6971 for(j=c;j>0;j--)
6972 {
6973 MATELEM(m,i,j)=MATELEM(I,i,j);
6974 MATELEM(I,i,j)=NULL;
6975 }
6976 }
6978 res->data = (char *)m;
6979 return FALSE;
6980}

◆ jjMATRIX_Mo()

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

Definition at line 6942 of file iparith.cc.

6943{
6944 int mi=(int)(long)v->Data();
6945 int ni=(int)(long)w->Data();
6946 if ((mi<0)||(ni<1))
6947 {
6948 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6949 return TRUE;
6950 }
6951 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6952 mi,ni,currRing);
6953 return FALSE;
6954}

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4683 of file iparith.cc.

4684{
4685 // clean out "_":
4687 // collect all info:
4688 omUpdateInfo();
4689 switch(((int)(long)v->Data()))
4690 {
4691 case 0:
4692 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4693 break;
4694 case 1:
4695 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4696 break;
4697 case 2:
4698 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4699 break;
4700 default:
4704 res->data = (char *)0;
4705 res->rtyp = NONE;
4706 }
4707 return FALSE;
4708}
omInfo_t om_Info
Definition omStats.c:16
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
#define NONE
Definition tok.h:223
#define omPrintStats(F)
Definition xalloc.h:231
#define omPrintInfo(F)
Definition xalloc.h:232
#define omPrintBinStats(F)
Definition xalloc.h:233
#define omUpdateInfo()
Definition xalloc.h:230

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6367 of file iparith.cc.

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

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4734 of file iparith.cc.

4735{
4736 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4737
4738 syStrategy tmp=syCopy((syStrategy)v->Data());
4739 tmp = syMinimize(tmp); // enrich itself!
4740
4741 res->data=(char *)tmp;
4742
4743 if (weights!=NULL)
4744 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4745
4746 return FALSE;
4747}
syStrategy syMinimize(syStrategy syzstr)
Definition syz1.cc:2393
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1885

◆ jjMINUS_B()

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

Definition at line 918 of file iparith.cc.

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

◆ jjMINUS_B_P()

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

Definition at line 908 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 893 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 941 of file iparith.cc.

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

◆ jjMINUS_I()

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

Definition at line 877 of file iparith.cc.

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

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

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

◆ jjMINUS_N()

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

Definition at line 898 of file iparith.cc.

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

◆ jjMINUS_SM()

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

Definition at line 964 of file iparith.cc.

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

◆ jjMINUS_V()

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

Definition at line 903 of file iparith.cc.

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

◆ jjMOD_BI()

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

Definition at line 2695 of file iparith.cc.

2696{
2697 number q=(number)v->Data();
2698 if (n_IsZero(q,coeffs_BIGINT))
2699 {
2701 return TRUE;
2702 }
2703 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2704 return FALSE;
2705}
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition coeffs.h:629

◆ jjMOD_N()

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

Definition at line 2706 of file iparith.cc.

2707{
2708 number q=(number)v->Data();
2709 if (nIsZero(q))
2710 {
2712 return TRUE;
2713 }
2714 res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2715 return FALSE;
2716}

◆ jjMOD_P()

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

Definition at line 2717 of file iparith.cc.

2718{
2719 poly q=(poly)v->Data();
2720 if (q==NULL)
2721 {
2723 return TRUE;
2724 }
2725 poly p=(poly)(u->Data());
2726 if (p==NULL)
2727 {
2728 res->data=NULL;
2729 return FALSE;
2730 }
2731 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2732 q /*(poly)(v->Data())*/ ,currRing));
2733 return FALSE;
2734}
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 2642 of file iparith.cc.

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

◆ jjMODULO3()

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

Definition at line 6981 of file iparith.cc.

6982{
6983 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6984 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6986 if (w_u!=NULL)
6987 {
6988 w_u=ivCopy(w_u);
6989 hom=isHomog;
6990 }
6991 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6992 if (w_v!=NULL)
6993 {
6994 w_v=ivCopy(w_v);
6995 hom=isHomog;
6996 }
6997 if ((w_u!=NULL) && (w_v==NULL))
6998 w_v=ivCopy(w_u);
6999 if ((w_v!=NULL) && (w_u==NULL))
7000 w_u=ivCopy(w_v);
7001 ideal u_id=(ideal)u->Data();
7002 ideal v_id=(ideal)v->Data();
7003 if (w_u!=NULL)
7004 {
7005 if ((*w_u).compare((w_v))!=0)
7006 {
7007 WarnS("incompatible weights");
7008 delete w_u; w_u=NULL;
7009 hom=testHomog;
7010 }
7011 else
7012 {
7013 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7014 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7015 {
7016 WarnS("wrong weights");
7017 delete w_u; w_u=NULL;
7018 hom=testHomog;
7019 }
7020 }
7021 }
7022 idhdl h=(idhdl)w->data;
7023 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
7024 if (w_u!=NULL)
7025 {
7026 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7027 }
7028 delete w_v;
7029 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7030 return FALSE;
7031}

◆ jjMODULO3S()

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

Definition at line 7032 of file iparith.cc.

7033{
7034 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
7035 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7037 if (w_u!=NULL)
7038 {
7039 w_u=ivCopy(w_u);
7040 hom=isHomog;
7041 }
7042 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
7043 if (w_v!=NULL)
7044 {
7045 w_v=ivCopy(w_v);
7046 hom=isHomog;
7047 }
7048 if ((w_u!=NULL) && (w_v==NULL))
7049 w_v=ivCopy(w_u);
7050 if ((w_v!=NULL) && (w_u==NULL))
7051 w_u=ivCopy(w_v);
7052 ideal u_id=(ideal)u->Data();
7053 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
7054 ideal v_id=(ideal)v->Data();
7055 if (w_u!=NULL)
7056 {
7057 if ((*w_u).compare((w_v))!=0)
7058 {
7059 WarnS("incompatible weights");
7060 delete w_u; w_u=NULL;
7061 hom=testHomog;
7062 }
7063 else
7064 {
7065 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7066 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7067 {
7068 WarnS("wrong weights");
7069 delete w_u; w_u=NULL;
7070 hom=testHomog;
7071 }
7072 }
7073 }
7074 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
7075 if (w_u!=NULL)
7076 {
7077 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7078 }
7079 delete w_v;
7080 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7081 return FALSE;
7082}

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 8269 of file iparith.cc.

8270{
8271 leftv v=u->next;
8272 leftv w=v->next;
8273 leftv u4=w->next;
8274 GbVariant alg;
8275 ideal u_id,v_id;
8276 // we have 4 arguments
8277 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8278 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8279 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8280 {
8281 u_id=(ideal)u->Data();
8282 v_id=(ideal)v->Data();
8283 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8284 }
8285 else
8286 {
8287 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8288 return TRUE;
8289 }
8290 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8292 if (w_u!=NULL)
8293 {
8294 w_u=ivCopy(w_u);
8295 hom=isHomog;
8296 }
8297 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8298 if (w_v!=NULL)
8299 {
8300 w_v=ivCopy(w_v);
8301 hom=isHomog;
8302 }
8303 if ((w_u!=NULL) && (w_v==NULL))
8304 w_v=ivCopy(w_u);
8305 if ((w_v!=NULL) && (w_u==NULL))
8306 w_u=ivCopy(w_v);
8307 if (w_u!=NULL)
8308 {
8309 if ((*w_u).compare((w_v))!=0)
8310 {
8311 WarnS("incompatible weights");
8312 delete w_u; w_u=NULL;
8313 hom=testHomog;
8314 }
8315 else
8316 {
8317 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8318 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8319 {
8320 WarnS("wrong weights");
8321 delete w_u; w_u=NULL;
8322 hom=testHomog;
8323 }
8324 }
8325 }
8326 idhdl h=(idhdl)w->data;
8327 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8328 if (w_u!=NULL)
8329 {
8330 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8331 }
8332 delete w_v;
8333 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8334 return FALSE;
8335}

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2736 of file iparith.cc.

2737{
2738 return jjMONITOR2(res,v,NULL);
2739}
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition iparith.cc:2740

◆ jjMONITOR2()

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

Definition at line 2740 of file iparith.cc.

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

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

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5719 of file iparith.cc.

5720{
5721 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5722 return FALSE;
5723}
poly mp_Trace(matrix a, const ring R)
Definition matpol.cc:268

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5724 of file iparith.cc.

5725{
5726 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5727 return FALSE;
5728}
matrix mp_Transp(matrix a, const ring R)
Definition matpol.cc:247

◆ jjMRES_MAP()

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

Definition at line 6563 of file iparith.cc.

6564{
6565 if ((ma->rtyp!=IDHDL)||(ma->e!=NULL))
6566 {
6567 WerrorS("3rd argument must have a name");
6568 return TRUE;
6569 }
6570 int maxl=(int)(long)v->Data();
6571 if (maxl<0)
6572 {
6573 WerrorS("length for res must not be negative");
6574 return TRUE;
6575 }
6576 syStrategy r;
6577 intvec *weights=NULL;
6578 int wmaxl=maxl;
6579 ideal u_id=(ideal)u->Data();
6580
6581 maxl--;
6582 if (/*(*/ maxl==-1 /*)*/)
6583 {
6584 maxl = currRing->N-1+2;
6585 if (currRing->qideal!=NULL)
6586 {
6587 Warn(
6588 "full resolution in a qring may be infinite, setting max length to %d",
6589 maxl+1);
6590 }
6591 }
6592 weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6593 if (weights!=NULL)
6594 {
6595 if (!idTestHomModule(u_id,currRing->qideal,weights))
6596 {
6597 WarnS("wrong weights given:");weights->show();PrintLn();
6598 weights=NULL;
6599 }
6600 }
6601 intvec *ww=NULL;
6602 int add_row_shift=0;
6603 if (weights!=NULL)
6604 {
6605 ww=ivCopy(weights);
6606 add_row_shift = ww->min_in();
6607 (*ww) -= add_row_shift;
6608 }
6609 unsigned save_opt=si_opt_1;
6611 u_id=(ideal)u->CopyD();
6612 ideal mat;
6614 idhdl h=(idhdl)ma->data;
6615 idDelete(&IDIDEAL(h));
6616 IDIDEAL(h)=mat;
6617 if (r->list_length>wmaxl)
6618 {
6619 for(int i=wmaxl-1;i>=r->list_length;i--)
6620 {
6621 if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
6622 if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
6623 }
6624 }
6625 r->list_length=wmaxl;
6626 res->data=(void *)r;
6627 if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
6628 if ((r->weights!=NULL) && (r->weights[0]!=NULL))
6629 {
6630 ww=ivCopy(r->weights[0]);
6631 if (weights!=NULL) (*ww) += add_row_shift;
6632 atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
6633 }
6634 else
6635 {
6636 if (weights!=NULL)
6637 {
6638 atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
6639 }
6640 }
6641 assume( (r->syRing != NULL) == (r->resPairs != NULL) );
6642 assume( (r->minres != NULL) || (r->fullres != NULL) );
6644 return FALSE;
6645}
void show(int mat=0, int spaces=0) const
Definition intvec.cc:149
#define IDIDEAL(a)
Definition ipid.h:133
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_REDTAIL_SYZ
Definition options.h:88
#define Sy_bit(x)
Definition options.h:31
syStrategy syMres_with_map(ideal arg, int maxlength, intvec *w, ideal &trans)
Definition syz.cc:1176
ring syRing
Definition syz.h:56
resolvente minres
Definition syz.h:58
short list_length
Definition syz.h:62
intvec ** weights
Definition syz.h:45
SRes resPairs
Definition syz.h:49

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4713 of file iparith.cc.

4714{
4715 int t=v->Typ();
4716 ideal r,m;
4717 r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4719 l->Init(2);
4720 l->m[0].rtyp=t;
4721 l->m[0].data=(char *)r;
4722 setFlag(&(l->m[0]),FLAG_STD);
4723 l->m[1].rtyp=t;
4724 l->m[1].data=(char *)m;
4725 res->data=(char *)l;
4726 return FALSE;
4727}
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
Definition kstd1.cc:3057

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4728 of file iparith.cc.

4729{
4731 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4732 return FALSE;
4733}
int scMultInt(ideal S, ideal Q)
Definition hdegree.cc:901

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4748 of file iparith.cc.

4749{
4750 number n,i; i=(number)v->Data();
4752 if (nMap!=NULL)
4754 else goto err;
4755 res->data=(void *)n;
4756 return FALSE;
4757err:
4758 WerrorS("cannot convert to bigint"); return TRUE;
4759}

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4760 of file iparith.cc.

4761{
4762 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4763 res->data=omStrDup(v->name);
4764 else if (v->name==NULL)
4765 res->data=omStrDup("");
4766 else
4767 {
4768 res->data = (char *)v->name;
4769 v->name=NULL;
4770 }
4771 return FALSE;
4772}

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4773 of file iparith.cc.

4774{
4775 res->data=ipNameList(((ring)v->Data())->idroot);
4776 return FALSE;
4777}
lists ipNameList(idhdl root)
Definition ipid.cc:627

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8336 of file iparith.cc.

8337{
8338 res->data=(void *)ipNameList(IDROOT);
8339 return FALSE;
8340}

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4778 of file iparith.cc.

4779{
4780 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4781 return FALSE;
4782}
lists ipNameListLev(idhdl root, int lev)
Definition ipid.cc:650

◆ jjNEWSTRUCT2()

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

Definition at line 2805 of file iparith.cc.

2806{
2807 // u: the name of the new type
2808 // v: the elements
2809 const char *s=(const char *)u->Data();
2811 if (strlen(s)>=2)
2812 {
2813 d=newstructFromString((const char *)v->Data());
2814 if (d!=NULL) newstruct_setup(s,d);
2815 }
2816 else WerrorS("name of newstruct must be longer than 1 character");
2817 return d==NULL;
2818}
void newstruct_setup(const char *n, newstruct_desc d)
Definition newstruct.cc:699
newstruct_desc newstructFromString(const char *s)
Definition newstruct.cc:803

◆ jjNEWSTRUCT3()

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

Definition at line 6646 of file iparith.cc.

6647{
6648 // u: the name of the new type
6649 // v: the parent type
6650 // w: the elements
6651 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6652 (const char *)w->Data());
6653 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6654 return (d==NULL);
6655}
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition newstruct.cc:810

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5759 of file iparith.cc.

5760{
5761 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5762 res->data=(char *)(long)iin_Int(n,currRing->cf);
5763 n_Delete(&n,currRing->cf);
5764 return FALSE;
5765}

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5766 of file iparith.cc.

5767{
5768 number n=(number)u->Data();
5769 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5770 return FALSE;
5771}

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4783 of file iparith.cc.

4784{
4785 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4786 return FALSE;
4787}

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3771 of file iparith.cc.

3772{
3773 return FALSE;
3774}

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 4075 of file iparith.cc.

4076{
4077 number n = reinterpret_cast<number>(v->CopyD());
4078 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
4079 n_Delete(&n,currRing->cf);
4080 return FALSE;
4081}
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition coeffs.h:609

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4788 of file iparith.cc.

4789{
4790 res->data = (char *)(long)(((ring)(v->Data()))->N);
4791 return FALSE;
4792}

◆ jjOP_BI_BIM()

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

Definition at line 275 of file iparith.cc.

276{
277 return jjOP_BIM_BI(res, v, u);
278}
static BOOLEAN jjOP_BIM_BI(leftv res, leftv u, leftv v)
Definition iparith.cc:262

◆ jjOP_BIM_BI()

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

Definition at line 262 of file iparith.cc.

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

◆ jjOP_BIM_I()

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

Definition at line 243 of file iparith.cc.

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

◆ jjOP_I_BIM()

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

Definition at line 258 of file iparith.cc.

259{
260 return jjOP_BIM_I(res, v, u);
261}
static BOOLEAN jjOP_BIM_I(leftv res, leftv u, leftv v)
Definition iparith.cc:243

◆ jjOP_I_IM()

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

Definition at line 315 of file iparith.cc.

316{
317 return jjOP_IM_I(res,v,u);
318}
static BOOLEAN jjOP_IM_I(leftv res, leftv u, leftv v)
Definition iparith.cc:300

◆ jjOP_I_IV()

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

Definition at line 296 of file iparith.cc.

297{
298 return jjOP_IV_I(res,v,u);
299}
static BOOLEAN jjOP_IV_I(leftv res, leftv u, leftv v)
Definition iparith.cc:279

◆ jjOP_IM_I()

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

Definition at line 300 of file iparith.cc.

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

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

◆ jjOP_REST()

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

Definition at line 505 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4793 of file iparith.cc.

4794{
4795 si_link l=(si_link)v->Data();
4796 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4797 else { slPrepClose(l); return slClose(l);}
4798}
@ OPEN_CMD
Definition tok.h:145

◆ jjOPPOSE()

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

Definition at line 2984 of file iparith.cc.

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

5294{
5295#ifdef HAVE_PLURAL
5296 ring r = (ring)a->Data();
5297 //if (rIsPluralRing(r))
5298 if (r->OrdSgn==1)
5299 {
5300 res->data = rOpposite(r);
5301 }
5302 else
5303 {
5304 WarnS("opposite only for global orderings");
5305 res->data = rCopy(r);
5306 }
5307 return FALSE;
5308#else
5309 return TRUE;
5310#endif
5311}
ring rOpposite(ring src)
Definition ring.cc:5417

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8341 of file iparith.cc.

8342{
8343 if(v==NULL)
8344 {
8345 res->data=(char *)showOption();
8346 return FALSE;
8347 }
8348 res->rtyp=NONE;
8349 return setOption(res,v);
8350}
BOOLEAN setOption(leftv res, leftv v)
Definition misc_ip.cc:570
char * showOption()
Definition misc_ip.cc:711

◆ jjOR_I()

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

Definition at line 1383 of file iparith.cc.

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

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4799 of file iparith.cc.

4800{
4801 poly p=(poly)v->Data();
4802 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4803 return FALSE;
4804}

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4845 of file iparith.cc.

4846{
4847 poly p=(poly)v->Data();
4848 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4849 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4850 {
4851 WerrorS("poly must be constant");
4852 return TRUE;
4853 }
4855 number n;
4857 if (nMap!=NULL)
4859 else goto err;
4860 res->data=(void *)n;
4861 return FALSE;
4862err:
4863 WerrorS("cannot convert to bigint"); return TRUE;
4864}

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4865 of file iparith.cc.

4866{
4867 poly p=(poly)v->Data();
4868 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4869 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4870 {
4871 WerrorS("poly must be constant");
4872 return TRUE;
4873 }
4874 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4875 return FALSE;
4876}

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4913 of file iparith.cc.

4914{
4915 number n;
4916 poly p;
4917 if (((p=(poly)v->Data())!=NULL)
4918 && (pIsConstant(p)))
4919 {
4920 n=nCopy(pGetCoeff(p));
4921 }
4922 else
4923 {
4924 n=nInit(0);
4925 }
4926 res->data = (char *)n;
4927 return FALSE;
4928}

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4805 of file iparith.cc.

4806{
4807 int i=(int)(long)v->Data();
4808 int p=0;
4809 p=rPar(currRing);
4810 if ((0<i) && (i<=p))
4811 {
4812 res->data=(char *)n_Param(i,currRing);
4813 }
4814 else
4815 {
4816 Werror("par number %d out of range 1..%d",i,p);
4817 return TRUE;
4818 }
4819 return FALSE;
4820}
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:776

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4821 of file iparith.cc.

4822{
4823 number nn=(number)v->Data();
4824 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4825 return FALSE;
4826}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition coeffs.h:763

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4827 of file iparith.cc.

4828{
4829 if (currRing==NULL)
4830 {
4831 WerrorS("no ring active (1)");
4832 return TRUE;
4833 }
4834 int i=(int)(long)v->Data();
4835 int p=0;
4836 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4837 res->data=omStrDup(rParameter(currRing)[i-1]);
4838 else
4839 {
4840 Werror("par number %d out of range 1..%d",i,p);
4841 return TRUE;
4842 }
4843 return FALSE;
4844}

◆ jjPARSTR2()

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

Definition at line 2819 of file iparith.cc.

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

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4635 of file iparith.cc.

4636{
4637 /* call method jjPFAC2 with second argument = 0 (meaning that no
4638 valid bound for the prime factors has been given) */
4639 sleftv tmp;
4640 tmp.Init();
4641 tmp.rtyp = INT_CMD;
4642 return jjPFAC2(res, v, &tmp);
4643}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition iparith.cc:3287

◆ jjPFAC2()

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

Definition at line 3287 of file iparith.cc.

3288{
3289 number n1; int i;
3290
3291 if ((u->Typ() == BIGINT_CMD) ||
3292 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3293 {
3294 n1 = (number)u->CopyD();
3295 }
3296 else if (u->Typ() == INT_CMD)
3297 {
3298 i = (int)(long)u->Data();
3300 }
3301 else
3302 {
3303 return TRUE;
3304 }
3305
3306 i = (int)(long)v->Data();
3307
3310 res->data = (char*)l;
3311 return FALSE;
3312}
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:358

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5691 of file iparith.cc.

5692{
5693 res->data = (char *)pHead((poly)v->Data());
5694 return FALSE;
5695}

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5666 of file iparith.cc.

5667{
5668 res->data = (char *)(long)pLength((poly)v->Data());
5669 return FALSE;
5670}

◆ jjPlural_mat_mat()

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

Definition at line 2896 of file iparith.cc.

2897{
2898 if( currRing->qideal != NULL )
2899 {
2900 WerrorS("basering must NOT be a qring!");
2901 return TRUE;
2902 }
2903
2904 if (iiOp==NCALGEBRA_CMD)
2905 {
2906 return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2907 }
2908 else
2909 {
2910 ring r=rCopy(currRing);
2911 BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2912 res->data=r;
2913 return result;
2914 }
2915}
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
@ NCALGEBRA_CMD
Definition tok.h:138

◆ jjPlural_mat_poly()

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

Definition at line 2876 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2856 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2836 of file iparith.cc.

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

◆ jjPLUS_B()

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

Definition at line 781 of file iparith.cc.

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

◆ jjPLUS_B_P()

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

Definition at line 794 of file iparith.cc.

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

◆ jjPLUS_BI()

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

Definition at line 766 of file iparith.cc.

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

◆ jjPLUS_BIM()

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

Definition at line 813 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 754 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 872 of file iparith.cc.

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

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

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

◆ jjPLUS_MA_P()

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

Definition at line 847 of file iparith.cc.

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

◆ jjPLUS_N()

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

Definition at line 771 of file iparith.cc.

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

859{
860 return jjPLUS_MA_P(res,v,u);
861}
static BOOLEAN jjPLUS_MA_P(leftv res, leftv u, leftv v)
Definition iparith.cc:847

◆ jjPLUS_S()

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

Definition at line 862 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 835 of file iparith.cc.

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

◆ jjPLUS_V()

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

Definition at line 776 of file iparith.cc.

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

◆ jjPLUSMINUS_Gen()

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

Definition at line 630 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3785 of file iparith.cc.

3786{
3787 if (IDTYP((idhdl)u->data)==INT_CMD)
3788 {
3789 int i=IDINT((idhdl)u->data);
3790 if (iiOp==PLUSPLUS) i++;
3791 else i--;
3792 IDDATA((idhdl)u->data)=(char *)(long)i;
3793 return FALSE;
3794 }
3795 return TRUE;
3796}
@ PLUSPLUS
Definition grammar.cc:274
#define IDINT(a)
Definition ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5714 of file iparith.cc.

5715{
5716 res->data = (char *)pMaxComp((poly)v->Data());
5717 return FALSE;
5718}

◆ jjPOWER_BI()

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

Definition at line 567 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 521 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 624 of file iparith.cc.

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

◆ jjPOWER_N()

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

Definition at line 583 of file iparith.cc.

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

◆ jjPOWER_P()

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

Definition at line 601 of file iparith.cc.

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

◆ jjPREIMAGE()

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

Definition at line 6656 of file iparith.cc.

6657{
6658 // handles preimage(r,phi,i) and kernel(r,phi)
6659 idhdl h;
6660 ring rr;
6661 map mapping;
6663
6664 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6665 {
6666 WerrorS("2nd/3rd arguments must have names");
6667 return TRUE;
6668 }
6669 rr=(ring)u->Data();
6670 const char *ring_name=u->Name();
6671 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6672 {
6673 if (h->typ==MAP_CMD)
6674 {
6675 mapping=IDMAP(h);
6676 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6677 if ((preim_ring==NULL)
6678 || (IDRING(preim_ring)!=currRing))
6679 {
6680 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6681 return TRUE;
6682 }
6683 }
6684 else if (h->typ==IDEAL_CMD)
6685 {
6686 mapping=IDMAP(h);
6687 }
6688 else
6689 {
6690 Werror("`%s` is no map nor ideal",IDID(h));
6691 return TRUE;
6692 }
6693 }
6694 else
6695 {
6696 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6697 return TRUE;
6698 }
6699 ideal image;
6700 if (kernel_cmd) image=idInit(1,1);
6701 else
6702 {
6703 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6704 {
6705 if (h->typ==IDEAL_CMD)
6706 {
6707 image=IDIDEAL(h);
6708 }
6709 else
6710 {
6711 Werror("`%s` is no ideal",IDID(h));
6712 return TRUE;
6713 }
6714 }
6715 else
6716 {
6717 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6718 return TRUE;
6719 }
6720 }
6721 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6722 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6723 {
6724 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6725 }
6726 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6727 if (kernel_cmd) idDelete(&image);
6728 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6729}
#define IDMAP(a)
Definition ipid.h:135
#define IDID(a)
Definition ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition preimage.cc:57
@ KERNEL_CMD
Definition tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4877 of file iparith.cc.

4878{
4879 map mapping=(map)v->Data();
4880 syMake(res,omStrDup(mapping->preimage));
4881 return FALSE;
4882}

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4883 of file iparith.cc.

4884{
4885 int i = IsPrime((int)(long)(v->Data()));
4886 res->data = (char *)(long)(i > 1 ? i : 2);
4887 return FALSE;
4888}
int IsPrime(int p)
Definition prime.cc:61

◆ jjPROC()

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

Definition at line 1615 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3862 of file iparith.cc.

3863{
3864 return jjPROC(res,u,NULL);
3865}
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition iparith.cc:1615

◆ jjPROC3()

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

Definition at line 6054 of file iparith.cc.

6055{
6057 memcpy(v->next,w,sizeof(sleftv));
6058 w->Init();
6059 return jjPROC(res,u,v);
6060}

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4889 of file iparith.cc.

4890{
4891 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4892 ideal v_id=(ideal)v->Data();
4893 if (w!=NULL)
4894 {
4895 if (!idTestHomModule(v_id,currRing->qideal,w))
4896 {
4897 WarnS("wrong weights");
4898 w=NULL;
4899 // and continue at the non-homog case below
4900 }
4901 else
4902 {
4903 w=ivCopy(w);
4904 intvec **ww=&w;
4905 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4906 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4907 return FALSE;
4908 }
4909 }
4910 res->data = (char *)idMinEmbedding(v_id);
4911 return FALSE;
4912}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition ideals.cc:2816

◆ jjPRUNE_MAP()

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

Definition at line 3057 of file iparith.cc.

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

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8815 of file iparith.cc.

8816{
8817 if ((INPUT->Typ() != MATRIX_CMD) ||
8818 (INPUT->next->Typ() != NUMBER_CMD) ||
8819 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8820 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8821 {
8822 WerrorS("expected (matrix, number, number, number) as arguments");
8823 return TRUE;
8824 }
8825 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8826 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8827 (number)(v->Data()),
8828 (number)(w->Data()),
8829 (number)(x->Data()));
8830 return FALSE;
8831}
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 3101 of file iparith.cc.

3102{
3103 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3104 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3105 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
3106 return FALSE;
3107}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition ideals.cc:1512

◆ jjRANDOM()

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

Definition at line 3108 of file iparith.cc.

3109{
3110 int i=(int)(long)u->Data();
3111 int j=(int)(long)v->Data();
3112 if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3113 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3114 return FALSE;
3115}
int siRand()
Definition sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6730 of file iparith.cc.

6731{
6732 int di, k;
6733 int i=(int)(long)u->Data();
6734 int r=(int)(long)v->Data();
6735 int c=(int)(long)w->Data();
6736 if ((r<=0) || (c<=0)) return TRUE;
6737 intvec *iv = new intvec(r, c, 0);
6738 if (iv->rows()==0)
6739 {
6740 delete iv;
6741 return TRUE;
6742 }
6743 if (i!=0)
6744 {
6745 if (i<0) i = -i;
6746 di = 2 * i + 1;
6747 for (k=0; k<iv->length(); k++)
6748 {
6749 (*iv)[k] = ((siRand() % di) - i);
6750 }
6751 }
6752 res->data = (char *)iv;
6753 return FALSE;
6754}

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4951 of file iparith.cc.

4952{
4953 matrix m =(matrix)v->Data();
4954 int rank = luRank(m, 0);
4955 res->data =(char *)(long)rank;
4956 return FALSE;
4957}
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 3116 of file iparith.cc.

3117{
3118 matrix m =(matrix)u->Data();
3119 int isRowEchelon = (int)(long)v->Data();
3120 if (isRowEchelon != 1) isRowEchelon = 0;
3121 int rank = luRank(m, isRowEchelon);
3122 res->data =(char *)(long)rank;
3123 return FALSE;
3124}

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5686 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4958 of file iparith.cc.

4959{
4960 return jjREAD2(res,v,NULL);
4961}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition iparith.cc:3125

◆ jjREAD2()

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

Definition at line 3125 of file iparith.cc.

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

◆ jjREDUCE3_CID()

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

Definition at line 7175 of file iparith.cc.

7176{
7178 if (!idIsZeroDim((ideal)v->Data()))
7179 {
7180 Werror("`%s` must be 0-dimensional",v->Name());
7181 return TRUE;
7182 }
7183 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7184 (matrix)w->CopyD());
7185 return FALSE;
7186}
static BOOLEAN idIsZeroDim(ideal i)
Definition ideals.h:179
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2315

◆ jjREDUCE3_CP()

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

Definition at line 7163 of file iparith.cc.

7164{
7166 if (!idIsZeroDim((ideal)v->Data()))
7167 {
7168 Werror("`%s` must be 0-dimensional",v->Name());
7169 return TRUE;
7170 }
7171 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
7172 (poly)w->CopyD());
7173 return FALSE;
7174}

◆ jjREDUCE3_ID()

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

Definition at line 7194 of file iparith.cc.

7195{
7197 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
7198 0,(int)(long)w->Data());
7199 return FALSE;
7200}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3209

◆ jjREDUCE3_P()

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

Definition at line 7187 of file iparith.cc.

7188{
7190 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
7191 0,(int)(long)w->Data());
7192 return FALSE;
7193}

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8351 of file iparith.cc.

8352{
8353 leftv u1=u;
8354 leftv u2=u1->next;
8355 leftv u3=u2->next;
8356 leftv u4=u3->next;
8357 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8358 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8359 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8360 {
8361 int save_d=Kstd1_deg;
8362 Kstd1_deg=(int)(long)u3->Data();
8363 kModW=(intvec *)u4->Data();
8364 BITSET save2;
8367 u2->next=NULL;
8368 BOOLEAN r=jjCALL2ARG(res,u);
8369 kModW=NULL;
8372 u->next->next=u3;
8373 return r;
8374 }
8375 else
8376 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8377 (u4->Typ()==INT_CMD))
8378 {
8380 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8381 {
8382 WerrorS("2nd argument must be a diagonal matrix of units");
8383 return TRUE;
8384 }
8385 res->data=(char*)redNF(
8386 idCopy((ideal)u3->Data()),
8387 idCopy((ideal)u1->Data()),
8388 mp_Copy((matrix)u2->Data(), currRing),
8389 (int)(long)u4->Data()
8390 );
8391 return FALSE;
8392 }
8393 else
8394 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8395 (u4->Typ()==INT_CMD))
8396 {
8397 poly u1p;
8398 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8399 else u1p=(poly)u1->Data();
8400 poly u2p;
8401 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8402 else u2p=(poly)u2->Data();
8404 if(!pIsUnit(u2p))
8405 {
8406 WerrorS("2nd argument must be a unit");
8407 return TRUE;
8408 }
8409 res->rtyp=POLY_CMD;
8410 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8411 pCopy(u2p),(int)(long)u4->Data());
8412 return FALSE;
8413 }
8414 else
8415 {
8416 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8417 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8418 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8419 return TRUE;
8420 }
8421}
#define BITSET
Definition auxiliary.h:85
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition iparith.cc:7328
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:63
VAR unsigned si_opt_2
Definition options.c:6
#define SI_SAVE_OPT2(A)
Definition options.h:22
#define SI_RESTORE_OPT2(A)
Definition options.h:25
#define V_DEG_STOP
Definition options.h:73
poly sBucketPeek(sBucket_pt b)
Definition sbuckets.cc:455

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 8422 of file iparith.cc.

8423{
8424 leftv u1=u;
8425 leftv u2=u1->next;
8426 leftv u3=u2->next;
8427 leftv u4=u3->next;
8428 leftv u5=u4->next;
8429 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8430 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8431 {
8433 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8434 {
8435 WerrorS("2nd argument must be a diagonal matrix of units");
8436 return TRUE;
8437 }
8438 res->data=(char*)redNF(
8439 idCopy((ideal)u3->Data()),
8440 idCopy((ideal)u1->Data()),
8441 mp_Copy((matrix)u2->Data(),currRing),
8442 (int)(long)u4->Data(),
8443 (intvec*)u5->Data()
8444 );
8445 return FALSE;
8446 }
8447 else
8448 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8449 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8450 {
8452 if(!pIsUnit((poly)u2->Data()))
8453 {
8454 WerrorS("2nd argument must be a unit");
8455 return TRUE;
8456 }
8457 res->rtyp=POLY_CMD;
8458 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8459 pCopy((poly)u2->Data()),
8460 (int)(long)u4->Data(),(intvec*)u5->Data());
8461 return FALSE;
8462 }
8463 else
8464 {
8465 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8466 Tok2Cmdname(iiOp));
8467 return TRUE;
8468 }
8469}

◆ jjREDUCE_ID()

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

Definition at line 3149 of file iparith.cc.

3150{
3151 ideal ui=(ideal)u->Data();
3152 ideal vi=(ideal)v->Data();
3153 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3155 res->data = (char *)kNF(vi,currRing->qideal,ui);
3156 return FALSE;
3157}

◆ jjREDUCE_P()

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

Definition at line 3141 of file iparith.cc.

3142{
3143 ideal vi=(ideal)v->Data();
3144 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3146 res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
3147 return FALSE;
3148}

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4962 of file iparith.cc.

4963{
4964 res->data = (char *)(long)iiRegularity((lists)v->Data());
4965 return FALSE;
4966}
int iiRegularity(lists L)
Definition ipshell.cc:1037

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4967 of file iparith.cc.

4968{
4969 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4970 return FALSE;
4971}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition coeffs.h:783

◆ jjRES()

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

Definition at line 3158 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 7202 of file iparith.cc.

7203{
7204 int maxl=(int)v->Data();
7205 ideal u_id=(ideal)u->Data();
7206 int l=0;
7207 resolvente r;
7208 intvec **weights=NULL;
7209 int wmaxl=maxl;
7210 maxl--;
7211 unsigned save_opt=si_opt_1;
7213 if ((maxl==-1) && (iiOp!=MRES_CMD))
7214 maxl = currRing->N-1;
7215 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7216 {
7217 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7218 if (iv!=NULL)
7219 {
7220 l=1;
7221 if (!idTestHomModule(u_id,currRing->qideal,iv))
7222 {
7223 WarnS("wrong weights");
7224 iv=NULL;
7225 }
7226 else
7227 {
7228 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7229 weights[0] = ivCopy(iv);
7230 }
7231 }
7232 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7233 }
7234 else
7235 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7236 if (r==NULL) return TRUE;
7237 int t3=u->Typ();
7238 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7240 return FALSE;
7241}
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition ipshell.cc:846
EXTERN_VAR omBin char_ptr_bin
Definition structs.h:73
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition syz.cc:401
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition syz0.cc:855

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 8470 of file iparith.cc.

8471{
8472 unsigned i=1;
8473 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8474 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8475 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8476 // sArithBase.nCmdAllocated);
8477 for(i=0; i<nCount; i++)
8478 {
8479 Print("%-20s",sArithBase.sCmds[i+1].name);
8481 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8482 if(i+1+2*nCount<sArithBase.nCmdUsed)
8483 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8484 //if ((i%3)==1) PrintLn();
8485 PrintLn();
8486 }
8487 PrintLn();
8489 return FALSE;
8490}
void printBlackboxTypes()
list all defined type (for debugging)
Definition blackbox.cc:236

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8492 of file iparith.cc.

8493{
8494 int l = 0;
8495 int k = 0;
8497 struct blackbox_list *bb_list = NULL;
8498 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8499
8500 if ((3*nCount) < sArithBase.nCmdUsed)
8501 {
8502 nCount++;
8503 }
8505 // count the number of entries;
8506 for (unsigned i=0; i<nCount; i++)
8507 {
8508 l++;
8509 if (i + 1 + nCount < sArithBase.nCmdUsed)
8510 {
8511 l++;
8512 }
8513 if(i+1+2*nCount<sArithBase.nCmdUsed)
8514 {
8515 l++;
8516 }
8517 }
8518 for (int i = 0; i < bb_list->count; i++)
8519 {
8520 if (bb_list->list[i] != NULL)
8521 {
8522 l++;
8523 }
8524 }
8525 // initiate list
8526 L->Init(l);
8527 k = 0;
8528 for (unsigned i=0; i<nCount; i++)
8529 {
8530 L->m[k].rtyp = STRING_CMD;
8531 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8532 k++;
8533 // Print("%-20s", sArithBase.sCmds[i+1].name);
8534 if (i + 1 + nCount < sArithBase.nCmdUsed)
8535 {
8536 L->m[k].rtyp = STRING_CMD;
8537 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8538 k++;
8539 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8540 }
8541 if(i+1+2*nCount<sArithBase.nCmdUsed)
8542 {
8543 L->m[k].rtyp = STRING_CMD;
8544 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8545 k++;
8546 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8547 }
8548 // PrintLn();
8549 }
8550
8551 // assign blackbox types
8552 for (int i = 0; i < bb_list->count; i++)
8553 {
8554 if (bb_list->list[i] != NULL)
8555 {
8556 L->m[k].rtyp = STRING_CMD;
8557 // already used strdup in getBlackBoxTypes
8558 L->m[k].data = bb_list->list[i];
8559 k++;
8560 }
8561 }
8562 // free the struct (not the list entries itself, which were allocated
8563 // by strdup)
8564 omfree(bb_list->list);
8565 omfree(bb_list);
8566
8567 // pass the resultant list to the res datastructure
8568 res->data=(void *)L;
8569
8570 return FALSE;
8571}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition blackbox.cc:245
struct for containing list of blackbox names and the number of them.
Definition blackbox.h:84
#define omfree(addr)

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4929 of file iparith.cc.

4930{
4931 char *s= (char *)v->Data();
4932 // try system keywords
4933 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4934 {
4935 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4936 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4937 {
4938 res->data = (char *)1;
4939 return FALSE;
4940 }
4941 }
4942 // try blackbox names
4943 int id;
4944 blackboxIsCmd(s,id);
4945 if (id>0)
4946 {
4947 res->data = (char *)1;
4948 }
4949 return FALSE;
4950}

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8944 of file iparith.cc.

8945{
8946 int c=(int)(long)u->Data();
8947 switch(c)
8948 {
8949 case 0:{
8950 PrintS("delete all variables\n");
8951 killlocals(0);
8952 WerrorS("restarting...");
8953 break;
8954 };
8955 default: WerrorS("not implemented");
8956 }
8957 return FALSE;
8958}
void killlocals(int v)
Definition ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5346 of file iparith.cc.

5347{
5348#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5349 if (rIsLPRing(currRing))
5350 {
5352 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5353 ideal result;
5354 ideal v_id=(ideal)v->Data();
5355 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5356 /* tHomog hom=testHomog; */
5357 /* if (w!=NULL) */
5358 /* { */
5359 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5360 /* { */
5361 /* WarnS("wrong weights"); */
5362 /* w=NULL; */
5363 /* } */
5364 /* else */
5365 /* { */
5366 /* hom=isHomog; */
5367 /* w=ivCopy(w); */
5368 /* } */
5369 /* } */
5370 /* result=kStd(v_id,currRing->qideal,hom,&w); */
5371 result = rightgb(v_id, currRing->qideal);
5373 res->data = (char *)result;
5375 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5376 return FALSE;
5377 }
5378 else if (rIsPluralRing(currRing))
5379 {
5380 ideal I=(ideal)v->Data();
5381
5382 ring A = currRing;
5383 ring Aopp = rOpposite(A);
5384 currRing = Aopp;
5385 ideal Iopp = idOppose(A, I, Aopp);
5387 currRing = A;
5388 ideal J = idOppose(Aopp, Jopp, A);
5389
5390 id_Delete(&Iopp, Aopp);
5391 id_Delete(&Jopp, Aopp);
5392 rDelete(Aopp);
5393
5394 idSkipZeroes(J);
5395 res->data = (char *)J;
5397 return FALSE;
5398 }
5399 else
5400 {
5401 return jjSTD(res, v);
5402 }
5403#else
5404 return TRUE;
5405#endif
5406}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition iparith.cc:5147
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2603
ideal rightgb(ideal F, const ideal Q)
Definition kstd2.cc:4958
#define TEST_OPT_DEGBOUND
Definition options.h:115
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:521

◆ jjRING3()

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

Definition at line 7243 of file iparith.cc.

7244{
7245 res->data=(void *)rInit(u,v,w);
7246 return (res->data==NULL);
7247}
ring rInit(leftv pn, leftv rv, leftv ord)
Definition ipshell.cc:5617

◆ jjRING_1()

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

Definition at line 1671 of file iparith.cc.

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

◆ jjRING_2()

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

Definition at line 6061 of file iparith.cc.

6062{
6063 u->next=(leftv)omAlloc(sizeof(sleftv));
6064 memcpy(u->next,v,sizeof(sleftv));
6065 v->Init();
6066 u->next->next=(leftv)omAlloc(sizeof(sleftv));
6067 memcpy(u->next->next,w,sizeof(sleftv));
6068 w->Init();
6069 BOOLEAN bo=iiExprArithM(res,u,'[');
6070 u->next=NULL;
6071 return bo;
6072}

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4994 of file iparith.cc.

4995{
4996 ring r=(ring)v->Data();
4997 if (r!=NULL)
4998 res->data = (char *)rDecompose_list_cf((ring)v->Data());
4999 return (r==NULL)||(res->data==NULL);
5000}
lists rDecompose_list_cf(const ring r)
Definition ipshell.cc:2104

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8915 of file iparith.cc.

8916{
8917 //Print("construct ring\n");
8918 if (a->Typ()!=CRING_CMD)
8919 {
8920 WerrorS("expected `cring` [ `id` ... ]");
8921 return TRUE;
8922 }
8923 assume(a->next!=NULL);
8924 leftv names=a->next;
8925 int N=names->listLength();
8926 char **n=(char**)omAlloc0(N*sizeof(char*));
8927 for(int i=0; i<N;i++,names=names->next)
8928 {
8929 n[i]=(char *)names->Name();
8930 }
8931 coeffs cf=(coeffs)a->CopyD();
8932 res->data=rDefault(cf,N,n, ringorder_dp);
8933 omFreeSize(n,N*sizeof(char*));
8934 return FALSE;
8935}
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition ring.cc:103
@ ringorder_dp
Definition ring.h:79
@ CRING_CMD
Definition tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4972 of file iparith.cc.

4973{
4974 ring r=(ring)v->Data();
4975 if (r!=NULL)
4976 {
4977 res->data = (char *)rDecompose((ring)v->Data());
4978 if (res->data!=NULL)
4979 {
4980 long mm=r->wanted_maxExp;
4981 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4982 return FALSE;
4983 }
4984 }
4985 return TRUE;
4986}
lists rDecompose(const ring r)
Definition ipshell.cc:2143

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4987 of file iparith.cc.

4988{
4989 coeffs r=(coeffs)v->Data();
4990 if (r!=NULL)
4991 return rDecompose_CF(res,r);
4992 return TRUE;
4993}
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition ipshell.cc:1933

◆ jjRMINUS()

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

Definition at line 3313 of file iparith.cc.

3314{
3315 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3316 res->data = (char *)r;
3317 return r==NULL;
3318}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition ring.cc:6016

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5729 of file iparith.cc.

5730{
5731 res->data = rOrdStr((ring)v->Data());
5732 return FALSE;
5733}
char * rOrdStr(ring r)
Definition ring.cc:524

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 5001 of file iparith.cc.

5002{
5003 ideal i = (ideal)v->Data();
5004 res->data = (char *)i->rank;
5005 return FALSE;
5006}

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5007 of file iparith.cc.

5008{
5009 res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
5010 return FALSE;
5011}

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5012 of file iparith.cc.

5013{
5014 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
5015 return FALSE;
5016}

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 5017 of file iparith.cc.

5018{
5019 res->data = (char *)(long)rPar(((ring)v->Data()));
5020 return FALSE;
5021}

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5739 of file iparith.cc.

5740{
5741 res->data = rParStr((ring)v->Data());
5742 return FALSE;
5743}
char * rParStr(ring r)
Definition ring.cc:652

◆ jjRPLUS()

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

Definition at line 3319 of file iparith.cc.

3320{
3321 int left;
3322 if (u->Typ()==RING_CMD) left=0;
3323 else
3324 {
3325 leftv h=u;u=v;v=h;
3326 left=1;
3327 }
3328 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3329 res->data = (char *)r;
3330 return r==NULL;
3331}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition ring.cc:5934

◆ jjRSUM()

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

Definition at line 3332 of file iparith.cc.

3333{
3334 ring r;
3335 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3336 res->data = (char *)r;
3337 return (i==-1);
3338}
int rSum(ring r1, ring r2, ring &sum)
Definition ring.cc:1405

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5734 of file iparith.cc.

5735{
5736 res->data = rVarStr((ring)v->Data());
5737 return FALSE;
5738}
char * rVarStr(ring r)
Definition ring.cc:626

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 5022 of file iparith.cc.

5023{
5024 res->data = (char *)(long)atoi((char*)v->Data());
5025 return FALSE;
5026}

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
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);
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,1,0);
5090 res->data = (char *)result;
5092 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5093 return FALSE;
5094}
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw)
Definition kstd1.cc:2656

◆ jjSBA_1()

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

Definition at line 5095 of file iparith.cc.

5096{
5097 ideal result;
5098 ideal v_id=(ideal)v->Data();
5099 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5101 if (w!=NULL)
5102 {
5103 if (!idTestHomModule(v_id,currRing->qideal,w))
5104 {
5105 WarnS("wrong weights");
5106 w=NULL;
5107 }
5108 else
5109 {
5110 hom=isHomog;
5111 w=ivCopy(w);
5112 }
5113 }
5114 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0);
5116 res->data = (char *)result;
5118 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5119 return FALSE;
5120}

◆ jjSBA_2()

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

Definition at line 5121 of file iparith.cc.

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

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3842 of file iparith.cc.

3843{
3844 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3845 else
3846 {
3847 ring r=(ring)u->Data();
3848 idhdl h=rFindHdl(r,NULL);
3849 if (h==NULL)
3850 {
3851 char name_buffer[100];
3852 STATIC_VAR int ending=1000000;
3853 ending++;
3854 snprintf(name_buffer,100, "PYTHON_RING_VAR%d",ending);
3856 IDRING(h)=rIncRefCnt(r);
3857 }
3858 rSetHdl(h);
3859 }
3860 return FALSE;
3861}
#define STATIC_VAR
Definition globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition ipshell.cc:1691
void rSetHdl(idhdl h)
Definition ipshell.cc:5118

◆ jjSIMPL_ID()

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

Definition at line 3346 of file iparith.cc.

3347{
3348 int sw = (int)(long)v->Data();
3349 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3350 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3351 if (sw & SIMPL_LMDIV)
3352 {
3353 id_DelDiv(id,currRing);
3354 }
3355 if (sw & SIMPL_LMEQ)
3356 {
3358 }
3359 if (sw & SIMPL_MULT)
3360 {
3362 }
3363 else if(sw & SIMPL_EQU)
3364 {
3366 }
3367 if (sw & SIMPL_NULL)
3368 {
3369 idSkipZeroes(id);
3370 }
3371 if (sw & SIMPL_NORM)
3372 {
3373 id_Norm(id,currRing);
3374 }
3375 if (sw & SIMPL_NORMALIZE)
3376 {
3378 }
3379 res->data = (char * )id;
3380 return FALSE;
3381}
#define SIMPL_EQU
Definition iparith.cc:3343
#define SIMPL_NORM
Definition iparith.cc:3345
#define SIMPL_LMEQ
Definition iparith.cc:3341
#define SIMPL_NULL
Definition iparith.cc:3344
#define SIMPL_MULT
Definition iparith.cc:3342
#define SIMPL_NORMALIZE
Definition iparith.cc:3339
#define SIMPL_LMDIV
Definition iparith.cc:3340
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 3441 of file iparith.cc.

3442{
3443 int sw = (int)(long)v->Data();
3444 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3445 poly p = (poly)u->CopyD(POLY_CMD);
3446 if (sw & SIMPL_NORM)
3447 {
3448 pNorm(p);
3449 }
3450 if (sw & SIMPL_NORMALIZE)
3451 {
3453 }
3454 res->data = (char * )p;
3455 return FALSE;
3456}
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3894
void pNorm(poly p)
Definition polys.h:363

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 5027 of file iparith.cc.

5028{
5029 const bool bIsSCA = rIsSCA(currRing);
5030
5031 if ((currRing->qideal!=NULL) && !bIsSCA)
5032 {
5033 WerrorS("qring not supported by slimgb at the moment");
5034 return TRUE;
5035 }
5037 {
5038 WerrorS("ordering must be global for slimgb");
5039 return TRUE;
5040 }
5042 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5043 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
5044 // tHomog hom=testHomog;
5045 ideal u_id=(ideal)u->Data();
5046 if (w!=NULL)
5047 {
5048 if (!idTestHomModule(u_id,currRing->qideal,w))
5049 {
5050 WarnS("wrong weights");
5051 w=NULL;
5052 }
5053 else
5054 {
5055 w=ivCopy(w);
5056 // hom=isHomog;
5057 }
5058 }
5059
5061 res->data=(char *)t_rep_gb(currRing,
5062 u_id,u_id->rank);
5063 //res->data=(char *)t_rep_gb(currRing, u_id);
5064
5066 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5067 return FALSE;
5068}
static bool rIsSCA(const ring r)
Definition nc.h:190
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition tgb.cc:3581

◆ jjSMATRIX_Mo()

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

Definition at line 7083 of file iparith.cc.

7084{
7085 int mi=(int)(long)v->Data();
7086 int ni=(int)(long)w->Data();
7087 if ((mi<0)||(ni<1))
7088 {
7089 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
7090 return TRUE;
7091 }
7092 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
7093 mi,ni,currRing);
7094 return FALSE;
7095}
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 5175 of file iparith.cc.

5176{
5177 res->data = (char *)idSort((ideal)v->Data());
5178 return FALSE;
5179}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:187

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10455 of file iparith.cc.

10456{
10457 lists l=(lists)arg->Data();
10458 if (l->nr>0)
10459 {
10460 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10461 }
10462 return FALSE;
10463}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition iparith.cc:10414

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5180 of file iparith.cc.

5181{
5183 intvec *v=NULL;
5184 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5185 if (f==NULL) return TRUE;
5186 ivTest(v);
5188 l->Init(2);
5189 l->m[0].rtyp=IDEAL_CMD;
5190 l->m[0].data=(void *)f;
5191 l->m[1].rtyp=INTVEC_CMD;
5192 l->m[1].data=(void *)v;
5193 res->data=(void *)l;
5194 return FALSE;
5195}
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 3383 of file iparith.cc.

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

◆ jjSTATUS2()

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

Definition at line 3430 of file iparith.cc.

3431{
3432 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3433 return FALSE;
3434}

◆ jjSTATUS2L()

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

Definition at line 3435 of file iparith.cc.

3436{
3437 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3438 //return (res->data== (void*)(long)-2);
3439 return FALSE;
3440}

◆ jjSTATUS3()

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

Definition at line 7248 of file iparith.cc.

7249{
7250 int yes;
7251 jjSTATUS2(res, u, v);
7252 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7253 omFreeBinAddr((ADDRESS) res->data);
7254 res->data = (void *)(long)yes;
7255 return FALSE;
7256}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition iparith.cc:3430

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8757 of file iparith.cc.

8758{
8759 if ((v->Typ() != LINK_CMD) ||
8760 (v->next->Typ() != STRING_CMD) ||
8761 (v->next->next->Typ() != STRING_CMD) ||
8762 (v->next->next->next->Typ() != INT_CMD))
8763 return TRUE;
8764 jjSTATUS3(res, v, v->next, v->next->next);
8765#if defined(HAVE_USLEEP)
8766 if (((long) res->data) == 0L)
8767 {
8768 int i_s = (int)(long) v->next->next->next->Data();
8769 if (i_s > 0)
8770 {
8771 usleep((int)(long) v->next->next->next->Data());
8772 jjSTATUS3(res, v, v->next, v->next->next);
8773 }
8774 }
8775#elif defined(HAVE_SLEEP)
8776 if (((int) res->data) == 0)
8777 {
8778 int i_s = (int) v->next->next->next->Data();
8779 if (i_s > 0)
8780 {
8781 si_sleep((is - 1)/1000000 + 1);
8782 jjSTATUS3(res, v, v->next, v->next->next);
8783 }
8784 }
8785#endif
8786 return FALSE;
8787}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:7248
@ LINK_CMD
Definition tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5147 of file iparith.cc.

5148{
5150 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5151 ideal result;
5152 ideal v_id=(ideal)v->Data();
5153 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5155 if (w!=NULL)
5156 {
5157 if (!idTestHomModule(v_id,currRing->qideal,w))
5158 {
5159 WarnS("wrong weights");
5160 w=NULL;
5161 }
5162 else
5163 {
5164 hom=isHomog;
5165 w=ivCopy(w);
5166 }
5167 }
5168 result=kStd(v_id,currRing->qideal,hom,&w);
5170 res->data = (char *)result;
5172 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5173 return FALSE;
5174}

◆ jjSTD_1()

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

Definition at line 3484 of file iparith.cc.

3485{
3486 ideal result;
3487 assumeStdFlag(u);
3488 ideal i1=(ideal)(u->Data());
3489 int ii1=idElem(i1); /* size of i1 */
3490 ideal i0;
3491 int r=v->Typ();
3492 if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3493 {
3494 poly p=(poly)v->Data();
3495 i0=idInit(1,i1->rank);
3496 i0->m[0]=p;
3497 i1=idSimpleAdd(i1,i0); //
3498 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3499 idDelete(&i0);
3500 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3502
3503 if (w!=NULL)
3504 {
3505 if (!idTestHomModule(i1,currRing->qideal,w))
3506 {
3507 // no warnung: this is legal, if i in std(i,p)
3508 // is homogeneous, but p not
3509 w=NULL;
3510 }
3511 else
3512 {
3513 w=ivCopy(w);
3514 hom=isHomog;
3515 }
3516 }
3517 BITSET save1;
3520 /* ii1 appears to be the position of the first element of il that
3521 does not belong to the old SB ideal */
3522 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3524 idDelete(&i1);
3526 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3527 res->data = (char *)result;
3528 }
3529 else /*IDEAL/MODULE*/
3530 {
3531 i0=(ideal)v->CopyD();
3532 i1=idSimpleAdd(i1,i0); //
3533 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3534 idDelete(&i0);
3535 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3537
3538 if (w!=NULL)
3539 {
3540 if (!idTestHomModule(i1,currRing->qideal,w))
3541 {
3542 // no warnung: this is legal, if i in std(i,p)
3543 // is homogeneous, but p not
3544 w=NULL;
3546 }
3547 else
3548 {
3549 w=ivCopy(w);
3550 hom=isHomog;
3551 }
3552 }
3553 BITSET save1;
3556 /* ii1 appears to be the position of the first element of i1 that
3557 does not belong to the old SB ideal */
3558 result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii1);
3560 idDelete(&i1);
3562 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3563 res->data = (char *)result;
3564 }
3566 return FALSE;
3567}
#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:32

◆ jjSTD_HILB()

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

Definition at line 3457 of file iparith.cc.

3458{
3459 ideal result;
3460 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3462 ideal u_id=(ideal)(u->Data());
3463 if (w!=NULL)
3464 {
3465 if (!idTestHomModule(u_id,currRing->qideal,w))
3466 {
3467 WarnS("wrong weights:");w->show();PrintLn();
3468 w=NULL;
3469 }
3470 else
3471 {
3472 w=ivCopy(w);
3473 hom=isHomog;
3474 }
3475 }
3476 bigintmat *vv=(bigintmat*)v->Data();
3477 result=kStd(u_id,currRing->qideal,hom,&w,vv);
3479 res->data = (char *)result;
3481 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3482 return FALSE;
3483}

◆ jjSTD_HILB_W()

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

Definition at line 7257 of file iparith.cc.

7258{
7259 intvec *vw=(intvec *)w->Data(); // weights of vars
7260 if (vw->length()!=currRing->N)
7261 {
7262 Werror("%d weights for %d variables",vw->length(),currRing->N);
7263 return TRUE;
7264 }
7265 ideal result;
7266 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7268 ideal u_id=(ideal)(u->Data());
7269 if (ww!=NULL)
7270 {
7271 if (!idTestHomModule(u_id,currRing->qideal,ww))
7272 {
7273 WarnS("wrong weights");
7274 ww=NULL;
7275 }
7276 else
7277 {
7278 ww=ivCopy(ww);
7279 hom=isHomog;
7280 }
7281 }
7282 bigintmat *vv=(bigintmat*)v->Data();
7284 currRing->qideal,
7285 hom,
7286 &ww, // module weights
7287 vv, // hilbert series
7288 0,0, // syzComp, newIdeal
7289 vw); // weights of vars
7291 res->data = (char *)result;
7293 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7294 return FALSE;
7295}

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8832 of file iparith.cc.

8833{ ideal result;
8834 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8835 leftv v = u->next; /* one additional polynomial or ideal */
8836 leftv h = v->next; /* Hilbert vector */
8837 leftv w = h->next; /* weight vector */
8838 assumeStdFlag(u);
8839 ideal i1=(ideal)(u->Data());
8840 ideal i0;
8841 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8842 || (h->Typ()!=BIGINTVEC_CMD)
8843 || (w->Typ()!=INTVEC_CMD))
8844 {
8845 WerrorS("expected `std(`ideal/module`,`poly/vector`,`bigintvec`,`intvec`)");
8846 return TRUE;
8847 }
8848 intvec *vw=(intvec *)w->Data(); // weights of vars
8849 /* merging std_hilb_w and std_1 */
8850 if (vw->length()!=currRing->N)
8851 {
8852 Werror("%d weights for %d variables",vw->length(),currRing->N);
8853 return TRUE;
8854 }
8855 int r=v->Typ();
8857 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8858 {
8859 i0=idInit(1,i1->rank);
8860 i0->m[0]=(poly)v->Data();
8862 }
8863 else if (r==IDEAL_CMD)/* IDEAL */
8864 {
8865 i0=(ideal)v->Data();
8866 }
8867 else
8868 {
8869 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8870 return TRUE;
8871 }
8872 int ii0=idElem(i0);
8873 i1 = idSimpleAdd(i1,i0);
8874 if (cleanup_i0)
8875 {
8876 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8877 idDelete(&i0);
8878 }
8879 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8881 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8882 if (ww!=NULL)
8883 {
8884 if (!idTestHomModule(i1,currRing->qideal,ww))
8885 {
8886 WarnS("wrong weights");
8887 ww=NULL;
8888 }
8889 else
8890 {
8891 ww=ivCopy(ww);
8892 hom=isHomog;
8893 }
8894 }
8895 BITSET save1;
8898 result=kStd(i1,
8899 currRing->qideal,
8900 hom,
8901 &ww, // module weights
8902 (bigintmat *)h->Data(), // hilbert series
8903 0, // syzComp, whatever it is...
8904 IDELEMS(i1)-ii0, // new ideal
8905 vw); // weights of vars
8907 idDelete(&i1);
8909 res->data = (char *)result;
8911 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8912 return FALSE;
8913}

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8572 of file iparith.cc.

8573{
8574 if (v == NULL)
8575 {
8576 res->data = omStrDup("");
8577 return FALSE;
8578 }
8579 int n = v->listLength();
8580 if (n == 1)
8581 {
8582 res->data = v->String();
8583 return FALSE;
8584 }
8585
8586 char** slist = (char**) omAlloc(n*sizeof(char*));
8587 int i, j;
8588
8589 for (i=0, j=0; i<n; i++, v = v ->next)
8590 {
8591 slist[i] = v->String();
8592 assume(slist[i] != NULL);
8593 j+=strlen(slist[i]);
8594 }
8595 char* s = (char*) omAlloc((j+1)*sizeof(char));
8596 *s='\0';
8597 for (i=0;i<n;i++)
8598 {
8599 strcat(s, slist[i]);
8600 omFree(slist[i]);
8601 }
8602 omFreeSize(slist, n*sizeof(char*));
8603 res->data = s;
8604 return FALSE;
8605}

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5661 of file iparith.cc.

5662{
5663 res->data = (char *)strlen((char *)v->Data());
5664 return FALSE;
5665}

◆ jjSUBST_Bu()

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

Definition at line 6805 of file iparith.cc.

6806{
6807 // generic conversion from polyBucket to poly:
6808 // force this to be the first try everytime
6809 poly p; int l;
6810 sBucket_pt bu=(sBucket_pt)w->CopyD();
6812 sleftv tmpw;
6813 tmpw.Init();
6814 tmpw.rtyp=POLY_CMD;
6815 tmpw.data=p;
6816 return iiExprArith3(res, iiOp, u, v, &tmpw);
6817}

◆ jjSUBST_Id()

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

Definition at line 6851 of file iparith.cc.

6852{
6853 int ringvar;
6854 poly monomexpr;
6856 if (nok) return TRUE;
6857 ideal id=(ideal)u->Data();
6858 if (ringvar>0)
6859 {
6860 BOOLEAN overflow=FALSE;
6861 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6862 {
6864 for(int i=IDELEMS(id)-1;i>=0;i--)
6865 {
6866 poly p=id->m[i];
6868 if ((p!=NULL) && (mm!=0) &&
6869 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6870 {
6871 overflow=TRUE;
6872 break;
6873 }
6874 }
6875 }
6876 if (overflow)
6877 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6878 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6879 {
6880 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6881 else id=id_Copy(id,currRing);
6882 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6883 }
6884 else
6885 res->data = idSubstPoly(id,ringvar,monomexpr);
6886 }
6887 else
6888 {
6889 if (rIsLPRing(currRing))
6890 {
6891 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6892 return TRUE;
6893 }
6894 res->data = idSubstPar(id,-ringvar,monomexpr);
6895 }
6896 return FALSE;
6897}
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:6777
ideal idSubstPoly(ideal id, int n, poly e)
Definition maps_ip.cc:424
ideal idSubstPar(ideal id, int n, poly e)
Definition maps_ip.cc:385
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition p_polys.cc:5101
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 6901 of file iparith.cc.

6902{
6903 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6904}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition iparith.cc:6909

◆ jjSUBST_Id_N()

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

Definition at line 6905 of file iparith.cc.

6906{
6907 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6908}

◆ jjSUBST_Id_X()

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

Definition at line 6909 of file iparith.cc.

6910{
6911 sleftv tmp;
6912 tmp.Init();
6913 // do not check the result, conversion from int/number to poly works always
6916 tmp.CleanUp();
6917 return b;
6918}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:6851

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8788 of file iparith.cc.

8789{
8790 leftv v = u->next; // number of args > 0
8791 if (v==NULL) return TRUE;
8792 leftv w = v->next;
8793 if (w==NULL) return TRUE;
8794 leftv rest = w->next;
8795
8796 u->next = NULL;
8797 v->next = NULL;
8798 w->next = NULL;
8799 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8800 if ((rest!=NULL) && (!b))
8801 {
8802 leftv tmp_next=res->next;
8803 res->next=rest;
8805 tmp_res.Init();
8807 memcpy(res,&tmp_res,sizeof(tmp_res));
8808 res->next=tmp_next;
8809 }
8810 u->next = v;
8811 v->next = w;
8812 // rest was w->next, but is already cleaned
8813 return b;
8814}

◆ jjSUBST_P()

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

Definition at line 6818 of file iparith.cc.

6819{
6820 int ringvar;
6821 poly monomexpr;
6823 if (nok) return TRUE;
6824 poly p=(poly)u->Data();
6825 if (ringvar>0)
6826 {
6828 if (!rIsLPRing(currRing) &&
6829 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6830 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6831 {
6832 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6833 //return TRUE;
6834 }
6835 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6836 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6837 else
6839 }
6840 else
6841 {
6842 if (rIsLPRing(currRing))
6843 {
6844 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6845 return TRUE;
6846 }
6848 }
6849 return FALSE;
6850}
poly pSubstPoly(poly p, int var, poly image)
Definition maps_ip.cc:402
poly pSubstPar(poly p, int par, poly image)
Definition maps_ip.cc:265

◆ jjSUBST_Test()

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

Definition at line 6777 of file iparith.cc.

6779{
6780 monomexpr=(poly)w->Data();
6781 poly p=(poly)v->Data();
6782#if 0
6783 if (pLength(monomexpr)>1)
6784 {
6785 Werror("`%s` substitutes a ringvar only by a term",
6787 return TRUE;
6788 }
6789#endif
6790 if ((ringvar=pVar(p))==0)
6791 {
6792 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6793 {
6794 number n = pGetCoeff(p);
6796 }
6797 if(ringvar==0)
6798 {
6799 WerrorS("ringvar/par expected");
6800 return TRUE;
6801 }
6802 }
6803 return FALSE;
6804}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition ring.cc:5913
@ SUBST_CMD
Definition tok.h:188

◆ jjSYZ_2()

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

Definition at line 3568 of file iparith.cc.

3569{
3570 // see jjSYZYGY
3571 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3572 intvec *w=NULL;
3574 ideal I=(ideal)u->Data();
3575 GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3576 if (ww!=NULL)
3577 {
3578 if (idTestHomModule(I,currRing->qideal,ww))
3579 {
3580 w=ivCopy(ww);
3581 int add_row_shift=w->min_in();
3582 (*w)-=add_row_shift;
3583 hom=isHomog;
3584 }
3585 else
3586 {
3587 //WarnS("wrong weights");
3588 delete ww; ww=NULL;
3589 hom=testHomog;
3590 }
3591 }
3592 else
3593 {
3594 if (u->Typ()==IDEAL_CMD)
3595 if (idHomIdeal(I,currRing->qideal))
3596 hom=isHomog;
3597 }
3599 if (w!=NULL) delete w;
3600 res->data = (char *)S;
3601 if (hom==isHomog)
3602 {
3603 int vl=S->rank;
3604 intvec *vv=new intvec(vl);
3605 if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3606 {
3607 for(int i=0;i<vl;i++)
3608 {
3609 if (I->m[i]!=NULL)
3610 (*vv)[i]=p_Deg(I->m[i],currRing);
3611 }
3612 }
3613 else
3614 {
3616 for(int i=0;i<vl;i++)
3617 {
3618 if (I->m[i]!=NULL)
3619 (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3620 }
3622 }
3623 if (idTestHomModule(S,currRing->qideal,vv))
3624 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3625 else
3626 delete vv;
3627 }
3629 return FALSE;
3630}
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:836
void p_SetModDeg(intvec *w, ring r)
Definition p_polys.cc:3753
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5207 of file iparith.cc.

5208{
5209 ideal v_id=(ideal)v->Data();
5210#ifdef HAVE_SHIFTBBA
5211 if (rIsLPRing(currRing))
5212 {
5213 if (currRing->LPncGenCount < IDELEMS(v_id))
5214 {
5215 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5216 return TRUE;
5217 }
5218 }
5219#endif
5220 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5221 intvec *w=NULL;
5223 if (ww!=NULL)
5224 {
5225 if (idTestHomModule(v_id,currRing->qideal,ww))
5226 {
5227 w=ivCopy(ww);
5228 int add_row_shift=w->min_in();
5229 (*w)-=add_row_shift;
5230 hom=isHomog;
5231 }
5232 else
5233 {
5234 //WarnS("wrong weights");
5235 delete ww; ww=NULL;
5236 hom=testHomog;
5237 }
5238 }
5239 else
5240 {
5241 if (v->Typ()==IDEAL_CMD)
5242 if (idHomIdeal(v_id,currRing->qideal))
5243 hom=isHomog;
5244 }
5246 res->data = (char *)S;
5247 if (hom==isHomog)
5248 {
5249 int vl=S->rank;
5250 intvec *vv=new intvec(vl);
5251 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5252 {
5253 for(int i=0;i<vl;i++)
5254 {
5255 if (v_id->m[i]!=NULL)
5256 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5257 }
5258 }
5259 else
5260 {
5262 for(int i=0;i<vl;i++)
5263 {
5264 if (v_id->m[i]!=NULL)
5265 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5266 }
5268 }
5269 if (idTestHomModule(S,currRing->qideal,vv))
5270 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5271 else
5272 delete vv;
5273 }
5274 if (w!=NULL) delete w;
5275 return FALSE;
5276}

◆ jjTENSOR()

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

Definition at line 3631 of file iparith.cc.

3632{
3633 ideal A=(ideal)u->Data();
3634 ideal B=(ideal)v->Data();
3635 res->data = (char *)sm_Tensor(A,B,currRing);
3636 return FALSE;
3637}
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition matpol.cc:1827

◆ jjTENSOR_Ma()

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

Definition at line 3638 of file iparith.cc.

3639{
3644 tmp_res.Init();
3645 tmp_res.rtyp=SMATRIX_CMD;
3647 if (!bo)
3648 {
3651 }
3652 tmp_u.CleanUp();
3653 tmp_v.CleanUp();
3654 tmp_res.CleanUp();
3655 return bo;
3656}
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition iparith.cc:3631
static int index(p_Length length, p_Ord ord)

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 8606 of file iparith.cc.

8607{
8608 do
8609 {
8610 if (v->Typ()!=INT_CMD)
8611 return TRUE;
8612 test_cmd((int)(long)v->Data());
8613 v=v->next;
8614 }
8615 while (v!=NULL);
8616 return FALSE;
8617}
void test_cmd(int i)
Definition ipshell.cc:512

◆ jjTIMES_BI()

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

Definition at line 989 of file iparith.cc.

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

◆ jjTIMES_BIM()

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

Definition at line 1072 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 977 of file iparith.cc.

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

◆ jjTIMES_ID()

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

Definition at line 1053 of file iparith.cc.

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

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

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

◆ jjTIMES_MA_BI1()

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

Definition at line 1084 of file iparith.cc.

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

◆ jjTIMES_MA_BI2()

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

Definition at line 1094 of file iparith.cc.

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

◆ jjTIMES_MA_I1()

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

Definition at line 1127 of file iparith.cc.

1128{
1129 res->data = (char *)mp_MultI((matrix)u->CopyD(MATRIX_CMD),(long)v->Data(),currRing);
1130 return FALSE;
1131}
matrix mp_MultI(matrix a, long f, const ring R)
c = f*a
Definition matpol.cc:128

◆ jjTIMES_MA_I2()

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

Definition at line 1132 of file iparith.cc.

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

◆ jjTIMES_MA_N1()

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

Definition at line 1116 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1123 of file iparith.cc.

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

◆ jjTIMES_MA_P1()

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

Definition at line 1098 of file iparith.cc.

1099{
1100 poly p=(poly)v->CopyD(POLY_CMD);
1101 int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1103 if (r>0) I->rank=r;
1104 res->data = (char *)I;
1105 return FALSE;
1106}

◆ jjTIMES_MA_P2()

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

Definition at line 1107 of file iparith.cc.

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

◆ jjTIMES_N()

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

Definition at line 996 of file iparith.cc.

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

◆ jjTIMES_P()

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

Definition at line 1006 of file iparith.cc.

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

◆ jjTIMES_SM()

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

Definition at line 1150 of file iparith.cc.

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

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5278 of file iparith.cc.

5279{
5280 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5281 return FALSE;
5282}
int ivTrace(intvec *o)
Definition intvec.cc:339

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5283 of file iparith.cc.

5284{
5285 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5286 return FALSE;
5287}

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5288 of file iparith.cc.

5289{
5290 res->data = (char *)ivTranp((intvec*)(v->Data()));
5291 return FALSE;
5292}
intvec * ivTranp(intvec *o)
Definition intvec.cc:327

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5327 of file iparith.cc.

5328{
5329#ifdef HAVE_PLURAL
5330 ideal result;
5331 ideal v_id=(ideal)a->Data();
5334 else /*commutative or shiftalgebra*/
5335 {
5336 return jjSTD(res,a);
5337 }
5338 res->data = (char *)result;
5341 return FALSE;
5342#else
5343 return TRUE;
5344#endif
5345}
#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 5407 of file iparith.cc.

5408{
5409 int t=(int)(long)v->data;
5410 switch (t)
5411 {
5412 case CRING_CMD:
5413 case INT_CMD:
5414 case POLY_CMD:
5415 case VECTOR_CMD:
5416 case STRING_CMD:
5417 case INTVEC_CMD:
5418 case IDEAL_CMD:
5419 case MATRIX_CMD:
5420 case MODUL_CMD:
5421 case MAP_CMD:
5422 case PROC_CMD:
5423 case RING_CMD:
5424 case SMATRIX_CMD:
5425 //case QRING_CMD:
5426 case INTMAT_CMD:
5427 case BIGINTMAT_CMD:
5428 case BIGINTVEC_CMD:
5429 case NUMBER_CMD:
5430 #ifdef SINGULAR_4_2
5431 case CNUMBER_CMD:
5432 #endif
5433 case BIGINT_CMD:
5434 case BUCKET_CMD:
5435 case LIST_CMD:
5436 case PACKAGE_CMD:
5437 case LINK_CMD:
5438 case RESOLUTION_CMD:
5439 res->data=omStrDup(Tok2Cmdname(t)); break;
5440 case DEF_CMD:
5441 case NONE: res->data=omStrDup("none"); break;
5442 default:
5443 {
5444 if (t>MAX_TOK)
5445 res->data=omStrDup(getBlackboxName(t));
5446 else
5447 res->data=omStrDup("?unknown type?");
5448 break;
5449 }
5450 }
5451 return FALSE;
5452}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition blackbox.cc:213
@ CNUMBER_CMD
Definition tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3797 of file iparith.cc.

3798{
3801 res->data = (char *)n;
3802 return FALSE;
3803}
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition coeffs.h:558

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3834 of file iparith.cc.

3835{
3837 (*bim)*=(-1);
3838 res->data = (char *)bim;
3839 return FALSE;
3840}

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3804 of file iparith.cc.

3805{
3806 res->data = (char *)(-(long)u->Data());
3807 return FALSE;
3808}

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3827 of file iparith.cc.

3828{
3829 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3830 (*iv)*=(-1);
3831 res->data = (char *)iv;
3832 return FALSE;
3833}

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3821 of file iparith.cc.

3822{
3823 poly m1=pISet(-1);
3824 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3825 return FALSE;
3826}
#define pISet(i)
Definition polys.h:313

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3809 of file iparith.cc.

3810{
3812 n=nInpNeg(n);
3813 res->data = (char *)n;
3814 return FALSE;
3815}
#define nInpNeg(n)
Definition numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3816 of file iparith.cc.

3817{
3818 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3819 return FALSE;
3820}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10464 of file iparith.cc.

10465{
10466 lists l=(lists)arg->Data();
10467 if (l->nr>0)
10468 {
10469 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10470 int i, j, len;
10471 len=l->nr;
10472 i=0;
10473 while(i<len)
10474 {
10475 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10476 {
10477 l->m[i].CleanUp();
10478 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10479 memset(&(l->m[len]),0,sizeof(sleftv));
10480 l->m[len].rtyp=DEF_CMD;
10481 len--;
10482 }
10483 else
10484 i++;
10485 }
10486 //Print("new len:%d\n",len);
10487 }
10488 return FALSE;
10489}

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5453 of file iparith.cc.

5454{
5455 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5456 return FALSE;
5457}
#define pIsUnivariate(p)
Definition polys.h:250

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5458 of file iparith.cc.

5459{
5460 int i=(int)(long)v->Data();
5461 if ((0<i) && (i<=currRing->N))
5462 {
5463 poly p=pOne();
5464 pSetExp(p,i,1);
5465 pSetm(p);
5466 res->data=(char *)p;
5467 }
5468 else
5469 {
5470 Werror("var number %d out of range 1..%d",i,currRing->N);
5471 return TRUE;
5472 }
5473 return FALSE;
5474}

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5475 of file iparith.cc.

5476{
5477 if (currRing==NULL)
5478 {
5479 WerrorS("no ring active (2)");
5480 return TRUE;
5481 }
5482 int i=(int)(long)v->Data();
5483 if ((0<i) && (i<=currRing->N))
5484 res->data=omStrDup(currRing->names[i-1]);
5485 else
5486 {
5487 Werror("var number %d out of range 1..%d",i,currRing->N);
5488 return TRUE;
5489 }
5490 return FALSE;
5491}

◆ jjVARSTR2()

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

Definition at line 3657 of file iparith.cc.

3658{
3659 idhdl h=(idhdl)u->data;
3660 int i=(int)(long)v->Data();
3661 if ((0<i) && (i<=IDRING(h)->N))
3662 res->data=omStrDup(IDRING(h)->names[i-1]);
3663 else
3664 {
3665 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3666 return TRUE;
3667 }
3668 return FALSE;
3669}

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5492 of file iparith.cc.

5493{
5495#ifdef HAVE_SHIFTBBA
5496 if (rIsLPRing(currRing))
5497 {
5499 {
5500 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5501 return TRUE;
5502 }
5503 if (currRing->qideal != NULL)
5504 {
5505 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5506 return TRUE;
5507 }
5508 int kDim = lp_kDim((ideal)(v->Data()));
5509 res->data = (char *)(long)kDim;
5510 return (kDim == -2);
5511 }
5512#endif
5513 long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5514 if (l<-1L)
5515 WerrorS("int overflow in vdim");
5516 res->data = (char *)l;
5517 return FALSE;
5518}
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
int lp_kDim(const ideal _G)
Definition hdegree.cc:2080

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5519 of file iparith.cc.

5520{
5521// input: u: a list with links of type
5522// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5523// returns: -1: the read state of all links is eof or error
5524// i>0: (at least) u[i] is ready
5525 lists L = (lists)u->Data();
5526 int i = slStatusSsiL(L, -1);
5527 if(i == -2) /* error */
5528 {
5529 return TRUE;
5530 }
5531 res->data = (void*)(long)i;
5532 return FALSE;
5533}

◆ jjWAIT1ST2()

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

Definition at line 3670 of file iparith.cc.

3671{
3672// input: u: a list with links of type
3673// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3674// v: timeout for select in milliseconds
3675// or 0 for polling
3676// returns: ERROR (via Werror): timeout negative
3677// -1: the read state of all links is eof
3678// 0: timeout (or polling): none ready
3679// i>0: (at least) L[i] is ready
3680 lists L = (lists)u->Data();
3681 int t = (int)(long)v->Data();
3682 if(t < 0)
3683 {
3684 t= -1;
3685 }
3686 int i = slStatusSsiL(L, t);
3687 if(i == -2) /* error */
3688 {
3689 return TRUE;
3690 }
3691 res->data = (void*)(long)i;
3692 return FALSE;
3693}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5534 of file iparith.cc.

5535{
5536// input: u: a list with links of type
5537// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5538// returns: -1: the read state of all links is eof or error
5539// 1: all links are ready
5540// (caution: at least one is ready, but some maybe dead)
5541 lists L = (lists)u->Data();
5542 int i;
5543 int j = -1;
5544 BOOLEAN* ignore=(BOOLEAN*)omAlloc0((L->nr+1)*sizeof(BOOLEAN));
5545 for(int nfinished = 0; nfinished <= L->nr; nfinished++)
5546 {
5547 i = slStatusSsiL(L, -1, ignore);
5548 if(i == -2) /* error */
5549 {
5550 omFreeSize(ignore,(L->nr+1)*sizeof(BOOLEAN));
5551 return TRUE;
5552 }
5553 if((i == -1)||(j==0))
5554 {
5555 j=-1;
5556 break;
5557 }
5558 if (i>0)
5559 {
5560 j=1;
5561 ignore[i-1]=TRUE;
5562 }
5563 }
5564 omFreeSize(ignore,(L->nr+1)*sizeof(BOOLEAN));
5565 res->data = (void*)(long)j;
5566 return FALSE;
5567}

◆ jjWAITALL2()

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

Definition at line 3694 of file iparith.cc.

3695{
3696// input: u: a list with links of type
3697// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3698// v: timeout for select in milliseconds
3699// or 0 for polling
3700// or -1 for infinite
3701// returns: ERROR (via Werror): timeout negative
3702// -1: the read state of all links is eof or error
3703// 0: timeout (or polling): none ready
3704// 1: all links are ready
3705// (caution: at least one is ready, but some maybe dead)
3706 lists L = (lists)u->Data();
3707 BOOLEAN* ignore=(BOOLEAN*)omAlloc0((L->nr+1)*sizeof(BOOLEAN));
3708 int timeout = (int)(long)v->Data();
3709 if(timeout < 0)
3710 {
3711 timeout=-1;
3712 }
3713 int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3714 int i;
3715 int ret = -1;
3716 for(unsigned nfinished = 0; nfinished <= ((unsigned)L->nr); nfinished++)
3717 {
3719 if(i > 0) /* L[i] is ready */
3720 {
3721 ret = 1;
3722 ignore[i-1]=TRUE;
3723 timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3724 }
3725 else /* terminate the for loop */
3726 {
3727 omFreeSize(ignore,(L->nr+1)*sizeof(BOOLEAN));
3728 if(i == -2) /* error */
3729 {
3730 return TRUE;
3731 }
3732 if(i == 0) /* timeout */
3733 {
3734 ret = 0;
3735 }
3736 break;
3737 }
3738 }
3739 res->data = (void*)(long)ret;
3740 return FALSE;
3741}
#define TIMER_RESOLUTION
Definition mod2.h:35
int getRTimer()
Definition timer.cc:150

◆ jjWEDGE()

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

Definition at line 3742 of file iparith.cc.

3743{
3744 res->data = (char *)mp_Wedge((matrix)u->Data(),(int)(long)v->Data(),currRing);
3745 return FALSE;
3746}
matrix mp_Wedge(matrix a, int ar, const ring R)
Definition matpol.cc:1745

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3747 of file iparith.cc.

3748{
3749 return TRUE;
3750}

◆ jjWRONG2()

static BOOLEAN jjWRONG2 ( leftv  ,
leftv  ,
leftv   
)
static

Definition at line 3751 of file iparith.cc.

3752{
3753 return TRUE;
3754}

◆ jjWRONG3()

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

Definition at line 3755 of file iparith.cc.

3756{
3757 return TRUE;
3758}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int  tok)

Definition at line 9864 of file iparith.cc.

9865{
9866 if (tok <= 0)
9867 {
9868 return sArithBase.sCmds[0].name;
9869 }
9870 if (tok==ANY_TYPE) return "any_type";
9871 if (tok==COMMAND) return "command";
9872 if (tok==NONE) return "nothing";
9873 if (tok < 128)
9874 {
9876 return Tok2Cmdname_buf;
9877 }
9878 //if (tok==IFBREAK) return "if_break";
9879 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9880 //if (tok==ORDER_VECTOR) return "ordering";
9881 //if (tok==REF_VAR) return "ref";
9882 //if (tok==OBJECT) return "object";
9883 //if (tok==PRINT_EXPR) return "print_expr";
9884 if (tok==IDHDL) return "identifier";
9885 if (tok>MAX_TOK) return getBlackboxName(tok);
9886 unsigned i;
9887 for(i=0; i<sArithBase.nCmdUsed; i++)
9888 //while (sArithBase.sCmds[i].tokval!=0)
9889 {
9890 if ((sArithBase.sCmds[i].tokval == tok)&&
9891 (sArithBase.sCmds[i].alias==0))
9892 {
9893 return sArithBase.sCmds[i].name;
9894 }
9895 }
9896 // try gain for alias/old names:
9897 for(i=0; i<sArithBase.nCmdUsed; i++)
9898 {
9899 if (sArithBase.sCmds[i].tokval == tok)
9900 {
9901 return sArithBase.sCmds[i].name;
9902 }
9903 }
9904 return sArithBase.sCmds[0].name;
9905}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition iparith.cc:9863
#define ANY_TYPE
Definition tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char )
static

Definition at line 5641 of file iparith.cc.

5642{
5644}

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 213 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

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

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 197 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2062 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9863 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5640 of file iparith.cc.