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 "kernel/combinatorics/stairc.h"
#include "kernel/combinatorics/hilb.h"
#include "kernel/linear_algebra/interpolation.h"
#include "kernel/linear_algebra/linearAlgebra.h"
#include "kernel/linear_algebra/MinorInterface.h"
#include "kernel/GBEngine/kChinese.h"
#include "kernel/spectrum/GMPrat.h"
#include "kernel/groebner_walk/walkProc.h"
#include "kernel/oswrapper/timer.h"
#include "kernel/fglm/fglm.h"
#include "kernel/GBEngine/kstdfac.h"
#include "kernel/GBEngine/syz.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/units.h"
#include "kernel/GBEngine/tgb.h"
#include "kernel/preimage.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "Singular/mod_lib.h"
#include "Singular/fevoices.h"
#include "Singular/tok.h"
#include "Singular/ipid.h"
#include "Singular/sdb.h"
#include "Singular/subexpr.h"
#include "Singular/lists.h"
#include "Singular/maps_ip.h"
#include "Singular/feOpt.h"
#include "Singular/ipconv.h"
#include "Singular/ipprint.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/misc_ip.h"
#include "Singular/linearAlgebra_ip.h"
#include "Singular/number2.h"
#include "Singular/fglm.h"
#include "Singular/blackbox.h"
#include "Singular/newstruct.h"
#include "Singular/ipshell.h"
#include "reporter/si_signals.h"
#include <ctype.h>
#include "kernel/GBEngine/ratgring.h"
#include "kernel/GBEngine/nc.h"
#include "polys/nc/nc.h"
#include "polys/nc/sca.h"
#include "table.h"
#include "iparith.inc"

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 124 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 59 of file gentable.cc.

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

◆ sValCmd1

struct sValCmd1

Definition at line 78 of file gentable.cc.

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

◆ sValCmd2

struct sValCmd2

Definition at line 69 of file gentable.cc.

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

◆ sValCmd3

struct sValCmd3

Definition at line 86 of file gentable.cc.

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

◆ sValCmdM

struct sValCmdM

Definition at line 96 of file gentable.cc.

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

◆ SArithBase

struct SArithBase

Definition at line 181 of file iparith.cc.

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

Macro Definition Documentation

◆ ALLOW_LP

#define ALLOW_LP   64

Definition at line 110 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 111 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 103 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 106 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 109 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 113 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 105 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 8686 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 217 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8688 of file iparith.cc.

◆ jjWRONG2

#define jjWRONG2   (proc2)jjWRONG

Definition at line 3669 of file iparith.cc.

◆ jjWRONG3

#define jjWRONG3   (proc3)jjWRONG

Definition at line 3670 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 91 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 119 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 104 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 107 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 108 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

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

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3263 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3264 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3265 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3268 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3262 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3267 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 117 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 98 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 130 of file iparith.cc.

◆ proc2

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

Definition at line 150 of file iparith.cc.

◆ proc3

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

Definition at line 161 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

9648{
9649 cmdnames *pCmdL = (cmdnames*)a;
9650 cmdnames *pCmdR = (cmdnames*)b;
9651
9652 if(a==NULL || b==NULL) return 0;
9653
9654 /* empty entries goes to the end of the list for later reuse */
9655 if(pCmdL->name==NULL) return 1;
9656 if(pCmdR->name==NULL) return -1;
9657
9658 /* $INVALID$ must come first */
9659 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9660 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9661
9662 /* tokval=-1 are reserved names at the end */
9663 if (pCmdL->tokval==-1)
9664 {
9665 if (pCmdR->tokval==-1)
9666 return strcmp(pCmdL->name, pCmdR->name);
9667 /* pCmdL->tokval==-1, pCmdL goes at the end */
9668 return 1;
9669 }
9670 /* pCmdR->tokval==-1, pCmdR goes at the end */
9671 if(pCmdR->tokval==-1) return -1;
9672
9673 return strcmp(pCmdL->name, pCmdR->name);
9674}
CanonicalForm b
Definition: cfModGcd.cc:4102
#define NULL
Definition: omList.c:12

◆ check_valid()

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

Definition at line 9873 of file iparith.cc.

9874{
9876 {
9877 if ((p & NC_MASK)==NO_NC)
9878 {
9879 WerrorS("not implemented for non-commutative rings");
9880 return TRUE;
9881 }
9882 else if ((p & NC_MASK)==COMM_PLURAL)
9883 {
9884 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9885 return FALSE;
9886 }
9887 /* else, ALLOW_PLURAL */
9888 }
9889 else if (rIsLPRing(currRing))
9890 {
9891 if ((p & ALLOW_LP)==0)
9892 {
9893 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9894 return TRUE;
9895 }
9896 }
9898 {
9899 if ((p & RING_MASK)==0 /*NO_RING*/)
9900 {
9901 WerrorS("not implemented for rings with rings as coeffients");
9902 return TRUE;
9903 }
9904 /* else ALLOW_RING */
9905 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9907 {
9908 WerrorS("domain required as coeffients");
9909 return TRUE;
9910 }
9911 /* else ALLOW_ZERODIVISOR */
9912 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9913 {
9914 WarnS("considering the image in Q[...]");
9915 }
9916 }
9917 return FALSE;
9918}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
int p
Definition: cfModGcd.cc:4077
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR char my_yylinebuf[80]
Definition: febase.cc:44
VAR int myynest
Definition: febase.cc:41
#define COMM_PLURAL
Definition: iparith.cc:105
#define NO_ZERODIVISOR
Definition: iparith.cc:108
#define ALLOW_LP
Definition: iparith.cc:110
#define RING_MASK
Definition: iparith.cc:97
#define WARN_RING
Definition: iparith.cc:117
#define NC_MASK
Definition: iparith.cc:91
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:9593
#define NO_NC
Definition: iparith.cc:104
#define ZERODIVISOR_MASK
Definition: iparith.cc:98
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void Werror(const char *fmt,...)
Definition: reporter.cc:189
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:488
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411
#define rField_is_Ring(R)
Definition: ring.h:486

◆ iiArithAddCmd()

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

Definition at line 9814 of file iparith.cc.

9821{
9822 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9823 // nTokval, nToktype, nPos);
9824 if(nPos>=0)
9825 {
9826 // no checks: we rely on a correct generated code in iparith.inc
9827 assume((unsigned)nPos < sArithBase.nCmdAllocated);
9828 assume(szName!=NULL);
9829 sArithBase.sCmds[nPos].name = omStrDup(szName);
9830 sArithBase.sCmds[nPos].alias = nAlias;
9831 sArithBase.sCmds[nPos].tokval = nTokval;
9832 sArithBase.sCmds[nPos].toktype = nToktype;
9834 //if(nTokval>0) sArithBase.nLastIdentifier++;
9835 }
9836 else
9837 {
9838 if(szName==NULL) return -1;
9839 int nIndex = iiArithFindCmd(szName);
9840 if(nIndex>=0)
9841 {
9842 Print("'%s' already exists at %d\n", szName, nIndex);
9843 return -1;
9844 }
9845
9847 {
9848 /* needs to create new slots */
9849 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9851 if(sArithBase.sCmds==NULL) return -1;
9853 }
9854 /* still free slots available */
9856 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9857 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9858 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9860
9861 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9865 {
9866 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9867 }
9868 //Print("L=%d\n", sArithBase.nLastIdentifier);
9869 }
9870 return 0;
9871}
#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:9647
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:9719
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:183
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:190
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:198
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:189
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:188
#define assume(x)
Definition: mod2.h:387
#define nSize(n)
Definition: numbers.h:39
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 9719 of file iparith.cc.

9720{
9721 int an=0;
9722 int i = 0,v = 0;
9724
9725 loop
9726 //for(an=0; an<sArithBase.nCmdUsed; )
9727 {
9728 if(an>=en-1)
9729 {
9730 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
9731 {
9732 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
9733 return an;
9734 }
9735 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
9736 {
9737 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
9738 return en;
9739 }
9740 else
9741 {
9742 //Print("RET- 1\n");
9743 return -1;
9744 }
9745 }
9746 i=(an+en)/2;
9747 if (*szName < *(sArithBase.sCmds[i].name))
9748 {
9749 en=i-1;
9750 }
9751 else if (*szName > *(sArithBase.sCmds[i].name))
9752 {
9753 an=i+1;
9754 }
9755 else
9756 {
9757 v=strcmp(szName,sArithBase.sCmds[i].name);
9758 if(v<0)
9759 {
9760 en=i-1;
9761 }
9762 else if(v>0)
9763 {
9764 an=i+1;
9765 }
9766 else /*v==0*/
9767 {
9768 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
9769 return i;
9770 }
9771 }
9772 }
9773 //if(i>=0 && i<sArithBase.nCmdUsed)
9774 // return i;
9775 //PrintS("RET-2\n");
9776 return -2;
9777}
int i
Definition: cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define loop
Definition: structs.h:75

◆ iiArithGetCmd()

char * iiArithGetCmd ( int  nPos)

Definition at line 9779 of file iparith.cc.

9780{
9781 if(nPos<0) return NULL;
9782 if(nPos<(int)sArithBase.nCmdUsed)
9783 return sArithBase.sCmds[nPos].name;
9784 return NULL;
9785}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 9787 of file iparith.cc.

9788{
9789 int nIndex;
9790 if(szName==NULL) return -1;
9791
9792 nIndex = iiArithFindCmd(szName);
9793 if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9794 {
9795 Print("'%s' not found (%d)\n", szName, nIndex);
9796 return -1;
9797 }
9798 omFree(sArithBase.sCmds[nIndex].name);
9799 sArithBase.sCmds[nIndex].name=NULL;
9800 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9803
9804 /* fix last-identifier */
9807 {
9808 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9809 }
9810 //Print("L=%d\n", sArithBase.nLastIdentifier);
9811 return 0;
9812}
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ iiExprArith1()

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

Definition at line 9059 of file iparith.cc.

9060{
9061 if (!errorreported)
9062 {
9063 res->Init();
9064#ifdef SIQ
9065 if (siq>0)
9066 {
9067 //Print("siq:%d\n",siq);
9069 memcpy(&d->arg1,a,sizeof(sleftv));
9070 a->Init();
9071 d->op=op;
9072 d->argc=1;
9073 res->data=(char *)d;
9074 res->rtyp=COMMAND;
9075 return FALSE;
9076 }
9077#endif
9078 int at=a->Typ();
9079 // handling bb-objects ----------------------------------------------------
9080 if(op>MAX_TOK) // explicit type conversion to bb
9081 {
9082 blackbox *bb=getBlackboxStuff(op);
9083 if (bb!=NULL)
9084 {
9085 res->rtyp=op;
9086 res->data=bb->blackbox_Init(bb);
9087 if(!bb->blackbox_Assign(res,a)) return FALSE;
9088 }
9089 else
9090 return TRUE;
9091 }
9092 else if (at>MAX_TOK) // argument is of bb-type
9093 {
9094 blackbox *bb=getBlackboxStuff(at);
9095 if (bb!=NULL)
9096 {
9097 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9098 // else: no op defined
9099 }
9100 else
9101 return TRUE;
9102 }
9103 if (errorreported) return TRUE;
9104
9105 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9106 return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9107 }
9108 a->CleanUp();
9109 return TRUE;
9110}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:1011
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
CanonicalForm res
Definition: facAbsFact.cc:60
VAR short errorreported
Definition: feFopen.cc:23
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation 'op' to an argument a return TRUE on failure
Definition: iparith.cc:8929
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:9568
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1277
VAR omBin sip_command_bin
Definition: ipid.cc:45
ip_command * command
Definition: ipid.h:23
const struct sValCmd1 dArith1[]
Definition: table.h:37
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
VAR BOOLEAN siq
Definition: subexpr.cc:48
@ MAX_TOK
Definition: tok.h:218
#define COMMAND
Definition: tok.h:29

◆ iiExprArith1Tab()

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

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

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

Definition at line 8929 of file iparith.cc.

8930{
8931 res->Init();
8932 BOOLEAN call_failed=FALSE;
8933
8934 if (!errorreported)
8935 {
8936 BOOLEAN failed=FALSE;
8937 iiOp=op;
8938 int i = 0;
8939 while (dA1[i].cmd==op)
8940 {
8941 if (at==dA1[i].arg)
8942 {
8943 if (currRing!=NULL)
8944 {
8945 if (check_valid(dA1[i].valid_for,op)) break;
8946 }
8947 else
8948 {
8949 if (RingDependend(dA1[i].res))
8950 {
8951 WerrorS("no ring active (5)");
8952 break;
8953 }
8954 }
8955 if (traceit&TRACE_CALL)
8956 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8957 res->rtyp=dA1[i].res;
8958 if ((call_failed=dA1[i].p(res,a)))
8959 {
8960 break;// leave loop, goto error handling
8961 }
8962 if (a->Next()!=NULL)
8963 {
8965 failed=iiExprArith1(res->next,a->next,op);
8966 }
8967 a->CleanUp();
8968 return failed;
8969 }
8970 i++;
8971 }
8972 // implicite type conversion --------------------------------------------
8973 if (dA1[i].cmd!=op)
8974 {
8976 i=0;
8977 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8978 while (dA1[i].cmd==op)
8979 {
8980 int ai;
8981 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8982 if ((dA1[i].valid_for & NO_CONVERSION)==0)
8983 {
8984 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8985 {
8986 if (currRing!=NULL)
8987 {
8988 if (check_valid(dA1[i].valid_for,op)) break;
8989 }
8990 else
8991 {
8992 if (RingDependend(dA1[i].res))
8993 {
8994 WerrorS("no ring active (6)");
8995 break;
8996 }
8997 }
8998 if (traceit&TRACE_CALL)
8999 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9000 res->rtyp=dA1[i].res;
9001 failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9002 || (call_failed=dA1[i].p(res,an)));
9003 // everything done, clean up temp. variables
9004 if (failed)
9005 {
9006 // leave loop, goto error handling
9007 break;
9008 }
9009 else
9010 {
9011 if (an->Next() != NULL)
9012 {
9013 res->next = (leftv)omAllocBin(sleftv_bin);
9014 failed=iiExprArith1(res->next,an->next,op);
9015 }
9016 // everything ok, clean up and return
9017 an->CleanUp();
9019 return failed;
9020 }
9021 }
9022 }
9023 i++;
9024 }
9025 an->CleanUp();
9027 }
9028 // error handling
9029 if (!errorreported)
9030 {
9031 if ((at==0) && (a->Fullname()!=sNoName_fe))
9032 {
9033 Werror("`%s` is not defined",a->Fullname());
9034 }
9035 else
9036 {
9037 i=0;
9038 const char *s = iiTwoOps(op);
9039 Werror("%s(`%s`) failed"
9040 ,s,Tok2Cmdname(at));
9041 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9042 {
9043 while (dA1[i].cmd==op)
9044 {
9045 if ((dA1[i].res!=0)
9046 && (dA1[i].p!=jjWRONG))
9047 Werror("expected %s(`%s`)"
9048 ,s,Tok2Cmdname(dA1[i].arg));
9049 i++;
9050 }
9051 }
9052 }
9053 }
9054 res->rtyp = UNKNOWN;
9055 }
9056 a->CleanUp();
9057 return TRUE;
9058}
int BOOLEAN
Definition: auxiliary.h:87
void * ADDRESS
Definition: auxiliary.h:119
leftv next
Definition: subexpr.h:86
leftv Next()
Definition: subexpr.h:136
const char * Fullname()
Definition: subexpr.h:125
const CanonicalForm int s
Definition: facAbsFact.cc:51
const char sNoName_fe[]
Definition: fevoices.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
const char * iiTwoOps(int t)
Definition: gentable.cc:261
#define jjWRONG
Definition: gentable.cc:127
static int RingDependend(int t)
Definition: gentable.cc:28
#define NO_CONVERSION
Definition: iparith.cc:119
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:9059
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9873
VAR int iiOp
Definition: iparith.cc:219
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:435
EXTERN_VAR omBin sleftv_bin
Definition: ipid.h:145
short res
Definition: gentable.cc:82
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:34
#define V_SHOW_USE
Definition: options.h:51
EXTERN_VAR int traceit
Definition: reporter.h:24
#define TRACE_CALL
Definition: reporter.h:44
sleftv * leftv
Definition: structs.h:57
#define UNKNOWN
Definition: tok.h:222

◆ iiExprArith2()

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

Definition at line 8870 of file iparith.cc.

8871{
8872 res->Init();
8873
8874 if (!errorreported)
8875 {
8876#ifdef SIQ
8877 if (siq>0)
8878 {
8879 //Print("siq:%d\n",siq);
8881 memcpy(&d->arg1,a,sizeof(sleftv));
8882 a->Init();
8883 memcpy(&d->arg2,b,sizeof(sleftv));
8884 b->Init();
8885 d->argc=2;
8886 d->op=op;
8887 res->data=(char *)d;
8888 res->rtyp=COMMAND;
8889 return FALSE;
8890 }
8891#endif
8892 int at=a->Typ();
8893 int bt=b->Typ();
8894 // handling bb-objects ----------------------------------------------------
8895 if (at>MAX_TOK)
8896 {
8897 blackbox *bb=getBlackboxStuff(at);
8898 if (bb!=NULL)
8899 {
8900 if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8901 //else: no op defined, try the default
8902 }
8903 else
8904 return TRUE;
8905 }
8906 else if ((bt>MAX_TOK)&&(op!='('))
8907 {
8908 blackbox *bb=getBlackboxStuff(bt);
8909 if (bb!=NULL)
8910 {
8911 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8912 // else: no op defined
8913 }
8914 else
8915 return TRUE;
8916 }
8917 int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8918 return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8919 }
8920 a->CleanUp();
8921 b->CleanUp();
8922 return TRUE;
8923}
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:8697
const struct sValCmd2 dArith2[]
Definition: table.h:318

◆ iiExprArith2Tab()

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

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

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

Definition at line 8856 of file iparith.cc.

8860{
8861 res->Init();
8862 leftv b=a->next;
8863 a->next=NULL;
8864 int bt=b->Typ();
8866 a->next=b;
8867 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8868 return bo;
8869}

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

