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

Go to the source code of this file.

Data Structures

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

Macros

#define PLURAL_MASK   3
 
#define RING_MASK   4
 
#define ZERODIVISOR_MASK   8
 
#define ALLOW_PLURAL   1
 
#define NO_PLURAL   0
 
#define COMM_PLURAL   2
 
#define ALLOW_RING   4
 
#define NO_RING   0
 
#define NO_ZERODIVISOR   8
 
#define ALLOW_ZERODIVISOR   0
 
#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

ring rCompose (const lists L, const BOOLEAN check_comp=TRUE, const long bitmask=0x7fff)
 
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_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_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_P (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 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 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_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_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 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 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 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 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 jjVARSTR2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAIT1ST2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWAITALL2 (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWEDGE (leftv res, leftv u, leftv v)
 
static BOOLEAN jjWRONG (leftv, leftv)
 
static BOOLEAN jjDUMMY (leftv res, leftv u)
 
static BOOLEAN jjNULL (leftv, leftv)
 
static BOOLEAN jjPLUSPLUS (leftv, leftv u)
 
static BOOLEAN jjUMINUS_BI (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_I (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_N (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_P (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_MA (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_IV (leftv res, leftv u)
 
static BOOLEAN jjUMINUS_BIM (leftv res, leftv u)
 
static BOOLEAN jjSetRing (leftv, leftv u)
 
static BOOLEAN jjPROC1 (leftv res, leftv u)
 
static BOOLEAN jjBAREISS (leftv res, leftv v)
 
static BOOLEAN jjBAREISS_BIM (leftv res, leftv v)
 
static BOOLEAN jjBI2N (leftv res, leftv u)
 
static BOOLEAN jjBI2IM (leftv res, leftv u)
 
static BOOLEAN jjBI2P (leftv res, leftv u)
 
static BOOLEAN jjCALL1MANY (leftv res, leftv u)
 
static BOOLEAN jjCHAR (leftv res, leftv v)
 
static BOOLEAN jjCOLS (leftv res, leftv v)
 
static BOOLEAN jjCOLS_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOLS_IV (leftv res, leftv v)
 
static BOOLEAN jjCONTENT (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BI (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_BIM (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_N (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_L (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_M (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_IV (leftv res, leftv v)
 
static BOOLEAN jjCOUNT_RG (leftv res, leftv v)
 
static BOOLEAN jjDEG (leftv res, leftv v)
 
static BOOLEAN jjDEG_M (leftv res, leftv u)
 
static BOOLEAN jjDEGREE (leftv res, leftv v)
 
static BOOLEAN jjDEFINED (leftv res, leftv v)
 
static BOOLEAN jjDENOMINATOR (leftv res, leftv v)
 Return the denominator of the input number NOTE: the input number is normalized as a side effect. More...
 
static BOOLEAN jjNUMERATOR (leftv res, leftv v)
 Return the numerator of the input number NOTE: the input number is normalized as a side effect. More...
 
static BOOLEAN jjDET (leftv res, leftv v)
 
static BOOLEAN jjDET_BI (leftv res, leftv v)
 
static BOOLEAN jjDET_I (leftv res, leftv v)
 
static BOOLEAN jjDET_S (leftv res, leftv v)
 
static BOOLEAN jjDIM (leftv res, leftv v)
 
static BOOLEAN jjDUMP (leftv, leftv v)
 
static BOOLEAN jjE (leftv res, leftv v)
 
static BOOLEAN jjEXECUTE (leftv, leftv v)
 
static BOOLEAN jjFACSTD (leftv res, leftv v)
 
static BOOLEAN jjFAC_P (leftv res, leftv u)
 
static BOOLEAN jjGETDUMP (leftv, leftv v)
 
static BOOLEAN jjHIGHCORNER (leftv res, leftv v)
 
static BOOLEAN jjHIGHCORNER_M (leftv res, leftv v)
 
static BOOLEAN jjHILBERT (leftv, leftv v)
 
static BOOLEAN jjHILBERT_IV (leftv res, leftv v)
 
static BOOLEAN jjHOMOG1 (leftv res, leftv v)
 
static BOOLEAN jjidMaxIdeal (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Ma (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_Map (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_R (leftv res, leftv v)
 
static BOOLEAN jjIm2Iv (leftv res, leftv v)
 
static BOOLEAN jjIMPART (leftv res, leftv v)
 
static BOOLEAN jjINDEPSET (leftv res, leftv v)
 
static BOOLEAN jjINTERRED (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_P (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR_S (leftv res, leftv v)
 
static BOOLEAN jjIS_RINGVAR0 (leftv res, leftv)
 
static BOOLEAN jjJACOB_P (leftv res, leftv v)
 
static BOOLEAN jjDIFF_COEF (leftv res, leftv u, leftv v)
 
static BOOLEAN jjJACOB_M (leftv res, leftv a)
 
static BOOLEAN jjKBASE (leftv res, leftv v)
 
static BOOLEAN jjL2R (leftv res, leftv v)
 
static BOOLEAN jjLEADCOEF (leftv res, leftv v)
 
static BOOLEAN jjLEADEXP (leftv res, leftv v)
 
static BOOLEAN jjLEADMONOM (leftv res, leftv v)
 
static BOOLEAN jjLOAD1 (leftv, leftv v)
 
static BOOLEAN jjLISTRING (leftv res, leftv v)
 
static BOOLEAN jjPFAC1 (leftv res, leftv v)
 
static BOOLEAN jjLU_DECOMP (leftv res, leftv v)
 
static BOOLEAN jjMEMORY (leftv res, leftv v)
 
static BOOLEAN jjMSTD (leftv res, leftv v)
 
static BOOLEAN jjMULT (leftv res, leftv v)
 
static BOOLEAN jjMINRES_R (leftv res, leftv v)
 
static BOOLEAN jjN2BI (leftv res, leftv v)
 
static BOOLEAN jjNAMEOF (leftv res, leftv v)
 
static BOOLEAN jjNAMES (leftv res, leftv v)
 
static BOOLEAN jjNAMES_I (leftv res, leftv v)
 
static BOOLEAN jjNOT (leftv res, leftv v)
 
static BOOLEAN jjNVARS (leftv res, leftv v)
 
static BOOLEAN jjOpenClose (leftv, leftv v)
 
static BOOLEAN jjORD (leftv res, leftv v)
 
static BOOLEAN jjPAR1 (leftv res, leftv v)
 
static BOOLEAN jjPARDEG (leftv res, leftv v)
 
static BOOLEAN jjPARSTR1 (leftv res, leftv v)
 
static BOOLEAN jjP2BI (leftv res, leftv v)
 
static BOOLEAN jjP2I (leftv res, leftv v)
 
static BOOLEAN jjPREIMAGE_R (leftv res, leftv v)
 
static BOOLEAN jjPRIME (leftv res, leftv v)
 
static BOOLEAN jjPRUNE (leftv res, leftv v)
 
static BOOLEAN jjP2N (leftv res, leftv v)
 
static BOOLEAN jjRESERVEDNAME (leftv res, leftv v)
 
static BOOLEAN jjRANK1 (leftv res, leftv v)
 
static BOOLEAN jjREAD (leftv res, leftv v)
 
static BOOLEAN jjREGULARITY (leftv res, leftv v)
 
static BOOLEAN jjREPART (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST (leftv res, leftv v)
 
static BOOLEAN jjRINGLIST_C (leftv res, leftv v)
 
static BOOLEAN jjRING_LIST (leftv res, leftv v)
 
static BOOLEAN jjROWS (leftv res, leftv v)
 
static BOOLEAN jjROWS_BIM (leftv res, leftv v)
 
static BOOLEAN jjROWS_IV (leftv res, leftv v)
 
static BOOLEAN jjRPAR (leftv res, leftv v)
 
static BOOLEAN jjSLIM_GB (leftv res, leftv u)
 
static BOOLEAN jjSBA (leftv res, leftv v)
 
static BOOLEAN jjSBA_1 (leftv res, leftv v, leftv u)
 
static BOOLEAN jjSBA_2 (leftv res, leftv v, leftv u, leftv t)
 
static BOOLEAN jjSTD (leftv res, leftv v)
 
static BOOLEAN jjSort_Id (leftv res, leftv v)
 
static BOOLEAN jjSQR_FREE (leftv res, leftv u)
 
static BOOLEAN jjSYZYGY (leftv res, leftv v)
 
static BOOLEAN jjTRACE_IV (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_BIM (leftv res, leftv v)
 
static BOOLEAN jjTRANSP_IV (leftv res, leftv v)
 
static BOOLEAN jjOPPOSITE (leftv res, leftv a)
 
static BOOLEAN jjENVELOPE (leftv res, leftv a)
 
static BOOLEAN jjTWOSTD (leftv res, leftv a)
 
static BOOLEAN 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_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_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 jjLIFT3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjLIFTSTD3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CP (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_CID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_P (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjREDUCE3_ID (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRES3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjRING3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTATUS3 (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjSTD_HILB_W (leftv res, leftv u, leftv v, leftv w)
 
static BOOLEAN jjBREAK0 (leftv, leftv)
 
static BOOLEAN jjBREAK1 (leftv, leftv v)
 
static BOOLEAN jjCALL1ARG (leftv res, leftv v)
 
static BOOLEAN jjCALL2ARG (leftv res, leftv u)
 
static BOOLEAN jjCALL3ARG (leftv res, leftv u)
 
static BOOLEAN jjCOEF_M (leftv, leftv v)
 
static BOOLEAN jjDIVISION4 (leftv res, leftv v)
 
static BOOLEAN jjIDEAL_PL (leftv res, leftv v)
 
static BOOLEAN jjFETCH_M (leftv res, leftv u)
 
static BOOLEAN jjINTERSECT_PL (leftv res, leftv v)
 
static BOOLEAN jjLU_INVERSE (leftv res, leftv v)
 
static BOOLEAN jjLU_SOLVE (leftv res, leftv v)
 
static BOOLEAN jjINTVEC_PL (leftv res, leftv v)
 
static BOOLEAN jjJET4 (leftv res, leftv u)
 
static BOOLEAN jjKLAMMER_PL (leftv res, leftv u)
 
static BOOLEAN jjLIFT_4 (leftv res, leftv U)
 
static BOOLEAN jjLIFTSTD_4 (leftv res, leftv U)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
static BOOLEAN jjNAMES0 (leftv res, leftv)
 
static BOOLEAN jjOPTION_PL (leftv res, leftv v)
 
static BOOLEAN jjREDUCE4 (leftv res, leftv u)
 
static BOOLEAN jjREDUCE5 (leftv res, leftv u)
 
static BOOLEAN jjRESERVED0 (leftv, leftv)
 
static BOOLEAN jjSTRING_PL (leftv res, leftv v)
 
static BOOLEAN jjTEST (leftv, leftv v)
 
static BOOLEAN jjFactModD_M (leftv res, leftv v)
 
static BOOLEAN jjSTATUS_M (leftv res, leftv v)
 
static BOOLEAN jjSUBST_M (leftv res, leftv u)
 
static BOOLEAN jjQRDS (leftv res, leftv INPUT)
 
static BOOLEAN jjSTD_HILB_WP (leftv res, leftv INPUT)
 
static BOOLEAN jjRING_PL (leftv res, leftv a)
 
static BOOLEAN jjRESTART (leftv, leftv u)
 
static BOOLEAN iiExprArith2TabIntern (leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a and a->next return TRUE on failure More...
 
BOOLEAN iiExprArith2 (leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
 
BOOLEAN iiExprArith1Tab (leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith1 (leftv res, leftv a, int op)
 
static BOOLEAN iiExprArith3TabIntern (leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
 
BOOLEAN iiExprArith3 (leftv res, int op, leftv a, leftv b, leftv c)
 
BOOLEAN iiExprArith3Tab (leftv res, leftv a, int op, const struct sValCmd3 *dA3, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure More...
 
BOOLEAN iiExprArithM (leftv res, leftv a, int op)
 
int IsCmd (const char *n, int &tok)
 
const char * Tok2Cmdname (int tok)
 
int iiInitArithmetic ()
 initialisation of arithmetic structured data More...
 
int iiArithFindCmd (const char *szName)
 
char * iiArithGetCmd (int nPos)
 
int iiArithRemoveCmd (const char *szName)
 
static int jjCOMPARE_ALL (const void *aa, const void *bb)
 
BOOLEAN jjSORTLIST (leftv, leftv arg)
 
BOOLEAN jjUNIQLIST (leftv, leftv arg)
 

Variables

static SArithBase sArithBase
 Base entry for arithmetic. More...
 
int cmdtok
 
BOOLEAN expected_parms
 
int iiOp
 
int singclap_factorize_retry
 
static int WerrorS_dummy_cnt =0
 
static si_char_2 Tok2Cmdname_buf =" "
 

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 123 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 57 of file gentable.cc.

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

◆ sValCmd1

struct sValCmd1

Definition at line 76 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 67 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 84 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 94 of file gentable.cc.

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

◆ SArithBase

struct SArithBase

Definition at line 180 of file iparith.cc.

Data Fields
unsigned nCmdAllocated number of commands-slots allocated
unsigned nCmdUsed number of commands used
unsigned nLastIdentifier valid 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_PLURAL

#define ALLOW_PLURAL   1

Definition at line 104 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 107 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 110 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 112 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 106 of file iparith.cc.

◆ D

#define D (   A)    (A)

Definition at line 7894 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 216 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 7896 of file iparith.cc.

◆ jjWRONG2

#define jjWRONG2   (proc2)jjWRONG

Definition at line 3398 of file iparith.cc.

◆ jjWRONG3

#define jjWRONG3   (proc3)jjWRONG

Definition at line 3399 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 118 of file iparith.cc.

◆ NO_PLURAL

#define NO_PLURAL   0

Definition at line 105 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 108 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 109 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

Definition at line 7895 of file iparith.cc.

◆ PLURAL_MASK

#define PLURAL_MASK   3

Definition at line 92 of file iparith.cc.

◆ RING_MASK

#define RING_MASK   4

Definition at line 98 of file iparith.cc.

◆ SIMPL_EQU

#define SIMPL_EQU   4

Definition at line 3066 of file iparith.cc.

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3063 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3064 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3065 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3068 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3062 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3067 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

Definition at line 116 of file iparith.cc.

◆ ZERODIVISOR_MASK

#define ZERODIVISOR_MASK   8

Definition at line 99 of file iparith.cc.

Typedef Documentation

◆ jjValCmdTab

typedef sValCmdTab jjValCmdTab[]

Definition at line 129 of file iparith.cc.

◆ proc2

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

Definition at line 149 of file iparith.cc.

◆ proc3

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

Definition at line 160 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

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

8858 {
8859  cmdnames *pCmdL = (cmdnames*)a;
8860  cmdnames *pCmdR = (cmdnames*)b;
8861 
8862  if(a==NULL || b==NULL) return 0;
8863 
8864  /* empty entries goes to the end of the list for later reuse */
8865  if(pCmdL->name==NULL) return 1;
8866  if(pCmdR->name==NULL) return -1;
8867 
8868  /* $INVALID$ must come first */
8869  if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
8870  if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
8871 
8872  /* tokval=-1 are reserved names at the end */
8873  if (pCmdL->tokval==-1)
8874  {
8875  if (pCmdR->tokval==-1)
8876  return strcmp(pCmdL->name, pCmdR->name);
8877  /* pCmdL->tokval==-1, pCmdL goes at the end */
8878  return 1;
8879  }
8880  /* pCmdR->tokval==-1, pCmdR goes at the end */
8881  if(pCmdR->tokval==-1) return -1;
8882 
8883  return strcmp(pCmdL->name, pCmdR->name);
8884 }
CanonicalForm b
Definition: cfModGcd.cc:4044
#define NULL
Definition: omList.c:10

◆ check_valid()

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

Definition at line 9083 of file iparith.cc.

9084 {
9085  #ifdef HAVE_PLURAL
9086  if (rIsPluralRing(currRing))
9087  {
9088  if ((p & PLURAL_MASK)==0 /*NO_PLURAL*/)
9089  {
9090  WerrorS("not implemented for non-commutative rings");
9091  return TRUE;
9092  }
9093  else if ((p & PLURAL_MASK)==2 /*, COMM_PLURAL */)
9094  {
9095  Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
9096  return FALSE;
9097  }
9098  /* else, ALLOW_PLURAL */
9099  }
9100  #endif
9101 #ifdef HAVE_RINGS
9102  if (rField_is_Ring(currRing))
9103  {
9104  if ((p & RING_MASK)==0 /*NO_RING*/)
9105  {
9106  WerrorS("not implemented for rings with rings as coeffients");
9107  return TRUE;
9108  }
9109  /* else ALLOW_RING */
9110  else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
9111  &&(!rField_is_Domain(currRing)))
9112  {
9113  WerrorS("domain required as coeffients");
9114  return TRUE;
9115  }
9116  /* else ALLOW_ZERODIVISOR */
9117  else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
9118  {
9119  WarnS("considering the image in Q[...]");
9120  }
9121  }
9122 #endif
9123  return FALSE;
9124 }
#define TRUE
Definition: auxiliary.h:98
#define FALSE
Definition: auxiliary.h:94
int p
Definition: cfModGcd.cc:4019
#define Warn
Definition: emacs.cc:77
#define WarnS
Definition: emacs.cc:78
void WerrorS(const char *s)
Definition: feFopen.cc:24
int myynest
Definition: febase.cc:41
char my_yylinebuf[80]
Definition: febase.cc:43
#define NO_ZERODIVISOR
Definition: iparith.cc:109
#define PLURAL_MASK
Definition: iparith.cc:92
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8803
#define RING_MASK
Definition: iparith.cc:98
#define WARN_RING
Definition: iparith.cc:116
#define ZERODIVISOR_MASK
Definition: iparith.cc:99
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480

◆ iiArithAddCmd()

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

Definition at line 9024 of file iparith.cc.

9031 {
9032  //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
9033  // nTokval, nToktype, nPos);
9034  if(nPos>=0)
9035  {
9036  // no checks: we rely on a correct generated code in iparith.inc
9037  assume((unsigned)nPos < sArithBase.nCmdAllocated);
9038  assume(szName!=NULL);
9039  sArithBase.sCmds[nPos].name = omStrDup(szName);
9040  sArithBase.sCmds[nPos].alias = nAlias;
9041  sArithBase.sCmds[nPos].tokval = nTokval;
9042  sArithBase.sCmds[nPos].toktype = nToktype;
9043  sArithBase.nCmdUsed++;
9044  //if(nTokval>0) sArithBase.nLastIdentifier++;
9045  }
9046  else
9047  {
9048  if(szName==NULL) return -1;
9049  int nIndex = iiArithFindCmd(szName);
9050  if(nIndex>=0)
9051  {
9052  Print("'%s' already exists at %d\n", szName, nIndex);
9053  return -1;
9054  }
9055 
9057  {
9058  /* needs to create new slots */
9059  unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
9060  sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
9061  if(sArithBase.sCmds==NULL) return -1;
9063  }
9064  /* still free slots available */
9065  sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
9066  sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
9067  sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
9068  sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
9069  sArithBase.nCmdUsed++;
9070 
9071  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9072  (&_gentable_sort_cmds));
9075  {
9076  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9077  }
9078  //Print("L=%d\n", sArithBase.nLastIdentifier);
9079  }
9080  return 0;
9081 }
#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:8857
int iiArithFindCmd(const char *szName)
Definition: iparith.cc:8929
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:197
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:182
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:189
unsigned nCmdAllocated
number of commands-slots allocated
Definition: iparith.cc:188
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:187
#define assume(x)
Definition: mod2.h:390
#define nSize(n)
Definition: numbers.h:40
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225

◆ iiArithFindCmd()

int iiArithFindCmd ( const char *  szName)

Definition at line 8929 of file iparith.cc.

8930 {
8931  int an=0;
8932  int i = 0,v = 0;
8933  int en=sArithBase.nLastIdentifier;
8934 
8935  loop
8936  //for(an=0; an<sArithBase.nCmdUsed; )
8937  {
8938  if(an>=en-1)
8939  {
8940  if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
8941  {
8942  //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
8943  return an;
8944  }
8945  else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
8946  {
8947  //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
8948  return en;
8949  }
8950  else
8951  {
8952  //Print("RET- 1\n");
8953  return -1;
8954  }
8955  }
8956  i=(an+en)/2;
8957  if (*szName < *(sArithBase.sCmds[i].name))
8958  {
8959  en=i-1;
8960  }
8961  else if (*szName > *(sArithBase.sCmds[i].name))
8962  {
8963  an=i+1;
8964  }
8965  else
8966  {
8967  v=strcmp(szName,sArithBase.sCmds[i].name);
8968  if(v<0)
8969  {
8970  en=i-1;
8971  }
8972  else if(v>0)
8973  {
8974  an=i+1;
8975  }
8976  else /*v==0*/
8977  {
8978  //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
8979  return i;
8980  }
8981  }
8982  }
8983  //if(i>=0 && i<sArithBase.nCmdUsed)
8984  // return i;
8985  //PrintS("RET-2\n");
8986  return -2;
8987 }
int i
Definition: cfEzgcd.cc:125
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define loop
Definition: structs.h:78

◆ iiArithGetCmd()

char* iiArithGetCmd ( int  nPos)

Definition at line 8989 of file iparith.cc.

8990 {
8991  if(nPos<0) return NULL;
8992  if(nPos<(int)sArithBase.nCmdUsed)
8993  return sArithBase.sCmds[nPos].name;
8994  return NULL;
8995 }

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char *  szName)

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char *  szName)

Definition at line 8997 of file iparith.cc.

8998 {
8999  int nIndex;
9000  if(szName==NULL) return -1;
9001 
9002  nIndex = iiArithFindCmd(szName);
9003  if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
9004  {
9005  Print("'%s' not found (%d)\n", szName, nIndex);
9006  return -1;
9007  }
9008  omFree(sArithBase.sCmds[nIndex].name);
9009  sArithBase.sCmds[nIndex].name=NULL;
9010  qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
9011  (&_gentable_sort_cmds));
9012  sArithBase.nCmdUsed--;
9013 
9014  /* fix last-identifier */
9017  {
9018  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
9019  }
9020  //Print("L=%d\n", sArithBase.nLastIdentifier);
9021  return 0;
9022 }
#define omFree(addr)
Definition: omAllocDecl.h:261

◆ iiExprArith1()

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

Definition at line 8267 of file iparith.cc.

8268 {
8269  memset(res,0,sizeof(sleftv));
8270 
8271  if (!errorreported)
8272  {
8273 #ifdef SIQ
8274  if (siq>0)
8275  {
8276  //Print("siq:%d\n",siq);
8278  memcpy(&d->arg1,a,sizeof(sleftv));
8279  a->Init();
8280  d->op=op;
8281  d->argc=1;
8282  res->data=(char *)d;
8283  res->rtyp=COMMAND;
8284  return FALSE;
8285  }
8286 #endif
8287  int at=a->Typ();
8288  // handling bb-objects ----------------------------------------------------
8289  if(op>MAX_TOK) // explicit type conversion to bb
8290  {
8291  blackbox *bb=getBlackboxStuff(op);
8292  if (bb!=NULL)
8293  {
8294  res->rtyp=op;
8295  res->data=bb->blackbox_Init(bb);
8296  if(!bb->blackbox_Assign(res,a)) return FALSE;
8297  }
8298  else
8299  return TRUE;
8300  }
8301  else if (at>MAX_TOK) // argument is of bb-type
8302  {
8303  blackbox *bb=getBlackboxStuff(at);
8304  if (bb!=NULL)
8305  {
8306  if(!bb->blackbox_Op1(op,res,a)) return FALSE;
8307  // else: no op defined
8308  }
8309  else
8310  return TRUE;
8311  }
8312  if (errorreported) return TRUE;
8313 
8314  iiOp=op;
8315  int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
8316  return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
8317  }
8318  a->CleanUp();
8319  return TRUE;
8320 }
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:992
void Init()
Definition: subexpr.h:107
void CleanUp(ring r=currRing)
Definition: subexpr.cc:328
CanonicalForm res
Definition: facAbsFact.cc:64
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:8137
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition: iparith.cc:8778
int iiOp
Definition: iparith.cc:218
omBin sip_command_bin
Definition: ipid.cc:47
ip_command * command
Definition: ipid.h:22
const struct sValCmd1 dArith1[]
Definition: table.h:19
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
BOOLEAN siq
Definition: subexpr.cc:53
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1207
@ MAX_TOK
Definition: tok.h:215
#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 8137 of file iparith.cc.

8138 {
8139  memset(res,0,sizeof(sleftv));
8140  BOOLEAN call_failed=FALSE;
8141 
8142  if (!errorreported)
8143  {
8144  BOOLEAN failed=FALSE;
8145  iiOp=op;
8146  int i = 0;
8147  while (dA1[i].cmd==op)
8148  {
8149  if (at==dA1[i].arg)
8150  {
8151  if (currRing!=NULL)
8152  {
8153  if (check_valid(dA1[i].valid_for,op)) break;
8154  }
8155  else
8156  {
8157  if (RingDependend(dA1[i].res))
8158  {
8159  WerrorS("no ring active");
8160  break;
8161  }
8162  }
8163  if (traceit&TRACE_CALL)
8164  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8165  res->rtyp=dA1[i].res;
8166  if ((call_failed=dA1[i].p(res,a)))
8167  {
8168  break;// leave loop, goto error handling
8169  }
8170  if (a->Next()!=NULL)
8171  {
8172  res->next=(leftv)omAllocBin(sleftv_bin);
8173  failed=iiExprArith1(res->next,a->next,op);
8174  }
8175  a->CleanUp();
8176  return failed;
8177  }
8178  i++;
8179  }
8180  // implicite type conversion --------------------------------------------
8181  if (dA1[i].cmd!=op)
8182  {
8184  i=0;
8185  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8186  while (dA1[i].cmd==op)
8187  {
8188  int ai;
8189  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8190  if ((dA1[i].valid_for & NO_CONVERSION)==0)
8191  {
8192  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8193  {
8194  if (currRing!=NULL)
8195  {
8196  if (check_valid(dA1[i].valid_for,op)) break;
8197  }
8198  else
8199  {
8200  if (RingDependend(dA1[i].res))
8201  {
8202  WerrorS("no ring active");
8203  break;
8204  }
8205  }
8206  if (traceit&TRACE_CALL)
8207  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8208  res->rtyp=dA1[i].res;
8209  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8210  || (call_failed=dA1[i].p(res,an)));
8211  // everything done, clean up temp. variables
8212  if (failed)
8213  {
8214  // leave loop, goto error handling
8215  break;
8216  }
8217  else
8218  {
8219  if (an->Next() != NULL)
8220  {
8221  res->next = (leftv)omAllocBin(sleftv_bin);
8222  failed=iiExprArith1(res->next,an->next,op);
8223  }
8224  // everything ok, clean up and return
8225  an->CleanUp();
8227  return failed;
8228  }
8229  }
8230  }
8231  i++;
8232  }
8233  an->CleanUp();
8235  }
8236  // error handling
8237  if (!errorreported)
8238  {
8239  if ((at==0) && (a->Fullname()!=sNoName_fe))
8240  {
8241  Werror("`%s` is not defined",a->Fullname());
8242  }
8243  else
8244  {
8245  i=0;
8246  const char *s = iiTwoOps(op);
8247  Werror("%s(`%s`) failed"
8248  ,s,Tok2Cmdname(at));
8249  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8250  {
8251  while (dA1[i].cmd==op)
8252  {
8253  if ((dA1[i].res!=0)
8254  && (dA1[i].p!=jjWRONG))
8255  Werror("expected %s(`%s`)"
8256  ,s,Tok2Cmdname(dA1[i].arg));
8257  i++;
8258  }
8259  }
8260  }
8261  }
8262  res->rtyp = UNKNOWN;
8263  }
8264  a->CleanUp();
8265  return TRUE;
8266 }
int BOOLEAN
Definition: auxiliary.h:85
void * ADDRESS
Definition: auxiliary.h:133
leftv next
Definition: subexpr.h:86
const char * Fullname()
Definition: subexpr.h:125
leftv Next()
Definition: subexpr.h:136
const CanonicalForm int s
Definition: facAbsFact.cc:55
const char sNoName_fe[]
Definition: fevoices.cc:56
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:299
int RingDependend(int t)
Definition: gentable.cc:29
const char * iiTwoOps(int t)
Definition: gentable.cc:259
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3400
#define NO_CONVERSION
Definition: iparith.cc:118
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8267
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9083
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:401
omBin sleftv_bin
Definition: subexpr.cc:46
short res
Definition: gentable.cc:80
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define BVERBOSE(a)
Definition: options.h:35
#define V_SHOW_USE
Definition: options.h:52
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int traceit
Definition: febase.cc:42
#define TRACE_CALL
Definition: reporter.h:43
sleftv * leftv
Definition: structs.h:60
#define UNKNOWN
Definition: tok.h:219

◆ iiExprArith2()

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

Definition at line 8078 of file iparith.cc.

8079 {
8080  memset(res,0,sizeof(sleftv));
8081 
8082  if (!errorreported)
8083  {
8084 #ifdef SIQ
8085  if (siq>0)
8086  {
8087  //Print("siq:%d\n",siq);
8089  memcpy(&d->arg1,a,sizeof(sleftv));
8090  a->Init();
8091  memcpy(&d->arg2,b,sizeof(sleftv));
8092  b->Init();
8093  d->argc=2;
8094  d->op=op;
8095  res->data=(char *)d;
8096  res->rtyp=COMMAND;
8097  return FALSE;
8098  }
8099 #endif
8100  int at=a->Typ();
8101  int bt=b->Typ();
8102  // handling bb-objects ----------------------------------------------------
8103  if (at>MAX_TOK)
8104  {
8105  blackbox *bb=getBlackboxStuff(at);
8106  if (bb!=NULL)
8107  {
8108  if (!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8109  //else: no op defined, try the default
8110  }
8111  else
8112  return TRUE;
8113  }
8114  else if ((bt>MAX_TOK)&&(op!='('))
8115  {
8116  blackbox *bb=getBlackboxStuff(bt);
8117  if (bb!=NULL)
8118  {
8119  if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
8120  // else: no op defined
8121  }
8122  else
8123  return TRUE;
8124  }
8125  int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
8126  return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
8127  }
8128  a->CleanUp();
8129  b->CleanUp();
8130  return TRUE;
8131 }
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:7905
const struct sValCmd2 dArith2[]
Definition: table.h:293

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

8069 {
8070  leftv b=a->next;
8071  a->next=NULL;
8072  int bt=b->Typ();
8073  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8074  a->next=b;
8075  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8076  return bo;
8077 }

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

7910 {
7911  memset(res,0,sizeof(sleftv));
7912  BOOLEAN call_failed=FALSE;
7913 
7914  if (!errorreported)
7915  {
7916  int i=0;
7917  iiOp=op;
7918  while (dA2[i].cmd==op)
7919  {
7920  if ((at==dA2[i].arg1)
7921  && (bt==dA2[i].arg2))
7922  {
7923  res->rtyp=dA2[i].res;
7924  if (currRing!=NULL)
7925  {
7926  if (check_valid(dA2[i].valid_for,op)) break;
7927  }
7928  else
7929  {
7930  if (RingDependend(dA2[i].res))
7931  {
7932  WerrorS("no ring active");
7933  break;
7934  }
7935  }
7936  if (traceit&TRACE_CALL)
7937  Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
7938  if ((call_failed=dA2[i].p(res,a,b)))
7939  {
7940  break;// leave loop, goto error handling
7941  }
7942  a->CleanUp();
7943  b->CleanUp();
7944  //Print("op: %d,result typ:%d\n",op,res->rtyp);
7945  return FALSE;
7946  }
7947  i++;
7948  }
7949  // implicite type conversion ----------------------------------------------
7950  if (dA2[i].cmd!=op)
7951  {
7952  int ai,bi;
7955  BOOLEAN failed=FALSE;
7956  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
7957  //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
7958  while (dA2[i].cmd==op)
7959  {
7960  //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
7961  if ((dA2[i].valid_for & NO_CONVERSION)==0)
7962  {
7963  if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
7964  {
7965  if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
7966  {
7967  res->rtyp=dA2[i].res;
7968  if (currRing!=NULL)
7969  {
7970  if (check_valid(dA2[i].valid_for,op)) break;
7971  }
7972  else
7973  {
7974  if (RingDependend(dA2[i].res))
7975  {
7976  WerrorS("no ring active");
7977  break;
7978  }
7979  }
7980  if (traceit&TRACE_CALL)
7981  Print("call %s(%s,%s)\n",iiTwoOps(op),
7982  Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
7983  failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
7984  || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
7985  || (call_failed=dA2[i].p(res,an,bn)));
7986  // everything done, clean up temp. variables
7987  if (failed)
7988  {
7989  // leave loop, goto error handling
7990  break;
7991  }
7992  else
7993  {
7994  // everything ok, clean up and return
7995  an->CleanUp();
7996  bn->CleanUp();
7999  return FALSE;
8000  }
8001  }
8002  }
8003  }
8004  i++;
8005  }
8006  an->CleanUp();
8007  bn->CleanUp();
8010  }
8011  // error handling ---------------------------------------------------
8012  const char *s=NULL;
8013  if (!errorreported)
8014  {
8015  if ((at==0) && (a->Fullname()!=sNoName_fe))
8016  {
8017  s=a->Fullname();
8018  }
8019  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8020  {
8021  s=b->Fullname();
8022  }
8023  if (s!=NULL)
8024  Werror("`%s` is not defined",s);
8025  else
8026  {
8027  i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
8028  s = iiTwoOps(op);
8029  if (proccall)
8030  {
8031  Werror("%s(`%s`,`%s`) failed"
8032  ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
8033  }
8034  else
8035  {
8036  Werror("`%s` %s `%s` failed"
8037  ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
8038  }
8039  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8040  {
8041  while (dA2[i].cmd==op)
8042  {
8043  if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
8044  && (dA2[i].res!=0)
8045  && (dA2[i].p!=jjWRONG2))
8046  {
8047  if (proccall)
8048  Werror("expected %s(`%s`,`%s`)"
8049  ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
8050  else
8051  Werror("expected `%s` %s `%s`"
8052  ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
8053  }
8054  i++;
8055  }
8056  }
8057  }
8058  }
8059  a->CleanUp();
8060  b->CleanUp();
8061  res->rtyp = UNKNOWN;
8062  }
8063  return TRUE;
8064 }
#define jjWRONG2
Definition: iparith.cc:3398
short res
Definition: gentable.cc:71

◆ iiExprArith3()

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

Definition at line 8480 of file iparith.cc.

8481 {
8482  memset(res,0,sizeof(sleftv));
8483 
8484  if (!errorreported)
8485  {
8486 #ifdef SIQ
8487  if (siq>0)
8488  {
8489  //Print("siq:%d\n",siq);
8491  memcpy(&d->arg1,a,sizeof(sleftv));
8492  a->Init();
8493  memcpy(&d->arg2,b,sizeof(sleftv));
8494  b->Init();
8495  memcpy(&d->arg3,c,sizeof(sleftv));
8496  c->Init();
8497  d->op=op;
8498  d->argc=3;
8499  res->data=(char *)d;
8500  res->rtyp=COMMAND;
8501  return FALSE;
8502  }
8503 #endif
8504  int at=a->Typ();
8505  // handling bb-objects ----------------------------------------------
8506  if (at>MAX_TOK)
8507  {
8508  blackbox *bb=getBlackboxStuff(at);
8509  if (bb!=NULL)
8510  {
8511  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8512  // else: no op defined
8513  }
8514  else
8515  return TRUE;
8516  if (errorreported) return TRUE;
8517  }
8518  int bt=b->Typ();
8519  int ct=c->Typ();
8520 
8521  iiOp=op;
8522  int i=0;
8523  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8524  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8525  }
8526  a->CleanUp();
8527  b->CleanUp();
8528  c->CleanUp();
8529  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8530  return TRUE;
8531 }
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:8326
const struct sValCmd3 dArith3[]
Definition: table.h:726

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

8536 {
8537  leftv b=a->next;
8538  a->next=NULL;
8539  int bt=b->Typ();
8540  leftv c=b->next;
8541  b->next=NULL;
8542  int ct=c->Typ();
8543  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8544  b->next=c;
8545  a->next=b;
8546  a->CleanUp(); // to cleanup the chain, content already done
8547  return bo;
8548 }

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

8329 {
8330  memset(res,0,sizeof(sleftv));
8331  BOOLEAN call_failed=FALSE;
8332 
8333  assume(dA3[0].cmd==op);
8334 
8335  if (!errorreported)
8336  {
8337  int i=0;
8338  iiOp=op;
8339  while (dA3[i].cmd==op)
8340  {
8341  if ((at==dA3[i].arg1)
8342  && (bt==dA3[i].arg2)
8343  && (ct==dA3[i].arg3))
8344  {
8345  res->rtyp=dA3[i].res;
8346  if (currRing!=NULL)
8347  {
8348  if (check_valid(dA3[i].valid_for,op)) break;
8349  }
8350  if (traceit&TRACE_CALL)
8351  Print("call %s(%s,%s,%s)\n",
8352  iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
8353  if ((call_failed=dA3[i].p(res,a,b,c)))
8354  {
8355  break;// leave loop, goto error handling
8356  }
8357  a->CleanUp();
8358  b->CleanUp();
8359  c->CleanUp();
8360  return FALSE;
8361  }
8362  i++;
8363  }
8364  // implicite type conversion ----------------------------------------------
8365  if (dA3[i].cmd!=op)
8366  {
8367  int ai,bi,ci;
8371  BOOLEAN failed=FALSE;
8372  i=0;
8373  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
8374  while (dA3[i].cmd==op)
8375  {
8376  if ((dA3[i].valid_for & NO_CONVERSION)==0)
8377  {
8378  if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
8379  {
8380  if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
8381  {
8382  if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
8383  {
8384  res->rtyp=dA3[i].res;
8385  if (currRing!=NULL)
8386  {
8387  if (check_valid(dA3[i].valid_for,op)) break;
8388  }
8389  if (traceit&TRACE_CALL)
8390  Print("call %s(%s,%s,%s)\n",
8391  iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
8392  Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
8393  failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
8394  || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
8395  || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
8396  || (call_failed=dA3[i].p(res,an,bn,cn)));
8397  // everything done, clean up temp. variables
8398  if (failed)
8399  {
8400  // leave loop, goto error handling
8401  break;
8402  }
8403  else
8404  {
8405  // everything ok, clean up and return
8406  an->CleanUp();
8407  bn->CleanUp();
8408  cn->CleanUp();
8412  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8413  return FALSE;
8414  }
8415  }
8416  }
8417  }
8418  }
8419  i++;
8420  }
8421  an->CleanUp();
8422  bn->CleanUp();
8423  cn->CleanUp();
8427  }
8428  // error handling ---------------------------------------------------
8429  if (!errorreported)
8430  {
8431  const char *s=NULL;
8432  if ((at==0) && (a->Fullname()!=sNoName_fe))
8433  {
8434  s=a->Fullname();
8435  }
8436  else if ((bt==0) && (b->Fullname()!=sNoName_fe))
8437  {
8438  s=b->Fullname();
8439  }
8440  else if ((ct==0) && (c->Fullname()!=sNoName_fe))
8441  {
8442  s=c->Fullname();
8443  }
8444  if (s!=NULL)
8445  Werror("`%s` is not defined",s);
8446  else
8447  {
8448  i=0;
8449  //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
8450  const char *s = iiTwoOps(op);
8451  Werror("%s(`%s`,`%s`,`%s`) failed"
8452  ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
8453  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8454  {
8455  while (dA3[i].cmd==op)
8456  {
8457  if(((at==dA3[i].arg1)
8458  ||(bt==dA3[i].arg2)
8459  ||(ct==dA3[i].arg3))
8460  && (dA3[i].res!=0))
8461  {
8462  Werror("expected %s(`%s`,`%s`,`%s`)"
8463  ,s,Tok2Cmdname(dA3[i].arg1)
8464  ,Tok2Cmdname(dA3[i].arg2)
8465  ,Tok2Cmdname(dA3[i].arg3));
8466  }
8467  i++;
8468  }
8469  }
8470  }
8471  }
8472  res->rtyp = UNKNOWN;
8473  }
8474  a->CleanUp();
8475  b->CleanUp();
8476  c->CleanUp();
8477  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8478  return TRUE;
8479 }
short res
Definition: gentable.cc:88

◆ iiExprArithM()

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

Definition at line 8570 of file iparith.cc.

8571 {
8572  memset(res,0,sizeof(sleftv));
8573 
8574  if (!errorreported)
8575  {
8576 #ifdef SIQ
8577  if (siq>0)
8578  {
8579  //Print("siq:%d\n",siq);
8581  d->op=op;
8582  res->data=(char *)d;
8583  if (a!=NULL)
8584  {
8585  d->argc=a->listLength();
8586  // else : d->argc=0;
8587  memcpy(&d->arg1,a,sizeof(sleftv));
8588  switch(d->argc)
8589  {
8590  case 3:
8591  memcpy(&d->arg3,a->next->next,sizeof(sleftv));
8592  a->next->next->Init();
8593  /* no break */
8594  case 2:
8595  memcpy(&d->arg2,a->next,sizeof(sleftv));
8596  a->next->Init();
8597  a->next->next=d->arg2.next;
8598  d->arg2.next=NULL;
8599  /* no break */
8600  case 1:
8601  a->Init();
8602  a->next=d->arg1.next;
8603  d->arg1.next=NULL;
8604  }
8605  if (d->argc>3) a->next=NULL;
8606  a->name=NULL;
8607  a->rtyp=0;
8608  a->data=NULL;
8609  a->e=NULL;
8610  a->attribute=NULL;
8611  a->CleanUp();
8612  }
8613  res->rtyp=COMMAND;
8614  return FALSE;
8615  }
8616 #endif
8617  if ((a!=NULL) && (a->Typ()>MAX_TOK))
8618  {
8619  blackbox *bb=getBlackboxStuff(a->Typ());
8620  if (bb!=NULL)
8621  {
8622  if(!bb->blackbox_OpM(op,res,a)) return FALSE;
8623  // else: no op defined
8624  }
8625  else
8626  return TRUE;
8627  if (errorreported) return TRUE;
8628  }
8629  int args=0;
8630  if (a!=NULL) args=a->listLength();
8631 
8632  iiOp=op;
8633  int i=0;
8634  while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
8635  while (dArithM[i].cmd==op)
8636  {
8637  if ((args==dArithM[i].number_of_args)
8638  || (dArithM[i].number_of_args==-1)
8639  || ((dArithM[i].number_of_args==-2)&&(args>0)))
8640  {
8641  res->rtyp=dArithM[i].res;
8642  if (currRing!=NULL)
8643  {
8644  if (check_valid(dArithM[i].valid_for,op)) break;
8645  }
8646  if (traceit&TRACE_CALL)
8647  Print("call %s(... (%d args))\n", iiTwoOps(op),args);
8648  if (dArithM[i].p(res,a))
8649  {
8650  break;// leave loop, goto error handling
8651  }
8652  if (a!=NULL) a->CleanUp();
8653  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8654  return FALSE;
8655  }
8656  i++;
8657  }
8658  // error handling
8659  if (!errorreported)
8660  {
8661  if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
8662  {
8663  Werror("`%s` is not defined",a->Fullname());
8664  }
8665  else
8666  {
8667  const char *s = iiTwoOps(op);
8668  Werror("%s(...) failed",s);
8669  }
8670  }
8671  res->rtyp = UNKNOWN;
8672  }
8673  if (a!=NULL) a->CleanUp();
8674  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8675  return TRUE;
8676 }
const char * name
Definition: subexpr.h:87
int rtyp
Definition: subexpr.h:91
int listLength()
Definition: subexpr.cc:56
void * data
Definition: subexpr.h:88
Subexpr e
Definition: subexpr.h:105
const char * Name()
Definition: subexpr.h:120
attr attribute
Definition: subexpr.h:89
short res
Definition: gentable.cc:98
const struct sValCmdM dArithM[]
Definition: table.h:844

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 8894 of file iparith.cc.

8895 {
8896  //printf("iiInitArithmetic()\n");
8897  memset(&sArithBase, 0, sizeof(sArithBase));
8898  iiInitCmdName();
8899  /* fix last-identifier */
8900 #if 0
8901  /* we expect that gentable allready did every thing */
8904  if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
8905  }
8906 #endif
8907  //Print("L=%d\n", sArithBase.nLastIdentifier);
8908 
8909  //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
8910  //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
8911 
8912  //iiArithAddCmd("Top", 0,-1,0);
8913 
8914 
8915  //for(i=0; i<sArithBase.nCmdUsed; i++) {
8916  // printf("CMD[%03d] %s, %d, %d, %d\n", i,
8917  // sArithBase.sCmds[i].name,
8918  // sArithBase.sCmds[i].alias,
8919  // sArithBase.sCmds[i].tokval,
8920  // sArithBase.sCmds[i].toktype);
8921  //}
8922  //iiArithRemoveCmd("Top");
8923  //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
8924  //iiArithRemoveCmd("mygcd");
8925  //iiArithAddCmd("kkk", 1, 1234, CMD_1);
8926  return 0;
8927 }

◆ iin_Int()

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

Definition at line 221 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 8778 of file iparith.cc.

8779 {
8780  // user defined types are not in the pre-computed table:
8781  if (op>MAX_TOK) return 0;
8782 
8783  int a=0;
8784  int e=len;
8785  int p=len/2;
8786  do
8787  {
8788  if (op==dArithTab[p].cmd) return dArithTab[p].start;
8789  if (op<dArithTab[p].cmd) e=p-1;
8790  else a = p+1;
8791  p=a+(e-a)/2;
8792  }
8793  while ( a <= e);
8794 
8795  // catch missing a cmd:
8796  // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
8797  // Print("op %d (%c) unknown",op,op);
8798  return 0;
8799 }

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 233 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 8679 of file iparith.cc.

8680 {
8681  int i;
8682  int an=1;
8683  int en=sArithBase.nLastIdentifier;
8684 
8685  loop
8686  //for(an=0; an<sArithBase.nCmdUsed; )
8687  {
8688  if(an>=en-1)
8689  {
8690  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8691  {
8692  i=an;
8693  break;
8694  }
8695  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8696  {
8697  i=en;
8698  break;
8699  }
8700  else
8701  {
8702  // -- blackbox extensions:
8703  // return 0;
8704  return blackboxIsCmd(n,tok);
8705  }
8706  }
8707  i=(an+en)/2;
8708  if (*n < *(sArithBase.sCmds[i].name))
8709  {
8710  en=i-1;
8711  }
8712  else if (*n > *(sArithBase.sCmds[i].name))
8713  {
8714  an=i+1;
8715  }
8716  else
8717  {
8718  int v=strcmp(n,sArithBase.sCmds[i].name);
8719  if(v<0)
8720  {
8721  en=i-1;
8722  }
8723  else if(v>0)
8724  {
8725  an=i+1;
8726  }
8727  else /*v==0*/
8728  {
8729  break;
8730  }
8731  }
8732  }
8734  tok=sArithBase.sCmds[i].tokval;
8735  if(sArithBase.sCmds[i].alias==2)
8736  {
8737  Warn("outdated identifier `%s` used - please change your code",
8738  sArithBase.sCmds[i].name);
8739  sArithBase.sCmds[i].alias=1;
8740  }
8741  #if 0
8742  if (currRingHdl==NULL)
8743  {
8744  #ifdef SIQ
8745  if (siq<=0)
8746  {
8747  #endif
8748  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8749  {
8750  WerrorS("no ring active");
8751  return 0;
8752  }
8753  #ifdef SIQ
8754  }
8755  #endif
8756  }
8757  #endif
8758  if (!expected_parms)
8759  {
8760  switch (tok)
8761  {
8762  case IDEAL_CMD:
8763  case INT_CMD:
8764  case INTVEC_CMD:
8765  case MAP_CMD:
8766  case MATRIX_CMD:
8767  case MODUL_CMD:
8768  case POLY_CMD:
8769  case PROC_CMD:
8770  case RING_CMD:
8771  case STRING_CMD:
8772  cmdtok = tok;
8773  break;
8774  }
8775  }
8776  return sArithBase.sCmds[i].toktype;
8777 }
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:192
@ END_RING
Definition: grammar.cc:308
@ IDEAL_CMD
Definition: grammar.cc:283
@ MATRIX_CMD
Definition: grammar.cc:285
@ MAP_CMD
Definition: grammar.cc:284
@ PROC_CMD
Definition: grammar.cc:280
@ BEGIN_RING
Definition: grammar.cc:282
@ MODUL_CMD
Definition: grammar.cc:286
@ POLY_CMD
Definition: grammar.cc:288
@ RING_CMD
Definition: grammar.cc:281
int cmdtok
Definition: grammar.cc:174
BOOLEAN expected_parms
Definition: grammar.cc:173
idhdl currRingHdl
Definition: ipid.cc:61
const char * lastreserved
Definition: ipshell.cc:80
@ INTVEC_CMD
Definition: tok.h:101
@ STRING_CMD
Definition: tok.h:183
@ INT_CMD
Definition: tok.h:96

◆ jjALIGN_M()

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

Definition at line 1687 of file iparith.cc.

1688 {
1689  ideal M=(ideal)u->CopyD();
1690  int s=(int)(long)v->Data();
1691  for(int i=IDELEMS(M)-1; i>=0;i--)
1692  {
1693  if (s+p_MinComp(M->m[i],currRing)<=0)
1694  { id_Delete(&M,currRing);return TRUE;}
1695  }
1696  id_Shift(M,s,currRing);
1697  res->data=M;
1698  return FALSE;
1699 }
void * CopyD(int t)
Definition: subexpr.cc:703
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:24
#define M
Definition: sirandom.c:24

◆ jjALIGN_V()

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

Definition at line 1677 of file iparith.cc.

1678 {
1679  poly p=(poly)u->CopyD();
1680  int s=(int)(long)v->Data();
1681  if (s+p_MinComp(p,currRing)<=0)
1682  { p_Delete(&p,currRing);return TRUE;}
1683  p_Shift(&p,s,currRing);
1684  res->data=p;
1685  return FALSE;
1686 }
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4590
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:857

◆ jjAND_I()

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

Definition at line 1287 of file iparith.cc.

1288 {
1289  res->data = (char *)((long)u->Data() && (long)v->Data());
1290  return FALSE;
1291 }
void * Data()
Definition: subexpr.cc:1134

◆ jjBAREISS()

static BOOLEAN jjBAREISS ( leftv  res,
leftv  v 
)
static

Definition at line 3510 of file iparith.cc.

3511 {
3512  //matrix m=(matrix)v->Data();
3513  //lists l=mpBareiss(m,FALSE);
3514  intvec *iv;
3515  ideal m;
3516  sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3518  l->Init(2);
3519  l->m[0].rtyp=MODUL_CMD;
3520  l->m[1].rtyp=INTVEC_CMD;
3521  l->m[0].data=(void *)m;
3522  l->m[1].data=(void *)iv;
3523  res->data = (char *)l;
3524  return FALSE;
3525 }
int m
Definition: cfEzgcd.cc:121
Definition: intvec.h:21
Definition: lists.h:23
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:402

◆ jjBAREISS3()

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

Definition at line 5569 of file iparith.cc.

5570 {
5571  intvec *iv;
5572  ideal m;
5574  int k=(int)(long)w->Data();
5575  if (k>=0)
5576  {
5577  sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
5578  l->Init(2);
5579  l->m[0].rtyp=MODUL_CMD;
5580  l->m[1].rtyp=INTVEC_CMD;
5581  l->m[0].data=(void *)m;
5582  l->m[1].data=(void *)iv;
5583  }
5584  else
5585  {
5586  m=sm_CallSolv((ideal)u->Data(), currRing);
5587  l->Init(1);
5588  l->m[0].rtyp=IDEAL_CMD;
5589  l->m[0].data=(void *)m;
5590  }
5591  res->data = (char *)l;
5592  return FALSE;
5593 }
int k
Definition: cfEzgcd.cc:92
const CanonicalForm & w
Definition: facAbsFact.cc:55
ideal sm_CallSolv(ideal I, const ring R)
Definition: sparsmat.cc:2371

◆ jjBAREISS_BIM()

static BOOLEAN jjBAREISS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3533 of file iparith.cc.

3534 {
3535  bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3536  b->hnf();
3537  res->data=(char*)b;
3538  return FALSE;
3539 }
Matrices of numbers.
Definition: bigintmat.h:52
@ BIGINTMAT_CMD
Definition: grammar.cc:278

◆ jjBI2IM()

static BOOLEAN jjBI2IM ( leftv  res,
leftv  u 
)
static

Definition at line 3555 of file iparith.cc.

3556 {
3557  bigintmat *b=(bigintmat*)u->Data();
3558  res->data=(void *)bim2iv(b);
3559  return FALSE;
3560 }
intvec * bim2iv(bigintmat *b)
Definition: bigintmat.cc:341

◆ jjBI2N()

static BOOLEAN jjBI2N ( leftv  res,
leftv  u 
)
static

Definition at line 3540 of file iparith.cc.

3541 {
3542  BOOLEAN bo=FALSE;
3543  number n=(number)u->CopyD();
3545  if (nMap!=NULL)
3546  res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3547  else
3548  {
3549  Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3550  bo=TRUE;
3551  }
3552  n_Delete(&n,coeffs_BIGINT);
3553  return bo;
3554 }
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:977
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:722
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:74
coeffs coeffs_BIGINT
Definition: ipid.cc:52

◆ jjBI2P()

static BOOLEAN jjBI2P ( leftv  res,
leftv  u 
)
static

Definition at line 3561 of file iparith.cc.

3562 {
3563  sleftv tmp;
3564  BOOLEAN bo=jjBI2N(&tmp,u);
3565  if (!bo)
3566  {
3567  number n=(number) tmp.data;
3568  if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3569  else
3570  {
3571  res->data=(void *)pNSet(n);
3572  }
3573  }
3574  return bo;
3575 }
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition: iparith.cc:3540
if(yy_init)
Definition: libparse.cc:1418
#define nDelete(n)
Definition: numbers.h:17
#define nIsZero(n)
Definition: numbers.h:20
#define pNSet(n)
Definition: polys.h:299

◆ jjBRACK_Bim()

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

Definition at line 5342 of file iparith.cc.

5343 {
5344  bigintmat *bim = (bigintmat *)u->Data();
5345  int r = (int)(long)v->Data();
5346  int c = (int)(long)w->Data();
5347  if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5348  {
5349  Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5350  r,c,u->Fullname(),bim->rows(),bim->cols());
5351  return TRUE;
5352  }
5353  res->data=u->data; u->data=NULL;
5354  res->rtyp=u->rtyp; u->rtyp=0;
5355  res->name=u->name; u->name=NULL;
5356  Subexpr e=jjMakeSub(v);
5357  e->next=jjMakeSub(w);
5358  if (u->e==NULL)
5359  res->e=e;
5360  else
5361  {
5362  Subexpr h=u->e;
5363  while (h->next!=NULL) h=h->next;
5364  h->next=e;
5365  res->e=u->e;
5366  u->e=NULL;
5367  }
5368  return FALSE;
5369 }
int cols() const
Definition: bigintmat.h:145
int rows() const
Definition: bigintmat.h:146
static Subexpr jjMakeSub(leftv e)
Definition: iparith.cc:7872
static Poly * h
Definition: janet.cc:972

◆ jjBRACK_Im()

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

Definition at line 5315 of file iparith.cc.

5316 {
5317  intvec *iv = (intvec *)u->Data();
5318  int r = (int)(long)v->Data();
5319  int c = (int)(long)w->Data();
5320  if ((r<1)||(r>iv->rows())||(c<1)||(c>iv->cols()))
5321  {
5322  Werror("wrong range[%d,%d] in intmat %s(%d x %d)",
5323  r,c,u->Fullname(),iv->rows(),iv->cols());
5324  return TRUE;
5325  }
5326  res->data=u->data; u->data=NULL;
5327  res->rtyp=u->rtyp; u->rtyp=0;
5328  res->name=u->name; u->name=NULL;
5329  Subexpr e=jjMakeSub(v);
5330  e->next=jjMakeSub(w);
5331  if (u->e==NULL) res->e=e;
5332  else
5333  {
5334  Subexpr h=u->e;
5335  while (h->next!=NULL) h=h->next;
5336  h->next=e;
5337  res->e=u->e;
5338  u->e=NULL;
5339  }
5340  return FALSE;
5341 }
int cols() const
Definition: intvec.h:93
int rows() const
Definition: intvec.h:94

◆ jjBRACK_Ma()

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

Definition at line 5370 of file iparith.cc.

5371 {
5372  matrix m= (matrix)u->Data();
5373  int r = (int)(long)v->Data();
5374  int c = (int)(long)w->Data();
5375  //Print("gen. elem %d, %d\n",r,c);
5376  if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5377  {
5378  Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5379  MATROWS(m),MATCOLS(m));
5380  return TRUE;
5381  }
5382  res->data=u->data; u->data=NULL;
5383  res->rtyp=u->rtyp; u->rtyp=0;
5384  res->name=u->name; u->name=NULL;
5385  Subexpr e=jjMakeSub(v);
5386  e->next=jjMakeSub(w);
5387  if (u->e==NULL)
5388  res->e=e;
5389  else
5390  {
5391  Subexpr h=u->e;
5392  while (h->next!=NULL) h=h->next;
5393  h->next=e;
5394  res->e=u->e;
5395  u->e=NULL;
5396  }
5397  return FALSE;
5398 }
ip_smatrix * matrix
Definition: matpol.h:31
#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 5399 of file iparith.cc.

5400 {
5401  sleftv t;
5402  sleftv ut;
5403  leftv p=NULL;
5404  intvec *iv=(intvec *)w->Data();
5405  int l;
5406  BOOLEAN nok;
5407 
5408  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5409  {
5410  WerrorS("cannot build expression lists from unnamed objects");
5411  return TRUE;
5412  }
5413  memcpy(&ut,u,sizeof(ut));
5414  memset(&t,0,sizeof(t));
5415  t.rtyp=INT_CMD;
5416  for (l=0;l< iv->length(); l++)
5417  {
5418  t.data=(char *)(long)((*iv)[l]);
5419  if (p==NULL)
5420  {
5421  p=res;
5422  }
5423  else
5424  {
5425  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5426  p=p->next;
5427  }
5428  memcpy(u,&ut,sizeof(ut));
5429  if (u->Typ() == MATRIX_CMD)
5430  nok=jjBRACK_Ma(p,u,v,&t);
5431  else if (u->Typ() == BIGINTMAT_CMD)
5432  nok=jjBRACK_Bim(p,u,v,&t);
5433  else /* INTMAT_CMD */
5434  nok=jjBRACK_Im(p,u,v,&t);
5435  if (nok)
5436  {
5437  while (res->next!=NULL)
5438  {
5439  p=res->next->next;
5440  omFreeBin((ADDRESS)res->next, sleftv_bin);
5441  // res->e aufraeumen !!!!
5442  res->next=p;
5443  }
5444  return TRUE;
5445  }
5446  }
5447  return FALSE;
5448 }
int length() const
Definition: intvec.h:92
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5342
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5315
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:5370
#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 5449 of file iparith.cc.

5450 {
5451  sleftv t;
5452  sleftv ut;
5453  leftv p=NULL;
5454  intvec *iv=(intvec *)v->Data();
5455  int l;
5456  BOOLEAN nok;
5457 
5458  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5459  {
5460  WerrorS("cannot build expression lists from unnamed objects");
5461  return TRUE;
5462  }
5463  memcpy(&ut,u,sizeof(ut));
5464  memset(&t,0,sizeof(t));
5465  t.rtyp=INT_CMD;
5466  for (l=0;l< iv->length(); l++)
5467  {
5468  t.data=(char *)(long)((*iv)[l]);
5469  if (p==NULL)
5470  {
5471  p=res;
5472  }
5473  else
5474  {
5475  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5476  p=p->next;
5477  }
5478  memcpy(u,&ut,sizeof(ut));
5479  if (u->Typ() == MATRIX_CMD)
5480  nok=jjBRACK_Ma(p,u,&t,w);
5481  else if (u->Typ() == BIGINTMAT_CMD)
5482  nok=jjBRACK_Bim(p,u,&t,w);
5483  else /* INTMAT_CMD */
5484  nok=jjBRACK_Im(p,u,&t,w);
5485  if (nok)
5486  {
5487  while (res->next!=NULL)
5488  {
5489  p=res->next->next;
5490  omFreeBin((ADDRESS)res->next, sleftv_bin);
5491  // res->e aufraeumen !!
5492  res->next=p;
5493  }
5494  return TRUE;
5495  }
5496  }
5497  return FALSE;
5498 }

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 5499 of file iparith.cc.

5500 {
5501  sleftv t1,t2,ut;
5502  leftv p=NULL;
5503  intvec *vv=(intvec *)v->Data();
5504  intvec *wv=(intvec *)w->Data();
5505  int vl;
5506  int wl;
5507  BOOLEAN nok;
5508 
5509  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5510  {
5511  WerrorS("cannot build expression lists from unnamed objects");
5512  return TRUE;
5513  }
5514  memcpy(&ut,u,sizeof(ut));
5515  memset(&t1,0,sizeof(sleftv));
5516  memset(&t2,0,sizeof(sleftv));
5517  t1.rtyp=INT_CMD;
5518  t2.rtyp=INT_CMD;
5519  for (vl=0;vl< vv->length(); vl++)
5520  {
5521  t1.data=(char *)(long)((*vv)[vl]);
5522  for (wl=0;wl< wv->length(); wl++)
5523  {
5524  t2.data=(char *)(long)((*wv)[wl]);
5525  if (p==NULL)
5526  {
5527  p=res;
5528  }
5529  else
5530  {
5531  p->next=(leftv)omAlloc0Bin(sleftv_bin);
5532  p=p->next;
5533  }
5534  memcpy(u,&ut,sizeof(ut));
5535  if (u->Typ() == MATRIX_CMD)
5536  nok=jjBRACK_Ma(p,u,&t1,&t2);
5537  else if (u->Typ() == BIGINTMAT_CMD)
5538  nok=jjBRACK_Bim(p,u,&t1,&t2);
5539  else /* INTMAT_CMD */
5540  nok=jjBRACK_Im(p,u,&t1,&t2);
5541  if (nok)
5542  {
5543  res->CleanUp();
5544  return TRUE;
5545  }
5546  }
5547  }
5548  return FALSE;
5549 }

◆ jjBRACK_S()

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

Definition at line 5299 of file iparith.cc.

5300 {
5301  char *s= (char *)u->Data();
5302  int r = (int)(long)v->Data();
5303  int c = (int)(long)w->Data();
5304  int l = strlen(s);
5305 
5306  if ( (r<1) || (r>l) || (c<0) )
5307  {
5308  Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5309  return TRUE;
5310  }
5311  res->data = (char *)omAlloc((long)(c+1));
5312  sprintf((char *)res->data,"%-*.*s",c,c,s+r-1);
5313  return FALSE;
5314 }
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ jjBRACKET()

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

Definition at line 2753 of file iparith.cc.

2754 {
2755  res->data=NULL;
2756 
2757  if (rIsPluralRing(currRing))
2758  {
2759  const poly q = (poly)b->Data();
2760 
2761  if( q != NULL )
2762  {
2763  if( (poly)a->Data() != NULL )
2764  {
2765  poly p = (poly)a->CopyD(POLY_CMD); // p = copy!
2766  res->data = nc_p_Bracket_qq(p,q, currRing); // p will be destroyed!
2767  }
2768  }
2769  }
2770  return FALSE;
2771 }
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2242

◆ jjBREAK0()

static BOOLEAN jjBREAK0 ( leftv  ,
leftv   
)
static

Definition at line 6502 of file iparith.cc.

6503 {
6504 #ifdef HAVE_SDB
6505  sdb_show_bp();
6506 #endif
6507  return FALSE;
6508 }
void sdb_show_bp()
Definition: sdb.cc:58

◆ jjBREAK1()

static BOOLEAN jjBREAK1 ( leftv  ,
leftv  v 
)
static

Definition at line 6509 of file iparith.cc.

6510 {
6511 #ifdef HAVE_SDB
6512  if(v->Typ()==PROC_CMD)
6513  {
6514  int lineno=0;
6515  if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
6516  {
6517  lineno=(int)(long)v->next->Data();
6518  }
6519  return sdb_set_breakpoint(v->Name(),lineno);
6520  }
6521  return TRUE;
6522 #else
6523  return FALSE;
6524 #endif
6525 }
Variable next() const
Definition: factory.h:137
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
Definition: sdb.cc:65

◆ jjCALL1ARG()

static BOOLEAN jjCALL1ARG ( leftv  res,
leftv  v 
)
static

Definition at line 6526 of file iparith.cc.

6527 {
6528  return iiExprArith1(res,v,iiOp);
6529 }

◆ jjCALL1MANY()

static BOOLEAN jjCALL1MANY ( leftv  res,
leftv  u 
)
static

Definition at line 3576 of file iparith.cc.

3577 {
3578  return iiExprArithM(res,u,iiOp);
3579 }
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8570

◆ jjCALL2ARG()

static BOOLEAN jjCALL2ARG ( leftv  res,
leftv  u 
)
static

Definition at line 6530 of file iparith.cc.

6531 {
6532  leftv v=u->next;
6533  u->next=NULL;
6534  BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
6535  u->next=v;
6536  return b;
6537 }
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8078

◆ jjCALL3ARG()

static BOOLEAN jjCALL3ARG ( leftv  res,
leftv  u 
)
static

Definition at line 6538 of file iparith.cc.

6539 {
6540  leftv v = u->next;
6541  leftv w = v->next;
6542  u->next = NULL;
6543  v->next = NULL;
6544  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
6545  u->next = v;
6546  v->next = w;
6547  return b;
6548 }
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8480

◆ jjCHAR()

static BOOLEAN jjCHAR ( leftv  res,
leftv  v 
)
static

Definition at line 3580 of file iparith.cc.

3581 {
3582  res->data = (char *)(long)rChar((ring)v->Data());
3583  return FALSE;
3584 }
int rChar(ring r)
Definition: ring.cc:688

◆ jjCHINREM_BI()

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

Definition at line 1590 of file iparith.cc.

1591 {
1592  intvec *c=(intvec*)u->Data();
1593  intvec* p=(intvec*)v->Data();
1594  int rl=p->length();
1595  number *x=(number *)omAlloc(rl*sizeof(number));
1596  number *q=(number *)omAlloc(rl*sizeof(number));
1597  int i;
1598  for(i=rl-1;i>=0;i--)
1599  {
1600  q[i]=n_Init((*p)[i], coeffs_BIGINT);
1601  x[i]=n_Init((*c)[i], coeffs_BIGINT);
1602  }
1603  CFArray iv(rl);
1604  number n=n_ChineseRemainderSym(x,q,rl,FALSE,iv,coeffs_BIGINT);
1605  for(i=rl-1;i>=0;i--)
1606  {
1607  n_Delete(&(q[i]),coeffs_BIGINT);
1608  n_Delete(&(x[i]),coeffs_BIGINT);
1609  }
1610  omFree(x); omFree(q);
1611  res->data=(char *)n;
1612  return FALSE;
1613 }
Variable x
Definition: cfModGcd.cc:4023
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
Definition: coeffs.h:795
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539

◆ jjCHINREM_ID()

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

Definition at line 9126 of file iparith.cc.

9127 {
9128  if ((currRing!=NULL)
9130  && (!rField_is_Z(currRing)))
9131  {
9132  WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
9133  return TRUE;
9134  }
9135  coeffs cf;
9136  lists c=(lists)u->CopyD(); // list of ideal or bigint/int
9137  int rl=c->nr+1;
9138  int return_type=c->m[0].Typ();
9139  if ((return_type!=IDEAL_CMD)
9140  && (return_type!=MODUL_CMD)
9141  && (return_type!=MATRIX_CMD)
9142  && (return_type!=POLY_CMD))
9143  {
9144  if((return_type==BIGINT_CMD)
9145  ||(return_type==INT_CMD))
9146  return_type=BIGINT_CMD;
9147  else if (return_type==LIST_CMD)
9148  {
9149  // create a tmp list of the correct size
9150  lists res_l=(lists)omAllocBin(slists_bin);
9151  res_l->Init(rl /*c->nr+1*/);
9152  BOOLEAN bo=FALSE;
9153  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
9154  for (unsigned i=0;i<=(unsigned)c->nr;i++)
9155  {
9156  sleftv tmp;
9157  tmp.Copy(v);
9158  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9159  if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
9160  }
9161  c->Clean();
9162  res->data=res_l;
9163  res->rtyp=LIST_CMD;
9164  return bo;
9165  }
9166  else
9167  {
9168  c->Clean();
9169  WerrorS("poly/ideal/module/matrix/list expected");
9170  return TRUE;
9171  }
9172  }
9173  if (return_type==BIGINT_CMD)
9174  cf=coeffs_BIGINT;
9175  else
9176  {
9177  cf=currRing->cf;
9178  if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
9179  cf=cf->extRing->cf;
9180  }
9181  lists pl=NULL;
9182  intvec *p=NULL;
9183  if (v->Typ()==LIST_CMD) pl=(lists)v->Data();
9184  else p=(intvec*)v->Data();
9185  ideal result;
9186  ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
9187  number *xx=NULL;
9189  int i;
9190  if (return_type!=BIGINT_CMD)
9191  {
9192  for(i=rl-1;i>=0;i--)
9193  {
9194  if (c->m[i].Typ()!=return_type)
9195  {
9196  Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
9197  omFree(x); // delete c
9198  return TRUE;
9199  }
9200  if (return_type==POLY_CMD)
9201  {
9202  x[i]=idInit(1,1);
9203  x[i]->m[0]=(poly)c->m[i].CopyD();
9204  }
9205  else
9206  {
9207  x[i]=(ideal)c->m[i].CopyD();
9208  }
9209  //c->m[i].Init();
9210  }
9211  }
9212  else
9213  {
9214  if (nMap==NULL)
9215  {
9216  Werror("not implemented: map bigint -> %s", nCoeffName(cf));
9217  return TRUE;
9218  }
9219  xx=(number *)omAlloc(rl*sizeof(number));
9220  for(i=rl-1;i>=0;i--)
9221  {
9222  if (c->m[i].Typ()==INT_CMD)
9223  {
9224  xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
9225  }
9226  else if (c->m[i].Typ()==BIGINT_CMD)
9227  {
9228  xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
9229  }
9230  else
9231  {
9232  Werror("bigint expected at pos %d",i+1);
9233  omFree(x); // delete c
9234  omFree(xx); // delete c
9235  return TRUE;
9236  }
9237  }
9238  }
9239  number *q=(number *)omAlloc(rl*sizeof(number));
9240  if (p!=NULL)
9241  {
9242  for(i=rl-1;i>=0;i--)
9243  {
9244  q[i]=n_Init((*p)[i], cf);
9245  }
9246  }
9247  else
9248  {
9249  for(i=rl-1;i>=0;i--)
9250  {
9251  if (pl->m[i].Typ()==INT_CMD)
9252  {
9253  q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
9254  }
9255  else if (pl->m[i].Typ()==BIGINT_CMD)
9256  {
9257  q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
9258  }
9259  else
9260  {
9261  Werror("bigint expected at pos %d",i+1);
9262  for(i++;i<rl;i++)
9263  {
9264  n_Delete(&(q[i]),cf);
9265  }
9266  omFree(x); // delete c
9267  omFree(q); // delete pl
9268  if (xx!=NULL) omFree(xx); // delete c
9269  return TRUE;
9270  }
9271  }
9272  }
9273  if (return_type==BIGINT_CMD)
9274  {
9275  CFArray i_v(rl);
9276  number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
9277  res->data=(char *)n;
9278  }
9279  else
9280  {
9281  result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
9282  c->Clean();
9283  if ((return_type==POLY_CMD) &&(result!=NULL))
9284  {
9285  res->data=(char *)result->m[0];
9286  result->m[0]=NULL;
9287  idDelete(&result);
9288  }
9289  else
9290  res->data=(char *)result;
9291  }
9292  for(i=rl-1;i>=0;i--)
9293  {
9294  n_Delete(&(q[i]),cf);
9295  }
9296  omFree(q);
9297  res->rtyp=return_type;
9298  return result==NULL;
9299 }
void Copy(leftv e)
Definition: subexpr.cc:684
sleftv * m
Definition: lists.h:45
void Clean(ring r=currRing)
Definition: lists.h:25
INLINE_THIS void Init(int l=0)
int nr
Definition: lists.h:43
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:860
return result
Definition: facAbsBiFact.cc:76
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:504
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
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 1701 of file iparith.cc.

1702 {
1703  poly p=(poly)v->Data();
1704  if ((p==NULL)||(pNext(p)!=NULL)) return TRUE;
1705  res->data=(char *)mp_CoeffProc((poly)u->Data(),p /*(poly)v->Data()*/,currRing);
1706  return FALSE;
1707 }
matrix mp_CoeffProc(poly f, poly vars, const ring R)
Definition: matpol.cc:401
#define pNext(p)
Definition: monomials.h:43

◆ jjCOEF_M()

static BOOLEAN jjCOEF_M ( leftv  ,
leftv  v 
)
static

Definition at line 6550 of file iparith.cc.

6551 {
6552  const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
6553  if (iiCheckTypes(v,t,1))
6554  {
6555  idhdl c=(idhdl)v->next->next->data;
6556  if (v->next->next->next->rtyp!=IDHDL) return TRUE;
6557  idhdl m=(idhdl)v->next->next->next->data;
6558  idDelete((ideal *)&(c->data.uideal));
6559  idDelete((ideal *)&(m->data.uideal));
6560  mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
6561  (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
6562  return FALSE;
6563  }
6564  return TRUE;
6565 }
Definition: idrec.h:35
utypes data
Definition: idrec.h:40
@ VECTOR_CMD
Definition: grammar.cc:290
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:6503
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:503
idrec * idhdl
Definition: ring.h:21

◆ jjCOEFFS2_KB()

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

Definition at line 1719 of file iparith.cc.

1720 {
1721  poly p = pInit();
1722  int i;
1723  for (i=1; i<=currRing->N; i++)
1724  {
1725  pSetExp(p, i, 1);
1726  }
1727  pSetm(p);
1728  res->data = (void*)idCoeffOfKBase((ideal)(u->Data()),
1729  (ideal)(v->Data()), p);
1730  pLmFree(&p);
1731  return FALSE;
1732 }
matrix idCoeffOfKBase(ideal arg, ideal kbase, poly how)
Definition: ideals.cc:2499
#define pSetm(p)
Definition: polys.h:257
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 5594 of file iparith.cc.

5595 {
5596  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5597  {
5598  WerrorS("3rd argument must be a name of a matrix");
5599  return TRUE;
5600  }
5601  ideal i=(ideal)u->Data();
5602  int rank=(int)i->rank;
5603  BOOLEAN r=jjCOEFFS_Id(res,u,v);
5604  if (r) return TRUE;
5605  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
5606  return FALSE;
5607 }
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition: iparith.cc:1708
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition: matpol.cc:364
#define pVar(m)
Definition: polys.h:367

◆ jjCOEFFS3_KB()

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

Definition at line 5608 of file iparith.cc.

5609 {
5610  res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
5611  (ideal)(v->Data()),(poly)(w->Data()));
5612  return FALSE;
5613 }

◆ jjCOEFFS3_P()

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

Definition at line 5614 of file iparith.cc.

5615 {
5616  if ((w->rtyp!=IDHDL)||(w->e!=NULL))
5617  {
5618  WerrorS("3rd argument must be a name of a matrix");
5619  return TRUE;
5620  }
5621  // CopyD for POLY_CMD and VECTOR_CMD are identical:
5622  poly p=(poly)u->CopyD(POLY_CMD);
5623  ideal i=idInit(1,1);
5624  i->m[0]=p;
5625  sleftv t;
5626  memset(&t,0,sizeof(t));
5627  t.data=(char *)i;
5628  t.rtyp=IDEAL_CMD;
5629  int rank=1;
5630  if (u->Typ()==VECTOR_CMD)
5631  {
5632  i->rank=rank=pMaxComp(p);
5633  t.rtyp=MODUL_CMD;
5634  }
5635  BOOLEAN r=jjCOEFFS_Id(res,&t,v);
5636  t.CleanUp();
5637  if (r) return TRUE;
5638  mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
5639  return FALSE;
5640 }
#define pMaxComp(p)
Definition: polys.h:285

◆ jjCOEFFS_Id()

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

Definition at line 1708 of file iparith.cc.

1709 {
1710  int i=pVar((poly)v->Data());
1711  if (i==0)
1712  {
1713  WerrorS("ringvar expected");
1714  return TRUE;
1715  }
1716  res->data=(char *)mp_Coeffs((ideal)u->CopyD(),i,currRing);
1717  return FALSE;
1718 }
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:315

◆ jjCOLCOL()

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

Definition at line 693 of file iparith.cc.

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

◆ jjCOLON()

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

Definition at line 323 of file iparith.cc.

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

◆ jjCOLS()

static BOOLEAN jjCOLS ( leftv  res,
leftv  v 
)
static

Definition at line 3585 of file iparith.cc.

3586 {
3587  res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3588  return FALSE;
3589 }

◆ jjCOLS_BIM()

static BOOLEAN jjCOLS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3590 of file iparith.cc.

3591 {
3592  res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3593  return FALSE;
3594 }

◆ jjCOLS_IV()

static BOOLEAN jjCOLS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3595 of file iparith.cc.

3596 {
3597  res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3598  return FALSE;
3599 }

◆ jjCOMPARE_ALL()

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

Definition at line 9319 of file iparith.cc.

9320 {
9321  leftv a=(leftv)aa;
9322  int at=a->Typ();
9323  leftv b=(leftv)bb;
9324  int bt=b->Typ();;
9325  if (at < bt) return -1;
9326  if (at > bt) return 1;
9327  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
9328  sleftv tmp;
9329  memset(&tmp,0,sizeof(sleftv));
9330  iiOp='<';
9331  BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
9332  if (bo)
9333  {
9334  Werror(" no `<` for %s",Tok2Cmdname(at));
9335  unsigned long ad=(unsigned long)a->Data();
9336  unsigned long bd=(unsigned long)b->Data();
9337  if (ad<bd) return -1;
9338  else if (ad==bd) return 0;
9339  else return 1;
9340  }
9341  else if (tmp.data==NULL) /* not < */
9342  {
9343  iiOp=EQUAL_EQUAL;
9344  tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
9345  bo=iiExprArith2TabIntern(&tmp,a,EQUAL_EQUAL,b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
9346  if (bo)
9347  {
9348  Werror(" no `==` for %s",Tok2Cmdname(at));
9349  unsigned long ad=(unsigned long)a->Data();
9350  unsigned long bd=(unsigned long)b->Data();
9351  if (ad<bd) return -1;
9352  else if (ad==bd) return 0;
9353  else return 1;
9354  }
9355  else if (tmp.data==NULL) /* not <,== */ return 1;
9356  else return 0;
9357  }
9358  else return -1;
9359 }
@ EQUAL_EQUAL
Definition: grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 370 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 342 of file iparith.cc.

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

◆ jjCOMPARE_IV_I()

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

Definition at line 398 of file iparith.cc.

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

◆ jjCOMPARE_MA()

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

Definition at line 425 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 453 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 480 of file iparith.cc.

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

◆ jjCONTENT()

static BOOLEAN jjCONTENT ( leftv  res,
leftv  v 
)
static

Definition at line 3600 of file iparith.cc.

3601 {
3602  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3603  poly p=(poly)v->CopyD(POLY_CMD);
3604  if (p!=NULL) p_Cleardenom(p, currRing);
3605  res->data = (char *)p;
3606  return FALSE;
3607 }
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2782

◆ jjCONTRACT()

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

Definition at line 1733 of file iparith.cc.

1734 {
1735  res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data(),FALSE);
1736  return FALSE;
1737 }
matrix idDiffOp(ideal I, ideal J, BOOLEAN multiply)
Definition: ideals.cc:2182

◆ jjCOUNT_BI()

static BOOLEAN jjCOUNT_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3608 of file iparith.cc.

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

◆ jjCOUNT_BIM()

static BOOLEAN jjCOUNT_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 3613 of file iparith.cc.

3614 {
3615  bigintmat* aa= (bigintmat *)v->Data();
3616  res->data = (char *)(long)(aa->rows()*aa->cols());
3617  return FALSE;
3618 }

◆ jjCOUNT_IV()

static BOOLEAN jjCOUNT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 3636 of file iparith.cc.

3637 {
3638  res->data = (char *)(long)((intvec*)(v->Data()))->length();
3639  return FALSE;
3640 }

◆ jjCOUNT_L()

static BOOLEAN jjCOUNT_L ( leftv  res,
leftv  v 
)
static

Definition at line 3624 of file iparith.cc.

3625 {
3626  lists l=(lists)v->Data();
3627  res->data = (char *)(long)(lSize(l)+1);
3628  return FALSE;
3629 }
int lSize(lists L)
Definition: lists.cc:25

◆ jjCOUNT_M()

static BOOLEAN jjCOUNT_M ( leftv  res,
leftv  v 
)
static

Definition at line 3630 of file iparith.cc.

3631 {
3632  matrix m=(matrix)v->Data();
3633  res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
3634  return FALSE;
3635 }

◆ jjCOUNT_N()

static BOOLEAN jjCOUNT_N ( leftv  res,
leftv  v 
)
static

Definition at line 3619 of file iparith.cc.

3620 {
3621  res->data = (char *)(long)nSize((number)v->Data());
3622  return FALSE;
3623 }

◆ jjCOUNT_RES()

static BOOLEAN jjCOUNT_RES ( leftv  res,
leftv  v 
)
static

Definition at line 5268 of file iparith.cc.

5269 {
5270  res->data=(char *)(long)sySize((syStrategy)v->Data());
5271  return FALSE;
5272 }
int sySize(syStrategy syzstr)
Definition: syz1.cc:1830

◆ jjCOUNT_RG()

static BOOLEAN jjCOUNT_RG ( leftv  res,
leftv  v 
)
static

Definition at line 3641 of file iparith.cc.

3642 {
3643  ring r=(ring)v->Data();
3644  int elems=-1;
3645  if (rField_is_Zp(r)) elems=r->cf->ch;
3646  else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
3647  else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
3648  {
3649  extern int ipower ( int b, int n ); /* factory/cf_util */
3650  elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
3651  }
3652  res->data = (char *)(long)elems;
3653  return FALSE;
3654 }
int ipower(int b, int m)
int ipower ( int b, int m )
Definition: cf_util.cc:25
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:521
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:495
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:513

◆ jjDEFINED()

static BOOLEAN jjDEFINED ( leftv  res,
leftv  v 
)
static

Definition at line 3693 of file iparith.cc.

3694 {
3695  if ((v->rtyp==IDHDL)
3696  && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
3697  {
3698  res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
3699  }
3700  else if (v->rtyp!=0) res->data=(void *)(-1);
3701  return FALSE;
3702 }
#define IDLEV(a)
Definition: ipid.h:116

◆ jjDEG()

static BOOLEAN jjDEG ( leftv  res,
leftv  v 
)
static

Definition at line 3655 of file iparith.cc.

3656 {
3657  int dummy;
3658  poly p=(poly)v->Data();
3659  if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
3660  else res->data=(char *)-1;
3661  return FALSE;
3662 }

◆ jjDEG_IV()

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

Definition at line 1749 of file iparith.cc.

1750 {
1751  poly p=(poly)u->Data();
1752  if (p!=NULL)
1753  {
1754  short *iv=iv2array((intvec *)v->Data(),currRing);
1755  const long d = p_DegW(p,iv,currRing);
1756  omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(short) );
1757  res->data = (char *)(d);
1758  }
1759  else
1760  res->data=(char *)(long)(-1);
1761  return FALSE;
1762 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:682
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
short * iv2array(intvec *iv, const ring R)
Definition: weight.cc:206

◆ jjDEG_M()

static BOOLEAN jjDEG_M ( leftv  res,
leftv  u 
)
static

Definition at line 3663 of file iparith.cc.

3664 {
3665  ideal I=(ideal)u->Data();
3666  int d=-1;
3667  int dummy;
3668  int i;
3669  for(i=IDELEMS(I)-1;i>=0;i--)
3670  if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
3671  res->data = (char *)(long)d;
3672  return FALSE;
3673 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:138

◆ jjDEG_M_IV()

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

Definition at line 1738 of file iparith.cc.

1739 {
1740  short *iv=iv2array((intvec *)v->Data(),currRing);
1741  ideal I=(ideal)u->Data();
1742  int d=-1;
1743  int i;
1744  for(i=IDELEMS(I);i>=0;i--) d=si_max(d,(int)p_DegW(I->m[i],iv,currRing));
1745  omFreeSize( (ADDRESS)iv, (rVar(currRing)+1)*sizeof(short) );
1746  res->data = (char *)((long)d);
1747  return FALSE;
1748 }

◆ jjDEGREE()

static BOOLEAN jjDEGREE ( leftv  res,
leftv  v 
)
static

Definition at line 3674 of file iparith.cc.

3675 {
3676  SPrintStart();
3677 #ifdef HAVE_RINGS
3679  {
3680  PrintS("// NOTE: computation of degree is being performed for\n");
3681  PrintS("// generic fibre, that is, over Q\n");
3682  }
3683 #endif
3684  assumeStdFlag(v);
3685  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3686  scDegree((ideal)v->Data(),module_w,currRing->qideal);
3687  char *s=SPrintEnd();
3688  int l=strlen(s)-1;
3689  s[l]='\0';
3690  res->data=(void*)s;
3691  return FALSE;
3692 }
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:131
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition: hdegree.cc:822
void SPrintStart()
Definition: reporter.cc:246
char * SPrintEnd()
Definition: reporter.cc:273
void PrintS(const char *s)
Definition: reporter.cc:284
static BOOLEAN rField_is_Ring_Z(const ring r)
Definition: ring.h:474
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1471

◆ jjDelete_ID()

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

Definition at line 1770 of file iparith.cc.

1771 {
1772  int pos=(int)(long)v->Data();
1773  ideal I=(ideal)u->Data();
1774  res->data=(void*)id_Delete_Pos(I,pos-1,currRing);
1775  return res->data==NULL;
1776 }
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 1763 of file iparith.cc.

1764 {
1765  int pos=(int)(long)v->Data();
1766  intvec *iv=(intvec*)u->Data();
1767  res->data=(void*)iv->delete_pos(pos-1);
1768  return res->data==NULL;
1769 }
intvec * delete_pos(int p)
Definition: intvec.cc:824

◆ jjDENOMINATOR()

static BOOLEAN jjDENOMINATOR ( leftv  res,
leftv  v 
)
static

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

Definition at line 3706 of file iparith.cc.

3707 {
3708  number n = reinterpret_cast<number>(v->Data());
3709  res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
3710  return FALSE;
3711 }
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
Definition: coeffs.h:604

◆ jjDET()

static BOOLEAN jjDET ( leftv  res,
leftv  v 
)
static

Definition at line 3722 of file iparith.cc.

3723 {
3724  matrix m=(matrix)v->Data();
3725  poly p;
3726  if (sm_CheckDet((ideal)m,m->cols(),TRUE, currRing))
3727  {
3729  p=sm_CallDet(I, currRing);
3730  idDelete(&I);
3731  }
3732  else
3734  res ->data = (char *)p;
3735  return FALSE;
3736 }
poly singclap_det(const matrix m, const ring s)
Definition: clapsing.cc:1639
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:63
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
poly sm_CallDet(ideal I, const ring R)
Definition: sparsmat.cc:357
BOOLEAN sm_CheckDet(ideal I, int d, BOOLEAN sw, const ring r)
Definition: sparsmat.cc:306

◆ jjDET_BI()

static BOOLEAN jjDET_BI ( leftv  res,
leftv  v 
)
static

Definition at line 3737 of file iparith.cc.

3738 {
3739  bigintmat * m=(bigintmat*)v->Data();
3740  int i,j;
3741  i=m->rows();j=m->cols();
3742  if(i==j)
3743  res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
3744  else
3745  {
3746  Werror("det of %d x %d bigintmat",i,j);
3747  return TRUE;
3748  }
3749  return FALSE;
3750 }
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition: clapsing.cc:1680
int j
Definition: facHensel.cc:105

◆ jjDET_I()

static BOOLEAN jjDET_I ( leftv  res,
leftv  v 
)
static

Definition at line 3773 of file iparith.cc.

3774 {
3775  intvec * m=(intvec*)v->Data();
3776  int i,j;
3777  i=m->rows();j=m->cols();
3778  if(i==j)
3779  res->data = (char *)(long)singclap_det_i(m,currRing);
3780  else
3781  {
3782  Werror("det of %d x %d intmat",i,j);
3783  return TRUE;
3784  }
3785  return FALSE;
3786 }
int singclap_det_i(intvec *m, const ring)
Definition: clapsing.cc:1662

◆ jjDET_S()

static BOOLEAN jjDET_S ( leftv  res,
leftv  v 
)
static

Definition at line 3787 of file iparith.cc.

3788 {
3789  ideal I=(ideal)v->Data();
3790  poly p;
3791  if (IDELEMS(I)<1) return TRUE;
3792  if (sm_CheckDet(I,IDELEMS(I),FALSE, currRing))
3793  {
3796  idDelete((ideal *)&m);
3797  }
3798  else
3799  p=sm_CallDet(I, currRing);
3800  res->data = (char *)p;
3801  return FALSE;
3802 }
ideal id_Copy(ideal h1, const ring r)
copy an ideal
matrix id_Module2Matrix(ideal mod, const ring R)

◆ jjDIFF_COEF()

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

Definition at line 4206 of file iparith.cc.

4207 {
4208  if (!nCoeff_is_transExt(currRing->cf))
4209  {
4210  WerrorS("differentiation not defined in the coefficient ring");
4211  return TRUE;
4212  }
4213  number n = (number) u->Data();
4214  number k = (number) v->Data();
4215  res->data = ntDiff(n,k,currRing->cf);
4216  return FALSE;
4217 }
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition: coeffs.h:932
number ntDiff(number a, number d, const coeffs cf)
Definition: transext.cc:885

◆ jjDIFF_ID()

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

Definition at line 1788 of file iparith.cc.

1789 {
1790  int i=pVar((poly)v->Data());
1791  if (i==0)
1792  {
1793  WerrorS("ringvar expected");
1794  return TRUE;
1795  }
1796  res->data=(char *)idDiff((matrix)(u->Data()),i);
1797  return FALSE;
1798 }
matrix idDiff(matrix i, int k)
Definition: ideals.cc:2169

◆ jjDIFF_ID_ID()

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

Definition at line 1799 of file iparith.cc.

1800 {
1801  res->data=(char *)idDiffOp((ideal)u->Data(),(ideal)v->Data());
1802  return FALSE;
1803 }

◆ jjDIFF_P()

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

Definition at line 1777 of file iparith.cc.

1778 {
1779  int i=pVar((poly)v->Data());
1780  if (i==0)
1781  {
1782  WerrorS("ringvar expected");
1783  return TRUE;
1784  }
1785  res->data=(char *)pDiff((poly)(u->Data()),i);
1786  return FALSE;
1787 }
#define pDiff(a, b)
Definition: polys.h:282

◆ jjDIM()

static BOOLEAN jjDIM ( leftv  res,
leftv  v 
)
static

Definition at line 3803 of file iparith.cc.

3804 {
3805  assumeStdFlag(v);
3807  {
3808  Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
3809  }
3810 #ifdef HAVE_RINGS
3811  if (rField_is_Ring(currRing))
3812  {
3813  ideal vid = (ideal)v->Data();
3814  int i = idPosConstant(vid);
3815  if ((i != -1) && (n_IsUnit(pGetCoeff(vid->m[i]),currRing->cf)))
3816  { /* ideal v contains unit; dim = -1 */
3817  res->data = (char *)-1L;
3818  return FALSE;
3819  }
3820  ideal vv = id_Head(vid,currRing);
3821  idSkipZeroes(vv);
3822  int j = idPosConstant(vv);
3823  long d;
3824  if(j == -1)
3825  {
3826  d = (long)scDimInt(vv, currRing->qideal);
3828  d++;
3829  }
3830  else
3831  {
3832  if(n_IsUnit(pGetCoeff(vv->m[j]),currRing->cf))
3833  d = -1;
3834  else
3835  d = (long)scDimInt(vv, currRing->qideal);
3836  }
3837  //Anne's Idea for std(4,2x) = 0 bug
3838  long dcurr = d;
3839  for(unsigned ii=0;ii<(unsigned)IDELEMS(vv);ii++)
3840  {
3841  if(vv->m[ii] != NULL && !n_IsUnit(pGetCoeff(vv->m[ii]),currRing->cf))
3842  {
3843  ideal vc = idCopy(vv);
3844  poly c = pInit();
3845  pSetCoeff0(c,nCopy(pGetCoeff(vv->m[ii])));
3846  idInsertPoly(vc,c);
3847  idSkipZeroes(vc);
3848  for(unsigned jj = 0;jj<(unsigned)IDELEMS(vc)-1;jj++)
3849  {
3850  if((vc->m[jj]!=NULL)
3851  && (n_DivBy(pGetCoeff(vc->m[jj]),pGetCoeff(c),currRing->cf)))
3852  {
3853  pDelete(&vc->m[jj]);
3854  }
3855  }
3856  idSkipZeroes(vc);
3857  j = idPosConstant(vc);
3858  if (j != -1) pDelete(&vc->m[j]);
3859  dcurr = (long)scDimInt(vc, currRing->qideal);
3860  // the following assumes the ground rings to be either zero- or one-dimensional
3861  if((j==-1) && rField_is_Ring_Z(currRing))
3862  {
3863  // should also be activated for other euclidean domains as groundfield
3864  dcurr++;
3865  }
3866  idDelete(&vc);
3867  }
3868  if(dcurr > d)
3869  d = dcurr;
3870  }
3871  res->data = (char *)d;
3872  idDelete(&vv);
3873  return FALSE;
3874  }
3875 #endif
3876  res->data = (char *)(long)scDimInt((ideal)(v->Data()),currRing->qideal);
3877  return FALSE;
3878 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:516
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:784
int scDimInt(ideal S, ideal Q)
Definition: hdegree.cc:72
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
ideal idCopy(ideal A)
Definition: ideals.h:60
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:51
#define pSetCoeff0(p, n)
Definition: monomials.h:66
#define nCopy(n)
Definition: numbers.h:16
#define pDelete(p_ptr)
Definition: polys.h:173
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ jjDIM2()

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

Definition at line 1804 of file iparith.cc.

1805 {
1806  assumeStdFlag(v);
1808  {
1809  Warn("dim(%s,...) may be wrong because the mixed monomial ordering",v->Name());
1810  }
1811 #ifdef HAVE_RINGS
1812  if (rField_is_Ring(currRing))
1813  {
1814  ideal vid = (ideal)v->Data();
1815  int i = idPosConstant(vid);
1816  if ((i != -1) && (n_IsUnit(pGetCoeff(vid->m[i]),currRing->cf)))
1817  { /* ideal v contains unit; dim = -1 */
1818  res->data = (char *)-1;
1819  return FALSE;
1820  }
1821  ideal vv = id_Copy(vid, currRing);
1822  ideal ww = id_Copy((ideal)w->Data(), currRing);
1823  /* drop degree zero generator from vv (if any) */
1824  if (i != -1) pDelete(&vv->m[i]);
1825  long d = (long)scDimInt(vv, ww);
1826  if (rField_is_Ring_Z(currRing) && (i == -1)) d++;
1827  res->data = (char *)d;
1828  idDelete(&vv); idDelete(&ww);
1829  return FALSE;
1830  }
1831 #endif
1832  if(currRing->qideal==NULL)
1833  res->data = (char *)((long)scDimInt((ideal)(v->Data()),(ideal)w->Data()));
1834  else
1835  {
1836  ideal q=idSimpleAdd(currRing->qideal,(ideal)w->Data());
1837  res->data = (char *)((long)scDimInt((ideal)(v->Data()),q));
1838  idDelete(&q);
1839  }
1840  return FALSE;
1841 }
#define idSimpleAdd(A, B)
Definition: ideals.h:42

◆ jjDIM_R()

static BOOLEAN jjDIM_R ( leftv  res,
leftv  v 
)
static

Definition at line 5273 of file iparith.cc.

5274 {
5275  res->data = (char *)(long)syDim((syStrategy)v->Data());
5276  return FALSE;
5277 }
int syDim(syStrategy syzstr)
Definition: syz1.cc:1850

◆ jjDIV_BI()

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

Definition at line 1171 of file iparith.cc.

1172 {
1173  number q=(number)v->Data();
1174  if (n_IsZero(q,coeffs_BIGINT))
1175  {
1177  return TRUE;
1178  }
1179  q = n_Div((number)u->Data(),q,coeffs_BIGINT);
1181  res->data = (char *)q;
1182  return FALSE;
1183 }
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:616
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:465
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
Definition: coeffs.h:579
#define ii_div_by_0
Definition: iparith.cc:216

◆ jjDIV_Ma()

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

Definition at line 1206 of file iparith.cc.

1207 {
1208  poly q=(poly)v->Data();
1209  if (q==NULL)
1210  {
1212  return TRUE;
1213  }
1214  matrix m=(matrix)(u->Data());
1215  int r=m->rows();
1216  int c=m->cols();
1217  matrix mm=mpNew(r,c);
1218  unsigned i,j;
1219  for(i=r;i>0;i--)
1220  {
1221  for(j=c;j>0;j--)
1222  {
1223  if (pNext(q)!=NULL)
1224  {
1225  MATELEM(mm,i,j) = singclap_pdivide( MATELEM(m,i,j) ,
1226  q /*(poly)(v->Data())*/, currRing );
1227  }
1228  else
1229  MATELEM(mm,i,j) = pDivideM(pCopy(MATELEM(m,i,j)),pHead(q));
1230  }
1231  }
1232  id_Normalize((ideal)mm,currRing);
1233  res->data=(char *)mm;
1234  return FALSE;
1235 }
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:577
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:36
#define MATELEM(mat, i, j)
Definition: matpol.h:28
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pDivideM(a, b)
Definition: polys.h:280
#define pCopy(p)
return a copy of the poly
Definition: polys.h:172
void id_Normalize(ideal I, const ring r)
normialize all polys in id

◆ jjDIV_N()

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

Definition at line 1184 of file iparith.cc.

1185 {
1186  number q=(number)v->Data();
1187  if (nIsZero(q))
1188  {
1190  return TRUE;
1191  }
1192  q = nDiv((number)u->Data(),q);
1193  nNormalize(q);
1194  res->data = (char *)q;
1195  return FALSE;
1196 }
#define nDiv(a, b)
Definition: numbers.h:33
#define nNormalize(n)
Definition: numbers.h:31

◆ jjDIV_P()

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

Definition at line 1197 of file iparith.cc.

1198 {
1199  poly q=(poly)v->CopyD();
1200  poly p=(poly)(u->CopyD());
1201  res->data=(void*)(p_Divide(p /*(poly)(u->CopyD())*/ ,
1202  q /*(poly)(v->CopyD())*/ ,currRing));
1203  if (res->data!=NULL) pNormalize((poly)res->data);
1204  return errorreported; /*there may be errors in p_Divide: div. ny 0, etc.*/
1205 }
poly p_Divide(poly p, poly q, const ring r)
polynomial division, ignoring the rest via singclap_pdiive resp. idLift destroyes a,...
Definition: polys.cc:31
#define pNormalize(p)
Definition: polys.h:303

◆ jjDIVISION()

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

Definition at line 1842 of file iparith.cc.

1843 {
1844  ideal vi=(ideal)v->Data();
1845  int vl= IDELEMS(vi);
1846  ideal ui=(ideal)u->Data();
1847  unsigned ul= IDELEMS(ui);
1848  ideal R; matrix U;
1849  ideal m = idLift(vi,ui,&R, FALSE,hasFlag(v,FLAG_STD),TRUE,&U);
1850  if (m==NULL) return TRUE;
1851  // now make sure that all matrices have the corect size:
1853  int i;
1854  if (MATCOLS(U) != (int)ul)
1855  {
1856  unsigned mul=si_min(ul,MATCOLS(U));
1857  matrix UU=mpNew(ul,ul);
1858  unsigned j;
1859  for(i=mul;i>0;i--)
1860  {
1861  for(j=mul;j>0;j--)
1862  {
1863  MATELEM(UU,i,j)=MATELEM(U,i,j);
1864  MATELEM(U,i,j)=NULL;
1865  }
1866  }
1867  idDelete((ideal *)&U);
1868  U=UU;
1869  }
1870  // make sure that U is a diagonal matrix of units
1871  for(i=ul;i>0;i--)
1872  {
1873  if(MATELEM(U,i,i)==NULL) MATELEM(U,i,i)=pOne();
1874  }
1876  L->Init(3);
1877  L->m[0].rtyp=MATRIX_CMD; L->m[0].data=(void *)T;
1878  L->m[1].rtyp=u->Typ(); L->m[1].data=(void *)R;
1879  L->m[2].rtyp=MATRIX_CMD; L->m[2].data=(void *)U;
1880  res->data=(char *)L;
1881  return FALSE;
1882 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
ideal idLift(ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit, GbVariant alg)
Definition: ideals.cc:1113
#define hasFlag(A, F)
Definition: ipid.h:107
#define FLAG_STD
Definition: ipid.h:104
static jList * T
Definition: janet.cc:31
#define pOne()
Definition: polys.h:301
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition: sirandom.c:26

◆ jjDIVISION4()

static BOOLEAN jjDIVISION4 ( leftv  res,
leftv  v 
)
static

Definition at line 6567 of file iparith.cc.

6568 { // may have 3 or 4 arguments
6569  leftv v1=v;
6570  leftv v2=v1->next;
6571  leftv v3=v2->next;
6572  leftv v4=v3->next;
6573  assumeStdFlag(v2);
6574 
6575  int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
6576  int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
6577 
6578  if((i1==0)||(i2==0)
6579  ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
6580  {
6581  WarnS("<module>,<module>,<int>[,<intvec>] expected!");
6582  return TRUE;
6583  }
6584 
6585  sleftv w1,w2;
6586  iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
6587  iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
6588  ideal P=(ideal)w1.Data();
6589  ideal Q=(ideal)w2.Data();
6590 
6591  int n=(int)(long)v3->Data();
6592  short *w=NULL;
6593  if(v4!=NULL)
6594  {
6595  w = iv2array((intvec *)v4->Data(),currRing);
6596  short * w0 = w + 1;
6597  int i = currRing->N;
6598  while( (i > 0) && ((*w0) > 0) )
6599  {
6600  w0++;
6601  i--;
6602  }
6603  if(i>0)
6604  WarnS("not all weights are positive!");
6605  }
6606 
6607  matrix T;
6608  ideal R;
6609  idLiftW(P,Q,n,T,R,w);
6610 
6611  w1.CleanUp();
6612  w2.CleanUp();
6613  if(w!=NULL)
6614  omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(short) );
6615 
6617  L->Init(2);
6618  L->m[1].rtyp=v1->Typ();
6619  if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
6620  {
6621  if(v1->Typ()==POLY_CMD)
6622  p_Shift(&R->m[0],-1,currRing);
6623  L->m[1].data=(void *)R->m[0];
6624  R->m[0]=NULL;
6625  idDelete(&R);
6626  }
6627  else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
6628  L->m[1].data=(void *)id_Module2Matrix(R,currRing);
6629  else
6630  {
6631  L->m[1].rtyp=MODUL_CMD;
6632  L->m[1].data=(void *)R;
6633  }
6634  L->m[0].rtyp=MATRIX_CMD;
6635  L->m[0].data=(char *)T;
6636 
6637  res->data=L;
6638  res->rtyp=LIST_CMD;
6639 
6640  return FALSE;
6641 }
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, short *w)
Definition: ideals.cc:1309
#define Q
Definition: sirandom.c:25

◆ jjDIVMOD_I()

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

Definition at line 1148 of file iparith.cc.

1149 {
1150  if (iiOp=='/') Warn("int division with `/`: use `div` instead in line >>%s<<",my_yylinebuf);
1151  int a= (int)(long)u->Data();
1152  int b= (int)(long)v->Data();
1153  if (b==0)
1154  {
1156  return TRUE;
1157  }
1158  int c=a%b;
1159  int r=0;
1160  switch (iiOp)
1161  {
1162  case '%':
1163  r=c; break;
1164  case '/':
1165  case INTDIV_CMD:
1166  r=((a-c) /b); break;
1167  }
1168  res->data=(void *)((long)r);
1169  return FALSE;
1170 }
@ INTDIV_CMD
Definition: tok.h:97

◆ jjDOTDOT()

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

Definition at line 336 of file iparith.cc.

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

◆ jjDUMMY()

static BOOLEAN jjDUMMY ( leftv  res,
leftv  u 
)
static

Definition at line 3409 of file iparith.cc.

3410 {
3411  res->data = (char *)u->CopyD();
3412  return FALSE;
3413 }

◆ jjDUMP()

static BOOLEAN jjDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 3879 of file iparith.cc.

3880 {
3881  si_link l = (si_link)v->Data();
3882  if (slDump(l))
3883  {
3884  const char *s;
3885  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3886  else s=sNoName_fe;
3887  Werror("cannot dump to `%s`",s);
3888  return TRUE;
3889  }
3890  else
3891  return FALSE;
3892 }

◆ jjE()

static BOOLEAN jjE ( leftv  res,
leftv  v 
)
static

Definition at line 3893 of file iparith.cc.

3894 {
3895  res->data = (char *)pOne();
3896  int co=(int)(long)v->Data();
3897  if (co>0)
3898  {
3899  pSetComp((poly)res->data,co);
3900  pSetm((poly)res->data);
3901  }
3902  else WerrorS("argument of gen must be positive");
3903  return (co<=0);
3904 }
#define pSetComp(p, v)
Definition: polys.h:38

◆ jjELIMIN()

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

Definition at line 1883 of file iparith.cc.

1884 {
1885  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data());
1886  //setFlag(res,FLAG_STD);
1887  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
1888 }
ideal idElimination(ideal h1, poly delVar, intvec *hilb, GbVariant alg)
Definition: ideals.cc:1574

◆ jjELIMIN_ALG()

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

Definition at line 5641 of file iparith.cc.

5642 {
5643  ideal I=(ideal)u->Data();
5644  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
5645  res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
5646  //setFlag(res,FLAG_STD);
5647  return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
5648 }
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition: ideals.cc:3030
GbVariant
Definition: ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 5649 of file iparith.cc.

5650 {
5651  res->data=(char *)idElimination((ideal)u->Data(),(poly)v->Data(),
5652  (intvec *)w->Data());
5653  //setFlag(res,FLAG_STD);
5654  return FALSE;
5655 }

◆ jjELIMIN_IV()

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

Definition at line 1889 of file iparith.cc.

1890 {
1891  poly p=pOne();
1892  intvec *iv=(intvec*)v->Data();
1893  for(int i=iv->length()-1; i>=0; i--)
1894  {
1895  pSetExp(p,(*iv)[i],1);
1896  }
1897  pSetm(p);
1898  res->data=(char *)idElimination((ideal)u->Data(),p);
1899  pLmDelete(&p);
1900  //setFlag(res,FLAG_STD);
1901  return FALSE;
1902 }
#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 4941 of file iparith.cc.

4942 {
4943  ring r = (ring)a->Data();
4944  if (rIsPluralRing(r))
4945  {
4946  ring s = rEnvelope(r);
4947  res->data = s;
4948  }
4949  else res->data = rCopy(r);
4950  return FALSE;
4951 }
ring rEnvelope(ring R)
Definition: ring.cc:5506
ring rCopy(ring r)
Definition: ring.cc:1605

◆ jjEQUAL_BI()

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

Definition at line 1236 of file iparith.cc.

1237 {
1238  res->data = (char *)((long)n_Equal((number)u->Data(),(number)v->Data(),coeffs_BIGINT));
1239  jjEQUAL_REST(res,u,v);
1240  return FALSE;
1241 }
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:461

◆ jjEQUAL_I()

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

Definition at line 1242 of file iparith.cc.

1243 {
1244  res->data = (char *)((int)((long)u->Data()) == (int)((long)v->Data()));
1245  jjEQUAL_REST(res,u,v);
1246  return FALSE;
1247 }

◆ jjEQUAL_Ma()

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

Definition at line 1248 of file iparith.cc.

1249 {
1250  res->data = (char *)((long)mp_Equal((matrix)u->Data(),(matrix)v->Data(),currRing));
1251  jjEQUAL_REST(res,u,v);
1252  return FALSE;
1253 }
BOOLEAN mp_Equal(matrix a, matrix b, const ring R)
Definition: matpol.cc:584

◆ jjEQUAL_N()

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

Definition at line 1260 of file iparith.cc.

1261 {
1262  res->data = (char *)((long)nEqual((number)u->Data(),(number)v->Data()));
1263  jjEQUAL_REST(res,u,v);
1264  return FALSE;
1265 }
#define nEqual(n1, n2)
Definition: numbers.h:21

◆ jjEQUAL_P()

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

Definition at line 1266 of file iparith.cc.

1267 {
1268  poly p=(poly)u->Data();
1269  poly q=(poly)v->Data();
1270  res->data = (char *) ((long)pEqualPolys(p,q));
1271  jjEQUAL_REST(res,u,v);
1272  return FALSE;
1273 }
#define pEqualPolys(p1, p2)
Definition: polys.h:386

◆ jjEQUAL_R()

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

Definition at line 1254 of file iparith.cc.

1255 {
1256  res->data = (char *)(long)(u->Data()==v->Data());
1257  jjEQUAL_REST(res,u,v);
1258  return FALSE;
1259 }

◆ jjEQUAL_REST()

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

Definition at line 1274 of file iparith.cc.

1275 {
1276  if ((res->data) && (u->next!=NULL) && (v->next!=NULL))
1277  {
1278  int save_iiOp=iiOp;
1279  if (iiOp==NOTEQUAL)
1281  else
1282  iiExprArith2(res,u->next,iiOp,v->next);
1283  iiOp=save_iiOp;
1284  }
1285  if (iiOp==NOTEQUAL) res->data=(char *)(!(long)res->data);
1286 }

◆ jjERROR()

static BOOLEAN jjERROR ( leftv  ,
leftv  u 
)
static

Definition at line 1908 of file iparith.cc.

1909 {
1910  WerrorS((char *)u->Data());
1911  extern int inerror;
1912  inerror=3;
1913  return TRUE;
1914 }
int inerror
Definition: grammar.cc:175

◆ jjEXECUTE()

static BOOLEAN jjEXECUTE ( leftv  ,
leftv  v 
)
static

Definition at line 3905 of file iparith.cc.

3906 {
3907  char * d = (char *)v->Data();
3908  char * s = (char *)omAlloc(strlen(d) + 13);
3909  strcpy( s, (char *)d);
3910  strcat( s, "\n;RETURN();\n");
3912  return yyparse();
3913 }
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:157
@ BT_execute
Definition: fevoices.h:23
int yyparse(void)
Definition: grammar.cc:2109

◆ jjEXPORTTO()

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

Definition at line 1903 of file iparith.cc.

1904 {
1905  //Print("exportto %s -> %s\n",v->Name(),u->Name() );
1906  return iiExport(v,0,IDPACKAGE((idhdl)u->data));
1907 }
BOOLEAN iiExport(leftv v, int toLev)
Definition: ipshell.cc:1414

◆ jjEXTGCD_BI()

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

Definition at line 1915 of file iparith.cc.

1916 {
1917  number uu=(number)u->Data();number vv=(number)v->Data();
1919  number a,b;
1920  number p0=n_ExtGcd(uu,vv,&a,&b,coeffs_BIGINT);
1921  L->Init(3);
1922  L->m[0].rtyp=BIGINT_CMD; L->m[0].data=(void *)p0;
1923  L->m[1].rtyp=BIGINT_CMD; L->m[1].data=(void *)a;
1924  L->m[2].rtyp=BIGINT_CMD; L->m[2].data=(void *)b;
1925  res->rtyp=LIST_CMD;
1926  res->data=(char *)L;
1927  return FALSE;
1928 }
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:694

◆ jjEXTGCD_I()

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

Definition at line 1929 of file iparith.cc.

1930 {
1931  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
1932  int p0=ABS(uu),p1=ABS(vv);
1933  int f0 = 1, f1 = 0, g0 = 0, g1 = 1, q, r;
1934 
1935  while ( p1!=0 )
1936  {
1937  q=p0 / p1;
1938  r=p0 % p1;
1939  p0 = p1; p1 = r;
1940  r = g0 - g1 * q;
1941  g0 = g1; g1 = r;
1942  r = f0 - f1 * q;
1943  f0 = f1; f1 = r;
1944  }
1945  int a = f0;
1946  int b = g0;
1947  if ( uu /*(int)(long)u->Data()*/ < 0 ) a=-a;
1948  if ( vv /*(int)(long)v->Data()*/ < 0 ) b=-b;
1950  L->Init(3);
1951  L->m[0].rtyp=INT_CMD; L->m[0].data=(void *)(long)p0;
1952  L->m[1].rtyp=INT_CMD; L->m[1].data=(void *)(long)a;
1953  L->m[2].rtyp=INT_CMD; L->m[2].data=(void *)(long)b;
1954  res->rtyp=LIST_CMD;
1955  res->data=(char *)L;
1956  return FALSE;
1957 }
static int ABS(int v)
Definition: auxiliary.h:110

◆ jjEXTGCD_P()

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

Definition at line 1958 of file iparith.cc.

1959 {
1960  poly r,pa,pb;
1961  BOOLEAN ret=singclap_extgcd((poly)u->Data(),(poly)v->Data(),r,pa,pb,currRing);
1962  if (ret) return TRUE;
1964  L->Init(3);
1965  res->data=(char *)L;
1966  L->m[0].data=(void *)r;
1967  L->m[0].rtyp=POLY_CMD;
1968  L->m[1].data=(void *)pa;
1969  L->m[1].rtyp=POLY_CMD;
1970  L->m[2].data=(void *)pb;
1971  L->m[2].rtyp=POLY_CMD;
1972  return FALSE;
1973 }
BOOLEAN singclap_extgcd(poly f, poly g, poly &res, poly &pa, poly &pb, const ring r)
Definition: clapsing.cc:438

◆ jjFAC_P()

static BOOLEAN jjFAC_P ( leftv  res,
leftv  u 
)
static

Definition at line 3954 of file iparith.cc.

3955 {
3956  intvec *v=NULL;
3958  ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
3959  if (f==NULL) return TRUE;
3960  ivTest(v);
3962  l->Init(2);
3963  l->m[0].rtyp=IDEAL_CMD;
3964  l->m[0].data=(void *)f;
3965  l->m[1].rtyp=INTVEC_CMD;
3966  l->m[1].data=(void *)v;
3967  res->data=(void *)l;
3968  return FALSE;
3969 }
FILE * f
Definition: checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:854
#define ivTest(v)
Definition: intvec.h:156
int singclap_factorize_retry
Definition: iparith.cc:3105

◆ jjFAC_P2()

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

Definition at line 1975 of file iparith.cc.

1976 {
1977  intvec *v=NULL;
1978  int sw=(int)(long)dummy->Data();
1979  int fac_sw=sw;
1980  if ((sw<0)||(sw>2)) fac_sw=1;
1982  ideal f=singclap_factorize((poly)(u->CopyD()), &v, fac_sw,currRing);
1983  if (f==NULL)
1984  return TRUE;
1985  switch(sw)
1986  {
1987  case 0:
1988  case 2:
1989  {
1991  l->Init(2);
1992  l->m[0].rtyp=IDEAL_CMD;
1993  l->m[0].data=(void *)f;
1994  l->m[1].rtyp=INTVEC_CMD;
1995  l->m[1].data=(void *)v;
1996  res->data=(void *)l;
1997  res->rtyp=LIST_CMD;
1998  return FALSE;
1999  }
2000  case 1:
2001  res->data=(void *)f;
2002  return FALSE;
2003  case 3:
2004  {
2005  poly p=f->m[0];
2006  int i=IDELEMS(f);
2007  f->m[0]=NULL;
2008  while(i>1)
2009  {
2010  i--;
2011  p=pMult(p,f->m[i]);
2012  f->m[i]=NULL;
2013  }
2014  res->data=(void *)p;
2015  res->rtyp=POLY_CMD;
2016  }
2017  return FALSE;
2018  }
2019  WerrorS("invalid switch");
2020  return TRUE;
2021 }
#define pMult(p, q)
Definition: polys.h:194

◆ jjFACSTD()

static BOOLEAN jjFACSTD ( leftv  res,
leftv  v 
)
static

Definition at line 3914 of file iparith.cc.

3915 {
3917  if (currRing->cf->convSingNFactoryN!=NULL) /* conversion to factory*/
3918  {
3919  ideal_list p,h;
3920  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
3921  if (h==NULL)
3922  {
3923  L->Init(1);
3924  L->m[0].data=(char *)idInit(1);
3925  L->m[0].rtyp=IDEAL_CMD;
3926  }
3927  else
3928  {
3929  p=h;
3930  int l=0;
3931  while (p!=NULL) { p=p->next;l++; }
3932  L->Init(l);
3933  l=0;
3934  while(h!=NULL)
3935  {
3936  L->m[l].data=(char *)h->d;
3937  L->m[l].rtyp=IDEAL_CMD;
3938  p=h->next;
3939  omFreeSize(h,sizeof(*h));
3940  h=p;
3941  l++;
3942  }
3943  }
3944  }
3945  else
3946  {
3947  WarnS("no factorization implemented");
3948  L->Init(1);
3949  iiExprArith1(&(L->m[0]),v,STD_CMD);
3950  }
3951  res->data=(void *)L;
3952  return FALSE;
3953 }
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition: kstdfac.cc:807
@ testHomog
Definition: structs.h:41
@ STD_CMD
Definition: tok.h:182

◆ jjFACSTD2()

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

Definition at line 2022 of file iparith.cc.

2023 {
2024  ideal_list p,h;
2025  h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL,(ideal)w->Data());
2026  p=h;
2027  int l=0;
2028  while (p!=NULL) { p=p->next;l++; }
2030  L->Init(l);
2031  l=0;
2032  while(h!=NULL)
2033  {
2034  L->m[l].data=(char *)h->d;
2035  L->m[l].rtyp=IDEAL_CMD;
2036  p=h->next;
2037  omFreeSize(h,sizeof(*h));
2038  h=p;
2039  l++;
2040  }
2041  res->data=(void *)L;
2042  return FALSE;
2043 }

◆ jjFactModD_M()

static BOOLEAN jjFactModD_M ( leftv  res,
leftv  v 
)
static

Definition at line 7560 of file iparith.cc.

7561 {
7562  /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
7563  see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
7564 
7565  valid argument lists:
7566  - (poly h, int d),
7567  - (poly h, int d, poly f0, poly g0), optional: factors of h(0,y),
7568  - (poly h, int d, int xIndex, int yIndex), optional: indices of vars x & y
7569  in list of ring vars,
7570  - (poly h, int d, poly f0, poly g0, int xIndex, int yIndec),
7571  optional: all 4 optional args
7572  (The defaults are xIndex = 1, yIndex = 2, f0 and g0 polynomials as found
7573  by singclap_factorize and h(0, y)
7574  has exactly two distinct monic factors [possibly with exponent > 1].)
7575  result:
7576  - list with the two factors f and g such that
7577  h(x,y) = f(x,y)*g(x,y) mod x^(d+1) */
7578 
7579  poly h = NULL;
7580  int d = 1;
7581  poly f0 = NULL;
7582  poly g0 = NULL;
7583  int xIndex = 1; /* default index if none provided */
7584  int yIndex = 2; /* default index if none provided */
7585 
7586  leftv u = v; int factorsGiven = 0;
7587  if ((u == NULL) || (u->Typ() != POLY_CMD))
7588  {
7589  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7590  return TRUE;
7591  }
7592  else h = (poly)u->Data();
7593  u = u->next;
7594  if ((u == NULL) || (u->Typ() != INT_CMD))
7595  {
7596  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7597  return TRUE;
7598  }
7599  else d = (int)(long)u->Data();
7600  u = u->next;
7601  if ((u != NULL) && (u->Typ() == POLY_CMD))
7602  {
7603  if ((u->next == NULL) || (u->next->Typ() != POLY_CMD))
7604  {
7605  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7606  return TRUE;
7607  }
7608  else
7609  {
7610  f0 = (poly)u->Data();
7611  g0 = (poly)u->next->Data();
7612  factorsGiven = 1;
7613  u = u->next->next;
7614  }
7615  }
7616  if ((u != NULL) && (u->Typ() == INT_CMD))
7617  {
7618  if ((u->next == NULL) || (u->next->Typ() != INT_CMD))
7619  {
7620  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7621  return TRUE;
7622  }
7623  else
7624  {
7625  xIndex = (int)(long)u->Data();
7626  yIndex = (int)(long)u->next->Data();
7627  u = u->next->next;
7628  }
7629  }
7630  if (u != NULL)
7631  {
7632  WerrorS("expected arguments (poly, int [, poly, poly] [, int, int])");
7633  return TRUE;
7634  }
7635 
7636  /* checks for provided arguments */
7637  if (pIsConstant(h) || (factorsGiven && (pIsConstant(f0) || pIsConstant(g0))))
7638  {
7639  WerrorS("expected non-constant polynomial argument(s)");
7640  return TRUE;
7641  }
7642  int n = rVar(currRing);
7643  if ((xIndex < 1) || (n < xIndex))
7644  {
7645  Werror("index for variable x (%d) out of range [1..%d]", xIndex, n);
7646  return TRUE;
7647  }
7648  if ((yIndex < 1) || (n < yIndex))
7649  {
7650  Werror("index for variable y (%d) out of range [1..%d]", yIndex, n);
7651  return TRUE;
7652  }
7653  if (xIndex == yIndex)
7654  {
7655  WerrorS("expected distinct indices for variables x and y");
7656  return TRUE;
7657  }
7658 
7659  /* computation of f0 and g0 if missing */
7660  if (factorsGiven == 0)
7661  {
7662  poly h0 = pSubst(pCopy(h), xIndex, NULL);
7663  intvec* v = NULL;
7664  ideal i = singclap_factorize(h0, &v, 0,currRing);
7665 
7666  ivTest(v);
7667 
7668  if (i == NULL) return TRUE;
7669 
7670  idTest(i);
7671 
7672  if ((v->rows() != 3) || ((*v)[0] =! 1) || (!nIsOne(pGetCoeff(i->m[0]))))
7673  {
7674  WerrorS("expected h(0,y) to have exactly two distinct monic factors");
7675  return TRUE;
7676  }
7677  f0 = pPower(pCopy(i->m[1]), (*v)[1]);
7678  g0 = pPower(pCopy(i->m[2]), (*v)[2]);
7679  idDelete(&i);
7680  }
7681 
7682  poly f; poly g;
7683  henselFactors(xIndex, yIndex, h, f0, g0, d, f, g);
7685  L->Init(2);
7686  L->m[0].rtyp = POLY_CMD; L->m[0].data=(void*)f;
7687  L->m[1].rtyp = POLY_CMD; L->m[1].data=(void*)g;
7688  res->rtyp = LIST_CMD;
7689  res->data = (char*)L;
7690  return FALSE;
7691 }
g
Definition: cfModGcd.cc:4031
#define idTest(id)
Definition: ideals.h:47
idhdl h0
Definition: libparse.cc:1141
void henselFactors(const int xIndex, const int yIndex, const poly h, const poly f0, const poly g0, const int d, poly &f, poly &g)
Computes a factorization of a polynomial h(x, y) in K[[x]][y] up to a certain degree in x,...
#define nIsOne(n)
Definition: numbers.h:26
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:225
#define pPower(p, q)
Definition: polys.h:191
#define pSubst(p, n, e)
Definition: polys.h:352

◆ jjFAREY_BI()

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

Definition at line 2044 of file iparith.cc.

2045 {
2046  if (rField_is_Q(currRing))
2047  {
2048  number uu=(number)u->Data();
2049  number vv=(number)v->Data();
2050  res->data=(char *)n_Farey(uu,vv,currRing->cf);
2051  return FALSE;
2052  }
2053  else return TRUE;
2054 }
static FORCE_INLINE number n_Farey(number a, number b, const coeffs r)
Definition: coeffs.h:798
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:501

◆ jjFAREY_ID()

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

Definition at line 2055 of file iparith.cc.

2056 {
2057  ideal uu=(ideal)u->Data();
2058  number vv=(number)v->Data();
2059  //timespec buf1,buf2;
2060  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf1);
2061  res->data=(void*)id_Farey(uu,vv,currRing);
2062  //clock_gettime(CLOCK_THREAD_CPUTIME_ID,&buf2);
2063  //const unsigned long SEC = 1000L*1000L*1000L;
2064  //all_farey+=((buf2.tv_sec-buf1.tv_sec)*SEC+
2065  // buf2.tv_nsec-buf1.tv_nsec);
2066  //farey_cnt++;
2067  return FALSE;
2068 }
ideal id_Farey(ideal x, number N, const ring r)
Definition: ideals.cc:2726

◆ jjFAREY_LI()

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

Definition at line 9300 of file iparith.cc.

9301 {
9302  lists c=(lists)u->CopyD();
9303  lists res_l=(lists)omAllocBin(slists_bin);
9304  res_l->Init(c->nr+1);
9305  BOOLEAN bo=FALSE;
9306  int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
9307  for (unsigned i=0;i<=(unsigned)c->nr;i++)
9308  {
9309  sleftv tmp;
9310  tmp.Copy(v);
9311  bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
9312  if (bo) { Werror("farey failed for list entry %d",i+1); break;}
9313  }
9314  c->Clean();
9315  res->data=res_l;
9316  return bo;
9317 }
@ FAREY_CMD
Definition: tok.h:77

◆ jjFETCH()

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

Definition at line 2070 of file iparith.cc.

2071 {
2072  ring r=(ring)u->Data();
2073  idhdl w;
2074  int op=iiOp;
2075  nMapFunc nMap;
2076 
2077  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
2078  {
2079  int *perm=NULL;
2080  int *par_perm=NULL;
2081  int par_perm_size=0;
2082  BOOLEAN bo;
2083  if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
2084  {
2085  // Allow imap/fetch to be make an exception only for:
2086  if ( (rField_is_Q_a(r) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2089  ||
2090  (rField_is_Zp_a(r) && // Zp(a..) -> Zp(a..) || Zp
2091  (rField_is_Zp(currRing, r->cf->ch) ||
2092  rField_is_Zp_a(currRing, r->cf->ch))) )
2093  {
2094  par_perm_size=rPar(r);
2095  }
2096  else
2097  {
2098  goto err_fetch;
2099  }
2100  }
2101  if ((iiOp!=FETCH_CMD) || (r->N!=currRing->N) || (rPar(r)!=rPar(currRing)))
2102  {
2103  perm=(int *)omAlloc0((r->N+1)*sizeof(int));
2104  if (par_perm_size!=0)
2105  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2106  op=IMAP_CMD;
2107  if (iiOp==IMAP_CMD)
2108  {
2109  int r_par=0;
2110  char ** r_par_names=NULL;
2111  if (r->cf->extRing!=NULL)
2112  {
2113  r_par=r->cf->extRing->N;
2114  r_par_names=r->cf->extRing->names;
2115  }
2116  int c_par=0;
2117  char ** c_par_names=NULL;
2118  if (currRing->cf->extRing!=NULL)
2119  {
2120  c_par=currRing->cf->extRing->N;
2121  c_par_names=currRing->cf->extRing->names;
2122  }
2123  maFindPerm(r->names, r->N, r_par_names, r_par,
2124  currRing->names,currRing->N,c_par_names, c_par,
2125  perm,par_perm, currRing->cf->type);
2126  }
2127  else
2128  {
2129  unsigned i;
2130  if (par_perm_size!=0)
2131  for(i=si_min(rPar(r),rPar(currRing));i>0;i--) par_perm[i-1]=-i;
2132  for(i=si_min(r->N,currRing->N);i>0;i--) perm[i]=i;
2133  }
2134  }
2135  if ((iiOp==FETCH_CMD) &&(BVERBOSE(V_IMAP)))
2136  {
2137  unsigned i;
2138  for(i=0;i<(unsigned)si_min(r->N,currRing->N);i++)
2139  {
2140  Print("// var nr %d: %s -> %s\n",i,r->names[i],currRing->names[i]);
2141  }
2142  for(i=0;i<(unsigned)si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
2143  {
2144  Print("// par nr %d: %s -> %s\n",
2145  i,rParameter(r)[i],rParameter(currRing)[i]);
2146  }
2147  }
2148  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
2149  sleftv tmpW;
2150  memset(&tmpW,0,sizeof(sleftv));
2151  tmpW.rtyp=IDTYP(w);
2152  tmpW.data=IDDATA(w);
2153  if ((bo=maApplyFetch(op,NULL,res,&tmpW, r,
2154  perm,par_perm,par_perm_size,nMap)))
2155  {
2156  Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
2157  }
2158  if (perm!=NULL)
2159  omFreeSize((ADDRESS)perm,(r->N+1)*sizeof(int));
2160  if (par_perm!=NULL)
2161  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
2162  return bo;
2163  }
2164  else
2165  {
2166  Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
2167  }
2168  return TRUE;
2169 err_fetch:
2170  char *s1=nCoeffString(r->cf);
2171  char *s2=nCoeffString(currRing->cf);
2172  Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
2173  omFree(s2); omFree(s1);
2174  return TRUE;
2175 }
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:973
@ IMAP_CMD
Definition: grammar.cc:296
@ FETCH_CMD
Definition: grammar.cc:293
#define IDDATA(a)
Definition: ipid.h:121
#define IDTYP(a)
Definition: ipid.h:114
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:165
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:46
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define V_IMAP
Definition: options.h:53
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:616
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:590
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:531
@ ALIAS_CMD
Definition: tok.h:34

◆ jjFETCH_M()

static BOOLEAN jjFETCH_M ( leftv  res,
leftv  u 
)
static

Definition at line 6711 of file iparith.cc.

6712 {
6713  ring r=(ring)u->Data();
6714  leftv v=u->next;
6715  leftv perm_var_l=v->next;
6716  leftv perm_par_l=v->next->next;
6717  if ((perm_var_l->Typ()!=INTVEC_CMD)
6718  ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
6719  ||(u->Typ()!=RING_CMD))
6720  {
6721  WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
6722  return TRUE;
6723  }
6724  intvec *perm_var_v=(intvec*)perm_var_l->Data();
6725  intvec *perm_par_v=NULL;
6726  if (perm_par_l!=NULL)
6727  perm_par_v=(intvec*)perm_par_l->Data();
6728  idhdl w;
6729  nMapFunc nMap;
6730 
6731  if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
6732  {
6733  int *perm=NULL;
6734  int *par_perm=NULL;
6735  int par_perm_size=0;
6736  BOOLEAN bo;
6737  if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
6738  {
6739  // Allow imap/fetch to be make an exception only for:
6740  if ( (rField_is_Q_a(r) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
6743  ||
6744  (rField_is_Zp_a(r) && // Zp(a..) -> Zp(a..) || Zp
6745  (rField_is_Zp(currRing, r->cf->ch) ||
6746  rField_is_Zp_a(currRing, r->cf->ch))) )
6747  {
6748  par_perm_size=rPar(r);
6749  }
6750  else
6751  {
6752  goto err_fetch;
6753  }
6754  }
6755  else
6756  par_perm_size=rPar(r);
6757  perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
6758  if (par_perm_size!=0)
6759  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
6760  int i;
6761  if (perm_par_l==NULL)
6762  {
6763  if (par_perm_size!=0)
6764  for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
6765  }
6766  else
6767  {
6768  if (par_perm_size==0) WarnS("source ring has no parameters");
6769  else
6770  {
6771  for(i=rPar(r)-1;i>=0;i--)
6772  {
6773  if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
6774  if ((par_perm[i]<-rPar(currRing))
6775  || (par_perm[i]>rVar(currRing)))
6776  {
6777  Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
6778  par_perm[i]=0;
6779  }
6780  }
6781  }
6782  }
6783  for(i=rVar(r)-1;i>=0;i--)
6784  {
6785  if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
6786  if ((perm[i]<-rPar(currRing))
6787  || (perm[i]>rVar(currRing)))
6788  {
6789  Warn("invalid entry for var %d: %d\n",i,perm[i]);
6790  perm[i]=0;
6791  }
6792  }
6793  if (BVERBOSE(V_IMAP))
6794  {
6795  for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
6796  {
6797  if (perm[i]>0)
6798  Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
6799  else if (perm[i]<0)
6800  Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
6801  }
6802  for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
6803  {
6804  if (par_perm[i-1]<0)
6805  Print("// par nr %d: %s -> par %s\n",
6806  i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
6807  else if (par_perm[i-1]>0)
6808  Print("// par nr %d: %s -> var %s\n",
6809  i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
6810  }
6811  }
6812  if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
6813  sleftv tmpW;
6814  memset(&tmpW,0,sizeof(sleftv));
6815  tmpW.rtyp=IDTYP(w);
6816  tmpW.data=IDDATA(w);
6817  if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
6818  perm,par_perm,par_perm_size,nMap)))
6819  {
6820  Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
6821  }
6822  if (perm!=NULL)
6823  omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
6824  if (par_perm!=NULL)
6825  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
6826  return bo;
6827  }
6828  else
6829  {
6830  Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
6831  }
6832  return TRUE;
6833 err_fetch:
6834  char *s1=nCoeffString(r->cf);
6835  char *s2=nCoeffString(currRing->cf);
6836  Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
6837  omFree(s2);omFree(s1);
6838  return TRUE;
6839 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:267

◆ jjFIND2()

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

Definition at line 2176 of file iparith.cc.

2177 {
2178  /*4
2179  * look for the substring what in the string where
2180  * return the position of the first char of what in where
2181  * or 0
2182  */
2183  char *where=(char *)u->Data();
2184  char *what=(char *)v->Data();
2185  char *found = strstr(where,what);
2186  if (found != NULL)
2187  {
2188  res->data=(char *)((found-where)+1);
2189  }
2190  /*else res->data=NULL;*/
2191  return FALSE;
2192 }
bool found
Definition: facFactorize.cc:56

◆ jjFIND3()

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

Definition at line 5656 of file iparith.cc.

5657 {
5658  /*4
5659  * look for the substring what in the string where
5660  * starting at position n
5661  * return the position of the first char of what in where
5662  * or 0
5663  */
5664  int n=(int)(long)w->Data();
5665  char *where=(char *)u->Data();
5666  char *what=(char *)v->Data();
5667  char *found;
5668  if ((1>n)||(n>(int)strlen(where)))
5669  {
5670  Werror("start position %d out of range",n);
5671  return TRUE;
5672  }
5673  found = strchr(where+n-1,*what);
5674  if (*(what+1)!='\0')
5675  {
5676  while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
5677  {
5678  found=strchr(found+1,*what);
5679  }
5680  }
5681  if (found != NULL)
5682  {
5683  res->data=(char *)((found-where)+1);
5684  }
5685  return FALSE;
5686 }

◆ jjFRES()

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

Definition at line 2226 of file iparith.cc.

2227 {
2228  leftv w = (leftv)omAlloc0(sizeof(sleftv));
2229  w->rtyp = STRING_CMD;
2230  w->data = (char *)"complete"; // default
2231  BOOLEAN RES = jjFRES3(res, u, v, w);
2232  omFree(w);
2233  return RES;
2234 }
static BOOLEAN jjFRES3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:2194

◆ jjFRES3()

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

Definition at line 2194 of file iparith.cc.

2195 {
2196  assumeStdFlag(u);
2197  ideal id = (ideal)u->Data();
2198  int max_length = (int)(long)v->Data();
2199  if (max_length < 0) {
2200  WerrorS("length for fres must not be negative");
2201  return TRUE;
2202  }
2203  if (max_length == 0) {
2204  max_length = currRing->N+1;
2205  if (currRing->qideal != NULL) {
2206  Warn("full resolution in a qring may be infinite, "
2207  "setting max length to %d", max_length);
2208  }
2209  }
2210  char *method = (char *)w->Data();
2211  /* For the moment, only "complete" (default), "frame", or "extended frame"
2212  * are allowed. Another useful option would be "linear strand".
2213  */
2214  if (strcmp(method, "complete") != 0
2215  && strcmp(method, "frame") != 0
2216  && strcmp(method, "extended frame") != 0
2217  && strcmp(method, "single module") != 0) {
2218  WerrorS("wrong optional argument for fres");
2219  }
2220  syStrategy r = syFrank(id, max_length, method);
2221  assume(r->fullres != NULL);
2222  res->data = (void *)r;
2223  return FALSE;
2224 }
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:748

◆ jjFWALK()

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

Definition at line 2236 of file iparith.cc.

2237 {
2238  res->data=(char *)fractalWalkProc(u,v);
2239  setFlag( res, FLAG_STD );
2240  return FALSE;
2241 }
#define setFlag(A, F)
Definition: ipid.h:108
ideal fractalWalkProc(leftv first, leftv second)
Definition: walk_ip.cc:161

◆ jjFWALK3()

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

Definition at line 5687 of file iparith.cc.

5688 {
5689  if ((int)(long)w->Data()==0)
5690  res->data=(char *)walkProc(u,v);
5691  else
5692  res->data=(char *)fractalWalkProc(u,v);
5693  setFlag( res, FLAG_STD );
5694  return FALSE;
5695 }
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 2256 of file iparith.cc.

2257 {
2258  number n1 = (number) u->Data();
2259  number n2 = (number) v->Data();
2260  res->data = n_Gcd(n1,n2,coeffs_BIGINT);
2261  return FALSE;
2262 }
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition: coeffs.h:687

◆ jjGCD_I()

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

Definition at line 2242 of file iparith.cc.

2243 {
2244  int uu=(int)(long)u->Data();int vv=(int)(long)v->Data();
2245  int p0=ABS(uu),p1=ABS(vv);
2246  int r;
2247  while ( p1!=0 )
2248  {
2249  r=p0 % p1;
2250  p0 = p1; p1 = r;
2251  }
2252  res->rtyp=INT_CMD;
2253  res->data=(char *)(long)p0;
2254  return FALSE;
2255 }

◆ jjGCD_N()

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

Definition at line 2263 of file iparith.cc.

2264 {
2265  number a=(number) u->Data();
2266  number b=(number) v->Data();
2267  if (nIsZero(a))
2268  {
2269  if (nIsZero(b)) res->data=(char *)nInit(1);
2270  else res->data=(char *)nCopy(b);
2271  }
2272  else
2273  {
2274  if (nIsZero(b)) res->data=(char *)nCopy(a);
2275  //else res->data=(char *)n_Gcd(a, b, currRing->cf);
2276  else res->data=(char *)n_SubringGcd(a, b, currRing->cf);
2277  }
2278  return FALSE;
2279 }
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:689
#define nInit(i)
Definition: numbers.h:25

◆ jjGCD_P()

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

Definition at line 2280 of file iparith.cc.

2281 {
2282  res->data=(void *)singclap_gcd((poly)(u->CopyD(POLY_CMD)),
2283  (poly)(v->CopyD(POLY_CMD)),currRing);
2284  return FALSE;
2285 }
poly singclap_gcd(poly f, poly g, const ring r)
destroys f and g
Definition: clapsing.cc:255

◆ jjGE_BI()

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

Definition at line 1087 of file iparith.cc.

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

◆ jjGE_I()

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

Definition at line 1094 of file iparith.cc.

1095 {
1096  res->data = (char *)(long)((int)((long)u->Data()) >= (int)((long)v->Data()));
1097  return FALSE;
1098 }

◆ jjGE_N()

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

Definition at line 1099 of file iparith.cc.

1100 {
1101  res->data = (char *)(long) (nGreater((number)u->Data(),(number)v->Data())
1102  || nEqual((number)u->Data(),(number)v->Data()));
1103  return FALSE;
1104 }
#define nGreater(a, b)
Definition: numbers.h:29

◆ jjGETDUMP()

static BOOLEAN jjGETDUMP ( leftv  ,
leftv  v 
)
static

Definition at line 3970 of file iparith.cc.

3971 {
3972  si_link l = (si_link)v->Data();
3973  if (slGetDump(l))
3974  {
3975  const char *s;
3976  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
3977  else s=sNoName_fe;
3978  Werror("cannot get dump from `%s`",s);
3979  return TRUE;
3980  }
3981  else
3982  return FALSE;
3983 }

◆ jjGT_BI()

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

Definition at line 1105 of file iparith.cc.

1106 {
1107  number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1108  res->data = (char *)(long) (n_GreaterZero(h,coeffs_BIGINT)&&(!n_IsZero(h,coeffs_BIGINT)));
1110  return FALSE;
1111 }

◆ jjGT_I()

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

Definition at line 1112 of file iparith.cc.

1113 {
1114  res->data = (char *)(long)((int)((long)u->Data()) > (int)((long)v->Data()));
1115  return FALSE;
1116 }

◆ jjGT_N()

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

Definition at line 1117 of file iparith.cc.

1118 {
1119  res->data = (char *)(long)(nGreater((number)u->Data(),(number)v->Data()));
1120  return FALSE;
1121 }

◆ jjHIGHCORNER()

static BOOLEAN jjHIGHCORNER ( leftv  res,
leftv  v 
)
static

Definition at line 3984 of file iparith.cc.

3985 {
3986  assumeStdFlag(v);
3987  ideal I=(ideal)v->Data();
3988  res->data=(void *)iiHighCorner(I,0);
3989  return FALSE;
3990 }
poly iiHighCorner(ideal I, int ak)
Definition: ipshell.cc:1512

◆ jjHIGHCORNER_M()

static BOOLEAN jjHIGHCORNER_M ( leftv  res,
leftv  v 
)
static

Definition at line 3991 of file iparith.cc.

3992 {
3993  assumeStdFlag(v);
3994  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
3995  BOOLEAN delete_w=FALSE;
3996  ideal I=(ideal)v->Data();
3997  int i;
3998  poly p=NULL,po=NULL;
3999  int rk=id_RankFreeModule(I,currRing);
4000  if (w==NULL)
4001  {
4002  w = new intvec(rk);
4003  delete_w=TRUE;
4004  }
4005  for(i=rk;i>0;i--)
4006  {
4007  p=iiHighCorner(I,i);
4008  if (p==NULL)
4009  {
4010  WerrorS("module must be zero-dimensional");
4011  if (delete_w) delete w;
4012  return TRUE;
4013  }
4014  if (po==NULL)
4015  {
4016  po=p;
4017  }
4018  else
4019  {
4020  // now po!=NULL, p!=NULL
4021  int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4022  if (d==0)
4023  d=pLmCmp(po,p);
4024  if (d > 0)
4025  {
4026  pDelete(&p);
4027  }
4028  else // (d < 0)
4029  {
4030  pDelete(&po); po=p;
4031  }
4032  }
4033  }
4034  if (delete_w) delete w;
4035  res->data=(void *)po;
4036  return FALSE;
4037 }
#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 4038 of file iparith.cc.

4039 {
4040 #ifdef HAVE_RINGS
4042  {
4043  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4044  PrintS("// performed for generic fibre, that is, over Q\n");
4045  }
4046 #endif
4047  assumeStdFlag(v);
4048  intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4049  //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4050  hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4051  return FALSE;
4052 }
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1419

◆ jjHILBERT2()

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

Definition at line 2286 of file iparith.cc.

2287 {
2288 #ifdef HAVE_RINGS
2290  {
2291  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
2292  PrintS("// performed for generic fibre, that is, over Q\n");
2293  }
2294 #endif
2295  assumeStdFlag(u);
2296  intvec *module_w=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2297  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal);
2298  if (errorreported) return TRUE;
2299 
2300  switch((int)(long)v->Data())
2301  {
2302  case 1:
2303  res->data=(void *)iv;
2304  return FALSE;
2305  case 2:
2306  res->data=(void *)hSecondSeries(iv);
2307  delete iv;
2308  return FALSE;
2309  }
2310  delete iv;
2312  return TRUE;
2313 }
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1346
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1336
const char feNotImplemented[]
Definition: reporter.cc:54

◆ jjHILBERT3()

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

Definition at line 5696 of file iparith.cc.

5697 {
5698  intvec *wdegree=(intvec*)w->Data();
5699  if (wdegree->length()!=currRing->N)
5700  {
5701  Werror("weight vector must have size %d, not %d",
5702  currRing->N,wdegree->length());
5703  return TRUE;
5704  }
5705 #ifdef HAVE_RINGS
5707  {
5708  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
5709  PrintS("// performed for generic fibre, that is, over Q\n");
5710  }
5711 #endif
5712  assumeStdFlag(u);
5713  intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
5714  intvec *iv=hFirstSeries((ideal)u->Data(),module_w,currRing->qideal,wdegree);
5715  if (errorreported) return TRUE;
5716 
5717  switch((int)(long)v->Data())
5718  {
5719  case 1:
5720  res->data=(void *)iv;
5721  return FALSE;
5722  case 2:
5723  res->data=(void *)hSecondSeries(iv);
5724  delete iv;
5725  return FALSE;
5726  }
5727  delete iv;
5729  return TRUE;
5730 }

◆ jjHILBERT_IV()

static BOOLEAN jjHILBERT_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4053 of file iparith.cc.

4054 {
4055 #ifdef HAVE_RINGS
4057  {
4058  PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4059  PrintS("// performed for generic fibre, that is, over Q\n");
4060  }
4061 #endif
4062  res->data=(void *)hSecondSeries((intvec *)v->Data());
4063  return FALSE;
4064 }

◆ jjHOMOG1()

static BOOLEAN jjHOMOG1 ( leftv  res,
leftv  v 
)
static

Definition at line 4065 of file iparith.cc.

4066 {
4067  intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4068  ideal v_id=(ideal)v->Data();
4069  if (w==NULL)
4070  {
4071  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4072  if (res->data!=NULL)
4073  {
4074  if (v->rtyp==IDHDL)
4075  {
4076  char *s_isHomog=omStrDup("isHomog");
4077  if (v->e==NULL)
4078  atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4079  else
4080  atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4081  }
4082  else if (w!=NULL) delete w;
4083  } // if res->data==NULL then w==NULL
4084  }
4085  else
4086  {
4087  res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4088  if((res->data==NULL) && (v->rtyp==IDHDL))
4089  {
4090  if (v->e==NULL)
4091  atKill((idhdl)(v->data),"isHomog");
4092  else
4093  atKill((idhdl)(v->LData()),"isHomog");
4094  }
4095  }
4096  return FALSE;
4097 }
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:152
#define atKill(H, A)
Definition: attrib.h:49
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition: ideals.cc:2100
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 2353 of file iparith.cc.

2354 {
2355  intvec *w=new intvec(rVar(currRing));
2356  intvec *vw=(intvec*)u->Data();
2357  ideal v_id=(ideal)v->Data();
2358  pFDegProc save_FDeg=currRing->pFDeg;
2359  pLDegProc save_LDeg=currRing->pLDeg;
2360  BOOLEAN save_pLexOrder=currRing->pLexOrder;
2361  currRing->pLexOrder=FALSE;
2362  kHomW=vw;
2363  kModW=w;
2365  res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2366  currRing->pLexOrder=save_pLexOrder;
2367  kHomW=NULL;
2368  kModW=NULL;
2369  pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2370  if (w!=NULL) delete w;
2371  return FALSE;
2372 }
intvec * kHomW
Definition: kstd1.cc:2071
intvec * kModW
Definition: kstd1.cc:2071
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2083
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3586
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3574
long(* pFDegProc)(poly p, ring r)
Definition: ring.h:45
long(* pLDegProc)(poly p, int *length, ring r)
Definition: ring.h:44

◆ jjHOMOG_ID()

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

Definition at line 2331 of file iparith.cc.

2332 {
2333  int i=pVar((poly)v->Data());
2334  if (i==0)
2335  {
2336  WerrorS("ringvar expected");
2337  return TRUE;
2338  }
2339  pFDegProc deg;
2340  if (currRing->pLexOrder && (currRing->order[0]==ringorder_lp))
2341  deg=p_Totaldegree;
2342  else
2343  deg=currRing->pFDeg;
2344  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2345  int d=deg(p,currRing);
2346  pLmDelete(p);
2347  if (d==1)
2348  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
2349  else
2350  WerrorS("variable must have weight 1");
2351  return (d!=1);
2352 }
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1453
@ ringorder_lp
Definition: ring.h:84
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 5731 of file iparith.cc.

5732 {
5733  PrintS("TODO\n");
5734  int i=pVar((poly)v->Data());
5735  if (i==0)
5736  {
5737  WerrorS("ringvar expected");
5738  return TRUE;
5739  }
5740  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
5741  int d=pWTotaldegree(p);
5742  pLmDelete(p);
5743  if (d==1)
5744  res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
5745  else
5746  WerrorS("variable must have weight 1");
5747  return (d!=1);
5748 }
#define pWTotaldegree(p)
Definition: polys.h:269

◆ jjHOMOG_P()

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

Definition at line 2314 of file iparith.cc.

2315 {
2316  int i=pVar((poly)v->Data());
2317  if (i==0)
2318  {
2319  WerrorS("ringvar expected");
2320  return TRUE;
2321  }
2322  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
2323  int d=pWTotaldegree(p);
2324  pLmDelete(p);
2325  if (d==1)
2326  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
2327  else
2328  WerrorS("variable must have weight 1");
2329  return (d!=1);
2330 }
poly p_Homogen(poly p, int varnum, const ring r)
Definition: p_polys.cc:3208

◆ jjHOMOG_P_W()

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

Definition at line 5749 of file iparith.cc.

5750 {
5751  PrintS("TODO\n");
5752  int i=pVar((poly)v->Data());
5753  if (i==0)
5754  {
5755  WerrorS("ringvar expected");
5756  return TRUE;
5757  }
5758  poly p=pOne(); pSetExp(p,i,1); pSetm(p);
5759  int d=pWTotaldegree(p);
5760  pLmDelete(p);
5761  if (d==1)
5762  res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
5763  else
5764  WerrorS("variable must have weight 1");
5765  return (d!=1);
5766 }

◆ jjIDEAL_Ma()

static BOOLEAN jjIDEAL_Ma ( leftv  res,
leftv  v 
)
static

Definition at line 4104 of file iparith.cc.

4105 {
4106  matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4107  IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4108  if (IDELEMS((ideal)mat)==0)
4109  {
4110  idDelete((ideal *)&mat);
4111  mat=(matrix)idInit(1,1);
4112  }
4113  else
4114  {
4115  MATROWS(mat)=1;
4116  mat->rank=1;
4117  idTest((ideal)mat);
4118  }
4119  res->data=(char *)mat;
4120  return FALSE;
4121 }

◆ jjIDEAL_Map()

static BOOLEAN jjIDEAL_Map ( leftv  res,
leftv  v 
)
static

Definition at line 4122 of file iparith.cc.

4123 {
4124  map m=(map)v->CopyD(MAP_CMD);
4125  omFree((ADDRESS)m->preimage);
4126  m->preimage=NULL;
4127  ideal I=(ideal)m;
4128  I->rank=1;
4129  res->data=(char *)I;
4130  return FALSE;
4131 }
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400

◆ jjIDEAL_PL()

static BOOLEAN jjIDEAL_PL ( leftv  res,
leftv  v 
)
static

Definition at line 6667 of file iparith.cc.

6668 {
6669  int s=1;
6670  leftv h=v;
6671  if (h!=NULL) s=exprlist_length(h);
6672  ideal id=idInit(s,1);
6673  int rank=1;
6674  int i=0;
6675  poly p;
6676  int dest_type=POLY_CMD;
6677  if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
6678  while (h!=NULL)
6679  {
6680  // use standard type conversions to poly/vector
6681  int ri;
6682  int ht=h->Typ();
6683  if (ht==dest_type)
6684  {
6685  p=(poly)h->CopyD();
6686  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
6687  }
6688  else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
6689  {
6690  sleftv tmp;
6691  leftv hnext=h->next;
6692  h->next=NULL;
6693  iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
6694  h->next=hnext;
6695  p=(poly)tmp.data;
6696  if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
6697  }
6698  else
6699  {
6700  idDelete(&id);
6701  return TRUE;
6702  }
6703  id->m[i]=p;
6704  i++;
6705  h=h->next;
6706  }
6707  id->rank=rank;
6708  res->data=(char *)id;
6709  return FALSE;
6710 }
int exprlist_length(leftv v)
Definition: ipshell.cc:544

◆ jjIDEAL_R()

static BOOLEAN jjIDEAL_R ( leftv  res,
leftv  v 
)
static

Definition at line 4132 of file iparith.cc.

4133 {
4134  if (currRing!=NULL)
4135  {
4136  ring q=(ring)v->Data();
4137  if (rSamePolyRep(currRing, q))
4138  {
4139  if (q->qideal==NULL)
4140  res->data=(char *)idInit(1,1);
4141  else
4142  res->data=(char *)idCopy(q->qideal);
4143  return FALSE;
4144  }
4145  }
4146  WerrorS("can only get ideal from identical qring");
4147  return TRUE;
4148 }
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:1668

◆ jjidElem()

static BOOLEAN jjidElem ( leftv  res,
leftv  v 
)
static

Definition at line 5195 of file iparith.cc.

5196 {
5197  res->data = (char *)(long)idElem((ideal)v->Data());
5198  return FALSE;
5199 }
int idElem(const ideal F)
count non-zero elements

◆ jjidFreeModule()

static BOOLEAN jjidFreeModule ( leftv  res,
leftv  v 
)
static

Definition at line 5200 of file iparith.cc.

5201 {
5202  res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5203  return FALSE;
5204 }
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 5220 of file iparith.cc.

5221 {
5222  res->data = (char *)id_Head((ideal)v->Data(),currRing);
5223  setFlag(res,FLAG_STD);
5224  return FALSE;
5225 }

◆ jjidMaxIdeal()

static BOOLEAN jjidMaxIdeal ( leftv  res,
leftv  v 
)
static

Definition at line 4098 of file iparith.cc.

4099 {
4100  res->data = (char *)idMaxIdeal((int)(long)v->Data());
4101  setFlag(res,FLAG_STD);
4102  return FALSE;
4103 }
#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 5226 of file iparith.cc.

5227 {
5228  res->data = (char *)idMinBase((ideal)v->Data());
5229  return FALSE;
5230 }
ideal idMinBase(ideal h1)
Definition: ideals.cc:49

◆ jjidTransp()

static BOOLEAN jjidTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5278 of file iparith.cc.

5279 {
5280  res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5281  return FALSE;
5282 }
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

static BOOLEAN jjidVec2Ideal ( leftv  res,
leftv  v 
)
static

Definition at line 5205 of file iparith.cc.

5206 {
5207  res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5208  return FALSE;
5209 }
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

static BOOLEAN jjIm2Iv ( leftv  res,
leftv  v 
)
static

Definition at line 4149 of file iparith.cc.

4150 {
4151  intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4152  iv->makeVector();
4153  res->data = iv;
4154  return FALSE;
4155 }
void makeVector()
Definition: intvec.h:100
@ INTMAT_CMD
Definition: grammar.cc:279

◆ jjIMPART()

static BOOLEAN jjIMPART ( leftv  res,
leftv  v 
)
static

Definition at line 4156 of file iparith.cc.

4157 {
4158  res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4159  return FALSE;
4160 }
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition: coeffs.h:824

◆ jjINDEPSET()

static BOOLEAN jjINDEPSET ( leftv  res,
leftv  v 
)
static

Definition at line 4161 of file iparith.cc.

4162 {
4163  assumeStdFlag(v);
4164  res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4165  return FALSE;
4166 }
intvec * scIndIntvec(ideal S, ideal Q)
Definition: hdegree.cc:212

◆ jjINDEPSET2()

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

Definition at line 2373 of file iparith.cc.

2374 {
2375  assumeStdFlag(u);
2376  res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2377  currRing->qideal);
2378  return FALSE;
2379 }
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition: ipshell.cc:1022

◆ jjINDEX_I()

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

Definition at line 1297 of file iparith.cc.

1298 {
1299  res->rtyp=u->rtyp; u->rtyp=0;
1300  res->data=u->data; u->data=NULL;
1301  res->name=u->name; u->name=NULL;
1302  res->e=u->e; u->e=NULL;
1303  if (res->e==NULL) res->e=jjMakeSub(v);
1304  else
1305  {
1306  Subexpr sh=res->e;
1307  while (sh->next != NULL) sh=sh->next;
1308  sh->next=jjMakeSub(v);
1309  }
1310  if (u->next!=NULL)
1311  {
1313  BOOLEAN bo=iiExprArith2(rn,u->next,iiOp,v);
1314  res->next=rn;
1315  return bo;
1316  }
1317  return FALSE;
1318 }

◆ jjINDEX_IV()

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

Definition at line 1319 of file iparith.cc.

1320 {
1321  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
1322  {
1323  WerrorS("indexed object must have a name");
1324  return TRUE;
1325  }
1326  intvec * iv=(intvec *)v->Data();
1327  leftv p=NULL;
1328  int i;
1329  sleftv t;
1330  memset(&t,0,sizeof(t));
1331  t.rtyp=INT_CMD;
1332  for (i=0;i<iv->length(); i++)
1333  {
1334  t.data=(char *)((long)(*iv)[i]);
1335  if (p==NULL)
1336  {
1337  p=res;
1338  }
1339  else
1340  {
1341  p->next=(leftv)omAlloc0Bin(sleftv_bin);
1342  p=p->next;
1343  }
1344  p->rtyp=IDHDL;
1345  p->data=u->data;
1346  p->name=u->name;
1347  p->flag=u->flag;
1348  p->e=jjMakeSub(&t);
1349  }
1350  u->rtyp=0;
1351  u->data=NULL;
1352  u->name=NULL;
1353  return FALSE;
1354 }
BITSET flag
Definition: subexpr.h:90

◆ jjINDEX_P()

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

Definition at line 1355 of file iparith.cc.

1356 {
1357  poly p=(poly)u->Data();
1358  int i=(int)(long)v->Data();
1359  int j=0;
1360  while (p!=NULL)
1361  {
1362  j++;
1363  if (j==i)
1364  {
1365  res->data=(char *)pHead(p);
1366  return FALSE;
1367  }
1368  pIter(p);
1369  }
1370  return FALSE;
1371 }
#define pIter(p)
Definition: monomials.h:44

◆ jjINDEX_P_IV()

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

Definition at line 1372 of file iparith.cc.

1373 {
1374  poly p=(poly)u->Data();
1375  poly r=NULL;
1376  intvec *iv=(intvec *)v->CopyD(INTVEC_CMD);
1377  int i;
1378  int sum=0;
1379  for(i=iv->length()-1;i>=0;i--)
1380  sum+=(*iv)[i];
1381  int j=0;
1382  while ((p!=NULL) && (sum>0))
1383  {
1384  j++;
1385  for(i=iv->length()-1;i>=0;i--)
1386  {
1387  if (j==(*iv)[i])
1388  {
1389  r=pAdd(r,pHead(p));
1390  sum-=j;
1391  (*iv)[i]=0;
1392  break;
1393  }
1394  }
1395  pIter(p);
1396  }
1397  delete iv;
1398  res->data=(char *)r;
1399  return FALSE;
1400 }
#define pAdd(p, q)
Definition: polys.h:190

◆ jjINDEX_V()

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

Definition at line 1401 of file iparith.cc.

1402 {
1403  poly p=(poly)u->CopyD(VECTOR_CMD);
1404  poly r=p; // pointer to the beginning of component i
1405  poly o=NULL;
1406  int i=(int)(long)v->Data();
1407  while (p!=NULL)
1408  {
1409  if (pGetComp(p)!=i)
1410  {
1411  if (r==p) r=pNext(p);
1412  if (o!=NULL)
1413  {
1414  if (pNext(o)!=NULL) pLmDelete(&pNext(o));
1415  p=pNext(o);
1416  }
1417  else
1418  pLmDelete(&p);
1419  }
1420  else
1421  {
1422  pSetComp(p, 0);
1423  p_SetmComp(p, currRing);
1424  o=p;
1425  p=pNext(o);
1426  }
1427  }
1428  res->data=(char *)r;
1429  return FALSE;
1430 }
#define p_SetmComp
Definition: p_polys.h:244

◆ jjINDEX_V_IV()

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

Definition at line 1431 of file iparith.cc.

1432 {
1433  poly p=(poly)u->CopyD(VECTOR_CMD);
1434  if (p!=NULL)
1435  {
1436  poly r=pOne();
1437  poly hp=r;
1438  intvec *iv=(intvec *)v->Data();
1439  int i;
1440  loop
1441  {
1442  for(i=0;i<iv->length();i++)
1443  {
1444  if (((int)pGetComp(p))==(*iv)[i])
1445  {
1446  poly h;
1447  pSplit(p,&h);
1448  pNext(hp)=p;
1449  p=h;
1450  pIter(hp);
1451  break;
1452  }
1453  }
1454  if (p==NULL) break;
1455  if (i==iv->length())
1456  {
1457  pLmDelete(&p);
1458  if (p==NULL) break;
1459  }
1460  }
1461  pLmDelete(&r);
1462  res->data=(char *)r;
1463  }
1464  return FALSE;
1465 }
#define pSplit(p, r)
Definition: polys.h:251

◆ jjINTERPOLATION()

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

Definition at line 2386 of file iparith.cc.

2387 {
2388  const lists L = (lists)l->Data();
2389  const int n = L->nr; assume (n >= 0);
2390  std::vector<ideal> V(n + 1);
2391 
2392  for(int i = n; i >= 0; i--) V[i] = (ideal)(L->m[i].Data());
2393 
2394  res->data=interpolation(V, (intvec*)v->Data());
2395  setFlag(res,FLAG_STD);
2396  return errorreported;
2397 }
ideal interpolation(const std::vector< ideal > &L, intvec *v)

◆ jjINTERRED()

static BOOLEAN jjINTERRED ( leftv  res,
leftv  v 
)
static

Definition at line 4167 of file iparith.cc.

4168 {
4169  ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4170 #ifdef HAVE_RINGS
4172  WarnS("interred: this command is experimental over the integers");
4173 #endif
4174  if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4175  res->data = result;
4176  return FALSE;
4177 }
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3387
#define TEST_OPT_PROT
Definition: options.h:102
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:57

◆ jjINTERSEC3S()

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

Definition at line 5794 of file iparith.cc.

5795 {
5796  ideal I=(ideal)u->Data();
5797  GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
5798  res->data=(char *)idSect(I,(ideal)v->Data(),alg);
5800  return FALSE;
5801 }
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition: ideals.cc:201
#define TEST_OPT_RETURN_SB
Definition: options.h:111

◆ jjINTERSECT()

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

Definition at line 2380 of file iparith.cc.

2381 {
2382  res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2384  return FALSE;
2385 }

◆ jjINTERSECT3()

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

Definition at line 5781 of file iparith.cc.

5782 {
5783  ideal I1=(ideal)u->Data();
5784  ideal I2=(ideal)v->Data();
5785  ideal I3=(ideal)w->Data();
5786  resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
5787  r[0]=I1;
5788  r[1]=I2;
5789  r[2]=I3;
5790  res->data=(char *)idMultSect(r,3);
5791  omFreeSize((ADDRESS)r,3*sizeof(ideal));
5792  return FALSE;
5793 }
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition: ideals.cc:421
ideal * resolvente
Definition: ideals.h:18

◆ jjINTERSECT_PL()

static BOOLEAN jjINTERSECT_PL ( leftv  res,
leftv  v 
)
static

Definition at line 6840 of file iparith.cc.

6841 {
6842  leftv h=v;
6843  int l=v->listLength();
6844  resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
6845  BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
6846  int t=0;
6847  // try to convert to IDEAL_CMD
6848  while (h!=NULL)
6849  {
6850  if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
6851  {
6852  t=IDEAL_CMD;
6853  }
6854  else break;
6855  h=h->next;
6856  }
6857  // if failure, try MODUL_CMD
6858  if (t==0)
6859  {
6860  h=v;
6861  while (h!=NULL)
6862  {
6863  if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
6864  {
6865  t=MODUL_CMD;
6866  }
6867  else break;
6868  h=h->next;
6869  }
6870  }
6871  // check for success in converting
6872  if (t==0)
6873  {
6874  WerrorS("cannot convert to ideal or module");
6875  return TRUE;
6876  }
6877  // call idMultSect
6878  h=v;
6879  int i=0;
6880  sleftv tmp;
6881  while (h!=NULL)
6882  {
6883  if (h->Typ()==t)
6884  {
6885  r[i]=(ideal)h->Data(); /*no copy*/
6886  h=h->next;
6887  }
6888  else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
6889  {
6890  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
6891  omFreeSize((ADDRESS)r,l*sizeof(ideal));
6892  Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
6893  return TRUE;
6894  }
6895  else
6896  {
6897  r[i]=(ideal)tmp.Data(); /*now it's a copy*/
6898  copied[i]=TRUE;
6899  h=tmp.next;
6900  }
6901  i++;
6902  }
6903  res->rtyp=t;
6904  res->data=(char *)idMultSect(r,i);
6905  while(i>0)
6906  {
6907  i--;
6908  if (copied[i]) idDelete(&(r[i]));
6909  }
6910  omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
6911  omFreeSize((ADDRESS)r,l*sizeof(ideal));
6912  return FALSE;
6913 }

◆ jjINTMAT3()

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

Definition at line 5767 of file iparith.cc.

5768 {
5769  intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
5770  intvec* arg = (intvec*) u->Data();
5771  int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
5772 
5773  for (i=0; i<n; i++)
5774  {
5775  (*im)[i] = (*arg)[i];
5776  }
5777 
5778  res->data = (char *)im;
5779  return FALSE;
5780 }

◆ jjINTVEC_PL()

static BOOLEAN jjINTVEC_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7076 of file iparith.cc.

7077 {
7078  int i=0;
7079  leftv h=v;
7080  if (h!=NULL) i=exprlist_length(h);
7081  intvec *iv=new intvec(i);
7082  i=0;
7083  while (h!=NULL)
7084  {
7085  if(h->Typ()==INT_CMD)
7086  {
7087  (*iv)[i]=(int)(long)h->Data();
7088  }
7089  else if (h->Typ()==INTVEC_CMD)
7090  {
7091  intvec *ivv=(intvec*)h->Data();
7092  for(int j=0;j<ivv->length();j++,i++)
7093  {
7094  (*iv)[i]=(*ivv)[j];
7095  }
7096  i--;
7097  }
7098  else
7099  {
7100  delete iv;
7101  return TRUE;
7102  }
7103  i++;
7104  h=h->next;
7105  }
7106  res->data=(char *)iv;
7107  return FALSE;
7108 }

◆ jjIS_RINGVAR0()

static BOOLEAN jjIS_RINGVAR0 ( leftv  res,
leftv   
)
static

Definition at line 4189 of file iparith.cc.

4190 {
4191  res->data = (char *)0;
4192  return FALSE;
4193 }

◆ jjIS_RINGVAR_P()

static BOOLEAN jjIS_RINGVAR_P ( leftv  res,
leftv  v 
)
static

Definition at line 4178 of file iparith.cc.

4179 {
4180  res->data = (char *)(long)pVar((poly)v->Data());
4181  return FALSE;
4182 }

◆ jjIS_RINGVAR_S()

static BOOLEAN jjIS_RINGVAR_S ( leftv  res,
leftv  v 
)
static

Definition at line 4183 of file iparith.cc.

4184 {
4185  res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4186  currRing->N)+1);
4187  return FALSE;
4188 }
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:213

◆ jjJACOB_M()

static BOOLEAN jjJACOB_M ( leftv  res,
leftv  a 
)
static

Definition at line 4225 of file iparith.cc.

4226 {
4227  ideal id = (ideal)a->Data();
4228  id = id_Transp(id,currRing);
4229  int W = IDELEMS(id);
4230 
4231  ideal result = idInit(W * currRing->N, id->rank);
4232  poly *p = result->m;
4233 
4234  for( int v = 1; v <= currRing->N; v++ )
4235  {
4236  poly* q = id->m;
4237  for( int i = 0; i < W; i++, p++, q++ )
4238  *p = pDiff( *q, v );
4239  }
4240  idDelete(&id);
4241 
4242  res->data = (char *)result;
4243  return FALSE;
4244 }

◆ jjJACOB_P()

static BOOLEAN jjJACOB_P ( leftv  res,
leftv  v 
)
static

Definition at line 4194 of file iparith.cc.

4195 {
4196  ideal i=idInit(currRing->N,1);
4197  int k;
4198  poly p=(poly)(v->Data());
4199  for (k=currRing->N;k>0;k--)
4200  {
4201  i->m[k-1]=pDiff(p,k);
4202  }
4203  res->data = (char *)i;
4204  return FALSE;
4205 }

◆ jjJanetBasis()

static BOOLEAN jjJanetBasis ( leftv  res,
leftv  v 
)
static

Definition at line 2404 of file iparith.cc.

2405 {
2406  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2407  return jjStdJanetBasis(res,v,0);
2408 }
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 2398 of file iparith.cc.

2399 {
2400  extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2401  return jjStdJanetBasis(res,u,(int)(long)v->Data());
2402 }

◆ jjJET4()

static BOOLEAN jjJET4 ( leftv  res,
leftv  u 
)
static

Definition at line 7109 of file iparith.cc.

7110 {
7111  const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7112  const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7113  const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7114  const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7115  leftv u1=u;
7116  leftv u2=u1->next;
7117  leftv u3=u2->next;
7118  leftv u4=u3->next;
7119  if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
7120  {
7121  if(!pIsUnit((poly)u2->Data()))
7122  {
7123  WerrorS("2nd argument must be a unit");
7124  return TRUE;
7125  }
7126  res->rtyp=u1->Typ();
7127  res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
7128  pCopy((poly)u2->Data()),(intvec*)u4->Data());
7129  return FALSE;
7130  }
7131  else
7132  if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
7133  {
7134  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7135  {
7136  WerrorS("2nd argument must be a diagonal matrix of units");
7137  return TRUE;
7138  }
7139  res->rtyp=u1->Typ();
7140  res->data=(char*)idSeries(
7141  (int)(long)u3->Data(),
7142  idCopy((ideal)u1->Data()),
7143  mp_Copy((matrix)u2->Data(), currRing),
7144  (intvec*)u4->Data()
7145  );
7146  return FALSE;
7147  }
7148  else
7149  {
7150  Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
7151  Tok2Cmdname(iiOp));
7152  return TRUE;
7153  }
7154 }
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition: ideals.cc:2152
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition: matpol.cc:716
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition: polys.h:227
#define pSeries(n, p, u, w)
Definition: polys.h:358

◆ jjJET_ID()

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

Definition at line 2414 of file iparith.cc.

2415 {
2416  res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2417  return FALSE;
2418 }
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 5819 of file iparith.cc.

5820 {
5821  res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
5822  (intvec *)w->Data(),currRing);
5823  return FALSE;
5824 }
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 5825 of file iparith.cc.

5826 {
5827  if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
5828  {
5829  WerrorS("2nd argument must be a diagonal matrix of units");
5830  return TRUE;
5831  }
5832  res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
5833  (matrix)v->CopyD());
5834  return FALSE;
5835 }

◆ jjJET_P()

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

Definition at line 2409 of file iparith.cc.

2410 {
2411  res->data = (char *)pJet((poly)u->CopyD(), (int)(long)v->Data());
2412  return FALSE;
2413 }
#define pJet(p, m)
Definition: polys.h:354

◆ jjJET_P_IV()

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

Definition at line 5802 of file iparith.cc.

5803 {
5804  short *iw=iv2array((intvec *)w->Data(),currRing);
5805  res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
5806  omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(short) );
5807  return FALSE;
5808 }
#define ppJetW(p, m, iv)
Definition: polys.h:355

◆ jjJET_P_P()

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

Definition at line 5809 of file iparith.cc.

5810 {
5811  if (!pIsUnit((poly)v->Data()))
5812  {
5813  WerrorS("2nd argument must be a unit");
5814  return TRUE;
5815  }
5816  res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
5817  return FALSE;
5818 }
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition: p_polys.cc:4382

◆ jjKBASE()

static BOOLEAN jjKBASE ( leftv  res,
leftv  v 
)
static

Definition at line 4247 of file iparith.cc.

4248 {
4249  assumeStdFlag(v);
4250  res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4251  return FALSE;
4252 }
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition: hdegree.cc:1353

◆ jjKBASE2()

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

Definition at line 2419 of file iparith.cc.

2420 {
2421  assumeStdFlag(u);
2422  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2423  res->data = (char *)scKBase((int)(long)v->Data(),
2424  (ideal)(u->Data()),currRing->qideal, w_u);
2425  if (w_u!=NULL)
2426  {
2427  atSet(res,omStrDup("isHomog"),ivCopy(w_u),INTVEC_CMD);
2428  }
2429  return FALSE;
2430 }
intvec * ivCopy(const intvec *o)
Definition: intvec.h:133

◆ jjKERNEL()

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

Definition at line 2432 of file iparith.cc.

2433 {
2434  return jjPREIMAGE(res,u,v,NULL);
2435 }
static BOOLEAN jjPREIMAGE(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6045

◆ jjKLAMMER()

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

Definition at line 1467 of file iparith.cc.

1468 {
1469  if(u->name==NULL) return TRUE;
1470  char * nn = (char *)omAlloc(strlen(u->name) + 14);
1471  sprintf(nn,"%s(%d)",u->name,(int)(long)v->Data());
1472  omFree((ADDRESS)u->name);
1473  u->name=NULL;
1474  char *n=omStrDup(nn);
1475  omFree((ADDRESS)nn);
1476  syMake(res,n);
1477  if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1478  return FALSE;
1479 }
static BOOLEAN jjKLAMMER_rest(leftv res, leftv u, leftv v)
Definition: iparith.cc:1508

◆ jjKLAMMER_IV()

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

Definition at line 1480 of file iparith.cc.

1481 {
1482  intvec * iv=(intvec *)v->Data();
1483  leftv p=NULL;
1484  int i;
1485  long slen = strlen(u->name) + 14;
1486  char *n = (char*) omAlloc(slen);
1487 
1488  for (i=0;i<iv->length(); i++)
1489  {
1490  if (p==NULL)
1491  {
1492  p=res;
1493  }
1494  else
1495  {
1496  p->next=(leftv)omAlloc0Bin(sleftv_bin);
1497  p=p->next;
1498  }
1499  sprintf(n,"%s(%d)",u->name,(*iv)[i]);
1500  syMake(p,omStrDup(n));
1501  }
1502  omFree((ADDRESS)u->name);
1503  u->name = NULL;
1504  omFreeSize(n, slen);
1505  if (u->next!=NULL) return jjKLAMMER_rest(res,u->next,v);
1506  return FALSE;
1507 }

◆ jjKLAMMER_PL()

static BOOLEAN jjKLAMMER_PL ( leftv  res,
leftv  u 
)
static

Definition at line 7192 of file iparith.cc.

7193 {
7194  if ((yyInRingConstruction)
7195  && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
7196  {
7197  memcpy(res,u,sizeof(sleftv));
7198  memset(u,0,sizeof(sleftv));
7199  return FALSE;
7200  }
7201  leftv v=u->next;
7202  BOOLEAN b;
7203  if(v==NULL) // p()
7204  b=iiExprArith1(res,u,iiOp);
7205  else if ((v->next==NULL) // p(1)
7206  || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
7207  {
7208  u->next=NULL;
7209  b=iiExprArith2(res,u,iiOp,v);
7210  u->next=v;
7211  }
7212  else // p(1,2), p undefined
7213  {
7214  if (v->Typ()!=INT_CMD)
7215  {
7216  Werror("`int` expected while building `%s(`",u->name);
7217  return TRUE;
7218  }
7219  int l=u->listLength();
7220  char * nn = (char *)omAlloc(strlen(u->name) + 12*l);
7221  sprintf(nn,"%s(%d",u->name,(int)(long)v->Data());
7222  char *s=nn;
7223  do
7224  {
7225  while (*s!='\0') s++;
7226  v=v->next;
7227  if (v->Typ()!=INT_CMD)
7228  {
7229  Werror("`int` expected while building `%s`",nn);
7230  omFree((ADDRESS)nn);
7231  return TRUE;
7232  }
7233  sprintf(s,",%d",(int)(long)v->Data());
7234  } while (v->next!=NULL);
7235  while (*s!='\0') s++;
7236  nn=strcat(nn,")");
7237  char *n=omStrDup(nn);
7238  omFree((ADDRESS)nn);
7239  syMake(res,n);
7240  b=FALSE;
7241  }
7242  return b;
7243 }
BOOLEAN yyInRingConstruction
Definition: grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1508 of file iparith.cc.

1509 {
1511  memset(tmp,0,sizeof(sleftv));
1512  BOOLEAN b;
1513  if (v->Typ()==INTVEC_CMD)
1514  b=jjKLAMMER_IV(tmp,u,v);
1515  else
1516  b=jjKLAMMER(tmp,u,v);
1517  if (b)
1518  {
1519  omFreeBin(tmp,sleftv_bin);
1520  return TRUE;
1521  }
1522  leftv h=res;
1523  while (h->next!=NULL) h=h->next;
1524  h->next=tmp;
1525  return FALSE;
1526 }
static BOOLEAN jjKLAMMER_IV(leftv res, leftv u, leftv v)
Definition: iparith.cc:1480
static BOOLEAN jjKLAMMER(leftv res, leftv u, leftv v)
Definition: iparith.cc:1467

◆ jjKoszul()

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

Definition at line 2436 of file iparith.cc.

2437 {
2438  return mpKoszul(res, u,v,NULL);
2439 }
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition: ipshell.cc:3031

◆ jjKoszul_Id()

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

Definition at line 2440 of file iparith.cc.

2441 {
2442  sleftv h;
2443  memset(&h,0,sizeof(sleftv));
2444  h.rtyp=INT_CMD;
2445  h.data=(void *)(long)IDELEMS((ideal)v->Data());
2446  return mpKoszul(res, u, &h, v);
2447 }

◆ jjL2R()

static BOOLEAN jjL2R ( leftv  res,
leftv  v 
)
static

Definition at line 4253 of file iparith.cc.

4254 {
4255  res->data=(char *)syConvList((lists)v->Data());
4256  if (res->data != NULL)
4257  return FALSE;
4258  else
4259  return TRUE;
4260 }
syStrategy syConvList(lists li)
Definition: ipshell.cc:3194

◆ jjLE_BI()

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

Definition at line 1122 of file iparith.cc.

1123 {
1124  return jjGE_BI(res,v,u);
1125 }
static BOOLEAN jjGE_BI(leftv res, leftv u, leftv v)
Definition: iparith.cc:1087

◆ jjLE_I()

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

Definition at line 1126 of file iparith.cc.

1127 {
1128  res->data = (char *)(long)((int)((long)u->Data()) <= (int)((long)v->Data()));
1129  return FALSE;
1130 }

◆ jjLE_N()

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

Definition at line 1131 of file iparith.cc.

1132 {
1133  return jjGE_N(res,v,u);
1134 }
static BOOLEAN jjGE_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1099

◆ jjLEADCOEF()

static BOOLEAN jjLEADCOEF ( leftv  res,
leftv  v 
)
static

Definition at line 4261 of file iparith.cc.

4262 {
4263  poly p=(poly)v->Data();
4264  if (p==NULL)
4265  {
4266  res->data=(char *)nInit(0);
4267  }
4268  else
4269  {
4270  res->data=(char *)nCopy(pGetCoeff(p));
4271  }
4272  return FALSE;
4273 }

◆ jjLEADEXP()

static BOOLEAN jjLEADEXP ( leftv  res,
leftv  v 
)
static

Definition at line 4274 of file iparith.cc.

4275 {
4276  poly p=(poly)v->Data();
4277  int s=currRing->N;
4278  if (v->Typ()==VECTOR_CMD) s++;
4279  intvec *iv=new intvec(s);
4280  if (p!=NULL)
4281  {
4282  for(int i = currRing->N;i;i--)
4283  {
4284  (*iv)[i-1]=pGetExp(p,i);
4285  }
4286  if (s!=currRing->N)
4287  (*iv)[currRing->N]=pGetComp(p);
4288  }
4289  res->data=(char *)iv;
4290  return FALSE;
4291 }
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41

◆ jjLEADMONOM()

static BOOLEAN jjLEADMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 4292 of file iparith.cc.

4293 {
4294  poly p=(poly)v->Data();
4295  if (p == NULL)
4296  {
4297  res->data = (char*) NULL;
4298  }
4299  else
4300  {
4301  poly lm = pLmInit(p);
4302  pSetCoeff0(lm, nInit(1));
4303  res->data = (char*) lm;
4304  }
4305  return FALSE;
4306 }
#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 2448 of file iparith.cc.

2449 {
2450  int ul= IDELEMS((ideal)u->Data());
2451  int vl= IDELEMS((ideal)v->Data());
2452  ideal m = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,
2453  hasFlag(u,FLAG_STD));
2454  if (m==NULL) return TRUE;
2455  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
2456  return FALSE;
2457 }

◆ jjLIFT3()

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

Definition at line 6344 of file iparith.cc.

6345 {
6346  if (w->rtyp!=IDHDL) return TRUE;
6347  int ul= IDELEMS((ideal)u->Data());
6348  int vl= IDELEMS((ideal)v->Data());
6349  ideal m
6350  = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
6351  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
6352  if (m==NULL) return TRUE;
6353  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
6354  return FALSE;
6355 }
#define IDMATRIX(a)
Definition: ipid.h:129

◆ jjLIFT_4()

static BOOLEAN jjLIFT_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7244 of file iparith.cc.

7245 {
7246  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7247  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7248  leftv u=U;
7249  leftv v=u->next;
7250  leftv w=v->next;
7251  leftv u4=w->next;
7252  if (w->rtyp!=IDHDL) return TRUE;
7253  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7254  {
7255  // see jjLIFT3
7256  ideal I=(ideal)u->Data();
7257  int ul= IDELEMS(I /*(ideal)u->Data()*/);
7258  int vl= IDELEMS((ideal)v->Data());
7259  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7260  ideal m
7261  = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7262  FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
7263  if (m==NULL) return TRUE;
7264  res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7265  return FALSE;
7266  }
7267  else
7268  {
7269  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7270  "or (`module`,`module`,`matrix`,`string`)expected",
7271  Tok2Cmdname(iiOp));
7272  return TRUE;
7273  }
7274 }

◆ jjLIFTSTD()

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

Definition at line 2458 of file iparith.cc.

2459 {
2460  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
2461  idhdl h=(idhdl)v->data;
2462  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
2463  res->data = (char *)idLiftStd((ideal)u->Data(),
2464  &(h->data.umatrix),testHomog);
2465  setFlag(res,FLAG_STD); v->flag=0;
2466  return FALSE;
2467 }
ideal idLiftStd(ideal h1, matrix *ma, tHomog hi, ideal *syz, GbVariant alg)
Definition: ideals.cc:925

◆ jjLIFTSTD3()

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

Definition at line 6356 of file iparith.cc.

6357 {
6358  if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
6359  if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
6360  idhdl hv=(idhdl)v->data;
6361  idhdl hw=(idhdl)w->data;
6362  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
6363  res->data = (char *)idLiftStd((ideal)u->Data(),
6364  &(hv->data.umatrix),testHomog,
6365  &(hw->data.uideal));
6366  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
6367  return FALSE;
6368 }

◆ jjLIFTSTD_4()

static BOOLEAN jjLIFTSTD_4 ( leftv  res,
leftv  U 
)
static

Definition at line 7275 of file iparith.cc.

7276 {
7277  const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
7278  const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
7279  leftv u=U;
7280  leftv v=u->next;
7281  leftv w=v->next;
7282  leftv u4=w->next;
7283  if (v->rtyp!=IDHDL) return TRUE;
7284  if (w->rtyp!=IDHDL) return TRUE;
7285  if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
7286  {
7287  // see jjLIFTSTD3
7288  ideal I=(ideal)u->Data();
7289  idhdl hv=(idhdl)v->data;
7290  idhdl hw=(idhdl)w->data;
7291  GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
7292  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7293  res->data = (char *)idLiftStd((ideal)u->Data(),
7294  &(hv->data.umatrix),testHomog,
7295  &(hw->data.uideal),alg);
7296  setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7297  return FALSE;
7298  }
7299  else
7300  {
7301  Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
7302  "or (`module`,`module`,`matrix`,`string`)expected",
7303  Tok2Cmdname(iiOp));
7304  return TRUE;
7305  }
7306 }

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7307 of file iparith.cc.

7308 {
7309  int sl=0;
7310  if (v!=NULL) sl = v->listLength();
7311  lists L;
7312  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7313  {
7314  int add_row_shift = 0;
7315  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7316  if (weights!=NULL) add_row_shift=weights->min_in();
7317  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7318  }
7319  else
7320  {
7322  leftv h=NULL;
7323  int i;
7324  int rt;
7325 
7326  L->Init(sl);
7327  for (i=0;i<sl;i++)
7328  {
7329  if (h!=NULL)
7330  { /* e.g. not in the first step:
7331  * h is the pointer to the old sleftv,
7332  * v is the pointer to the next sleftv
7333  * (in this moment) */
7334  h->next=v;
7335  }
7336  h=v;
7337  v=v->next;
7338  h->next=NULL;
7339  rt=h->Typ();
7340  if (rt==0)
7341  {
7342  L->Clean();
7343  Werror("`%s` is undefined",h->Fullname());
7344  return TRUE;
7345  }
7346  if (rt==RING_CMD)
7347  {
7348  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7349  ((ring)L->m[i].data)->ref++;
7350  }
7351  else
7352  L->m[i].Copy(h);
7353  }
7354  }
7355  res->data=(char *)L;
7356  return FALSE;
7357 }
int min_in()
Definition: intvec.h:119
@ RESOLUTION_CMD
Definition: grammar.cc:289
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3122

◆ jjLISTRING()

static BOOLEAN jjLISTRING ( leftv  res,
leftv  v 
)
static

Definition at line 4311 of file iparith.cc.

4312 {
4313  lists l=(lists)v->Data();
4314  long mm=(long)atGet(v,"maxExp",INT_CMD);
4315  if (mm==0) mm=0x7fff;
4316  ring r=rCompose(l,TRUE,mm);
4317  res->data=(char *)r;
4318  return (r==NULL);
4319 }
ring rCompose(const lists L, const BOOLEAN check_comp=TRUE, const long bitmask=0x7fff)
Definition: ipshell.cc:2743

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport 
)

load lib/module given in v

Definition at line 5096 of file iparith.cc.

5097 {
5098  char libnamebuf[1024];
5100 
5101 #ifdef HAVE_DYNAMIC_LOADING
5102  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5103 #endif /* HAVE_DYNAMIC_LOADING */
5104  switch(LT)
5105  {
5106  default:
5107  case LT_NONE:
5108  Werror("%s: unknown type", s);
5109  break;
5110  case LT_NOTFOUND:
5111  Werror("cannot open %s", s);
5112  break;
5113 
5114  case LT_SINGULAR:
5115  {
5116  char *plib = iiConvName(s);
5117  idhdl pl = IDROOT->get(plib,0);
5118  if (pl==NULL)
5119  {
5120  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5121  IDPACKAGE(pl)->language = LANG_SINGULAR;
5122  IDPACKAGE(pl)->libname=omStrDup(s);
5123  }
5124  else if (IDTYP(pl)!=PACKAGE_CMD)
5125  {
5126  Werror("can not create package `%s`",plib);
5127  omFree(plib);
5128  return TRUE;
5129  }
5130  else /* package */
5131  {
5132  package pa=IDPACKAGE(pl);
5133  if ((pa->language==LANG_C)
5134  || (pa->language==LANG_MIX))
5135  {
5136  Werror("can not create package `%s` - binaries exists",plib);
5137  omfree(plib);
5138  return TRUE;
5139  }
5140  }
5141  omFree(plib);
5142  package savepack=currPack;
5143  currPack=IDPACKAGE(pl);
5144  IDPACKAGE(pl)->loaded=TRUE;
5145  char libnamebuf[1024];
5146  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5147  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5148  currPack=savepack;
5149  IDPACKAGE(pl)->loaded=(!bo);
5150  return bo;
5151  }
5152  case LT_BUILTIN:
5153  SModulFunc_t iiGetBuiltinModInit(const char*);
5154  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5155  case LT_MACH_O:
5156  case LT_ELF:
5157  case LT_HPUX:
5158 #ifdef HAVE_DYNAMIC_LOADING
5159  return load_modules(s, libnamebuf, autoexport);
5160 #else /* HAVE_DYNAMIC_LOADING */
5161  WerrorS("Dynamic modules are not supported by this version of Singular");
5162  break;
5163 #endif /* HAVE_DYNAMIC_LOADING */
5164  }
5165  return TRUE;
5166 }
CanonicalForm fp
Definition: cfModGcd.cc:4043
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:257
package basePack
Definition: ipid.cc:60
package currPack
Definition: ipid.cc:59
#define IDROOT
Definition: ipid.h:18
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1197
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:80
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:915
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1091
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:751
char libnamebuf[1024]
Definition: libparse.cc:1096
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:22
lib_types
Definition: mod_raw.h:16
@ LT_MACH_O
Definition: mod_raw.h:16
@ LT_HPUX
Definition: mod_raw.h:16
@ LT_SINGULAR
Definition: mod_raw.h:16
@ LT_BUILTIN
Definition: mod_raw.h:16
@ LT_ELF
Definition: mod_raw.h:16
@ LT_NONE
Definition: mod_raw.h:16
@ LT_NOTFOUND
Definition: mod_raw.h:16
#define omfree(addr)
Definition: omAllocDecl.h:237
@ LANG_SINGULAR
Definition: subexpr.h:22
@ LANG_MIX
Definition: subexpr.h:22
@ LANG_C
Definition: subexpr.h:22

◆ jjLOAD1()

static BOOLEAN jjLOAD1 ( leftv  ,
leftv  v 
)
static

Definition at line 4307 of file iparith.cc.

4308 {
4309  return jjLOAD((char*)v->Data(),FALSE);
4310 }
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5096

◆ jjLOAD2()

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

Definition at line 2468 of file iparith.cc.

2469 {
2470  return jjLOAD((char*)v->Data(),TRUE);
2471 }

◆ jjLOAD_E()

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

Definition at line 2472 of file iparith.cc.

2473 {
2474  char * s=(char *)u->Data();
2475  if(strcmp(s, "with")==0)
2476  return jjLOAD((char*)v->Data(), TRUE);
2477  if (strcmp(s,"try")==0)
2478  return jjLOAD_TRY((char*)v->Data());
2479  WerrorS("invalid second argument");
2480  WerrorS("load(\"libname\" [,option]);");
2481  return TRUE;
2482 }
BOOLEAN jjLOAD_TRY(const char *s)
Definition: iparith.cc:5172

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5172 of file iparith.cc.

5173 {
5174  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5177  BOOLEAN bo=jjLOAD(s,TRUE);
5178  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5179  Print("loading of >%s< failed\n",s);
5180  WerrorS_callback=WerrorS_save;
5181  errorreported=0;
5182  return FALSE;
5183 }
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5168
static int WerrorS_dummy_cnt
Definition: iparith.cc:5167

◆ jjLT_BI()

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

Definition at line 1135 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1139 of file iparith.cc.

1140 {
1141  res->data = (char *)(long)((int)((long)u->Data()) < (int)((long)v->Data()));
1142  return FALSE;
1143 }

◆ jjLT_N()

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

Definition at line 1144 of file iparith.cc.

1145 {
1146  return jjGT_N(res,v,u);
1147 }
static BOOLEAN jjGT_N(leftv res, leftv u, leftv v)
Definition: iparith.cc:1117

◆ jjLU_DECOMP()

static BOOLEAN jjLU_DECOMP ( leftv  res,
leftv  v 
)
static

Definition at line 4329 of file iparith.cc.

4330 {
4331  /* computes the LU-decomposition of a matrix M;
4332  i.e., M = P * L * U, where
4333  - P is a row permutation matrix,
4334  - L is in lower triangular form,
4335  - U is in upper row echelon form
4336  Then, we also have P * M = L * U.
4337  A list [P, L, U] is returned. */
4338  matrix mat = (const matrix)v->Data();
4339  if (!idIsConstant((ideal)mat))
4340  {
4341  WerrorS("matrix must be constant");
4342  return TRUE;
4343  }
4344  matrix pMat;
4345  matrix lMat;
4346  matrix uMat;
4347 
4348  luDecomp(mat, pMat, lMat, uMat);
4349 
4351  ll->Init(3);
4352  ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4353  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4354  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4355  res->data=(char*)ll;
4356 
4357  return FALSE;
4358 }
#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 6914 of file iparith.cc.

6915 {
6916  /* computation of the inverse of a quadratic matrix A
6917  using the L-U-decomposition of A;
6918  There are two valid parametrisations:
6919  1) exactly one argument which is just the matrix A,
6920  2) exactly three arguments P, L, U which already
6921  realise the L-U-decomposition of A, that is,
6922  P * A = L * U, and P, L, and U satisfy the
6923  properties decribed in method 'jjLU_DECOMP';
6924  see there;
6925  If A is invertible, the list [1, A^(-1)] is returned,
6926  otherwise the list [0] is returned. Thus, the user may
6927  inspect the first entry of the returned list to see
6928  whether A is invertible. */
6929  matrix iMat; int invertible;
6930  const short t1[]={1,MATRIX_CMD};
6931  const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
6932  if (iiCheckTypes(v,t1))
6933  {
6934  matrix aMat = (matrix)v->Data();
6935  int rr = aMat->rows();
6936  int cc = aMat->cols();
6937  if (rr != cc)
6938  {
6939  Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
6940  return TRUE;
6941  }
6942  if (!idIsConstant((ideal)aMat))
6943  {
6944  WerrorS("matrix must be constant");
6945  return TRUE;
6946  }
6947  invertible = luInverse(aMat, iMat);
6948  }
6949  else if (iiCheckTypes(v,t2))
6950  {
6951  matrix pMat = (matrix)v->Data();
6952  matrix lMat = (matrix)v->next->Data();
6953  matrix uMat = (matrix)v->next->next->Data();
6954  int rr = uMat->rows();
6955  int cc = uMat->cols();
6956  if (rr != cc)
6957  {
6958  Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
6959  rr, cc);
6960  return TRUE;
6961  }
6962  if (!idIsConstant((ideal)pMat)
6963  || (!idIsConstant((ideal)lMat))
6964  || (!idIsConstant((ideal)uMat))
6965  )
6966  {
6967  WerrorS("matricesx must be constant");
6968  return TRUE;
6969  }
6970  invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
6971  }
6972  else
6973  {
6974  Werror("expected either one or three matrices");
6975  return TRUE;
6976  }
6977 
6978  /* build the return structure; a list with either one or two entries */
6980  if (invertible)
6981  {
6982  ll->Init(2);
6983  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
6984  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
6985  }
6986  else
6987  {
6988  ll->Init(1);
6989  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
6990  }
6991 
6992  res->data=(char*)ll;
6993  return FALSE;
6994 }
int & rows()
Definition: matpol.h:23
int & cols()
Definition: matpol.h:24
bool luInverseFromLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, matrix &iMat, const ring R)
This code computes the inverse by inverting lMat and uMat, and then performing two matrix multiplicat...
bool luInverse(const matrix aMat, matrix &iMat, const ring R)
This code first computes the LU-decomposition of aMat, and then calls the method for inverting a matr...

◆ jjLU_SOLVE()

static BOOLEAN jjLU_SOLVE ( leftv  res,
leftv  v 
)
static

Definition at line 6995 of file iparith.cc.

6996 {
6997  /* for solving a linear equation system A * x = b, via the
6998  given LU-decomposition of the matrix A;
6999  There is one valid parametrisation:
7000  1) exactly four arguments P, L, U, b;
7001  P, L, and U realise the L-U-decomposition of A, that is,
7002  P * A = L * U, and P, L, and U satisfy the
7003  properties decribed in method 'jjLU_DECOMP';
7004  see there;
7005  b is the right-hand side vector of the equation system;
7006  The method will return a list of either 1 entry or three entries:
7007  1) [0] if there is no solution to the system;
7008  2) [1, x, H] if there is at least one solution;
7009  x is any solution of the given linear system,
7010  H is the matrix with column vectors spanning the homogeneous
7011  solution space.
7012  The method produces an error if matrix and vector sizes do not fit. */
7013  const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7014  if (!iiCheckTypes(v,t))
7015  {
7016  WerrorS("expected exactly three matrices and one vector as input");
7017  return TRUE;
7018  }
7019  matrix pMat = (matrix)v->Data();
7020  matrix lMat = (matrix)v->next->Data();
7021  matrix uMat = (matrix)v->next->next->Data();
7022  matrix bVec = (matrix)v->next->next->next->Data();
7023  matrix xVec; int solvable; matrix homogSolSpace;
7024  if (pMat->rows() != pMat->cols())
7025  {
7026  Werror("first matrix (%d x %d) is not quadratic",
7027  pMat->rows(), pMat->cols());
7028  return TRUE;
7029  }
7030  if (lMat->rows() != lMat->cols())
7031  {
7032  Werror("second matrix (%d x %d) is not quadratic",
7033  lMat->rows(), lMat->cols());
7034  return TRUE;
7035  }
7036  if (lMat->rows() != uMat->rows())
7037  {
7038  Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7039  lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7040  return TRUE;
7041  }
7042  if (uMat->rows() != bVec->rows())
7043  {
7044  Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7045  uMat->rows(), uMat->cols(), bVec->rows());
7046  return TRUE;
7047  }
7048  if (!idIsConstant((ideal)pMat)
7049  ||(!idIsConstant((ideal)lMat))
7050  ||(!idIsConstant((ideal)uMat))
7051  )
7052  {
7053  WerrorS("matrices must be constant");
7054  return TRUE;
7055  }
7056  solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7057 
7058  /* build the return structure; a list with either one or three entries */
7060  if (solvable)
7061  {
7062  ll->Init(3);
7063  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7064  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7065  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7066  }
7067  else
7068  {
7069  ll->Init(1);
7070  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7071  }
7072 
7073  res->data=(char*)ll;
7074  return FALSE;
7075 }
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 7872 of file iparith.cc.

7873 {
7874  assume( e->Typ()==INT_CMD );
7875  Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
7876  r->start =(int)(long)e->Data();
7877  return r;
7878 }
omBin sSubexpr_bin
Definition: subexpr.cc:45

◆ jjMAP()

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

Definition at line 1563 of file iparith.cc.

1564 {
1565  //Print("try to map %s with %s\n",$3.Name(),$1.Name());
1566  leftv sl=NULL;
1567  if ((v->e==NULL)&&(v->name!=NULL))
1568  {
1569  map m=(map)u->Data();
1570  sl=iiMap(m,v->name);
1571  }
1572  else
1573  {
1574  Werror("%s(<name>) expected",u->Name());
1575  }
1576  if (sl==NULL) return TRUE;
1577  memcpy(res,sl,sizeof(sleftv));
1579  return FALSE;
1580 }
leftv iiMap(map theMap, const char *what)
Definition: ipshell.cc:607

◆ jjMATRIX_Id()

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

Definition at line 6282 of file iparith.cc.

6283 {
6284  int mi=(int)(long)v->Data();
6285  int ni=(int)(long)w->Data();
6286  if ((mi<1)||(ni<1))
6287  {
6288  Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6289  return TRUE;
6290  }
6291  matrix m=mpNew(mi,ni);
6292  ideal I=(ideal)u->CopyD(IDEAL_CMD);
6293  int i=si_min(IDELEMS(I),mi*ni);
6294  //for(i=i-1;i>=0;i--)
6295  //{
6296  // m->m[i]=I->m[i];
6297  // I->m[i]=NULL;
6298  //}
6299  memcpy(m->m,I->m,i*sizeof(poly));
6300  memset(I->m,0,i*sizeof(poly));
6301  id_Delete(&I,currRing);
6302  res->data = (char *)m;
6303  return FALSE;
6304 }

◆ jjMATRIX_Ma()

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

Definition at line 6318 of file iparith.cc.

6319 {
6320  int mi=(int)(long)v->Data();
6321  int ni=(int)(long)w->Data();
6322  if ((mi<1)||(ni<1))
6323  {
6324  Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6325  return TRUE;
6326  }
6327  matrix m=mpNew(mi,ni);
6328  matrix I=(matrix)u->CopyD(MATRIX_CMD);
6329  int r=si_min(MATROWS(I),mi);
6330  int c=si_min(MATCOLS(I),ni);
6331  int i,j;
6332  for(i=r;i>0;i--)
6333  {
6334  for(j=c;j>0;j--)
6335  {
6336  MATELEM(m,i,j)=MATELEM(I,i,j);
6337  MATELEM(I,i,j)=NULL;
6338  }
6339  }
6340  id_Delete((ideal *)&I,currRing);
6341  res->data = (char *)m;
6342  return FALSE;
6343 }

◆ jjMATRIX_Mo()

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

Definition at line 6305 of file iparith.cc.

6306 {
6307  int mi=(int)(long)v->Data();
6308  int ni=(int)(long)w->Data();
6309  if ((mi<1)||(ni<1))
6310  {
6311  Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6312  return TRUE;
6313  }
6314  res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6315  mi,ni,currRing);
6316  return FALSE;
6317 }

◆ jjMEMORY()

static BOOLEAN jjMEMORY ( leftv  res,
leftv  v 
)
static

Definition at line 4359 of file iparith.cc.

4360 {
4361  // clean out "_":
4363  memset(&sLastPrinted,0,sizeof(sleftv));
4364  // collect all info:
4365  omUpdateInfo();
4366  switch(((int)(long)v->Data()))
4367  {
4368  case 0:
4369  res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4370  break;
4371  case 1:
4372  res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4373  break;
4374  case 2:
4375  res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4376  break;
4377  default:
4378  omPrintStats(stdout);
4379  omPrintInfo(stdout);
4380  omPrintBinStats(stdout);
4381  res->data = (char *)0;
4382  res->rtyp = NONE;
4383  }
4384  return FALSE;
4385  res->data = (char *)0;
4386  return FALSE;
4387 }
void omPrintBinStats(FILE *fd)
Definition: omBin.c:692
void omPrintStats(FILE *fd)
Definition: omStats.c:115
void omPrintInfo(FILE *fd)
Definition: omStats.c:129
void omUpdateInfo()
Definition: omStats.c:24
omInfo_t om_Info
Definition: omStats.c:13
sleftv sLastPrinted
Definition: subexpr.cc:51
#define NONE
Definition: tok.h:218

◆ jjMINOR_M()

static BOOLEAN jjMINOR_M ( leftv  res,
leftv  v 
)
static

Definition at line 5836 of file iparith.cc.

5837 {
5838  /* Here's the use pattern for the minor command:
5839  minor ( matrix_expression m, int_expression minorSize,
5840  optional ideal_expression IasSB, optional int_expression k,
5841  optional string_expression algorithm,
5842  optional int_expression cachedMinors,
5843  optional int_expression cachedMonomials )
5844  This method here assumes that there are at least two arguments.
5845  - If IasSB is present, it must be a std basis. All minors will be
5846  reduced w.r.t. IasSB.
5847  - If k is absent, all non-zero minors will be computed.
5848  If k is present and k > 0, the first k non-zero minors will be
5849  computed.
5850  If k is present and k < 0, the first |k| minors (some of which
5851  may be zero) will be computed.
5852  If k is present and k = 0, an error is reported.
5853  - If algorithm is absent, all the following arguments must be absent too.
5854  In this case, a heuristic picks the best-suited algorithm (among
5855  Bareiss, Laplace, and Laplace with caching).
5856  If algorithm is present, it must be one of "Bareiss", "bareiss",
5857  "Laplace", "laplace", "Cache", "cache". In the cases "Cache" and
5858  "cache" two more arguments may be given, determining how many entries
5859  the cache may have at most, and how many cached monomials there are at
5860  most. (Cached monomials are counted over all cached polynomials.)
5861  If these two additional arguments are not provided, 200 and 100000
5862  will be used as defaults.
5863  */
5864  matrix m;
5865  leftv u=v->next;
5866  v->next=NULL;
5867  int v_typ=v->Typ();
5868  if (v_typ==MATRIX_CMD)
5869  {
5870  m = (const matrix)v->Data();
5871  }
5872  else
5873  {
5874  if (v_typ==0)
5875  {
5876  Werror("`%s` is undefined",v->Fullname());
5877  return TRUE;
5878  }
5879  // try to convert to MATRIX:
5880  int ii=iiTestConvert(v_typ,MATRIX_CMD);
5881  BOOLEAN bo;
5882  sleftv tmp;
5883  if (ii>0) bo=iiConvert(v_typ,MATRIX_CMD,ii,v,&tmp);
5884  else bo=TRUE;
5885  if (bo)
5886  {
5887  Werror("cannot convert %s to matrix",Tok2Cmdname(v_typ));
5888  return TRUE;
5889  }
5890  m=(matrix)tmp.data;
5891  }
5892  const int mk = (const int)(long)u->Data();
5893  bool noIdeal = true; bool noK = true; bool noAlgorithm = true;
5894  bool noCacheMinors = true; bool noCacheMonomials = true;
5895  ideal IasSB; int k; char* algorithm; int cacheMinors; int cacheMonomials;
5896 
5897  /* here come the different cases of correct argument sets */
5898  if ((u->next != NULL) && (u->next->Typ() == IDEAL_CMD))
5899  {
5900  IasSB = (ideal)u->next->Data();
5901  noIdeal = false;
5902  if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
5903  {
5904  k = (int)(long)u->next->next->Data();
5905  noK = false;
5906  assume(k != 0);
5907  if ((u->next->next->next != NULL) &&
5908  (u->next->next->next->Typ() == STRING_CMD))
5909  {
5910  algorithm = (char*)u->next->next->next->Data();
5911  noAlgorithm = false;
5912  if ((u->next->next->next->next != NULL) &&
5913  (u->next->next->next->next->Typ() == INT_CMD))
5914  {
5915  cacheMinors = (int)(long)u->next->next->next->next->Data();
5916  noCacheMinors = false;
5917  if ((u->next->next->next->next->next != NULL) &&
5918  (u->next->next->next->next->next->Typ() == INT_CMD))
5919  {
5920  cacheMonomials =
5921  (int)(long)u->next->next->next->next->next->Data();
5922  noCacheMonomials = false;
5923  }
5924  }
5925  }
5926  }
5927  }
5928  else if ((u->next != NULL) && (u->next->Typ() == INT_CMD))
5929  {
5930  k = (int)(long)u->next->Data();
5931  noK = false;
5932  assume(k != 0);
5933  if ((u->next->next != NULL) && (u->next->next->Typ() == STRING_CMD))
5934  {
5935  algorithm = (char*)u->next->next->Data();
5936  noAlgorithm = false;
5937  if ((u->next->next->next != NULL) &&
5938  (u->next->next->next->Typ() == INT_CMD))
5939  {
5940  cacheMinors = (int)(long)u->next->next->next->Data();
5941  noCacheMinors = false;
5942  if ((u->next->next->next->next != NULL) &&
5943  (u->next->next->next->next->Typ() == INT_CMD))
5944  {
5945  cacheMonomials = (int)(long)u->next->next->next->next->Data();
5946  noCacheMonomials = false;
5947  }
5948  }
5949  }
5950  }
5951  else if ((u->next != NULL) && (u->next->Typ() == STRING_CMD))
5952  {
5953  algorithm = (char*)u->next->Data();
5954  noAlgorithm = false;
5955  if ((u->next->next != NULL) && (u->next->next->Typ() == INT_CMD))
5956  {
5957  cacheMinors = (int)(long)u->next->next->Data();
5958  noCacheMinors = false;
5959  if ((u->next->next->next != NULL) &&
5960  (u->next->next->next->Typ() == INT_CMD))
5961  {
5962  cacheMonomials = (int)(long)u->next->next->next->Data();
5963  noCacheMonomials = false;
5964  }
5965  }
5966  }
5967 
5968  /* upper case conversion for the algorithm if present */
5969  if (!noAlgorithm)
5970  {
5971  if (strcmp(algorithm, "bareiss") == 0)
5972  algorithm = (char*)"Bareiss";
5973  if (strcmp(algorithm, "laplace") == 0)
5974  algorithm = (char*)"Laplace";
5975  if (strcmp(algorithm, "cache") == 0)
5976  algorithm = (char*)"Cache";
5977  }
5978 
5979  v->next=u;
5980  /* here come some tests */
5981  if (!noIdeal)
5982  {
5983  assumeStdFlag(u->next);
5984  }
5985  if ((!noK) && (k == 0))
5986  {
5987  WerrorS("Provided number of minors to be computed is zero.");
5988  return TRUE;
5989  }
5990  if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") != 0)
5991  && (strcmp(algorithm, "Laplace") != 0)
5992  && (strcmp(algorithm, "Cache") != 0))
5993  {
5994  WerrorS("Expected as algorithm one of 'B/bareiss', 'L/laplace', or 'C/cache'.");
5995  return TRUE;
5996  }
5997  if ((!noAlgorithm) && (strcmp(algorithm, "Bareiss") == 0)
5998  && (!rField_is_Domain(currRing)))
5999  {
6000  Werror("Bareiss algorithm not defined over coefficient rings %s",
6001  "with zero divisors.");
6002  return TRUE;
6003  }
6004  res->rtyp=IDEAL_CMD;
6005  if ((mk < 1) || (mk > m->rows()) || (mk > m->cols()))
6006  {
6007  ideal I=idInit(1,1);
6008  if (mk<1) I->m[0]=p_One(currRing);
6009  //Werror("invalid size of minors: %d (matrix is (%d x %d))", mk,
6010  // m->rows(), m->cols());
6011  res->data=(void*)I;
6012  return FALSE;
6013  }
6014  if ((!noAlgorithm) && (strcmp(algorithm, "Cache") == 0)
6015  && (noCacheMinors || noCacheMonomials))
6016  {
6017  cacheMinors = 200;
6018  cacheMonomials = 100000;
6019  }
6020 
6021  /* here come the actual procedure calls */
6022  if (noAlgorithm)
6023  res->data = getMinorIdealHeuristic(m, mk, (noK ? 0 : k),
6024  (noIdeal ? 0 : IasSB), false);
6025  else if (strcmp(algorithm, "Cache") == 0)
6026  res->data = getMinorIdealCache(m, mk, (noK ? 0 : k),
6027  (noIdeal ? 0 : IasSB), 3, cacheMinors,
6028  cacheMonomials, false);
6029  else
6030  res->data = getMinorIdeal(m, mk, (noK ? 0 : k), algorithm,
6031  (noIdeal ? 0 : IasSB), false);
6032  if (v_typ!=MATRIX_CMD) idDelete((ideal *)&m);
6033  return FALSE;
6034 }
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:1305

◆ jjMINRES_R()

static BOOLEAN jjMINRES_R ( leftv  res,
leftv  v 
)
static

Definition at line 4413 of file iparith.cc.

4414 {
4415  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4416 
4417  syStrategy tmp=(syStrategy)v->Data();
4418  tmp = syMinimize(tmp); // enrich itself!
4419 
4420  res->data=(char *)tmp;
4421 
4422  if (weights!=NULL)
4423  atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4424 
4425  return FALSE;
4426 }
syStrategy syMinimize(syStrategy syzstr)
Definition: syz1.cc:2395
ssyStrategy * syStrategy
Definition: syz.h:35

◆ jjMINUS_BI()

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

Definition at line 860 of file iparith.cc.

861 {
862  res->data = (char *)(n_Sub((number)u->Data(), (number)v->Data(),coeffs_BIGINT));
863  return jjPLUSMINUS_Gen(res,u,v);
864 }
static BOOLEAN jjPLUSMINUS_Gen(leftv res, leftv u, leftv v)
Definition: iparith.cc:631

◆ jjMINUS_BIM()

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

Definition at line 885 of file iparith.cc.

886 {
887  res->data = (char *)bimSub((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
888  if (res->data==NULL)
889  {
890  WerrorS("bigintmat/cmatrix not compatible");
891  return TRUE;
892  }
893  return jjPLUSMINUS_Gen(res,u,v);
894 }
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 844 of file iparith.cc.

845 {
846  void *ap=u->Data(); void *bp=v->Data();
847  int aa=(int)(long)ap;
848  int bb=(int)(long)bp;
849  int cc=aa-bb;
850  unsigned int a=(unsigned int)(unsigned long)ap;
851  unsigned int b=(unsigned int)(unsigned long)bp;
852  unsigned int c=a-b;
853  if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
854  {
855  WarnS("int overflow(-), result may be wrong");
856  }
857  res->data = (char *)((long)cc);
858  return jjPLUSMINUS_Gen(res,u,v);
859 }
Definition: ap.h:40
#define Sy_bit(x)
Definition: options.h:32

◆ jjMINUS_IV()

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

Definition at line 875 of file iparith.cc.

876 {
877  res->data = (char *)ivSub((intvec*)(u->Data()), (intvec*)(v->Data()));
878  if (res->data==NULL)
879  {
880  WerrorS("intmat size not compatible");
881  return TRUE;
882  }
883  return jjPLUSMINUS_Gen(res,u,v);
884 }
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 895 of file iparith.cc.

896 {
897  matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
898  res->data = (char *)(mp_Sub(A , B, currRing));
899  if (res->data==NULL)
900  {
901  Werror("matrix size not compatible(%dx%d, %dx%d)",
903  return TRUE;
904  }
905  return jjPLUSMINUS_Gen(res,u,v);
906  return FALSE;
907 }
b *CanonicalForm B
Definition: facBivar.cc:52
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition: matpol.cc:195
#define A
Definition: sirandom.c:23

◆ jjMINUS_N()

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

Definition at line 865 of file iparith.cc.

866 {
867  res->data = (char *)(nSub((number)u->Data(), (number)v->Data()));
868  return jjPLUSMINUS_Gen(res,u,v);
869 }
#define nSub(n1, n2)
Definition: numbers.h:23

◆ jjMINUS_P()

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

Definition at line 870 of file iparith.cc.

871 {
872  res->data = (char *)(pSub((poly)u->CopyD(POLY_CMD) , (poly)v->CopyD(POLY_CMD)));
873  return jjPLUSMINUS_Gen(res,u,v);
874 }
#define pSub(a, b)
Definition: polys.h:273

◆ jjMOD_BI()

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

Definition at line 2532 of file iparith.cc.

2533 {
2534  number q=(number)v->Data();
2535  if (n_IsZero(q,coeffs_BIGINT))
2536  {
2538  return TRUE;
2539  }
2540  res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2541  return FALSE;
2542 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition: coeffs.h:629

◆ jjMOD_N()

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

Definition at line 2543 of file iparith.cc.

2544 {
2545  number q=(number)v->Data();
2546  if (nIsZero(q))
2547  {
2549  return TRUE;
2550  }
2551  res->data =(char *) n_IntMod((number)u->Data(),q,currRing->cf);
2552  return FALSE;
2553 }

◆ jjMOD_P()

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

Definition at line 2554 of file iparith.cc.

2555 {
2556  poly q=(poly)v->Data();
2557  if (q==NULL)
2558  {
2560  return TRUE;
2561  }
2562  poly p=(poly)(u->Data());
2563  if (p==NULL)
2564  {
2565  res->data=NULL;
2566  return FALSE;
2567  }
2568  res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2569  q /*(poly)(v->Data())*/ ,currRing));
2570  return FALSE;
2571 }
poly singclap_pmod(poly f, poly g, const ring r)
Definition: clapsing.cc:623

◆ jjMODULO()

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

Definition at line 2483 of file iparith.cc.

2484 {
2485  intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2486  tHomog hom=testHomog;
2487  if (w_u!=NULL)
2488  {
2489  w_u=ivCopy(w_u);
2490  hom=isHomog;
2491  }
2492  intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
2493  if (w_v!=NULL)
2494  {
2495  w_v=ivCopy(w_v);
2496  hom=isHomog;
2497  }
2498  if ((w_u!=NULL) && (w_v==NULL))
2499  w_v=ivCopy(w_u);
2500  if ((w_v!=NULL) && (w_u==NULL))
2501  w_u=ivCopy(w_v);
2502  ideal u_id=(ideal)u->Data();
2503  ideal v_id=(ideal)v->Data();
2504  if (w_u!=NULL)
2505  {
2506  if ((*w_u).compare((w_v))!=0)
2507  {
2508  WarnS("incompatible weights");
2509  delete w_u; w_u=NULL;
2510  hom=testHomog;
2511  }
2512  else
2513  {
2514  if ((!idTestHomModule(u_id,currRing->qideal,w_v))
2515  || (!idTestHomModule(v_id,currRing->qideal,w_v)))
2516  {
2517  WarnS("wrong weights");
2518  delete w_u; w_u=NULL;
2519  hom=testHomog;
2520  }
2521  }
2522  }
2523  res->data = (char *)idModulo(u_id,v_id ,hom,&w_u);
2524  if (w_u!=NULL)
2525  {
2526  atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
2527  }
2528  delete w_v;
2529  //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
2530  return FALSE;
2531 }
ideal idModulo(ideal h2, ideal h1, tHomog hom, intvec **w)
Definition: ideals.cc:2254
tHomog
Definition: structs.h:38
@ isHomog
Definition: structs.h:40

◆ jjMONITOR1()

static BOOLEAN jjMONITOR1 ( leftv  res,
leftv  v 
)
static

Definition at line 2573 of file iparith.cc.

2574 {
2575  return jjMONITOR2(res,v,NULL);
2576 }
static BOOLEAN jjMONITOR2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2577

◆ jjMONITOR2()

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

Definition at line 2577 of file iparith.cc.

2578 {
2579 #if 0
2580  char *opt=(char *)v->Data();
2581  int mode=0;
2582  while(*opt!='\0')
2583  {
2584  if (*opt=='i') mode |= SI_PROT_I;
2585  else if (*opt=='o') mode |= SI_PROT_O;
2586  opt++;
2587  }
2588  monitor((char *)(u->Data()),mode);
2589 #else
2590  si_link l=(si_link)u->Data();
2591  if (slOpen(l,SI_LINK_WRITE,u)) return TRUE;
2592  if(strcmp(l->m->type,"ASCII")!=0)
2593  {
2594  Werror("ASCII link required, not `%s`",l->m->type);
2595  slClose(l);
2596  return TRUE;
2597  }
2598  SI_LINK_SET_CLOSE_P(l); // febase handles the FILE*
2599  if ( l->name[0]!='\0') // "" is the stop condition
2600  {
2601  const char *opt;
2602  int mode=0;
2603  if (v==NULL) opt=(const char*)"i";
2604  else opt=(const char *)v->Data();
2605  while(*opt!='\0')
2606  {
2607  if (*opt=='i') mode |= SI_PROT_I;
2608  else if (*opt=='o') mode |= SI_PROT_O;
2609  opt++;
2610  }
2611  monitor((FILE *)l->data,mode);
2612  }
2613  else
2614  monitor(NULL,0);
2615  return FALSE;
2616 #endif
2617 }
void monitor(void *F, int mode)
Definition: febase.cc:67
#define SI_PROT_O
Definition: reporter.h:53
#define SI_PROT_I
Definition: reporter.h:52

◆ jjMONOM()

static BOOLEAN jjMONOM ( leftv  res,
leftv  v 
)
static

Definition at line 2618 of file iparith.cc.

2619 {
2620  intvec *iv=(intvec *)v->Data();
2621  poly p=pOne();
2622  int e;
2623  BOOLEAN err=FALSE;
2624  for(unsigned i=si_min(currRing->N,iv->length()); i>0; i--)
2625  {
2626  e=(*iv)[i-1];
2627  if (e>=0) pSetExp(p,i,e);
2628  else err=TRUE;
2629  }
2630  if (iv->length()==(currRing->N+1))
2631  {
2632  res->rtyp=VECTOR_CMD;
2633  e=(*iv)[currRing->N];
2634  if (e>=0) pSetComp(p,e);
2635  else err=TRUE;
2636  }
2637  pSetm(p);
2638  res->data=(char*)p;
2639  if(err) { pDelete(&p); WerrorS("no negative exponent allowed"); }
2640  return err;
2641 }

◆ jjmpTrace()

static BOOLEAN jjmpTrace ( leftv  res,
leftv  v 
)
static

Definition at line 5243 of file iparith.cc.

5244 {
5245  res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5246  return FALSE;
5247 }
poly mp_Trace(matrix a, const ring R)
Definition: matpol.cc:277

◆ jjmpTransp()

static BOOLEAN jjmpTransp ( leftv  res,
leftv  v 
)
static

Definition at line 5248 of file iparith.cc.

5249 {
5250  res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5251  return FALSE;
5252 }
matrix mp_Transp(matrix a, const ring R)
Definition: matpol.cc:256

◆ jjMSTD()

static BOOLEAN jjMSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4392 of file iparith.cc.

4393 {
4394  int t=v->Typ();
4395  ideal r,m;
4396  r=kMin_std((ideal)v->Data(),currRing->qideal,testHomog,NULL,m);
4398  l->Init(2);
4399  l->m[0].rtyp=t;
4400  l->m[0].data=(char *)r;
4401  setFlag(&(l->m[0]),FLAG_STD);
4402  l->m[1].rtyp=t;
4403  l->m[1].data=(char *)m;
4404  res->data=(char *)l;
4405  return FALSE;
4406 }
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2664

◆ jjMULT()

static BOOLEAN jjMULT ( leftv  res,
leftv  v 
)
static

Definition at line 4407 of file iparith.cc.

4408 {
4409  assumeStdFlag(v);
4410  res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4411  return FALSE;
4412 }
int scMultInt(ideal S, ideal Q)
Definition: hdegree.cc:799

◆ jjN2BI()

static BOOLEAN jjN2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4427 of file iparith.cc.

4428 {
4429  number n,i; i=(number)v->Data();
4431  if (nMap!=NULL)
4432  n=nMap(i,currRing->cf,coeffs_BIGINT);
4433  else goto err;
4434  res->data=(void *)n;
4435  return FALSE;
4436 err:
4437  WerrorS("cannot convert to bigint"); return TRUE;
4438 }

◆ jjNAMEOF()

static BOOLEAN jjNAMEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4439 of file iparith.cc.

4440 {
4441  if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4442  res->data=omStrDup(v->name);
4443  else if (v->name==NULL)
4444  res->data=omStrDup("");
4445  else
4446  {
4447  res->data = (char *)v->name;
4448  v->name=NULL;
4449  }
4450  return FALSE;
4451 }

◆ jjNAMES()

static BOOLEAN jjNAMES ( leftv  res,
leftv  v 
)
static

Definition at line 4452 of file iparith.cc.

4453 {
4454  res->data=ipNameList(((ring)v->Data())->idroot);
4455  return FALSE;
4456 }
lists ipNameList(idhdl root)
Definition: ipid.cc:536

◆ jjNAMES0()

static BOOLEAN jjNAMES0 ( leftv  res,
leftv   
)
static

Definition at line 7358 of file iparith.cc.

7359 {
7360  res->data=(void *)ipNameList(IDROOT);
7361  return FALSE;
7362 }

◆ jjNAMES_I()

static BOOLEAN jjNAMES_I ( leftv  res,
leftv  v 
)
static

Definition at line 4457 of file iparith.cc.

4458 {
4459  res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4460  return FALSE;
4461 }
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:559

◆ jjNEWSTRUCT2()

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

Definition at line 2642 of file iparith.cc.

2643 {
2644  // u: the name of the new type
2645  // v: the elements
2646  const char *s=(const char *)u->Data();
2647  newstruct_desc d=NULL;
2648  if (strlen(s)>=2)
2649  {
2650  d=newstructFromString((const char *)v->Data());
2651  if (d!=NULL) newstruct_setup(s,d);
2652  }
2653  else WerrorS("name of newstruct must be longer than 1 character");
2654  return d==NULL;
2655 }
void newstruct_setup(const char *n, newstruct_desc d)
Definition: newstruct.cc:701
newstruct_desc newstructFromString(const char *s)
Definition: newstruct.cc:805

◆ jjNEWSTRUCT3()

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

Definition at line 6035 of file iparith.cc.

6036 {
6037  // u: the name of the new type
6038  // v: the parent type
6039  // w: the elements
6040  newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6041  (const char *)w->Data());
6042  if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6043  return (d==NULL);
6044 }
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition: newstruct.cc:812

◆ jjnInt()

static BOOLEAN jjnInt ( leftv  res,
leftv  u 
)
static

Definition at line 5283 of file iparith.cc.

5284 {
5285  number n=(number)u->CopyD(); // n_Int may call n_Normalize
5286  res->data=(char *)(long)iin_Int(n,currRing->cf);
5287  n_Delete(&n,currRing->cf);
5288  return FALSE;
5289 }
static int iin_Int(number &n, coeffs cf)
Definition: iparith.cc:221

◆ jjnlInt()

static BOOLEAN jjnlInt ( leftv  res,
leftv  u 
)
static

Definition at line 5290 of file iparith.cc.

5291 {
5292  number n=(number)u->Data();
5293  res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5294  return FALSE;
5295 }

◆ jjNOT()

static BOOLEAN jjNOT ( leftv  res,
leftv  v 
)
static

Definition at line 4462 of file iparith.cc.

4463 {
4464  res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4465  return FALSE;
4466 }

◆ jjNULL()

static BOOLEAN jjNULL ( leftv  ,
leftv   
)
static

Definition at line 3414 of file iparith.cc.

3415 {
3416  return FALSE;
3417 }

◆ jjNUMERATOR()

static BOOLEAN jjNUMERATOR ( leftv  res,
leftv  v 
)
static

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

Definition at line 3715 of file iparith.cc.

3716 {
3717  number n = reinterpret_cast<number>(v->Data());
3718  res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
3719  return FALSE;
3720 }
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
Definition: coeffs.h:609

◆ jjNVARS()

static BOOLEAN jjNVARS ( leftv  res,
leftv  v 
)
static

Definition at line 4467 of file iparith.cc.

4468 {
4469  res->data = (char *)(long)(((ring)(v->Data()))->N);
4470  return FALSE;
4471 }

◆ jjOP_BI_BIM()

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

Definition at line 279 of file iparith.cc.

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

◆ jjOP_BIM_BI()

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

Definition at line 266 of file iparith.cc.

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

◆ jjOP_BIM_I()

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

Definition at line 247 of file iparith.cc.

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

◆ jjOP_I_BIM()

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

Definition at line 262 of file iparith.cc.

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

◆ jjOP_I_IM()

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

Definition at line 319 of file iparith.cc.

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

◆ jjOP_I_IV()

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

Definition at line 300 of file iparith.cc.

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

◆ jjOP_IM_I()

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

Definition at line 304 of file iparith.cc.

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

◆ jjOP_IV_I()

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

Definition at line 283 of file iparith.cc.

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

◆ jjOP_REST()

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

Definition at line 507 of file iparith.cc.

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

◆ jjOpenClose()

static BOOLEAN jjOpenClose ( leftv  ,
leftv  v 
)
static

Definition at line 4472 of file iparith.cc.

4473 {
4474  si_link l=(si_link)v->Data();
4475  if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4476  else { slPrepClose(l); return slClose(l);}
4477 }
@ OPEN_CMD
Definition: tok.h:144

◆ jjOPPOSE()

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

Definition at line 2772 of file iparith.cc.

2773 {
2774  /* number, poly, vector, ideal, module, matrix */
2775  ring r = (ring)a->Data();
2776  if (r == currRing)
2777  {
2778  res->data = b->Data();
2779  res->rtyp = b->rtyp;
2780  return FALSE;
2781  }
2782  if (!rIsLikeOpposite(currRing, r))
2783  {
2784  Werror("%s is not an opposite ring to current ring",a->Fullname());
2785  return TRUE;
2786  }
2787  idhdl w;
2788  if( ((w=r->idroot->get(b->Name(),myynest))!=NULL) && (b->e==NULL))
2789  {
2790  int argtype = IDTYP(w);
2791  switch (argtype)
2792  {
2793  case NUMBER_CMD:
2794  {
2795  /* since basefields are equal, we can apply nCopy */
2796  res->data = nCopy((number)IDDATA(w));
2797  res->rtyp = argtype;
2798  break;
2799  }
2800  case POLY_CMD:
2801  case VECTOR_CMD:
2802  {
2803  poly q = (poly)IDDATA(w);
2804  res->data = pOppose(r,q,currRing);
2805  res->rtyp = argtype;
2806  break;
2807  }
2808  case IDEAL_CMD:
2809  case MODUL_CMD:
2810  {
2811  ideal Q = (ideal)IDDATA(w);
2812  res->data = idOppose(r,Q,currRing);
2813  res->rtyp = argtype;
2814  break;
2815  }
2816  case MATRIX_CMD:
2817  {
2818  ring save = currRing;
2819  rChangeCurrRing(r);
2820  matrix m = (matrix)IDDATA(w);
2822  rChangeCurrRing(save);
2823  ideal S = idOppose(r,Q,currRing);
2824  id_Delete(&Q, r);
2825  res->data = id_Module2Matrix(S,currRing);
2826  res->rtyp = argtype;
2827  break;
2828  }
2829  default:
2830  {
2831  WerrorS("unsupported type in oppose");
2832  return TRUE;
2833  }
2834  }
2835  }
2836  else
2837  {
2838  Werror("identifier %s not found in %s",b->Fullname(),a->Fullname());
2839  return TRUE;
2840  }
2841  return FALSE;
2842 }
@ NUMBER_CMD
Definition: grammar.cc:287
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3406
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3367
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:3340
void rChangeCurrRing(ring r)
Definition: polys.cc:15

◆ jjOPPOSITE()

static BOOLEAN jjOPPOSITE ( leftv  res,
leftv  a 
)
static

Definition at line 4926 of file iparith.cc.

4927 {
4928  ring r = (ring)a->Data();
4929  //if (rIsPluralRing(r))
4930  if (r->OrdSgn==1)
4931  {
4932  res->data = rOpposite(r);
4933  }
4934  else
4935  {
4936  WarnS("opposite only for global orderings");
4937  res->data = rCopy(r);
4938  }
4939  return FALSE;
4940 }
ring rOpposite(ring src)
Definition: ring.cc:5176

◆ jjOPTION_PL()

static BOOLEAN jjOPTION_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7363 of file iparith.cc.

7364 {
7365  if(v==NULL)
7366  {
7367  res->data=(char *)showOption();
7368  return FALSE;
7369  }
7370  res->rtyp=NONE;
7371  return setOption(res,v);
7372 }
BOOLEAN setOption(leftv res, leftv v)
Definition: misc_ip.cc:585
char * showOption()
Definition: misc_ip.cc:727

◆ jjOR_I()

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

Definition at line 1292 of file iparith.cc.

1293 {
1294  res->data = (char *)((long)u->Data() || (long)v->Data());
1295  return FALSE;
1296 }

◆ jjORD()

static BOOLEAN jjORD ( leftv  res,
leftv  v 
)
static

Definition at line 4478 of file iparith.cc.

4479 {
4480  poly p=(poly)v->Data();
4481  res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4482  return FALSE;
4483 }

◆ jjP2BI()

static BOOLEAN jjP2BI ( leftv  res,
leftv  v 
)
static

Definition at line 4524 of file iparith.cc.

4525 {
4526  poly p=(poly)v->Data();
4527  if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4528  if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4529  {
4530  WerrorS("poly must be constant");
4531  return TRUE;
4532  }
4533  number i=pGetCoeff(p);
4534  number n;
4536  if (nMap!=NULL)
4537  n=nMap(i,currRing->cf,coeffs_BIGINT);
4538  else goto err;
4539  res->data=(void *)n;
4540  return FALSE;
4541 err:
4542  WerrorS("cannot convert to bigint"); return TRUE;
4543 }

◆ jjP2I()

static BOOLEAN jjP2I ( leftv  res,
leftv  v 
)
static

Definition at line 4544 of file iparith.cc.

4545 {
4546  poly p=(poly)v->Data();
4547  if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4548  if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4549  {
4550  WerrorS("poly must be constant");
4551  return TRUE;
4552  }
4553  res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4554  return FALSE;
4555 }

◆ jjP2N()

static BOOLEAN jjP2N ( leftv  res,
leftv  v 
)
static

Definition at line 4592 of file iparith.cc.

4593 {
4594  number n;
4595  poly p;
4596  if (((p=(poly)v->Data())!=NULL)
4597  && (pIsConstant(p)))
4598  {
4599  n=nCopy(pGetCoeff(p));
4600  }
4601  else
4602  {
4603  n=nInit(0);
4604  }
4605  res->data = (char *)n;
4606  return FALSE;
4607 }

◆ jjPAR1()

static BOOLEAN jjPAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4484 of file iparith.cc.

4485 {
4486  int i=(int)(long)v->Data();
4487  int p=0;
4488  p=rPar(currRing);
4489  if ((0<i) && (i<=p))
4490  {
4491  res->data=(char *)n_Param(i,currRing);
4492  }
4493  else
4494  {
4495  Werror("par number %d out of range 1..%d",i,p);
4496  return TRUE;
4497  }
4498  return FALSE;
4499 }
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:814

◆ jjPARDEG()

static BOOLEAN jjPARDEG ( leftv  res,
leftv  v 
)
static

Definition at line 4500 of file iparith.cc.

4501 {
4502  number nn=(number)v->Data();
4503  res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4504  return FALSE;
4505 }
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition: coeffs.h:801

◆ jjPARSTR1()

static BOOLEAN jjPARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 4506 of file iparith.cc.

4507 {
4508  if (currRing==NULL)
4509  {
4510  WerrorS("no ring active");
4511  return TRUE;
4512  }
4513  int i=(int)(long)v->Data();
4514  int p=0;
4515  if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4516  res->data=omStrDup(rParameter(currRing)[i-1]);
4517  else
4518  {
4519  Werror("par number %d out of range 1..%d",i,p);
4520  return TRUE;
4521  }
4522  return FALSE;
4523 }

◆ jjPARSTR2()

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

Definition at line 2656 of file iparith.cc.

2657 {
2658  idhdl h=(idhdl)u->data;
2659  int i=(int)(long)v->Data();
2660  int p=0;
2661  if ((0<i)
2662  && (rParameter(IDRING(h))!=NULL)
2663  && (i<=(p=rPar(IDRING(h)))))
2664  res->data=omStrDup(rParameter(IDRING(h))[i-1]);
2665  else
2666  {
2667  Werror("par number %d out of range 1..%d",i,p);
2668  return TRUE;
2669  }
2670  return FALSE;
2671 }
#define IDRING(a)
Definition: ipid.h:122

◆ jjPFAC1()

static BOOLEAN jjPFAC1 ( leftv  res,
leftv  v 
)
static

Definition at line 4320 of file iparith.cc.

4321 {
4322  /* call method jjPFAC2 with second argument = 0 (meaning that no
4323  valid bound for the prime factors has been given) */
4324  sleftv tmp;
4325  memset(&tmp, 0, sizeof(tmp));
4326  tmp.rtyp = INT_CMD;
4327  return jjPFAC2(res, v, &tmp);
4328 }
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3029

◆ jjPFAC2()

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

Definition at line 3029 of file iparith.cc.

3030 {
3031  number n1; int i;
3032 
3033  if ((u->Typ() == BIGINT_CMD) ||
3034  ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3035  {
3036  n1 = (number)u->CopyD();
3037  }
3038  else if (u->Typ() == INT_CMD)
3039  {
3040  i = (int)(long)u->Data();
3041  n1 = n_Init(i, coeffs_BIGINT);
3042  }
3043  else
3044  {
3045  return TRUE;
3046  }
3047 
3048  i = (int)(long)v->Data();
3049 
3050  lists l = primeFactorisation(n1, i);
3051  n_Delete(&n1, coeffs_BIGINT);
3052  res->data = (char*)l;
3053  return FALSE;
3054 }
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:371

◆ jjpHead()

static BOOLEAN jjpHead ( leftv  res,
leftv  v 
)
static

Definition at line 5215 of file iparith.cc.

5216 {
5217  res->data = (char *)pHead((poly)v->Data());
5218  return FALSE;
5219 }

◆ jjpLength()

static BOOLEAN jjpLength ( leftv  res,
leftv  v 
)
static

Definition at line 5190 of file iparith.cc.

5191 {
5192  res->data = (char *)(long)pLength((poly)v->Data());
5193  return FALSE;
5194 }
static unsigned pLength(poly a)
Definition: p_polys.h:192

◆ jjPlural_mat_mat()

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

Definition at line 2733 of file iparith.cc.

2734 {
2735  if( currRing->qideal != NULL )
2736  {
2737  WerrorS("basering must NOT be a qring!");
2738  return TRUE;
2739  }
2740 
2741  if (iiOp==NCALGEBRA_CMD)
2742  {
2743  return nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,currRing,false,true,false,currRing);
2744  }
2745  else
2746  {
2747  ring r=rCopy(currRing);
2748  BOOLEAN result=nc_CallPlural((matrix)a->Data(),(matrix)b->Data(),NULL,NULL,r,false,true,false,currRing);
2749  res->data=r;
2750  return result;
2751  }
2752 }
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:2681
@ NCALGEBRA_CMD
Definition: tok.h:137

◆ jjPlural_mat_poly()

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

Definition at line 2713 of file iparith.cc.

2714 {
2715  if( currRing->qideal != NULL )
2716  {
2717  WerrorS("basering must NOT be a qring!");
2718  return TRUE;
2719  }
2720 
2721  if (iiOp==NCALGEBRA_CMD)
2722  {
2723  return nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),currRing,false,true,false,currRing);
2724  }
2725  else
2726  {
2727  ring r=rCopy(currRing);
2728  BOOLEAN result=nc_CallPlural((matrix)a->Data(),NULL,NULL,(poly)b->Data(),r,false,true,false,currRing);
2729  res->data=r;
2730  return result;
2731  }
2732 }

◆ jjPlural_num_mat()

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

Definition at line 2693 of file iparith.cc.

2694 {
2695  if( currRing->qideal != NULL )
2696  {
2697  WerrorS("basering must NOT be a qring!");
2698  return TRUE;
2699  }
2700 
2701  if (iiOp==NCALGEBRA_CMD)
2702  {
2703  return nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,currRing,false,true,false,currRing);
2704  }
2705  else
2706  {
2707  ring r=rCopy(currRing);
2708  BOOLEAN result=nc_CallPlural(NULL,(matrix)b->Data(),(poly)a->Data(),NULL,r,false,true,false,currRing);
2709  res->data=r;
2710  return result;
2711  }
2712 }

◆ jjPlural_num_poly()

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

Definition at line 2673 of file iparith.cc.

2674 {
2675  if( currRing->qideal != NULL )
2676  {
2677  WerrorS("basering must NOT be a qring!");
2678  return TRUE;
2679  }
2680 
2681  if (iiOp==NCALGEBRA_CMD)
2682  {
2683  return nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),currRing,false,true,false,currRing);
2684  }
2685  else
2686  {
2687  ring r=rCopy(currRing);
2688  BOOLEAN result=nc_CallPlural(NULL,NULL,(poly)a->Data(),(poly)b->Data(),r,false,true,false,currRing);
2689  res->data=r;
2690  return result;
2691  }
2692 }

◆ jjPLUS_BI()

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

Definition at line 767 of file iparith.cc.

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

◆ jjPLUS_BIM()

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

Definition at line 792 of file iparith.cc.

793 {
794  res->data = (char *)bimAdd((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
795  if (res->data==NULL)
796  {
797  WerrorS("bigintmat/cmatrix not compatible");
798  return TRUE;
799  }
800  return jjPLUSMINUS_Gen(res,u,v);
801 }

◆ jjPLUS_I()

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

Definition at line 755 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 839 of file iparith.cc.

840 {
841  res->data = (char *)idAdd((ideal)u->Data(),(ideal)v->Data());
842  return jjPLUSMINUS_Gen(res,u,v);
843 }
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 782 of file iparith.cc.

783 {
784  res->data = (char *)ivAdd((intvec*)(u->Data()), (intvec*)(v->Data()));
785  if (res->data==NULL)
786  {
787  WerrorS("intmat size not compatible");
788  return TRUE;
789  }
790  return jjPLUSMINUS_Gen(res,u,v);
791 }
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 802 of file iparith.cc.

803 {
804  matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
805  res->data = (char *)(mp_Add(A , B, currRing));
806  if (res->data==NULL)
807  {
808  Werror("matrix size not compatible(%dx%d, %dx%d)",
810  return TRUE;
811  }
812  return jjPLUSMINUS_Gen(res,u,v);
813 }
matrix mp_Add(matrix a, matrix b, const ring R)
Definition: matpol.cc:178

◆ jjPLUS_MA_P()

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

Definition at line 814 of file iparith.cc.

815 {
816  matrix m=(matrix)u->Data();
817  matrix p= mp_InitP(m->nrows,m->ncols,(poly)(v->CopyD(POLY_CMD)),currRing);
818  if (iiOp=='+')
819  res->data = (char *)mp_Add(m , p,currRing);
820  else
821  res->data = (char *)mp_Sub(m , p,currRing);
822  idDelete((ideal *)&p);
823  return jjPLUSMINUS_Gen(res,u,v);
824 }
matrix mp_InitP(int r, int c, poly p, const ring R)
make it a p * unit matrix
Definition: matpol.cc:112

◆ jjPLUS_N()

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

Definition at line 772 of file iparith.cc.

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

◆ jjPLUS_P()

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

Definition at line 777 of file iparith.cc.

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

◆ jjPLUS_P_MA()

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

Definition at line 825 of file iparith.cc.

826 {
827  return jjPLUS_MA_P(res,v,u);
828 }
static BOOLEAN jjPLUS_MA_P(leftv res, leftv u, leftv v)
Definition: iparith.cc:814

◆ jjPLUS_S()

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

Definition at line 829 of file iparith.cc.

830 {
831  char* a = (char * )(u->Data());
832  char* b = (char * )(v->Data());
833  char* r = (char * )omAlloc(strlen(a) + strlen(b) + 1);
834  strcpy(r,a);
835  strcat(r,b);
836  res->data=r;
837  return jjPLUSMINUS_Gen(res,u,v);
838 }

◆ jjPLUSMINUS_Gen()

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

Definition at line 631 of file iparith.cc.

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

◆ jjPLUSPLUS()

static BOOLEAN jjPLUSPLUS ( leftv  ,
leftv  u 
)
static

Definition at line 3428 of file iparith.cc.

3429 {
3430  if (IDTYP((idhdl)u->data)==INT_CMD)
3431  {
3432  int i=IDINT((idhdl)u->data);
3433  if (iiOp==PLUSPLUS) i++;
3434  else i--;
3435  IDDATA((idhdl)u->data)=(char *)(long)i;
3436  return FALSE;
3437  }
3438  return TRUE;
3439 }
@ PLUSPLUS
Definition: grammar.cc:274
#define IDINT(a)
Definition: ipid.h:120

◆ jjpMaxComp()

static BOOLEAN jjpMaxComp ( leftv  res,
leftv  v 
)
static

Definition at line 5238 of file iparith.cc.

5239 {
5240  res->data = (char *)pMaxComp((poly)v->Data());
5241  return FALSE;
5242 }

◆ jjPOWER_BI()

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

Definition at line 569 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 523 of file iparith.cc.

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

◆ jjPOWER_ID()

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

Definition at line 625 of file iparith.cc.

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

◆ jjPOWER_N()

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

Definition at line 585 of file iparith.cc.

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

◆ jjPOWER_P()

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

Definition at line 603 of file iparith.cc.

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

◆ jjPREIMAGE()

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

Definition at line 6045 of file iparith.cc.

6046 {
6047  // handles preimage(r,phi,i) and kernel(r,phi)
6048  idhdl h;
6049  ring rr;
6050  map mapping;
6051  BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6052 
6053  if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6054  {
6055  WerrorS("2nd/3rd arguments must have names");
6056  return TRUE;
6057  }
6058  rr=(ring)u->Data();
6059  const char *ring_name=u->Name();
6060  if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6061  {
6062  if (h->typ==MAP_CMD)
6063  {
6064  mapping=IDMAP(h);
6065  idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6066  if ((preim_ring==NULL)
6067  || (IDRING(preim_ring)!=currRing))
6068  {
6069  Werror("preimage ring `%s` is not the basering",mapping->preimage);
6070  return TRUE;
6071  }
6072  }
6073  else if (h->typ==IDEAL_CMD)
6074  {
6075  mapping=IDMAP(h);
6076  }
6077  else
6078  {
6079  Werror("`%s` is no map nor ideal",IDID(h));
6080  return TRUE;
6081  }
6082  }
6083  else
6084  {
6085  Werror("`%s` is not defined in `%s`",v->name,ring_name);
6086  return TRUE;
6087  }
6088  ideal image;
6089  if (kernel_cmd) image=idInit(1,1);
6090  else
6091  {
6092  if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6093  {
6094  if (h->typ==IDEAL_CMD)
6095  {
6096  image=IDIDEAL(h);
6097  }
6098  else
6099  {
6100  Werror("`%s` is no ideal",IDID(h));
6101  return TRUE;
6102  }
6103  }
6104  else
6105  {
6106  Werror("`%s` is not defined in `%s`",w->name,ring_name);
6107  return TRUE;
6108  }
6109  }
6110  if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6111  || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6112  {
6113  WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6114  }
6115  res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6116  if (kernel_cmd) idDelete(&image);
6117  return (res->data==NULL/* is of type ideal, should not be NULL*/);
6118 }
#define IDMAP(a)
Definition: ipid.h:130
#define IDIDEAL(a)
Definition: ipid.h:128
#define IDID(a)
Definition: ipid.h:117
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition: preimage.cc:61
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
@ KERNEL_CMD
Definition: tok.h:107

◆ jjPREIMAGE_R()

static BOOLEAN jjPREIMAGE_R ( leftv  res,
leftv  v 
)
static

Definition at line 4556 of file iparith.cc.

4557 {
4558  map mapping=(map)v->Data();
4559  syMake(res,omStrDup(mapping->preimage));
4560  return FALSE;
4561 }

◆ jjPRIME()

static BOOLEAN jjPRIME ( leftv  res,
leftv  v 
)
static

Definition at line 4562 of file iparith.cc.

4563 {
4564  int i = IsPrime((int)(long)(v->Data()));
4565  res->data = (char *)(long)(i > 1 ? i : 2);
4566  return FALSE;
4567 }
int IsPrime(int p)
Definition: prime.cc:61

◆ jjPROC()

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

Definition at line 1527 of file iparith.cc.

1528 {
1529  void *d;
1530  Subexpr e;
1531  int typ;
1532  BOOLEAN t=FALSE;
1533  idhdl tmp_proc=NULL;
1534  if ((u->rtyp!=IDHDL)||(u->e!=NULL))
1535  {
1536  tmp_proc=(idhdl)omAlloc0(sizeof(idrec));
1537  tmp_proc->id="_auto";
1538  tmp_proc->typ=PROC_CMD;
1539  tmp_proc->data.pinf=(procinfo *)u->Data();
1540  tmp_proc->ref=1;
1541  d=u->data; u->data=(void *)tmp_proc;
1542  e=u->e; u->e=NULL;
1543  t=TRUE;
1544  typ=u->rtyp; u->rtyp=IDHDL;
1545  }
1546  BOOLEAN sl;
1547  if (u->req_packhdl==currPack)
1548  sl = iiMake_proc((idhdl)u->data,NULL,v);
1549  else
1550  sl = iiMake_proc((idhdl)u->data,u->req_packhdl,v);
1551  if (t)
1552  {
1553  u->rtyp=typ;
1554  u->data=d;
1555  u->e=e;
1556  omFreeSize(tmp_proc,sizeof(idrec));
1557  }
1558  if (sl) return TRUE;
1559  memcpy(res,&iiRETURNEXPR,sizeof(sleftv));
1560  iiRETURNEXPR.Init();
1561  return FALSE;
1562 }
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
sleftv iiRETURNEXPR
Definition: iplib.cc:455
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv sl)
Definition: iplib.cc:485

◆ jjPROC1()

static BOOLEAN jjPROC1 ( leftv  res,
leftv  u 
)
static

Definition at line 3506 of file iparith.cc.

3507 {
3508  return jjPROC(res,u,NULL);
3509 }
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition: iparith.cc:1527

◆ jjPROC3()

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

Definition at line 5550 of file iparith.cc.

5551 {
5553  memcpy(v->next,w,sizeof(sleftv));
5554  memset(w,0,sizeof(sleftv));
5555  return jjPROC(res,u,v);
5556 }

◆ jjPRUNE()

static BOOLEAN jjPRUNE ( leftv  res,
leftv  v 
)
static

Definition at line 4568 of file iparith.cc.

4569 {
4570  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4571  ideal v_id=(ideal)v->Data();
4572  if (w!=NULL)
4573  {
4574  if (!idTestHomModule(v_id,currRing->qideal,w))
4575  {
4576  WarnS("wrong weights");
4577  w=NULL;
4578  // and continue at the non-homog case below
4579  }
4580  else
4581  {
4582  w=ivCopy(w);
4583  intvec **ww=&w;
4584  res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4585  atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4586  return FALSE;
4587  }
4588  }
4589  res->data = (char *)idMinEmbedding(v_id);
4590  return FALSE;
4591 }
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition: ideals.cc:2565

◆ jjQRDS()

static BOOLEAN jjQRDS ( leftv  res,
leftv  INPUT 
)
static

Definition at line 7750 of file iparith.cc.

7751 {
7752  if ((INPUT->Typ() != MATRIX_CMD) ||
7753  (INPUT->next->Typ() != NUMBER_CMD) ||
7754  (INPUT->next->next->Typ() != NUMBER_CMD) ||
7755  (INPUT->next->next->next->Typ() != NUMBER_CMD))
7756  {
7757  WerrorS("expected (matrix, number, number, number) as arguments");
7758  return TRUE;
7759  }
7760  leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
7761  res->data = (char *)qrDoubleShift((matrix)(u->Data()),
7762  (number)(v->Data()),
7763  (number)(w->Data()),
7764  (number)(x->Data()));
7765  return FALSE;
7766 }
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 2845 of file iparith.cc.

2846 {
2847  res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
2848  hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
2849  id_DelMultiples((ideal)(res->data),currRing);
2851  return FALSE;
2852 }
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition: ideals.cc:1479
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i

◆ jjRANDOM()

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

Definition at line 2853 of file iparith.cc.

2854 {
2855  int i=(int)(long)u->Data();
2856  int j=(int)(long)v->Data();
2857  if (j-i <0) {WerrorS("invalid range for random"); return TRUE;}
2858  res->data =(char *)(long)((i > j) ? i : (siRand() % (j-i+1)) + i);
2859  return FALSE;
2860 }
int siRand()
Definition: sirandom.c:41

◆ jjRANDOM_Im()

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

Definition at line 6119 of file iparith.cc.

6120 {
6121  int di, k;
6122  int i=(int)(long)u->Data();
6123  int r=(int)(long)v->Data();
6124  int c=(int)(long)w->Data();
6125  if ((r<=0) || (c<=0)) return TRUE;
6126  intvec *iv = new intvec(r, c, 0);
6127  if (iv->rows()==0)
6128  {
6129  delete iv;
6130  return TRUE;
6131  }
6132  if (i!=0)
6133  {
6134  if (i<0) i = -i;
6135  di = 2 * i + 1;
6136  for (k=0; k<iv->length(); k++)
6137  {
6138  (*iv)[k] = ((siRand() % di) - i);
6139  }
6140  }
6141  res->data = (char *)iv;
6142  return FALSE;
6143 }

◆ jjRANK1()

static BOOLEAN jjRANK1 ( leftv  res,
leftv  v 
)
static

Definition at line 4630 of file iparith.cc.

4631 {
4632  matrix m =(matrix)v->Data();
4633  int rank = luRank(m, 0);
4634  res->data =(char *)(long)rank;
4635  return FALSE;
4636 }
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 2861 of file iparith.cc.

2862 {
2863  matrix m =(matrix)u->Data();
2864  int isRowEchelon = (int)(long)v->Data();
2865  if (isRowEchelon != 1) isRowEchelon = 0;
2866  int rank = luRank(m, isRowEchelon);
2867  res->data =(char *)(long)rank;
2868  return FALSE;
2869 }

◆ jjrCharStr()

static BOOLEAN jjrCharStr ( leftv  res,
leftv  v 
)
static

Definition at line 5210 of file iparith.cc.

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

◆ jjREAD()

static BOOLEAN jjREAD ( leftv  res,
leftv  v 
)
static

Definition at line 4637 of file iparith.cc.

4638 {
4639  return jjREAD2(res,v,NULL);
4640 }
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition: iparith.cc:2870

◆ jjREAD2()

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

Definition at line 2870 of file iparith.cc.

2871 {
2872  si_link l=(si_link)u->Data();
2873  leftv r=slRead(l,v);
2874  if (r==NULL)
2875  {
2876  const char *s;
2877  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
2878  else s=sNoName_fe;
2879  Werror("cannot read from `%s`",s);
2880  return TRUE;
2881  }
2882  memcpy(res,r,sizeof(sleftv));
2884  return FALSE;
2885 }

◆ jjREDUCE3_CID()

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

Definition at line 6381 of file iparith.cc.

6382 {
6383  assumeStdFlag(v);
6384  if (!idIsZeroDim((ideal)v->Data()))
6385  {
6386  Werror("`%s` must be 0-dimensional",v->Name());
6387  return TRUE;
6388  }
6389  res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
6390  (matrix)w->CopyD());
6391  return FALSE;
6392 }
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:178
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1607

◆ jjREDUCE3_CP()

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

Definition at line 6369 of file iparith.cc.

6370 {
6371  assumeStdFlag(v);
6372  if (!idIsZeroDim((ideal)v->Data()))
6373  {
6374  Werror("`%s` must be 0-dimensional",v->Name());
6375  return TRUE;
6376  }
6377  res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
6378  (poly)w->CopyD());
6379  return FALSE;
6380 }

◆ jjREDUCE3_ID()

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

Definition at line 6400 of file iparith.cc.

6401 {
6402  assumeStdFlag(v);
6403  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
6404  0,(int)(long)w->Data());
6405  return FALSE;
6406 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2813

◆ jjREDUCE3_P()

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

Definition at line 6393 of file iparith.cc.

6394 {
6395  assumeStdFlag(v);
6396  res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
6397  0,(int)(long)w->Data());
6398  return FALSE;
6399 }

◆ jjREDUCE4()

static BOOLEAN jjREDUCE4 ( leftv  res,
leftv  u 
)
static

Definition at line 7373 of file iparith.cc.

7374 {
7375  leftv u1=u;
7376  leftv u2=u1->next;
7377  leftv u3=u2->next;
7378  leftv u4=u3->next;
7379  if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
7380  {
7381  int save_d=Kstd1_deg;
7382  Kstd1_deg=(int)(long)u3->Data();
7383  kModW=(intvec *)u4->Data();
7384  BITSET save2;
7385  SI_SAVE_OPT2(save2);
7387  u2->next=NULL;
7388  BOOLEAN r=jjCALL2ARG(res,u);
7389  kModW=NULL;
7390  Kstd1_deg=save_d;
7391  SI_RESTORE_OPT2(save2);
7392  u->next->next=u3;
7393  return r;
7394  }
7395  else
7396  if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7397  (u4->Typ()==INT_CMD))
7398  {
7399  assumeStdFlag(u3);
7400  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7401  {
7402  WerrorS("2nd argument must be a diagonal matrix of units");
7403  return TRUE;
7404  }
7405  res->rtyp=IDEAL_CMD;
7406  res->data=(char*)redNF(
7407  idCopy((ideal)u3->Data()),
7408  idCopy((ideal)u1->Data()),
7409  mp_Copy((matrix)u2->Data(), currRing),
7410  (int)(long)u4->Data()
7411  );
7412  return FALSE;
7413  }
7414  else
7415  if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7416  (u4->Typ()==INT_CMD))
7417  {
7418  assumeStdFlag(u3);
7419  if(!pIsUnit((poly)u2->Data()))
7420  {
7421  WerrorS("2nd argument must be a unit");
7422  return TRUE;
7423  }
7424  res->rtyp=POLY_CMD;
7425  res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
7426  pCopy((poly)u2->Data()),(int)(long)u4->Data());
7427  return FALSE;
7428  }
7429  else
7430  {
7431  Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
7432  Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
7433  Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
7434  return TRUE;
7435  }
7436 }
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition: iparith.cc:6530
int Kstd1_deg
Definition: kstd1.h:47
unsigned si_opt_2
Definition: options.c:6
#define SI_SAVE_OPT2(A)
Definition: options.h:23
#define SI_RESTORE_OPT2(A)
Definition: options.h:26
#define V_DEG_STOP
Definition: options.h:71
#define BITSET
Definition: structs.h:18

◆ jjREDUCE5()

static BOOLEAN jjREDUCE5 ( leftv  res,
leftv  u 
)
static

Definition at line 7437 of file iparith.cc.

7438 {
7439  leftv u1=u;
7440  leftv u2=u1->next;
7441  leftv u3=u2->next;
7442  leftv u4=u3->next;
7443  leftv u5=u4->next;
7444  if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7445  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
7446  {
7447  assumeStdFlag(u3);
7448  if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
7449  {
7450  WerrorS("2nd argument must be a diagonal matrix of units");
7451  return TRUE;
7452  }
7453  res->rtyp=IDEAL_CMD;
7454  res->data=(char*)redNF(
7455  idCopy((ideal)u3->Data()),
7456  idCopy((ideal)u1->Data()),
7457  mp_Copy((matrix)u2->Data(),currRing),
7458  (int)(long)u4->Data(),
7459  (intvec*)u5->Data()
7460  );
7461  return FALSE;
7462  }
7463  else
7464  if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
7465  (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
7466  {
7467  assumeStdFlag(u3);
7468  if(!pIsUnit((poly)u2->Data()))
7469  {
7470  WerrorS("2nd argument must be a unit");
7471  return TRUE;
7472  }
7473  res->rtyp=POLY_CMD;
7474  res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
7475  pCopy((poly)u2->Data()),
7476  (int)(long)u4->Data(),(intvec*)u5->Data());
7477  return FALSE;
7478  }
7479  else
7480  {
7481  Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
7482  Tok2Cmdname(iiOp));
7483  return TRUE;
7484  }
7485 }

◆ jjREDUCE_ID()

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

Definition at line 2894 of file iparith.cc.

2895 {
2896  ideal ui=(ideal)u->Data();
2897  ideal vi=(ideal)v->Data();
2898  if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
2899  assumeStdFlag(v);
2900  res->data = (char *)kNF(vi,currRing->qideal,ui);
2901  return FALSE;
2902 }

◆ jjREDUCE_P()

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

Definition at line 2886 of file iparith.cc.

2887 {
2888  ideal vi=(ideal)v->Data();
2889  if (currRing->qideal!=NULL || vi->ncols>1 || rIsPluralRing(currRing))
2890  assumeStdFlag(v);
2891  res->data = (char *)kNF(vi,currRing->qideal,(poly)u->Data());
2892  return FALSE;
2893 }

◆ jjREGULARITY()

static BOOLEAN jjREGULARITY ( leftv  res,
leftv  v 
)
static

Definition at line 4641 of file iparith.cc.

4642 {
4643  res->data = (char *)(long)iiRegularity((lists)v->Data());
4644  return FALSE;
4645 }
int iiRegularity(lists L)
Definition: ipshell.cc:956

◆ jjREPART()

static BOOLEAN jjREPART ( leftv  res,
leftv  v 
)
static

Definition at line 4646 of file iparith.cc.

4647 {
4648  res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4649  return FALSE;
4650 }
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition: coeffs.h:821

◆ jjRES()

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

Definition at line 2903 of file iparith.cc.

2904 {
2905  int maxl=(int)(long)v->Data();
2906  if (maxl<0)
2907  {
2908  WerrorS("length for res must not be negative");
2909  return TRUE;
2910  }
2911  syStrategy r;
2912  intvec *weights=NULL;
2913  int wmaxl=maxl;
2914  ideal u_id=(ideal)u->Data();
2915 
2916  maxl--;
2917  if (/*(*/ maxl==-1 /*)*/) /*&& (iiOp!=MRES_CMD)*/
2918  {
2919  maxl = currRing->N-1+2*(iiOp==MRES_CMD);
2920  if (currRing->qideal!=NULL)
2921  {
2922  Warn(
2923  "full resolution in a qring may be infinite, setting max length to %d",
2924  maxl+1);
2925  }
2926  }
2927  weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
2928  if (weights!=NULL)
2929  {
2930  if (!idTestHomModule(u_id,currRing->qideal,weights))
2931  {
2932  WarnS("wrong weights given:");weights->show();PrintLn();
2933  weights=NULL;
2934  }
2935  }
2936  intvec *ww=NULL;
2937  int add_row_shift=0;
2938  if (weights!=NULL)
2939  {
2940  ww=ivCopy(weights);
2941  add_row_shift = ww->min_in();
2942  (*ww) -= add_row_shift;
2943  }
2944  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
2945  {
2946  r=syResolution(u_id,maxl, ww, iiOp==MRES_CMD);
2947  }
2948  else if (iiOp==SRES_CMD)
2949  // r=sySchreyerResolvente(u_id,maxl+1,&l);
2950  r=sySchreyer(u_id,maxl+1);
2951  else if (iiOp == LRES_CMD)
2952  {
2953  int dummy;
2954  if((currRing->qideal!=NULL)||
2955  (!idHomIdeal (u_id,NULL)))
2956  {
2957  WerrorS
2958  ("`lres` not implemented for inhomogeneous input or qring");
2959  return TRUE;
2960  }
2961  if(currRing->N == 1)
2962  WarnS("the current implementation of `lres` may not work in the case of a single variable");
2963  r=syLaScala3(u_id,&dummy);
2964  }
2965  else if (iiOp == KRES_CMD)
2966  {
2967  int dummy;
2968  if((currRing->qideal!=NULL)||
2969  (!idHomIdeal (u_id,NULL)))
2970  {
2971  WerrorS
2972  ("`kres` not implemented for inhomogeneous input or qring");
2973  return TRUE;
2974  }
2975  r=syKosz(u_id,&dummy);
2976  }
2977  else
2978  {
2979  int dummy;
2980  if((currRing->qideal!=NULL)||
2981  (!idHomIdeal (u_id,NULL)))
2982  {
2983  WerrorS
2984  ("`hres` not implemented for inhomogeneous input or qring");
2985  return TRUE;
2986  }
2987  ideal u_id_copy=idCopy(u_id);
2988  idSkipZeroes(u_id_copy);
2989  r=syHilb(u_id_copy,&dummy);
2990  idDelete(&u_id_copy);
2991  }
2992  if (r==NULL) return TRUE;
2993  if (r->list_length>wmaxl)
2994  {
2995  for(int i=wmaxl-1;i>=r->list_length;i--)
2996  {
2997  if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
2998  if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
2999  }
3000  }
3001  r->list_length=wmaxl;
3002  res->data=(void *)r;
3003  if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
3004  if ((r->weights!=NULL) && (r->weights[0]!=NULL))
3005  {
3006  ww=ivCopy(r->weights[0]);
3007  if (weights!=NULL) (*ww) += add_row_shift;
3008  atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
3009  }
3010  else
3011  {
3012  if (weights!=NULL)
3013  {
3014  atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
3015  }
3016  }
3017 
3018  // test the La Scala case' output
3019  assume( ((iiOp == LRES_CMD) || (iiOp == HRES_CMD)) == (r->syRing != NULL) );
3020  assume( (r->syRing != NULL) == (r->resPairs != NULL) );
3021 
3022  if(iiOp != HRES_CMD)
3023  assume( (r->minres != NULL) || (r->fullres != NULL) ); // is wrong for HRES_CMD...
3024  else
3025  assume( (r->orderedRes != NULL) || (r->res != NULL) ); // analog for hres...
3026 
3027  return FALSE;
3028 }
void show(int mat=0, int spaces=0) const
Definition: intvec.cc:149
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
syStrategy syResolution(ideal arg, int maxlength, intvec *w, BOOLEAN minim)
Definition: syz.cc:614
syStrategy syHilb(ideal arg, int *length)
Definition: syz2.cc:952
syStrategy sySchreyer(ideal arg, int maxlength)
Definition: syz0.cc:1019
ring syRing
Definition: syz.h:56
resolvente minres
Definition: syz.h:58
syStrategy syKosz(ideal arg, int *length)
Definition: syz3.cc:1764
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:2434
@ 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:180
@ RES_CMD
Definition: tok.h:167

◆ jjRES3()

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

Definition at line 6408 of file iparith.cc.

6409 {
6410  int maxl=(int)v->Data();
6411  ideal u_id=(ideal)u->Data();
6412  int l=0;
6413  resolvente r;
6414  intvec **weights=NULL;
6415  int wmaxl=maxl;
6416  maxl--;
6417  if ((maxl==-1) && (iiOp!=MRES_CMD))
6418  maxl = currRing->N-1;
6419  if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
6420  {
6421  intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6422  if (iv!=NULL)
6423  {
6424  l=1;
6425  if (!idTestHomModule(u_id,currRing->qideal,iv))
6426  {
6427  WarnS("wrong weights");
6428  iv=NULL;
6429  }
6430  else
6431  {
6432  weights = (intvec**)omAlloc0Bin(char_ptr_bin);
6433  weights[0] = ivCopy(iv);
6434  }
6435  }
6436  r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
6437  }
6438  else
6439  r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
6440  if (r==NULL) return TRUE;
6441  int t3=u->Typ();
6442  iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
6443  return FALSE;
6444 }
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition: ipshell.cc:766
omBin char_ptr_bin
Definition: ring.cc:45
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition: syz.cc:390
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:856

◆ jjRESERVED0()

static BOOLEAN jjRESERVED0 ( leftv  ,
leftv   
)
static

Definition at line 7486 of file iparith.cc.

7487 {
7488  unsigned i=1;
7489  unsigned nCount = (sArithBase.nCmdUsed-1)/3;
7490  if((3*nCount)<sArithBase.nCmdUsed) nCount++;
7491  //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
7492  // sArithBase.nCmdAllocated);
7493  for(i=0; i<nCount; i++)
7494  {
7495  Print("%-20s",sArithBase.sCmds[i+1].name);
7496  if(i+1+nCount<sArithBase.nCmdUsed)
7497  Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
7498  if(i+1+2*nCount<sArithBase.nCmdUsed)
7499  Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
7500  //if ((i%3)==1) PrintLn();
7501  PrintLn();
7502  }
7503  PrintLn();
7505  return FALSE;
7506 }
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:209

◆ jjRESERVEDNAME()

static BOOLEAN jjRESERVEDNAME ( leftv  res,
leftv  v 
)
static

Definition at line 4608 of file iparith.cc.

4609 {
4610  char *s= (char *)v->Data();
4611  // try system keywords
4612  for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4613  {
4614  //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4615  if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4616  {
4617  res->data = (char *)1;
4618  return FALSE;
4619  }
4620  }
4621  // try blackbox names
4622  int id;
4623  blackboxIsCmd(s,id);
4624  if (id>0)
4625  {
4626  res->data = (char *)1;
4627  }
4628  return FALSE;
4629 }

◆ jjRESTART()

static BOOLEAN jjRESTART ( leftv  ,
leftv  u 
)
static

Definition at line 7879 of file iparith.cc.

7880 {
7881  int c=(int)(long)u->Data();
7882  switch(c)
7883  {
7884  case 0:{
7885  PrintS("delete all variables\n");
7886  killlocals(0);
7887  WerrorS("restarting...");
7888  break;
7889  };
7890  default: WerrorS("not implemented");
7891  }
7892  return FALSE;
7893 }
void killlocals(int v)
Definition: ipshell.cc:378

◆ jjRING3()

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

Definition at line 6446 of file iparith.cc.

6447 {
6448  res->data=(void *)rInit(u,v,w);
6449  return (res->data==NULL);
6450 }
ring rInit(leftv pn, leftv rv, leftv ord)
Definition: ipshell.cc:5543

◆ jjRING_1()

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

Definition at line 1581 of file iparith.cc.

1582 {
1583  u->next=(leftv)omAlloc(sizeof(sleftv));
1584  memcpy(u->next,v,sizeof(sleftv));
1585  memset(v,0,sizeof(sleftv));
1586  BOOLEAN bo=iiExprArithM(res,u,'[');
1587  u->next=NULL;
1588  return bo;
1589 }

◆ jjRING_2()

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

Definition at line 5557 of file iparith.cc.

5558 {
5559  u->next=(leftv)omAlloc(sizeof(sleftv));
5560  memcpy(u->next,v,sizeof(sleftv));
5561  memset(v,0,sizeof(sleftv));
5562  u->next->next=(leftv)omAlloc(sizeof(sleftv));
5563  memcpy(u->next->next,w,sizeof(sleftv));
5564  memset(w,0,sizeof(sleftv));
5565  BOOLEAN bo=iiExprArithM(res,u,'[');
5566  u->next=NULL;
5567  return bo;
5568 }

◆ jjRING_LIST()

static BOOLEAN jjRING_LIST ( leftv  res,
leftv  v 
)
static

Definition at line 4674 of file iparith.cc.

4675 {
4676  ring r=(ring)v->Data();
4677  if (r!=NULL)
4678  res->data = (char *)rDecompose_list_cf((ring)v->Data());
4679  return (r==NULL)||(res->data==NULL);
4680 }
lists rDecompose_list_cf(const ring r)
Definition: ipshell.cc:1910

◆ jjRING_PL()

static BOOLEAN jjRING_PL ( leftv  res,
leftv  a 
)
static

Definition at line 7850 of file iparith.cc.

7851 {
7852  //Print("construct ring\n");
7853  if (a->Typ()!=CRING_CMD)
7854  {
7855  WerrorS("expected `cring` [ `id` ... ]");
7856  return TRUE;
7857  }
7858  assume(a->next!=NULL);
7859  leftv names=a->next;
7860  int N=names->listLength();
7861  char **n=(char**)omAlloc0(N*sizeof(char*));
7862  for(int i=0; i<N;i++,names=names->next)
7863  {
7864  n[i]=(char *)names->Name();
7865  }
7866  coeffs cf=(coeffs)a->CopyD();
7867  res->data=rDefault(cf,N,n, ringorder_dp);
7868  omFreeSize(n,N*sizeof(char*));
7869  return FALSE;
7870 }
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:103
@ ringorder_dp
Definition: ring.h:85
@ CRING_CMD
Definition: tok.h:56

◆ jjRINGLIST()

static BOOLEAN jjRINGLIST ( leftv  res,
leftv  v 
)
static

Definition at line 4651 of file iparith.cc.

4652 {
4653  ring r=(ring)v->Data();
4654  if (r!=NULL)
4655  {
4656  res->data = (char *)rDecompose((ring)v->Data());
4657  if (res->data!=NULL)
4658  {
4659  long mm=r->bitmask/2;
4660  if (mm>MAX_INT_VAL) mm=MAX_INT_VAL;
4661  atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4662  return FALSE;
4663  }
4664  }
4665  return TRUE;
4666 }
lists rDecompose(const ring r)
Definition: ipshell.cc:2041
const int MAX_INT_VAL
Definition: mylimits.h:12

◆ jjRINGLIST_C()

static BOOLEAN jjRINGLIST_C ( leftv  res,
leftv  v 
)
static

Definition at line 4667 of file iparith.cc.

4668 {
4669  coeffs r=(coeffs)v->Data();
4670  if (r!=NULL)
4671  return rDecompose_CF(res,r);
4672  return TRUE;
4673 }
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition: ipshell.cc:1839

◆ jjrOrdStr()

static BOOLEAN jjrOrdStr ( leftv  res,
leftv  v 
)
static

Definition at line 5253 of file iparith.cc.

5254 {
5255  res->data = rOrdStr((ring)v->Data());
5256  return FALSE;
5257 }
char * rOrdStr(ring r)
Definition: ring.cc:513

◆ jjROWS()

static BOOLEAN jjROWS ( leftv  res,
leftv  v 
)
static

Definition at line 4681 of file iparith.cc.

4682 {
4683  ideal i = (ideal)v->Data();
4684  res->data = (char *)i->rank;
4685  return FALSE;
4686 }

◆ jjROWS_BIM()

static BOOLEAN jjROWS_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4687 of file iparith.cc.

4688 {
4689  res->data = (char *)(long)((bigintmat*)(v->Data()))->rows();
4690  return FALSE;
4691 }

◆ jjROWS_IV()

static BOOLEAN jjROWS_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4692 of file iparith.cc.

4693 {
4694  res->data = (char *)(long)((intvec*)(v->Data()))->rows();
4695  return FALSE;
4696 }

◆ jjRPAR()

static BOOLEAN jjRPAR ( leftv  res,
leftv  v 
)
static

Definition at line 4697 of file iparith.cc.

4698 {
4699  res->data = (char *)(long)rPar(((ring)v->Data()));
4700  return FALSE;
4701 }

◆ jjrParStr()

static BOOLEAN jjrParStr ( leftv  res,
leftv  v 
)
static

Definition at line 5263 of file iparith.cc.

5264 {
5265  res->data = rParStr((ring)v->Data());
5266  return FALSE;
5267 }
char * rParStr(ring r)
Definition: ring.cc:624

◆ jjRSUM()

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

Definition at line 3055 of file iparith.cc.

3056 {
3057  ring r;
3058  int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3059  res->data = (char *)r;
3060  return (i==-1);
3061 }
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1306

◆ jjrVarStr()

static BOOLEAN jjrVarStr ( leftv  res,
leftv  v 
)
static

Definition at line 5258 of file iparith.cc.

5259 {
5260  res->data = rVarStr((ring)v->Data());
5261  return FALSE;
5262 }
char * rVarStr(ring r)
Definition: ring.cc:598

◆ jjSBA()

static BOOLEAN jjSBA ( leftv  res,
leftv  v 
)
static

Definition at line 4744 of file iparith.cc.

4745 {
4746  ideal result;
4747  ideal v_id=(ideal)v->Data();
4748  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4749  tHomog hom=testHomog;
4750  if (w!=NULL)
4751  {
4752  if (!idTestHomModule(v_id,currRing->qideal,w))
4753  {
4754  WarnS("wrong weights");
4755  w=NULL;
4756  }
4757  else
4758  {
4759  hom=isHomog;
4760  w=ivCopy(w);
4761  }
4762  }
4763  result=kSba(v_id,currRing->qideal,hom,&w,1,0);
4765  res->data = (char *)result;
4767  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4768  return FALSE;
4769 }
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:2274
#define TEST_OPT_DEGBOUND
Definition: options.h:112

◆ jjSBA_1()

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

Definition at line 4770 of file iparith.cc.

4771 {
4772  ideal result;
4773  ideal v_id=(ideal)v->Data();
4774  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4775  tHomog hom=testHomog;
4776  if (w!=NULL)
4777  {
4778  if (!idTestHomModule(v_id,currRing->qideal,w))
4779  {
4780  WarnS("wrong weights");
4781  w=NULL;
4782  }
4783  else
4784  {
4785  hom=isHomog;
4786  w=ivCopy(w);
4787  }
4788  }
4789  result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0);
4791  res->data = (char *)result;
4793  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4794  return FALSE;
4795 }

◆ jjSBA_2()

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

Definition at line 4796 of file iparith.cc.

4797 {
4798  ideal result;
4799  ideal v_id=(ideal)v->Data();
4800  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4801  tHomog hom=testHomog;
4802  if (w!=NULL)
4803  {
4804  if (!idTestHomModule(v_id,currRing->qideal,w))
4805  {
4806  WarnS("wrong weights");
4807  w=NULL;
4808  }
4809  else
4810  {
4811  hom=isHomog;
4812  w=ivCopy(w);
4813  }
4814  }
4815  result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data());
4817  res->data = (char *)result;
4819  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4820  return FALSE;
4821 }

◆ jjSetRing()

static BOOLEAN jjSetRing ( leftv  ,
leftv  u 
)
static

Definition at line 3485 of file iparith.cc.

3486 {
3487  if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3488  else
3489  {
3490  ring r=(ring)u->Data();
3491  idhdl h=rFindHdl(r,NULL);
3492  if (h==NULL)
3493  {
3494  char name_buffer[100];
3495  static int ending=1000000;
3496  ending++;
3497  sprintf(name_buffer, "PYTHON_RING_VAR%d",ending);
3498  h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3499  IDRING(h)=r;
3500  r->ref++;
3501  }
3502  rSetHdl(h);
3503  }
3504  return FALSE;
3505 }
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1595
void rSetHdl(idhdl h)
Definition: ipshell.cc:5050

◆ jjSIMPL_ID()

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

Definition at line 3069 of file iparith.cc.

3070 {
3071  int sw = (int)(long)v->Data();
3072  // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3073  ideal id = (ideal)u->CopyD(IDEAL_CMD);
3074  if (sw & SIMPL_LMDIV)
3075  {
3076  id_DelDiv(id,currRing);
3077  }
3078  if (sw & SIMPL_LMEQ)
3079  {
3081  }
3082  if (sw & SIMPL_MULT)
3083  {
3085  }
3086  else if(sw & SIMPL_EQU)
3087  {
3088  id_DelEquals(id,currRing);
3089  }
3090  if (sw & SIMPL_NULL)
3091  {
3092  idSkipZeroes(id);
3093  }
3094  if (sw & SIMPL_NORM)
3095  {
3096  id_Norm(id,currRing);
3097  }
3098  if (sw & SIMPL_NORMALIZE)
3099  {
3100  id_Normalize(id,currRing);
3101  }
3102  res->data = (char * )id;
3103  return FALSE;
3104 }
#define SIMPL_EQU
Definition: iparith.cc:3066
#define SIMPL_NORM
Definition: iparith.cc:3068
#define SIMPL_LMEQ
Definition: iparith.cc:3064
#define SIMPL_NULL
Definition: iparith.cc:3067
#define SIMPL_MULT
Definition: iparith.cc:3065
#define SIMPL_NORMALIZE
Definition: iparith.cc:3062
#define SIMPL_LMDIV
Definition: iparith.cc:3063
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.

◆ jjSIMPL_P()

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

Definition at line 3164 of file iparith.cc.

3165 {
3166  int sw = (int)(long)v->Data();
3167  // CopyD for POLY_CMD and VECTOR_CMD are identical:
3168  poly p = (poly)u->CopyD(POLY_CMD);
3169  if (sw & SIMPL_NORM)
3170  {
3171  pNorm(p);
3172  }
3173  if (sw & SIMPL_NORMALIZE)
3174  {
3176  }
3177  res->data = (char * )p;
3178  return FALSE;
3179 }
void p_Normalize(poly p, const ring r)
Definition: p_polys.cc:3709
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:349

◆ jjSLIM_GB()

static BOOLEAN jjSLIM_GB ( leftv  res,
leftv  u 
)
static

Definition at line 4702 of file iparith.cc.

4703 {
4704  const bool bIsSCA = rIsSCA(currRing);
4705 
4706  if ((currRing->qideal!=NULL) && !bIsSCA)
4707  {
4708  WerrorS("qring not supported by slimgb at the moment");
4709  return TRUE;
4710  }
4712  {
4713  WerrorS("ordering must be global for slimgb");
4714  return TRUE;
4715  }
4717  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4718  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
4719  // tHomog hom=testHomog;
4720  ideal u_id=(ideal)u->Data();
4721  if (w!=NULL)
4722  {
4723  if (!idTestHomModule(u_id,currRing->qideal,w))
4724  {
4725  WarnS("wrong weights");
4726  w=NULL;
4727  }
4728  else
4729  {
4730  w=ivCopy(w);
4731  // hom=isHomog;
4732  }
4733  }
4734 
4735  assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
4736  res->data=(char *)t_rep_gb(currRing,
4737  u_id,u_id->rank);
4738  //res->data=(char *)t_rep_gb(currRing, u_id);
4739 
4741  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4742  return FALSE;
4743 }
static bool rIsSCA(const ring r)
Definition: nc.h:198
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:507
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition: tgb.cc:3520

◆ jjSort_Id()

static BOOLEAN jjSort_Id ( leftv  res,
leftv  v 
)
static

Definition at line 4850 of file iparith.cc.

4851 {
4852  res->data = (char *)idSort((ideal)v->Data());
4853  return FALSE;
4854 }
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:186

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv  ,
leftv  arg 
)

Definition at line 9360 of file iparith.cc.

9361 {
9362  lists l=(lists)arg->Data();
9363  if (l->nr>0)
9364  {
9365  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
9366  }
9367  return FALSE;
9368 }
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition: iparith.cc:9319

◆ jjSQR_FREE()

static BOOLEAN jjSQR_FREE ( leftv  res,
leftv  u 
)
static

Definition at line 4855 of file iparith.cc.

4856 {
4858  intvec *v=NULL;
4859  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
4860  if (f==NULL) return TRUE;
4861  ivTest(v);
4863  l->Init(2);
4864  l->m[0].rtyp=IDEAL_CMD;
4865  l->m[0].data=(void *)f;
4866  l->m[1].rtyp=INTVEC_CMD;
4867  l->m[1].data=(void *)v;
4868  res->data=(void *)l;
4869  return FALSE;
4870 }
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition: clapsing.cc:1225

◆ jjSQR_FREE2()

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

Definition at line 3106 of file iparith.cc.

3107 {
3108  intvec *v=NULL;
3109  int sw=(int)(long)dummy->Data();
3110  int fac_sw=sw;
3111  if (sw<0) fac_sw=1;
3113  ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3114  if (f==NULL)
3115  return TRUE;
3116  switch(sw)
3117  {
3118  case 0:
3119  case 2:
3120  {
3122  l->Init(2);
3123  l->m[0].rtyp=IDEAL_CMD;
3124  l->m[0].data=(void *)f;
3125  l->m[1].rtyp=INTVEC_CMD;
3126  l->m[1].data=(void *)v;
3127  res->data=(void *)l;
3128  res->rtyp=LIST_CMD;
3129  return FALSE;
3130  }
3131  case 1:
3132  res->data=(void *)f;
3133  return FALSE;
3134  case 3:
3135  {
3136  poly p=f->m[0];
3137  int i=IDELEMS(f);
3138  f->m[0]=NULL;
3139  while(i>1)
3140  {
3141  i--;
3142  p=pMult(p,f->m[i]);
3143  f->m[i]=NULL;
3144  }
3145  res->data=(void *)p;
3146  res->rtyp=POLY_CMD;
3147  }
3148  return FALSE;
3149  }
3150  WerrorS("invalid switch");
3151  return FALSE;
3152 }

◆ jjSTATUS2()

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

Definition at line 3153 of file iparith.cc.

3154 {
3155  res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3156  return FALSE;
3157 }

◆ jjSTATUS2L()

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

Definition at line 3158 of file iparith.cc.

3159 {
3160  res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3161  //return (res->data== (void*)(long)-2);
3162  return FALSE;
3163 }

◆ jjSTATUS3()

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

Definition at line 6451 of file iparith.cc.

6452 {
6453  int yes;
6454  jjSTATUS2(res, u, v);
6455  yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
6456  omFree((ADDRESS) res->data);
6457  res->data = (void *)(long)yes;
6458  return FALSE;
6459 }
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition: iparith.cc:3153

◆ jjSTATUS_M()

static BOOLEAN jjSTATUS_M ( leftv  res,
leftv  v 
)
static

Definition at line 7692 of file iparith.cc.

7693 {
7694  if ((v->Typ() != LINK_CMD) ||
7695  (v->next->Typ() != STRING_CMD) ||
7696  (v->next->next->Typ() != STRING_CMD) ||
7697  (v->next->next->next->Typ() != INT_CMD))
7698  return TRUE;
7699  jjSTATUS3(res, v, v->next, v->next->next);
7700 #if defined(HAVE_USLEEP)
7701  if (((long) res->data) == 0L)
7702  {
7703  int i_s = (int)(long) v->next->next->next->Data();
7704  if (i_s > 0)
7705  {
7706  usleep((int)(long) v->next->next->next->Data());
7707  jjSTATUS3(res, v, v->next, v->next->next);
7708  }
7709  }
7710 #elif defined(HAVE_SLEEP)
7711  if (((int) res->data) == 0)
7712  {
7713  int i_s = (int) v->next->next->next->Data();
7714  if (i_s > 0)
7715  {
7716  si_sleep((is - 1)/1000000 + 1);
7717  jjSTATUS3(res, v, v->next, v->next->next);
7718  }
7719  }
7720 #endif
7721  return FALSE;
7722 }
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6451
@ LINK_CMD
Definition: tok.h:117

◆ jjSTD()

static BOOLEAN jjSTD ( leftv  res,
leftv  v 
)
static

Definition at line 4822 of file iparith.cc.

4823 {
4825  WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
4826  ideal result;
4827  ideal v_id=(ideal)v->Data();
4828  intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4829  tHomog hom=testHomog;
4830  if (w!=NULL)
4831  {
4832  if (!idTestHomModule(v_id,currRing->qideal,w))
4833  {
4834  WarnS("wrong weights");
4835  w=NULL;
4836  }
4837  else
4838  {
4839  hom=isHomog;
4840  w=ivCopy(w);
4841  }
4842  }
4843  result=kStd(v_id,currRing->qideal,hom,&w);
4845  res->data = (char *)result;
4847  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
4848  return FALSE;
4849 }
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:2096

◆ jjSTD_1()

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

Definition at line 3206 of file iparith.cc.

3207 {
3208  ideal result;
3209  assumeStdFlag(u);
3210  ideal i1=(ideal)(u->Data());
3211  ideal i0;
3212  int r=v->Typ();
3213  if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3214  {
3215  i0=idInit(1,i1->rank); // TODO: rank is wrong (if v is a vector!)
3216  i0->m[0]=(poly)v->Data();
3217  int ii0=idElem(i0); /* size of i0 */
3218  i1=idSimpleAdd(i1,i0); //
3219  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3220  idDelete(&i0);
3221  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3222  tHomog hom=testHomog;
3223 
3224  if (w!=NULL)
3225  {
3226  if (!idTestHomModule(i1,currRing->qideal,w))
3227  {
3228  // no warnung: this is legal, if i in std(i,p)
3229  // is homogeneous, but p not
3230  w=NULL;
3231  }
3232  else
3233  {
3234  w=ivCopy(w);
3235  hom=isHomog;
3236  }
3237  }
3238  BITSET save1;
3239  SI_SAVE_OPT1(save1);
3241  /* ii0 appears to be the position of the first element of il that
3242  does not belong to the old SB ideal */
3243  result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii0);
3244  SI_RESTORE_OPT1(save1);
3245  idDelete(&i1);
3247  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3248  res->data = (char *)result;
3249  }
3250  else /*IDEAL/MODULE*/
3251  {
3252  i0=(ideal)v->CopyD();
3253  int ii0=idElem(i0); /* size of i0 */
3254  i1=idSimpleAdd(i1,i0); //
3255  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3256  idDelete(&i0);
3257  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3258  tHomog hom=testHomog;
3259 
3260  if (w!=NULL)
3261  {
3262  if (!idTestHomModule(i1,currRing->qideal,w))
3263  {
3264  // no warnung: this is legal, if i in std(i,p)
3265  // is homogeneous, but p not
3266  w=NULL;
3267  }
3268  else
3269  {
3270  w=ivCopy(w);
3271  hom=isHomog;
3272  }
3273  }
3274  if (ii0*4 >= 3*IDELEMS(i1)) // MAGIC: add few poly to large SB: 3/4
3275  {
3276  BITSET save1;
3277  SI_SAVE_OPT1(save1);
3279  /* ii0 appears to be the position of the first element of il that
3280  does not belong to the old SB ideal */
3281  result=kStd(i1,currRing->qideal,hom,&w,NULL,0,ii0);
3282  SI_RESTORE_OPT1(save1);
3283  }
3284  else
3285  {
3286  result=kStd(i1,currRing->qideal,hom,&w);
3287  }
3288  idDelete(&i1);
3290  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3291  res->data = (char *)result;
3292  }
3294  return FALSE;
3295 }
unsigned si_opt_1
Definition: options.c:5
#define OPT_SB_1
Definition: options.h:94
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define SI_RESTORE_OPT1(A)
Definition: options.h:25

◆ jjSTD_HILB()

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

Definition at line 3180 of file iparith.cc.

3181 {
3182  ideal result;
3183  intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3184  tHomog hom=testHomog;
3185  ideal u_id=(ideal)(u->Data());
3186  if (w!=NULL)
3187  {
3188  if (!idTestHomModule(u_id,currRing->qideal,w))
3189  {
3190  WarnS("wrong weights:");w->show();PrintLn();
3191  w=NULL;
3192  }
3193  else
3194  {
3195  w=ivCopy(w);
3196  hom=isHomog;
3197  }
3198  }
3199  result=kStd(u_id,currRing->qideal,hom,&w,(intvec *)v->Data());
3201  res->data = (char *)result;
3202  setFlag(res,FLAG_STD);
3203  if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3204  return FALSE;
3205 }

◆ jjSTD_HILB_W()

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

Definition at line 6460 of file iparith.cc.

6461 {
6462  intvec *vw=(intvec *)w->Data(); // weights of vars
6463  if (vw->length()!=currRing->N)
6464  {
6465  Werror("%d weights for %d variables",vw->length(),currRing->N);
6466  return TRUE;
6467  }
6468  ideal result;
6469  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6470  tHomog hom=testHomog;
6471  ideal u_id=(ideal)(u->Data());
6472  if (ww!=NULL)
6473  {
6474  if (!idTestHomModule(u_id,currRing->qideal,ww))
6475  {
6476  WarnS("wrong weights");
6477  ww=NULL;
6478  }
6479  else
6480  {
6481  ww=ivCopy(ww);
6482  hom=isHomog;
6483  }
6484  }
6485  result=kStd(u_id,
6486  currRing->qideal,
6487  hom,
6488  &ww, // module weights
6489  (intvec *)v->Data(), // hilbert series
6490  0,0, // syzComp, newIdeal
6491  vw); // weights of vars
6493  res->data = (char *)result;
6494  setFlag(res,FLAG_STD);
6495  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
6496  return FALSE;
6497 }

◆ jjSTD_HILB_WP()

static BOOLEAN jjSTD_HILB_WP ( leftv  res,
leftv  INPUT 
)
static

Definition at line 7767 of file iparith.cc.

7768 { ideal result;
7769  leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
7770  leftv v = u->next; /* one additional polynomial or ideal */
7771  leftv h = v->next; /* Hilbert vector */
7772  leftv w = h->next; /* weight vector */
7773  assumeStdFlag(u);
7774  ideal i1=(ideal)(u->Data());
7775  ideal i0;
7776  if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
7777  || (h->Typ()!=INTVEC_CMD)
7778  || (w->Typ()!=INTVEC_CMD))
7779  {
7780  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
7781  return TRUE;
7782  }
7783  intvec *vw=(intvec *)w->Data(); // weights of vars
7784  /* merging std_hilb_w and std_1 */
7785  if (vw->length()!=currRing->N)
7786  {
7787  Werror("%d weights for %d variables",vw->length(),currRing->N);
7788  return TRUE;
7789  }
7790  int r=v->Typ();
7791  BOOLEAN cleanup_i0=FALSE;
7792  if ((r==POLY_CMD) ||(r==VECTOR_CMD))
7793  {
7794  i0=idInit(1,i1->rank);
7795  i0->m[0]=(poly)v->Data();
7796  cleanup_i0=TRUE;
7797  }
7798  else if (r==IDEAL_CMD)/* IDEAL */
7799  {
7800  i0=(ideal)v->Data();
7801  }
7802  else
7803  {
7804  WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
7805  return TRUE;
7806  }
7807  int ii0=idElem(i0);
7808  i1 = idSimpleAdd(i1,i0);
7809  if (cleanup_i0)
7810  {
7811  memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
7812  idDelete(&i0);
7813  }
7814  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7815  tHomog hom=testHomog;
7816  /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
7817  if (ww!=NULL)
7818  {
7819  if (!idTestHomModule(i1,currRing->qideal,ww))
7820  {
7821  WarnS("wrong weights");
7822  ww=NULL;
7823  }
7824  else
7825  {
7826  ww=ivCopy(ww);
7827  hom=isHomog;
7828  }
7829  }
7830  BITSET save1;
7831  SI_SAVE_OPT1(save1);
7833  result=kStd(i1,
7834  currRing->qideal,
7835  hom,
7836  &ww, // module weights
7837  (intvec *)h->Data(), // hilbert series
7838  0, // syzComp, whatever it is...
7839  IDELEMS(i1)-ii0, // new ideal
7840  vw); // weights of vars
7841  SI_RESTORE_OPT1(save1);
7842  idDelete(&i1);
7844  res->data = (char *)result;
7846  if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7847  return FALSE;
7848 }

◆ jjSTRING_PL()

static BOOLEAN jjSTRING_PL ( leftv  res,
leftv  v 
)
static

Definition at line 7507 of file iparith.cc.

7508 {
7509  if (v == NULL)
7510  {
7511  res->data = omStrDup("");
7512  return FALSE;
7513  }
7514  int n = v->listLength();
7515  if (n == 1)
7516  {
7517  res->data = v->String();
7518  return FALSE;
7519  }
7520 
7521  char** slist = (char**) omAlloc(n*sizeof(char*));
7522  int i, j;
7523 
7524  for (i=0, j=0; i<n; i++, v = v ->next)
7525  {
7526  slist[i] = v->String();
7527  assume(slist[i] != NULL);
7528  j+=strlen(slist[i]);
7529  }
7530  char* s = (char*) omAlloc((j+1)*sizeof(char));
7531  *s='\0';
7532  for (i=0;i<n;i++)
7533  {
7534  strcat(s, slist[i]);
7535  omFree(slist[i]);
7536  }
7537  omFreeSize(slist, n*sizeof(char*));
7538  res->data = s;
7539  return FALSE;
7540 }

◆ jjstrlen()

static BOOLEAN jjstrlen ( leftv  res,
leftv  v 
)
static

Definition at line 5185 of file iparith.cc.

5186 {
5187  res->data = (char *)strlen((char *)v->Data());
5188  return FALSE;
5189 }

◆ jjSUBST_Id()

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

Definition at line 6220 of file iparith.cc.

6221 {
6222  int ringvar;
6223  poly monomexpr;
6224  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6225  if (nok) return TRUE;
6226  ideal id=(ideal)u->Data();
6227  if (ringvar>0)
6228  {
6229  BOOLEAN overflow=FALSE;
6230  if (monomexpr!=NULL)
6231  {
6232  long deg_monexp=pTotaldegree(monomexpr);
6233  for(int i=IDELEMS(id)-1;i>=0;i--)
6234  {
6235  poly p=id->m[i];
6236  if ((p!=NULL) && (pTotaldegree(p)!=0) &&
6237  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)pTotaldegree(p)/2)))
6238  {
6239  overflow=TRUE;
6240  break;
6241  }
6242  }
6243  }
6244  if (overflow)
6245  Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6246  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6247  {
6248  if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6249  else id=id_Copy(id,currRing);
6250  res->data = id_Subst(id, ringvar, monomexpr, currRing);
6251  }
6252  else
6253  res->data = idSubstPoly(id,ringvar,monomexpr);
6254  }
6255  else
6256  {
6257  res->data = idSubstPar(id,-ringvar,monomexpr);
6258  }
6259  return FALSE;
6260 }
static BOOLEAN jjSUBST_Test(leftv v, leftv w, int &ringvar, poly &monomexpr)
Definition: iparith.cc:6166
ideal idSubstPoly(ideal id, int n, poly e)
Definition: maps_ip.cc:403
ideal idSubstPar(ideal id, int n, poly e)
Definition: maps_ip.cc:370
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 6264 of file iparith.cc.

6265 {
6266  return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6267 }
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition: iparith.cc:6272

◆ jjSUBST_Id_N()

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

Definition at line 6268 of file iparith.cc.

6269 {
6270  return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6271 }

◆ jjSUBST_Id_X()

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

Definition at line 6272 of file iparith.cc.

6273 {
6274  sleftv tmp;
6275  memset(&tmp,0,sizeof(tmp));
6276  // do not check the result, conversion from int/number to poly works always
6277  iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6278  BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6279  tmp.CleanUp();
6280  return b;
6281 }
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition: iparith.cc:6220

◆ jjSUBST_M()

static BOOLEAN jjSUBST_M ( leftv  res,
leftv  u 
)
static

Definition at line 7723 of file iparith.cc.

7724 {
7725  leftv v = u->next; // number of args > 0
7726  if (v==NULL) return TRUE;
7727  leftv w = v->next;
7728  if (w==NULL) return TRUE;
7729  leftv rest = w->next;;
7730 
7731  u->next = NULL;
7732  v->next = NULL;
7733  w->next = NULL;
7734  BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7735  if ((rest!=NULL) && (!b))
7736  {
7737  sleftv tmp_res;
7738  leftv tmp_next=res->next;
7739  res->next=rest;
7740  memset(&tmp_res,0,sizeof(tmp_res));
7741  b = iiExprArithM(&tmp_res,res,iiOp);
7742  memcpy(res,&tmp_res,sizeof(tmp_res));
7743  res->next=tmp_next;
7744  }
7745  u->next = v;
7746  v->next = w;
7747  // rest was w->next, but is already cleaned
7748  return b;
7749 }

◆ jjSUBST_P()

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

Definition at line 6194 of file iparith.cc.

6195 {
6196  int ringvar;
6197  poly monomexpr;
6198  BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6199  if (nok) return TRUE;
6200  poly p=(poly)u->Data();
6201  if (ringvar>0)
6202  {
6203  if ((monomexpr!=NULL) && (p!=NULL) && (pTotaldegree(p)!=0) &&
6204  ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)pTotaldegree(p)/2)))
6205  {
6206  Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), pTotaldegree(p));
6207  //return TRUE;
6208  }
6209  if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6210  res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6211  else
6212  res->data= pSubstPoly(p,ringvar,monomexpr);
6213  }
6214  else
6215  {
6216  res->data=pSubstPar(p,-ringvar,monomexpr);
6217  }
6218  return FALSE;
6219 }
poly pSubstPoly(poly p, int var, poly image)
Definition: maps_ip.cc:387
poly pSubstPar(poly p, int par, poly image)
Definition: maps_ip.cc:250

◆ jjSUBST_Test()

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

Definition at line 6166 of file iparith.cc.

6168 {
6169  monomexpr=(poly)w->Data();
6170  poly p=(poly)v->Data();
6171 #if 0
6172  if (pLength(monomexpr)>1)
6173  {
6174  Werror("`%s` substitutes a ringvar only by a term",
6176  return TRUE;
6177  }
6178 #endif
6179  if ((ringvar=pVar(p))==0)
6180  {
6181  if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6182  {
6183  number n = pGetCoeff(p);
6184  ringvar= -n_IsParam(n, currRing);
6185  }
6186  if(ringvar==0)
6187  {
6188  WerrorS("ringvar/par expected");
6189  return TRUE;
6190  }
6191  }
6192  return FALSE;
6193 }
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition: ring.cc:5631
@ SUBST_CMD
Definition: tok.h:184

◆ jjSYZ_2()

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

Definition at line 3296 of file iparith.cc.

3297 {
3298  // see jjSYZYGY
3299  intvec *w=NULL;
3300  ideal I=(ideal)u->Data();
3301  GbVariant alg=syGetAlgorithm((char*)v->Data(),currRing,I);
3302  res->data = (char *)idSyzygies(I,testHomog,&w,TRUE,FALSE,NULL,alg);
3303  if (w!=NULL) delete w;
3305  return FALSE;
3306 
3307 }
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:730

◆ jjSYZYGY()

static BOOLEAN jjSYZYGY ( leftv  res,
leftv  v 
)
static

Definition at line 4872 of file iparith.cc.

4873 {
4874  intvec *w=NULL;
4875  res->data = (char *)idSyzygies((ideal)v->Data(),testHomog,&w);
4876  if (w!=NULL) delete w;
4878  return FALSE;
4879 }

◆ jjTEST()

static BOOLEAN jjTEST ( leftv  ,
leftv  v 
)
static

Definition at line 7541 of file iparith.cc.

7542 {
7543  do
7544  {
7545  if (v->Typ()!=INT_CMD)
7546  return TRUE;
7547  test_cmd((int)(long)v->Data());
7548  v=v->next;
7549  }
7550  while (v!=NULL);
7551  return FALSE;
7552 }
void test_cmd(int i)
Definition: ipshell.cc:506

◆ jjTIMES_BI()

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

Definition at line 920 of file iparith.cc.

921 {
922  res->data = (char *)(n_Mult( (number)u->Data(), (number)v->Data(),coeffs_BIGINT));
923  if ((v->next!=NULL) || (u->next!=NULL))
924  return jjOP_REST(res,u,v);
925  return FALSE;
926 }
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:637

◆ jjTIMES_BIM()

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

Definition at line 1004 of file iparith.cc.

1005 {
1006  res->data = (char *)bimMult((bigintmat*)(u->Data()), (bigintmat*)(v->Data()));
1007  if (res->data==NULL)
1008  {
1009  WerrorS("bigintmat/cmatrix not compatible");
1010  return TRUE;
1011  }
1012  if ((v->next!=NULL) || (u->next!=NULL))
1013  return jjOP_REST(res,u,v);
1014  return FALSE;
1015 }

◆ jjTIMES_I()

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

Definition at line 908 of file iparith.cc.

909 {
910  int a=(int)(long)u->Data();
911  int b=(int)(long)v->Data();
912  int64 c=(int64)a * (int64)b;
913  if ((c>INT_MAX)||(c<INT_MIN))
914  WarnS("int overflow(*), result may be wrong");
915  res->data = (char *)((long)((int)c));
916  if ((u->Next()!=NULL) || (v->Next()!=NULL))
917  return jjOP_REST(res,u,v);
918  return FALSE;
919 }
long int64
Definition: auxiliary.h:66

◆ jjTIMES_ID()

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

Definition at line 984 of file iparith.cc.

985 {
986  res->data = (char *)idMult((ideal)u->Data(),(ideal)v->Data());
987  id_Normalize((ideal)res->data,currRing);
988  if ((v->next!=NULL) || (u->next!=NULL))
989  return jjOP_REST(res,u,v);
990  return FALSE;
991 }
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 992 of file iparith.cc.

993 {
994  res->data = (char *)ivMult((intvec*)(u->Data()), (intvec*)(v->Data()));
995  if (res->data==NULL)
996  {
997  WerrorS("intmat size not compatible");
998  return TRUE;
999  }
1000  if ((v->next!=NULL) || (u->next!=NULL))
1001  return jjOP_REST(res,u,v);
1002  return FALSE;
1003 }
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 1072 of file iparith.cc.

1073 {
1074  matrix A=(matrix)u->Data(); matrix B=(matrix)v->Data();
1075  res->data = (char *)mp_Mult(A,B,currRing);
1076  if (res->data==NULL)
1077  {
1078  Werror("matrix size not compatible(%dx%d, %dx%d) in *",
1080  return TRUE;
1081  }
1082  id_Normalize((ideal)res->data,currRing);
1083  if ((v->next!=NULL) || (u->next!=NULL))
1084  return jjOP_REST(res,u,v);
1085  return FALSE;
1086 }
matrix mp_Mult(matrix a, matrix b, const ring R)
Definition: matpol.cc:212

◆ jjTIMES_MA_BI1()

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

Definition at line 1016 of file iparith.cc.

1017 {
1019  if (nMap==NULL) return TRUE;
1020  number n=nMap((number)v->Data(),coeffs_BIGINT,currRing->cf);
1021  poly p=pNSet(n);
1022  ideal I= (ideal)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1023  res->data = (char *)I;
1024  return FALSE;
1025 }
matrix mp_MultP(matrix a, poly p, const ring R)
multiply a matrix 'a' by a poly 'p', destroy the args
Definition: matpol.cc:147

◆ jjTIMES_MA_BI2()

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

Definition at line 1026 of file iparith.cc.

1027 {
1028  return jjTIMES_MA_BI1(res,v,u);
1029 }
static BOOLEAN jjTIMES_MA_BI1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1016

◆ jjTIMES_MA_I1()

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

Definition at line 1062 of file iparith.cc.

1063 {
1064  res->data = (char *)mp_MultI((matrix)u->CopyD(MATRIX_CMD),(int)(long)v->Data(),currRing);
1065  id_Normalize((ideal)res->data,currRing);
1066  return FALSE;
1067 }
matrix mp_MultI(matrix a, int f, const ring R)
c = f*a
Definition: matpol.cc:134

◆ jjTIMES_MA_I2()

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

Definition at line 1068 of file iparith.cc.

1069 {
1070  return jjTIMES_MA_I1(res,v,u);
1071 }
static BOOLEAN jjTIMES_MA_I1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1062

◆ jjTIMES_MA_N1()

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

Definition at line 1050 of file iparith.cc.

1051 {
1052  number n=(number)v->CopyD(NUMBER_CMD);
1053  poly p=pNSet(n);
1054  res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1055  id_Normalize((ideal)res->data,currRing);
1056  return FALSE;
1057 }

◆ jjTIMES_MA_N2()

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

Definition at line 1058 of file iparith.cc.

1059 {
1060  return jjTIMES_MA_N1(res,v,u);
1061 }
static BOOLEAN jjTIMES_MA_N1(leftv res, leftv u, leftv v)
Definition: iparith.cc:1050

◆ jjTIMES_MA_P1()

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

Definition at line 1030 of file iparith.cc.

1031 {
1032  poly p=(poly)v->CopyD(POLY_CMD);
1033  int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1034  ideal I= (ideal)mp_MultP((matrix)u->CopyD(MATRIX_CMD),p,currRing);
1035  if (r>0) I->rank=r;
1037  res->data = (char *)I;
1038  return FALSE;
1039 }
long rank
Definition: matpol.h:19

◆ jjTIMES_MA_P2()

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

Definition at line 1040 of file iparith.cc.

1041 {
1042  poly p=(poly)u->CopyD(POLY_CMD);
1043  int r=pMaxComp(p);/* recompute the rank for the case ideal*vector*/
1044  ideal I= (ideal)pMultMp(p,(matrix)v->CopyD(MATRIX_CMD),currRing);
1045  if (r>0) I->rank=r;
1047  res->data = (char *)I;
1048  return FALSE;
1049 }
matrix pMultMp(poly p, matrix a, const ring R)
Definition: matpol.cc:164

◆ jjTIMES_N()

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

Definition at line 927 of file iparith.cc.

928 {
929  res->data = (char *)(nMult( (number)u->Data(), (number)v->Data()));
930  number n=(number)res->data;
931  nNormalize(n);
932  res->data=(char *)n;
933  if ((v->next!=NULL) || (u->next!=NULL))
934  return jjOP_REST(res,u,v);
935  return FALSE;
936 }
#define nMult(n1, n2)
Definition: numbers.h:18

◆ jjTIMES_P()

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

Definition at line 937 of file iparith.cc.

938 {
939  poly a;
940  poly b;
941  if (v->next==NULL)
942  {
943  a=(poly)u->CopyD(POLY_CMD); // works also for VECTOR_CMD
944  if (u->next==NULL)
945  {
946  b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD
947  if ((a!=NULL) && (b!=NULL)
948  && ((long)pTotaldegree(a)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)-(long)pTotaldegree(b)))
949  {
950  Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
951  pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
952  }
953  res->data = (char *)(pMult( a, b));
954  pNormalize((poly)res->data);
955  return FALSE;
956  }
957  // u->next exists: copy v
958  b=pCopy((poly)v->Data());
959  if ((a!=NULL) && (b!=NULL)
960  && (pTotaldegree(a)+pTotaldegree(b)>si_max((long)rVar(currRing),(long)currRing->bitmask/2)))
961  {
962  Warn("possible OVERFLOW in mult(d=%ld, d=%ld, max=%ld)",
963  pTotaldegree(a),pTotaldegree(b),currRing->bitmask/2);
964  }
965  res->data = (char *)(pMult( a, b));
966  pNormalize((poly)res->data);
967  return jjOP_REST(res,u,v);
968  }
969  // v->next exists: copy u
970  a=pCopy((poly)u->Data());
971  b=(poly)v->CopyD(POLY_CMD); // works also for VECTOR_CMD
972  if ((a!=NULL) && (b!=NULL)
973  && ((unsigned long)(pTotaldegree(a)+pTotaldegree(b))>=currRing->bitmask/2))
974  {
975  pDelete(&a);
976  pDelete(&b);
977  WerrorS("OVERFLOW");
978  return TRUE;
979  }
980  res->data = (char *)(pMult( a, b));
981  pNormalize((poly)res->data);
982  return jjOP_REST(res,u,v);
983 }

◆ jjTRACE_IV()

static BOOLEAN jjTRACE_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4910 of file iparith.cc.

4911 {
4912  res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
4913  return FALSE;
4914 }
int ivTrace(intvec *o)
Definition: intvec.cc:321

◆ jjTRANSP_BIM()

static BOOLEAN jjTRANSP_BIM ( leftv  res,
leftv  v 
)
static

Definition at line 4915 of file iparith.cc.

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

◆ jjTRANSP_IV()

static BOOLEAN jjTRANSP_IV ( leftv  res,
leftv  v 
)
static

Definition at line 4920 of file iparith.cc.

4921 {
4922  res->data = (char *)ivTranp((intvec*)(v->Data()));
4923  return FALSE;
4924 }
intvec * ivTranp(intvec *o)
Definition: intvec.cc:309

◆ jjTWOSTD()

static BOOLEAN jjTWOSTD ( leftv  res,
leftv  a 
)
static

Definition at line 4952 of file iparith.cc.

4953 {
4954  if (rIsPluralRing(currRing)) res->data=(ideal)twostd((ideal)a->Data());
4955  else res->data=(ideal)a->CopyD();
4956  setFlag(res,FLAG_STD);
4958  return FALSE;
4959 }
#define FLAG_TWOSTD
Definition: ipid.h:105
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18

◆ jjTYPEOF()

static BOOLEAN jjTYPEOF ( leftv  res,
leftv  v 
)
static

Definition at line 4962 of file iparith.cc.

4963 {
4964  int t=(int)(long)v->data;
4965  switch (t)
4966  {
4967  case CRING_CMD:
4968  case INT_CMD:
4969  case POLY_CMD:
4970  case VECTOR_CMD:
4971  case STRING_CMD:
4972  case INTVEC_CMD:
4973  case IDEAL_CMD:
4974  case MATRIX_CMD:
4975  case MODUL_CMD:
4976  case MAP_CMD:
4977  case PROC_CMD:
4978  case RING_CMD:
4979  //case QRING_CMD:
4980  case INTMAT_CMD:
4981  case BIGINTMAT_CMD:
4982  case NUMBER_CMD:
4983  #ifdef SINGULAR_4_2
4984  case CNUMBER_CMD:
4985  #endif
4986  case BIGINT_CMD:
4987  case LIST_CMD:
4988  case PACKAGE_CMD:
4989  case LINK_CMD:
4990  case RESOLUTION_CMD:
4991  res->data=omStrDup(Tok2Cmdname(t)); break;
4992  case DEF_CMD:
4993  case NONE: res->data=omStrDup("none"); break;
4994  default:
4995  {
4996  if (t>MAX_TOK)
4997  res->data=omStrDup(getBlackboxName(t));
4998  else
4999  res->data=omStrDup("?unknown type?");
5000  break;
5001  }
5002  }
5003  return FALSE;
5004 }
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition: blackbox.cc:186
@ CNUMBER_CMD
Definition: tok.h:47

◆ jjUMINUS_BI()

static BOOLEAN jjUMINUS_BI ( leftv  res,
leftv  u 
)
static

Definition at line 3440 of file iparith.cc.

3441 {
3442  number n=(number)u->CopyD(BIGINT_CMD);
3443  n=n_InpNeg(n,coeffs_BIGINT);
3444  res->data = (char *)n;
3445  return FALSE;
3446 }
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:558

◆ jjUMINUS_BIM()

static BOOLEAN jjUMINUS_BIM ( leftv  res,
leftv  u 
)
static

Definition at line 3477 of file iparith.cc.

3478 {
3479  bigintmat *bim=(bigintmat *)u->CopyD(BIGINTMAT_CMD);
3480  (*bim)*=(-1);
3481  res->data = (char *)bim;
3482  return FALSE;
3483 }

◆ jjUMINUS_I()

static BOOLEAN jjUMINUS_I ( leftv  res,
leftv  u 
)
static

Definition at line 3447 of file iparith.cc.

3448 {
3449  res->data = (char *)(-(long)u->Data());
3450  return FALSE;
3451 }

◆ jjUMINUS_IV()

static BOOLEAN jjUMINUS_IV ( leftv  res,
leftv  u 
)
static

Definition at line 3470 of file iparith.cc.

3471 {
3472  intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3473  (*iv)*=(-1);
3474  res->data = (char *)iv;
3475  return FALSE;
3476 }

◆ jjUMINUS_MA()

static BOOLEAN jjUMINUS_MA ( leftv  res,
leftv  u 
)
static

Definition at line 3464 of file iparith.cc.

3465 {
3466  poly m1=pISet(-1);
3467  res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3468  return FALSE;
3469 }
#define pISet(i)
Definition: polys.h:298

◆ jjUMINUS_N()

static BOOLEAN jjUMINUS_N ( leftv  res,
leftv  u 
)
static

Definition at line 3452 of file iparith.cc.

3453 {
3454  number n=(number)u->CopyD(NUMBER_CMD);
3455  n=nInpNeg(n);
3456  res->data = (char *)n;
3457  return FALSE;
3458 }
#define nInpNeg(n)
Definition: numbers.h:22

◆ jjUMINUS_P()

static BOOLEAN jjUMINUS_P ( leftv  res,
leftv  u 
)
static

Definition at line 3459 of file iparith.cc.

3460 {
3461  res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3462  return FALSE;
3463 }
#define pNeg(p)
Definition: polys.h:185

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv  ,
leftv  arg 
)

Definition at line 9369 of file iparith.cc.

9370 {
9371  lists l=(lists)arg->Data();
9372  if (l->nr>0)
9373  {
9374  qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
9375  int i, j, len;
9376  len=l->nr;
9377  i=0;
9378  while(i<len)
9379  {
9380  if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
9381  {
9382  l->m[i].CleanUp();
9383  for(j=i; j<len;j++) l->m[j]=l->m[j+1];
9384  memset(&(l->m[len]),0,sizeof(sleftv));
9385  l->m[len].rtyp=DEF_CMD;
9386  len--;
9387  }
9388  else
9389  i++;
9390  }
9391  //Print("new len:%d\n",len);
9392  }
9393  return FALSE;
9394 }

◆ jjUNIVARIATE()

static BOOLEAN jjUNIVARIATE ( leftv  res,
leftv  v 
)
static

Definition at line 5005 of file iparith.cc.

5006 {
5007  res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5008  return FALSE;
5009 }
#define pIsUnivariate(p)
Definition: polys.h:236

◆ jjVAR1()

static BOOLEAN jjVAR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5010 of file iparith.cc.

5011 {
5012  int i=(int)(long)v->Data();
5013  if ((0<i) && (i<=currRing->N))
5014  {
5015  poly p=pOne();
5016  pSetExp(p,i,1);
5017  pSetm(p);
5018  res->data=(char *)p;
5019  }
5020  else
5021  {
5022  Werror("var number %d out of range 1..%d",i,currRing->N);
5023  return TRUE;
5024  }
5025  return FALSE;
5026 }

◆ jjVARSTR1()

static BOOLEAN jjVARSTR1 ( leftv  res,
leftv  v 
)
static

Definition at line 5027 of file iparith.cc.

5028 {
5029  if (currRing==NULL)
5030  {
5031  WerrorS("no ring active");
5032  return TRUE;
5033  }
5034  int i=(int)(long)v->Data();
5035  if ((0<i) && (i<=currRing->N))
5036  res->data=omStrDup(currRing->names[i-1]);
5037  else
5038  {
5039  Werror("var number %d out of range 1..%d",i,currRing->N);
5040  return TRUE;
5041  }
5042  return FALSE;
5043 }

◆ jjVARSTR2()

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

Definition at line 3308 of file iparith.cc.

3309 {
3310  idhdl h=(idhdl)u->data;
3311  int i=(int)(long)v->Data();
3312  if ((0<i) && (i<=IDRING(h)->N))
3313  res->data=omStrDup(IDRING(h)->names[i-1]);
3314  else
3315  {
3316  Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3317  return TRUE;
3318  }
3319  return FALSE;
3320 }

◆ jjVDIM()

static BOOLEAN jjVDIM ( leftv  res,
leftv  v 
)
static

Definition at line 5044 of file iparith.cc.

5045 {
5046  assumeStdFlag(v);
5047  res->data = (char *)(long)scMult0Int((ideal)v->Data(),currRing->qideal);
5048  return FALSE;
5049 }
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:919

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv  res,
leftv  u 
)

Definition at line 5050 of file iparith.cc.

5051 {
5052 // input: u: a list with links of type
5053 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5054 // returns: -1: the read state of all links is eof
5055 // i>0: (at least) u[i] is ready
5056  lists Lforks = (lists)u->Data();
5057  int i = slStatusSsiL(Lforks, -1);
5058  if(i == -2) /* error */
5059  {
5060  return TRUE;
5061  }
5062  res->data = (void*)(long)i;
5063  return FALSE;
5064 }

◆ jjWAIT1ST2()

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

Definition at line 3321 of file iparith.cc.

3322 {
3323 // input: u: a list with links of type
3324 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3325 // v: timeout for select in milliseconds
3326 // or 0 for polling
3327 // returns: ERROR (via Werror): timeout negative
3328 // -1: the read state of all links is eof
3329 // 0: timeout (or polling): none ready
3330 // i>0: (at least) L[i] is ready
3331  lists Lforks = (lists)u->Data();
3332  int t = (int)(long)v->Data();
3333  if(t < 0)
3334  {
3335  WerrorS("negative timeout"); return TRUE;
3336  }
3337  int i = slStatusSsiL(Lforks, t*1000);
3338  if(i == -2) /* error */
3339  {
3340  return TRUE;
3341  }
3342  res->data = (void*)(long)i;
3343  return FALSE;
3344 }

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv  res,
leftv  u 
)

Definition at line 5065 of file iparith.cc.

5066 {
5067 // input: u: a list with links of type
5068 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5069 // returns: -1: the read state of all links is eof
5070 // 1: all links are ready
5071 // (caution: at least one is ready, but some maybe dead)
5072  lists Lforks = (lists)u->CopyD();
5073  int i;
5074  int j = -1;
5075  for(int nfinished = 0; nfinished < Lforks->nr+1; nfinished++)
5076  {
5077  i = slStatusSsiL(Lforks, -1);
5078  if(i == -2) /* error */
5079  {
5080  return TRUE;
5081  }
5082  if(i == -1)
5083  {
5084  break;
5085  }
5086  j = 1;
5087  Lforks->m[i-1].CleanUp();
5088  Lforks->m[i-1].rtyp=DEF_CMD;
5089  Lforks->m[i-1].data=NULL;
5090  }
5091  res->data = (void*)(long)j;
5092  Lforks->Clean();
5093  return FALSE;
5094 }

◆ jjWAITALL2()

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

Definition at line 3345 of file iparith.cc.

3346 {
3347 // input: u: a list with links of type
3348 // ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3349 // v: timeout for select in milliseconds
3350 // or 0 for polling
3351 // returns: ERROR (via Werror): timeout negative
3352 // -1: the read state of all links is eof
3353 // 0: timeout (or polling): none ready
3354 // 1: all links are ready
3355 // (caution: at least one is ready, but some maybe dead)
3356  lists Lforks = (lists)u->CopyD();
3357  int timeout = 1000*(int)(long)v->Data();
3358  if(timeout < 0)
3359  {
3360  WerrorS("negative timeout"); return TRUE;
3361  }
3362  int t = getRTimer()/TIMER_RESOLUTION; // in seconds
3363  int i;
3364  int ret = -1;
3365  for(unsigned nfinished = 0; nfinished < ((unsigned)Lforks->nr)+1; nfinished++)
3366  {
3367  i = slStatusSsiL(Lforks, timeout);
3368  if(i > 0) /* Lforks[i] is ready */
3369  {
3370  ret = 1;
3371  Lforks->m[i-1].CleanUp();
3372  Lforks->m[i-1].rtyp=DEF_CMD;
3373  Lforks->m[i-1].data=NULL;
3374  timeout = si_max(0,timeout - 1000*(getRTimer()/TIMER_RESOLUTION - t));
3375  }
3376  else /* terminate the for loop */
3377  {
3378  if(i == -2) /* error */
3379  {
3380  return TRUE;
3381  }
3382  if(i == 0) /* timeout */
3383  {
3384  ret = 0;
3385  }
3386  break;
3387  }
3388  }
3389  Lforks->Clean();
3390  res->data = (void*)(long)ret;
3391  return FALSE;
3392 }
#define TIMER_RESOLUTION
Definition: mod2.h:34
int getRTimer()
Definition: timer.cc:172

◆ jjWEDGE()

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

Definition at line 3393 of file iparith.cc.

3394 {
3395  res->data = (char *)mp_Wedge((matrix)u->Data(),(int)(long)v->Data(),currRing);
3396  return FALSE;
3397 }
matrix mp_Wedge(matrix a, int ar, const ring R)
Definition: matpol.cc:1651

◆ jjWRONG()

static BOOLEAN jjWRONG ( leftv  ,
leftv   
)
static

Definition at line 3400 of file iparith.cc.

3401 {
3402  return TRUE;
3403 }

◆ pHeadProc()

poly pHeadProc ( poly  p)

Definition at line 228 of file iparith.cc.

229 {
230  return pHead(p);
231 }

◆ rCompose()

ring rCompose ( const lists  L,
const BOOLEAN  check_comp = TRUE,
const long  bitmask = 0x7fff 
)

Definition at line 2743 of file ipshell.cc.

2744 {
2745  if ((L->nr!=3)
2746 #ifdef HAVE_PLURAL
2747  &&(L->nr!=5)
2748 #endif
2749  )
2750  return NULL;
2751  int is_gf_char=0;
2752  // 0: char/ cf - ring
2753  // 1: list (var)
2754  // 2: list (ord)
2755  // 3: qideal
2756  // possibly:
2757  // 4: C
2758  // 5: D
2759 
2760  ring R = (ring) omAlloc0Bin(sip_sring_bin);
2761 
2762  // ------------------------------------------------------------------
2763  // 0: char:
2764  if (L->m[0].Typ()==CRING_CMD)
2765  {
2766  R->cf=(coeffs)L->m[0].Data();
2767  R->cf->ref++;
2768  }
2769  else if (L->m[0].Typ()==INT_CMD)
2770  {
2771  int ch = (int)(long)L->m[0].Data();
2772  assume( ch >= 0 );
2773 
2774  if (ch == 0) // Q?
2775  R->cf = nInitChar(n_Q, NULL);
2776  else
2777  {
2778  int l = IsPrime(ch); // Zp?
2779  if( l != ch )
2780  {
2781  Warn("%d is invalid characteristic of ground field. %d is used.", ch, l);
2782  ch = l;
2783  }
2784  R->cf = nInitChar(n_Zp, (void*)(long)ch);
2785  }
2786  }
2787  else if (L->m[0].Typ()==LIST_CMD) // something complicated...
2788  {
2789  lists LL=(lists)L->m[0].Data();
2790 
2791 #ifdef HAVE_RINGS
2792  if (LL->m[0].Typ() == STRING_CMD) // 1st comes a string?
2793  {
2794  rComposeRing(LL, R); // Ring!?
2795  }
2796  else
2797 #endif
2798  if (LL->nr < 3)
2799  rComposeC(LL,R); // R, long_R, long_C
2800  else
2801  {
2802  if (LL->m[0].Typ()==INT_CMD)
2803  {
2804  int ch = (int)(long)LL->m[0].Data();
2805  while ((ch!=fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;
2806  if (fftable[is_gf_char]==0) is_gf_char=-1;
2807 
2808  if(is_gf_char!= -1)
2809  {
2810  GFInfo param;
2811 
2812  param.GFChar = ch;
2813  param.GFDegree = 1;
2814  param.GFPar_name = (const char*)(((lists)(LL->m[1].Data()))->m[0].Data());
2815 
2816  // nfInitChar should be able to handle the case when ch is in fftables!
2817  R->cf = nInitChar(n_GF, (void*)&param);
2818  }
2819  }
2820 
2821  if( R->cf == NULL )
2822  {
2823  ring extRing = rCompose((lists)L->m[0].Data(),FALSE,0x7fff);
2824 
2825  if (extRing==NULL)
2826  {
2827  WerrorS("could not create the specified coefficient field");
2828  goto rCompose_err;
2829  }
2830 
2831  if( extRing->qideal != NULL ) // Algebraic extension
2832  {
2833  AlgExtInfo extParam;
2834 
2835  extParam.r = extRing;
2836 
2837  R->cf = nInitChar(n_algExt, (void*)&extParam);
2838  }
2839  else // Transcendental extension
2840  {
2841  TransExtInfo extParam;
2842  extParam.r = extRing;
2843  assume( extRing->qideal == NULL );
2844 
2845  R->cf = nInitChar(n_transExt, &extParam);
2846  }
2847  }
2848  }
2849  }
2850  else
2851  {
2852  WerrorS("coefficient field must be described by `int` or `list`");
2853  goto rCompose_err;
2854  }
2855 
2856  if( R->cf == NULL )
2857  {
2858  WerrorS("could not create coefficient field described by the input!");
2859  goto rCompose_err;
2860  }
2861 
2862  // ------------------------- VARS ---------------------------
2863  if (rComposeVar(L,R)) goto rCompose_err;
2864  // ------------------------ ORDER ------------------------------
2865  if (rComposeOrder(L,check_comp,R)) goto rCompose_err;
2866 
2867  // ------------------------ ??????? --------------------
2868 
2869  rRenameVars(R);
2870  if (bitmask!=0x7fff) R->bitmask=bitmask*2;
2871  rComplete(R);
2872 
2873  // ------------------------ Q-IDEAL ------------------------
2874 
2875  if (L->m[3].Typ()==IDEAL_CMD)
2876  {
2877  ideal q=(ideal)L->m[3].Data();
2878  if (q->m[0]!=NULL)
2879  {
2880  if (R->cf != currRing->cf) //->cf->ch!=currRing->cf->ch)
2881  {
2882  #if 0
2883  WerrorS("coefficient fields must be equal if q-ideal !=0");
2884  goto rCompose_err;
2885  #else
2886  ring orig_ring=currRing;
2887  rChangeCurrRing(R);
2888  int *perm=NULL;
2889  int *par_perm=NULL;
2890  int par_perm_size=0;
2891  nMapFunc nMap;
2892 
2893  if ((nMap=nSetMap(orig_ring->cf))==NULL)
2894  {
2895  if (rEqual(orig_ring,currRing))
2896  {
2897  nMap=n_SetMap(currRing->cf, currRing->cf);
2898  }
2899  else
2900  // Allow imap/fetch to be make an exception only for:
2901  if ( (rField_is_Q_a(orig_ring) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2904  ||
2905  (rField_is_Zp_a(orig_ring) && // Zp(a..) -> Zp(a..) || Zp
2906  (rField_is_Zp(currRing, rInternalChar(orig_ring)) ||
2907  rField_is_Zp_a(currRing, rInternalChar(orig_ring)))) )
2908  {
2909  par_perm_size=rPar(orig_ring);
2910 
2911 // if ((orig_ring->minpoly != NULL) || (orig_ring->qideal != NULL))
2912 // naSetChar(rInternalChar(orig_ring),orig_ring);
2913 // else ntSetChar(rInternalChar(orig_ring),orig_ring);
2914 
2915  nSetChar(currRing->cf);
2916  }
2917  else
2918  {
2919  WerrorS("coefficient fields must be equal if q-ideal !=0");
2920  goto rCompose_err;
2921  }
2922  }
2923  perm=(int *)omAlloc0((orig_ring->N+1)*sizeof(int));
2924  if (par_perm_size!=0)
2925  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2926  int i;
2927  #if 0
2928  // use imap:
2929  maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2930  currRing->names,currRing->N,currRing->parameter, currRing->P,
2931  perm,par_perm, currRing->ch);
2932  #else
2933  // use fetch
2934  if ((rPar(orig_ring)>0) && (rPar(currRing)==0))
2935  {
2936  for(i=si_min(rPar(orig_ring),rVar(currRing))-1;i>=0;i--) par_perm[i]=i+1;
2937  }
2938  else if (par_perm_size!=0)
2939  for(i=si_min(rPar(orig_ring),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
2940  for(i=si_min(orig_ring->N,rVar(currRing));i>0;i--) perm[i]=i;
2941  #endif
2942  ideal dest_id=idInit(IDELEMS(q),1);
2943  for(i=IDELEMS(q)-1; i>=0; i--)
2944  {
2945  dest_id->m[i]=p_PermPoly(q->m[i],perm,orig_ring, currRing,nMap,
2946  par_perm,par_perm_size);
2947  // PrintS("map:");pWrite(dest_id->m[i]);PrintLn();
2948  pTest(dest_id->m[i]);
2949  }
2950  R->qideal=dest_id;
2951  if (perm!=NULL)
2952  omFreeSize((ADDRESS)perm,(orig_ring->N+1)*sizeof(int));
2953  if (par_perm!=NULL)
2954  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
2955  rChangeCurrRing(orig_ring);
2956  #endif
2957  }
2958  else
2959  R->qideal=idrCopyR(q,currRing,R);
2960  }
2961  }
2962  else
2963  {
2964  WerrorS("q-ideal must be given as `ideal`");
2965  goto rCompose_err;
2966  }
2967 
2968 
2969  // ---------------------------------------------------------------
2970  #ifdef HAVE_PLURAL
2971  if (L->nr==5)
2972  {
2973  if (nc_CallPlural((matrix)L->m[4].Data(),
2974  (matrix)L->m[5].Data(),
2975  NULL,NULL,
2976  R,
2977  true, // !!!
2978  true, false,
2979  currRing, FALSE)) goto rCompose_err;
2980  // takes care about non-comm. quotient! i.e. calls "nc_SetupQuotient" due to last true
2981  }
2982  #endif
2983  return R;
2984 
2985 rCompose_err:
2986  if (R->N>0)
2987  {
2988  int i;
2989  if (R->names!=NULL)
2990  {
2991  i=R->N-1;
2992  while (i>=0) { omfree(R->names[i]); i--; }
2993  omFree(R->names);
2994  }
2995  }
2996  omfree(R->order);
2997  omfree(R->block0);
2998  omfree(R->block1);
2999  omfree(R->wvhdl);
3000  omFree(R);
3001  return NULL;
3002 }
ring r
Definition: algext.h:37
struct for passing initialization parameters to naInitChar
Definition: algext.h:37
int GFDegree
Definition: coeffs.h:96
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:33
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:31
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:30
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
const unsigned short fftable[]
Definition: ffields.cc:31
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
Definition: coeffs.h:437
const char * GFPar_name
Definition: coeffs.h:97
int GFChar
Definition: coeffs.h:95
Creation data needed for finite fields.
Definition: coeffs.h:94
static void rRenameVars(ring R)
Definition: ipshell.cc:2391
void rComposeC(lists L, ring R)
Definition: ipshell.cc:2227
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask)
Definition: ipshell.cc:2743
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
Definition: ipshell.cc:2477
void rComposeRing(lists L, ring R)
Definition: ipshell.cc:2298
static BOOLEAN rComposeVar(const lists L, ring R)
Definition: ipshell.cc:2432
#define nSetMap(R)
Definition: numbers.h:44
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4014
#define pTest(p)
Definition: polys.h:401
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
omBin sip_sring_bin
Definition: ring.cc:44
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3351
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
Definition: ring.cc:1620
static int rInternalChar(const ring r)
Definition: ring.h:680
struct for passing initialization parameters to naInitChar
Definition: transext.h:88

◆ Tok2Cmdname()

const char* Tok2Cmdname ( int  tok)

Definition at line 8803 of file iparith.cc.

8804 {
8805  if (tok <= 0)
8806  {
8807  return sArithBase.sCmds[0].name;
8808  }
8809  if (tok==ANY_TYPE) return "any_type";
8810  if (tok==COMMAND) return "command";
8811  if (tok==NONE) return "nothing";
8812  if (tok < 128)
8813  {
8814  Tok2Cmdname_buf[1]=(char)tok;
8815  return Tok2Cmdname_buf;
8816  }
8817  //if (tok==IFBREAK) return "if_break";
8818  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
8819  //if (tok==ORDER_VECTOR) return "ordering";
8820  //if (tok==REF_VAR) return "ref";
8821  //if (tok==OBJECT) return "object";
8822  //if (tok==PRINT_EXPR) return "print_expr";
8823  if (tok==IDHDL) return "identifier";
8824  if (tok>MAX_TOK) return getBlackboxName(tok);
8825  unsigned i;
8826  for(i=0; i<sArithBase.nCmdUsed; i++)
8827  //while (sArithBase.sCmds[i].tokval!=0)
8828  {
8829  if ((sArithBase.sCmds[i].tokval == tok)&&
8830  (sArithBase.sCmds[i].alias==0))
8831  {
8832  return sArithBase.sCmds[i].name;
8833  }
8834  }
8835  // try gain for alias/old names:
8836  for(i=0; i<sArithBase.nCmdUsed; i++)
8837  {
8838  if (sArithBase.sCmds[i].tokval == tok)
8839  {
8840  return sArithBase.sCmds[i].name;
8841  }
8842  }
8843  return sArithBase.sCmds[0].name;
8844 }
static si_char_2 Tok2Cmdname_buf
Definition: iparith.cc:8802
#define ANY_TYPE
Definition: tok.h:30

◆ WerrorS_dummy()

static void WerrorS_dummy ( const char *  )
static

Definition at line 5168 of file iparith.cc.

5169 {
5171 }

Variable Documentation

◆ cmdtok

int cmdtok
extern

Definition at line 174 of file grammar.cc.

◆ expected_parms

BOOLEAN expected_parms
extern

Definition at line 173 of file grammar.cc.

◆ iiOp

int iiOp

Definition at line 218 of file iparith.cc.

◆ sArithBase

SArithBase sArithBase
static

Base entry for arithmetic.

Definition at line 197 of file iparith.cc.

◆ singclap_factorize_retry

int singclap_factorize_retry
extern

Definition at line 3105 of file iparith.cc.

◆ Tok2Cmdname_buf

si_char_2 Tok2Cmdname_buf =" "
static

Definition at line 8802 of file iparith.cc.

◆ WerrorS_dummy_cnt

int WerrorS_dummy_cnt =0
static

Definition at line 5167 of file iparith.cc.