8702{
8703 BOOLEAN call_failed=FALSE;
8704
8705 if (!errorreported)
8706 {
8707 int i=0;
8708 iiOp=op;
8709 while (dA2[i].cmd==op)
8710 {
8711 if ((at==dA2[i].arg1)
8712 && (bt==dA2[i].arg2))
8713 {
8714 res->rtyp=dA2[i].res;
8715 if (currRing!=NULL)
8716 {
8717 if (check_valid(dA2[i].valid_for,op)) break;
8718 }
8719 else
8720 {
8721 if (RingDependend(dA2[i].res))
8722 {
8723 WerrorS("no ring active (3)");
8724 break;
8725 }
8726 }
8727 if (traceit&TRACE_CALL)
8728 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
8729 if ((call_failed=dA2[i].p(res,a,b)))
8730 {
8731 break;// leave loop, goto error handling
8732 }
8733 a->CleanUp();
8734 b->CleanUp();
8735 //Print("op: %d,result typ:%d\n",op,res->rtyp);
8736 return FALSE;
8737 }
8738 i++;
8739 }
8740 // implicite type conversion ----------------------------------------------
8741 if (dA2[i].cmd!=op)
8742 {
8743 int ai,bi;
8746 BOOLEAN failed=FALSE;
8747 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8748 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
8749 while (dA2[i].cmd==op)
8750 {
8751 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8752 if ((dA2[i].valid_for & NO_CONVERSION)==0)
8753 {
8754 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
8755 {
8756 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
8757 {
8758 res->rtyp=dA2[i].res;
8759 if (currRing!=NULL)
8760 {
8761 if (check_valid(dA2[i].valid_for,op)) break;
8762 }
8763 else
8764 {
8765 if (RingDependend(dA2[i].res))
8766 {
8767 WerrorS("no ring active (4)");
8768 break;
8769 }
8770 }
8771 if (traceit&TRACE_CALL)
8772 Print("call %s(%s,%s)\n",iiTwoOps(op),
8773 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8774 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
8775 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
8776 || (call_failed=dA2[i].p(res,an,bn)));
8777 // everything done, clean up temp. variables
8778 if (failed)
8779 {
8780 // leave loop, goto error handling
8781 break;
8782 }
8783 else
8784 {
8785 // everything ok, clean up and return
8786 an->CleanUp();
8787 bn->CleanUp();
8790 return FALSE;
8791 }
8792 }
8793 }
8794 }
8795 i++;
8796 }
8797 an->CleanUp();
8798 bn->CleanUp();
8801 }
8802 // error handling ---------------------------------------------------
8803 const char *s=NULL;
8804 if (!errorreported)
8805 {
8806 if ((at==0) && (a->Fullname()!=sNoName_fe))
8807 {
8808 s=a->Fullname();
8809 }
8810 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8811 {
8812 s=b->Fullname();
8813 }
8814 if (s!=NULL)
8815 Werror("`%s` is not defined",s);
8816 else
8817 {
8818 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8819 s = iiTwoOps(op);
8820 if (proccall)
8821 {
8822 Werror("%s(`%s`,`%s`) failed"
8823 ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8824 }
8825 else
8826 {
8827 Werror("`%s` %s `%s` failed"
8828 ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8829 }
8830 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8831 {
8832 while (dA2[i].cmd==op)
8833 {
8834 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8835 && (dA2[i].res!=0)
8836 && (dA2[i].p!=jjWRONG2))
8837 {
8838 if (proccall)
8839 Werror("expected %s(`%s`,`%s`)"
8840 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8841 else
8842 Werror("expected `%s` %s `%s`"
8843 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8844 }
8845 i++;
8846 }
8847 }
8848 }
8849 }
8850 a->CleanUp();
8851 b->CleanUp();
8852 res->rtyp = UNKNOWN;
8853 }
8854 return TRUE;
8855}
#define jjWRONG2
Definition: iparith.cc:3669
short res
Definition: gentable.cc:73

◆ iiExprArith3()

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

Definition at line 9269 of file iparith.cc.

9270{
9271 res->Init();
9272
9273 if (!errorreported)
9274 {
9275#ifdef SIQ
9276 if (siq>0)
9277 {
9278 //Print("siq:%d\n",siq);
9280 memcpy(&d->arg1,a,sizeof(sleftv));
9281 a->Init();
9282 memcpy(&d->arg2,b,sizeof(sleftv));
9283 b->Init();
9284 memcpy(&d->arg3,c,sizeof(sleftv));
9285 c->Init();
9286 d->op=op;
9287 d->argc=3;
9288 res->data=(char *)d;
9289 res->rtyp=COMMAND;
9290 return FALSE;
9291 }
9292#endif
9293 int at=a->Typ();
9294 // handling bb-objects ----------------------------------------------
9295 if (at>MAX_TOK)
9296 {
9297 blackbox *bb=getBlackboxStuff(at);
9298 if (bb!=NULL)
9299 {
9300 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9301 // else: no op defined
9302 }
9303 else
9304 return TRUE;
9305 if (errorreported) return TRUE;
9306 }
9307 int bt=b->Typ();
9308 int ct=c->Typ();
9309
9310 iiOp=op;
9311 int i=0;
9312 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9313 return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9314 }
9315 a->CleanUp();
9316 b->CleanUp();
9317 c->CleanUp();
9318 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9319 return TRUE;
9320}
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:9116
const struct sValCmd3 dArith3[]
Definition: table.h:770

◆ iiExprArith3Tab()

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

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

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

Definition at line 9321 of file iparith.cc.

9325{
9326 res->Init();
9327 leftv b=a->next;
9328 a->next=NULL;
9329 int bt=b->Typ();
9330 leftv c=b->next;
9331 b->next=NULL;
9332 int ct=c->Typ();
9333 BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9334 b->next=c;
9335 a->next=b;
9336 a->CleanUp(); // to cleanup the chain, content already done
9337 return bo;
9338}

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

9119{
9120 BOOLEAN call_failed=FALSE;
9121
9122 assume(dA3[0].cmd==op);
9123
9124 if (!errorreported)
9125 {
9126 int i=0;
9127 iiOp=op;
9128 while (dA3[i].cmd==op)
9129 {
9130 if ((at==dA3[i].arg1)
9131 && (bt==dA3[i].arg2)
9132 && (ct==dA3[i].arg3))
9133 {
9134 res->rtyp=dA3[i].res;
9135 if (currRing!=NULL)
9136 {
9137 if (check_valid(dA3[i].valid_for,op)) break;
9138 }
9139 if (traceit&TRACE_CALL)
9140 Print("call %s(%s,%s,%s)\n",
9142 if ((call_failed=dA3[i].p(res,a,b,c)))
9143 {
9144 break;// leave loop, goto error handling
9145 }
9146 a->CleanUp();
9147 b->CleanUp();
9148 c->CleanUp();
9149 return FALSE;
9150 }
9151 i++;
9152 }
9153 // implicite type conversion ----------------------------------------------
9154 if (dA3[i].cmd!=op)
9155 {
9156 int ai,bi,ci;
9160 BOOLEAN failed=FALSE;
9161 i=0;
9162 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9163 while (dA3[i].cmd==op)
9164 {
9165 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9166 {
9167 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9168 {
9169 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9170 {
9171 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9172 {
9173 res->rtyp=dA3[i].res;
9174 if (currRing!=NULL)
9175 {
9176 if (check_valid(dA3[i].valid_for,op)) break;
9177 }
9178 if (traceit&TRACE_CALL)
9179 Print("call %s(%s,%s,%s)\n",
9180 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9181 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9182 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9183 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9184 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9185 || (call_failed=dA3[i].p(res,an,bn,cn)));
9186 // everything done, clean up temp. variables
9187 if (failed)
9188 {
9189 // leave loop, goto error handling
9190 break;
9191 }
9192 else
9193 {
9194 // everything ok, clean up and return
9195 an->CleanUp();
9196 bn->CleanUp();
9197 cn->CleanUp();
9201 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9202 return FALSE;
9203 }
9204 }
9205 }
9206 }
9207 }
9208 i++;
9209 }
9210 an->CleanUp();
9211 bn->CleanUp();
9212 cn->CleanUp();
9216 }
9217 // error handling ---------------------------------------------------
9218 if (!errorreported)
9219 {
9220 const char *s=NULL;
9221 if ((at==0) && (a->Fullname()!=sNoName_fe))
9222 {
9223 s=a->Fullname();
9224 }
9225 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9226 {
9227 s=b->Fullname();
9228 }
9229 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9230 {
9231 s=c->Fullname();
9232 }
9233 if (s!=NULL)
9234 Werror("`%s` is not defined",s);
9235 else
9236 {
9237 i=0;
9238 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9239 const char *s = iiTwoOps(op);
9240 Werror("%s(`%s`,`%s`,`%s`) failed"
9241 ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9242 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9243 {
9244 while (dA3[i].cmd==op)
9245 {
9246 if(((at==dA3[i].arg1)
9247 ||(bt==dA3[i].arg2)
9248 ||(ct==dA3[i].arg3))
9249 && (dA3[i].res!=0))
9250 {
9251 Werror("expected %s(`%s`,`%s`,`%s`)"
9252 ,s,Tok2Cmdname(dA3[i].arg1)
9253 ,Tok2Cmdname(dA3[i].arg2)
9254 ,Tok2Cmdname(dA3[i].arg3));
9255 }
9256 i++;
9257 }
9258 }
9259 }
9260 }
9261 res->rtyp = UNKNOWN;
9262 }
9263 a->CleanUp();
9264 b->CleanUp();
9265 c->CleanUp();
9266 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9267 return TRUE;
9268}
short res
Definition: gentable.cc:90

◆ iiExprArithM()

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

Definition at line 9360 of file iparith.cc.

9361{
9362 res->Init();
9363
9364 if (!errorreported)
9365 {
9366#ifdef SIQ
9367 if (siq>0)
9368 {
9369 //Print("siq:%d\n",siq);
9371 d->op=op;
9372 res->data=(char *)d;
9373 if (a!=NULL)
9374 {
9375 d->argc=a->listLength();
9376 // else : d->argc=0;
9377 memcpy(&d->arg1,a,sizeof(sleftv));
9378 switch(d->argc)
9379 {
9380 case 3:
9381 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9382 a->next->next->Init();
9383 /* no break */
9384 case 2:
9385 memcpy(&d->arg2,a->next,sizeof(sleftv));
9386 a->next->Init();
9387 a->next->next=d->arg2.next;
9388 d->arg2.next=NULL;
9389 /* no break */
9390 case 1:
9391 a->Init();
9392 a->next=d->arg1.next;
9393 d->arg1.next=NULL;
9394 }
9395 if (d->argc>3) a->next=NULL;
9396 a->name=NULL;
9397 a->rtyp=0;
9398 a->data=NULL;
9399 a->e=NULL;
9400 a->attribute=NULL;
9401 a->CleanUp();
9402 }
9403 res->rtyp=COMMAND;
9404 return FALSE;
9405 }
9406#endif
9407 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9408 {
9409 blackbox *bb=getBlackboxStuff(a->Typ());
9410 if (bb!=NULL)
9411 {
9412 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9413 // else: no op defined
9414 }
9415 else
9416 return TRUE;
9417 if (errorreported) return TRUE;
9418 }
9419 int args=0;
9420 if (a!=NULL) args=a->listLength();
9421
9422 iiOp=op;
9423 int i=0;
9424 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9425 while (dArithM[i].cmd==op)
9426 {
9427 if ((args==dArithM[i].number_of_args)
9428 || (dArithM[i].number_of_args==-1)
9429 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9430 {
9431 res->rtyp=dArithM[i].res;
9432 if (currRing!=NULL)
9433 {
9434 if (check_valid(dArithM[i].valid_for,op)) break;
9435 }
9436 if (traceit&TRACE_CALL)
9437 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9438 if (dArithM[i].p(res,a))
9439 {
9440 break;// leave loop, goto error handling
9441 }
9442 if (a!=NULL) a->CleanUp();
9443 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9444 return FALSE;
9445 }
9446 i++;
9447 }
9448 // error handling
9449 if (!errorreported)
9450 {
9451 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9452 {
9453 Werror("`%s` is not defined",a->Fullname());
9454 }
9455 else
9456 {
9457 const char *s = iiTwoOps(op);
9458 Werror("%s(...) failed",s);
9459 }
9460 }
9461 res->rtyp = UNKNOWN;
9462 }
9463 if (a!=NULL) a->CleanUp();
9464 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9465 return TRUE;
9466}
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
const char * Name()
Definition: subexpr.h:120
int listLength()
Definition: subexpr.cc:51
void * data
Definition: subexpr.h:88
Subexpr e
Definition: subexpr.h:105
attr attribute
Definition: subexpr.h:89
short res
Definition: gentable.cc:100
const struct sValCmdM dArithM[]
Definition: table.h:901

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9684 of file iparith.cc.

9685{
9686 //printf("iiInitArithmetic()\n");
9687 memset(&sArithBase, 0, sizeof(sArithBase));
9688 iiInitCmdName();
9689 /* fix last-identifier */
9690#if 0
9691 /* we expect that gentable allready did every thing */
9694 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9695 }
9696#endif
9697 //Print("L=%d\n", sArithBase.nLastIdentifier);
9698
9699 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
9700 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
9701
9702 //iiArithAddCmd("Top", 0,-1,0);
9703
9704
9705 //for(i=0; i<sArithBase.nCmdUsed; i++) {
9706 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
9707 // sArithBase.sCmds[i].name,
9708 // sArithBase.sCmds[i].alias,
9709 // sArithBase.sCmds[i].tokval,
9710 // sArithBase.sCmds[i].toktype);
9711 //}
9712 //iiArithRemoveCmd("Top");
9713 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
9714 //iiArithRemoveCmd("mygcd");
9715 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
9716 return 0;
9717}

◆ iin_Int()

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

Definition at line 222 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 9568 of file iparith.cc.

9569{
9570 // user defined types are not in the pre-computed table:
9571 if (op>MAX_TOK) return 0;
9572
9573 int a=0;
9574 int e=len;
9575 int p=len/2;
9576 do
9577 {
9578 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9579 if (op<dArithTab[p].cmd) e=p-1;
9580 else a = p+1;
9581 p=a+(e-a)/2;
9582 }
9583 while ( a <= e);
9584
9585 // catch missing a cmd:
9586 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9587 // Print("op %d (%c) unknown",op,op);
9588 return 0;
9589}

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 234 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9469 of file iparith.cc.

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

◆ jjALIGN_M()

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

Definition at line 1780 of file iparith.cc.

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

◆ jjALIGN_V()

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

Definition at line 1770 of file iparith.cc.

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

◆ jjAND_I()

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

Definition at line 1381 of file iparith.cc.

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

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3782 of file iparith.cc.

3783{
3784 //matrix m=(matrix)v->Data();
3785 //lists l=mpBareiss(m,FALSE);
3786 intvec *iv;
3787 ideal m;
3788 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3790 l->Init(2);
3791 l->m[0].rtyp=MODUL_CMD;
3792 l->m[1].rtyp=INTVEC_CMD;
3793 l->m[0].data=(void *)m;
3794 l->m[1].data=(void *)iv;
3795 res->data = (char *)l;
3796 return FALSE;
3797}
int m
Definition: cfEzgcd.cc:128
Definition: intvec.h:23
Definition: lists.h:24
VAR omBin slists_bin
Definition: lists.cc:23
slists * lists
Definition: mpr_numeric.h:146
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition: sparsmat.cc:347

◆ jjBAREISS3()

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

Definition at line 5970 of file iparith.cc.

5971{
5972 intvec *iv;
5973 ideal m;
5975 int k=(int)(long)w->Data();
5976 if (k>=0)
5977 {
5978 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
5979 l->Init(2);
5980 l->m[0].rtyp=MODUL_CMD;
5981 l->m[1].rtyp=INTVEC_CMD;
5982 l->m[0].data=(void *)m;
5983 l->m[1].data=(void *)iv;
5984 }
5985 else
5986 {
5987 m=sm_CallSolv((ideal)u->Data(), currRing);
5988 l->Init(1);
5989 l->m[0].rtyp=IDEAL_CMD;
5990 l->m[0].data=(void *)m;
5991 }
5992 res->data = (char *)l;
5993 return FALSE;
5994}
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 3805 of file iparith.cc.

3806{
3807 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3808 b->hnf();
3809 res->data=(char*)b;
3810 return FALSE;
3811}
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 3827 of file iparith.cc.

3828{
3829 bigintmat *b=(bigintmat*)u->Data();
3830 res->data=(void *)bim2iv(b);
3831 return FALSE;
3832}
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3812 of file iparith.cc.

3813{
3814 BOOLEAN bo=FALSE;
3815 number n=(number)u->CopyD();
3817 if (nMap!=NULL)
3818 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3819 else
3820 {
3821 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3822 bo=TRUE;
3823 }
3825 return bo;
3826}
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:700
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:963
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3833 of file iparith.cc.

3834{
3835 sleftv tmp;
3836 BOOLEAN bo=jjBI2N(&tmp,u);
3837 if (!bo)
3838 {
3839 number n=(number) tmp.data;
3840 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3841 else
3842 {
3843 res->data=(void *)pNSet(n);
3844 }
3845 }
3846 return bo;
3847}
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3812
if(yy_init)
Definition: libparse.cc:1420
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define pNSet(n)
Definition: polys.h:313

◆ jjBRACK_Bim()

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

Definition at line 5715 of file iparith.cc.

5716{
5717 bigintmat *bim = (bigintmat *)u->Data();
5718 int r = (int)(long)v->Data();
5719 int c = (int)(long)w->Data();
5720 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5721 {
5722 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5723 r,c,u->Fullname(),bim->rows(),bim->cols());
5724 return TRUE;
5725 }
5726 res->data=u->data; u->data=NULL;
5727 res->rtyp=u->rtyp; u->rtyp=0;
5728 res->name=u->name; u->name=NULL;
5729 Subexpr e=jjMakeSub(v);
5730 e->next=jjMakeSub(w);
5731 if (u->e==NULL)
5732 res->e=e;
5733 else
5734 {
5735 Subexpr h=u->e;
5736 while (h->next!=NULL) h=h->next;
5737 h->next=e;
5738 res->e=u->e;
5739 u->e=NULL;
5740 }
5741 return FALSE;
5742}
int cols() const
Definition: bigintmat.h:144
int rows() const
Definition: bigintmat.h:145
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:8664
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ jjBRACK_Im()

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

Definition at line 5688 of file iparith.cc.

5689{
5690 intvec *iv = (intvec *)u->Data();
5691 int r = (int)(long)v->Data();
5692 int c = (int)(long)w->Data();
5693 if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5694 {
5695 Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5696 r,c,u->Fullname(),iv->rows(),iv->cols());
5697 return TRUE;
5698 }
5699 res->data=u->data; u->data=NULL;
5700 res->rtyp=u->rtyp; u->rtyp=0;
5701 res->name=u->name; u->name=NULL;
5702 Subexpr e=jjMakeSub(v);
5703 e->next=jjMakeSub(w);
5704 if (u->e==NULL) res->e=e;
5705 else
5706 {
5707 Subexpr h=u->e;
5708 while (h->next!=NULL) h=h->next;
5709 h->next=e;
5710 res->e=u->e;
5711 u->e=NULL;
5712 }
5713 return FALSE;
5714}
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 5743 of file iparith.cc.

5744{
5745 matrix m= (matrix)u->Data();
5746 int r = (int)(long)v->Data();
5747 int c = (int)(long)w->Data();
5748 //Print("gen. elem %d, %d\n",r,c);
5749 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5750 {
5751 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5752 MATROWS(m),MATCOLS(m));
5753 return TRUE;
5754 }
5755 res->data=u->data; u->data=NULL;
5756 res->rtyp=u->rtyp; u->rtyp=0;
5757 res->name=u->name; u->name=NULL;
5758 Subexpr e=jjMakeSub(v);
5759 e->next=jjMakeSub(w);
5760 if (u->e==NULL)
5761 res->e=e;
5762 else
5763 {
5764 Subexpr h=u->e;
5765 while (h->next!=NULL) h=h->next;
5766 h->next=e;
5767 res->e=u->e;
5768 u->e=NULL;
5769 }
5770 return FALSE;
5771}
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 5801 of file iparith.cc.

5802{
5803 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5804 {
5805 WerrorS("cannot build expression lists from unnamed objects");
5806 return TRUE;
5807 }
5808
5809 leftv p=NULL;
5810 intvec *iv=(intvec *)w->Data();
5811 int l;
5812 BOOLEAN nok;
5813 sleftv ut;
5814 memcpy(&ut,u,sizeof(ut));
5815 sleftv t;
5816 t.Init();
5817 t.rtyp=INT_CMD;
5818 for (l=0;l< iv->length(); l++)
5819 {
5820 t.data=(char *)(long)((*iv)[l]);
5821 if (p==NULL)
5822 {
5823 p=res;
5824 }
5825 else
5826 {
5827 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5828 p=p->next;
5829 }
5830 memcpy(u,&ut,sizeof(ut));
5831 if (u->Typ() == MATRIX_CMD)
5832 nok=jjBRACK_Ma(p,u,v,&t);
5833 else if (u->Typ() == BIGINTMAT_CMD)
5834 nok=jjBRACK_Bim(p,u,v,&t);
5835 else /* INTMAT_CMD */
5836 nok=jjBRACK_Im(p,u,v,&t);
5837 if (nok)
5838 {
5839 while (res->next!=NULL)
5840 {
5841 p=res->next->next;
5843 // res->e aufraeumen !!!!
5844 res->next=p;
5845 }
5846 return TRUE;
5847 }
5848 }
5849 return FALSE;
5850}
int length() const
Definition: intvec.h:94
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5715
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5688
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5743
#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 5851 of file iparith.cc.

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

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5900 of file iparith.cc.

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

◆ jjBRACK_S()

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

Definition at line 5672 of file iparith.cc.

5673{
5674 char *s= (char *)u->Data();
5675 int r = (int)(long)v->Data();
5676 int c = (int)(long)w->Data();
5677 int l = strlen(s);
5678
5679 if ( (r<1) || (r>l) || (c<0) )
5680 {
5681 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5682 return TRUE;
5683 }
5684 res->data = (char *)omAlloc((long)(c+1));
5685 sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5686 return FALSE;
5687}
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ jjBRACK_SM()

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

Definition at line 5772 of file iparith.cc.

5773{
5774 ideal m= (ideal)u->Data();
5775 int r = (int)(long)v->Data();
5776 int c = (int)(long)w->Data();
5777 //Print("gen. elem %d, %d\n",r,c);
5778 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5779 {
5780 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5781 (int)m->rank,IDELEMS(m));
5782 return TRUE;
5783 }
5784 res->data=u->data; u->data=NULL;
5785 res->rtyp=u->rtyp; u->rtyp=0;
5786 res->name=u->name; u->name=NULL;
5787 Subexpr e=jjMakeSub(v);
5788 e->next=jjMakeSub(w);
5789 if (u->e==NULL)
5790 res->e=e;
5791 else
5792 {
5793 Subexpr h=u->e;
5794 while (h->next!=NULL) h=h->next;
5795 h->next=e;
5796 res->e=u->e;
5797 u->e=NULL;
5798 }
5799 return FALSE;
5800}

◆ jjBRACKET()

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

Definition at line 2883 of file iparith.cc.

2884{
2885 res->data=NULL;
2886
2888 {
2889 const poly q = (poly)b->Data();
2890
2891 if( q != NULL )
2892 {
2893 if( (poly)a->Data() != NULL )
2894 {
2896 {
2897 poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2898 res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2899 }
2900 else if (rIsLPRing(currRing))
2901 {
2902 const poly p = (poly)a->Data();
2903 res->data = pAdd(ppMult_qq(p,q), pNeg(ppMult_qq(q,p)));
2904 }
2905 }
2906 }
2907 }
2908 return FALSE;
2909}
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
#define pAdd(p, q)
Definition: polys.h:203
#define pNeg(p)
Definition: polys.h:198
#define ppMult_qq(p, q)
Definition: polys.h:208

◆ jjBRACKET_REC()

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

Definition at line 2910 of file iparith.cc.

2911{
2912 res->data=NULL;
2913
2915 {
2916 const poly q = (poly)b->Data();
2917 if(q != NULL)
2918 {
2919 if((poly)a->Data() != NULL)
2920 {
2921 const poly p = (poly)a->Data();
2922 int k=(int)(long)c->Data();
2923 if (k > 0)
2924 {
2925 poly qq = pCopy(q);
2926 for (int i = 0; i < k; i++)
2927 {
2928 poly qq_ref = qq;
2929 if (rIsLPRing(currRing))
2930 {
2931 qq = pAdd(ppMult_qq(p,qq), pNeg(ppMult_qq(qq,p)));
2932 }
2933 else if (rIsPluralRing(currRing))
2934 {
2935 qq = nc_p_Bracket_qq(pCopy(p), qq, currRing);
2936 }
2937 pDelete(&qq_ref);
2938 if (qq == NULL) break;
2939 }
2940 res->data = qq;
2941 }
2942 else
2943 {
2944 Werror("invalid number of iterations");
2945 }
2946 }
2947 }
2948 }
2949 return FALSE;
2950}
#define pDelete(p_ptr)
Definition: polys.h:186
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 7086 of file iparith.cc.

7087{
7088#ifdef HAVE_SDB
7089 sdb_show_bp();
7090#endif
7091 return FALSE;
7092}
void sdb_show_bp()
Definition: sdb.cc:57

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 7093 of file iparith.cc.

7094{
7095#ifdef HAVE_SDB
7096 if(v->Typ()==PROC_CMD)
7097 {
7098 int lineno=0;
7099 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7100 {
7101 lineno=(int)(long)v->next->Data();
7102 }
7103 return sdb_set_breakpoint(v->Name(),lineno);
7104 }
7105 return TRUE;
7106#else
7107 return FALSE;
7108#endif
7109}
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 7110 of file iparith.cc.

7111{
7112 return iiExprArith1(res,v,iiOp);
7113}

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3848 of file iparith.cc.

3849{
3850 return iiExprArithM(res,u,iiOp);
3851}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:9360

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7114 of file iparith.cc.

7115{
7116 leftv v=u->next;
7117 u->next=NULL;
7118 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7119 u->next=v;
7120 return b;
7121}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8870

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 7122 of file iparith.cc.

7123{
7124 leftv v = u->next;
7125 leftv w = v->next;
7126 u->next = NULL;
7127 v->next = NULL;
7128 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7129 u->next = v;
7130 v->next = w;
7131 return b;
7132}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:9269

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3852 of file iparith.cc.

3853{
3854 res->data = (char *)(long)rChar((ring)v->Data());
3855 return FALSE;
3856}
int rChar(ring r)
Definition: ring.cc:711

◆ jjCHINREM_BI()

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

Definition at line 1683 of file iparith.cc.

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

◆ jjCHINREM_ID()

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

Definition at line 9920 of file iparith.cc.

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

◆ jjCOEF()

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

Definition at line 1794 of file iparith.cc.

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

◆ jjCOEF_Id()

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

Definition at line 1801 of file iparith.cc.

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

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 7134 of file iparith.cc.

7135{
7136 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7137 if (iiCheckTypes(v,t,1))
7138 {
7139 idhdl c=(idhdl)v->next->next->data;
7140 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7141 idhdl m=(idhdl)v->next->next->next->data;
7142 idDelete((ideal *)&(c->data.uideal));
7143 idDelete((ideal *)&(m->data.uideal));
7144 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7145 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7146 return FALSE;
7147 }
7148 return TRUE;
7149}
Definition: idrec.h:35
utypes data
Definition: idrec.h:40
@ VECTOR_CMD
Definition: grammar.cc:292
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6566
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition: matpol.cc:581
idrec * idhdl
Definition: ring.h:21

◆ jjCOEFFS2_KB()

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

Definition at line 1819 of file iparith.cc.

1820{
1821 poly p = pInit();
1822 int i;
1823 for (i=1; i<=currRing->N; i++)
1824 {
1825 pSetExp(p, i, 1);
1826 }
1827 pSetm(p);
1828 res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1829 (ideal)(v->Data()), p);
1830 pLmFree(&p);
1831 return FALSE;
1832}
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2615
#define pSetm(p)
Definition: polys.h:271
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:70
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pSetExp(p, i, v)
Definition: polys.h:42

◆ jjCOEFFS3_Id()

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

Definition at line 5995 of file iparith.cc.

5996{
5997 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5998 {
5999 WerrorS("3rd argument must be a name of a matrix");
6000 return TRUE;
6001 }
6002 ideal i=(ideal)u->Data();
6003 int rank=(int)i->rank;
6004 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6005 if (r) return TRUE;
6006 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6007 return FALSE;
6008}
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1808
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition: matpol.cc:362
#define pVar(m)
Definition: polys.h:381

◆ jjCOEFFS3_KB()

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

Definition at line 6009 of file iparith.cc.

6010{
6011 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6012 (ideal)(v->Data()),(poly)(w->Data()));
6013 return FALSE;
6014}

◆ jjCOEFFS3_P()

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

Definition at line 6015 of file iparith.cc.

6016{
6017 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6018 {
6019 WerrorS("3rd argument must be a name of a matrix");
6020 return TRUE;
6021 }
6022 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6023 poly p=(poly)u->CopyD(POLY_CMD);
6024 ideal i=idInit(1,1);
6025 i->m[0]=p;
6026 sleftv t;
6027 t.Init();
6028 t.data=(char *)i;
6029 t.rtyp=IDEAL_CMD;
6030 int rank=1;
6031 if (u->Typ()==VECTOR_CMD)
6032 {
6033 i->rank=rank=pMaxComp(p);
6034 t.rtyp=MODUL_CMD;
6035 }
6036 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6037 t.CleanUp();
6038 if (r) return TRUE;
6039 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6040 return FALSE;
6041}
#define pMaxComp(p)
Definition: polys.h:299

◆ jjCOEFFS_Id()

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

Definition at line 1808 of file iparith.cc.

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

◆ jjCOLCOL()

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

Definition at line 695 of file iparith.cc.

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

◆ jjCOLON()

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

Definition at line 324 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3857 of file iparith.cc.

3858{
3859 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3860 return FALSE;
3861}

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3862 of file iparith.cc.

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

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3867 of file iparith.cc.

3868{
3869 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3870 return FALSE;
3871}

◆ jjCOMPARE_ALL()

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

Definition at line 10137 of file iparith.cc.

10138{
10139 leftv a=(leftv)aa;
10140 int at=a->Typ();
10141 leftv b=(leftv)bb;
10142 int bt=b->Typ();
10143 if (at < bt) return -1;
10144 if (at > bt) return 1;
10145 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10146 sleftv tmp;
10147 tmp.Init();
10148 iiOp='<';
10149 BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10150 if (bo)
10151 {
10152 Werror(" no `<` for %s",Tok2Cmdname(at));
10153 unsigned long ad=(unsigned long)a->Data();
10154 unsigned long bd=(unsigned long)b->Data();
10155 if (ad<bd) return -1;
10156 else if (ad==bd) return 0;
10157 else return 1;
10158 }
10159 else if (tmp.data==NULL) /* not < */
10160 {
10162 tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10164 if (bo)
10165 {
10166 Werror(" no `==` for %s",Tok2Cmdname(at));
10167 unsigned long ad=(unsigned long)a->Data();
10168 unsigned long bd=(unsigned long)b->Data();
10169 if (ad<bd) return -1;
10170 else if (ad==bd) return 0;
10171 else return 1;
10172 }
10173 else if (tmp.data==NULL) /* not <,== */ return 1;
10174 else return 0;
10175 }
10176 else return -1;
10177}
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 371 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 343 of file iparith.cc.

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

◆ jjCOMPARE_IV_I()

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

Definition at line 399 of file iparith.cc.

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

◆ jjCOMPARE_MA()

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

Definition at line 426 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 454 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 481 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3872 of file iparith.cc.

3873{
3874 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3875 poly p=(poly)v->CopyD(POLY_CMD);
3876 if (p!=NULL) p_Cleardenom(p, currRing);
3877 res->data = (char *)p;
3878 return FALSE;
3879}
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2906

◆ jjCONTRACT()

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

Definition at line 1833 of file iparith.cc.

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

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3880 of file iparith.cc.

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

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3885 of file iparith.cc.

3886{
3887 bigintmat* aa= (bigintmat *)v->Data();
3888 res->data = (char *)(long)(aa->rows()*aa->cols());
3889 return FALSE;
3890}

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3908 of file iparith.cc.

3909{
3910 res->data = (char *)(long)((intvec*)(v->Data()))->length();
3911 return FALSE;
3912}

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3896 of file iparith.cc.

3897{
3898 lists l=(lists)v->Data();
3899 res->data = (char *)(long)(lSize(l)+1);
3900 return FALSE;
3901}
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3902 of file iparith.cc.

3903{
3904 matrix m=(matrix)v->Data();
3905 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3906 return FALSE;
3907}

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3891 of file iparith.cc.

3892{
3893 res->data = (char *)(long)nSize((number)v->Data());
3894 return FALSE;
3895}

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5641 of file iparith.cc.

5642{
5643 res->data=(char *)(long)sySize((syStrategy)v->Data());
5644 return FALSE;
5645}
int sySize(syStrategy syzstr)
Definition: syz1.cc:1829

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3913 of file iparith.cc.

3914{
3915 ring r=(ring)v->Data();
3916 int elems=-1;
3917 if (rField_is_Zp(r)) elems=r->cf->ch;
3918 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3919 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3920 {
3921 extern int ipower ( int b, int n ); /* factory/cf_util */
3922 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3923 }
3924 res->data = (char *)(long)elems;
3925 return FALSE;
3926}
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:530
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:501
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:522

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3965 of file iparith.cc.

3966{
3967 if ((v->rtyp==IDHDL)
3968 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
3969 {
3970 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
3971 }
3972 else if (v->rtyp!=0) res->data=(void *)(-1);
3973 return FALSE;
3974}
#define IDLEV(a)
Definition: ipid.h:121

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3927 of file iparith.cc.

3928{
3929 int dummy;
3930 poly p=(poly)v->Data();
3931 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3932 else res->data=(char *)-1;
3933 return FALSE;
3934}

◆ jjDEG_IV()

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

Definition at line 1849 of file iparith.cc.

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

3936{
3937 ideal I=(ideal)u->Data();
3938 int d=-1;
3939 int dummy;
3940 int i;
3941 for(i=IDELEMS(I)-1;i>=0;i--)
3942 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3943 res->data = (char *)(long)d;
3944 return FALSE;
3945}
static int si_max(const int a, const int b)
Definition: auxiliary.h:124

◆ jjDEG_M_IV()

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

Definition at line 1838 of file iparith.cc.

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

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3946 of file iparith.cc.

3947{
3948 SPrintStart();
3949#ifdef HAVE_RINGS
3950 if (rField_is_Z(currRing))
3951 {
3952 PrintS("// NOTE: computation of degree is being performed for\n");
3953 PrintS("// generic fibre, that is, over Q\n");
3954 }
3955#endif
3957 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3958 scDegree((ideal)v->Data(),module_w,currRing->qideal);
3959 char *s=SPrintEnd();
3960 int l=strlen(s)-1;
3961 s[l]='\0';
3962 res->data=(void*)s;
3963 return FALSE;
3964}
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:895
void SPrintStart()
Definition: reporter.cc:246
void PrintS(const char *s)
Definition: reporter.cc:284
char * SPrintEnd()
Definition: reporter.cc:273
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1536

◆ jjDelete_ID()

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

Definition at line 1870 of file iparith.cc.

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

◆ jjDelete_IV()

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

Definition at line 1863 of file iparith.cc.

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

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

Return the denominator of the input number.

Definition at line 3977 of file iparith.cc.

3978{
3979 number n = reinterpret_cast<number>(v->CopyD());
3980 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
3981 n_Delete(&n,currRing->cf);
3982 return FALSE;
3983}
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:603

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 3994 of file iparith.cc.

3995{
3996 matrix m=(matrix)v->Data();
3997 res ->data = mp_Det(m,currRing);
3998 return FALSE;
3999}
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition: matpol.cc:2143

◆ jjDET2()

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

Definition at line 1877 of file iparith.cc.

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

◆ jjDET2_S()

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

Definition at line 1884 of file iparith.cc.

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

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 4000 of file iparith.cc.

4001{
4002 bigintmat * m=(bigintmat*)v->Data();
4003 int i,j;
4004 i=m->rows();j=m->cols();
4005 if(i==j)
4006 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4007 else
4008 {
4009 Werror("det of %d x %d bigintmat",i,j);
4010 return TRUE;
4011 }
4012 return FALSE;
4013}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1775
int j
Definition: facHensel.cc:110

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 4036 of file iparith.cc.

4037{
4038 intvec * m=(intvec*)v->Data();
4039 int i,j;
4040 i=m->rows();j=m->cols();
4041 if(i==j)
4042 res->data = (char *)(long)singclap_det_i(m,currRing);
4043 else
4044 {
4045 Werror("det of %d x %d intmat",i,j);
4046 return TRUE;
4047 }
4048 return FALSE;
4049}
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1757

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 4050 of file iparith.cc.

4051{
4052 ideal I=(ideal)v->Data();
4053 res->data=(char*)sm_Det(I,currRing);
4054 return FALSE;
4055}

◆ jjDIFF_COEF()

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

Definition at line 4424 of file iparith.cc.

4425{
4426 if (!nCoeff_is_transExt(currRing->cf))
4427 {
4428 WerrorS("differentiation not defined in the coefficient ring");
4429 return TRUE;
4430 }
4431 number n = (number) u->Data();
4432 number k = (number) v->Data();
4433 res->data = ntDiff(n,k,currRing->cf);
4434 return FALSE;
4435}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:918
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 1902 of file iparith.cc.

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

◆ jjDIFF_ID_ID()

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

Definition at line 1913 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1891 of file iparith.cc.

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

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 4056 of file iparith.cc.

4057{
4059#ifdef HAVE_SHIFTBBA
4060 if (rIsLPRing(currRing))
4061 {
4062#ifdef HAVE_RINGS
4064 {
4065 WerrorS("`dim` is not implemented for letterplace rings over rings");
4066 return TRUE;
4067 }
4068#endif
4069 if (currRing->qideal != NULL)
4070 {
4071 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4072 return TRUE;
4073 }
4074 int gkDim = lp_gkDim((ideal)(v->Data()));
4075 res->data = (char *)(long)gkDim;
4076 return (gkDim == -2);
4077 }
4078#endif
4080 {
4081 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4082 }
4083 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4084 return FALSE;
4085}
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition: hdegree.cc:135
int lp_gkDim(const ideal _G)
Definition: hdegree.cc:1840
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:762

◆ jjDIM2()

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

Definition at line 1918 of file iparith.cc.

1919{
1922 {
1923 Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1924 }
1925 if(currRing->qideal==NULL)
1926 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),(ideal)w->Data()));
1927 else
1928 {
1929 ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1930 res->data = (char *)((long)scDimIntRing((ideal)(v->Data()),q));
1931 idDelete(&q);
1932 }
1933 return FALSE;
1934}
#define idSimpleAdd(A, B)
Definition: ideals.h:42

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5646 of file iparith.cc.

5647{
5648 res->data = (char *)(long)syDim((syStrategy)v->Data());
5649 return FALSE;
5650}
int syDim(syStrategy syzstr)
Definition: syz1.cc:1849

◆ jjDIV_BI()

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

Definition at line 1251 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1295 of file iparith.cc.

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

◆ jjDIV_N()

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

Definition at line 1264 of file iparith.cc.

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

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

◆ jjDIVISION()

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

Definition at line 1935 of file iparith.cc.

1936{
1937 ideal vi=(ideal)v->Data();
1938 int vl= IDELEMS(vi);
1939 ideal ui=(ideal)u->Data();
1940 unsigned ul= IDELEMS(ui);
1941 ideal R; matrix U;
1942 ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1943 if (m==NULL) return TRUE;
1944 // now make sure that all matrices have the correct size:
1946 int i;
1947 assume (MATCOLS(U) == (int)ul);
1949 L->Init(3);
1950 L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1951 L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1952 L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1953 res->data=(char *)L;
1954 return FALSE;
1955}
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
represents the generators of submod in terms of the generators of mod (Matrix(SM)*U-Matrix(rest)) = M...
Definition: ideals.cc:1105
#define hasFlag(A, F)
Definition: ipid.h:112
#define FLAG_STD
Definition: ipid.h:106
STATIC_VAR jList * T
Definition: janet.cc:30
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition: sirandom.c:27

◆ jjDIVISION4()

static BOOLEAN jjDIVISION4 ( leftv  res,
leftv  v 
)
static

Definition at line 7151 of file iparith.cc.

7152{ // may have 3 or 4 arguments
7153 leftv v1=v;
7154 leftv v2=v1->next;
7155 leftv v3=v2->next;
7156 leftv v4=v3->next;
7157 assumeStdFlag(v2);
7158
7159 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7160 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7161
7162 if((i1==0)||(i2==0)
7163 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7164 {
7165 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7166 return TRUE;
7167 }
7168
7169 sleftv w1,w2;
7170 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7171 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7172 ideal P=(ideal)w1.Data();
7173 ideal Q=(ideal)w2.Data();
7174
7175 int n=(int)(long)v3->Data();
7176 int *w=NULL;
7177 if(v4!=NULL)
7178 {
7179 w = iv2array((intvec *)v4->Data(),currRing);
7180 int * w0 = w + 1;
7181 int i = currRing->N;
7182 while( (i > 0) && ((*w0) > 0) )
7183 {
7184 w0++;
7185 i--;
7186 }
7187 if(i>0)
7188 WarnS("not all weights are positive!");
7189 }
7190
7191 matrix T;
7192 ideal R;
7193 idLiftW(P,Q,n,T,R,w);
7194
7195 w1.CleanUp();
7196 w2.CleanUp();
7197 if(w!=NULL)
7198 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7199
7201 L->Init(2);
7202 L->m[1].rtyp=v1->Typ();
7203 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7204 {
7205 if(v1->Typ()==POLY_CMD)
7206 p_Shift(&R->m[0],-1,currRing);
7207 L->m[1].data=(void *)R->m[0];
7208 R->m[0]=NULL;
7209 idDelete(&R);
7210 }
7211 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7212 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7213 else
7214 {
7215 L->m[1].rtyp=MODUL_CMD;
7216 L->m[1].data=(void *)R;
7217 }
7218 L->m[0].rtyp=MATRIX_CMD;
7219 L->m[0].data=(char *)T;
7220
7221 res->data=L;
7222
7223 return FALSE;
7224}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition: ideals.cc:1324
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 1228 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 337 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3680 of file iparith.cc.

3681{
3682// res->data = (char *)u->CopyD();
3683// also copy attributes:
3684 res->Copy(u);
3685 return FALSE;
3686}

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4086 of file iparith.cc.

4087{
4088 si_link l = (si_link)v->Data();
4089 if (slDump(l))
4090 {
4091 const char *s;
4092 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4093 else s=sNoName_fe;
4094 Werror("cannot dump to `%s`",s);
4095 return TRUE;
4096 }
4097 else
4098 return FALSE;
4099}

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 4100 of file iparith.cc.

4101{
4102 res->data = (char *)pOne();
4103 int co=(int)(long)v->Data();
4104 if (co>0)
4105 {
4106 pSetComp((poly)res->data,co);
4107 pSetm((poly)res->data);
4108 }
4109 else WerrorS("argument of gen must be positive");
4110 return (co<=0);
4111}
#define pSetComp(p, v)
Definition: polys.h:38
#define pOne()
Definition: polys.h:315

◆ jjELIMIN()

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

Definition at line 1956 of file iparith.cc.

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

◆ jjELIMIN_ALG()

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

Definition at line 6042 of file iparith.cc.

6043{
6044 ideal I=(ideal)u->Data();
6045 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6046 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6047 //setFlag(res,FLAG_STD);
6048 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6049}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3148
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6050 of file iparith.cc.

6051{
6052 res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
6053 (intvec *)w->Data());
6054 //setFlag(res,FLAG_STD);
6055 return FALSE;
6056}

◆ jjELIMIN_IV()

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

Definition at line 1962 of file iparith.cc.

1963{
1964 poly p=pOne();
1965 intvec *iv=(intvec*)v->Data();
1966 for(int i=iv->length()-1; i>=0; i--)
1967 {
1968 pSetExp(p,(*iv)[i],1);
1969 }
1970 pSetm(p);
1971 res->data=(char *)idElimination((ideal)u->Data(),p);
1972 pLmDelete(&p);
1973 //setFlag(res,FLAG_STD);
1974 return FALSE;
1975}
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76

◆ jjENVELOPE()

static BOOLEAN jjENVELOPE ( leftv  res,
leftv  a 
)
static

Definition at line 5215 of file iparith.cc.

5216{
5217#ifdef HAVE_PLURAL
5218 ring r = (ring)a->Data();
5219 if (rIsPluralRing(r))
5220 {
5221 ring s = rEnvelope(r);
5222 res->data = s;
5223 }
5224 else res->data = rCopy(r);
5225 return FALSE;
5226#else
5227 return TRUE;
5228#endif
5229}
ring rEnvelope(ring R)
Definition: ring.cc:5633
ring rCopy(ring r)
Definition: ring.cc:1645

◆ jjEQUAL_BI()

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

Definition at line 1324 of file iparith.cc.

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

◆ jjEQUAL_I()

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

Definition at line 1330 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1336 of file iparith.cc.

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

◆ jjEQUAL_N()

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

Definition at line 1354 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1360 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1348 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1368 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1342 of file iparith.cc.

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

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 1981 of file iparith.cc.

1982{
1983 WerrorS((char *)u->Data());
1984 EXTERN_VAR int inerror;
1985 inerror=3;
1986 return TRUE;
1987}
#define EXTERN_VAR
Definition: globaldefs.h:6
EXTERN_VAR int inerror

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 4112 of file iparith.cc.

4113{
4114 char * d = (char *)v->Data();
4115 char * s = (char *)omAlloc(strlen(d) + 13);
4116 strcpy( s, (char *)d);
4117 strcat( s, "\n;RETURN();\n");
4119 return yyparse();
4120}
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:164
@ BT_execute
Definition: fevoices.h:23
int yyparse(void)
Definition: grammar.cc:2111

◆ jjEXPORTTO()

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

Definition at line 1976 of file iparith.cc.

1977{
1978 //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1979 return iiExport(v,0,IDPACKAGE((idhdl)u->data));
1980}
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1515

◆ jjEXTGCD_BI()

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

Definition at line 1988 of file iparith.cc.

1989{
1990 number uu=(number)u->Data();number vv=(number)v->Data();
1992 number a,b;
1993 number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
1994 L->Init(3);
1995 L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
1996 L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
1997 L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
1998 res->rtyp=LIST_CMD;
1999 res->data=(char *)L;
2000 return FALSE;
2001}
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:671

◆ jjEXTGCD_I()

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

Definition at line 2002 of file iparith.cc.

2003{
2004 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2005 int p0=ABS(uu),p1=ABS(vv);
2006 int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
2007
2008 while ( p1!=0 )
2009 {
2010 q=p0 / p1;
2011 r=p0 % p1;
2012 p0 = p1; p1 = r;
2013 r = g0 - g1 * q;
2014 g0 = g1; g1 = r;
2015 r = f0 - f1 * q;
2016 f0 = f1; f1 = r;
2017 }
2018 int a = f0;
2019 int b = g0;
2020 if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
2021 if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
2023 L->Init(3);
2024 L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
2025 L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
2026 L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
2027 res->data=(char *)L;
2028 return FALSE;
2029}
static int ABS(int v)
Definition: auxiliary.h:112

◆ jjEXTGCD_P()

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

Definition at line 2030 of file iparith.cc.

2031{
2032 poly r,pa,pb;
2033 BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
2034 if (ret) return TRUE;
2036 L->Init(3);
2037 res->data=(char *)L;
2038 L->m[0].data=(void *)r;
2039 L->m[0].rtyp=POLY_CMD;
2040 L->m[1].data=(void *)pa;
2041 L->m[1].rtyp=POLY_CMD;
2042 L->m[2].data=(void *)pb;
2043 L->m[2].rtyp=POLY_CMD;
2044 return FALSE;
2045}
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition: clapsing.cc:466
BOOLEAN pb(leftv res, leftv args)
Definition: cohomo.cc:4371

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 4161 of file iparith.cc.

4162{
4163 intvec *v=NULL;
4165 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4166 if (f==NULL) return TRUE;
4167 ivTest(v);
4169 l->Init(2);
4170 l->m[0].rtyp=IDEAL_CMD;
4171 l->m[0].data=(void *)f;
4172 l->m[1].rtyp=INTVEC_CMD;
4173 l->m[1].data=(void *)v;
4174 res->data=(void *)l;
4175 return FALSE;
4176}
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:925
#define ivTest(v)
Definition: intvec.h:158
EXTERN_VAR int singclap_factorize_retry
Definition: iparith.cc:2046

◆ jjFAC_P2()

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

Definition at line 2047 of file iparith.cc.

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

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4121 of file iparith.cc.

4122{
4124 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4125 {
4126 ideal_list p,h;
4127 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4128 if (h==NULL)
4129 {
4130 L->Init(1);
4131 L->m[0].data=(char *)idInit(1);
4132 L->m[0].rtyp=IDEAL_CMD;
4133 }
4134 else
4135 {
4136 p=h;
4137 int l=0;
4138 while (p!=NULL) { p=p->next;l++; }
4139 L->Init(l);
4140 l=0;
4141 while(h!=NULL)
4142 {
4143 L->m[l].data=(char *)h->d;
4144 L->m[l].rtyp=IDEAL_CMD;
4145 p=h->next;
4146 omFreeSize(h,sizeof(*h));
4147 h=p;
4148 l++;
4149 }
4150 }
4151 }
4152 else
4153 {
4154 WarnS("no factorization implemented");
4155 L->Init(1);
4156 iiExprArith1(&(L->m[0]),v,STD_CMD);
4157 }
4158 res->data=(void *)L;
4159 return FALSE;
4160}
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition: kstdfac.cc:798
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition: numbers.cc:276
@ testHomog
Definition: structs.h:38
@ STD_CMD
Definition: tok.h:184

◆ jjFACSTD2()

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

Definition at line 2094 of file iparith.cc.

2095{
2096 ideal_list p,h;
2097 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2098 p=h;
2099 int l=0;
2100 while (p!=NULL) { p=p->next;l++; }
2102 L->Init(l);
2103 l=0;
2104 while(h!=NULL)
2105 {
2106 L->m[l].data=(char *)h->d;
2107 L->m[l].rtyp=IDEAL_CMD;
2108 p=h->next;
2109 omFreeSize(h,sizeof(*h));
2110 h=p;
2111 l++;
2112 }
2113 res->data=(void *)L;
2114 return FALSE;
2115}

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 8352 of file iparith.cc.

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

◆ jjFAREY_BI()

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

Definition at line 2116 of file iparith.cc.

2117{
2118 if (rField_is_Q(currRing))
2119 {
2120 number uu=(number)u->Data();
2121 number vv=(number)v->Data();
2122 res->data=(char *)n_Farey(uu,vv,currRing->cf);
2123 return FALSE;
2124 }
2125 else return TRUE;
2126}
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:767

◆ jjFAREY_ID()

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

Definition at line 2127 of file iparith.cc.

2128{
2129 ideal uu=(ideal)u->Data();
2130 number vv=(number)v->Data();
2131 //timespec buf1,buf2;
2132 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2133 #if 1
2134 #ifdef HAVE_VSPACE
2135 int cpus = (long) feOptValue(FE_OPT_CPUS);
2136 if ((cpus>1) && (rField_is_Q(currRing)))
2137 res->data=(void*)id_Farey_0(uu,vv,currRing);
2138 else
2139 #endif
2140 #endif
2141 res->data=(void*)id_Farey(uu,vv,currRing);
2142 //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2143 //const unsigned long SEC = 1000L*1000L*1000L;
2144 //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2145 // buf2.tv_nsec-buf1.tv_nsec);
2146 //farey_cnt++;
2147 return FALSE;
2148}
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2842
ideal id_Farey_0(ideal x, number N, const ring r)
Definition: kChinese.cc:295

◆ jjFAREY_LI()

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

Definition at line 10118 of file iparith.cc.

10119{
10120 lists c=(lists)u->CopyD();
10122 res_l->Init(c->nr+1);
10123 BOOLEAN bo=FALSE;
10124 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10125 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10126 {
10127 sleftv tmp;
10128 tmp.Copy(v);
10129 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10130 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10131 }
10132 c->Clean();
10133 res->data=res_l;
10134 return bo;
10135}
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2150 of file iparith.cc.

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

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 7294 of file iparith.cc.

7295{
7296 ring r=(ring)u->Data();
7297 leftv v=u->next;
7298 leftv perm_var_l=v->next;
7299 leftv perm_par_l=v->next->next;
7300 if ((perm_var_l->Typ()!=INTVEC_CMD)
7301 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7302 ||(u->Typ()!=RING_CMD))
7303 {
7304 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7305 return TRUE;
7306 }
7307 intvec *perm_var_v=(intvec*)perm_var_l->Data();
7308 intvec *perm_par_v=NULL;
7309 if (perm_par_l!=NULL)
7310 perm_par_v=(intvec*)perm_par_l->Data();
7311 idhdl w;
7312 nMapFunc nMap;
7313
7314 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7315 {
7316 int *perm=NULL;
7317 int *par_perm=NULL;
7318 int par_perm_size=0;
7319 BOOLEAN bo;
7320 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7321 {
7322 // Allow imap/fetch to be make an exception only for:
7323 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7324 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7325 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7326 {
7327 par_perm_size=rPar(r);
7328 }
7329 else
7330 {
7331 goto err_fetch;
7332 }
7333 }
7334 else
7335 par_perm_size=rPar(r);
7336 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7337 if (par_perm_size!=0)
7338 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7339 int i;
7340 if (perm_par_l==NULL)
7341 {
7342 if (par_perm_size!=0)
7343 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7344 }
7345 else
7346 {
7347 if (par_perm_size==0) WarnS("source ring has no parameters");
7348 else
7349 {
7350 for(i=rPar(r)-1;i>=0;i--)
7351 {
7352 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7353 if ((par_perm[i]<-rPar(currRing))
7354 || (par_perm[i]>rVar(currRing)))
7355 {
7356 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7357 par_perm[i]=0;
7358 }
7359 }
7360 }
7361 }
7362 for(i=rVar(r)-1;i>=0;i--)
7363 {
7364 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7365 if ((perm[i]<-rPar(currRing))
7366 || (perm[i]>rVar(currRing)))
7367 {
7368 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7369 perm[i]=0;
7370 }
7371 }
7372 if (BVERBOSE(V_IMAP))
7373 {
7374 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7375 {
7376 if (perm[i]>0)
7377 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7378 else if (perm[i]<0)
7379 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7380 }
7381 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7382 {
7383 if (par_perm[i-1]<0)
7384 Print("// par nr %d: %s -> par %s\n",
7385 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7386 else if (par_perm[i-1]>0)
7387 Print("// par nr %d: %s -> var %s\n",
7388 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7389 }
7390 }
7391 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7392 sleftv tmpW;
7393 tmpW.Init();
7394 tmpW.rtyp=IDTYP(w);
7395 tmpW.data=IDDATA(w);
7396 if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7397 perm,par_perm,par_perm_size,nMap)))
7398 {
7399 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7400 }
7401 if (perm!=NULL)
7402 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7403 if (par_perm!=NULL)
7404 omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7405 return bo;
7406 }
7407 else
7408 {
7409 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7410 }
7411 return TRUE;
7412err_fetch:
7413 char *s1=nCoeffString(r->cf);
7414 char *s2=nCoeffString(currRing->cf);
7415 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7416 omFree(s2);omFree(s1);
7417 return TRUE;
7418}
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 2278 of file iparith.cc.

2279{
2280 /*4
2281 * look for the substring what in the string where
2282 * return the position of the first char of what in where
2283 * or 0
2284 */
2285 char *where=(char *)u->Data();
2286 char *what=(char *)v->Data();
2287 char *found = strstr(where,what);
2288 if (found != NULL)
2289 {
2290 res->data=(char *)((found-where)+1);
2291 }
2292 /*else res->data=NULL;*/
2293 return FALSE;
2294}
bool found
Definition: facFactorize.cc:55

◆ jjFIND3()

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

Definition at line 6057 of file iparith.cc.

6058{
6059 /*4
6060 * look for the substring what in the string where
6061 * starting at position n
6062 * return the position of the first char of what in where
6063 * or 0
6064 */
6065 int n=(int)(long)w->Data();
6066 char *where=(char *)u->Data();
6067 char *what=(char *)v->Data();
6068 char *found;
6069 if ((1>n)||(n>(int)strlen(where)))
6070 {
6071 Werror("start position %d out of range",n);
6072 return TRUE;
6073 }
6074 found = strchr(where+n-1,*what);
6075 if (*(what+1)!='\0')
6076 {
6077 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6078 {
6079 found=strchr(found+1,*what);
6080 }
6081 }
6082 if (found != NULL)
6083 {
6084 res->data=(char *)((found-where)+1);
6085 }
6086 return FALSE;
6087}

◆ jjFRES()

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

Definition at line 2333 of file iparith.cc.

2334{
2335 leftv w = (leftv)omAlloc0(sizeof(sleftv));
2336 w->rtyp = STRING_CMD;
2337 w->data = (char *)"complete"; // default
2338 BOOLEAN RES = jjFRES3(res, u, v, w);
2339 omFree(w);
2340 return RES;
2341}
static BOOLEAN jjFRES3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:2296

◆ jjFRES3()

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

Definition at line 2296 of file iparith.cc.

2297{
2298 assumeStdFlag(u);
2299 ideal id = (ideal)u->Data();
2300 int max_length = (int)(long)v->Data();
2301 if (max_length < 0)
2302 {
2303 WerrorS("length for fres must not be negative");
2304 return TRUE;
2305 }
2306 if (max_length == 0)
2307 {
2308 max_length = currRing->N+1;
2309 if (currRing->qideal != NULL)
2310 {
2311 Warn("full resolution in a qring may be infinite, "
2312 "setting max length to %d", max_length);
2313 }
2314 }
2315 char *method = (char *)w->Data();
2316 /* For the moment, only "complete" (default), "frame", or "extended frame"
2317 * are allowed. Another useful option would be "linear strand".
2318 */
2319 if (strcmp(method, "complete") != 0
2320 && strcmp(method, "frame") != 0
2321 && strcmp(method, "extended frame") != 0
2322 && strcmp(method, "single module") != 0)
2323 {
2324 WerrorS("wrong optional argument for fres");
2325 return TRUE;
2326 }
2327 syStrategy r = syFrank(id, max_length, method);
2328 assume(r->fullres != NULL);
2329 res->data = (void *)r;
2330 return FALSE;
2331}
resolvente fullres
Definition: syz.h:57
syStrategy syFrank(const ideal arg, const int length, const char *method, const bool use_cache=true, const bool use_tensor_trick=false)
Definition: syz4.cc:822

◆ jjFWALK()

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

Definition at line 2343 of file iparith.cc.

2344{
2345 res->data=(char *)fractalWalkProc(u,v);
2346 setFlag( res, FLAG_STD );
2347 return FALSE;
2348}
#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 6088 of file iparith.cc.

6089{
6090 if ((int)(long)w->Data()==0)
6091 res->data=(char *)walkProc(u,v);
6092 else
6093 res->data=(char *)fractalWalkProc(u,v);
6094 setFlag( res, FLAG_STD );
6095 return FALSE;
6096}
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 2362 of file iparith.cc.

2363{
2364 number n1 = (number) u->Data();
2365 number n2 = (number) v->Data();
2366 res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2367 return FALSE;
2368}
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:664

◆ jjGCD_I()

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

Definition at line 2349 of file iparith.cc.

2350{
2351 int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2352 int p0=ABS(uu),p1=ABS(vv);
2353 int r;
2354 while ( p1!=0 )
2355 {
2356 r=p0 % p1;
2357 p0 = p1; p1 = r;
2358 }
2359 res->data=(char *)(long)p0;
2360 return FALSE;
2361}

◆ jjGCD_N()

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

Definition at line 2369 of file iparith.cc.

2370{
2371 number a=(number) u->Data();
2372 number b=(number) v->Data();
2373 if (nIsZero(a))
2374 {
2375 if (nIsZero(b)) res->data=(char *)nInit(1);
2376 else res->data=(char *)nCopy(b);
2377 }
2378 else
2379 {
2380 if (nIsZero(b)) res->data=(char *)nCopy(a);
2381 //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2382 else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2383 }
2384 return FALSE;
2385}
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:666
#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 2386 of file iparith.cc.

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

◆ jjGE_BI()

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

Definition at line 1167 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1174 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1179 of file iparith.cc.

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

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 4177 of file iparith.cc.

4178{
4179 si_link l = (si_link)v->Data();
4180 if (slGetDump(l))
4181 {
4182 const char *s;
4183 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4184 else s=sNoName_fe;
4185 Werror("cannot get dump from `%s`",s);
4186 return TRUE;
4187 }
4188 else
4189 return FALSE;
4190}

◆ jjGT_BI()

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

Definition at line 1185 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1192 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1197 of file iparith.cc.

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

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 4191 of file iparith.cc.

4192{
4194 ideal I=(ideal)v->Data();
4195 res->data=(void *)iiHighCorner(I,0);
4196 return FALSE;
4197}
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1610

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 4198 of file iparith.cc.

4199{
4201 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4202 BOOLEAN delete_w=FALSE;
4203 ideal I=(ideal)v->Data();
4204 int i;
4205 poly p=NULL,po=NULL;
4206 int rk=id_RankFreeModule(I,currRing);
4207 if (w==NULL)
4208 {
4209 w = new intvec(rk);
4210 delete_w=TRUE;
4211 }
4212 for(i=rk;i>0;i--)
4213 {
4214 p=iiHighCorner(I,i);
4215 if (p==NULL)
4216 {
4217 WerrorS("module must be zero-dimensional");
4218 if (delete_w) delete w;
4219 return TRUE;
4220 }
4221 if (po==NULL)
4222 {
4223 po=p;
4224 }
4225 else
4226 {
4227 // now po!=NULL, p!=NULL
4228 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4229 if (d==0)
4230 d=pLmCmp(po,p);
4231 if (d > 0)
4232 {
4233 pDelete(&p);
4234 }
4235 else // (d < 0)
4236 {
4237 pDelete(&po); po=p;
4238 }
4239 }
4240 }
4241 if (delete_w) delete w;
4242 res->data=(void *)po;
4243 return FALSE;
4244}
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s

◆ jjHILBERT()

static BOOLEAN jjHILBERT ( leftv  ,
leftv  v 
)
static

Definition at line 4245 of file iparith.cc.

4246{
4247#ifdef HAVE_RINGS
4248 if (rField_is_Z(currRing))
4249 {
4250 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4251 PrintS("// performed for generic fibre, that is, over Q\n");
4252 }
4253#endif
4255 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4256 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4257 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4258 return FALSE;
4259}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1462

◆ jjHILBERT2()

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

Definition at line 2392 of file iparith.cc.

2393{
2394#ifdef HAVE_RINGS
2395 if (rField_is_Z(currRing))
2396 {
2397 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2398 PrintS("// performed for generic fibre, that is, over Q\n");
2399 }
2400#endif
2401 assumeStdFlag(u);
2402 intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2403 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2404 if (errorreported) return TRUE;
2405
2406 switch((int)(long)v->Data())
2407 {
2408 case 1:
2409 res->data=(void *)iv;
2410 return FALSE;
2411 case 2:
2412 res->data=(void *)hSecondSeries(iv);
2413 delete iv;
2414 return FALSE;
2415 }
2416 delete iv;
2418 return TRUE;
2419}
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1383
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1373
const char feNotImplemented[]
Definition: reporter.cc:54

◆ jjHILBERT3()

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

Definition at line 6097 of file iparith.cc.

6098{
6099 intvec *wdegree=(intvec*)w->Data();
6100 if (wdegree->length()!=currRing->N)
6101 {
6102 Werror("weight vector must have size %d, not %d",
6103 currRing->N,wdegree->length());
6104 return TRUE;
6105 }
6106#ifdef HAVE_RINGS
6107 if (rField_is_Z(currRing))
6108 {
6109 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6110 PrintS("// performed for generic fibre, that is, over Q\n");
6111 }
6112#endif
6113 assumeStdFlag(u);
6114 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6115 intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
6116 if (errorreported) return TRUE;
6117
6118 switch((int)(long)v->Data())
6119 {
6120 case 1:
6121 res->data=(void *)iv;
6122 return FALSE;
6123 case 2:
6124 res->data=(void *)hSecondSeries(iv);
6125 delete iv;
6126 return FALSE;
6127 }
6128 delete iv;
6130 return TRUE;
6131}

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4260 of file iparith.cc.

4261{
4262#ifdef HAVE_RINGS
4263 if (rField_is_Z(currRing))
4264 {
4265 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4266 PrintS("// performed for generic fibre, that is, over Q\n");
4267 }
4268#endif
4269 res->data=(void *)hSecondSeries((intvec *)v->Data());
4270 return FALSE;
4271}

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4272 of file iparith.cc.

4273{
4274 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4275 ideal v_id=(ideal)v->Data();
4276 if (w==NULL)
4277 {
4278 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4279 if (res->data!=NULL)
4280 {
4281 if (v->rtyp==IDHDL)
4282 {
4283 char *s_isHomog=omStrDup("isHomog");
4284 if (v->e==NULL)
4285 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4286 else
4287 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4288 }
4289 else if (w!=NULL) delete w;
4290 } // if res->data==NULL then w==NULL
4291 }
4292 else
4293 {
4294 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4295 if((res->data==NULL) && (v->rtyp==IDHDL))
4296 {
4297 if (v->e==NULL)
4298 atKill((idhdl)(v->data),"isHomog");
4299 else
4300 atKill((idhdl)(v->LData()),"isHomog");
4301 }
4302 }
4303 return FALSE;
4304}
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:2063
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 2459 of file iparith.cc.

2460{
2461 intvec *w=new intvec(rVar(currRing));
2462 intvec *vw=(intvec*)u->Data();
2463 ideal v_id=(ideal)v->Data();
2464 pFDegProc save_FDeg=currRing->pFDeg;
2465 pLDegProc save_LDeg=currRing->pLDeg;
2466 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2467 currRing->pLexOrder=FALSE;
2468 kHomW=vw;
2469 kModW=w;
2471 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2472 currRing->pLexOrder=save_pLexOrder;
2473 kHomW=NULL;
2474 kModW=NULL;
2475 pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2476 if (w!=NULL) delete w;
2477 return FALSE;
2478}
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2420
VAR intvec * kHomW
Definition: kstd1.cc:2408
VAR intvec * kModW
Definition: kstd1.cc:2408
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3723
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3711
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:38
long(* pLDegProc)(poly p, int *length, ring r)
Definition: ring.h:37

◆ jjHOMOG_ID()

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

Definition at line 2437 of file iparith.cc.

2438{
2439 int i=pVar((poly)v->Data());
2440 if (i==0)
2441 {
2442 WerrorS("ringvar expected");
2443 return TRUE;
2444 }
2445 pFDegProc deg;
2446 if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2447 deg=p_Totaldegree;
2448 else
2449 deg=currRing->pFDeg;
2450 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2451 int d=deg(p,currRing);
2452 pLmDelete(p);
2453 if (d==1)
2454 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2455 else
2456 WerrorS("variable must have weight 1");
2457 return (d!=1);
2458}
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1479
@ ringorder_lp
Definition: ring.h:77
ideal id_Homogen(ideal h, int varnum, const ring r)

◆ jjHOMOG_ID_W()

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

Definition at line 6132 of file iparith.cc.

6133{
6134 PrintS("TODO\n");
6135 int i=pVar((poly)v->Data());
6136 if (i==0)
6137 {
6138 WerrorS("ringvar expected");
6139 return TRUE;
6140 }
6141 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6142 int d=pWTotaldegree(p);
6143 pLmDelete(p);
6144 if (d==1)
6145 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6146 else
6147 WerrorS("variable must have weight 1");
6148 return (d!=1);
6149}
#define pWTotaldegree(p)
Definition: polys.h:283

◆ jjHOMOG_P()

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

Definition at line 2420 of file iparith.cc.

2421{
2422 int i=pVar((poly)v->Data());
2423 if (i==0)
2424 {
2425 WerrorS("ringvar expected");
2426 return TRUE;
2427 }
2428 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2429 int d=pWTotaldegree(p);
2430 pLmDelete(p);
2431 if (d==1)
2432 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2433 else
2434 WerrorS("variable must have weight 1");
2435 return (d!=1);
2436}
poly p_Homogen(poly p, int varnum, const ring r)
Definition: p_polys.cc:3331

◆ jjHOMOG_P_W()

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

Definition at line 6150 of file iparith.cc.

6151{
6152 PrintS("TODO\n");
6153 int i=pVar((poly)v->Data());
6154 if (i==0)
6155 {
6156 WerrorS("ringvar expected");
6157 return TRUE;
6158 }
6159 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6160 int d=pWTotaldegree(p);
6161 pLmDelete(p);
6162 if (d==1)
6163 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6164 else
6165 WerrorS("variable must have weight 1");
6166 return (d!=1);
6167}

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4322 of file iparith.cc.

4323{
4324 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4325 IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4326 if (IDELEMS((ideal)mat)==0)
4327 {
4328 idDelete((ideal *)&mat);
4329 mat=(matrix)idInit(1,1);
4330 }
4331 else
4332 {
4333 MATROWS(mat)=1;
4334 mat->rank=1;
4335 idTest((ideal)mat);
4336 }
4337 res->data=(char *)mat;
4338 return FALSE;
4339}

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4340 of file iparith.cc.

4341{
4342 map m=(map)v->CopyD(MAP_CMD);
4343 omFree((ADDRESS)m->preimage);
4344 m->preimage=NULL;
4345 ideal I=(ideal)m;
4346 I->rank=1;
4347 res->data=(char *)I;
4348 return FALSE;
4349}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:504

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7250 of file iparith.cc.

7251{
7252 int s=1;
7253 leftv h=v;
7254 if (h!=NULL) s=exprlist_length(h);
7255 ideal id=idInit(s,1);
7256 int rank=1;
7257 int i=0;
7258 poly p;
7259 int dest_type=POLY_CMD;
7260 if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7261 while (h!=NULL)
7262 {
7263 // use standard type conversions to poly/vector
7264 int ri;
7265 int ht=h->Typ();
7266 if (ht==dest_type)
7267 {
7268 p=(poly)h->CopyD();
7269 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7270 }
7271 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7272 {
7273 sleftv tmp;
7274 leftv hnext=h->next;
7275 h->next=NULL;
7276 iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7277 h->next=hnext;
7278 p=(poly)tmp.data;
7279 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7280 }
7281 else
7282 {
7283 idDelete(&id);
7284 return TRUE;
7285 }
7286 id->m[i]=p;
7287 i++;
7288 h=h->next;
7289 }
7290 id->rank=rank;
7291 res->data=(char *)id;
7292 return FALSE;
7293}
int exprlist_length(leftv v)
Definition: ipshell.cc:552

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4350 of file iparith.cc.

4351{
4352 if (currRing!=NULL)
4353 {
4354 ring q=(ring)v->Data();
4355 if (rSamePolyRep(currRing, q))
4356 {
4357 if (q->qideal==NULL)
4358 res->data=(char *)idInit(1,1);
4359 else
4360 res->data=(char *)idCopy(q->qideal);
4361 return FALSE;
4362 }
4363 }
4364 WerrorS("can only get ideal from identical qring");
4365 return TRUE;
4366}
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:1713

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5568 of file iparith.cc.

5569{
5570 res->data = (char *)(long)idElem((ideal)v->Data());
5571 return FALSE;
5572}
int idElem(const ideal F)
count non-zero elements

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5573 of file iparith.cc.

5574{
5575 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5576 return FALSE;
5577}
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 5593 of file iparith.cc.

5594{
5595 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5597 return FALSE;
5598}
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 4305 of file iparith.cc.

4306{
4307#ifdef HAVE_SHIFTBBA
4308 if (rIsLPRing(currRing))
4309 {
4310 int deg = (int)(long)v->Data();
4311 if (deg > currRing->N/currRing->isLPring)
4312 {
4313 WerrorS("degree bound of Letterplace ring is to small");
4314 return TRUE;
4315 }
4316 }
4317#endif
4318 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4320 return FALSE;
4321}
#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 5599 of file iparith.cc.

5600{
5601 res->data = (char *)idMinBase((ideal)v->Data());
5602 return FALSE;
5603}
ideal idMinBase(ideal h1)
Definition: ideals.cc:51

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5651 of file iparith.cc.

5652{
5653 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5654 return FALSE;
5655}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5578 of file iparith.cc.

5579{
5580 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5581 return FALSE;
5582}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4367 of file iparith.cc.

4368{
4369 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4370 iv->makeVector();
4371 res->data = iv;
4372 return FALSE;
4373}
void makeVector()
Definition: intvec.h:102
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4374 of file iparith.cc.

4375{
4376 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4377 return FALSE;
4378}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:793

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4379 of file iparith.cc.

4380{
4382 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4383 return FALSE;
4384}
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:285

◆ jjINDEPSET2()

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

Definition at line 2479 of file iparith.cc.

2480{
2481 assumeStdFlag(u);
2482 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2483 currRing->qideal);
2484 return FALSE;
2485}
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 1391 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1413 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1449 of file iparith.cc.

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

◆ jjINDEX_P_IV()

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

Definition at line 1489 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1466 of file iparith.cc.

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

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

◆ jjINDEX_V_IV()

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

Definition at line 1525 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2492 of file iparith.cc.

2493{
2494 const lists L = (lists)l->Data();
2495 const int n = L->nr; assume (n >= 0);
2496 std::vector<ideal> V(n + 1);
2497
2498 for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2499
2500 res->data=interpolation(V, (intvec*)v->Data());
2502 return errorreported;
2503}
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4385 of file iparith.cc.

4386{
4387 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4388#ifdef HAVE_RINGS
4390 WarnS("interred: this command is experimental over the integers");
4391#endif
4392 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4393 res->data = result;
4394 return FALSE;
4395}
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3743
#define TEST_OPT_PROT
Definition: options.h:103
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:58

◆ jjINTERSEC3S()

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

Definition at line 6195 of file iparith.cc.

6196{
6197 ideal I=(ideal)u->Data();
6198 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6199 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6201 return FALSE;
6202}
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:316
#define TEST_OPT_RETURN_SB
Definition: options.h:112

◆ jjINTERSECT()

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

Definition at line 2486 of file iparith.cc.

2487{
2488 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2490 return FALSE;
2491}

◆ jjINTERSECT3()

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

Definition at line 6182 of file iparith.cc.

6183{
6184 ideal I1=(ideal)u->Data();
6185 ideal I2=(ideal)v->Data();
6186 ideal I3=(ideal)w->Data();
6187 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6188 r[0]=I1;
6189 r[1]=I2;
6190 r[2]=I3;
6191 res->data=(char *)idMultSect(r,3);
6192 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6193 return FALSE;
6194}
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 7419 of file iparith.cc.

7420{
7421 leftv h=v;
7422 int l=v->listLength();
7423 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7424 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7425 int t=0;
7426 // try to convert to IDEAL_CMD
7427 while (h!=NULL)
7428 {
7429 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7430 {
7431 t=IDEAL_CMD;
7432 }
7433 else break;
7434 h=h->next;
7435 }
7436 // if failure, try MODUL_CMD
7437 if (t==0)
7438 {
7439 h=v;
7440 while (h!=NULL)
7441 {
7442 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7443 {
7444 t=MODUL_CMD;
7445 }
7446 else break;
7447 h=h->next;
7448 }
7449 }
7450 // check for success in converting
7451 if (t==0)
7452 {
7453 WerrorS("cannot convert to ideal or module");
7454 return TRUE;
7455 }
7456 // call idMultSect
7457 h=v;
7458 int i=0;
7459 sleftv tmp;
7460 while (h!=NULL)
7461 {
7462 if (h->Typ()==t)
7463 {
7464 r[i]=(ideal)h->Data(); /*no copy*/
7465 h=h->next;
7466 }
7467 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7468 {
7469 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7470 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7471 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7472 return TRUE;
7473 }
7474 else
7475 {
7476 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7477 copied[i]=TRUE;
7478 h=tmp.next;
7479 }
7480 i++;
7481 }
7482 res->rtyp=t;
7483 res->data=(char *)idMultSect(r,i);
7484 while(i>0)
7485 {
7486 i--;
7487 if (copied[i]) idDelete(&(r[i]));
7488 }
7489 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7490 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7491 return FALSE;
7492}

◆ jjINTMAT3()

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

Definition at line 6168 of file iparith.cc.

6169{
6170 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6171 intvec* arg = (intvec*) u->Data();
6172 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6173
6174 for (i=0; i<n; i++)
6175 {
6176 (*im)[i] = (*arg)[i];
6177 }
6178
6179 res->data = (char *)im;
6180 return FALSE;
6181}

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7655 of file iparith.cc.

7656{
7657 int i=0;
7658 leftv h=v;
7659 if (h!=NULL) i=exprlist_length(h);
7660 intvec *iv=new intvec(i);
7661 i=0;
7662 while (h!=NULL)
7663 {
7664 if(h->Typ()==INT_CMD)
7665 {
7666 (*iv)[i]=(int)(long)h->Data();
7667 }
7668 else if (h->Typ()==INTVEC_CMD)
7669 {
7670 intvec *ivv=(intvec*)h->Data();
7671 for(int j=0;j<ivv->length();j++,i++)
7672 {
7673 (*iv)[i]=(*ivv)[j];
7674 }
7675 i--;
7676 }
7677 else
7678 {
7679 delete iv;
7680 return TRUE;
7681 }
7682 i++;
7683 h=h->next;
7684 }
7685 res->data=(char *)iv;
7686 return FALSE;
7687}

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4407 of file iparith.cc.

4408{
4409 res->data = (char *)0;
4410 return FALSE;
4411}

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4396 of file iparith.cc.

4397{
4398 res->data = (char *)(long)pVar((poly)v->Data());
4399 return FALSE;
4400}

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4401 of file iparith.cc.

4402{
4403 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4404 currRing->N)+1);
4405 return FALSE;
4406}
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:212

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv  res,
leftv  a 
)
static

Definition at line 4443 of file iparith.cc.

4444{
4445 ideal id = (ideal)a->Data();
4446 id = id_Transp(id,currRing);
4447 int W = IDELEMS(id);
4448
4449 ideal result = idInit(W * currRing->N, id->rank);
4450 poly *p = result->m;
4451
4452 for( int v = 1; v <= currRing->N; v++ )
4453 {
4454 poly* q = id->m;
4455 for( int i = 0; i < W; i++, p++, q++ )
4456 *p = pDiff( *q, v );
4457 }
4458 idDelete(&id);
4459
4460 res->data = (char *)result;
4461 return FALSE;
4462}

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4412 of file iparith.cc.

4413{
4414 ideal i=idInit(currRing->N,1);
4415 int k;
4416 poly p=(poly)(v->Data());
4417 for (k=currRing->N;k>0;k--)
4418 {
4419 i->m[k-1]=pDiff(p,k);
4420 }
4421 res->data = (char *)i;
4422 return FALSE;
4423}

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2510 of file iparith.cc.

2511{
2512 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2513 return jjStdJanetBasis(res,v,0);
2514}
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 2504 of file iparith.cc.

2505{
2506 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2507 return jjStdJanetBasis(res,u,(int)(long)v->Data());
2508}

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7688 of file iparith.cc.

7689{
7690 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7691 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7692 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7693 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7694 leftv u1=u;
7695 leftv u2=u1->next;
7696 leftv u3=u2->next;
7697 leftv u4=u3->next;
7698 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7699 {
7700 if(!pIsUnit((poly)u2->Data()))
7701 {
7702 WerrorS("2nd argument must be a unit");
7703 return TRUE;
7704 }
7705 res->rtyp=u1->Typ();
7706 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7707 pCopy((poly)u2->Data()),(intvec*)u4->Data());
7708 return FALSE;
7709 }
7710 else
7711 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7712 {
7713 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7714 {
7715 WerrorS("2nd argument must be a diagonal matrix of units");
7716 return TRUE;
7717 }
7718 res->rtyp=u1->Typ();
7719 res->data=(char*)idSeries(
7720 (int)(long)u3->Data(),
7721 idCopy((ideal)u1->Data()),
7722 mp_Copy((matrix)u2->Data(), currRing),
7723 (intvec*)u4->Data()
7724 );
7725 return FALSE;
7726 }
7727 else
7728 {
7729 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7730 Tok2Cmdname(iiOp));
7731 return TRUE;
7732 }
7733}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2115
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition: matpol.cc:816
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition: polys.h:240
#define pSeries(n, p, u, w)
Definition: polys.h:372

◆ jjJET_ID()

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

Definition at line 2520 of file iparith.cc.

2521{
2522 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2523 return FALSE;
2524}
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 6220 of file iparith.cc.

6221{
6222 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6223 (intvec *)w->Data(),currRing);
6224 return FALSE;
6225}
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 6226 of file iparith.cc.

6227{
6228 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6229 {
6230 WerrorS("2nd argument must be a diagonal matrix of units");
6231 return TRUE;
6232 }
6233 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6234 (matrix)v->CopyD());
6235 return FALSE;
6236}

◆ jjJET_P()

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

Definition at line 2515 of file iparith.cc.

2516{
2517 res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2518 return FALSE;
2519}
#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 6203 of file iparith.cc.

6204{
6205 int *iw=iv2array((intvec *)w->Data(),currRing);
6206 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6207 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6208 return FALSE;
6209}
#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 6210 of file iparith.cc.

6211{
6212 if (!pIsUnit((poly)v->Data()))
6213 {
6214 WerrorS("2nd argument must be a unit");
6215 return TRUE;
6216 }
6217 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6218 return FALSE;
6219}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4531

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4464 of file iparith.cc.

4465{
4467 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4468 return FALSE;
4469}
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1427

◆ jjKBASE2()

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

Definition at line 2525 of file iparith.cc.

2526{
2527 assumeStdFlag(u);
2528 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2529 res->data = (char *)scKBase((int)(long)v->Data(),
2530 (ideal)(u->Data()),currRing->qideal, w_u);
2531 if (w_u!=NULL)
2532 {
2533 atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2534 }
2535 return FALSE;
2536}
intvec * ivCopy(const intvec *o)
Definition: intvec.h:135

◆ jjKERNEL()

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

Definition at line 2538 of file iparith.cc.

2539{
2540 return jjPREIMAGE(res,u,v,NULL);
2541}
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6443

◆ jjKLAMMER()

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

Definition at line 1561 of file iparith.cc.

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

◆ jjKLAMMER_IV()

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

Definition at line 1573 of file iparith.cc.

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

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7771 of file iparith.cc.

7772{
7774 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7775 {
7776 memcpy(res,u,sizeof(sleftv));
7777 u->Init();
7778 return FALSE;
7779 }
7780 leftv v=u->next;
7781 BOOLEAN b;
7782 if(v==NULL) // p()
7784 else if ((v->next==NULL) // p(1)
7785 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7786 {
7787 u->next=NULL;
7788 b=iiExprArith2(res,u,iiOp,v);
7789 u->next=v;
7790 }
7791 else // p(1,2), p undefined
7792 {
7793 if (v->Typ()!=INT_CMD)
7794 {
7795 Werror("`int` expected while building `%s(`",u->name);
7796 return TRUE;
7797 }
7798 int l=u->listLength();
7799 char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7800 sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7801 char *s=nn;
7802 do
7803 {
7804 while (*s!='\0') s++;
7805 v=v->next;
7806 if (v->Typ()!=INT_CMD)
7807 {
7808 Werror("`int` expected while building `%s`",nn);
7809 omFree((ADDRESS)nn);
7810 return TRUE;
7811 }
7812 sprintf(s,",%d",(int)(long)v->Data());
7813 } while (v->next!=NULL);
7814 while (*s!='\0') s++;
7815 nn=strcat(nn,")");
7816 char *n=omStrDup(nn);
7817 omFree((ADDRESS)nn);
7818 syMake(res,n);
7819 b=FALSE;
7820 }
7821 return b;
7822}
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1600 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2542 of file iparith.cc.

2543{
2544 return mpKoszul(res, u,v,NULL);
2545}
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3096

◆ jjKoszul_Id()

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

Definition at line 2546 of file iparith.cc.

2547{
2548 sleftv h;
2549 h.Init();
2550 h.rtyp=INT_CMD;
2551 h.data=(void *)(long)IDELEMS((ideal)v->Data());
2552 return mpKoszul(res, u, &h, v);
2553}

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4470 of file iparith.cc.

4471{
4472 res->data=(char *)syConvList((lists)v->Data());
4473 if (res->data != NULL)
4474 return FALSE;
4475 else
4476 return TRUE;
4477}
syStrategy syConvList(lists li)
Definition: ipshell.cc:3259

◆ jjLagSolve()

static BOOLEAN jjLagSolve ( leftv  res,
leftv  v 
)
static

Definition at line 4547 of file iparith.cc.

4548{
4549 sleftv a2,a3;
4550 memset(&a2,0,sizeof(a2));
4551 memset(&a3,0,sizeof(a3));
4552 a2.rtyp=INT_CMD; a2.data=(void*)10;
4553 a3.rtyp=INT_CMD; a3.data=(void*)1;
4554 return nuLagSolve(res,v,&a2,&a3);
4555}
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:4681

◆ jjLE_BI()

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

Definition at line 1202 of file iparith.cc.

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

◆ jjLE_I()

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

Definition at line 1206 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1211 of file iparith.cc.

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

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4478 of file iparith.cc.

4479{
4480 poly p=(poly)v->Data();
4481 if (p==NULL)
4482 {
4483 res->data=(char *)nInit(0);
4484 }
4485 else
4486 {
4488 res->data=(char *)nCopy(pGetCoeff(p));
4489 }
4490 return FALSE;
4491}

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4492 of file iparith.cc.

4493{
4494 poly p=(poly)v->Data();
4495 int s=currRing->N;
4496 if (v->Typ()==VECTOR_CMD) s++;
4497 intvec *iv=new intvec(s);
4498 if (p!=NULL)
4499 {
4500 for(int i = currRing->N;i;i--)
4501 {
4502 (*iv)[i-1]=pGetExp(p,i);
4503 }
4504 if (s!=currRing->N)
4505 (*iv)[currRing->N]=pGetComp(p);
4506 }
4507 res->data=(char *)iv;
4508 return FALSE;
4509}
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4510 of file iparith.cc.

4511{
4512 poly p=(poly)v->Data();
4513 if (p == NULL)
4514 {
4515 res->data = (char*) NULL;
4516 }
4517 else
4518 {
4519 poly lm = pLmInit(p);
4520 pSetCoeff0(lm, nInit(1));
4521 res->data = (char*) lm;
4522 }
4523 return FALSE;
4524}
#define pSetCoeff0(p, n)
Definition: monomials.h:59
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64

◆ jjLIFT()

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

Definition at line 2554 of file iparith.cc.

2555{
2556 int ul= IDELEMS((ideal)u->Data());
2557 int vl= IDELEMS((ideal)v->Data());
2558#ifdef HAVE_SHIFTBBA
2559 if (rIsLPRing(currRing))
2560 {
2561 if (currRing->LPncGenCount < ul)
2562 {
2563 Werror("At least %d ncgen variables are needed for this computation.", ul);
2564 return TRUE;
2565 }
2566 }
2567#endif
2568 ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2569 hasFlag(u,FLAG_STD));
2570 if (m==NULL) return TRUE;
2571 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2572 return FALSE;
2573}

◆ jjLIFT3()

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

Definition at line 6883 of file iparith.cc.

6884{
6885 if (w->rtyp!=IDHDL) return TRUE;
6886 int ul= IDELEMS((ideal)u->Data());
6887 int vl= IDELEMS((ideal)v->Data());
6888#ifdef HAVE_SHIFTBBA
6889 if (rIsLPRing(currRing))
6890 {
6891 if (currRing->LPncGenCount < ul)
6892 {
6893 Werror("At least %d ncgen variables are needed for this computation.", ul);
6894 return TRUE;
6895 }
6896 }
6897#endif
6898 ideal m
6899 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6900 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6901 if (m==NULL) return TRUE;
6902 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6903 return FALSE;
6904}
#define IDMATRIX(a)
Definition: ipid.h:134

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7823 of file iparith.cc.

7824{
7825 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7826 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7827 leftv u=U;
7828 leftv v=u->next;
7829 leftv w=v->next;
7830 leftv u4=w->next;
7831 if (w->rtyp!=IDHDL) return TRUE;
7832 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7833 {
7834 // see jjLIFT3
7835 ideal I=(ideal)u->Data();
7836 int ul= IDELEMS(I /*(ideal)u->Data()*/);
7837 int vl= IDELEMS((ideal)v->Data());
7838 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7839 ideal m
7840 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7841 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7842 if (m==NULL) return TRUE;
7843 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7844 return FALSE;
7845 }
7846 else
7847 {
7848 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7849 "or (`module`,`module`,`matrix`,`string`) expected",
7850 Tok2Cmdname(iiOp));
7851 return TRUE;
7852 }
7853}

◆ jjLIFTSTD()

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

Definition at line 2574 of file iparith.cc.

2575{
2576 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2577 idhdl h=(idhdl)v->data;
2578#ifdef HAVE_SHIFTBBA
2580 {
2581 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
2582 {
2583 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
2584 return TRUE;
2585 }
2586 }
2587#endif
2588 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2589 res->data = (char *)idLiftStd((ideal)u->Data(),
2590 &(h->data.umatrix),testHomog);
2591 setFlag(res,FLAG_STD); v->flag=0;
2592 return FALSE;
2593}
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition: ideals.cc:976

◆ jjLIFTSTD_ALG()

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

Definition at line 6928 of file iparith.cc.

6929{
6930 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6931 idhdl hv=(idhdl)v->data;
6932 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
6933#ifdef HAVE_SHIFTBBA
6934 if (rIsLPRing(currRing))
6935 {
6936 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
6937 {
6938 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
6939 return TRUE;
6940 }
6941 }
6942#endif
6943 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6944 res->data = (char *)idLiftStd((ideal)u->Data(),
6945 &(hv->data.umatrix),testHomog,
6946 NULL,alg);
6947 setFlag(res,FLAG_STD); v->flag=0;
6948 return FALSE;
6949}

◆ jjLIFTSTD_M()

static BOOLEAN jjLIFTSTD_M ( leftv  res,
leftv  U 
)
static

Definition at line 7854 of file iparith.cc.

7855{
7856 // we have 4 or 5 arguments
7857 leftv u=U;
7858 leftv v=u->next;
7859 leftv u3=v->next;
7860 leftv u4=u3->next;
7861 leftv u5=u4->next; // might be NULL
7862
7863 ideal *syz=NULL;
7864 GbVariant alg=GbDefault;
7865 ideal h11=NULL;
7866
7867 if(u5==NULL)
7868 {
7869 // test all three possibilities for 4 arguments
7870 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7871 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
7872 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
7873 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
7874 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
7875 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
7876
7877 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7878 {
7879 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7880 idhdl hw=(idhdl)u3->data;
7881 syz=&(hw->data.uideal);
7882 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7883 }
7884 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
7885 {
7886 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
7887 idhdl hw=(idhdl)u3->data;
7888 syz=&(hw->data.uideal);
7889 h11=(ideal)u4->Data();
7890 }
7891 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
7892 {
7893 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
7894 h11=(ideal)u4->Data();
7895 }
7896 else
7897 {
7898 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7899 return TRUE;
7900 }
7901 }
7902 else
7903 {
7904 // we have 5 arguments
7905 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
7906 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
7907 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7908 {
7909 idhdl hw=(idhdl)u3->data;
7910 syz=&(hw->data.uideal);
7911 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
7912 h11=(ideal)u5->Data();
7913 }
7914 else
7915 {
7916 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
7917 return TRUE;
7918 }
7919 }
7920
7921#ifdef HAVE_SHIFTBBA
7922 if (rIsLPRing(currRing))
7923 {
7924 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7925 {
7926 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7927 return TRUE;
7928 }
7929 }
7930#endif
7931
7932 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7933 idhdl hv=(idhdl)v->data;
7934 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7935 res->rtyp = u->Typ();
7936 res->data = (char *)idLiftStd((ideal)u->Data(),
7937 &(hv->data.umatrix),testHomog,
7938 syz,alg,h11);
7939 setFlag(res,FLAG_STD); v->flag=0;
7940 if(syz!=NULL)
7941 u3->flag=0;
7942 return FALSE;
7943}
@ GbDefault
Definition: ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 6905 of file iparith.cc.

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

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7944 of file iparith.cc.

7945{
7946 int sl=0;
7947 if (v!=NULL) sl = v->listLength();
7948 lists L;
7949 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7950 {
7951 int add_row_shift = 0;
7952 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7953 if (weights!=NULL) add_row_shift=weights->min_in();
7954 L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7955 }
7956 else
7957 {
7959 leftv h=NULL;
7960 int i;
7961 int rt;
7962
7963 L->Init(sl);
7964 for (i=0;i<sl;i++)
7965 {
7966 if (h!=NULL)
7967 { /* e.g. not in the first step:
7968 * h is the pointer to the old sleftv,
7969 * v is the pointer to the next sleftv
7970 * (in this moment) */
7971 h->next=v;
7972 }
7973 h=v;
7974 v=v->next;
7975 h->next=NULL;
7976 rt=h->Typ();
7977 if (rt==0)
7978 {
7979 L->Clean();
7980 Werror("`%s` is undefined",h->Fullname());
7981 return TRUE;
7982 }
7983 if (rt==RING_CMD)
7984 {
7985 L->m[i].rtyp=rt;
7986 L->m[i].data=rIncRefCnt(((ring)h->Data()));
7987 }
7988 else
7989 L->m[i].Copy(h);
7990 }
7991 }
7992 res->data=(char *)L;
7993 return FALSE;
7994}
int min_in()
Definition: intvec.h:121
@ RESOLUTION_CMD
Definition: grammar.cc:290
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3187
static ring rIncRefCnt(ring r)
Definition: ring.h:843

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4529 of file iparith.cc.

4530{
4531 lists l=(lists)v->Data();
4532 long mm=(long)atGet(v,"maxExp",INT_CMD);
4533 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4534 ring r=rCompose(l,TRUE,mm,isLetterplace);
4535 res->data=(char *)r;
4536 return (r==NULL);
4537}
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2787

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5466 of file iparith.cc.

5467{
5468 char libnamebuf[1024];
5470
5471#ifdef HAVE_DYNAMIC_LOADING
5472 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5473#endif /* HAVE_DYNAMIC_LOADING */
5474 switch(LT)
5475 {
5476 default:
5477 case LT_NONE:
5478 Werror("%s: unknown type", s);
5479 break;
5480 case LT_NOTFOUND:
5481 Werror("cannot open %s", s);
5482 break;
5483
5484 case LT_SINGULAR:
5485 {
5486 char *plib = iiConvName(s);
5487 idhdl pl = IDROOT->get_level(plib,0);
5488 if (pl==NULL)
5489 {
5490 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5491 IDPACKAGE(pl)->language = LANG_SINGULAR;
5492 IDPACKAGE(pl)->libname=omStrDup(s);
5493 }
5494 else if (IDTYP(pl)!=PACKAGE_CMD)
5495 {
5496 Werror("can not create package `%s`",plib);
5497 omFree(plib);
5498 return TRUE;
5499 }
5500 else /* package */
5501 {
5502 package pa=IDPACKAGE(pl);
5503 if ((pa->language==LANG_C)
5504 || (pa->language==LANG_MIX))
5505 {
5506 Werror("can not create package `%s` - binaries exists",plib);
5507 omfree(plib);
5508 return TRUE;
5509 }
5510 }
5511 omFree(plib);
5512 package savepack=currPack;
5513 currPack=IDPACKAGE(pl);
5514 IDPACKAGE(pl)->loaded=TRUE;
5515 char libnamebuf[1024];
5516 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5517 BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5518 currPack=savepack;
5519 IDPACKAGE(pl)->loaded=(!bo);
5520 return bo;
5521 }
5522 case LT_BUILTIN:
5523 SModulFunc_t iiGetBuiltinModInit(const char*);
5524 return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5525 case LT_MACH_O:
5526 case LT_ELF:
5527 case LT_HPUX:
5528#ifdef HAVE_DYNAMIC_LOADING
5529 return load_modules(s, libnamebuf, autoexport);
5530#else /* HAVE_DYNAMIC_LOADING */
5531 WerrorS("Dynamic modules are not supported by this version of Singular");
5532 break;
5533#endif /* HAVE_DYNAMIC_LOADING */
5534 }
5535 return TRUE;
5536}
CanonicalForm fp
Definition: cfModGcd.cc:4101
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
VAR package basePack
Definition: ipid.cc:58
VAR package currPack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:19
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1294
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:81
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:973
char * iiConvName(const char *libname)
Definition: iplib.cc:1429
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1284
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:807
VAR char libnamebuf[1024]
Definition: libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:27
lib_types
Definition: mod_raw.h:16
@ LT_MACH_O
Definition: mod_raw.h:16
@ LT_HPUX
Definition: mod_raw.h:16
@ LT_SINGULAR
Definition: mod_raw.h:16
@ LT_BUILTIN
Definition: mod_raw.h:16
@ LT_ELF
Definition: mod_raw.h:16
@ LT_NONE
Definition: mod_raw.h:16
@ LT_NOTFOUND
Definition: mod_raw.h:16
#define omfree(addr)
Definition: omAllocDecl.h:237
@ LANG_SINGULAR
Definition: subexpr.h:22
@ LANG_MIX
Definition: subexpr.h:22
@ LANG_C
Definition: subexpr.h:22

◆ jjLOAD1()

static BOOLEAN jjLOAD1 ( leftv  ,
leftv  v 
)
static

Definition at line 4525 of file iparith.cc.

4526{
4527 return jjLOAD((char*)v->Data(),FALSE);
4528}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5466

◆ jjLOAD2()

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

Definition at line 2594 of file iparith.cc.

2595{
2596 return jjLOAD((char*)v->Data(),TRUE);
2597}

◆ jjLOAD_E()

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

Definition at line 2598 of file iparith.cc.

2599{
2600 char * s=(char *)u->Data();
2601 if(strcmp(s, "with")==0)
2602 return jjLOAD((char*)v->Data(), TRUE);
2603 if (strcmp(s,"try")==0)
2604 return jjLOAD_TRY((char*)v->Data());
2605 WerrorS("invalid second argument");
2606 WerrorS("load(\"libname\" [,option]);");
2607 return TRUE;
2608}
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5542

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5542 of file iparith.cc.

5543{
5544 if (!iiGetLibStatus(s))
5545 {
5546 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5549 BOOLEAN bo=jjLOAD(s,TRUE);
5550 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5551 Print("loading of >%s< failed\n",s);
5552 WerrorS_callback=WerrorS_save;
5553 errorreported=0;
5554 }
5555 return FALSE;
5556}
VAR void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition: iparith.cc:5537
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5538
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 1215 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1219 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1224 of file iparith.cc.

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

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4556 of file iparith.cc.

4557{
4558 /* computes the LU-decomposition of a matrix M;
4559 i.e., M = P * L * U, where
4560 - P is a row permutation matrix,
4561 - L is in lower triangular form,
4562 - U is in upper row echelon form
4563 Then, we also have P * M = L * U.
4564 A list [P, L, U] is returned. */
4565 matrix mat = (const matrix)v->Data();
4566 if (!idIsConstant((ideal)mat))
4567 {
4568 WerrorS("matrix must be constant");
4569 return TRUE;
4570 }
4571 matrix pMat;
4572 matrix lMat;
4573 matrix uMat;
4574
4575 luDecomp(mat, pMat, lMat, uMat);
4576
4578 ll->Init(3);
4579 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4580 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4581 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4582 res->data=(char*)ll;
4583
4584 return FALSE;
4585}
#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 7493 of file iparith.cc.

7494{
7495 /* computation of the inverse of a quadratic matrix A
7496 using the L-U-decomposition of A;
7497 There are two valid parametrisations:
7498 1) exactly one argument which is just the matrix A,
7499 2) exactly three arguments P, L, U which already
7500 realise the L-U-decomposition of A, that is,
7501 P * A = L * U, and P, L, and U satisfy the
7502 properties decribed in method 'jjLU_DECOMP';
7503 see there;
7504 If A is invertible, the list [1, A^(-1)] is returned,
7505 otherwise the list [0] is returned. Thus, the user may
7506 inspect the first entry of the returned list to see
7507 whether A is invertible. */
7508 matrix iMat; int invertible;
7509 const short t1[]={1,MATRIX_CMD};
7510 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7511 if (iiCheckTypes(v,t1))
7512 {
7513 matrix aMat = (matrix)v->Data();
7514 int rr = aMat->rows();
7515 int cc = aMat->cols();
7516 if (rr != cc)
7517 {
7518 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7519 return TRUE;
7520 }
7521 if (!idIsConstant((ideal)aMat))
7522 {
7523 WerrorS("matrix must be constant");
7524 return TRUE;
7525 }
7526 invertible = luInverse(aMat, iMat);
7527 }
7528 else if (iiCheckTypes(v,t2))
7529 {
7530 matrix pMat = (matrix)v->Data();
7531 matrix lMat = (matrix)v->next->Data();
7532 matrix uMat = (matrix)v->next->next->Data();
7533 int rr = uMat->rows();
7534 int cc = uMat->cols();
7535 if (rr != cc)
7536 {
7537 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7538 rr, cc);
7539 return TRUE;
7540 }
7541 if (!idIsConstant((ideal)pMat)
7542 || (!idIsConstant((ideal)lMat))
7543 || (!idIsConstant((ideal)uMat))
7544 )
7545 {
7546 WerrorS("matricesx must be constant");
7547 return TRUE;
7548 }
7549 invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7550 }
7551 else
7552 {
7553 Werror("expected either one or three matrices");
7554 return TRUE;
7555 }
7556
7557 /* build the return structure; a list with either one or two entries */
7559 if (invertible)
7560 {
7561 ll->Init(2);
7562 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7563 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7564 }
7565 else
7566 {
7567 ll->Init(1);
7568 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7569 }
7570
7571 res->data=(char*)ll;
7572 return FALSE;
7573}
int & cols()
Definition: matpol.h:24
int & rows()
Definition: matpol.h:23
bool luInverseFromLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, matrix &iMat, const ring R)
This code computes the inverse by inverting lMat and uMat, and then performing two matrix multiplicat...
bool luInverse(const matrix aMat, matrix &iMat, const ring R)
This code first computes the LU-decomposition of aMat, and then calls the method for inverting a matr...

◆ jjLU_SOLVE()

static BOOLEAN jjLU_SOLVE ( leftv  res,
leftv  v 
)
static

Definition at line 7574 of file iparith.cc.

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

8665{
8666 assume( e->Typ()==INT_CMD );
8667 Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8668 r->start =(int)(long)e->Data();
8669 return r;
8670}
VAR omBin sSubexpr_bin
Definition: subexpr.cc:40

◆ jjMAP()

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

Definition at line 1654 of file iparith.cc.

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

◆ jjMATRIX_Id()

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

Definition at line 6706 of file iparith.cc.

6707{
6708 int mi=(int)(long)v->Data();
6709 int ni=(int)(long)w->Data();
6710 if ((mi<1)||(ni<1))
6711 {
6712 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6713 return TRUE;
6714 }
6715 matrix m=mpNew(mi,ni);
6716 ideal I=(ideal)u->CopyD(IDEAL_CMD);
6717 int i=si_min(IDELEMS(I),mi*ni);
6718 //for(i=i-1;i>=0;i--)
6719 //{
6720 // m->m[i]=I->m[i];
6721 // I->m[i]=NULL;
6722 //}
6723 memcpy(m->m,I->m,i*sizeof(poly));
6724 memset(I->m,0,i*sizeof(poly));
6725 id_Delete(&I,currRing);
6726 res->data = (char *)m;
6727 return FALSE;
6728}

◆ jjMATRIX_Ma()

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

Definition at line 6742 of file iparith.cc.

6743{
6744 int mi=(int)(long)v->Data();
6745 int ni=(int)(long)w->Data();
6746 if ((mi<1)||(ni<1))
6747 {
6748 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6749 return TRUE;
6750 }
6751 matrix m=mpNew(mi,ni);
6753 int r=si_min(MATROWS(I),mi);
6754 int c=si_min(MATCOLS(I),ni);
6755 int i,j;
6756 for(i=r;i>0;i--)
6757 {
6758 for(j=c;j>0;j--)
6759 {
6760 MATELEM(m,i,j)=MATELEM(I,i,j);
6761 MATELEM(I,i,j)=NULL;
6762 }
6763 }
6764 id_Delete((ideal *)&I,currRing);
6765 res->data = (char *)m;
6766 return FALSE;
6767}

◆ jjMATRIX_Mo()

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

Definition at line 6729 of file iparith.cc.

6730{
6731 int mi=(int)(long)v->Data();
6732 int ni=(int)(long)w->Data();
6733 if ((mi<0)||(ni<1))
6734 {
6735 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6736 return TRUE;
6737 }
6738 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6739 mi,ni,currRing);
6740 return FALSE;
6741}

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4586 of file iparith.cc.

4587{
4588 // clean out "_":
4590 // collect all info:
4591 omUpdateInfo();
4592 switch(((int)(long)v->Data()))
4593 {
4594 case 0:
4595 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4596 break;
4597 case 1:
4598 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4599 break;
4600 case 2:
4601 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4602 break;
4603 default:
4604 omPrintStats(stdout);
4605 omPrintInfo(stdout);
4606 omPrintBinStats(stdout);
4607 res->data = (char *)0;
4608 res->rtyp = NONE;
4609 }
4610 return FALSE;
4611}
omInfo_t om_Info
Definition: omStats.c:16
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
#define NONE
Definition: tok.h:221
#define omPrintStats(F)
Definition: xalloc.h:282
#define omPrintInfo(F)
Definition: xalloc.h:283
#define omPrintBinStats(F)
Definition: xalloc.h:284
#define omUpdateInfo()
Definition: xalloc.h:281

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 6237 of file iparith.cc.

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

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4637 of file iparith.cc.

4638{
4639 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4640
4641 syStrategy tmp=(syStrategy)v->Data();
4642 tmp = syMinimize(tmp); // enrich itself!
4643
4644 res->data=(char *)tmp;
4645
4646 if (weights!=NULL)
4647 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4648
4649 return FALSE;
4650}
syStrategy syMinimize(syStrategy syzstr)
Definition: syz1.cc:2393
ssyStrategy * syStrategy
Definition: syz.h:36

◆ jjMINUS_B()

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

Definition at line 921 of file iparith.cc.

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

◆ jjMINUS_B_P()

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

Definition at line 911 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 896 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 944 of file iparith.cc.

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

◆ jjMINUS_I()

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

Definition at line 880 of file iparith.cc.

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

◆ jjMINUS_IV()

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

Definition at line 934 of file iparith.cc.

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

◆ jjMINUS_MA()

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

Definition at line 954 of file iparith.cc.

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

◆ jjMINUS_N()

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

Definition at line 901 of file iparith.cc.

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

◆ jjMINUS_SM()

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

Definition at line 967 of file iparith.cc.

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

◆ jjMINUS_V()

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

Definition at line 906 of file iparith.cc.

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

◆ jjMOD_BI()

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

Definition at line 2662 of file iparith.cc.

2663{
2664 number q=(number)v->Data();
2665 if (n_IsZero(q,coeffs_BIGINT))
2666 {
2668 return TRUE;
2669 }
2670 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2671 return FALSE;
2672}
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:628

◆ jjMOD_N()

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

Definition at line 2673 of file iparith.cc.

2674{
2675 number q=(number)v->Data();
2676 if (nIsZero(q))
2677 {
2679 return TRUE;
2680 }
2681 res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2682 return FALSE;
2683}

◆ jjMOD_P()

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

Definition at line 2684 of file iparith.cc.

2685{
2686 poly q=(poly)v->Data();
2687 if (q==NULL)
2688 {
2690 return TRUE;
2691 }
2692 poly p=(poly)(u->Data());
2693 if (p==NULL)
2694 {
2695 res->data=NULL;
2696 return FALSE;
2697 }
2698 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2699 q /*(poly)(v->Data())*/ ,currRing));
2700 return FALSE;
2701}
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:679

◆ jjMODULO()

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

Definition at line 2609 of file iparith.cc.

2610{
2611 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2612 tHomog hom=testHomog;
2613 if (w_u!=NULL)
2614 {
2615 //PrintS("modulo: wu:");w_u->show(INTVEC_CMD);PrintLn();
2616 w_u=ivCopy(w_u);
2617 hom=isHomog;
2618 }
2619 //else PrintS("modulo: wu:none\n");
2620 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2621 if (w_v!=NULL)
2622 {
2623 //PrintS("modulo: wv:");w_v->show(INTVEC_CMD);PrintLn();
2624 w_v=ivCopy(w_v);
2625 hom=isHomog;
2626 }
2627 //else PrintS("modulo: wv:none\n");
2628 if ((w_u!=NULL) && (w_v==NULL))
2629 w_v=ivCopy(w_u);
2630 if ((w_v!=NULL) && (w_u==NULL))
2631 w_u=ivCopy(w_v);
2632 ideal u_id=(ideal)u->Data();
2633 ideal v_id=(ideal)v->Data();
2634 if (w_u!=NULL)
2635 {
2636 if ((*w_u).compare((w_v))!=0)
2637 {
2638 WarnS("incompatible weights");
2639 delete w_u; w_u=NULL;
2640 hom=testHomog;
2641 }
2642 else
2643 {
2644 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2645 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2646 {
2647 WarnS("wrong weights");
2648 delete w_u; w_u=NULL;
2649 hom=testHomog;
2650 }
2651 }
2652 }
2653 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2654 if (w_u!=NULL)
2655 {
2656 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2657 }
2658 delete w_v;
2659 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2660 return FALSE;
2661}
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w, matrix *T, GbVariant alg)
Definition: ideals.cc:2408
tHomog
Definition: structs.h:35
@ isHomog
Definition: structs.h:37

◆ jjMODULO3()

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

Definition at line 6768 of file iparith.cc.

6769{
6770 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
6771 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6772 tHomog hom=testHomog;
6773 if (w_u!=NULL)
6774 {
6775 w_u=ivCopy(w_u);
6776 hom=isHomog;
6777 }
6778 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
6779 if (w_v!=NULL)
6780 {
6781 w_v=ivCopy(w_v);
6782 hom=isHomog;
6783 }
6784 if ((w_u!=NULL) && (w_v==NULL))
6785 w_v=ivCopy(w_u);
6786 if ((w_v!=NULL) && (w_u==NULL))
6787 w_u=ivCopy(w_v);
6788 ideal u_id=(ideal)u->Data();
6789 ideal v_id=(ideal)v->Data();
6790 if (w_u!=NULL)
6791 {
6792 if ((*w_u).compare((w_v))!=0)
6793 {
6794 WarnS("incompatible weights");
6795 delete w_u; w_u=NULL;
6796 hom=testHomog;
6797 }
6798 else
6799 {
6800 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
6801 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
6802 {
6803 WarnS("wrong weights");
6804 delete w_u; w_u=NULL;
6805 hom=testHomog;
6806 }
6807 }
6808 }
6809 idhdl h=(idhdl)w->data;
6810 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
6811 if (w_u!=NULL)
6812 {
6813 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
6814 }
6815 delete w_v;
6816 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
6817 return FALSE;
6818}

◆ jjMODULO3S()

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

Definition at line 6819 of file iparith.cc.

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

◆ jjMODULO4()

static BOOLEAN jjMODULO4 ( leftv  res,
leftv  u 
)
static

Definition at line 7995 of file iparith.cc.

7996{
7997 leftv v=u->next;
7998 leftv w=v->next;
7999 leftv u4=w->next;
8000 GbVariant alg;
8001 ideal u_id,v_id;
8002 // we have 4 arguments
8003 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8004 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8005 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8006 {
8007 u_id=(ideal)u->Data();
8008 v_id=(ideal)v->Data();
8009 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8010 }
8011 else
8012 {
8013 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8014 return TRUE;
8015 }
8016 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8017 tHomog hom=testHomog;
8018 if (w_u!=NULL)
8019 {
8020 w_u=ivCopy(w_u);
8021 hom=isHomog;
8022 }
8023 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8024 if (w_v!=NULL)
8025 {
8026 w_v=ivCopy(w_v);
8027 hom=isHomog;
8028 }
8029 if ((w_u!=NULL) && (w_v==NULL))
8030 w_v=ivCopy(w_u);
8031 if ((w_v!=NULL) && (w_u==NULL))
8032 w_u=ivCopy(w_v);
8033 if (w_u!=NULL)
8034 {
8035 if ((*w_u).compare((w_v))!=0)
8036 {
8037 WarnS("incompatible weights");
8038 delete w_u; w_u=NULL;
8039 hom=testHomog;
8040 }
8041 else
8042 {
8043 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8044 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8045 {
8046 WarnS("wrong weights");
8047 delete w_u; w_u=NULL;
8048 hom=testHomog;
8049 }
8050 }
8051 }
8052 idhdl h=(idhdl)w->data;
8053 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8054 if (w_u!=NULL)
8055 {
8056 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8057 }
8058 delete w_v;
8059 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8060 return FALSE;
8061}

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2703 of file iparith.cc.

2704{
2705 return jjMONITOR2(res,v,NULL);
2706}
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2707

◆ jjMONITOR2()

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

Definition at line 2707 of file iparith.cc.

2708{
2709#if 0
2710 char *opt=(char *)v->Data();
2711 int mode=0;
2712 while(*opt!='\0')
2713 {
2714 if (*opt=='i') mode |= SI_PROT_I;
2715 else if (*opt=='o') mode |= SI_PROT_O;
2716 opt++;
2717 }
2718 monitor((char *)(u->Data()),mode);
2719#else
2720 si_link l=(si_link)u->Data();
2721 if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2722 if(strcmp(l->m->type,"ASCII")!=0)
2723 {
2724 Werror("ASCII link required, not `%s`",l->m->type);
2725 slClose(l);
2726 return TRUE;
2727 }
2728 SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2729 if ( l->name[0]!='\0') // "" is the stop condition
2730 {
2731 const char *opt;
2732 int mode=0;
2733 if (v==NULL) opt=(const char*)"i";
2734 else opt=(const char *)v->Data();
2735 while(*opt!='\0')
2736 {
2737 if (*opt=='i') mode |= SI_PROT_I;
2738 else if (*opt=='o') mode |= SI_PROT_O;
2739 opt++;
2740 }
2741 monitor((FILE *)l->data,mode);
2742 }
2743 else
2744 monitor(NULL,0);
2745 return FALSE;
2746#endif
2747}
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 2748 of file iparith.cc.

2749{
2750 intvec *iv=(intvec *)v->Data();
2751 poly p=pOne();
2752 int e;
2753 BOOLEAN err=FALSE;
2754 for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2755 {
2756 e=(*iv)[i-1];
2757 if (e>=0) pSetExp(p,i,e);
2758 else err=TRUE;
2759 }
2760 if (iv->length()==(currRing->N+1))
2761 {
2762 res->rtyp=VECTOR_CMD;
2763 e=(*iv)[currRing->N];
2764 if (e>=0) pSetComp(p,e);
2765 else err=TRUE;
2766 }
2767 pSetm(p);
2768 res->data=(char*)p;
2769 if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2770 return err;
2771}

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5616 of file iparith.cc.

5617{
5618 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5619 return FALSE;
5620}
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:275

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5621 of file iparith.cc.

5622{
5623 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5624 return FALSE;
5625}
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:254

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4616 of file iparith.cc.

4617{
4618 int t=v->Typ();
4619 ideal r,m;
4620 r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4622 l->Init(2);
4623 l->m[0].rtyp=t;
4624 l->m[0].data=(char *)r;
4625 setFlag(&(l->m[0]),FLAG_STD);
4626 l->m[1].rtyp=t;
4627 l->m[1].data=(char *)m;
4628 res->data=(char *)l;
4629 return FALSE;
4630}
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:3019

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4631 of file iparith.cc.

4632{
4634 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4635 return FALSE;
4636}
int scMultInt(ideal S, ideal Q)
Definition: hdegree.cc:872

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4651 of file iparith.cc.

4652{
4653 number n,i; i=(number)v->Data();
4655 if (nMap!=NULL)
4656 n=nMap(i,currRing->cf,coeffs_BIGINT);
4657 else goto err;
4658 res->data=(void *)n;
4659 return FALSE;
4660err:
4661 WerrorS("cannot convert to bigint"); return TRUE;
4662}

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4663 of file iparith.cc.

4664{
4665 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4666 res->data=omStrDup(v->name);
4667 else if (v->name==NULL)
4668 res->data=omStrDup("");
4669 else
4670 {
4671 res->data = (char *)v->name;
4672 v->name=NULL;
4673 }
4674 return FALSE;
4675}

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4676 of file iparith.cc.

4677{
4678 res->data=ipNameList(((ring)v->Data())->idroot);
4679 return FALSE;
4680}
lists ipNameList(idhdl root)
Definition: ipid.cc:595

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 8062 of file iparith.cc.

8063{
8064 res->data=(void *)ipNameList(IDROOT);
8065 return FALSE;
8066}

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4681 of file iparith.cc.

4682{
4683 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4684 return FALSE;
4685}
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:618

◆ jjNEWSTRUCT2()

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

Definition at line 2772 of file iparith.cc.

2773{
2774 // u: the name of the new type
2775 // v: the elements
2776 const char *s=(const char *)u->Data();
2777 newstruct_desc d=NULL;
2778 if (strlen(s)>=2)
2779 {
2780 d=newstructFromString((const char *)v->Data());
2781 if (d!=NULL) newstruct_setup(s,d);
2782 }
2783 else WerrorS("name of newstruct must be longer than 1 character");
2784 return d==NULL;
2785}
void newstruct_setup(const char *n, newstruct_desc d)
Definition: newstruct.cc:688
newstruct_desc newstructFromString(const char *s)
Definition: newstruct.cc:792

◆ jjNEWSTRUCT3()

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

Definition at line 6433 of file iparith.cc.

6434{
6435 // u: the name of the new type
6436 // v: the parent type
6437 // w: the elements
6438 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6439 (const char *)w->Data());
6440 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6441 return (d==NULL);
6442}
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition: newstruct.cc:799

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5656 of file iparith.cc.

5657{
5658 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5659 res->data=(char *)(long)iin_Int(n,currRing->cf);
5660 n_Delete(&n,currRing->cf);
5661 return FALSE;
5662}
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:222

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5663 of file iparith.cc.

5664{
5665 number n=(number)u->Data();
5666 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5667 return FALSE;
5668}

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4686 of file iparith.cc.

4687{
4688 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4689 return FALSE;
4690}

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3687 of file iparith.cc.

3688{
3689 return FALSE;
3690}

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

Return the numerator of the input number.

Definition at line 3986 of file iparith.cc.

3987{
3988 number n = reinterpret_cast<number>(v->CopyD());
3989 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
3990 n_Delete(&n,currRing->cf);
3991 return FALSE;
3992}
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:608

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4691 of file iparith.cc.

4692{
4693 res->data = (char *)(long)(((ring)(v->Data()))->N);
4694 return FALSE;
4695}

◆ jjOP_BI_BIM()

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

Definition at line 280 of file iparith.cc.

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

◆ jjOP_BIM_BI()

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

Definition at line 267 of file iparith.cc.

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

◆ jjOP_BIM_I()

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

Definition at line 248 of file iparith.cc.

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

◆ jjOP_I_BIM()

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

Definition at line 263 of file iparith.cc.

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

◆ jjOP_I_IM()

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

Definition at line 320 of file iparith.cc.

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

◆ jjOP_I_IV()

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

Definition at line 301 of file iparith.cc.

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

◆ jjOP_IM_I()

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

Definition at line 305 of file iparith.cc.

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

◆ jjOP_IV_I()

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

Definition at line 284 of file iparith.cc.

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

◆ jjOP_REST()

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

Definition at line 508 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4696 of file iparith.cc.

4697{
4698 si_link l=(si_link)v->Data();
4699 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4700 else { slPrepClose(l); return slClose(l);}
4701}
@ OPEN_CMD
Definition: tok.h:144

◆ jjOPPOSE()

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

Definition at line 2951 of file iparith.cc.

2952{
2953 /* number, poly, vector, ideal, module, matrix */
2954 ring r = (ring)a->Data();
2955 if (r == currRing)
2956 {
2957 res->data = b->Data();
2958 res->rtyp = b->rtyp;
2959 return FALSE;
2960 }
2961 if (!rIsLikeOpposite(currRing, r))
2962 {
2963 Werror("%s is not an opposite ring to current ring",a->Fullname());
2964 return TRUE;
2965 }
2966 idhdl w;
2967 if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
2968 {
2969 int argtype = IDTYP(w);
2970 switch (argtype)
2971 {
2972 case NUMBER_CMD:
2973 {
2974 /* since basefields are equal, we can apply nCopy */
2975 res->data = nCopy((number)IDDATA(w));
2976 res->rtyp = argtype;
2977 break;
2978 }
2979 case POLY_CMD:
2980 case VECTOR_CMD:
2981 {
2982 poly q = (poly)IDDATA(w);
2983 res->data = pOppose(r,q,currRing);
2984 res->rtyp = argtype;
2985 break;
2986 }
2987 case IDEAL_CMD:
2988 case MODUL_CMD:
2989 {
2990 ideal Q = (ideal)IDDATA(w);
2991 res->data = idOppose(r,Q,currRing);
2992 res->rtyp = argtype;
2993 break;
2994 }
2995 case MATRIX_CMD:
2996 {
2997 ring save = currRing;
2998 rChangeCurrRing(r);
2999 matrix m = (matrix)IDDATA(w);
3001 rChangeCurrRing(save);
3002 ideal S = idOppose(r,Q,currRing);
3003 id_Delete(&Q, r);
3004 res->data = id_Module2Matrix(S,currRing);
3005 res->rtyp = argtype;
3006 break;
3007 }
3008 default:
3009 {
3010 WerrorS("unsupported type in oppose");
3011 return TRUE;
3012 }
3013 }
3014 }
3015 else
3016 {
3017 Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
3018 return TRUE;
3019 }
3020 return FALSE;
3021}
@ NUMBER_CMD
Definition: grammar.cc:288
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3381
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3342
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
Definition: old.gring.cc:3315
void rChangeCurrRing(ring r)
Definition: polys.cc:15
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat

◆ jjOPPOSITE()

static BOOLEAN jjOPPOSITE ( leftv  res,
leftv  a 
)
static

Definition at line 5196 of file iparith.cc.

5197{
5198#ifdef HAVE_PLURAL
5199 ring r = (ring)a->Data();
5200 //if (rIsPluralRing(r))
5201 if (r->OrdSgn==1)
5202 {
5203 res->data = rOpposite(r);
5204 }
5205 else
5206 {
5207 WarnS("opposite only for global orderings");
5208 res->data = rCopy(r);
5209 }
5210 return FALSE;
5211#else
5212 return TRUE;
5213#endif
5214}
ring rOpposite(ring src)
Definition: ring.cc:5243

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8067 of file iparith.cc.

8068{
8069 if(v==NULL)
8070 {
8071 res->data=(char *)showOption();
8072 return FALSE;
8073 }
8074 res->rtyp=NONE;
8075 return setOption(res,v);
8076}
BOOLEAN setOption(leftv res, leftv v)
Definition: misc_ip.cc:568
char * showOption()
Definition: misc_ip.cc:709

◆ jjOR_I()

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

Definition at line 1386 of file iparith.cc.

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

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4702 of file iparith.cc.

4703{
4704 poly p=(poly)v->Data();
4705 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4706 return FALSE;
4707}

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4748 of file iparith.cc.

4749{
4750 poly p=(poly)v->Data();
4751 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4752 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4753 {
4754 WerrorS("poly must be constant");
4755 return TRUE;
4756 }
4757 number i=pGetCoeff(p);
4758 number n;
4760 if (nMap!=NULL)
4761 n=nMap(i,currRing->cf,coeffs_BIGINT);
4762 else goto err;
4763 res->data=(void *)n;
4764 return FALSE;
4765err:
4766 WerrorS("cannot convert to bigint"); return TRUE;
4767}

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4768 of file iparith.cc.

4769{
4770 poly p=(poly)v->Data();
4771 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4772 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4773 {
4774 WerrorS("poly must be constant");
4775 return TRUE;
4776 }
4777 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4778 return FALSE;
4779}

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4816 of file iparith.cc.

4817{
4818 number n;
4819 poly p;
4820 if (((p=(poly)v->Data())!=NULL)
4821 && (pIsConstant(p)))
4822 {
4823 n=nCopy(pGetCoeff(p));
4824 }
4825 else
4826 {
4827 n=nInit(0);
4828 }
4829 res->data = (char *)n;
4830 return FALSE;
4831}

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4708 of file iparith.cc.

4709{
4710 int i=(int)(long)v->Data();
4711 int p=0;
4712 p=rPar(currRing);
4713 if ((0<i) && (i<=p))
4714 {
4715 res->data=(char *)n_Param(i,currRing);
4716 }
4717 else
4718 {
4719 Werror("par number %d out of range 1..%d",i,p);
4720 return TRUE;
4721 }
4722 return FALSE;
4723}
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:783

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4724 of file iparith.cc.

4725{
4726 number nn=(number)v->Data();
4727 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4728 return FALSE;
4729}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition: coeffs.h:770

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4730 of file iparith.cc.

4731{
4732 if (currRing==NULL)
4733 {
4734 WerrorS("no ring active (1)");
4735 return TRUE;
4736 }
4737 int i=(int)(long)v->Data();
4738 int p=0;
4739 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4740 res->data=omStrDup(rParameter(currRing)[i-1]);
4741 else
4742 {
4743 Werror("par number %d out of range 1..%d",i,p);
4744 return TRUE;
4745 }
4746 return FALSE;
4747}

◆ jjPARSTR2()

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

Definition at line 2786 of file iparith.cc.

2787{
2788 idhdl h=(idhdl)u->data;
2789 int i=(int)(long)v->Data();
2790 int p=0;
2791 if ((0<i)
2792 && (rParameter(IDRING(h))!=NULL)
2793 && (i<=(p=rPar(IDRING(h)))))
2794 res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2795 else
2796 {
2797 Werror("par number %d out of range 1..%d",i,p);
2798 return TRUE;
2799 }
2800 return FALSE;
2801}
#define IDRING(a)
Definition: ipid.h:127

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4538 of file iparith.cc.

4539{
4540 /* call method jjPFAC2 with second argument = 0 (meaning that no
4541 valid bound for the prime factors has been given) */
4542 sleftv tmp;
4543 tmp.Init();
4544 tmp.rtyp = INT_CMD;
4545 return jjPFAC2(res, v, &tmp);
4546}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3210

◆ jjPFAC2()

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

Definition at line 3210 of file iparith.cc.

3211{
3212 number n1; int i;
3213
3214 if ((u->Typ() == BIGINT_CMD) ||
3215 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3216 {
3217 n1 = (number)u->CopyD();
3218 }
3219 else if (u->Typ() == INT_CMD)
3220 {
3221 i = (int)(long)u->Data();
3222 n1 = n_Init(i, coeffs_BIGINT);
3223 }
3224 else
3225 {
3226 return TRUE;
3227 }
3228
3229 i = (int)(long)v->Data();
3230
3231 lists l = primeFactorisation(n1, i);
3232 n_Delete(&n1, coeffs_BIGINT);
3233 res->data = (char*)l;
3234 return FALSE;
3235}
lists primeFactorisation(const number n, const int pBound)
Factorises a given bigint number n into its prime factors less than or equal to a given bound,...
Definition: misc_ip.cc:357

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5588 of file iparith.cc.

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

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5563 of file iparith.cc.

5564{
5565 res->data = (char *)(long)pLength((poly)v->Data());
5566 return FALSE;
5567}

◆ jjPlural_mat_mat()

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

Definition at line 2863 of file iparith.cc.

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

◆ jjPlural_mat_poly()

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

Definition at line 2843 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2823 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2803 of file iparith.cc.

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

◆ jjPLUS_B()

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

Definition at line 784 of file iparith.cc.

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

◆ jjPLUS_B_P()

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

Definition at line 797 of file iparith.cc.

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

◆ jjPLUS_BI()

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

Definition at line 769 of file iparith.cc.

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

◆ jjPLUS_BIM()

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

Definition at line 816 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 757 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 875 of file iparith.cc.

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

◆ jjPLUS_IV()

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

Definition at line 806 of file iparith.cc.

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

◆ jjPLUS_MA()

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

Definition at line 826 of file iparith.cc.

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

◆ jjPLUS_MA_P()

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

Definition at line 850 of file iparith.cc.

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

◆ jjPLUS_N()

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

Definition at line 774 of file iparith.cc.

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

◆ jjPLUS_P_MA()

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

Definition at line 861 of file iparith.cc.

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

◆ jjPLUS_S()

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

Definition at line 865 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 838 of file iparith.cc.

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

◆ jjPLUS_V()

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

Definition at line 779 of file iparith.cc.

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

◆ jjPLUSMINUS_Gen()

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

Definition at line 633 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3701 of file iparith.cc.

3702{
3703 if (IDTYP((idhdl)u->data)==INT_CMD)
3704 {
3705 int i=IDINT((idhdl)u->data);
3706 if (iiOp==PLUSPLUS) i++;
3707 else i--;
3708 IDDATA((idhdl)u->data)=(char *)(long)i;
3709 return FALSE;
3710 }
3711 return TRUE;
3712}
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:125

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5611 of file iparith.cc.

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

◆ jjPOWER_BI()

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

Definition at line 570 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 524 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 627 of file iparith.cc.

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

◆ jjPOWER_N()

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

Definition at line 586 of file iparith.cc.

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

◆ jjPOWER_P()

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

Definition at line 604 of file iparith.cc.

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

◆ jjPREIMAGE()

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

Definition at line 6443 of file iparith.cc.

6444{
6445 // handles preimage(r,phi,i) and kernel(r,phi)
6446 idhdl h;
6447 ring rr;
6448 map mapping;
6449 BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6450
6451 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6452 {
6453 WerrorS("2nd/3rd arguments must have names");
6454 return TRUE;
6455 }
6456 rr=(ring)u->Data();
6457 const char *ring_name=u->Name();
6458 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6459 {
6460 if (h->typ==MAP_CMD)
6461 {
6462 mapping=IDMAP(h);
6463 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6464 if ((preim_ring==NULL)
6465 || (IDRING(preim_ring)!=currRing))
6466 {
6467 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6468 return TRUE;
6469 }
6470 }
6471 else if (h->typ==IDEAL_CMD)
6472 {
6473 mapping=IDMAP(h);
6474 }
6475 else
6476 {
6477 Werror("`%s` is no map nor ideal",IDID(h));
6478 return TRUE;
6479 }
6480 }
6481 else
6482 {
6483 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6484 return TRUE;
6485 }
6486 ideal image;
6487 if (kernel_cmd) image=idInit(1,1);
6488 else
6489 {
6490 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6491 {
6492 if (h->typ==IDEAL_CMD)
6493 {
6494 image=IDIDEAL(h);
6495 }
6496 else
6497 {
6498 Werror("`%s` is no ideal",IDID(h));
6499 return TRUE;
6500 }
6501 }
6502 else
6503 {
6504 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6505 return TRUE;
6506 }
6507 }
6508 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6509 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6510 {
6511 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6512 }
6513 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6514 if (kernel_cmd) idDelete(&image);
6515 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6516}
#define IDMAP(a)
Definition: ipid.h:135
#define IDIDEAL(a)
Definition: ipid.h:133
#define IDID(a)
Definition: ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:57
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:761
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4780 of file iparith.cc.

4781{
4782 map mapping=(map)v->Data();
4783 syMake(res,omStrDup(mapping->preimage));
4784 return FALSE;
4785}

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4786 of file iparith.cc.

4787{
4788 int i = IsPrime((int)(long)(v->Data()));
4789 res->data = (char *)(long)(i > 1 ? i : 2);
4790 return FALSE;
4791}
int IsPrime(int p)
Definition: prime.cc:61

◆ jjPROC()

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

Definition at line 1618 of file iparith.cc.

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

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3778 of file iparith.cc.

3779{
3780 return jjPROC(res,u,NULL);
3781}
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1618

◆ jjPROC3()

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

Definition at line 5951 of file iparith.cc.

5952{
5954 memcpy(v->next,w,sizeof(sleftv));
5955 w->Init();
5956 return jjPROC(res,u,v);
5957}

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4792 of file iparith.cc.

4793{
4794 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4795 ideal v_id=(ideal)v->Data();
4796 if (w!=NULL)
4797 {
4798 if (!idTestHomModule(v_id,currRing->qideal,w))
4799 {
4800 WarnS("wrong weights");
4801 w=NULL;
4802 // and continue at the non-homog case below
4803 }
4804 else
4805 {
4806 w=ivCopy(w);
4807 intvec **ww=&w;
4808 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4809 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4810 return FALSE;
4811 }
4812 }
4813 res->data = (char *)idMinEmbedding(v_id);
4814 return FALSE;
4815}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2681

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8542 of file iparith.cc.

8543{
8544 if ((INPUT->Typ() != MATRIX_CMD) ||
8545 (INPUT->next->Typ() != NUMBER_CMD) ||
8546 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8547 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8548 {
8549 WerrorS("expected (matrix, number, number, number) as arguments");
8550 return TRUE;
8551 }
8552 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8553 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8554 (number)(v->Data()),
8555 (number)(w->Data()),
8556 (number)(x->Data()));
8557 return FALSE;
8558}
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 3024 of file iparith.cc.

3025{
3026 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3027 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3029 return FALSE;
3030}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1494

◆ jjRANDOM()

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

Definition at line 3031 of file iparith.cc.

3032{
3033 int i=(int)(long)u->Data();
3034 int j=(int)(long)v->Data();
3035 if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
3036 res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
3037 return FALSE;
3038}
int siRand()
Definition: sirandom.c:42

◆ jjRANDOM_Im()

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

Definition at line 6517 of file iparith.cc.

6518{
6519 int di, k;
6520 int i=(int)(long)u->Data();
6521 int r=(int)(long)v->Data();
6522 int c=(int)(long)w->Data();
6523 if ((r<=0) || (c<=0)) return TRUE;
6524 intvec *iv = new intvec(r, c, 0);
6525 if (iv->rows()==0)
6526 {
6527 delete iv;
6528 return TRUE;
6529 }
6530 if (i!=0)
6531 {
6532 if (i<0) i = -i;
6533 di = 2 * i + 1;
6534 for (k=0; k<iv->length(); k++)
6535 {
6536 (*iv)[k] = ((siRand() % di) - i);
6537 }
6538 }
6539 res->data = (char *)iv;
6540 return FALSE;
6541}

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4854 of file iparith.cc.

4855{
4856 matrix m =(matrix)v->Data();
4857 int rank = luRank(m, 0);
4858 res->data =(char *)(long)rank;
4859 return FALSE;
4860}
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 3039 of file iparith.cc.

3040{
3041 matrix m =(matrix)u->Data();
3042 int isRowEchelon = (int)(long)v->Data();
3043 if (isRowEchelon != 1) isRowEchelon = 0;
3044 int rank = luRank(m, isRowEchelon);
3045 res->data =(char *)(long)rank;
3046 return FALSE;
3047}

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5583 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4861 of file iparith.cc.

4862{
4863 return jjREAD2(res,v,NULL);
4864}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3048

◆ jjREAD2()

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

Definition at line 3048 of file iparith.cc.

3049{
3050 si_link l=(si_link)u->Data();
3051 leftv r=slRead(l,v);
3052 if (r==NULL)
3053 {
3054 const char *s;
3055 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3056 else s=sNoName_fe;
3057 Werror("cannot read from `%s`",s);
3058 return TRUE;
3059 }
3060 memcpy(res,r,sizeof(sleftv));
3062 return FALSE;
3063}

◆ jjREDUCE3_CID()

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

Definition at line 6962 of file iparith.cc.

6963{
6965 if (!idIsZeroDim((ideal)v->Data()))
6966 {
6967 Werror("`%s` must be 0-dimensional",v->Name());
6968 return TRUE;
6969 }
6970 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
6971 (matrix)w->CopyD());
6972 return FALSE;
6973}
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:176
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:2135

◆ jjREDUCE3_CP()

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

Definition at line 6950 of file iparith.cc.

6951{
6953 if (!idIsZeroDim((ideal)v->Data()))
6954 {
6955 Werror("`%s` must be 0-dimensional",v->Name());
6956 return TRUE;
6957 }
6958 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
6959 (poly)w->CopyD());
6960 return FALSE;
6961}

◆ jjREDUCE3_ID()

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

Definition at line 6981 of file iparith.cc.

6982{
6984 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
6985 0,(int)(long)w->Data());
6986 return FALSE;
6987}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:3167

◆ jjREDUCE3_P()

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

Definition at line 6974 of file iparith.cc.

6975{
6977 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
6978 0,(int)(long)w->Data());
6979 return FALSE;
6980}

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 8077 of file iparith.cc.

8078{
8079 leftv u1=u;
8080 leftv u2=u1->next;
8081 leftv u3=u2->next;
8082 leftv u4=u3->next;
8083 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8084 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8085 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8086 {
8087 int save_d=Kstd1_deg;
8088 Kstd1_deg=(int)(long)u3->Data();
8089 kModW=(intvec *)u4->Data();
8090 BITSET save2;
8091 SI_SAVE_OPT2(save2);
8093 u2->next=NULL;
8094 BOOLEAN r=jjCALL2ARG(res,u);
8095 kModW=NULL;
8096 Kstd1_deg=save_d;
8097 SI_RESTORE_OPT2(save2);
8098 u->next->next=u3;
8099 return r;
8100 }
8101 else
8102 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8103 (u4->Typ()==INT_CMD))
8104 {
8105 assumeStdFlag(u3);
8106 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8107 {
8108 WerrorS("2nd argument must be a diagonal matrix of units");
8109 return TRUE;
8110 }
8111 res->data=(char*)redNF(
8112 idCopy((ideal)u3->Data()),
8113 idCopy((ideal)u1->Data()),
8114 mp_Copy((matrix)u2->Data(), currRing),
8115 (int)(long)u4->Data()
8116 );
8117 return FALSE;
8118 }
8119 else
8120 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8121 (u4->Typ()==INT_CMD))
8122 {
8123 poly u1p;
8124 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8125 else u1p=(poly)u1->Data();
8126 poly u2p;
8127 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8128 else u2p=(poly)u2->Data();
8129 assumeStdFlag(u3);
8130 if(!pIsUnit(u2p))
8131 {
8132 WerrorS("2nd argument must be a unit");
8133 return TRUE;
8134 }
8135 res->rtyp=POLY_CMD;
8136 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8137 pCopy(u2p),(int)(long)u4->Data());
8138 return FALSE;
8139 }
8140 else
8141 {
8142 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8143 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8144 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8145 return TRUE;
8146 }
8147}
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:7114
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:49
VAR unsigned si_opt_2
Definition: options.c:6
#define SI_SAVE_OPT2(A)
Definition: options.h:22
#define SI_RESTORE_OPT2(A)
Definition: options.h:25
#define V_DEG_STOP
Definition: options.h:72
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
#define BITSET
Definition: structs.h:16

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 8148 of file iparith.cc.

8149{
8150 leftv u1=u;
8151 leftv u2=u1->next;
8152 leftv u3=u2->next;
8153 leftv u4=u3->next;
8154 leftv u5=u4->next;
8155 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8156 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8157 {
8158 assumeStdFlag(u3);
8159 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8160 {
8161 WerrorS("2nd argument must be a diagonal matrix of units");
8162 return TRUE;
8163 }
8164 res->data=(char*)redNF(
8165 idCopy((ideal)u3->Data()),
8166 idCopy((ideal)u1->Data()),
8167 mp_Copy((matrix)u2->Data(),currRing),
8168 (int)(long)u4->Data(),
8169 (intvec*)u5->Data()
8170 );
8171 return FALSE;
8172 }
8173 else
8174 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8175 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8176 {
8177 assumeStdFlag(u3);
8178 if(!pIsUnit((poly)u2->Data()))
8179 {
8180 WerrorS("2nd argument must be a unit");
8181 return TRUE;
8182 }
8183 res->rtyp=POLY_CMD;
8184 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8185 pCopy((poly)u2->Data()),
8186 (int)(long)u4->Data(),(intvec*)u5->Data());
8187 return FALSE;
8188 }
8189 else
8190 {
8191 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8192 Tok2Cmdname(iiOp));
8193 return TRUE;
8194 }
8195}

◆ jjREDUCE_ID()

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

Definition at line 3072 of file iparith.cc.

3073{
3074 ideal ui=(ideal)u->Data();
3075 ideal vi=(ideal)v->Data();
3076 if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
3078 res->data = (char *)kNF(vi,currRing->qideal,ui);
3079 return FALSE;
3080}

◆ jjREDUCE_P()

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

Definition at line 3064 of file iparith.cc.

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

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4865 of file iparith.cc.

4866{
4867 res->data = (char *)(long)iiRegularity((lists)v->Data());
4868 return FALSE;
4869}
int iiRegularity(lists L)
Definition: ipshell.cc:1037

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4870 of file iparith.cc.

4871{
4872 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4873 return FALSE;
4874}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition: coeffs.h:790

◆ jjRES()

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

Definition at line 3081 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 6989 of file iparith.cc.

6990{
6991 int maxl=(int)v->Data();
6992 ideal u_id=(ideal)u->Data();
6993 int l=0;
6994 resolvente r;
6995 intvec **weights=NULL;
6996 int wmaxl=maxl;
6997 maxl--;
6998 unsigned save_opt=si_opt_1;
7000 if ((maxl==-1) && (iiOp!=MRES_CMD))
7001 maxl = currRing->N-1;
7002 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7003 {
7004 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7005 if (iv!=NULL)
7006 {
7007 l=1;
7008 if (!idTestHomModule(u_id,currRing->qideal,iv))
7009 {
7010 WarnS("wrong weights");
7011 iv=NULL;
7012 }
7013 else
7014 {
7015 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7016 weights[0] = ivCopy(iv);
7017 }
7018 }
7019 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7020 }
7021 else
7022 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7023 if (r==NULL) return TRUE;
7024 int t3=u->Typ();
7025 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7026 si_opt_1=save_opt;
7027 return FALSE;
7028}
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:847
EXTERN_VAR omBin char_ptr_bin
Definition: structs.h:77
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:389
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:855

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 8196 of file iparith.cc.

8197{
8198 unsigned i=1;
8199 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8200 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8201 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8202 // sArithBase.nCmdAllocated);
8203 for(i=0; i<nCount; i++)
8204 {
8205 Print("%-20s",sArithBase.sCmds[i+1].name);
8206 if(i+1+nCount<sArithBase.nCmdUsed)
8207 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8208 if(i+1+2*nCount<sArithBase.nCmdUsed)
8209 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8210 //if ((i%3)==1) PrintLn();
8211 PrintLn();
8212 }
8213 PrintLn();
8215 return FALSE;
8216}
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:235

◆ jjRESERVEDLIST0()

static BOOLEAN jjRESERVEDLIST0 ( leftv  res,
leftv   
)
static

Definition at line 8218 of file iparith.cc.

8219{
8220 unsigned i=1;
8221 int l = 0;
8222 int k = 0;
8224 struct blackbox_list *bb_list = NULL;
8225 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8226
8227 if ((3*nCount) < sArithBase.nCmdUsed)
8228 {
8229 nCount++;
8230 }
8231 bb_list = getBlackboxTypes();
8232 // count the number of entries;
8233 for (i=0; i<nCount; i++)
8234 {
8235 l++;
8236 if (i + 1 + nCount < sArithBase.nCmdUsed)
8237 {
8238 l++;
8239 }
8240 if(i+1+2*nCount<sArithBase.nCmdUsed)
8241 {
8242 l++;
8243 }
8244 }
8245 for (i = 0; i < bb_list->count; i++)
8246 {
8247 if (bb_list->list[i] != NULL)
8248 {
8249 l++;
8250 }
8251 }
8252 // initiate list
8253 L->Init(l);
8254 k = 0;
8255 for (i=0; i<nCount; i++)
8256 {
8257 L->m[k].rtyp = STRING_CMD;
8258 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8259 k++;
8260 // Print("%-20s", sArithBase.sCmds[i+1].name);
8261 if (i + 1 + nCount < sArithBase.nCmdUsed)
8262 {
8263 L->m[k].rtyp = STRING_CMD;
8264 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8265 k++;
8266 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8267 }
8268 if(i+1+2*nCount<sArithBase.nCmdUsed)
8269 {
8270 L->m[k].rtyp = STRING_CMD;
8271 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8272 k++;
8273 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8274 }
8275 // PrintLn();
8276 }
8277
8278 // assign blackbox types
8279 for (i = 0; i < bb_list->count; i++)
8280 {
8281 if (bb_list->list[i] != NULL)
8282 {
8283 L->m[k].rtyp = STRING_CMD;
8284 // already used strdup in getBlackBoxTypes
8285 L->m[k].data = bb_list->list[i];
8286 k++;
8287 }
8288 }
8289 // free the struct (not the list entries itself, which were allocated
8290 // by strdup)
8291 omfree(bb_list->list);
8292 omfree(bb_list);
8293
8294 // pass the resultant list to the res datastructure
8295 res->data=(void *)L;
8296
8297 return FALSE;
8298}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition: blackbox.cc:244
void ** list
Definition: blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition: blackbox.h:84

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4832 of file iparith.cc.

4833{
4834 char *s= (char *)v->Data();
4835 // try system keywords
4836 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4837 {
4838 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4839 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4840 {
4841 res->data = (char *)1;
4842 return FALSE;
4843 }
4844 }
4845 // try blackbox names
4846 int id;
4847 blackboxIsCmd(s,id);
4848 if (id>0)
4849 {
4850 res->data = (char *)1;
4851 }
4852 return FALSE;
4853}

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 8671 of file iparith.cc.

8672{
8673 int c=(int)(long)u->Data();
8674 switch(c)
8675 {
8676 case 0:{
8677 PrintS("delete all variables\n");
8678 killlocals(0);
8679 WerrorS("restarting...");
8680 break;
8681 };
8682 default: WerrorS("not implemented");
8683 }
8684 return FALSE;
8685}
void killlocals(int v)
Definition: ipshell.cc:386

◆ jjRIGHTSTD()

static BOOLEAN jjRIGHTSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5249 of file iparith.cc.

5250{
5251#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5252 if (rIsLPRing(currRing))
5253 {
5255 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5256 ideal result;
5257 ideal v_id=(ideal)v->Data();
5258 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5259 /* tHomog hom=testHomog; */
5260 /* if (w!=NULL) */
5261 /* { */
5262 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5263 /* { */
5264 /* WarnS("wrong weights"); */
5265 /* w=NULL; */
5266 /* } */
5267 /* else */
5268 /* { */
5269 /* hom=isHomog; */
5270 /* w=ivCopy(w); */
5271 /* } */
5272 /* } */
5273 /* result=kStd(v_id,currRing->qideal,hom,&w); */
5274 result = rightgb(v_id, currRing->qideal);
5276 res->data = (char *)result;
5278 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5279 return FALSE;
5280 }
5281 else if (rIsPluralRing(currRing))
5282 {
5283 ideal I=(ideal)v->Data();
5284
5285 ring A = currRing;
5286 ring Aopp = rOpposite(A);
5287 currRing = Aopp;
5288 ideal Iopp = idOppose(A, I, Aopp);
5289 ideal Jopp = kStd(Iopp,currRing->qideal,testHomog,NULL);
5290 currRing = A;
5291 ideal J = idOppose(Aopp, Jopp, A);
5292
5293 id_Delete(&Iopp, Aopp);
5294 id_Delete(&Jopp, Aopp);
5295 rDelete(Aopp);
5296
5297 idSkipZeroes(J);
5298 res->data = (char *)J;
5300 return FALSE;
5301 }
5302 else
5303 {
5304 return jjSTD(res, v);
5305 }
5306#else
5307 return TRUE;
5308#endif
5309}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition: iparith.cc:5050
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2433
ideal rightgb(ideal F, ideal Q)
Definition: kstd2.cc:4715
#define TEST_OPT_DEGBOUND
Definition: options.h:113
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:449
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:516

◆ jjRING3()

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

Definition at line 7030 of file iparith.cc.

7031{
7032 res->data=(void *)rInit(u,v,w);
7033 return (res->data==NULL);
7034}
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5628

◆ jjRING_1()

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

Definition at line 1674 of file iparith.cc.

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

◆ jjRING_2()

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

Definition at line 5958 of file iparith.cc.

5959{
5960 u->next=(leftv)omAlloc(sizeof(sleftv));
5961 memcpy(u->next,v,sizeof(sleftv));
5962 v->Init();
5963 u->next->next=(leftv)omAlloc(sizeof(sleftv));
5964 memcpy(u->next->next,w,sizeof(sleftv));
5965 w->Init();
5966 BOOLEAN bo=iiExprArithM(res,u,'[');
5967 u->next=NULL;
5968 return bo;
5969}

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4897 of file iparith.cc.

4898{
4899 ring r=(ring)v->Data();
4900 if (r!=NULL)
4901 res->data = (char *)rDecompose_list_cf((ring)v->Data());
4902 return (r==NULL)||(res->data==NULL);
4903}
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:2126

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 8642 of file iparith.cc.

8643{
8644 //Print("construct ring\n");
8645 if (a->Typ()!=CRING_CMD)
8646 {
8647 WerrorS("expected `cring` [ `id` ... ]");
8648 return TRUE;
8649 }
8650 assume(a->next!=NULL);
8651 leftv names=a->next;
8652 int N=names->listLength();
8653 char **n=(char**)omAlloc0(N*sizeof(char*));
8654 for(int i=0; i<N;i++,names=names->next)
8655 {
8656 n[i]=(char *)names->Name();
8657 }
8658 coeffs cf=(coeffs)a->CopyD();
8659 res->data=rDefault(cf,N,n, ringorder_dp);
8660 omFreeSize(n,N*sizeof(char*));
8661 return FALSE;
8662}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102
@ ringorder_dp
Definition: ring.h:78
@ CRING_CMD
Definition: tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4875 of file iparith.cc.

4876{
4877 ring r=(ring)v->Data();
4878 if (r!=NULL)
4879 {
4880 res->data = (char *)rDecompose((ring)v->Data());
4881 if (res->data!=NULL)
4882 {
4883 long mm=r->wanted_maxExp;
4884 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4885 return FALSE;
4886 }
4887 }
4888 return TRUE;
4889}
lists rDecompose(const ring r)
Definition: ipshell.cc:2165

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4890 of file iparith.cc.

4891{
4892 coeffs r=(coeffs)v->Data();
4893 if (r!=NULL)
4894 return rDecompose_CF(res,r);
4895 return TRUE;
4896}
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1953

◆ jjRMINUS()

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

Definition at line 3236 of file iparith.cc.

3237{
3238 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3239 res->data = (char *)r;
3240 return r==NULL;
3241}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition: ring.cc:5861

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5626 of file iparith.cc.

5627{
5628 res->data = rOrdStr((ring)v->Data());
5629 return FALSE;
5630}
char * rOrdStr(ring r)
Definition: ring.cc:520

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4904 of file iparith.cc.

4905{
4906 ideal i = (ideal)v->Data();
4907 res->data = (char *)i->rank;
4908 return FALSE;
4909}

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4910 of file iparith.cc.

4911{
4912 res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
4913 return FALSE;
4914}

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4915 of file iparith.cc.

4916{
4917 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
4918 return FALSE;
4919}

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4920 of file iparith.cc.

4921{
4922 res->data = (char *)(long)rPar(((ring)v->Data()));
4923 return FALSE;
4924}

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5636 of file iparith.cc.

5637{
5638 res->data = rParStr((ring)v->Data());
5639 return FALSE;
5640}
char * rParStr(ring r)
Definition: ring.cc:647

◆ jjRPLUS()

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

Definition at line 3242 of file iparith.cc.

3243{
3244 int left;
3245 if (u->Typ()==RING_CMD) left=0;
3246 else
3247 {
3248 leftv h=u;u=v;v=h;
3249 left=1;
3250 }
3251 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3252 res->data = (char *)r;
3253 return r==NULL;
3254}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition: ring.cc:5779

◆ jjRSUM()

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

Definition at line 3255 of file iparith.cc.

3256{
3257 ring r;
3258 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3259 res->data = (char *)r;
3260 return (i==-1);
3261}
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1344

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5631 of file iparith.cc.

5632{
5633 res->data = rVarStr((ring)v->Data());
5634 return FALSE;
5635}
char * rVarStr(ring r)
Definition: ring.cc:621

◆ jjS2I()

static BOOLEAN jjS2I ( leftv  res,
leftv  v 
)
static

Definition at line 4925 of file iparith.cc.

4926{
4927 res->data = (char *)(long)atoi((char*)v->Data());
4928 return FALSE;
4929}

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 4972 of file iparith.cc.

4973{
4974 ideal result;
4975 ideal v_id=(ideal)v->Data();
4976 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4977 tHomog hom=testHomog;
4978 if (w!=NULL)
4979 {
4980 if (!idTestHomModule(v_id,currRing->qideal,w))
4981 {
4982 WarnS("wrong weights");
4983 w=NULL;
4984 }
4985 else
4986 {
4987 hom=isHomog;
4988 w=ivCopy(w);
4989 }
4990 }
4991 result=kSba(v_id,currRing->qideal,hom,&w,1,0);
4993 res->data = (char *)result;
4995 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4996 return FALSE;
4997}
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2617

◆ jjSBA_1()

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

Definition at line 4998 of file iparith.cc.

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

◆ jjSBA_2()

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

Definition at line 5024 of file iparith.cc.

5025{
5026 ideal result;
5027 ideal v_id=(ideal)v->Data();
5028 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5029 tHomog hom=testHomog;
5030 if (w!=NULL)
5031 {
5032 if (!idTestHomModule(v_id,currRing->qideal,w))
5033 {
5034 WarnS("wrong weights");
5035 w=NULL;
5036 }
5037 else
5038 {
5039 hom=isHomog;
5040 w=ivCopy(w);
5041 }
5042 }
5043 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
5045 res->data = (char *)result;
5047 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5048 return FALSE;
5049}

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3758 of file iparith.cc.

3759{
3760 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3761 else
3762 {
3763 ring r=(ring)u->Data();
3764 idhdl h=rFindHdl(r,NULL);
3765 if (h==NULL)
3766 {
3767 char name_buffer[100];
3768 STATIC_VAR int ending=1000000;
3769 ending++;
3770 sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3771 h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3772 IDRING(h)=rIncRefCnt(r);
3773 }
3774 rSetHdl(h);
3775 }
3776 return FALSE;
3777}
#define STATIC_VAR
Definition: globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1705
void rSetHdl(idhdl h)
Definition: ipshell.cc:5129

◆ jjSIMPL_ID()

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

Definition at line 3269 of file iparith.cc.

3270{
3271 int sw = (int)(long)v->Data();
3272 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3273 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3274 if (sw & SIMPL_LMDIV)
3275 {
3276 id_DelDiv(id,currRing);
3277 }
3278 if (sw & SIMPL_LMEQ)
3279 {
3281 }
3282 if (sw & SIMPL_MULT)
3283 {
3285 }
3286 else if(sw & SIMPL_EQU)
3287 {
3289 }
3290 if (sw & SIMPL_NULL)
3291 {
3292 idSkipZeroes(id);
3293 }
3294 if (sw & SIMPL_NORM)
3295 {
3296 id_Norm(id,currRing);
3297 }
3298 if (sw & SIMPL_NORMALIZE)
3299 {
3301 }
3302 res->data = (char * )id;
3303 return FALSE;
3304}
#define SIMPL_EQU
Definition: iparith.cc:3266
#define SIMPL_NORM
Definition: iparith.cc:3268
#define SIMPL_LMEQ
Definition: iparith.cc:3264
#define SIMPL_NULL
Definition: iparith.cc:3267
#define SIMPL_MULT
Definition: iparith.cc:3265
#define SIMPL_NORMALIZE
Definition: iparith.cc:3262
#define SIMPL_LMDIV
Definition: iparith.cc:3263
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 3364 of file iparith.cc.

3365{
3366 int sw = (int)(long)v->Data();
3367 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3368 poly p = (poly)u->CopyD(POLY_CMD);
3369 if (sw & SIMPL_NORM)
3370 {
3371 pNorm(p);
3372 }
3373 if (sw & SIMPL_NORMALIZE)
3374 {
3376 }
3377 res->data = (char * )p;
3378 return FALSE;
3379}
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3847
void pNorm(poly p)
Definition: polys.h:363

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4930 of file iparith.cc.

4931{
4932 const bool bIsSCA = rIsSCA(currRing);
4933
4934 if ((currRing->qideal!=NULL) && !bIsSCA)
4935 {
4936 WerrorS("qring not supported by slimgb at the moment");
4937 return TRUE;
4938 }
4940 {
4941 WerrorS("ordering must be global for slimgb");
4942 return TRUE;
4943 }
4945 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4946 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4947 // tHomog hom=testHomog;
4948 ideal u_id=(ideal)u->Data();
4949 if (w!=NULL)
4950 {
4951 if (!idTestHomModule(u_id,currRing->qideal,w))
4952 {
4953 WarnS("wrong weights");
4954 w=NULL;
4955 }
4956 else
4957 {
4958 w=ivCopy(w);
4959 // hom=isHomog;
4960 }
4961 }
4962
4963 assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
4964 res->data=(char *)t_rep_gb(currRing,
4965 u_id,u_id->rank);
4966 //res->data=(char *)t_rep_gb(currRing, u_id);
4967
4969 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4970 return FALSE;
4971}
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:3585

◆ jjSMATRIX_Mo()

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

Definition at line 6870 of file iparith.cc.

6871{
6872 int mi=(int)(long)v->Data();
6873 int ni=(int)(long)w->Data();
6874 if ((mi<0)||(ni<1))
6875 {
6876 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
6877 return TRUE;
6878 }
6879 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
6880 mi,ni,currRing);
6881 return FALSE;
6882}
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 5078 of file iparith.cc.

5079{
5080 res->data = (char *)idSort((ideal)v->Data());
5081 return FALSE;
5082}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:184

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 10178 of file iparith.cc.

10179{
10180 lists l=(lists)arg->Data();
10181 if (l->nr>0)
10182 {
10183 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10184 }
10185 return FALSE;
10186}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:10137

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 5083 of file iparith.cc.

5084{
5086 intvec *v=NULL;
5087 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5088 if (f==NULL) return TRUE;
5089 ivTest(v);
5091 l->Init(2);
5092 l->m[0].rtyp=IDEAL_CMD;
5093 l->m[0].data=(void *)f;
5094 l->m[1].rtyp=INTVEC_CMD;
5095 l->m[1].data=(void *)v;
5096 res->data=(void *)l;
5097 return FALSE;
5098}
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1315

◆ jjSQR_FREE2()

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

Definition at line 3306 of file iparith.cc.

3307{
3308 intvec *v=NULL;
3309 int sw=(int)(long)dummy->Data();
3310 int fac_sw=sw;
3311 if (sw<0) fac_sw=1;
3313 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3314 if (f==NULL)
3315 return TRUE;
3316 switch(sw)
3317 {
3318 case 0:
3319 case 2:
3320 {
3322 l->Init(2);
3323 l->m[0].rtyp=IDEAL_CMD;
3324 l->m[0].data=(void *)f;
3325 l->m[1].rtyp=INTVEC_CMD;
3326 l->m[1].data=(void *)v;
3327 res->data=(void *)l;
3328 res->rtyp=LIST_CMD;
3329 return FALSE;
3330 }
3331 case 1:
3332 res->data=(void *)f;
3333 return FALSE;
3334 case 3:
3335 {
3336 poly p=f->m[0];
3337 int i=IDELEMS(f);
3338 f->m[0]=NULL;
3339 while(i>1)
3340 {
3341 i--;
3342 p=pMult(p,f->m[i]);
3343 f->m[i]=NULL;
3344 }
3345 res->data=(void *)p;
3346 res->rtyp=POLY_CMD;
3347 }
3348 return FALSE;
3349 }
3350 WerrorS("invalid switch");
3351 return FALSE;
3352}

◆ jjSTATUS2()

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

Definition at line 3353 of file iparith.cc.

3354{
3355 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3356 return FALSE;
3357}

◆ jjSTATUS2L()

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

Definition at line 3358 of file iparith.cc.

3359{
3360 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3361 //return (res->data== (void*)(long)-2);
3362 return FALSE;
3363}

◆ jjSTATUS3()

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

Definition at line 7035 of file iparith.cc.

7036{
7037 int yes;
7038 jjSTATUS2(res, u, v);
7039 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7040 omFree((ADDRESS) res->data);
7041 res->data = (void *)(long)yes;
7042 return FALSE;
7043}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3353

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 8484 of file iparith.cc.

8485{
8486 if ((v->Typ() != LINK_CMD) ||
8487 (v->next->Typ() != STRING_CMD) ||
8488 (v->next->next->Typ() != STRING_CMD) ||
8489 (v->next->next->next->Typ() != INT_CMD))
8490 return TRUE;
8491 jjSTATUS3(res, v, v->next, v->next->next);
8492#if defined(HAVE_USLEEP)
8493 if (((long) res->data) == 0L)
8494 {
8495 int i_s = (int)(long) v->next->next->next->Data();
8496 if (i_s > 0)
8497 {
8498 usleep((int)(long) v->next->next->next->Data());
8499 jjSTATUS3(res, v, v->next, v->next->next);
8500 }
8501 }
8502#elif defined(HAVE_SLEEP)
8503 if (((int) res->data) == 0)
8504 {
8505 int i_s = (int) v->next->next->next->Data();
8506 if (i_s > 0)
8507 {
8508 si_sleep((is - 1)/1000000 + 1);
8509 jjSTATUS3(res, v, v->next, v->next->next);
8510 }
8511 }
8512#endif
8513 return FALSE;
8514}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:7035
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 5050 of file iparith.cc.

5051{
5053 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5054 ideal result;
5055 ideal v_id=(ideal)v->Data();
5056 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5057 tHomog hom=testHomog;
5058 if (w!=NULL)
5059 {
5060 if (!idTestHomModule(v_id,currRing->qideal,w))
5061 {
5062 WarnS("wrong weights");
5063 w=NULL;
5064 }
5065 else
5066 {
5067 hom=isHomog;
5068 w=ivCopy(w);
5069 }
5070 }
5071 result=kStd(v_id,currRing->qideal,hom,&w);
5073 res->data = (char *)result;
5075 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5076 return FALSE;
5077}

◆ jjSTD_1()

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

Definition at line 3406 of file iparith.cc.

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

◆ jjSTD_HILB()

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

Definition at line 3380 of file iparith.cc.

3381{
3382 ideal result;
3383 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3384 tHomog hom=testHomog;
3385 ideal u_id=(ideal)(u->Data());
3386 if (w!=NULL)
3387 {
3388 if (!idTestHomModule(u_id,currRing->qideal,w))
3389 {
3390 WarnS("wrong weights:");w->show();PrintLn();
3391 w=NULL;
3392 }
3393 else
3394 {
3395 w=ivCopy(w);
3396 hom=isHomog;
3397 }
3398 }
3399 result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3401 res->data = (char *)result;
3403 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3404 return FALSE;
3405}

◆ jjSTD_HILB_W()

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

Definition at line 7044 of file iparith.cc.

7045{
7046 intvec *vw=(intvec *)w->Data(); // weights of vars
7047 if (vw->length()!=currRing->N)
7048 {
7049 Werror("%d weights for %d variables",vw->length(),currRing->N);
7050 return TRUE;
7051 }
7052 ideal result;
7053 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7054 tHomog hom=testHomog;
7055 ideal u_id=(ideal)(u->Data());
7056 if (ww!=NULL)
7057 {
7058 if (!idTestHomModule(u_id,currRing->qideal,ww))
7059 {
7060 WarnS("wrong weights");
7061 ww=NULL;
7062 }
7063 else
7064 {
7065 ww=ivCopy(ww);
7066 hom=isHomog;
7067 }
7068 }
7069 result=kStd(u_id,
7070 currRing->qideal,
7071 hom,
7072 &ww, // module weights
7073 (intvec *)v->Data(), // hilbert series
7074 0,0, // syzComp, newIdeal
7075 vw); // weights of vars
7077 res->data = (char *)result;
7079 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7080 return FALSE;
7081}

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 8559 of file iparith.cc.

8560{ ideal result;
8561 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8562 leftv v = u->next; /* one additional polynomial or ideal */
8563 leftv h = v->next; /* Hilbert vector */
8564 leftv w = h->next; /* weight vector */
8565 assumeStdFlag(u);
8566 ideal i1=(ideal)(u->Data());
8567 ideal i0;
8568 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8569 || (h->Typ()!=INTVEC_CMD)
8570 || (w->Typ()!=INTVEC_CMD))
8571 {
8572 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8573 return TRUE;
8574 }
8575 intvec *vw=(intvec *)w->Data(); // weights of vars
8576 /* merging std_hilb_w and std_1 */
8577 if (vw->length()!=currRing->N)
8578 {
8579 Werror("%d weights for %d variables",vw->length(),currRing->N);
8580 return TRUE;
8581 }
8582 int r=v->Typ();
8583 BOOLEAN cleanup_i0=FALSE;
8584 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8585 {
8586 i0=idInit(1,i1->rank);
8587 i0->m[0]=(poly)v->Data();
8588 cleanup_i0=TRUE;
8589 }
8590 else if (r==IDEAL_CMD)/* IDEAL */
8591 {
8592 i0=(ideal)v->Data();
8593 }
8594 else
8595 {
8596 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8597 return TRUE;
8598 }
8599 int ii0=idElem(i0);
8600 i1 = idSimpleAdd(i1,i0);
8601 if (cleanup_i0)
8602 {
8603 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8604 idDelete(&i0);
8605 }
8606 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8607 tHomog hom=testHomog;
8608 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8609 if (ww!=NULL)
8610 {
8611 if (!idTestHomModule(i1,currRing->qideal,ww))
8612 {
8613 WarnS("wrong weights");
8614 ww=NULL;
8615 }
8616 else
8617 {
8618 ww=ivCopy(ww);
8619 hom=isHomog;
8620 }
8621 }
8622 BITSET save1;
8623 SI_SAVE_OPT1(save1);
8625 result=kStd(i1,
8626 currRing->qideal,
8627 hom,
8628 &ww, // module weights
8629 (intvec *)h->Data(), // hilbert series
8630 0, // syzComp, whatever it is...
8631 IDELEMS(i1)-ii0, // new ideal
8632 vw); // weights of vars
8633 SI_RESTORE_OPT1(save1);
8634 idDelete(&i1);
8636 res->data = (char *)result;
8638 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8639 return FALSE;
8640}

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 8299 of file iparith.cc.

8300{
8301 if (v == NULL)
8302 {
8303 res->data = omStrDup("");
8304 return FALSE;
8305 }
8306 int n = v->listLength();
8307 if (n == 1)
8308 {
8309 res->data = v->String();
8310 return FALSE;
8311 }
8312
8313 char** slist = (char**) omAlloc(n*sizeof(char*));
8314 int i, j;
8315
8316 for (i=0, j=0; i<n; i++, v = v ->next)
8317 {
8318 slist[i] = v->String();
8319 assume(slist[i] != NULL);
8320 j+=strlen(slist[i]);
8321 }
8322 char* s = (char*) omAlloc((j+1)*sizeof(char));
8323 *s='\0';
8324 for (i=0;i<n;i++)
8325 {
8326 strcat(s, slist[i]);
8327 omFree(slist[i]);
8328 }
8329 omFreeSize(slist, n*sizeof(char*));
8330 res->data = s;
8331 return FALSE;
8332}

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5558 of file iparith.cc.

5559{
5560 res->data = (char *)strlen((char *)v->Data());
5561 return FALSE;
5562}

◆ jjSUBST_Bu()

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

Definition at line 6592 of file iparith.cc.

6593{
6594 // generic conversion from polyBucket to poly:
6595 // force this to be the first try everytime
6596 poly p; int l;
6597 sBucket_pt bu=(sBucket_pt)w->CopyD();
6598 sBucketDestroyAdd(bu,&p,&l);
6599 sleftv tmpw;
6600 tmpw.Init();
6601 tmpw.rtyp=POLY_CMD;
6602 tmpw.data=p;
6603 return iiExprArith3(res, iiOp, u, v, &tmpw);
6604}

◆ jjSUBST_Id()

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

Definition at line 6638 of file iparith.cc.

6639{
6640 int ringvar;
6641 poly monomexpr;
6642 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6643 if (nok) return TRUE;
6644 ideal id=(ideal)u->Data();
6645 if (ringvar>0)
6646 {
6647 BOOLEAN overflow=FALSE;
6648 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6649 {
6650 long deg_monexp=pTotaldegree(monomexpr);
6651 for(int i=IDELEMS(id)-1;i>=0;i--)
6652 {
6653 poly p=id->m[i];
6654 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6655 if ((p!=NULL) && (mm!=0) &&
6656 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6657 {
6658 overflow=TRUE;
6659 break;
6660 }
6661 }
6662 }
6663 if (overflow)
6664 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6665 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6666 {
6667 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6668 else id=id_Copy(id,currRing);
6669 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6670 }
6671 else
6672 res->data = idSubstPoly(id,ringvar,monomexpr);
6673 }
6674 else
6675 {
6676 if (rIsLPRing(currRing))
6677 {
6678 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6679 return TRUE;
6680 }
6681 res->data = idSubstPar(id,-ringvar,monomexpr);
6682 }
6683 return FALSE;
6684}
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:6564
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:426
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:387
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition: p_polys.cc:5036
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 6688 of file iparith.cc.

6689{
6690 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6691}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6696

◆ jjSUBST_Id_N()

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

Definition at line 6692 of file iparith.cc.

6693{
6694 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6695}

◆ jjSUBST_Id_X()

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

Definition at line 6696 of file iparith.cc.

6697{
6698 sleftv tmp;
6699 tmp.Init();
6700 // do not check the result, conversion from int/number to poly works always
6701 iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6702 BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6703 tmp.CleanUp();
6704 return b;
6705}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6638

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 8515 of file iparith.cc.

8516{
8517 leftv v = u->next; // number of args > 0
8518 if (v==NULL) return TRUE;
8519 leftv w = v->next;
8520 if (w==NULL) return TRUE;
8521 leftv rest = w->next;
8522
8523 u->next = NULL;
8524 v->next = NULL;
8525 w->next = NULL;
8526 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8527 if ((rest!=NULL) && (!b))
8528 {
8529 leftv tmp_next=res->next;
8530 res->next=rest;
8531 sleftv tmp_res;
8532 tmp_res.Init();
8533 b = iiExprArithM(&tmp_res,res,iiOp);
8534 memcpy(res,&tmp_res,sizeof(tmp_res));
8535 res->next=tmp_next;
8536 }
8537 u->next = v;
8538 v->next = w;
8539 // rest was w->next, but is already cleaned
8540 return b;
8541}

◆ jjSUBST_P()

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

Definition at line 6605 of file iparith.cc.

6606{
6607 int ringvar;
6608 poly monomexpr;
6609 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6610 if (nok) return TRUE;
6611 poly p=(poly)u->Data();
6612 if (ringvar>0)
6613 {
6614 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6615 if (!rIsLPRing(currRing) &&
6616 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6617 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6618 {
6619 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6620 //return TRUE;
6621 }
6622 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6623 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6624 else
6625 res->data= pSubstPoly(p,ringvar,monomexpr);
6626 }
6627 else
6628 {
6629 if (rIsLPRing(currRing))
6630 {
6631 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6632 return TRUE;
6633 }
6634 res->data=pSubstPar(p,-ringvar,monomexpr);
6635 }
6636 return FALSE;
6637}
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:404
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:267

◆ jjSUBST_Test()

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

Definition at line 6564 of file iparith.cc.

6566{
6567 monomexpr=(poly)w->Data();
6568 poly p=(poly)v->Data();
6569#if 0
6570 if (pLength(monomexpr)>1)
6571 {
6572 Werror("`%s` substitutes a ringvar only by a term",
6574 return TRUE;
6575 }
6576#endif
6577 if ((ringvar=pVar(p))==0)
6578 {
6579 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6580 {
6581 number n = pGetCoeff(p);
6582 ringvar= -n_IsParam(n, currRing);
6583 }
6584 if(ringvar==0)
6585 {
6586 WerrorS("ringvar/par expected");
6587 return TRUE;
6588 }
6589 }
6590 return FALSE;
6591}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5758
@ SUBST_CMD
Definition: tok.h:186

◆ jjSYZ_2()

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

Definition at line 3490 of file iparith.cc.

3491{
3492 // see jjSYZYGY
3493 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3494 intvec *w=NULL;
3495 tHomog hom=testHomog;
3496 ideal I=(ideal)u->Data();
3497 GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3498 if (ww!=NULL)
3499 {
3500 if (idTestHomModule(I,currRing->qideal,ww))
3501 {
3502 w=ivCopy(ww);
3503 int add_row_shift=w->min_in();
3504 (*w)-=add_row_shift;
3505 hom=isHomog;
3506 }
3507 else
3508 {
3509 //WarnS("wrong weights");
3510 delete ww; ww=NULL;
3511 hom=testHomog;
3512 }
3513 }
3514 else
3515 {
3516 if (u->Typ()==IDEAL_CMD)
3517 if (idHomIdeal(I,currRing->qideal))
3518 hom=isHomog;
3519 }
3520 ideal S=idSyzygies(I,hom,&w,TRUE,FALSE,NULL,alg);
3521 if (w!=NULL) delete w;
3522 res->data = (char *)S;
3523 if (hom==isHomog)
3524 {
3525 int vl=S->rank;
3526 intvec *vv=new intvec(vl);
3527 if ((u->Typ()==IDEAL_CMD)||(ww==NULL))
3528 {
3529 for(int i=0;i<vl;i++)
3530 {
3531 if (I->m[i]!=NULL)
3532 (*vv)[i]=p_Deg(I->m[i],currRing);
3533 }
3534 }
3535 else
3536 {
3537 p_SetModDeg(ww, currRing);
3538 for(int i=0;i<vl;i++)
3539 {
3540 if (I->m[i]!=NULL)
3541 (*vv)[i]=currRing->pFDeg(I->m[i],currRing);
3542 }
3544 }
3545 if (idTestHomModule(S,currRing->qideal,vv))
3546 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
3547 else
3548 delete vv;
3549 }
3551 return FALSE;
3552}
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:830
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3747
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:583

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 5110 of file iparith.cc.

5111{
5112 ideal v_id=(ideal)v->Data();
5113#ifdef HAVE_SHIFTBBA
5114 if (rIsLPRing(currRing))
5115 {
5116 if (currRing->LPncGenCount < IDELEMS(v_id))
5117 {
5118 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5119 return TRUE;
5120 }
5121 }
5122#endif
5123 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5124 intvec *w=NULL;
5125 tHomog hom=testHomog;
5126 if (ww!=NULL)
5127 {
5128 if (idTestHomModule(v_id,currRing->qideal,ww))
5129 {
5130 w=ivCopy(ww);
5131 int add_row_shift=w->min_in();
5132 (*w)-=add_row_shift;
5133 hom=isHomog;
5134 }
5135 else
5136 {
5137 //WarnS("wrong weights");
5138 delete ww; ww=NULL;
5139 hom=testHomog;
5140 }
5141 }
5142 else
5143 {
5144 if (v->Typ()==IDEAL_CMD)
5145 if (idHomIdeal(v_id,currRing->qideal))
5146 hom=isHomog;
5147 }
5148 ideal S=idSyzygies(v_id,hom,&w);
5149 res->data = (char *)S;
5150 if (hom==isHomog)
5151 {
5152 int vl=S->rank;
5153 intvec *vv=new intvec(vl);
5154 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5155 {
5156 for(int i=0;i<vl;i++)
5157 {
5158 if (v_id->m[i]!=NULL)
5159 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5160 }
5161 }
5162 else
5163 {
5164 p_SetModDeg(ww, currRing);
5165 for(int i=0;i<vl;i++)
5166 {
5167 if (v_id->m[i]!=NULL)
5168 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5169 }
5171 }
5172 if (idTestHomModule(S,currRing->qideal,vv))
5173 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5174 else
5175 delete vv;
5176 }
5177 if (w!=NULL) delete w;
5178 return FALSE;
5179}

◆ jjTENSOR()

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

Definition at line 3553 of file iparith.cc.

3554{
3555 ideal A=(ideal)u->Data();
3556 ideal B=(ideal)v->Data();
3557 res->data = (char *)sm_Tensor(A,B,currRing);
3558 return FALSE;
3559}
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition: matpol.cc:1831

◆ jjTENSOR_Ma()

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

Definition at line 3560 of file iparith.cc.

3561{
3562 sleftv tmp_u,tmp_v,tmp_res;
3566 tmp_res.Init();
3567 tmp_res.rtyp=SMATRIX_CMD;
3568 BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3569 if (!bo)
3570 {
3573 }
3574 tmp_u.CleanUp();
3575 tmp_v.CleanUp();
3576 tmp_res.CleanUp();
3577 return bo;
3578}
@ SMATRIX_CMD
Definition: grammar.cc:291
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition: iparith.cc:3553
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 8333 of file iparith.cc.

8334{
8335 do
8336 {
8337 if (v->Typ()!=INT_CMD)
8338 return TRUE;
8339 test_cmd((int)(long)v->Data());
8340 v=v->next;
8341 }
8342 while (v!=NULL);
8343 return FALSE;
8344}
void test_cmd(int i)
Definition: ipshell.cc:514

◆ jjTIMES_BI()

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

Definition at line 992 of file iparith.cc.

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

◆ jjTIMES_BIM()

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

Definition at line 1075 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 980 of file iparith.cc.

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

◆ jjTIMES_ID()

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

Definition at line 1056 of file iparith.cc.

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

◆ jjTIMES_IV()

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

Definition at line 1063 of file iparith.cc.

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

◆ jjTIMES_MA()

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

Definition at line 1139 of file iparith.cc.

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

◆ jjTIMES_MA_BI1()

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

Definition at line 1087 of file iparith.cc.

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

◆ jjTIMES_MA_BI2()

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

Definition at line 1097 of file iparith.cc.

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

◆ jjTIMES_MA_I1()

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

Definition at line 1130 of file iparith.cc.

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

◆ jjTIMES_MA_I2()

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

Definition at line 1135 of file iparith.cc.

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

◆ jjTIMES_MA_N1()

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

Definition at line 1119 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1126 of file iparith.cc.

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

◆ jjTIMES_MA_P1()

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

Definition at line 1101 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1110 of file iparith.cc.

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

◆ jjTIMES_N()

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

Definition at line 999 of file iparith.cc.

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

◆ jjTIMES_P()

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

Definition at line 1009 of file iparith.cc.

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

◆ jjTIMES_SM()

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

Definition at line 1153 of file iparith.cc.

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

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5181 of file iparith.cc.

5182{
5183 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5184 return FALSE;
5185}
int ivTrace(intvec *o)
Definition: intvec.cc:321

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 5186 of file iparith.cc.

5187{
5188 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5189 return FALSE;
5190}

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 5191 of file iparith.cc.

5192{
5193 res->data = (char *)ivTranp((intvec*)(v->Data()));
5194 return FALSE;
5195}
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 5230 of file iparith.cc.

5231{
5232#ifdef HAVE_PLURAL
5233 ideal result;
5234 ideal v_id=(ideal)a->Data();
5236 result=(ideal)twostd(v_id);
5237 else /*commutative or shiftalgebra*/
5238 {
5239 return jjSTD(res,a);
5240 }
5241 res->data = (char *)result;
5244 return FALSE;
5245#else
5246 return TRUE;
5247#endif
5248}
#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 5310 of file iparith.cc.

5311{
5312 int t=(int)(long)v->data;
5313 switch (t)
5314 {
5315 case CRING_CMD:
5316 case INT_CMD:
5317 case POLY_CMD:
5318 case VECTOR_CMD:
5319 case STRING_CMD:
5320 case INTVEC_CMD:
5321 case IDEAL_CMD:
5322 case MATRIX_CMD:
5323 case MODUL_CMD:
5324 case MAP_CMD:
5325 case PROC_CMD:
5326 case RING_CMD:
5327 case SMATRIX_CMD:
5328 //case QRING_CMD:
5329 case INTMAT_CMD:
5330 case BIGINTMAT_CMD:
5331 case NUMBER_CMD:
5332 #ifdef SINGULAR_4_2
5333 case CNUMBER_CMD:
5334 #endif
5335 case BIGINT_CMD:
5336 case BUCKET_CMD:
5337 case LIST_CMD:
5338 case PACKAGE_CMD:
5339 case LINK_CMD:
5340 case RESOLUTION_CMD:
5341 res->data=omStrDup(Tok2Cmdname(t)); break;
5342 case DEF_CMD:
5343 case NONE: res->data=omStrDup("none"); break;
5344 default:
5345 {
5346 if (t>MAX_TOK)
5347 res->data=omStrDup(getBlackboxName(t));
5348 else
5349 res->data=omStrDup("?unknown type?");
5350 break;
5351 }
5352 }
5353 return FALSE;
5354}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition: blackbox.cc:212
@ CNUMBER_CMD
Definition: tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3713 of file iparith.cc.

3714{
3715 number n=(number)u->CopyD(BIGINT_CMD);
3717 res->data = (char *)n;
3718 return FALSE;
3719}
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:557

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3750 of file iparith.cc.

3751{
3753 (*bim)*=(-1);
3754 res->data = (char *)bim;
3755 return FALSE;
3756}

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3720 of file iparith.cc.

3721{
3722 res->data = (char *)(-(long)u->Data());
3723 return FALSE;
3724}

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3743 of file iparith.cc.

3744{
3745 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3746 (*iv)*=(-1);
3747 res->data = (char *)iv;
3748 return FALSE;
3749}

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3737 of file iparith.cc.

3738{
3739 poly m1=pISet(-1);
3740 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3741 return FALSE;
3742}
#define pISet(i)
Definition: polys.h:312

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3725 of file iparith.cc.

3726{
3727 number n=(number)u->CopyD(NUMBER_CMD);
3728 n=nInpNeg(n);
3729 res->data = (char *)n;
3730 return FALSE;
3731}
#define nInpNeg(n)
Definition: numbers.h:21

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3732 of file iparith.cc.

3733{
3734 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3735 return FALSE;
3736}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 10187 of file iparith.cc.

10188{
10189 lists l=(lists)arg->Data();
10190 if (l->nr>0)
10191 {
10192 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10193 int i, j, len;
10194 len=l->nr;
10195 i=0;
10196 while(i<len)
10197 {
10198 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10199 {
10200 l->m[i].CleanUp();
10201 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10202 memset(&(l->m[len]),0,sizeof(sleftv));
10203 l->m[len].rtyp=DEF_CMD;
10204 len--;
10205 }
10206 else
10207 i++;
10208 }
10209 //Print("new len:%d\n",len);
10210 }
10211 return FALSE;
10212}

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5355 of file iparith.cc.

5356{
5357 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5358 return FALSE;
5359}
#define pIsUnivariate(p)
Definition: polys.h:249

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5360 of file iparith.cc.

5361{
5362 int i=(int)(long)v->Data();
5363 if ((0<i) && (i<=currRing->N))
5364 {
5365 poly p=pOne();
5366 pSetExp(p,i,1);
5367 pSetm(p);
5368 res->data=(char *)p;
5369 }
5370 else
5371 {
5372 Werror("var number %d out of range 1..%d",i,currRing->N);
5373 return TRUE;
5374 }
5375 return FALSE;
5376}

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5377 of file iparith.cc.

5378{
5379 if (currRing==NULL)
5380 {
5381 WerrorS("no ring active (2)");
5382 return TRUE;
5383 }
5384 int i=(int)(long)v->Data();
5385 if ((0<i) && (i<=currRing->N))
5386 res->data=omStrDup(currRing->names[i-1]);
5387 else
5388 {
5389 Werror("var number %d out of range 1..%d",i,currRing->N);
5390 return TRUE;
5391 }
5392 return FALSE;
5393}

◆ jjVARSTR2()

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

Definition at line 3579 of file iparith.cc.

3580{
3581 idhdl h=(idhdl)u->data;
3582 int i=(int)(long)v->Data();
3583 if ((0<i) && (i<=IDRING(h)->N))
3584 res->data=omStrDup(IDRING(h)->names[i-1]);
3585 else
3586 {
3587 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3588 return TRUE;
3589 }
3590 return FALSE;
3591}

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5394 of file iparith.cc.

5395{
5397#ifdef HAVE_SHIFTBBA
5398 if (rIsLPRing(currRing))
5399 {
5400#ifdef HAVE_RINGS
5402 {
5403 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5404 return TRUE;
5405 }
5406#endif
5407 if (currRing->qideal != NULL)
5408 {
5409 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5410 return TRUE;
5411 }
5412 int kDim = lp_kDim((ideal)(v->Data()));
5413 res->data = (char *)(long)kDim;
5414 return (kDim == -2);
5415 }
5416#endif
5417 res->data = (char *)(long)scMult0Int((ideal)v->Data(),currRing->qideal);
5418 return FALSE;
5419}
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:993
int lp_kDim(const ideal _G)
Definition: hdegree.cc:2090

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5420 of file iparith.cc.

5421{
5422// input: u: a list with links of type
5423// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5424// returns: -1: the read state of all links is eof
5425// i>0: (at least) u[i] is ready
5426 lists Lforks = (lists)u->Data();
5427 int i = slStatusSsiL(Lforks, -1);
5428 if(i == -2) /* error */
5429 {
5430 return TRUE;
5431 }
5432 res->data = (void*)(long)i;
5433 return FALSE;
5434}

◆ jjWAIT1ST2()

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

Definition at line 3592 of file iparith.cc.

3593{
3594// input: u: a list with links of type
3595// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3596// v: timeout for select in milliseconds
3597// or 0 for polling
3598// returns: ERROR (via Werror): timeout negative
3599// -1: the read state of all links is eof
3600// 0: timeout (or polling): none ready
3601// i>0: (at least) L[i] is ready
3602 lists Lforks = (lists)u->Data();
3603 int t = (int)(long)v->Data();
3604 if(t < 0)
3605 {
3606 WerrorS("negative timeout"); return TRUE;
3607 }
3608 int i = slStatusSsiL(Lforks, t*1000);
3609 if(i == -2) /* error */
3610 {
3611 return TRUE;
3612 }
3613 res->data = (void*)(long)i;
3614 return FALSE;
3615}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5435 of file iparith.cc.

5436{
5437// input: u: a list with links of type
5438// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5439// returns: -1: the read state of all links is eof
5440// 1: all links are ready
5441// (caution: at least one is ready, but some maybe dead)
5442 lists Lforks = (lists)u->CopyD();
5443 int i;
5444 int j = -1;
5445 for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5446 {
5447 i = slStatusSsiL(Lforks, -1);
5448 if(i == -2) /* error */
5449 {
5450 return TRUE;
5451 }
5452 if(i == -1)
5453 {
5454 break;
5455 }
5456 j = 1;
5457 Lforks->m[i-1].CleanUp();
5458 Lforks->m[i-1].rtyp=DEF_CMD;
5459 Lforks->m[i-1].data=NULL;
5460 }
5461 res->data = (void*)(long)j;
5462 Lforks->Clean();
5463 return FALSE;
5464}

◆ jjWAITALL2()

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

Definition at line 3616 of file iparith.cc.

3617{
3618// input: u: a list with links of type
3619// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3620// v: timeout for select in milliseconds
3621// or 0 for polling
3622// returns: ERROR (via Werror): timeout negative
3623// -1: the read state of all links is eof
3624// 0: timeout (or polling): none ready
3625// 1: all links are ready
3626// (caution: at least one is ready, but some maybe dead)
3627 lists Lforks = (lists)u->CopyD();
3628 int timeout = 1000*(int)(long)v->Data();
3629 if(timeout < 0)
3630 {
3631 WerrorS("negative timeout"); return TRUE;
3632 }
3633 int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3634 int i;
3635 int ret = -1;
3636 for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3637 {
3638 i = slStatusSsiL(Lforks, timeout);
3639 if(i > 0) /* Lforks[i] is ready */
3640 {
3641 ret = 1;
3642 Lforks->m[i-1].CleanUp();
3643 Lforks->m[i-1].rtyp=DEF_CMD;
3644 Lforks->m[i-1].data=NULL;
3645 timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3646 }
3647 else /* terminate the for loop */
3648 {
3649 if(i == -2) /* error */
3650 {
3651 return TRUE;
3652 }
3653 if(i == 0) /* timeout */
3654 {
3655 ret = 0;
3656 }
3657 break;
3658 }
3659 }
3660 Lforks->Clean();
3661 res->data = (void*)(long)ret;
3662 return FALSE;
3663}
#define TIMER_RESOLUTION
Definition: mod2.h:34
int getRTimer()
Definition: timer.cc:170

◆ jjWEDGE()

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

Definition at line 3664 of file iparith.cc.

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

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3671 of file iparith.cc.

3672{
3673 return TRUE;
3674}

◆ pHeadProc()

poly pHeadProc ( poly  p)

Definition at line 229 of file iparith.cc.

230{
231 return pHead(p);
232}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int  tok)

Definition at line 9593 of file iparith.cc.

9594{
9595 if (tok <= 0)
9596 {
9597 return sArithBase.sCmds[0].name;
9598 }
9599 if (tok==ANY_TYPE) return "any_type";
9600 if (tok==COMMAND) return "command";
9601 if (tok==NONE) return "nothing";
9602 if (tok < 128)
9603 {
9604 Tok2Cmdname_buf[0]=(char)tok;
9605 return Tok2Cmdname_buf;
9606 }
9607 //if (tok==IFBREAK) return "if_break";
9608 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9609 //if (tok==ORDER_VECTOR) return "ordering";
9610 //if (tok==REF_VAR) return "ref";
9611 //if (tok==OBJECT) return "object";
9612 //if (tok==PRINT_EXPR) return "print_expr";
9613 if (tok==IDHDL) return "identifier";
9614 if (tok>MAX_TOK) return getBlackboxName(tok);
9615 unsigned i;
9616 for(i=0; i<sArithBase.nCmdUsed; i++)
9617 //while (sArithBase.sCmds[i].tokval!=0)
9618 {
9619 if ((sArithBase.sCmds[i].tokval == tok)&&
9620 (sArithBase.sCmds[i].alias==0))
9621 {
9622 return sArithBase.sCmds[i].name;
9623 }
9624 }
9625 // try gain for alias/old names:
9626 for(i=0; i<sArithBase.nCmdUsed; i++)
9627 {
9628 if (sArithBase.sCmds[i].tokval == tok)
9629 {
9630 return sArithBase.sCmds[i].name;
9631 }
9632 }
9633 return sArithBase.sCmds[0].name;
9634}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:9592
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5538 of file iparith.cc.

5539{
5541}

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 214 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 215 of file iparith.cc.

◆ farey_cnt

long farey_cnt =0L

Definition at line 9 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 219 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 198 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2046 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9592 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5537 of file iparith.cc.