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

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Functions

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

Variables

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

Data Structure Documentation

◆ sValCmdTab

struct sValCmdTab

Definition at line 124 of file iparith.cc.

Data Fields
short cmd
short start

◆ _scmdnames

struct _scmdnames

Definition at line 56 of file gentable.cc.

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

◆ sValCmd1

struct sValCmd1

Definition at line 75 of file gentable.cc.

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

◆ sValCmd2

struct sValCmd2

Definition at line 66 of file gentable.cc.

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

◆ sValCmd3

struct sValCmd3

Definition at line 83 of file gentable.cc.

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

◆ sValCmdM

struct sValCmdM

Definition at line 93 of file gentable.cc.

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

◆ SArithBase

struct SArithBase

Definition at line 181 of file iparith.cc.

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

Macro Definition Documentation

◆ ALLOW_LP

#define ALLOW_LP   64

Definition at line 107 of file iparith.cc.

◆ ALLOW_NC

#define ALLOW_NC   ALLOW_LP|ALLOW_PLURAL

Definition at line 109 of file iparith.cc.

◆ ALLOW_PLURAL

#define ALLOW_PLURAL   1

Definition at line 100 of file iparith.cc.

◆ ALLOW_RING

#define ALLOW_RING   4

Definition at line 103 of file iparith.cc.

◆ ALLOW_ZERODIVISOR

#define ALLOW_ZERODIVISOR   0

Definition at line 106 of file iparith.cc.

◆ ALLOW_ZZ

#define ALLOW_ZZ   (ALLOW_RING|NO_ZERODIVISOR)

Definition at line 111 of file iparith.cc.

◆ bit31

#define bit31   SIZEOF_LONG*8-1

Definition at line 121 of file iparith.cc.

◆ COMM_PLURAL

#define COMM_PLURAL   2

Definition at line 102 of file iparith.cc.

◆ D

#define D ( A)
Value:
(A)
#define A
Definition sirandom.c:24

Definition at line 8994 of file iparith.cc.

◆ ii_div_by_0

#define ii_div_by_0   "div. by 0"

Definition at line 217 of file iparith.cc.

◆ IPARITH

#define IPARITH

Definition at line 8996 of file iparith.cc.

◆ NC_MASK

#define NC_MASK   (3+64)

Definition at line 93 of file iparith.cc.

◆ NO_CONVERSION

#define NO_CONVERSION   32

Definition at line 117 of file iparith.cc.

◆ NO_LRING

#define NO_LRING   128

Definition at line 108 of file iparith.cc.

◆ NO_NC

#define NO_NC   0

Definition at line 101 of file iparith.cc.

◆ NO_RING

#define NO_RING   0

Definition at line 104 of file iparith.cc.

◆ NO_ZERODIVISOR

#define NO_ZERODIVISOR   8

Definition at line 105 of file iparith.cc.

◆ NULL_VAL

#define NULL_VAL   NULL

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

◆ SIMPL_LMDIV

#define SIMPL_LMDIV   32

Definition at line 3351 of file iparith.cc.

◆ SIMPL_LMEQ

#define SIMPL_LMEQ   16

Definition at line 3352 of file iparith.cc.

◆ SIMPL_MULT

#define SIMPL_MULT   8

Definition at line 3353 of file iparith.cc.

◆ SIMPL_NORM

#define SIMPL_NORM   1

Definition at line 3356 of file iparith.cc.

◆ SIMPL_NORMALIZE

#define SIMPL_NORMALIZE   64

Definition at line 3350 of file iparith.cc.

◆ SIMPL_NULL

#define SIMPL_NULL   2

Definition at line 3355 of file iparith.cc.

◆ WARN_RING

#define WARN_RING   16

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

◆ proc2

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

Definition at line 150 of file iparith.cc.

◆ proc3

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

Definition at line 161 of file iparith.cc.

◆ si_char_2

typedef char si_char_2[2]

Definition at line 9897 of file iparith.cc.

Function Documentation

◆ _gentable_sort_cmds()

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

9954{
9955 cmdnames *pCmdL = (cmdnames*)a;
9956 cmdnames *pCmdR = (cmdnames*)b;
9957
9958 if(a==NULL || b==NULL) return 0;
9959
9960 /* empty entries goes to the end of the list for later reuse */
9961 if(pCmdL->name==NULL) return 1;
9962 if(pCmdR->name==NULL) return -1;
9963
9964 /* $INVALID$ must come first */
9965 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9966 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9967
9968 /* tokval=-1 are reserved names at the end */
9969 if (pCmdL->tokval==-1)
9970 {
9971 if (pCmdR->tokval==-1)
9972 return strcmp(pCmdL->name, pCmdR->name);
9973 /* pCmdL->tokval==-1, pCmdL goes at the end */
9974 return 1;
9975 }
9976 /* pCmdR->tokval==-1, pCmdR goes at the end */
9977 if(pCmdR->tokval==-1) return -1;
9978
9979 return strcmp(pCmdL->name, pCmdR->name);
9980}
CanonicalForm b
Definition cfModGcd.cc:4111
#define NULL
Definition omList.c:12

◆ check_valid()

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

Definition at line 10179 of file iparith.cc.

10180{
10182 {
10183 if ((p & NC_MASK)==NO_NC)
10184 {
10185 WerrorS("not implemented for non-commutative rings");
10186 return TRUE;
10187 }
10188 else if ((p & NC_MASK)==COMM_PLURAL)
10189 {
10190 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10191 return FALSE;
10192 }
10193 /* else, ALLOW_PLURAL */
10194 }
10195 else if (rIsLPRing(currRing))
10196 {
10197 if ((p & ALLOW_LP)==0)
10198 {
10199 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10200 return TRUE;
10201 }
10202 }
10204 {
10205 if ((p & RING_MASK)==0 /*NO_RING*/)
10206 {
10207 WerrorS("not implemented for rings with rings as coeffients");
10208 return TRUE;
10209 }
10211 {
10212 WerrorS("not implemented for rings with rings as coeffients and non-global orderings");
10213 return TRUE;
10214 }
10215 /* else ALLOW_RING */
10216 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
10218 {
10219 WerrorS("domain required as coeffients");
10220 return TRUE;
10221 }
10222 /* else ALLOW_ZERODIVISOR */
10223 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
10224 {
10225 WarnS("considering the image in Q[...]");
10226 }
10227 }
10228 return FALSE;
10229}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int p
Definition cfModGcd.cc:4086
#define Warn
Definition emacs.cc:77
#define WarnS
Definition emacs.cc:78
void WerrorS(const char *s)
Definition feFopen.cc:24
VAR char my_yylinebuf[80]
Definition febase.cc:44
VAR int myynest
Definition febase.cc:41
#define COMM_PLURAL
Definition gentable.cc:31
#define NO_ZERODIVISOR
Definition gentable.cc:42
#define NO_LRING
Definition gentable.cc:54
#define ALLOW_LP
Definition gentable.cc:33
#define RING_MASK
Definition gentable.cc:20
#define WARN_RING
Definition gentable.cc:49
#define NC_MASK
Definition gentable.cc:34
#define NO_NC
Definition gentable.cc:29
#define ZERODIVISOR_MASK
Definition gentable.cc:21
const char * Tok2Cmdname(int tok)
Definition iparith.cc:9899
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:774
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
#define rField_is_Ring(R)
Definition ring.h:491

◆ iiArithAddCmd()

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

Definition at line 10120 of file iparith.cc.

10127{
10128 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
10129 // nTokval, nToktype, nPos);
10130 if(nPos>=0)
10131 {
10132 // no checks: we rely on a correct generated code in iparith.inc
10133 assume((unsigned)nPos < sArithBase.nCmdAllocated);
10134 assume(szName!=NULL);
10135 sArithBase.sCmds[nPos].name = omStrDup(szName);
10136 sArithBase.sCmds[nPos].alias = nAlias;
10137 sArithBase.sCmds[nPos].tokval = nTokval;
10138 sArithBase.sCmds[nPos].toktype = nToktype;
10139 sArithBase.nCmdUsed++;
10140 //if(nTokval>0) sArithBase.nLastIdentifier++;
10141 }
10142 else
10143 {
10144 if(szName==NULL) return -1;
10145 int nIndex = iiArithFindCmd(szName);
10146 if(nIndex>=0)
10147 {
10148 Print("'%s' already exists at %d\n", szName, nIndex);
10149 return -1;
10150 }
10151
10152 if(sArithBase.nCmdUsed>=sArithBase.nCmdAllocated)
10153 {
10154 /* needs to create new slots */
10155 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
10156 sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
10157 if(sArithBase.sCmds==NULL) return -1;
10158 sArithBase.nCmdAllocated++;
10159 }
10160 /* still free slots available */
10161 sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
10162 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
10163 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
10164 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
10165 sArithBase.nCmdUsed++;
10166
10167 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
10169 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1;
10170 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--)
10171 {
10172 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10173 }
10174 //Print("L=%d\n", sArithBase.nLastIdentifier);
10175 }
10176 return 0;
10177}
#define Print
Definition emacs.cc:80
static int _gentable_sort_cmds(const void *a, const void *b)
compares to entry of cmdsname-list
Definition gentable.cc:191
int iiArithFindCmd(const char *szName)
Definition iparith.cc:10025
STATIC_VAR SArithBase sArithBase
Base entry for arithmetic.
Definition iparith.cc:198
#define assume(x)
Definition mod2.h:389
#define nSize(n)
Definition numbers.h:39
#define omStrDup(s)
#define omRealloc(addr, size)

◆ iiArithFindCmd()

int iiArithFindCmd ( const char * szName)

Definition at line 10025 of file iparith.cc.

10026{
10027 int an=0;
10028 int i = 0,v = 0;
10029 int en=sArithBase.nLastIdentifier;
10030
10031 loop
10032 //for(an=0; an<sArithBase.nCmdUsed; )
10033 {
10034 if(an>=en-1)
10035 {
10036 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
10037 {
10038 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
10039 return an;
10040 }
10041 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
10042 {
10043 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
10044 return en;
10045 }
10046 else
10047 {
10048 //Print("RET- 1\n");
10049 return -1;
10050 }
10051 }
10052 i=(an+en)/2;
10053 if (*szName < *(sArithBase.sCmds[i].name))
10054 {
10055 en=i-1;
10056 }
10057 else if (*szName > *(sArithBase.sCmds[i].name))
10058 {
10059 an=i+1;
10060 }
10061 else
10062 {
10063 v=strcmp(szName,sArithBase.sCmds[i].name);
10064 if(v<0)
10065 {
10066 en=i-1;
10067 }
10068 else if(v>0)
10069 {
10070 an=i+1;
10071 }
10072 else /*v==0*/
10073 {
10074 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
10075 return i;
10076 }
10077 }
10078 }
10079 //if(i>=0 && i<sArithBase.nCmdUsed)
10080 // return i;
10081 //PrintS("RET-2\n");
10082 return -2;
10083}
int i
Definition cfEzgcd.cc:132
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
#define loop
Definition structs.h:71

◆ iiArithGetCmd()

char * iiArithGetCmd ( int nPos)

Definition at line 10085 of file iparith.cc.

10086{
10087 if(nPos<0) return NULL;
10088 if(nPos<(int)sArithBase.nCmdUsed)
10089 return sArithBase.sCmds[nPos].name;
10090 return NULL;
10091}

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char * szName)
extern

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char * szName)

Definition at line 10093 of file iparith.cc.

10094{
10095 int nIndex;
10096 if(szName==NULL) return -1;
10097
10098 nIndex = iiArithFindCmd(szName);
10099 if(nIndex<0 || nIndex>=(int)sArithBase.nCmdUsed)
10100 {
10101 Print("'%s' not found (%d)\n", szName, nIndex);
10102 return -1;
10103 }
10104 omFreeBinAddr(sArithBase.sCmds[nIndex].name);
10105 sArithBase.sCmds[nIndex].name=NULL;
10106 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
10108 sArithBase.nCmdUsed--;
10109
10110 /* fix last-identifier */
10111 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1;
10112 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--)
10113 {
10114 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10115 }
10116 //Print("L=%d\n", sArithBase.nLastIdentifier);
10117 return 0;
10118}
#define omFreeBinAddr(addr)

◆ iiExprArith1()

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

Definition at line 9367 of file iparith.cc.

9368{
9369 if (!errorreported)
9370 {
9371 res->Init();
9372#ifdef SIQ
9373 if (siq>0)
9374 {
9375 //Print("siq:%d\n",siq);
9377 memcpy(&d->arg1,a,sizeof(sleftv));
9378 a->Init();
9379 d->op=op;
9380 d->argc=1;
9381 res->data=(char *)d;
9382 res->rtyp=COMMAND;
9383 return FALSE;
9384 }
9385#endif
9386 int at=a->Typ();
9387 // handling bb-objects ----------------------------------------------------
9388 if(op>MAX_TOK) // explicit type conversion to bb
9389 {
9390 blackbox *bb=getBlackboxStuff(op);
9391 if (bb!=NULL)
9392 {
9393 res->rtyp=op;
9394 res->data=bb->blackbox_Init(bb);
9395 return bb->blackbox_Assign(res,a);
9396 }
9397 else
9398 return TRUE;
9399 }
9400 else if (at>MAX_TOK) // argument is of bb-type
9401 {
9402 blackbox *bb=getBlackboxStuff(at);
9403 if (bb!=NULL)
9404 {
9405 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9406 // if not defined, try generic routines (attrib, defined,..)
9407 }
9408 else
9409 return TRUE;
9410 }
9411 if (errorreported) return TRUE;
9412
9413 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9414 return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9415 }
9416 a->CleanUp();
9417 return TRUE;
9418}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
Class used for (list of) interpreter objects.
Definition subexpr.h:83
int Typ()
Definition subexpr.cc:1048
void Init()
Definition subexpr.h:107
void CleanUp(ring r=currRing)
Definition subexpr.cc:351
CanonicalForm res
Definition facAbsFact.cc:60
VAR short errorreported
Definition feFopen.cc:23
BOOLEAN iiExprArith1Tab(leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
apply an operation 'op' to an argument a return TRUE on failure
Definition iparith.cc:9237
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition iparith.cc:9874
const struct sConvertTypes dConvertTypes[]
Definition table.h:1321
VAR omBin sip_command_bin
Definition ipid.cc:45
ip_command * command
Definition ipid.h:23
const struct sValCmd1 dArith1[]
Definition table.h:38
#define omAlloc0Bin(bin)
VAR BOOLEAN siq
Definition subexpr.cc:48
@ MAX_TOK
Definition tok.h:220
#define COMMAND
Definition tok.h:29

◆ iiExprArith1Tab()

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

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

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

Definition at line 9237 of file iparith.cc.

9238{
9239 res->Init();
9240 BOOLEAN call_failed=FALSE;
9241
9242 if (!errorreported)
9243 {
9244 BOOLEAN failed=FALSE;
9245 iiOp=op;
9246 int i = 0;
9247 while (dA1[i].cmd==op)
9248 {
9249 if (at==dA1[i].arg)
9250 {
9251 if (currRing!=NULL)
9252 {
9253 if (check_valid(dA1[i].valid_for,op)) break;
9254 }
9255 else
9256 {
9257 if (RingDependend(dA1[i].res))
9258 {
9259 WerrorS("no ring active (5)");
9260 break;
9261 }
9262 }
9263 if (traceit&TRACE_CALL)
9264 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9265 res->rtyp=dA1[i].res;
9266 if ((call_failed=dA1[i].p(res,a)))
9267 {
9268 break;// leave loop, goto error handling
9269 }
9270 if (a->Next()!=NULL)
9271 {
9273 failed=iiExprArith1(res->next,a->next,op);
9274 }
9275 a->CleanUp();
9276 return failed;
9277 }
9278 i++;
9279 }
9280 // implicite type conversion --------------------------------------------
9281 if (dA1[i].cmd!=op)
9282 {
9284 i=0;
9285 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9286 while (dA1[i].cmd==op)
9287 {
9288 int ai;
9289 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9290 if ((dA1[i].valid_for & NO_CONVERSION)==0)
9291 {
9292 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9293 {
9294 if (currRing!=NULL)
9295 {
9296 if (check_valid(dA1[i].valid_for,op)) break;
9297 }
9298 else
9299 {
9300 if (RingDependend(dA1[i].res))
9301 {
9302 WerrorS("no ring active (6)");
9303 break;
9304 }
9305 }
9306 if (traceit&TRACE_CALL)
9307 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9308 res->rtyp=dA1[i].res;
9309 failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9310 || (call_failed=dA1[i].p(res,an)));
9311 // everything done, clean up temp. variables
9312 if (failed)
9313 {
9314 // leave loop, goto error handling
9315 break;
9316 }
9317 else
9318 {
9319 if (an->Next() != NULL)
9320 {
9321 res->next = (leftv)omAllocBin(sleftv_bin);
9322 failed=iiExprArith1(res->next,an->next,op);
9323 }
9324 // everything ok, clean up and return
9325 an->CleanUp();
9327 return failed;
9328 }
9329 }
9330 }
9331 i++;
9332 }
9333 an->CleanUp();
9335 }
9336 // error handling
9337 if (!errorreported)
9338 {
9339 if ((at==0) && (a->Fullname()!=sNoName_fe))
9340 {
9341 Werror("`%s` is not defined",a->Fullname());
9342 }
9343 else
9344 {
9345 i=0;
9346 const char *s = iiTwoOps(op);
9347 Werror("%s(`%s`) failed"
9348 ,s,Tok2Cmdname(at));
9349 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9350 {
9351 while (dA1[i].cmd==op)
9352 {
9353 if ((dA1[i].res!=0)
9354 && (dA1[i].p!=jjWRONG))
9355 Werror("expected %s(`%s`)"
9356 ,s,Tok2Cmdname(dA1[i].arg));
9357 i++;
9358 }
9359 }
9360 }
9361 }
9362 res->rtyp = UNKNOWN;
9363 }
9364 a->CleanUp();
9365 return TRUE;
9366}
int BOOLEAN
Definition auxiliary.h:88
void * ADDRESS
Definition auxiliary.h:120
leftv next
Definition subexpr.h:86
leftv Next()
Definition subexpr.h:136
const char * Fullname()
Definition subexpr.h:125
const CanonicalForm int s
Definition facAbsFact.cc:51
const char sNoName_fe[]
Definition fevoices.cc:57
#define NO_CONVERSION
Definition gentable.cc:51
int iiTestConvert(int inputType, int outputType)
Definition gentable.cc:298
const char * iiTwoOps(int t)
Definition gentable.cc:258
#define jjWRONG
Definition gentable.cc:124
static int RingDependend(int t)
Definition gentable.cc:23
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9367
static BOOLEAN check_valid(const int p, const int op)
Definition iparith.cc:10179
VAR int iiOp
Definition iparith.cc:219
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition ipconv.cc:450
EXTERN_VAR omBin sleftv_bin
Definition ipid.h:145
short res
Definition gentable.cc:79
#define omAllocBin(bin)
#define omFreeBin(addr, bin)
#define BVERBOSE(a)
Definition options.h:35
#define V_SHOW_USE
Definition options.h:52
EXTERN_VAR int traceit
Definition reporter.h:24
#define TRACE_CALL
Definition reporter.h:44
sleftv * leftv
Definition structs.h:53
#define UNKNOWN
Definition tok.h:224

◆ iiExprArith2()

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

Definition at line 9178 of file iparith.cc.

9179{
9180 res->Init();
9181
9182 if (!errorreported)
9183 {
9184#ifdef SIQ
9185 if (siq>0)
9186 {
9187 //Print("siq:%d\n",siq);
9189 memcpy(&d->arg1,a,sizeof(sleftv));
9190 a->Init();
9191 memcpy(&d->arg2,b,sizeof(sleftv));
9192 b->Init();
9193 d->argc=2;
9194 d->op=op;
9195 res->data=(char *)d;
9196 res->rtyp=COMMAND;
9197 return FALSE;
9198 }
9199#endif
9200 int at=a->Typ();
9201 int bt=b->Typ();
9202 // handling bb-objects ----------------------------------------------------
9203 if (at>MAX_TOK)
9204 {
9205 blackbox *bb=getBlackboxStuff(at);
9206 if (bb!=NULL)
9207 {
9208 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9209 // if not defined, try generic (attrib, ..)
9210 }
9211 else
9212 return TRUE;
9213 }
9214 else if ((bt>MAX_TOK)&&(op!='('))
9215 {
9216 blackbox *bb=getBlackboxStuff(bt);
9217 if (bb!=NULL)
9218 {
9219 if(!bb->blackbox_Op2(op,res,a,b)) return FALSE;
9220 // if not defined, try generic (attrib, ..)
9221 }
9222 else
9223 return TRUE;
9224 }
9225 int i=iiTabIndex(dArithTab2,JJTAB2LEN,op);
9226 return iiExprArith2TabIntern(res,a,op,b,proccall,dArith2+i,at,bt,dConvertTypes);
9227 }
9228 a->CleanUp();
9229 b->CleanUp();
9230 return TRUE;
9231}
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:9005
const struct sValCmd2 dArith2[]
Definition table.h:325

◆ iiExprArith2Tab()

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

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

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

Definition at line 9164 of file iparith.cc.

9168{
9169 res->Init();
9170 leftv b=a->next;
9171 a->next=NULL;
9172 int bt=b->Typ();
9174 a->next=b;
9175 a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
9176 return bo;
9177}

◆ iiExprArith2TabIntern()

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

9010{
9011 BOOLEAN call_failed=FALSE;
9012
9013 if (!errorreported)
9014 {
9015 int i=0;
9016 iiOp=op;
9017 while (dA2[i].cmd==op)
9018 {
9019 if ((at==dA2[i].arg1)
9020 && (bt==dA2[i].arg2))
9021 {
9022 res->rtyp=dA2[i].res;
9023 if (currRing!=NULL)
9024 {
9025 if (check_valid(dA2[i].valid_for,op)) break;
9026 }
9027 else
9028 {
9029 if (RingDependend(dA2[i].res))
9030 {
9031 WerrorS("no ring active (3)");
9032 break;
9033 }
9034 }
9035 if (traceit&TRACE_CALL)
9036 Print("call %s(%s,%s)\n",iiTwoOps(op),Tok2Cmdname(at),Tok2Cmdname(bt));
9037 if ((call_failed=dA2[i].p(res,a,b)))
9038 {
9039 break;// leave loop, goto error handling
9040 }
9041 a->CleanUp();
9042 b->CleanUp();
9043 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9044 return FALSE;
9045 }
9046 i++;
9047 }
9048 // implicite type conversion ----------------------------------------------
9049 if (dA2[i].cmd!=op)
9050 {
9051 int ai,bi;
9054 BOOLEAN failed=FALSE;
9055 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9056 //Print("op: %c, type: %s %s\n",op,Tok2Cmdname(at),Tok2Cmdname(bt));
9057 while (dA2[i].cmd==op)
9058 {
9059 //Print("test %s %s\n",Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9060 if ((dA2[i].valid_for & NO_CONVERSION)==0)
9061 {
9062 if ((ai=iiTestConvert(at,dA2[i].arg1,dConvertTypes))!=0)
9063 {
9064 if ((bi=iiTestConvert(bt,dA2[i].arg2,dConvertTypes))!=0)
9065 {
9066 res->rtyp=dA2[i].res;
9067 if (currRing!=NULL)
9068 {
9069 if (check_valid(dA2[i].valid_for,op)) break;
9070 }
9071 else
9072 {
9073 if (RingDependend(dA2[i].res))
9074 {
9075 WerrorS("no ring active (4)");
9076 break;
9077 }
9078 }
9079 if (traceit&TRACE_CALL)
9080 Print("call %s(%s,%s)\n",iiTwoOps(op),
9081 Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9082 failed= ((iiConvert(at,dA2[i].arg1,ai,a,an))
9083 || (iiConvert(bt,dA2[i].arg2,bi,b,bn))
9084 || (call_failed=dA2[i].p(res,an,bn)));
9085 // everything done, clean up temp. variables
9086 if (failed)
9087 {
9088 // leave loop, goto error handling
9089 break;
9090 }
9091 else
9092 {
9093 // everything ok, clean up and return
9094 an->CleanUp();
9095 bn->CleanUp();
9098 return FALSE;
9099 }
9100 }
9101 }
9102 }
9103 i++;
9104 }
9105 an->CleanUp();
9106 bn->CleanUp();
9109 }
9110 // error handling ---------------------------------------------------
9111 const char *s=NULL;
9112 if (!errorreported)
9113 {
9114 if ((at==0) && (a->Fullname()!=sNoName_fe))
9115 {
9116 s=a->Fullname();
9117 }
9118 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9119 {
9120 s=b->Fullname();
9121 }
9122 if (s!=NULL)
9123 Werror("`%s` is not defined",s);
9124 else
9125 {
9126 i=0; /*iiTabIndex(dArithTab2,JJTAB2LEN,op);*/
9127 s = iiTwoOps(op);
9128 if (proccall)
9129 {
9130 Werror("%s(`%s`,`%s`) failed"
9131 ,s,Tok2Cmdname(at),Tok2Cmdname(bt));
9132 }
9133 else
9134 {
9135 Werror("`%s` %s `%s` failed"
9136 ,Tok2Cmdname(at),s,Tok2Cmdname(bt));
9137 }
9138 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9139 {
9140 while (dA2[i].cmd==op)
9141 {
9142 if(((at==dA2[i].arg1)||(bt==dA2[i].arg2))
9143 && (dA2[i].res!=0)
9144 && (dA2[i].p!=jjWRONG2))
9145 {
9146 if (proccall)
9147 Werror("expected %s(`%s`,`%s`)"
9148 ,s,Tok2Cmdname(dA2[i].arg1),Tok2Cmdname(dA2[i].arg2));
9149 else
9150 Werror("expected `%s` %s `%s`"
9151 ,Tok2Cmdname(dA2[i].arg1),s,Tok2Cmdname(dA2[i].arg2));
9152 }
9153 i++;
9154 }
9155 }
9156 }
9157 }
9158 a->CleanUp();
9159 b->CleanUp();
9160 res->rtyp = UNKNOWN;
9161 }
9162 return TRUE;
9163}
#define jjWRONG2
Definition gentable.cc:125
short res
Definition gentable.cc:70

◆ iiExprArith3()

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

Definition at line 9577 of file iparith.cc.

9578{
9579 res->Init();
9580
9581 if (!errorreported)
9582 {
9583#ifdef SIQ
9584 if (siq>0)
9585 {
9586 //Print("siq:%d\n",siq);
9588 memcpy(&d->arg1,a,sizeof(sleftv));
9589 a->Init();
9590 memcpy(&d->arg2,b,sizeof(sleftv));
9591 b->Init();
9592 memcpy(&d->arg3,c,sizeof(sleftv));
9593 c->Init();
9594 d->op=op;
9595 d->argc=3;
9596 res->data=(char *)d;
9597 res->rtyp=COMMAND;
9598 return FALSE;
9599 }
9600#endif
9601 int at=a->Typ();
9602 // handling bb-objects ----------------------------------------------
9603 if (at>MAX_TOK)
9604 {
9605 blackbox *bb=getBlackboxStuff(at);
9606 if (bb!=NULL)
9607 {
9608 if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
9609 // otherwise, try defaul (attrib,..)
9610 }
9611 else
9612 return TRUE;
9613 if (errorreported) return TRUE;
9614 }
9615 int bt=b->Typ();
9616 int ct=c->Typ();
9617
9618 iiOp=op;
9619 int i=0;
9620 while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
9621 return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
9622 }
9623 a->CleanUp();
9624 b->CleanUp();
9625 c->CleanUp();
9626 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9627 return TRUE;
9628}
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:9424
const struct sValCmd3 dArith3[]
Definition table.h:801

◆ iiExprArith3Tab()

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

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

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

Definition at line 9629 of file iparith.cc.

9633{
9634 res->Init();
9635 leftv b=a->next;
9636 a->next=NULL;
9637 int bt=b->Typ();
9638 leftv c=b->next;
9639 b->next=NULL;
9640 int ct=c->Typ();
9641 BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
9642 b->next=c;
9643 a->next=b;
9644 a->CleanUp(); // to cleanup the chain, content already done
9645 return bo;
9646}

◆ iiExprArith3TabIntern()

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

9427{
9428 BOOLEAN call_failed=FALSE;
9429
9430 assume(dA3[0].cmd==op);
9431
9432 if (!errorreported)
9433 {
9434 int i=0;
9435 iiOp=op;
9436 while (dA3[i].cmd==op)
9437 {
9438 if ((at==dA3[i].arg1)
9439 && (bt==dA3[i].arg2)
9440 && (ct==dA3[i].arg3))
9441 {
9442 res->rtyp=dA3[i].res;
9443 if (currRing!=NULL)
9444 {
9445 if (check_valid(dA3[i].valid_for,op)) break;
9446 }
9447 if (traceit&TRACE_CALL)
9448 Print("call %s(%s,%s,%s)\n",
9450 if ((call_failed=dA3[i].p(res,a,b,c)))
9451 {
9452 break;// leave loop, goto error handling
9453 }
9454 a->CleanUp();
9455 b->CleanUp();
9456 c->CleanUp();
9457 return FALSE;
9458 }
9459 i++;
9460 }
9461 // implicite type conversion ----------------------------------------------
9462 if (dA3[i].cmd!=op)
9463 {
9464 int ai,bi,ci;
9468 BOOLEAN failed=FALSE;
9469 i=0;
9470 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9471 while (dA3[i].cmd==op)
9472 {
9473 if ((dA3[i].valid_for & NO_CONVERSION)==0)
9474 {
9475 if ((ai=iiTestConvert(at,dA3[i].arg1,dConvertTypes))!=0)
9476 {
9477 if ((bi=iiTestConvert(bt,dA3[i].arg2,dConvertTypes))!=0)
9478 {
9479 if ((ci=iiTestConvert(ct,dA3[i].arg3,dConvertTypes))!=0)
9480 {
9481 res->rtyp=dA3[i].res;
9482 if (currRing!=NULL)
9483 {
9484 if (check_valid(dA3[i].valid_for,op)) break;
9485 }
9486 if (traceit&TRACE_CALL)
9487 Print("call %s(%s,%s,%s)\n",
9488 iiTwoOps(op),Tok2Cmdname(dA3[i].arg1),
9489 Tok2Cmdname(dA3[i].arg2),Tok2Cmdname(dA3[i].arg3));
9490 failed= ((iiConvert(at,dA3[i].arg1,ai,a,an,dConvertTypes))
9491 || (iiConvert(bt,dA3[i].arg2,bi,b,bn,dConvertTypes))
9492 || (iiConvert(ct,dA3[i].arg3,ci,c,cn,dConvertTypes))
9493 || (call_failed=dA3[i].p(res,an,bn,cn)));
9494 // everything done, clean up temp. variables
9495 if (failed)
9496 {
9497 // leave loop, goto error handling
9498 break;
9499 }
9500 else
9501 {
9502 // everything ok, clean up and return
9503 an->CleanUp();
9504 bn->CleanUp();
9505 cn->CleanUp();
9509 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9510 return FALSE;
9511 }
9512 }
9513 }
9514 }
9515 }
9516 i++;
9517 }
9518 an->CleanUp();
9519 bn->CleanUp();
9520 cn->CleanUp();
9524 }
9525 // error handling ---------------------------------------------------
9526 if (!errorreported)
9527 {
9528 const char *s=NULL;
9529 if ((at==0) && (a->Fullname()!=sNoName_fe))
9530 {
9531 s=a->Fullname();
9532 }
9533 else if ((bt==0) && (b->Fullname()!=sNoName_fe))
9534 {
9535 s=b->Fullname();
9536 }
9537 else if ((ct==0) && (c->Fullname()!=sNoName_fe))
9538 {
9539 s=c->Fullname();
9540 }
9541 if (s!=NULL)
9542 Werror("`%s` is not defined",s);
9543 else
9544 {
9545 i=0;
9546 //while ((dA3[i].cmd!=op)&&(dA3[i].cmd!=0)) i++;
9547 const char *s = iiTwoOps(op);
9548 Werror("%s(`%s`,`%s`,`%s`) failed"
9549 ,s,Tok2Cmdname(at),Tok2Cmdname(bt),Tok2Cmdname(ct));
9550 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9551 {
9552 while (dA3[i].cmd==op)
9553 {
9554 if(((at==dA3[i].arg1)
9555 ||(bt==dA3[i].arg2)
9556 ||(ct==dA3[i].arg3))
9557 && (dA3[i].res!=0))
9558 {
9559 Werror("expected %s(`%s`,`%s`,`%s`)"
9560 ,s,Tok2Cmdname(dA3[i].arg1)
9561 ,Tok2Cmdname(dA3[i].arg2)
9562 ,Tok2Cmdname(dA3[i].arg3));
9563 }
9564 i++;
9565 }
9566 }
9567 }
9568 }
9569 res->rtyp = UNKNOWN;
9570 }
9571 a->CleanUp();
9572 b->CleanUp();
9573 c->CleanUp();
9574 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9575 return TRUE;
9576}
short res
Definition gentable.cc:87

◆ iiExprArithM()

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

Definition at line 9668 of file iparith.cc.

9669{
9670 res->Init();
9671
9672 if (!errorreported)
9673 {
9674#ifdef SIQ
9675 if (siq>0)
9676 {
9677 //Print("siq:%d\n",siq);
9679 d->op=op;
9680 res->data=(char *)d;
9681 if (a!=NULL)
9682 {
9683 d->argc=a->listLength();
9684 // else : d->argc=0;
9685 memcpy(&d->arg1,a,sizeof(sleftv));
9686 switch(d->argc)
9687 {
9688 case 3:
9689 memcpy(&d->arg3,a->next->next,sizeof(sleftv));
9690 a->next->next->Init(); /* no break */
9691 case 2:
9692 memcpy(&d->arg2,a->next,sizeof(sleftv));
9693 a->next->Init();
9694 a->next->next=d->arg2.next;
9695 d->arg2.next=NULL; /* no break */
9696 case 1:
9697 a->Init();
9698 a->next=d->arg1.next;
9699 d->arg1.next=NULL;
9700 }
9701 if (d->argc>3) a->next=NULL;
9702 a->name=NULL;
9703 a->rtyp=0;
9704 a->data=NULL;
9705 a->e=NULL;
9706 a->attribute=NULL;
9707 a->CleanUp();
9708 }
9709 res->rtyp=COMMAND;
9710 return FALSE;
9711 }
9712#endif
9713 if ((a!=NULL) && (a->Typ()>MAX_TOK))
9714 {
9715 blackbox *bb=getBlackboxStuff(a->Typ());
9716 if (bb!=NULL)
9717 {
9718 if(!bb->blackbox_OpM(op,res,a)) return FALSE;
9719 // otherwise, try default
9720 }
9721 else
9722 return TRUE;
9723 if (errorreported) return TRUE;
9724 }
9725 int args=0;
9726 if (a!=NULL) args=a->listLength();
9727
9728 iiOp=op;
9729 int i=0;
9730 while ((dArithM[i].cmd!=op)&&(dArithM[i].cmd!=0)) i++;
9731 while (dArithM[i].cmd==op)
9732 {
9733 if ((args==dArithM[i].number_of_args)
9734 || (dArithM[i].number_of_args==-1)
9735 || ((dArithM[i].number_of_args==-2)&&(args>0)))
9736 {
9737 res->rtyp=dArithM[i].res;
9738 if (currRing!=NULL)
9739 {
9740 if (check_valid(dArithM[i].valid_for,op)) break;
9741 }
9742 if (traceit&TRACE_CALL)
9743 Print("call %s(... (%d args))\n", iiTwoOps(op),args);
9744 if (dArithM[i].p(res,a))
9745 {
9746 break;// leave loop, goto error handling
9747 }
9748 if (a!=NULL) a->CleanUp();
9749 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9750 return FALSE;
9751 }
9752 i++;
9753 }
9754 // error handling
9755 if (!errorreported)
9756 {
9757 if ((args>0) && (a->rtyp==0) && (a->Name()!=sNoName_fe))
9758 {
9759 Werror("`%s` is not defined",a->Fullname());
9760 }
9761 else
9762 {
9763 const char *s = iiTwoOps(op);
9764 Werror("%s(...) failed",s);
9765 }
9766 }
9767 res->rtyp = UNKNOWN;
9768 }
9769 if (a!=NULL) a->CleanUp();
9770 //Print("op: %d,result typ:%d\n",op,res->rtyp);
9771 return TRUE;
9772}
const char * name
Definition subexpr.h:87
int rtyp
Definition subexpr.h:91
const char * Name()
Definition subexpr.h:120
int listLength()
Definition subexpr.cc:51
void * data
Definition subexpr.h:88
Subexpr e
Definition subexpr.h:105
attr attribute
Definition subexpr.h:89
const struct sValCmdM dArithM[]
Definition table.h:937

◆ iiInitArithmetic()

int iiInitArithmetic ( )

initialisation of arithmetic structured data

Return values
0on success

Definition at line 9990 of file iparith.cc.

9991{
9992 //printf("iiInitArithmetic()\n");
9993 memset(&sArithBase, 0, sizeof(sArithBase));
9994 iiInitCmdName();
9995 /* fix last-identifier */
9996#if 0
9997 /* we expect that gentable allready did every thing */
9998 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1;
9999 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--) {
10000 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10001 }
10002#endif
10003 //Print("L=%d\n", sArithBase.nLastIdentifier);
10004
10005 //iiArithAddCmd(szName, nAlias, nTokval, nToktype);
10006 //iiArithAddCmd("mygcd", 1, GCD_CMD, CMD_2);
10007
10008 //iiArithAddCmd("Top", 0,-1,0);
10009
10010
10011 //for(i=0; i<sArithBase.nCmdUsed; i++) {
10012 // printf("CMD[%03d] %s, %d, %d, %d\n", i,
10013 // sArithBase.sCmds[i].name,
10014 // sArithBase.sCmds[i].alias,
10015 // sArithBase.sCmds[i].tokval,
10016 // sArithBase.sCmds[i].toktype);
10017 //}
10018 //iiArithRemoveCmd("Top");
10019 //iiArithAddCmd("mygcd", 2, GCD_CMD, CMD_2);
10020 //iiArithRemoveCmd("mygcd");
10021 //iiArithAddCmd("kkk", 1, 1234, CMD_1);
10022 return 0;
10023}

◆ iin_Int()

int iin_Int ( number & n,
coeffs cf )
static

Definition at line 222 of file iparith.cc.

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

◆ iiTabIndex()

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

Definition at line 9874 of file iparith.cc.

9875{
9876 // user defined types are not in the pre-computed table:
9877 if (op>MAX_TOK) return 0;
9878
9879 int a=0;
9880 int e=len;
9881 int p=len/2;
9882 do
9883 {
9884 if (op==dArithTab[p].cmd) return dArithTab[p].start;
9885 if (op<dArithTab[p].cmd) e=p-1;
9886 else a = p+1;
9887 p=a+(e-a)/2;
9888 }
9889 while ( a <= e);
9890
9891 // catch missing a cmd:
9892 // may be missing as a op for blackbox, if the first operand is "undef" instead of bb
9893 // Print("op %d (%c) unknown",op,op);
9894 return 0;
9895}

◆ iiTokType()

int iiTokType ( int op)

Definition at line 230 of file iparith.cc.

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

◆ IsCmd()

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

Definition at line 9775 of file iparith.cc.

9776{
9777 int i;
9778 int an=1;
9779 int en=sArithBase.nLastIdentifier;
9780
9781 loop
9782 //for(an=0; an<sArithBase.nCmdUsed; )
9783 {
9784 if(an>=en-1)
9785 {
9786 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9787 {
9788 i=an;
9789 break;
9790 }
9791 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9792 {
9793 i=en;
9794 break;
9795 }
9796 else
9797 {
9798 // -- blackbox extensions:
9799 // return 0;
9800 return blackboxIsCmd(n,tok);
9801 }
9802 }
9803 i=(an+en)/2;
9804 if (*n < *(sArithBase.sCmds[i].name))
9805 {
9806 en=i-1;
9807 }
9808 else if (*n > *(sArithBase.sCmds[i].name))
9809 {
9810 an=i+1;
9811 }
9812 else
9813 {
9814 int v=strcmp(n,sArithBase.sCmds[i].name);
9815 if(v<0)
9816 {
9817 en=i-1;
9818 }
9819 else if(v>0)
9820 {
9821 an=i+1;
9822 }
9823 else /*v==0*/
9824 {
9825 break;
9826 }
9827 }
9828 }
9829 lastreserved=sArithBase.sCmds[i].name;
9830 tok=sArithBase.sCmds[i].tokval;
9831 if(sArithBase.sCmds[i].alias==2)
9832 {
9833 Warn("outdated identifier `%s` used - please change your code",
9834 sArithBase.sCmds[i].name);
9835 sArithBase.sCmds[i].alias=1;
9836 }
9837 #if 0
9838 if (currRingHdl==NULL)
9839 {
9840 #ifdef SIQ
9841 if (siq<=0)
9842 {
9843 #endif
9844 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9845 {
9846 WerrorS("no ring active");
9847 return 0;
9848 }
9849 #ifdef SIQ
9850 }
9851 #endif
9852 }
9853 #endif
9854 if (!expected_parms)
9855 {
9856 switch (tok)
9857 {
9858 case IDEAL_CMD:
9859 case INT_CMD:
9860 case INTVEC_CMD:
9861 case MAP_CMD:
9862 case MATRIX_CMD:
9863 case MODUL_CMD:
9864 case POLY_CMD:
9865 case PROC_CMD:
9866 case RING_CMD:
9867 case STRING_CMD:
9868 cmdtok = tok;
9869 break;
9870 }
9871 }
9872 return sArithBase.sCmds[i].toktype;
9873}
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition blackbox.cc:219
@ END_RING
Definition grammar.cc:311
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ MAP_CMD
Definition grammar.cc:286
@ PROC_CMD
Definition grammar.cc:281
@ BEGIN_RING
Definition grammar.cc:283
@ MODUL_CMD
Definition grammar.cc:288
@ POLY_CMD
Definition grammar.cc:290
@ RING_CMD
Definition grammar.cc:282
int cmdtok
Definition grammar.cc:174
BOOLEAN expected_parms
Definition grammar.cc:173
VAR idhdl currRingHdl
Definition ipid.cc:57
const char * lastreserved
Definition ipshell.cc:83
@ INTVEC_CMD
Definition tok.h:101
@ STRING_CMD
Definition tok.h:187
@ INT_CMD
Definition tok.h:96

◆ jjALIGN_M()

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

Definition at line 1779 of file iparith.cc.

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

◆ jjALIGN_V()

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

Definition at line 1769 of file iparith.cc.

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

◆ jjAND_I()

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

Definition at line 1380 of file iparith.cc.

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

◆ jjBAREISS()

BOOLEAN jjBAREISS ( leftv res,
leftv v )
static

Definition at line 3879 of file iparith.cc.

3880{
3881 //matrix m=(matrix)v->Data();
3882 //lists l=mpBareiss(m,FALSE);
3883 intvec *iv;
3884 ideal m;
3885 sm_CallBareiss((ideal)v->Data(),0,0,m,&iv, currRing);
3887 l->Init(2);
3888 l->m[0].rtyp=MODUL_CMD;
3889 l->m[1].rtyp=INTVEC_CMD;
3890 l->m[0].data=(void *)m;
3891 l->m[1].data=(void *)iv;
3892 res->data = (char *)l;
3893 return FALSE;
3894}
int m
Definition cfEzgcd.cc:128
VAR omBin slists_bin
Definition lists.cc:23
slists * lists
void sm_CallBareiss(ideal I, int x, int y, ideal &M, intvec **iv, const ring R)
Definition sparsmat.cc:347

◆ jjBAREISS3()

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

Definition at line 6097 of file iparith.cc.

6098{
6099 intvec *iv;
6100 ideal m;
6102 int k=(int)(long)w->Data();
6103 if (k>=0)
6104 {
6105 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6106 l->Init(2);
6107 l->m[0].rtyp=MODUL_CMD;
6108 l->m[1].rtyp=INTVEC_CMD;
6109 l->m[0].data=(void *)m;
6110 l->m[1].data=(void *)iv;
6111 }
6112 else
6113 {
6114 m=sm_CallSolv((ideal)u->Data(), currRing);
6115 l->Init(1);
6116 l->m[0].rtyp=IDEAL_CMD;
6117 l->m[0].data=(void *)m;
6118 }
6119 res->data = (char *)l;
6120 return FALSE;
6121}
int k
Definition cfEzgcd.cc:99
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal sm_CallSolv(ideal I, const ring R)
Definition sparsmat.cc:2316

◆ jjBAREISS_BIM()

BOOLEAN jjBAREISS_BIM ( leftv res,
leftv v )
static

Definition at line 3902 of file iparith.cc.

3903{
3904 bigintmat *b=(bigintmat*)v->CopyD(BIGINTMAT_CMD);
3905 b->hnf();
3906 res->data=(char*)b;
3907 return FALSE;
3908}
Matrices of numbers.
Definition bigintmat.h:51
@ BIGINTMAT_CMD
Definition grammar.cc:278

◆ jjBI2IM()

BOOLEAN jjBI2IM ( leftv res,
leftv u )
static

Definition at line 3924 of file iparith.cc.

3925{
3926 bigintmat *b=(bigintmat*)u->Data();
3927 res->data=(void *)bim2iv(b);
3928 return FALSE;
3929}
intvec * bim2iv(bigintmat *b)
Definition bigintmat.cc:339

◆ jjBI2N()

BOOLEAN jjBI2N ( leftv res,
leftv u )
static

Definition at line 3909 of file iparith.cc.

3910{
3911 BOOLEAN bo=FALSE;
3912 number n=(number)u->CopyD();
3914 if (nMap!=NULL)
3915 res->data=nMap(n,coeffs_BIGINT,currRing->cf);
3916 else
3917 {
3918 Werror("cannot convert bigint to cring %s", nCoeffName(currRing->cf));
3919 bo=TRUE;
3920 }
3922 return bo;
3923}
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:703
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition coeffs.h:965
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
VAR coeffs coeffs_BIGINT
Definition polys.cc:14

◆ jjBI2P()

BOOLEAN jjBI2P ( leftv res,
leftv u )
static

Definition at line 3930 of file iparith.cc.

3931{
3932 sleftv tmp;
3933 BOOLEAN bo=jjBI2N(&tmp,u);
3934 if (!bo)
3935 {
3936 number n=(number) tmp.data;
3937 if (nIsZero(n)) { res->data=NULL;nDelete(&n); }
3938 else
3939 {
3940 res->data=(void *)pNSet(n);
3941 }
3942 }
3943 return bo;
3944}
static BOOLEAN jjBI2N(leftv res, leftv u)
Definition iparith.cc:3909
#define nDelete(n)
Definition numbers.h:16
#define nIsZero(n)
Definition numbers.h:19
#define pNSet(n)
Definition polys.h:314

◆ jjBIGINTVEC_PL()

BOOLEAN jjBIGINTVEC_PL ( leftv res,
leftv v )
static

Definition at line 7934 of file iparith.cc.

7935{
7936 leftv h=v;
7937 int l=0;
7938 while (h!=NULL)
7939 {
7940 if(h->Typ()==INT_CMD) l++;
7941 else if (h->Typ()==BIGINT_CMD) l++;
7942 else if (h->Typ()==INTVEC_CMD)
7943 {
7944 intvec *ivv=(intvec*)h->Data();
7945 l+=ivv->rows();
7946 }
7947 else if (h->Typ()==BIGINTVEC_CMD)
7948 {
7949 bigintmat *ivv=(bigintmat *)h->Data();
7950 l+=ivv->rows();
7951 }
7952 else return TRUE;
7953 h=h->next;
7954 }
7955 bigintmat *bim=new bigintmat(1,l,coeffs_BIGINT);
7956 h=v;
7957 int i=0;
7958 while (h!=NULL)
7959 {
7960 if(h->Typ()==INT_CMD)
7961 {
7962 number tp = n_Init((long)(h->Data()), coeffs_BIGINT);
7963 bim->set(i++, tp);
7964 n_Delete(&tp, coeffs_BIGINT);
7965 }
7966 else if (h->Typ()==INTVEC_CMD)
7967 {
7968 intvec *ivv=(intvec*)h->Data();
7969 for(int j=0;j<ivv->length();j++)
7970 {
7971 number tp = n_Init((long)(*ivv)[j], coeffs_BIGINT);
7972 bim->set(i++, tp);
7973 n_Delete(&tp, coeffs_BIGINT);
7974 }
7975 }
7976 else if(h->Typ()==BIGINT_CMD)
7977 {
7978 number tp = (number)h->Data();
7979 bim->set(i++, tp);
7980 }
7981 else if(h->Typ()==BIGINTVEC_CMD)
7982 {
7983 bigintmat *b=(bigintmat*)h->Data();
7984 for(int j=0;j<b->cols();j++)
7985 {
7986 number tp=BIMATELEM((*b),1,j);
7987 bim->set(i++, tp);
7988 }
7989 }
7990 h=h->next;
7991 }
7992 res->data=(char *)bim;
7993 return FALSE;
7994}
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int rows() const
Definition bigintmat.h:145
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
Definition bigintmat.cc:93
int length() const
Definition intvec.h:95
int rows() const
Definition intvec.h:97
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:541
int j
Definition facHensel.cc:110
@ BIGINTVEC_CMD
Definition grammar.cc:279
STATIC_VAR Poly * h
Definition janet.cc:971
@ BIGINT_CMD
Definition tok.h:38

◆ jjBIV2IV()

BOOLEAN jjBIV2IV ( leftv res,
leftv v )
static

Definition at line 4479 of file iparith.cc.

4480{
4481 bigintmat* aa= (bigintmat *)v->Data();
4482 int l=aa->cols();
4483 intvec *iv=new intvec(l);
4484 for(int i=0;i<l;i++) (*iv)[i]=iin_Int(BIMATELEM((*aa),1,i+1),coeffs_BIGINT);
4485 res->data = (void*)iv;
4486 return FALSE;
4487}
int cols() const
Definition bigintmat.h:144
static int iin_Int(number &n, coeffs cf)
Definition iparith.cc:222

◆ jjBRACK_Bim()

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

Definition at line 5842 of file iparith.cc.

5843{
5844 bigintmat *bim = (bigintmat *)u->Data();
5845 int r = (int)(long)v->Data();
5846 int c = (int)(long)w->Data();
5847 if ((r<1)||(r>bim->rows())||(c<1)||(c>bim->cols()))
5848 {
5849 Werror("wrong range[%d,%d] in bigintmat %s(%d x %d)",
5850 r,c,u->Fullname(),bim->rows(),bim->cols());
5851 return TRUE;
5852 }
5853 res->data=u->data; u->data=NULL;
5854 res->rtyp=u->rtyp; u->rtyp=0;
5855 res->name=u->name; u->name=NULL;
5856 Subexpr e=jjMakeSub(v);
5857 e->next=jjMakeSub(w);
5858 if (u->e==NULL)
5859 res->e=e;
5860 else
5861 {
5862 Subexpr h=u->e;
5863 while (h->next!=NULL) h=h->next;
5864 h->next=e;
5865 res->e=u->e;
5866 u->e=NULL;
5867 }
5868 return FALSE;
5869}
static Subexpr jjMakeSub(leftv e)
Definition iparith.cc:8972

◆ jjBRACK_Im()

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

Definition at line 5815 of file iparith.cc.

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

◆ jjBRACK_Ma()

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

Definition at line 5870 of file iparith.cc.

5871{
5872 matrix m= (matrix)u->Data();
5873 int r = (int)(long)v->Data();
5874 int c = (int)(long)w->Data();
5875 //Print("gen. elem %d, %d\n",r,c);
5876 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5877 {
5878 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5879 MATROWS(m),MATCOLS(m));
5880 return TRUE;
5881 }
5882 res->data=u->data; u->data=NULL;
5883 res->rtyp=u->rtyp; u->rtyp=0;
5884 res->name=u->name; u->name=NULL;
5885 Subexpr e=jjMakeSub(v);
5886 e->next=jjMakeSub(w);
5887 if (u->e==NULL)
5888 res->e=e;
5889 else
5890 {
5891 Subexpr h=u->e;
5892 while (h->next!=NULL) h=h->next;
5893 h->next=e;
5894 res->e=u->e;
5895 u->e=NULL;
5896 }
5897 return FALSE;
5898}
ip_smatrix * matrix
Definition matpol.h:43
#define MATROWS(i)
Definition matpol.h:26
#define MATCOLS(i)
Definition matpol.h:27

◆ jjBRACK_Ma_I_IV()

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

Definition at line 5928 of file iparith.cc.

5929{
5930 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5931 {
5932 WerrorS("cannot build expression lists from unnamed objects");
5933 return TRUE;
5934 }
5935
5936 leftv p=NULL;
5937 intvec *iv=(intvec *)w->Data();
5938 int l;
5939 BOOLEAN nok;
5940 sleftv ut;
5941 memcpy(&ut,u,sizeof(ut));
5942 sleftv t;
5943 t.Init();
5944 t.rtyp=INT_CMD;
5945 for (l=0;l< iv->length(); l++)
5946 {
5947 t.data=(char *)(long)((*iv)[l]);
5948 if (p==NULL)
5949 {
5950 p=res;
5951 }
5952 else
5953 {
5954 p->next=(leftv)omAlloc0Bin(sleftv_bin);
5955 p=p->next;
5956 }
5957 memcpy(u,&ut,sizeof(ut));
5958 if (u->Typ() == MATRIX_CMD)
5959 nok=jjBRACK_Ma(p,u,v,&t);
5960 else if (u->Typ() == BIGINTMAT_CMD)
5961 nok=jjBRACK_Bim(p,u,v,&t);
5962 else /* INTMAT_CMD */
5963 nok=jjBRACK_Im(p,u,v,&t);
5964 if (nok)
5965 {
5966 while (res->next!=NULL)
5967 {
5968 p=res->next->next;
5970 // res->e aufraeumen !!!!
5971 res->next=p;
5972 }
5973 return TRUE;
5974 }
5975 }
5976 return FALSE;
5977}
static BOOLEAN jjBRACK_Bim(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5842
static BOOLEAN jjBRACK_Im(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5815
static BOOLEAN jjBRACK_Ma(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:5870
#define IDHDL
Definition tok.h:31

◆ jjBRACK_Ma_IV_I()

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

Definition at line 5978 of file iparith.cc.

5979{
5980 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
5981 {
5982 WerrorS("cannot build expression lists from unnamed objects");
5983 return TRUE;
5984 }
5985 leftv p=NULL;
5986 intvec *iv=(intvec *)v->Data();
5987 int l;
5988 BOOLEAN nok;
5989 sleftv ut;
5990 memcpy(&ut,u,sizeof(ut));
5991 sleftv t;
5992 t.Init();
5993 t.rtyp=INT_CMD;
5994 for (l=0;l< iv->length(); l++)
5995 {
5996 t.data=(char *)(long)((*iv)[l]);
5997 if (p==NULL)
5998 {
5999 p=res;
6000 }
6001 else
6002 {
6003 p->next=(leftv)omAlloc0Bin(sleftv_bin);
6004 p=p->next;
6005 }
6006 memcpy(u,&ut,sizeof(ut));
6007 if (u->Typ() == MATRIX_CMD)
6008 nok=jjBRACK_Ma(p,u,&t,w);
6009 else if (u->Typ() == BIGINTMAT_CMD)
6010 nok=jjBRACK_Bim(p,u,&t,w);
6011 else /* INTMAT_CMD */
6012 nok=jjBRACK_Im(p,u,&t,w);
6013 if (nok)
6014 {
6015 while (res->next!=NULL)
6016 {
6017 p=res->next->next;
6019 // res->e aufraeumen !!
6020 res->next=p;
6021 }
6022 return TRUE;
6023 }
6024 }
6025 return FALSE;
6026}

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 6027 of file iparith.cc.

6028{
6029 if ((u->rtyp!=IDHDL)||(u->e!=NULL))
6030 {
6031 WerrorS("cannot build expression lists from unnamed objects");
6032 return TRUE;
6033 }
6034 leftv p=NULL;
6035 intvec *vv=(intvec *)v->Data();
6036 intvec *wv=(intvec *)w->Data();
6037 int vl;
6038 int wl;
6039 BOOLEAN nok;
6040
6041 sleftv t1,t2,ut;
6042 memcpy(&ut,u,sizeof(ut));
6043 t1.Init();
6044 t1.rtyp=INT_CMD;
6045 t2.Init();
6046 t2.rtyp=INT_CMD;
6047 for (vl=0;vl< vv->length(); vl++)
6048 {
6049 t1.data=(char *)(long)((*vv)[vl]);
6050 for (wl=0;wl< wv->length(); wl++)
6051 {
6052 t2.data=(char *)(long)((*wv)[wl]);
6053 if (p==NULL)
6054 {
6055 p=res;
6056 }
6057 else
6058 {
6059 p->next=(leftv)omAlloc0Bin(sleftv_bin);
6060 p=p->next;
6061 }
6062 memcpy(u,&ut,sizeof(ut));
6063 if (u->Typ() == MATRIX_CMD)
6064 nok=jjBRACK_Ma(p,u,&t1,&t2);
6065 else if (u->Typ() == BIGINTMAT_CMD)
6066 nok=jjBRACK_Bim(p,u,&t1,&t2);
6067 else /* INTMAT_CMD */
6068 nok=jjBRACK_Im(p,u,&t1,&t2);
6069 if (nok)
6070 {
6071 res->CleanUp();
6072 return TRUE;
6073 }
6074 }
6075 }
6076 return FALSE;
6077}

◆ jjBRACK_S()

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

Definition at line 5799 of file iparith.cc.

5800{
5801 char *s= (char *)u->Data();
5802 int r = (int)(long)v->Data();
5803 int c = (int)(long)w->Data();
5804 int l = strlen(s);
5805
5806 if ( (r<1) || (r>l) || (c<0) )
5807 {
5808 Werror("wrong range[%d,%d] in string %s",r,c,u->Fullname());
5809 return TRUE;
5810 }
5811 res->data = (char *)omAlloc((long)(c+1));
5812 snprintf((char *)res->data,c+1,"%-*.*s",c,c,s+r-1);
5813 return FALSE;
5814}
#define omAlloc(size)

◆ jjBRACK_SM()

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

Definition at line 5899 of file iparith.cc.

5900{
5901 ideal m= (ideal)u->Data();
5902 int r = (int)(long)v->Data();
5903 int c = (int)(long)w->Data();
5904 //Print("gen. elem %d, %d\n",r,c);
5905 if ((r<1)||(r>m->rank)||(c<1)||(c>IDELEMS(m)))
5906 {
5907 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5908 (int)m->rank,IDELEMS(m));
5909 return TRUE;
5910 }
5911 res->data=u->data; u->data=NULL;
5912 res->rtyp=u->rtyp; u->rtyp=0;
5913 res->name=u->name; u->name=NULL;
5914 Subexpr e=jjMakeSub(v);
5915 e->next=jjMakeSub(w);
5916 if (u->e==NULL)
5917 res->e=e;
5918 else
5919 {
5920 Subexpr h=u->e;
5921 while (h->next!=NULL) h=h->next;
5922 h->next=e;
5923 res->e=u->e;
5924 u->e=NULL;
5925 }
5926 return FALSE;
5927}

◆ jjBRACKET()

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

Definition at line 2918 of file iparith.cc.

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

◆ jjBRACKET_REC()

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

Definition at line 2945 of file iparith.cc.

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

◆ jjBREAK0()

BOOLEAN jjBREAK0 ( leftv ,
leftv  )
static

Definition at line 7334 of file iparith.cc.

7335{
7336#ifdef HAVE_SDB
7337 sdb_show_bp();
7338#endif
7339 return FALSE;
7340}
void sdb_show_bp()
Definition sdb.cc:57

◆ jjBREAK1()

BOOLEAN jjBREAK1 ( leftv ,
leftv v )
static

Definition at line 7341 of file iparith.cc.

7342{
7343#ifdef HAVE_SDB
7344 if(v->Typ()==PROC_CMD)
7345 {
7346 int lineno=0;
7347 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7348 {
7349 lineno=(int)(long)v->next->Data();
7350 }
7351 return sdb_set_breakpoint(v->Name(),lineno);
7352 }
7353 return TRUE;
7354#else
7355 return FALSE;
7356#endif
7357}
BOOLEAN sdb_set_breakpoint(const char *pp, int given_lineno)
Definition sdb.cc:64

◆ jjCALL1ARG()

BOOLEAN jjCALL1ARG ( leftv res,
leftv v )
static

Definition at line 7358 of file iparith.cc.

7359{
7360 return iiExprArith1(res,v,iiOp);
7361}

◆ jjCALL1MANY()

BOOLEAN jjCALL1MANY ( leftv res,
leftv u )
static

Definition at line 3945 of file iparith.cc.

3946{
3947 return iiExprArithM(res,u,iiOp);
3948}
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9668

◆ jjCALL2ARG()

BOOLEAN jjCALL2ARG ( leftv res,
leftv u )
static

Definition at line 7362 of file iparith.cc.

7363{
7364 leftv v=u->next;
7365 u->next=NULL;
7366 BOOLEAN b=iiExprArith2(res,u,iiOp,v, (iiOp > 255));
7367 u->next=v;
7368 return b;
7369}
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition iparith.cc:9178

◆ jjCALL3ARG()

BOOLEAN jjCALL3ARG ( leftv res,
leftv u )
static

Definition at line 7370 of file iparith.cc.

7371{
7372 leftv v = u->next;
7373 leftv w = v->next;
7374 u->next = NULL;
7375 v->next = NULL;
7376 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
7377 u->next = v;
7378 v->next = w;
7379 return b;
7380}
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9577

◆ jjCHAR()

BOOLEAN jjCHAR ( leftv res,
leftv v )
static

Definition at line 3949 of file iparith.cc.

3950{
3951 res->data = (char *)(long)rChar((ring)v->Data());
3952 return FALSE;
3953}
int rChar(ring r)
Definition ring.cc:719

◆ jjCHINREM_BI()

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

Definition at line 1682 of file iparith.cc.

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

◆ jjCHINREM_ID()

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

Definition at line 10231 of file iparith.cc.

10232{
10233 if ((currRing!=NULL)
10235 && (!rField_is_Z(currRing)))
10236 {
10237 WerrorS("not implemented for rings with rings as coeffients (except ZZ)");
10238 return TRUE;
10239 }
10240 coeffs cf;
10241 lists c=(lists)u->CopyD(); // list of ideal or bigint/int
10242 int rl=c->nr+1;
10243 int return_type=c->m[0].Typ();
10244 if ((return_type!=IDEAL_CMD)
10245 && (return_type!=MODUL_CMD)
10246 && (return_type!=SMATRIX_CMD)
10247 && (return_type!=MATRIX_CMD)
10248 && (return_type!=POLY_CMD))
10249 {
10250 if((return_type==BIGINT_CMD)
10251 ||(return_type==INT_CMD))
10252 return_type=BIGINT_CMD;
10253 else if (return_type==LIST_CMD)
10254 {
10255 // create a tmp list of the correct size
10257 res_l->Init(rl /*c->nr+1*/);
10258 BOOLEAN bo=FALSE;
10259 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,CHINREM_CMD);
10260 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10261 {
10262 sleftv tmp;
10263 tmp.Copy(v);
10264 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],CHINREM_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10265 if (bo) { Werror("chinrem failed for list entry %d",i+1); break;}
10266 }
10267 c->Clean();
10268 res->data=res_l;
10269 res->rtyp=LIST_CMD;
10270 return bo;
10271 }
10272 else
10273 {
10274 c->Clean();
10275 WerrorS("poly/ideal/module/matrix/list expected");
10276 return TRUE;
10277 }
10278 }
10279 if (return_type==BIGINT_CMD)
10281 else
10282 {
10283 cf=currRing->cf;
10284 if (nCoeff_is_Extension(cf) && (cf->extRing!=NULL))
10285 cf=cf->extRing->cf;
10286 }
10287 lists pl=NULL;
10288 intvec *p=NULL;
10289 if (v->Typ()==LIST_CMD)
10290 {
10291 pl=(lists)v->Data();
10292 if (pl->nr!=rl-1)
10293 {
10294 Werror("wromg number of primes (%d:%d) for chinrem",pl->nr+1,rl);
10295 return TRUE;
10296 }
10297 }
10298 else
10299 {
10300 p=(intvec*)v->Data();
10301 if (p->length()!=rl)
10302 {
10303 Werror("wromg number of primes (%d:%d) for chinrem",p->length(),rl);
10304 return TRUE;
10305 }
10306 }
10307 ideal result;
10308 ideal *x=(ideal *)omAlloc(rl*sizeof(ideal));
10309 number *xx=NULL;
10311 int i;
10312 if (return_type!=BIGINT_CMD)
10313 {
10314 for(i=rl-1;i>=0;i--)
10315 {
10316 if (c->m[i].Typ()!=return_type)
10317 {
10318 Werror("%s expected at pos %d",Tok2Cmdname(return_type),i+1);
10319 omFree(x); // delete c
10320 return TRUE;
10321 }
10322 if (return_type==POLY_CMD)
10323 {
10324 x[i]=idInit(1,1);
10325 x[i]->m[0]=(poly)c->m[i].CopyD();
10326 }
10327 else
10328 {
10329 x[i]=(ideal)c->m[i].CopyD();
10330 }
10331 //c->m[i].Init();
10332 }
10333 }
10334 else
10335 {
10336 if (nMap==NULL)
10337 {
10338 Werror("not implemented: map bigint -> %s", nCoeffName(cf));
10339 return TRUE;
10340 }
10341 xx=(number *)omAlloc(rl*sizeof(number));
10342 for(i=rl-1;i>=0;i--)
10343 {
10344 if (c->m[i].Typ()==INT_CMD)
10345 {
10346 xx[i]=n_Init(((int)(long)c->m[i].Data()),cf);
10347 }
10348 else if (c->m[i].Typ()==BIGINT_CMD)
10349 {
10350 xx[i]=nMap((number)c->m[i].Data(),coeffs_BIGINT,cf);
10351 }
10352 else
10353 {
10354 Werror("bigint expected at pos %d",i+1);
10355 omFree(x); // delete c
10356 omFree(xx); // delete c
10357 return TRUE;
10358 }
10359 }
10360 }
10361 number *q=(number *)omAlloc(rl*sizeof(number));
10362 if (p!=NULL)
10363 {
10364 for(i=rl-1;i>=0;i--)
10365 {
10366 q[i]=n_Init((*p)[i], cf);
10367 }
10368 }
10369 else
10370 {
10371 for(i=rl-1;i>=0;i--)
10372 {
10373 if (pl->m[i].Typ()==INT_CMD)
10374 {
10375 q[i]=n_Init((int)(long)pl->m[i].Data(),cf);
10376 }
10377 else if (pl->m[i].Typ()==BIGINT_CMD)
10378 {
10379 q[i]=nMap((number)(pl->m[i].Data()),coeffs_BIGINT,cf);
10380 }
10381 else
10382 {
10383 Werror("bigint expected at pos %d",i+1);
10384 for(i++;i<rl;i++)
10385 {
10386 n_Delete(&(q[i]),cf);
10387 }
10388 omFree(x); // delete c
10389 omFree(q); // delete pl
10390 if (xx!=NULL) omFree(xx); // delete c
10391 return TRUE;
10392 }
10393 }
10394 }
10395 if (return_type==BIGINT_CMD)
10396 {
10397 CFArray i_v(rl);
10398 number n=n_ChineseRemainderSym(xx,q,rl,TRUE,i_v,coeffs_BIGINT);
10399 res->data=(char *)n;
10400 }
10401 else
10402 {
10403 /* called in modular.lib::chinrem_recursive: too many proc.
10404 #ifdef HAVE_VSPACE
10405 int cpus = (long) feOptValue(FE_OPT_CPUS);
10406 if ((cpus>1) && (rField_is_Q(currRing)))
10407 result=id_ChineseRemainder_0(x,q,rl,currRing); // deletes also x
10408 else
10409 #endif
10410 */
10411 result=id_ChineseRemainder(x,q,rl,currRing); // deletes also x
10412 c->Clean();
10413 if ((return_type==POLY_CMD) &&(result!=NULL))
10414 {
10415 res->data=(char *)result->m[0];
10416 result->m[0]=NULL;
10417 idDelete(&result);
10418 }
10419 else
10420 res->data=(char *)result;
10421 }
10422 for(i=rl-1;i>=0;i--)
10423 {
10424 n_Delete(&(q[i]),cf);
10425 }
10426 omFree(q);
10427 res->rtyp=return_type;
10428 return result==NULL;
10429}
void Copy(leftv e)
Definition subexpr.cc:689
sleftv * m
Definition lists.h:46
void Clean(ring r=currRing)
Definition lists.h:26
INLINE_THIS void Init(int l=0)
int nr
Definition lists.h:44
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:844
return result
@ SMATRIX_CMD
Definition grammar.cc:292
#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:520
ideal idInit(int idsize, int rank)
initialise an ideal / module
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)
@ LIST_CMD
Definition tok.h:118
@ CHINREM_CMD
Definition tok.h:45

◆ jjCOEF()

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

Definition at line 1793 of file iparith.cc.

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

◆ jjCOEF_Id()

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

Definition at line 1800 of file iparith.cc.

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

◆ jjCOEF_M()

BOOLEAN jjCOEF_M ( leftv ,
leftv v )
static

Definition at line 7382 of file iparith.cc.

7383{
7384 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7385 if (iiCheckTypes(v,t,1))
7386 {
7387 idhdl c=(idhdl)v->next->next->data;
7388 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7389 idhdl m=(idhdl)v->next->next->next->data;
7390 idDelete((ideal *)&(c->data.uideal));
7391 idDelete((ideal *)&(m->data.uideal));
7392 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7393 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7394 return FALSE;
7395 }
7396 return TRUE;
7397}
@ VECTOR_CMD
Definition grammar.cc:293
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition ipshell.cc:6576
void mp_Coef2(poly v, poly mon, matrix *c, matrix *m, const ring R)
corresponds to Macauley's coef: the exponent vector of vars has to contain the variables,...
Definition matpol.cc:574
idrec * idhdl
Definition ring.h:22

◆ jjCOEFFS1()

BOOLEAN jjCOEFFS1 ( leftv res,
leftv v )
static

Definition at line 3954 of file iparith.cc.

3955{
3956 ring r=(ring)v->Data();
3957 r->cf->ref++;
3958 res->data = (char *)r->cf;
3959 return FALSE;
3960}

◆ jjCOEFFS2_KB()

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

Definition at line 1818 of file iparith.cc.

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

◆ jjCOEFFS3_Id()

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

Definition at line 6122 of file iparith.cc.

6123{
6124 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6125 {
6126 WerrorS("3rd argument must be a name of a matrix");
6127 return TRUE;
6128 }
6129 ideal i=(ideal)u->Data();
6130 int rank=(int)i->rank;
6131 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6132 if (r) return TRUE;
6133 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6134 return FALSE;
6135}
static BOOLEAN jjCOEFFS_Id(leftv res, leftv u, leftv v)
Definition iparith.cc:1807
void mp_Monomials(matrix c, int r, int var, matrix m, const ring R)
Definition matpol.cc:355
#define pVar(m)
Definition polys.h:381

◆ jjCOEFFS3_KB()

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

Definition at line 6136 of file iparith.cc.

6137{
6138 res->data=(void*)idCoeffOfKBase((ideal)(u->Data()),
6139 (ideal)(v->Data()),(poly)(w->Data()));
6140 return FALSE;
6141}

◆ jjCOEFFS3_P()

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

Definition at line 6142 of file iparith.cc.

6143{
6144 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6145 {
6146 WerrorS("3rd argument must be a name of a matrix");
6147 return TRUE;
6148 }
6149 // CopyD for POLY_CMD and VECTOR_CMD are identical:
6150 poly p=(poly)u->CopyD(POLY_CMD);
6151 ideal i=idInit(1,1);
6152 i->m[0]=p;
6153 sleftv t;
6154 t.Init();
6155 t.data=(char *)i;
6156 t.rtyp=IDEAL_CMD;
6157 int rank=1;
6158 if (u->Typ()==VECTOR_CMD)
6159 {
6160 i->rank=rank=pMaxComp(p);
6161 t.rtyp=MODUL_CMD;
6162 }
6163 BOOLEAN r=jjCOEFFS_Id(res,&t,v);
6164 t.CleanUp();
6165 if (r) return TRUE;
6166 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6167 return FALSE;
6168}
#define pMaxComp(p)
Definition polys.h:300

◆ jjCOEFFS_Id()

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

Definition at line 1807 of file iparith.cc.

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

◆ jjCOLCOL()

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 v->Init();
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
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3770
if(!FE_OPT_NO_SHELL_FLAG)
Definition fehelp.cc:1000
#define IDPACKAGE(a)
Definition ipid.h:139
BOOLEAN iiTryLoadLib(leftv v, const char *id)
Definition iplib.cc:832
void syMake(leftv v, const char *id, package pa)
Definition subexpr.cc:1613
@ LANG_TOP
Definition subexpr.h:22
@ PACKAGE_CMD
Definition tok.h:150
@ DEF_CMD
Definition tok.h:58

◆ jjCOLON()

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

Definition at line 320 of file iparith.cc.

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

◆ jjCOLS()

BOOLEAN jjCOLS ( leftv res,
leftv v )
static

Definition at line 3961 of file iparith.cc.

3962{
3963 res->data = (char *)(long)MATCOLS((matrix)(v->Data()));
3964 return FALSE;
3965}

◆ jjCOLS_BIM()

BOOLEAN jjCOLS_BIM ( leftv res,
leftv v )
static

Definition at line 3966 of file iparith.cc.

3967{
3968 res->data = (char *)(long)((bigintmat*)(v->Data()))->cols();
3969 return FALSE;
3970}

◆ jjCOLS_IV()

BOOLEAN jjCOLS_IV ( leftv res,
leftv v )
static

Definition at line 3971 of file iparith.cc.

3972{
3973 res->data = (char *)(long)((intvec*)(v->Data()))->cols();
3974 return FALSE;
3975}

◆ jjCOMPARE_ALL()

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

Definition at line 10449 of file iparith.cc.

10450{
10451 leftv a=(leftv)aa;
10452 int at=a->Typ();
10453 leftv b=(leftv)bb;
10454 int bt=b->Typ();
10455 if (at < bt) return -1;
10456 if (at > bt) return 1;
10457 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,'<');
10458 sleftv tmp;
10459 tmp.Init();
10460 iiOp='<';
10461 BOOLEAN bo=iiExprArith2TabIntern(&tmp,a,'<',b,FALSE,dArith2+tab_pos,at,bt,dConvertTypes);
10462 if (bo)
10463 {
10464 Werror(" no `<` for %s",Tok2Cmdname(at));
10465 unsigned long ad=(unsigned long)a->Data();
10466 unsigned long bd=(unsigned long)b->Data();
10467 if (ad<bd) return -1;
10468 else if (ad==bd) return 0;
10469 else return 1;
10470 }
10471 else if (tmp.data==NULL) /* not < */
10472 {
10474 tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,EQUAL_EQUAL);
10476 if (bo)
10477 {
10478 Werror(" no `==` for %s",Tok2Cmdname(at));
10479 unsigned long ad=(unsigned long)a->Data();
10480 unsigned long bd=(unsigned long)b->Data();
10481 if (ad<bd) return -1;
10482 else if (ad==bd) return 0;
10483 else return 1;
10484 }
10485 else if (tmp.data==NULL) /* not <,== */ return 1;
10486 else return 0;
10487 }
10488 else return -1;
10489}
@ EQUAL_EQUAL
Definition grammar.cc:268

◆ jjCOMPARE_BIM()

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

Definition at line 367 of file iparith.cc.

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

◆ jjCOMPARE_IV()

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

Definition at line 339 of file iparith.cc.

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

◆ jjCOMPARE_IV_I()

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

Definition at line 397 of file iparith.cc.

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

◆ jjCOMPARE_MA()

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

Definition at line 424 of file iparith.cc.

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

◆ jjCOMPARE_P()

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

Definition at line 452 of file iparith.cc.

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

◆ jjCOMPARE_S()

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

Definition at line 479 of file iparith.cc.

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

◆ jjCONTENT()

BOOLEAN jjCONTENT ( leftv res,
leftv v )
static

Definition at line 3976 of file iparith.cc.

3977{
3978 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3979 poly p=(poly)v->CopyD(POLY_CMD);
3980 if (p!=NULL) p_Cleardenom(p, currRing);
3981 res->data = (char *)p;
3982 return FALSE;
3983}
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2893

◆ jjCONTRACT()

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

Definition at line 1832 of file iparith.cc.

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

◆ jjCOUNT_BI()

BOOLEAN jjCOUNT_BI ( leftv res,
leftv v )
static

Definition at line 3984 of file iparith.cc.

3985{
3986 res->data = (char *)(long)n_Size((number)v->Data(),coeffs_BIGINT);
3987 return FALSE;
3988}
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:573

◆ jjCOUNT_BIM()

BOOLEAN jjCOUNT_BIM ( leftv res,
leftv v )
static

Definition at line 3989 of file iparith.cc.

3990{
3991 bigintmat* aa= (bigintmat *)v->Data();
3992 res->data = (char *)(long)(aa->rows()*aa->cols());
3993 return FALSE;
3994}

◆ jjCOUNT_IV()

BOOLEAN jjCOUNT_IV ( leftv res,
leftv v )
static

Definition at line 4012 of file iparith.cc.

4013{
4014 res->data = (char *)(long)((intvec*)(v->Data()))->length();
4015 return FALSE;
4016}

◆ jjCOUNT_L()

BOOLEAN jjCOUNT_L ( leftv res,
leftv v )
static

Definition at line 4000 of file iparith.cc.

4001{
4002 lists l=(lists)v->Data();
4003 res->data = (char *)(long)(lSize(l)+1);
4004 return FALSE;
4005}
int lSize(lists L)
Definition lists.cc:25

◆ jjCOUNT_M()

BOOLEAN jjCOUNT_M ( leftv res,
leftv v )
static

Definition at line 4006 of file iparith.cc.

4007{
4008 matrix m=(matrix)v->Data();
4009 res->data = (char *)(long)(MATROWS(m)*MATCOLS(m));
4010 return FALSE;
4011}

◆ jjCOUNT_N()

BOOLEAN jjCOUNT_N ( leftv res,
leftv v )
static

Definition at line 3995 of file iparith.cc.

3996{
3997 res->data = (char *)(long)nSize((number)v->Data());
3998 return FALSE;
3999}

◆ jjCOUNT_RES()

BOOLEAN jjCOUNT_RES ( leftv res,
leftv v )
static

Definition at line 5768 of file iparith.cc.

5769{
5770 res->data=(char *)(long)sySize((syStrategy)v->Data());
5771 return FALSE;
5772}
int sySize(syStrategy syzstr)
Definition syz1.cc:1831
ssyStrategy * syStrategy
Definition syz.h:36

◆ jjCOUNT_RG()

BOOLEAN jjCOUNT_RG ( leftv res,
leftv v )
static

Definition at line 4017 of file iparith.cc.

4018{
4019 ring r=(ring)v->Data();
4020 int elems=-1;
4021 if (rField_is_Zp(r)) elems=r->cf->ch;
4022 else if (rField_is_GF(r)) elems=r->cf->m_nfCharQ;
4023 else if (rField_is_Zp_a(r) && (r->cf->type==n_algExt))
4024 {
4025 extern int ipower ( int b, int n ); /* factory/cf_util */
4026 elems=ipower(r->cf->ch,r->cf->extRing->pFDeg(r->cf->extRing->qideal->m[0],r->cf->extRing));
4027 }
4028 res->data = (char *)(long)elems;
4029 return FALSE;
4030}
int ipower(int b, int m)
int ipower ( int b, int m )
Definition cf_util.cc:27
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
static BOOLEAN rField_is_Zp_a(const ring r)
Definition ring.h:540
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:532

◆ jjDEFINED()

BOOLEAN jjDEFINED ( leftv res,
leftv v )
static

Definition at line 4067 of file iparith.cc.

4068{
4069 if ((v->rtyp==IDHDL)
4070 && ((myynest==IDLEV((idhdl)v->data))||(0==IDLEV((idhdl)v->data))))
4071 {
4072 res->data=(void *)(long)(IDLEV((idhdl)v->data)+1);
4073 }
4074 else if (v->rtyp!=0) res->data=(void *)(-1);
4075 return FALSE;
4076}
#define IDLEV(a)
Definition ipid.h:121

◆ jjDEG()

BOOLEAN jjDEG ( leftv res,
leftv v )
static

Definition at line 4031 of file iparith.cc.

4032{
4033 int dummy;
4034 poly p=(poly)v->Data();
4035 if (p!=NULL) res->data = (char *)currRing->pLDeg(p,&dummy,currRing);
4036 else res->data=(char *)-1;
4037 return FALSE;
4038}

◆ jjDEG_IV()

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

Definition at line 1848 of file iparith.cc.

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

◆ jjDEG_M()

BOOLEAN jjDEG_M ( leftv res,
leftv u )
static

Definition at line 4039 of file iparith.cc.

4040{
4041 ideal I=(ideal)u->Data();
4042 int d=-1;
4043 int dummy;
4044 int i;
4045 for(i=IDELEMS(I)-1;i>=0;i--)
4046 if (I->m[i]!=NULL) d=si_max(d,(int)currRing->pLDeg(I->m[i],&dummy,currRing));
4047 res->data = (char *)(long)d;
4048 return FALSE;
4049}
static int si_max(const int a, const int b)
Definition auxiliary.h:125

◆ jjDEG_M_IV()

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

Definition at line 1837 of file iparith.cc.

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

◆ jjDEGREE()

BOOLEAN jjDEGREE ( leftv res,
leftv v )
static

Definition at line 4050 of file iparith.cc.

4051{
4052 SPrintStart();
4053 if (rField_is_Z(currRing))
4054 {
4055 PrintS("// NOTE: computation of degree is being performed for\n");
4056 PrintS("// generic fibre, that is, over Q\n");
4057 }
4059 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4060 scDegree((ideal)v->Data(),module_w,currRing->qideal);
4061 char *s=SPrintEnd();
4062 int l=strlen(s)-1;
4063 s[l]='\0';
4064 res->data=(void*)s;
4065 return FALSE;
4066}
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition attrib.cc:132
void scDegree(ideal S, intvec *modulweight, ideal Q)
Definition hilb.cc:2055
void SPrintStart()
Definition reporter.cc:250
void PrintS(const char *s)
Definition reporter.cc:288
char * SPrintEnd()
Definition reporter.cc:277
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587

◆ jjDelete_ID()

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

Definition at line 1869 of file iparith.cc.

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

◆ jjDelete_ID_IV()

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

Definition at line 1876 of file iparith.cc.

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

◆ jjDelete_IV()

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

Definition at line 1862 of file iparith.cc.

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

◆ jjDENOMINATOR()

BOOLEAN jjDENOMINATOR ( leftv res,
leftv v )
static

Return the denominator of the input number.

Definition at line 4079 of file iparith.cc.

4080{
4081 number n = reinterpret_cast<number>(v->CopyD());
4082 res->data = reinterpret_cast<void*>(n_GetDenom(n, currRing->cf));
4083 n_Delete(&n,currRing->cf);
4084 return FALSE;
4085}
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:606

◆ jjDET()

BOOLEAN jjDET ( leftv res,
leftv v )
static

Definition at line 4096 of file iparith.cc.

4097{
4098 matrix m=(matrix)v->Data();
4099 res ->data = mp_Det(m,currRing);
4100 return FALSE;
4101}
poly mp_Det(matrix a, const ring r, DetVariant d)
Definition matpol.cc:2139

◆ jjDET2()

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

Definition at line 1896 of file iparith.cc.

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

◆ jjDET2_S()

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

Definition at line 1903 of file iparith.cc.

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

◆ jjDET_BI()

BOOLEAN jjDET_BI ( leftv res,
leftv v )
static

Definition at line 4102 of file iparith.cc.

4103{
4104 bigintmat * m=(bigintmat*)v->Data();
4105 int i,j;
4106 i=m->rows();j=m->cols();
4107 if(i==j)
4108 res->data = (char *)(long)singclap_det_bi(m,coeffs_BIGINT);
4109 else
4110 {
4111 Werror("det of %d x %d bigintmat",i,j);
4112 return TRUE;
4113 }
4114 return FALSE;
4115}
number singclap_det_bi(bigintmat *m, const coeffs cf)
Definition clapsing.cc:1852

◆ jjDET_I()

BOOLEAN jjDET_I ( leftv res,
leftv v )
static

Definition at line 4138 of file iparith.cc.

4139{
4140 intvec * m=(intvec*)v->Data();
4141 int i,j;
4142 i=m->rows();j=m->cols();
4143 if(i==j)
4144 res->data = (char *)(long)singclap_det_i(m,currRing);
4145 else
4146 {
4147 Werror("det of %d x %d intmat",i,j);
4148 return TRUE;
4149 }
4150 return FALSE;
4151}
int singclap_det_i(intvec *m, const ring)
Definition clapsing.cc:1834

◆ jjDET_S()

BOOLEAN jjDET_S ( leftv res,
leftv v )
static

Definition at line 4152 of file iparith.cc.

4153{
4154 ideal I=(ideal)v->Data();
4155 res->data=(char*)sm_Det(I,currRing);
4156 return FALSE;
4157}

◆ jjDIFF_COEF()

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

Definition at line 4516 of file iparith.cc.

4517{
4518 if (!nCoeff_is_transExt(currRing->cf))
4519 {
4520 WerrorS("differentiation not defined in the coefficient ring");
4521 return TRUE;
4522 }
4523 number n = (number) u->Data();
4524 number k = (number) v->Data();
4525 res->data = ntDiff(n,k,currRing->cf);
4526 return FALSE;
4527}
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
Definition coeffs.h:916
number ntDiff(number a, number d, const coeffs cf)
Definition transext.cc:897

◆ jjDIFF_ID()

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

Definition at line 1921 of file iparith.cc.

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

◆ jjDIFF_ID_ID()

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

Definition at line 1932 of file iparith.cc.

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

◆ jjDIFF_P()

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

Definition at line 1910 of file iparith.cc.

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

◆ jjDIM()

BOOLEAN jjDIM ( leftv res,
leftv v )
static

Definition at line 4158 of file iparith.cc.

4159{
4161#ifdef HAVE_SHIFTBBA
4162 if (rIsLPRing(currRing))
4163 {
4165 {
4166 WerrorS("`dim` is not implemented for letterplace rings over rings");
4167 return TRUE;
4168 }
4169 if (currRing->qideal != NULL)
4170 {
4171 WerrorS("qring not supported by `dim` for letterplace rings at the moment");
4172 return TRUE;
4173 }
4174 int gkDim = lp_gkDim((ideal)(v->Data()));
4175 res->data = (char *)(long)gkDim;
4176 return (gkDim == -2);
4177 }
4178#endif
4180 {
4181 Warn("dim(%s) may be wrong because the mixed monomial ordering",v->Name());
4182 }
4183 res->data = (char *)(long)scDimIntRing((ideal)(v->Data()),currRing->qideal);
4184 return FALSE;
4185}
int scDimIntRing(ideal vid, ideal Q)
scDimInt for ring-coefficients
Definition hdegree.cc:136
int lp_gkDim(const ideal _G)
Definition hdegree.cc:1827
static BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:775

◆ jjDIM2()

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

Definition at line 1937 of file iparith.cc.

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

◆ jjDIM_R()

BOOLEAN jjDIM_R ( leftv res,
leftv v )
static

Definition at line 5773 of file iparith.cc.

5774{
5775 res->data = (char *)(long)syDim((syStrategy)v->Data());
5776 return FALSE;
5777}
int syDim(syStrategy syzstr)
Definition syz1.cc:1851

◆ jjDIV_BI()

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

Definition at line 1250 of file iparith.cc.

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

◆ jjDIV_Ma()

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

Definition at line 1294 of file iparith.cc.

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

◆ jjDIV_N()

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

Definition at line 1263 of file iparith.cc.

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

◆ jjDIV_P()

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

Definition at line 1276 of file iparith.cc.

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

◆ jjDIVISION()

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

Definition at line 1954 of file iparith.cc.

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

◆ jjDIVISION4()

BOOLEAN jjDIVISION4 ( leftv res,
leftv v )
static

Definition at line 7399 of file iparith.cc.

7400{ // may have 3 or 4 arguments
7401 leftv v1=v;
7402 leftv v2=v1->next;
7403 leftv v3=v2->next;
7404 leftv v4=v3->next;
7405 assumeStdFlag(v2);
7406
7407 int i1=iiTestConvert(v1->Typ(),MODUL_CMD);
7408 int i2=iiTestConvert(v2->Typ(),MODUL_CMD);
7409
7410 if((i1==0)||(i2==0)
7411 ||(v3->Typ()!=INT_CMD)||((v4!=NULL)&&(v4->Typ()!=INTVEC_CMD)))
7412 {
7413 WarnS("<module>,<module>,<int>[,<intvec>] expected!");
7414 return TRUE;
7415 }
7416
7417 sleftv w1,w2;
7418 iiConvert(v1->Typ(),MODUL_CMD,i1,v1,&w1);
7419 iiConvert(v2->Typ(),MODUL_CMD,i2,v2,&w2);
7420 ideal P=(ideal)w1.Data();
7421 ideal Q=(ideal)w2.Data();
7422
7423 int n=(int)(long)v3->Data();
7424 int *w=NULL;
7425 if(v4!=NULL)
7426 {
7427 w = iv2array((intvec *)v4->Data(),currRing);
7428 int * w0 = w + 1;
7429 int i = currRing->N;
7430 while( (i > 0) && ((*w0) > 0) )
7431 {
7432 w0++;
7433 i--;
7434 }
7435 if(i>0)
7436 WarnS("not all weights are positive!");
7437 }
7438
7439 matrix T;
7440 ideal R;
7441 idLiftW(P,Q,n,T,R,w);
7442
7443 w1.CleanUp();
7444 w2.CleanUp();
7445 if(w!=NULL)
7446 omFreeSize( (ADDRESS)w, (rVar(currRing)+1)*sizeof(int) );
7447
7449 L->Init(2);
7450 L->m[1].rtyp=v1->Typ();
7451 if(v1->Typ()==POLY_CMD||v1->Typ()==VECTOR_CMD)
7452 {
7453 if(v1->Typ()==POLY_CMD)
7454 p_Shift(&R->m[0],-1,currRing);
7455 L->m[1].data=(void *)R->m[0];
7456 R->m[0]=NULL;
7457 idDelete(&R);
7458 }
7459 else if(v1->Typ()==IDEAL_CMD||v1->Typ()==MATRIX_CMD)
7460 L->m[1].data=(void *)id_Module2Matrix(R,currRing);
7461 else
7462 {
7463 L->m[1].rtyp=MODUL_CMD;
7464 L->m[1].data=(void *)R;
7465 }
7466 L->m[0].rtyp=MATRIX_CMD;
7467 L->m[0].data=(char *)T;
7468
7469 res->data=L;
7470
7471 return FALSE;
7472}
void idLiftW(ideal P, ideal Q, int n, matrix &T, ideal &R, int *w)
Definition ideals.cc:1345
matrix id_Module2Matrix(ideal mod, const ring R)
#define Q
Definition sirandom.c:26

◆ jjDIVMOD_I()

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

Definition at line 1227 of file iparith.cc.

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

◆ jjDOTDOT()

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

Definition at line 333 of file iparith.cc.

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

◆ jjDUMMY()

BOOLEAN jjDUMMY ( leftv res,
leftv u )
static

Definition at line 3777 of file iparith.cc.

3778{
3779// res->data = (char *)u->CopyD();
3780// also copy attributes:
3781 res->Copy(u);
3782 return FALSE;
3783}

◆ jjDUMP()

BOOLEAN jjDUMP ( leftv ,
leftv v )
static

Definition at line 4186 of file iparith.cc.

4187{
4188 si_link l = (si_link)v->Data();
4189 if (slDump(l))
4190 {
4191 const char *s;
4192 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4193 else s=sNoName_fe;
4194 Werror("cannot dump to `%s`",s);
4195 return TRUE;
4196 }
4197 else
4198 return FALSE;
4199}

◆ jjE()

BOOLEAN jjE ( leftv res,
leftv v )
static

Definition at line 4200 of file iparith.cc.

4201{
4202 res->data = (char *)pOne();
4203 int co=(int)(long)v->Data();
4204 if (co>0)
4205 {
4206 pSetComp((poly)res->data,co);
4207 pSetm((poly)res->data);
4208 }
4209 else WerrorS("argument of gen must be positive");
4210 return (co<=0);
4211}
#define pSetComp(p, v)
Definition polys.h:39
#define pOne()
Definition polys.h:316

◆ jjELIMIN()

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

Definition at line 1974 of file iparith.cc.

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

◆ jjELIMIN_ALG()

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

Definition at line 6169 of file iparith.cc.

6170{
6171 ideal I=(ideal)u->Data();
6172 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6173 res->data=(char *)idElimination(I,(poly)v->Data(),NULL,alg);
6174 //setFlag(res,FLAG_STD);
6175 return v->next!=NULL; //do not allow next like in eliminate(I,a(1..4))
6176}
GbVariant syGetAlgorithm(char *n, const ring r, const ideal)
Definition ideals.cc:3701
GbVariant
Definition ideals.h:119

◆ jjELIMIN_HILB()

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

Definition at line 6177 of file iparith.cc.

6178{
6179 bigintmat *ww=(bigintmat*)w->Data();
6180
6181 res->data=(char *)idElimination2((ideal)u->Data(),(poly)v->Data(),
6182 ww);
6183 //setFlag(res,FLAG_STD);
6184 return FALSE;
6185}
ideal idElimination2(ideal h1, poly delVar, bigintmat *hilb, GbVariant alg)
Definition ideals.cc:1647

◆ jjELIMIN_IV()

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

Definition at line 1980 of file iparith.cc.

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

◆ jjENVELOPE()

BOOLEAN jjENVELOPE ( leftv res,
leftv a )
static

Definition at line 5331 of file iparith.cc.

5332{
5333#ifdef HAVE_PLURAL
5334 ring r = (ring)a->Data();
5335 if (rIsPluralRing(r))
5336 {
5337 ring s = rEnvelope(r);
5338 res->data = s;
5339 }
5340 else res->data = rCopy(r);
5341 return FALSE;
5342#else
5343 return TRUE;
5344#endif
5345}
ring rEnvelope(ring R)
Definition ring.cc:5819
ring rCopy(ring r)
Definition ring.cc:1737

◆ jjEQUAL_BI()

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

Definition at line 1323 of file iparith.cc.

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

◆ jjEQUAL_I()

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

Definition at line 1329 of file iparith.cc.

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

◆ jjEQUAL_Ma()

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

Definition at line 1335 of file iparith.cc.

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

◆ jjEQUAL_N()

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

Definition at line 1353 of file iparith.cc.

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

◆ jjEQUAL_P()

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

Definition at line 1359 of file iparith.cc.

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

◆ jjEQUAL_R()

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

Definition at line 1347 of file iparith.cc.

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

◆ jjEQUAL_REST()

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

Definition at line 1367 of file iparith.cc.

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

◆ jjEQUAL_SM()

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

Definition at line 1341 of file iparith.cc.

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

◆ jjERROR()

BOOLEAN jjERROR ( leftv ,
leftv u )
static

Definition at line 1999 of file iparith.cc.

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

◆ jjEXECUTE()

BOOLEAN jjEXECUTE ( leftv ,
leftv v )
static

Definition at line 4212 of file iparith.cc.

4213{
4214 char * d = (char *)v->Data();
4215 char * s = (char *)omAlloc(strlen(d) + 13);
4216 strcpy( s, (char *)d);
4217 strcat( s, "\n;RETURN();\n");
4219 return yyparse();
4220}
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition fevoices.cc:166
@ BT_execute
Definition fevoices.h:23
int yyparse(void)
Definition grammar.cc:2149

◆ jjEXPORTTO()

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

Definition at line 1994 of file iparith.cc.

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

◆ jjEXTGCD_BI()

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

Definition at line 2006 of file iparith.cc.

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

◆ jjEXTGCD_I()

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

Definition at line 2020 of file iparith.cc.

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

◆ jjEXTGCD_P()

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

Definition at line 2048 of file iparith.cc.

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

◆ jjFAC_P()

BOOLEAN jjFAC_P ( leftv res,
leftv u )
static

Definition at line 4261 of file iparith.cc.

4262{
4263 intvec *v=NULL;
4265 ideal f=singclap_factorize((poly)(u->CopyD()), &v, 0,currRing);
4266 if (f==NULL) return TRUE;
4267 ivTest(v);
4269 l->Init(2);
4270 l->m[0].rtyp=IDEAL_CMD;
4271 l->m[0].data=(void *)f;
4272 l->m[1].rtyp=INTVEC_CMD;
4273 l->m[1].data=(void *)v;
4274 res->data=(void *)l;
4275 return FALSE;
4276}
FILE * f
Definition checklibs.c:9
ideal singclap_factorize(poly f, intvec **v, int with_exps, const ring r)
Definition clapsing.cc:983
VAR int singclap_factorize_retry
Definition clapsing.cc:981
#define ivTest(v)
Definition intvec.h:172

◆ jjFAC_P2()

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

Definition at line 2065 of file iparith.cc.

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

◆ jjFACSTD()

BOOLEAN jjFACSTD ( leftv res,
leftv v )
static

Definition at line 4221 of file iparith.cc.

4222{
4224 if (currRing->cf->convSingNFactoryN!=ndConvSingNFactoryN) /* conversion to factory*/
4225 {
4226 ideal_list p,h;
4227 h=kStdfac((ideal)v->Data(),NULL,testHomog,NULL);
4228 if (h==NULL)
4229 {
4230 L->Init(1);
4231 L->m[0].data=(char *)idInit(1);
4232 L->m[0].rtyp=IDEAL_CMD;
4233 }
4234 else
4235 {
4236 p=h;
4237 int l=0;
4238 while (p!=NULL) { p=p->next;l++; }
4239 L->Init(l);
4240 l=0;
4241 while(h!=NULL)
4242 {
4243 L->m[l].data=(char *)h->d;
4244 L->m[l].rtyp=IDEAL_CMD;
4245 p=h->next;
4246 omFreeSize(h,sizeof(*h));
4247 h=p;
4248 l++;
4249 }
4250 }
4251 }
4252 else
4253 {
4254 WarnS("no factorization implemented");
4255 L->Init(1);
4256 iiExprArith1(&(L->m[0]),v,STD_CMD);
4257 }
4258 res->data=(void *)L;
4259 return FALSE;
4260}
ideal_list kStdfac(ideal F, ideal Q, tHomog h, intvec **w, ideal D)
Definition kstdfac.cc:800
CanonicalForm ndConvSingNFactoryN(number, BOOLEAN, const coeffs)
Definition numbers.cc:313
@ testHomog
Definition structs.h:34
@ STD_CMD
Definition tok.h:186

◆ jjFACSTD2()

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

Definition at line 2112 of file iparith.cc.

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

◆ jjFactModD_M()

BOOLEAN jjFactModD_M ( leftv res,
leftv v )
static

Definition at line 8659 of file iparith.cc.

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

◆ jjFAREY_BI()

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

Definition at line 2134 of file iparith.cc.

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

◆ jjFAREY_ID()

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

Definition at line 2145 of file iparith.cc.

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

◆ jjFAREY_LI()

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

Definition at line 10430 of file iparith.cc.

10431{
10432 lists c=(lists)u->CopyD();
10434 res_l->Init(c->nr+1);
10435 BOOLEAN bo=FALSE;
10436 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10437 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10438 {
10439 sleftv tmp;
10440 tmp.Copy(v);
10441 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10442 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10443 }
10444 c->Clean();
10445 res->data=res_l;
10446 return bo;
10447}
@ FAREY_CMD
Definition tok.h:77

◆ jjFETCH()

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

Definition at line 2166 of file iparith.cc.

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

◆ jjFETCH_M()

BOOLEAN jjFETCH_M ( leftv res,
leftv u )
static

Definition at line 7541 of file iparith.cc.

7542{
7543 ring r=(ring)u->Data();
7544 leftv v=u->next;
7545 leftv perm_var_l=v->next;
7546 leftv perm_par_l=v->next->next;
7547 if ((perm_var_l->Typ()!=INTVEC_CMD)
7548 ||((perm_par_l!=NULL)&&(perm_par_l->Typ()!=INTVEC_CMD))
7549 ||(u->Typ()!=RING_CMD))
7550 {
7551 WerrorS("fetch(<ring>,<name>[,<intvec>[,<intvec>])");
7552 return TRUE;
7553 }
7554 intvec *perm_var_v=(intvec*)perm_var_l->Data();
7555 intvec *perm_par_v=NULL;
7556 if (perm_par_l!=NULL)
7557 perm_par_v=(intvec*)perm_par_l->Data();
7558 idhdl w;
7559 nMapFunc nMap;
7560
7561 if ((w=r->idroot->get(v->Name(),myynest))!=NULL)
7562 {
7563 int *perm=NULL;
7564 int *par_perm=NULL;
7565 int par_perm_size=0;
7566 BOOLEAN bo;
7567 if ((nMap=n_SetMap(r->cf,currRing->cf))==NULL)
7568 {
7569 // Allow imap/fetch to be make an exception only for:
7570 if (nCoeff_is_Extension(r->cf) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
7571 ((n_SetMap(r->cf->extRing->cf,currRing->cf)!=NULL)
7572 || (nCoeff_is_Extension(currRing->cf) && (n_SetMap(r->cf->extRing->cf,currRing->cf->extRing->cf)!=NULL))))
7573 {
7574 par_perm_size=rPar(r);
7575 }
7576 else
7577 {
7578 goto err_fetch;
7579 }
7580 }
7581 else
7582 par_perm_size=rPar(r);
7583 perm=(int *)omAlloc0((rVar(r)+1)*sizeof(int));
7584 if (par_perm_size!=0)
7585 par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
7586 int i;
7587 if (perm_par_l==NULL)
7588 {
7589 if (par_perm_size!=0)
7590 for(i=si_min(rPar(r),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
7591 }
7592 else
7593 {
7594 if (par_perm_size==0) WarnS("source ring has no parameters");
7595 else
7596 {
7597 for(i=rPar(r)-1;i>=0;i--)
7598 {
7599 if (i<perm_par_v->length()) par_perm[i]=(*perm_par_v)[i];
7600 if ((par_perm[i]<-rPar(currRing))
7601 || (par_perm[i]>rVar(currRing)))
7602 {
7603 Warn("invalid entry for par %d: %d\n",i,par_perm[i]);
7604 par_perm[i]=0;
7605 }
7606 }
7607 }
7608 }
7609 for(i=rVar(r)-1;i>=0;i--)
7610 {
7611 if (i<perm_var_v->length()) perm[i+1]=(*perm_var_v)[i];
7612 if ((perm[i]<-rPar(currRing))
7613 || (perm[i]>rVar(currRing)))
7614 {
7615 Warn("invalid entry for var %d: %d\n",i,perm[i]);
7616 perm[i]=0;
7617 }
7618 }
7619 if (BVERBOSE(V_IMAP))
7620 {
7621 for(i=1;i<=si_min(rVar(r),rVar(currRing));i++)
7622 {
7623 if (perm[i]>0)
7624 Print("// var nr %d: %s -> var %s\n",i,r->names[i-1],currRing->names[perm[i]-1]);
7625 else if (perm[i]<0)
7626 Print("// var nr %d: %s -> par %s\n",i,r->names[i-1],rParameter(currRing)[-perm[i]-1]);
7627 }
7628 for(i=1;i<=si_min(rPar(r),rPar(currRing));i++) // possibly empty loop
7629 {
7630 if (par_perm[i-1]<0)
7631 Print("// par nr %d: %s -> par %s\n",
7632 i,rParameter(r)[i-1],rParameter(currRing)[-par_perm[i-1]-1]);
7633 else if (par_perm[i-1]>0)
7634 Print("// par nr %d: %s -> var %s\n",
7635 i,rParameter(r)[i-1],currRing->names[par_perm[i-1]-1]);
7636 }
7637 }
7638 if (IDTYP(w)==ALIAS_CMD) w=(idhdl)IDDATA(w);
7639 sleftv tmpW;
7640 tmpW.Init();
7641 tmpW.rtyp=IDTYP(w);
7642 tmpW.data=IDDATA(w);
7643 if ((bo=maApplyFetch(IMAP_CMD,NULL,res,&tmpW, r,
7644 perm,par_perm,par_perm_size,nMap)))
7645 {
7646 Werror("cannot map %s of type %s(%d)",v->name, Tok2Cmdname(w->typ),w->typ);
7647 }
7648 if (perm!=NULL)
7649 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
7650 if (par_perm!=NULL)
7651 omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
7652 return bo;
7653 }
7654 else
7655 {
7656 Werror("identifier %s not found in %s",v->Fullname(),u->Fullname());
7657 }
7658 return TRUE;
7659err_fetch:
7660 char *s1=nCoeffString(r->cf);
7661 char *s2=nCoeffString(currRing->cf);
7662 Werror("no identity map from %s (%s -> %s)",u->Fullname(),s1,s2);
7664 return TRUE;
7665}
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257

◆ jjFIND2()

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

Definition at line 2294 of file iparith.cc.

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

◆ jjFIND3()

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

Definition at line 6186 of file iparith.cc.

6187{
6188 /*4
6189 * look for the substring what in the string where
6190 * starting at position n
6191 * return the position of the first char of what in where
6192 * or 0
6193 */
6194 int n=(int)(long)w->Data();
6195 char *where=(char *)u->Data();
6196 char *what=(char *)v->Data();
6197 char *found;
6198 if ((1>n)||(n>(int)strlen(where)))
6199 {
6200 Werror("start position %d out of range",n);
6201 return TRUE;
6202 }
6203 found = strchr(where+n-1,*what);
6204 if (*(what+1)!='\0')
6205 {
6206 while((found !=NULL) && (strncmp(found+1,what+1,strlen(what+1))!=0))
6207 {
6208 found=strchr(found+1,*what);
6209 }
6210 }
6211 if (found != NULL)
6212 {
6213 res->data=(char *)((found-where)+1);
6214 }
6215 return FALSE;
6216}

◆ jjFRES()

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

Definition at line 2351 of file iparith.cc.

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

◆ jjFRES3()

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

Definition at line 2312 of file iparith.cc.

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

◆ jjFWALK()

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

Definition at line 2361 of file iparith.cc.

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

◆ jjFWALK3()

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

Definition at line 6217 of file iparith.cc.

6218{
6219 if ((int)(long)w->Data()==0)
6220 res->data=(char *)walkProc(u,v);
6221 else
6222 res->data=(char *)fractalWalkProc(u,v);
6223 setFlag( res, FLAG_STD );
6224 return FALSE;
6225}
ideal walkProc(leftv first, leftv second)
Definition walk_ip.cc:55

◆ jjGCD_BI()

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

Definition at line 2380 of file iparith.cc.

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

◆ jjGCD_I()

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

Definition at line 2367 of file iparith.cc.

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

◆ jjGCD_N()

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

Definition at line 2387 of file iparith.cc.

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

◆ jjGCD_P()

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

Definition at line 2404 of file iparith.cc.

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

◆ jjGE_BI()

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

Definition at line 1166 of file iparith.cc.

1167{
1168 number h=n_Sub((number)u->Data(),(number)v->Data(),coeffs_BIGINT);
1169 res->data = (char *) (n_GreaterZero(h,coeffs_BIGINT)||(n_IsZero(h,coeffs_BIGINT)));
1171 return FALSE;
1172}
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition coeffs.h:500
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:658

◆ jjGE_I()

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

Definition at line 1173 of file iparith.cc.

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

◆ jjGE_N()

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

Definition at line 1178 of file iparith.cc.

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

◆ jjGETDUMP()

BOOLEAN jjGETDUMP ( leftv ,
leftv v )
static

Definition at line 4277 of file iparith.cc.

4278{
4279 si_link l = (si_link)v->Data();
4280 if (slGetDump(l))
4281 {
4282 const char *s;
4283 if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
4284 else s=sNoName_fe;
4285 Werror("cannot get dump from `%s`",s);
4286 return TRUE;
4287 }
4288 else
4289 return FALSE;
4290}

◆ jjGT_BI()

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

Definition at line 1184 of file iparith.cc.

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

◆ jjGT_I()

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

Definition at line 1191 of file iparith.cc.

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

◆ jjGT_N()

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

Definition at line 1196 of file iparith.cc.

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

◆ jjHIGHCORNER()

BOOLEAN jjHIGHCORNER ( leftv res,
leftv v )
static

Definition at line 4291 of file iparith.cc.

4292{
4294 ideal I=(ideal)v->Data();
4295 res->data=(void *)iiHighCorner(I,0);
4296 return FALSE;
4297}
poly iiHighCorner(ideal I, int ak)
the largest monomial in R/I
Definition ipshell.cc:1606

◆ jjHIGHCORNER_M()

BOOLEAN jjHIGHCORNER_M ( leftv res,
leftv v )
static

Definition at line 4298 of file iparith.cc.

4299{
4301 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4302 BOOLEAN delete_w=FALSE;
4303 ideal I=(ideal)v->Data();
4304 int i;
4305 poly p=NULL,po=NULL;
4306 int rk=id_RankFreeModule(I,currRing);
4307 if (w==NULL)
4308 {
4309 w = new intvec(rk);
4310 delete_w=TRUE;
4311 }
4312 for(i=rk;i>0;i--)
4313 {
4314 p=iiHighCorner(I,i);
4315 if (p==NULL)
4316 {
4317 WerrorS("module must be zero-dimensional");
4318 if (delete_w) delete w;
4319 return TRUE;
4320 }
4321 if (po==NULL)
4322 {
4323 po=p;
4324 }
4325 else
4326 {
4327 // now po!=NULL, p!=NULL
4328 int d=(currRing->pFDeg(po,currRing)-(*w)[pGetComp(po)-1] - currRing->pFDeg(p,currRing)+(*w)[i-1]);
4329 if (d==0)
4330 d=pLmCmp(po,p);
4331 if (d > 0)
4332 {
4333 pDelete(&p);
4334 }
4335 else // (d < 0)
4336 {
4337 pDelete(&po); po=p;
4338 }
4339 }
4340 }
4341 if (delete_w) delete w;
4342 res->data=(void *)po;
4343 return FALSE;
4344}
#define pGetComp(p)
Component.
Definition polys.h:38
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:106
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s

◆ jjHILBERT()

BOOLEAN jjHILBERT ( leftv ,
leftv v )
static

Definition at line 4345 of file iparith.cc.

4346{
4347 if (rField_is_Z(currRing))
4348 {
4349 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4350 PrintS("// performed for generic fibre, that is, over Q\n");
4351 }
4353 intvec *module_w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4354 //scHilbertPoly((ideal)v->Data(),currRing->qideal);
4355 hLookSeries((ideal)v->Data(),module_w,currRing->qideal);
4356 return FALSE;
4357}
void hLookSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree)
Definition hilb.cc:220

◆ jjHILBERT2()

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

Definition at line 2410 of file iparith.cc.

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

◆ jjHILBERT3()

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

Definition at line 6226 of file iparith.cc.

6227{
6228 intvec *wdegree=(intvec*)w->Data();
6229 if (wdegree->length()!=currRing->N)
6230 {
6231 Werror("weight vector must have size %d, not %d",
6232 currRing->N,wdegree->length());
6233 return TRUE;
6234 }
6235 if (rField_is_Z(currRing))
6236 {
6237 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6238 PrintS("// performed for generic fibre, that is, over Q\n");
6239 }
6240 assumeStdFlag(u);
6241 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6242 if (errorreported) return TRUE;
6243
6244 switch((int)(long)v->Data())
6245 {
6246 case 1:
6247 res->data=(void *)hFirstSeries0b((ideal)u->Data(),currRing->qideal,wdegree,module_w,currRing,coeffs_BIGINT);
6248 return FALSE;
6249 case 2:
6250 res->data=(void *)hSecondSeries0b((ideal)u->Data(),currRing->qideal,wdegree,module_w,currRing,coeffs_BIGINT);
6251 return FALSE;
6252 }
6254 return TRUE;
6255}

◆ jjHILBERT3Qt()

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

Definition at line 6256 of file iparith.cc.

6257{
6258 if (rField_is_Z(currRing))
6259 {
6260 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6261 PrintS("// performed for generic fibre, that is, over Q\n");
6262 }
6263 assumeStdFlag(u);
6264 ring Qt =(ring)v->Data();
6265 char *name=(char*)w->Data();
6266 poly h;
6267 if (u->Typ()==IDEAL_CMD)
6268 h=hFirstSeries0p((ideal)u->Data(),currRing->qideal,NULL,currRing,Qt);
6269 else
6270 {
6271 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6272 h=hFirstSeries0m((ideal)u->Data(),currRing->qideal,NULL,module_w,currRing,Qt);
6273 }
6274 idhdl hh=enterid(name,myynest,POLY_CMD,&(Qt->idroot),FALSE,FALSE);
6275 IDPOLY(hh)=h;
6276 return FALSE;
6277}
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:1425
poly hFirstSeries0p(ideal A, ideal Q, intvec *wdegree, const ring src, const ring Qt)
Definition hilb.cc:1384
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:256
#define IDPOLY(a)
Definition ipid.h:130
int name
New type name for int.

◆ jjHILBERT_IV()

BOOLEAN jjHILBERT_IV ( leftv res,
leftv v )
static

Definition at line 4358 of file iparith.cc.

4359{
4360 if (rField_is_Z(currRing))
4361 {
4362 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
4363 PrintS("// performed for generic fibre, that is, over Q\n");
4364 }
4365 res->data=(void *)hSecondSeries((intvec *)v->Data());
4366 return FALSE;
4367}

◆ jjHOMOG1()

BOOLEAN jjHOMOG1 ( leftv res,
leftv v )
static

Definition at line 4368 of file iparith.cc.

4369{
4370 intvec *w=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4371 ideal v_id=(ideal)v->Data();
4372 if (w==NULL)
4373 {
4374 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
4375 if (res->data!=NULL)
4376 {
4377 if (v->rtyp==IDHDL)
4378 {
4379 char *s_isHomog=omStrDup("isHomog");
4380 if (v->e==NULL)
4381 atSet((idhdl)(v->data),s_isHomog,w,INTVEC_CMD);
4382 else
4383 atSet((idhdl)(v->LData()),s_isHomog,w,INTVEC_CMD);
4384 }
4385 else if (w!=NULL) delete w;
4386 } // if res->data==NULL then w==NULL
4387 }
4388 else
4389 {
4390 res->data=(void *)(long)idTestHomModule(v_id,currRing->qideal,w);
4391 if((res->data==NULL) && (v->rtyp==IDHDL))
4392 {
4393 if (v->e==NULL)
4394 atKill((idhdl)(v->data),"isHomog");
4395 else
4396 atKill((idhdl)(v->LData()),"isHomog");
4397 }
4398 }
4399 return FALSE;
4400}
void atSet(idhdl root, char *name, void *data, int typ)
Definition attrib.cc:153
#define atKill(H, A)
Definition attrib.h:49
BOOLEAN idTestHomModule(ideal m, ideal Q, intvec *w)
Definition ideals.cc:2125
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96

◆ jjHOMOG1_W()

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

Definition at line 2487 of file iparith.cc.

2488{
2489 intvec *w=new intvec(rVar(currRing));
2490 intvec *vw=(intvec*)u->Data();
2491 ideal v_id=(ideal)v->Data();
2492 pFDegProc save_FDeg=currRing->pFDeg;
2493 pLDegProc save_LDeg=currRing->pLDeg;
2494 BOOLEAN save_pLexOrder=currRing->pLexOrder;
2495 currRing->pLexOrder=FALSE;
2496 kHomW=vw;
2497 kModW=w;
2499 res->data=(void *)(long)idHomModule(v_id,currRing->qideal,&w);
2500 currRing->pLexOrder=save_pLexOrder;
2501 kHomW=NULL;
2502 kModW=NULL;
2503 pRestoreDegProcs(currRing,save_FDeg,save_LDeg);
2504 if (w!=NULL) delete w;
2505 return FALSE;
2506}
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2421
VAR intvec * kHomW
Definition kstd1.cc:2409
VAR intvec * kModW
Definition kstd1.cc:2409
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3774
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3762
long(* pFDegProc)(poly p, ring r)
Definition ring.h:39
long(* pLDegProc)(poly p, int *length, ring r)
Definition ring.h:38

◆ jjHOMOG1_WI()

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

Definition at line 2507 of file iparith.cc.

2508{
2509 intvec *vw=(intvec*)u->Data();
2510 ideal v_id=(ideal)v->Data();
2511 res->data=(void *)(long)id_HomIdealW(v_id,currRing->qideal,vw,currRing);
2512 return FALSE;
2513}
BOOLEAN id_HomIdealW(ideal id, ideal Q, const intvec *w, const ring r)

◆ jjHOMOG_ID()

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

Definition at line 2465 of file iparith.cc.

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

◆ jjHOMOG_ID_W()

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

Definition at line 6278 of file iparith.cc.

6279{
6280 PrintS("TODO\n");
6281 int i=pVar((poly)v->Data());
6282 if (i==0)
6283 {
6284 WerrorS("ringvar expected");
6285 return TRUE;
6286 }
6287 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6288 int d=pWTotaldegree(p);
6289 pLmDelete(p);
6290 if (d==1)
6291 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6292 else
6293 WerrorS("variable must have weight 1");
6294 return (d!=1);
6295}
#define pWTotaldegree(p)
Definition polys.h:284

◆ jjHOMOG_P()

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

Definition at line 2448 of file iparith.cc.

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

◆ jjHOMOG_P_W()

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

Definition at line 6296 of file iparith.cc.

6297{
6298 PrintS("TODO\n");
6299 int i=pVar((poly)v->Data());
6300 if (i==0)
6301 {
6302 WerrorS("ringvar expected");
6303 return TRUE;
6304 }
6305 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6306 int d=pWTotaldegree(p);
6307 pLmDelete(p);
6308 if (d==1)
6309 res->data = (char *)p_Homogen((poly)u->Data(), i, currRing);
6310 else
6311 WerrorS("variable must have weight 1");
6312 return (d!=1);
6313}

◆ jjHOMOG_W_M()

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

Definition at line 6314 of file iparith.cc.

6315{
6316 intvec *w=(intvec *)v3->Data();
6317 intvec *vw=(intvec*)v2->Data();
6318 ideal v_id=(ideal)v1->Data();
6319 res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6320 return FALSE;
6321}
BOOLEAN id_HomModuleW(ideal id, ideal Q, const intvec *w, const intvec *module_w, const ring r)

◆ jjIDEAL_Ma()

BOOLEAN jjIDEAL_Ma ( leftv res,
leftv v )
static

Definition at line 4418 of file iparith.cc.

4419{
4420 matrix mat=(matrix)v->CopyD(MATRIX_CMD);
4421 IDELEMS((ideal)mat)=MATCOLS(mat)*MATROWS(mat);
4422 MATROWS(mat)=1;
4423 mat->rank=1;
4424 res->data=(char *)mat;
4425 return FALSE;
4426}
long rank
Definition matpol.h:19

◆ jjIDEAL_Map()

BOOLEAN jjIDEAL_Map ( leftv res,
leftv v )
static

Definition at line 4427 of file iparith.cc.

4428{
4429 map m=(map)v->CopyD(MAP_CMD);
4430 omFreeBinAddr((ADDRESS)m->preimage);
4431 m->preimage=NULL;
4432 ideal I=(ideal)m;
4433 I->rank=1;
4434 res->data=(char *)I;
4435 return FALSE;
4436}
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto

◆ jjIDEAL_PL()

BOOLEAN jjIDEAL_PL ( leftv res,
leftv v )
static

Definition at line 7498 of file iparith.cc.

7499{
7500 leftv h=v;
7501 int s=exprlist_length(h);
7502 ideal id=idInit(s,1);
7503 int rank=1;
7504 int i=0;
7505 poly p;
7506 int dest_type=POLY_CMD;
7507 if (iiOp==MODUL_CMD) dest_type=VECTOR_CMD;
7508 while (h!=NULL)
7509 {
7510 // use standard type conversions to poly/vector
7511 int ri;
7512 int ht=h->Typ();
7513 if (ht==dest_type)
7514 {
7515 p=(poly)h->CopyD();
7516 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7517 }
7518 else if ((ri=iiTestConvert(ht,dest_type,dConvertTypes))!=0)
7519 {
7520 sleftv tmp;
7521 leftv hnext=h->next;
7522 h->next=NULL;
7523 iiConvert(ht,dest_type,ri,h,&tmp,dConvertTypes);
7524 h->next=hnext;
7525 p=(poly)tmp.data;
7526 if (p!=NULL) rank=si_max(rank,(int)pMaxComp(p));
7527 }
7528 else
7529 {
7530 idDelete(&id);
7531 return TRUE;
7532 }
7533 id->m[i]=p;
7534 i++;
7535 h=h->next;
7536 }
7537 id->rank=rank;
7538 res->data=(char *)id;
7539 return FALSE;
7540}
int exprlist_length(leftv v)
Definition ipshell.cc:551

◆ jjIDEAL_R()

BOOLEAN jjIDEAL_R ( leftv res,
leftv v )
static

Definition at line 4437 of file iparith.cc.

4438{
4439 if (currRing!=NULL)
4440 {
4441 ring q=(ring)v->Data();
4442 if (rSamePolyRep(currRing, q))
4443 {
4444 if (q->qideal==NULL)
4445 res->data=(char *)idInit(1,1);
4446 else
4447 res->data=(char *)idCopy(q->qideal);
4448 return FALSE;
4449 }
4450 }
4451 WerrorS("can only get ideal from identical qring");
4452 return TRUE;
4453}
ideal idCopy(ideal A)
Definition ideals.h:60
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition ring.cc:1805

◆ jjidElem()

BOOLEAN jjidElem ( leftv res,
leftv v )
static

Definition at line 5695 of file iparith.cc.

5696{
5697 res->data = (char *)(long)idElem((ideal)v->Data());
5698 return FALSE;
5699}
static int idElem(const ideal F)
number of non-zero polys in F

◆ jjidFreeModule()

BOOLEAN jjidFreeModule ( leftv res,
leftv v )
static

Definition at line 5700 of file iparith.cc.

5701{
5702 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5703 return FALSE;
5704}
ideal id_FreeModule(int i, const ring r)
the free module of rank i

◆ jjidHead()

BOOLEAN jjidHead ( leftv res,
leftv v )
static

Definition at line 5720 of file iparith.cc.

5721{
5722 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5724 return FALSE;
5725}
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms

◆ jjidMaxIdeal()

BOOLEAN jjidMaxIdeal ( leftv res,
leftv v )
static

Definition at line 4401 of file iparith.cc.

4402{
4403#ifdef HAVE_SHIFTBBA
4404 if (rIsLPRing(currRing))
4405 {
4406 int deg = (int)(long)v->Data();
4407 if (deg > currRing->N/currRing->isLPring)
4408 {
4409 WerrorS("degree bound of Letterplace ring is to small");
4410 return TRUE;
4411 }
4412 }
4413#endif
4414 res->data = (char *)idMaxIdeal((int)(long)v->Data());
4416 return FALSE;
4417}
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition ideals.h:33

◆ jjidMinBase()

BOOLEAN jjidMinBase ( leftv res,
leftv v )
static

Definition at line 5726 of file iparith.cc.

5727{
5728 res->data = (char *)idMinBase((ideal)v->Data());
5729 return FALSE;
5730}
ideal idMinBase(ideal h1, ideal *SB)
Definition ideals.cc:51

◆ jjidTransp()

BOOLEAN jjidTransp ( leftv res,
leftv v )
static

Definition at line 5778 of file iparith.cc.

5779{
5780 res->data = (char *)id_Transp((ideal)v->Data(),currRing);
5781 return FALSE;
5782}
ideal id_Transp(ideal a, const ring rRing)
transpose a module

◆ jjidVec2Ideal()

BOOLEAN jjidVec2Ideal ( leftv res,
leftv v )
static

Definition at line 5705 of file iparith.cc.

5706{
5707 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5708 return FALSE;
5709}
ideal id_Vec2Ideal(poly vec, const ring R)

◆ jjIm2Iv()

BOOLEAN jjIm2Iv ( leftv res,
leftv v )
static

Definition at line 4454 of file iparith.cc.

4455{
4456 intvec *iv = (intvec *)v->CopyD(INTMAT_CMD);
4457 iv->makeVector();
4458 res->data = iv;
4459 return FALSE;
4460}
void makeVector()
Definition intvec.h:103
@ INTMAT_CMD
Definition grammar.cc:280

◆ jjIMPART()

BOOLEAN jjIMPART ( leftv res,
leftv v )
static

Definition at line 4461 of file iparith.cc.

4462{
4463 res->data = (char *)n_ImPart((number)v->Data(),currRing->cf);
4464 return FALSE;
4465}
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
Definition coeffs.h:785

◆ jjINDEPSET()

BOOLEAN jjINDEPSET ( leftv res,
leftv v )
static

Definition at line 4466 of file iparith.cc.

4467{
4469 res->data=(void *)scIndIntvec((ideal)(v->Data()),currRing->qideal);
4470 return FALSE;
4471}
intvec * scIndIntvec(ideal S, ideal Q)
Definition hdegree.cc:284

◆ jjINDEPSET2()

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

Definition at line 2514 of file iparith.cc.

2515{
2516 assumeStdFlag(u);
2517 res->data=(void *)scIndIndset((ideal)(u->Data()),(int)(long)(v->Data()),
2518 currRing->qideal);
2519 return FALSE;
2520}
lists scIndIndset(ideal S, BOOLEAN all, ideal Q)
Definition ipshell.cc:1111

◆ jjINDEX_I()

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

Definition at line 1390 of file iparith.cc.

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

◆ jjINDEX_IV()

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

Definition at line 1412 of file iparith.cc.

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

◆ jjINDEX_P()

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

Definition at line 1448 of file iparith.cc.

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

◆ jjINDEX_P_IV()

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

Definition at line 1488 of file iparith.cc.

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

◆ jjINDEX_PBu()

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

Definition at line 1465 of file iparith.cc.

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

◆ jjINDEX_V()

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

Definition at line 1517 of file iparith.cc.

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

◆ jjINDEX_V_IV()

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

Definition at line 1524 of file iparith.cc.

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

◆ jjINTERPOLATION()

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

Definition at line 2527 of file iparith.cc.

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

◆ jjINTERRED()

BOOLEAN jjINTERRED ( leftv res,
leftv v )
static

Definition at line 4472 of file iparith.cc.

4473{
4474 ideal result=kInterRed((ideal)(v->Data()), currRing->qideal);
4475 if (TEST_OPT_PROT) { PrintLn(); mflush(); }
4476 res->data = result;
4477 return FALSE;
4478}
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3803
#define TEST_OPT_PROT
Definition options.h:105
void PrintLn()
Definition reporter.cc:314
#define mflush()
Definition reporter.h:58

◆ jjINTERSEC3S()

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

Definition at line 6349 of file iparith.cc.

6350{
6351 ideal I=(ideal)u->Data();
6352 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6353 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6355 return FALSE;
6356}
ideal idSect(ideal h1, ideal h2, GbVariant alg)
Definition ideals.cc:315
#define TEST_OPT_RETURN_SB
Definition options.h:114

◆ jjINTERSECT()

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

Definition at line 2521 of file iparith.cc.

2522{
2523 res->data=(char *)idSect((ideal)u->Data(),(ideal)v->Data());
2525 return FALSE;
2526}

◆ jjINTERSECT3()

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

Definition at line 6336 of file iparith.cc.

6337{
6338 ideal I1=(ideal)u->Data();
6339 ideal I2=(ideal)v->Data();
6340 ideal I3=(ideal)w->Data();
6341 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6342 r[0]=I1;
6343 r[1]=I2;
6344 r[2]=I3;
6345 res->data=(char *)idMultSect(r,3);
6346 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6347 return FALSE;
6348}
ideal idMultSect(resolvente arg, int length, GbVariant alg)
Definition ideals.cc:472
ideal * resolvente
Definition ideals.h:18

◆ jjINTERSECT_PL()

BOOLEAN jjINTERSECT_PL ( leftv res,
leftv v )
static

Definition at line 7666 of file iparith.cc.

7667{
7668 leftv h=v;
7669 int l=v->listLength();
7670 resolvente r=(resolvente)omAlloc0(l*sizeof(ideal));
7671 BOOLEAN *copied=(BOOLEAN *)omAlloc0(l*sizeof(BOOLEAN));
7672 int t=0;
7673 // try to convert to IDEAL_CMD
7674 while (h!=NULL)
7675 {
7676 if (iiTestConvert(h->Typ(),IDEAL_CMD)!=0)
7677 {
7678 t=IDEAL_CMD;
7679 }
7680 else break;
7681 h=h->next;
7682 }
7683 // if failure, try MODUL_CMD
7684 if (t==0)
7685 {
7686 h=v;
7687 while (h!=NULL)
7688 {
7689 if (iiTestConvert(h->Typ(),MODUL_CMD)!=0)
7690 {
7691 t=MODUL_CMD;
7692 }
7693 else break;
7694 h=h->next;
7695 }
7696 }
7697 // check for success in converting
7698 if (t==0)
7699 {
7700 WerrorS("cannot convert to ideal or module");
7701 return TRUE;
7702 }
7703 // call idMultSect
7704 h=v;
7705 int i=0;
7706 sleftv tmp;
7707 while (h!=NULL)
7708 {
7709 if (h->Typ()==t)
7710 {
7711 r[i]=(ideal)h->Data(); /*no copy*/
7712 h=h->next;
7713 }
7714 else if(iiConvert(h->Typ(),t,iiTestConvert(h->Typ(),t),h,&tmp))
7715 {
7716 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7717 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7718 Werror("cannot convert arg. %d to %s",i+1,Tok2Cmdname(t));
7719 return TRUE;
7720 }
7721 else
7722 {
7723 r[i]=(ideal)tmp.Data(); /*now it's a copy*/
7724 copied[i]=TRUE;
7725 h=tmp.next;
7726 }
7727 i++;
7728 }
7729 res->rtyp=t;
7730 res->data=(char *)idMultSect(r,i);
7731 while(i>0)
7732 {
7733 i--;
7734 if (copied[i]) idDelete(&(r[i]));
7735 }
7736 omFreeSize((ADDRESS)copied,l*sizeof(BOOLEAN));
7737 omFreeSize((ADDRESS)r,l*sizeof(ideal));
7738 return FALSE;
7739}

◆ jjINTMAT3()

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

Definition at line 6322 of file iparith.cc.

6323{
6324 intvec* im= new intvec((int)(long)v->Data(),(int)(long)w->Data(), 0);
6325 intvec* arg = (intvec*) u->Data();
6326 int i, n = si_min(im->cols()*im->rows(), arg->cols()*arg->rows());
6327
6328 for (i=0; i<n; i++)
6329 {
6330 (*im)[i] = (*arg)[i];
6331 }
6332
6333 res->data = (char *)im;
6334 return FALSE;
6335}

◆ jjINTVEC_PL()

BOOLEAN jjINTVEC_PL ( leftv res,
leftv v )
static

Definition at line 7902 of file iparith.cc.

7903{
7904 leftv h=v;
7905 int i=exprlist_length(h);
7906 intvec *iv=new intvec(i);
7907 i=0;
7908 while (h!=NULL)
7909 {
7910 if(h->Typ()==INT_CMD)
7911 {
7912 (*iv)[i]=(int)(long)h->Data();
7913 }
7914 else if (h->Typ()==INTVEC_CMD)
7915 {
7916 intvec *ivv=(intvec*)h->Data();
7917 for(int j=0;j<ivv->length();j++,i++)
7918 {
7919 (*iv)[i]=(*ivv)[j];
7920 }
7921 i--;
7922 }
7923 else
7924 {
7925 delete iv;
7926 return TRUE;
7927 }
7928 i++;
7929 h=h->next;
7930 }
7931 res->data=(char *)iv;
7932 return FALSE;
7933}

◆ jjIS_RINGVAR0()

BOOLEAN jjIS_RINGVAR0 ( leftv res,
leftv  )
static

Definition at line 4499 of file iparith.cc.

4500{
4501 res->data = (char *)0;
4502 return FALSE;
4503}

◆ jjIS_RINGVAR_P()

BOOLEAN jjIS_RINGVAR_P ( leftv res,
leftv v )
static

Definition at line 4488 of file iparith.cc.

4489{
4490 res->data = (char *)(long)pVar((poly)v->Data());
4491 return FALSE;
4492}

◆ jjIS_RINGVAR_S()

BOOLEAN jjIS_RINGVAR_S ( leftv res,
leftv v )
static

Definition at line 4493 of file iparith.cc.

4494{
4495 res->data = (char *)(long)(r_IsRingVar((char *)v->Data(), currRing->names,
4496 currRing->N)+1);
4497 return FALSE;
4498}
int r_IsRingVar(const char *n, char **names, int N)
Definition ring.cc:213

◆ jjJACOB_M()

BOOLEAN jjJACOB_M ( leftv res,
leftv a )
static

Definition at line 4535 of file iparith.cc.

4536{
4537 ideal id = (ideal)a->Data();
4538 id = id_Transp(id,currRing);
4539 int W = IDELEMS(id);
4540
4541 ideal result = idInit(W * currRing->N, id->rank);
4542 poly *p = result->m;
4543
4544 for( int v = 1; v <= currRing->N; v++ )
4545 {
4546 poly* q = id->m;
4547 for( int i = 0; i < W; i++, p++, q++ )
4548 *p = pDiff( *q, v );
4549 }
4550 idDelete(&id);
4551
4552 res->data = (char *)result;
4553 return FALSE;
4554}

◆ jjJACOB_P()

BOOLEAN jjJACOB_P ( leftv res,
leftv v )
static

Definition at line 4504 of file iparith.cc.

4505{
4506 ideal i=idInit(currRing->N,1);
4507 int k;
4508 poly p=(poly)(v->Data());
4509 for (k=currRing->N;k>0;k--)
4510 {
4511 i->m[k-1]=pDiff(p,k);
4512 }
4513 res->data = (char *)i;
4514 return FALSE;
4515}

◆ jjJanetBasis()

BOOLEAN jjJanetBasis ( leftv res,
leftv v )
static

Definition at line 2545 of file iparith.cc.

2546{
2547 extern BOOLEAN jjStdJanetBasis(leftv res, leftv v,int flag);
2548 return jjStdJanetBasis(res,v,0);
2549}
BOOLEAN jjStdJanetBasis(leftv res, leftv v, int flag)
flag: 0: JB, 1: SB
Definition wrapper.cc:50

◆ jjJanetBasis2()

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

Definition at line 2539 of file iparith.cc.

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

◆ jjJET4()

BOOLEAN jjJET4 ( leftv res,
leftv u )
static

Definition at line 7995 of file iparith.cc.

7996{
7997 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7998 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7999 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
8000 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
8001 leftv u1=u;
8002 leftv u2=u1->next;
8003 leftv u3=u2->next;
8004 leftv u4=u3->next;
8005 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
8006 {
8007 if(!pIsUnit((poly)u2->Data()))
8008 {
8009 WerrorS("2nd argument must be a unit");
8010 return TRUE;
8011 }
8012 res->rtyp=u1->Typ();
8013 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
8014 pCopy((poly)u2->Data()),(intvec*)u4->Data());
8015 return FALSE;
8016 }
8017 else
8018 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
8019 {
8020 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8021 {
8022 WerrorS("2nd argument must be a diagonal matrix of units");
8023 return TRUE;
8024 }
8025 res->rtyp=u1->Typ();
8026 res->data=(char*)idSeries(
8027 (int)(long)u3->Data(),
8028 idCopy((ideal)u1->Data()),
8029 mp_Copy((matrix)u2->Data(), currRing),
8030 (intvec*)u4->Data()
8031 );
8032 return FALSE;
8033 }
8034 else
8035 {
8036 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
8037 Tok2Cmdname(iiOp));
8038 return TRUE;
8039 }
8040}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition ideals.cc:2177
BOOLEAN mp_IsDiagUnit(matrix U, const ring R)
Definition matpol.cc:810
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition matpol.cc:57
#define pIsUnit(p)
return true if the Lm is a constant <>0
Definition polys.h:241
#define pSeries(n, p, u, w)
Definition polys.h:372

◆ jjJET_ID()

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

Definition at line 2555 of file iparith.cc.

2556{
2557 res->data = (char *)id_Jet((ideal)u->Data(),(int)(long)v->Data(),currRing);
2558 return FALSE;
2559}
ideal id_Jet(const ideal i, int d, const ring R)

◆ jjJET_ID_IV()

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

Definition at line 6374 of file iparith.cc.

6375{
6376 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6377 (intvec *)w->Data(),currRing);
6378 return FALSE;
6379}
ideal id_JetW(const ideal i, int d, intvec *iv, const ring R)

◆ jjJET_ID_M()

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

Definition at line 6380 of file iparith.cc.

6381{
6382 if (!mp_IsDiagUnit((matrix)v->Data(), currRing))
6383 {
6384 WerrorS("2nd argument must be a diagonal matrix of units");
6385 return TRUE;
6386 }
6387 res->data = (char *)idSeries((int)(long)w->Data(),(ideal)u->CopyD(),
6388 (matrix)v->CopyD());
6389 return FALSE;
6390}

◆ jjJET_P()

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

Definition at line 2550 of file iparith.cc.

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

◆ jjJET_P_IV()

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

Definition at line 6357 of file iparith.cc.

6358{
6359 int *iw=iv2array((intvec *)w->Data(),currRing);
6360 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6361 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6362 return FALSE;
6363}
#define ppJetW(p, m, iv)
Definition polys.h:369

◆ jjJET_P_P()

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

Definition at line 6364 of file iparith.cc.

6365{
6366 if (!pIsUnit((poly)v->Data()))
6367 {
6368 WerrorS("2nd argument must be a unit");
6369 return TRUE;
6370 }
6371 res->data = (char *)p_Series((int)(long)w->Data(),(poly)u->CopyD(),(poly)v->CopyD(),NULL,currRing);
6372 return FALSE;
6373}
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
Definition p_polys.cc:4665

◆ jjKBASE()

BOOLEAN jjKBASE ( leftv res,
leftv v )
static

Definition at line 4574 of file iparith.cc.

4575{
4577 res->data = (char *)scKBase(-1,(ideal)(v->Data()),currRing->qideal);
4578 return FALSE;
4579}
ideal scKBase(int deg, ideal s, ideal Q, intvec *mv)
Definition hdegree.cc:1414

◆ jjKBASE2()

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

Definition at line 2560 of file iparith.cc.

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

◆ jjKERNEL()

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

Definition at line 2573 of file iparith.cc.

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

◆ jjKERNEL_M()

BOOLEAN jjKERNEL_M ( leftv res,
leftv v )
static

Definition at line 4556 of file iparith.cc.

4557{
4558#ifdef HAVE_FLINT
4559 res->data = (char *)singflint_kernel((matrix)(v->Data()),currRing);
4560 return res->data==NULL;
4561#else
4562 return TRUE;
4563#endif
4564}
matrix singflint_kernel(matrix m, const ring R)

◆ jjKERNEL_SM()

BOOLEAN jjKERNEL_SM ( leftv res,
leftv v )
static

Definition at line 4565 of file iparith.cc.

4566{
4567#ifdef HAVE_FLINT
4568 res->data = (char *)singflint_kernel((ideal)(v->Data()),currRing);
4569 return res->data==NULL;
4570#else
4571 return TRUE;
4572#endif
4573}

◆ jjKLAMMER()

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

Definition at line 1560 of file iparith.cc.

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

◆ jjKLAMMER_IV()

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

Definition at line 1572 of file iparith.cc.

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

◆ jjKLAMMER_PL()

BOOLEAN jjKLAMMER_PL ( leftv res,
leftv u )
static

Definition at line 8078 of file iparith.cc.

8079{
8081 && ((strcmp(u->Name(),"real")==0) || (strcmp(u->Name(),"complex")==0)))
8082 {
8083 memcpy(res,u,sizeof(sleftv));
8084 u->Init();
8085 return FALSE;
8086 }
8087 leftv v=u->next;
8088 BOOLEAN b;
8089 if(v==NULL) // p()
8091 else if ((v->next==NULL) // p(1)
8092 || (u->Typ()!=UNKNOWN)) // p(1,2), p proc or map
8093 {
8094 u->next=NULL;
8095 b=iiExprArith2(res,u,iiOp,v);
8096 u->next=v;
8097 }
8098 else // p(1,2), p undefined
8099 {
8100 if (v->Typ()!=INT_CMD)
8101 {
8102 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8103 return TRUE;
8104 }
8105 int l=u->listLength();
8106 size_t len=strlen(u->name) + 12*l;
8107 char * nn = (char *)omAlloc(len);
8108 snprintf(nn,len,"%s(%d",u->name,(int)(long)v->Data());
8109 char *s=nn;
8110 do
8111 {
8112 while (*s!='\0') s++;
8113 v=v->next;
8114 if (v->Typ()!=INT_CMD)
8115 {
8116 Werror("`%s` undefined or `int` expected while building `%s(`",u->name,u->name);
8117 omFree((ADDRESS)nn);
8118 return TRUE;
8119 }
8120 snprintf(s,len-(nn-s),",%d",(int)(long)v->Data());
8121 } while (v->next!=NULL);
8122 while (*s!='\0') s++;
8123 nn=strcat(nn,")");
8124 char *n=omStrDup(nn);
8125 omFree((ADDRESS)nn);
8126 syMake(res,n);
8127 b=FALSE;
8128 }
8129 return b;
8130}
BOOLEAN yyInRingConstruction
Definition grammar.cc:172

◆ jjKLAMMER_rest()

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

Definition at line 1599 of file iparith.cc.

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

◆ jjKoszul()

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

Definition at line 2577 of file iparith.cc.

2578{
2579 return mpKoszul(res, u,v,NULL);
2580}
BOOLEAN mpKoszul(leftv res, leftv c, leftv b, leftv id)
Definition ipshell.cc:3086

◆ jjKoszul_Id()

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

Definition at line 2581 of file iparith.cc.

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

◆ jjL2R()

BOOLEAN jjL2R ( leftv res,
leftv v )
static

Definition at line 4580 of file iparith.cc.

4581{
4582 res->data=(char *)syConvList((lists)v->Data());
4583 if (res->data != NULL)
4584 return FALSE;
4585 else
4586 return TRUE;
4587}
syStrategy syConvList(lists li)
Definition ipshell.cc:3250

◆ jjLagSolve()

BOOLEAN jjLagSolve ( leftv res,
leftv v )
static

Definition at line 4657 of file iparith.cc.

4658{
4659 sleftv a2,a3;
4660 a2.Init();
4661 a3.Init();
4662 a2.rtyp=INT_CMD; a2.data=(void*)10;
4663 a3.rtyp=INT_CMD; a3.data=(void*)1;
4664 return nuLagSolve(res,v,&a2,&a3);
4665}
BOOLEAN nuLagSolve(leftv res, leftv arg1, leftv arg2, leftv arg3)
find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial us...
Definition ipshell.cc:4681

◆ jjLE_BI()

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

Definition at line 1201 of file iparith.cc.

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

◆ jjLE_I()

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

Definition at line 1205 of file iparith.cc.

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

◆ jjLE_N()

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

Definition at line 1210 of file iparith.cc.

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

◆ jjLEADCOEF()

BOOLEAN jjLEADCOEF ( leftv res,
leftv v )
static

Definition at line 4588 of file iparith.cc.

4589{
4590 poly p=(poly)v->Data();
4591 if (p==NULL)
4592 {
4593 res->data=(char *)nInit(0);
4594 }
4595 else
4596 {
4598 res->data=(char *)nCopy(pGetCoeff(p));
4599 }
4600 return FALSE;
4601}

◆ jjLEADEXP()

BOOLEAN jjLEADEXP ( leftv res,
leftv v )
static

Definition at line 4602 of file iparith.cc.

4603{
4604 poly p=(poly)v->Data();
4605 int s=currRing->N;
4606 if (v->Typ()==VECTOR_CMD) s++;
4607 intvec *iv=new intvec(s);
4608 if (p!=NULL)
4609 {
4610 for(int i = currRing->N;i;i--)
4611 {
4612 (*iv)[i-1]=pGetExp(p,i);
4613 }
4614 if (s!=currRing->N)
4615 (*iv)[currRing->N]=pGetComp(p);
4616 }
4617 res->data=(char *)iv;
4618 return FALSE;
4619}
#define pGetExp(p, i)
Exponent.
Definition polys.h:42

◆ jjLEADMONOM()

BOOLEAN jjLEADMONOM ( leftv res,
leftv v )
static

Definition at line 4620 of file iparith.cc.

4621{
4622 poly p=(poly)v->Data();
4623 if (p == NULL)
4624 {
4625 res->data = (char*) NULL;
4626 }
4627 else
4628 {
4629 poly lm = pLmInit(p);
4630 pSetCoeff0(lm, nInit(1));
4631 res->data = (char*) lm;
4632 }
4633 return FALSE;
4634}
#define pSetCoeff0(p, n)
Definition monomials.h:59
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition polys.h:65

◆ jjLIFT()

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

Definition at line 2589 of file iparith.cc.

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

◆ jjLIFT3()

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

Definition at line 7129 of file iparith.cc.

7130{
7131 if (w->rtyp!=IDHDL) return TRUE;
7132 int ul= IDELEMS((ideal)u->Data());
7133 int vl= IDELEMS((ideal)v->Data());
7134#ifdef HAVE_SHIFTBBA
7135 if (rIsLPRing(currRing))
7136 {
7137 if (currRing->LPncGenCount < ul)
7138 {
7139 Werror("At least %d ncgen variables are needed for this computation.", ul);
7140 return TRUE;
7141 }
7142 }
7143#endif
7144 ideal m
7145 = idLift((ideal)u->Data(),(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
7146 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))));
7147 if (m==NULL) return TRUE;
7148 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
7149 return FALSE;
7150}
#define IDMATRIX(a)
Definition ipid.h:134

◆ jjLIFT_4()

BOOLEAN jjLIFT_4 ( leftv res,
leftv U )
static

Definition at line 8131 of file iparith.cc.

8132{
8133 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8134 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8135 leftv u=U;
8136 leftv v=u->next;
8137 leftv w=v->next;
8138 leftv u4=w->next;
8139 if (w->rtyp!=IDHDL) return TRUE;
8140 if (iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8141 {
8142 // see jjLIFT3
8143 ideal I=(ideal)u->Data();
8144 int ul= IDELEMS(I /*(ideal)u->Data()*/);
8145 int vl= IDELEMS((ideal)v->Data());
8146 GbVariant alg=syGetAlgorithm((char*)u4->Data(),currRing,I);
8147 ideal m
8148 = idLift(I,(ideal)v->Data(),NULL,FALSE,hasFlag(u,FLAG_STD),
8149 FALSE, (matrix *)(&(IDMATRIX((idhdl)(w->data)))),alg);
8150 if (m==NULL) return TRUE;
8151 res->data = (char *)id_Module2formatedMatrix(m,ul,vl,currRing);
8152 return FALSE;
8153 }
8154 else
8155 {
8156 Werror("%s(`ideal`,`ideal`,`matrix`,`string`)\n"
8157 "or (`module`,`module`,`matrix`,`string`) expected",
8158 Tok2Cmdname(iiOp));
8159 return TRUE;
8160 }
8161}

◆ jjLIFTSTD()

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

Definition at line 2609 of file iparith.cc.

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

◆ jjLIFTSTD_ALG()

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

Definition at line 7174 of file iparith.cc.

7175{
7176 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7177 idhdl hv=(idhdl)v->data;
7178 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,(ideal)u->Data());
7179#ifdef HAVE_SHIFTBBA
7180 if (rIsLPRing(currRing))
7181 {
7182 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7183 {
7184 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7185 return TRUE;
7186 }
7187 }
7188#endif
7189 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7190 res->data = (char *)idLiftStd((ideal)u->Data(),
7191 &(hv->data.umatrix),testHomog,
7192 NULL,alg);
7193 setFlag(res,FLAG_STD); v->flag=0;
7194 return FALSE;
7195}

◆ jjLIFTSTD_M()

BOOLEAN jjLIFTSTD_M ( leftv res,
leftv U )
static

Definition at line 8162 of file iparith.cc.

8163{
8164 // we have 4 or 5 arguments
8165 leftv u=U;
8166 leftv v=u->next;
8167 leftv u3=v->next;
8168 leftv u4=u3->next;
8169 leftv u5=u4->next; // might be NULL
8170
8171 ideal *syz=NULL;
8172 GbVariant alg=GbDefault;
8173 ideal h11=NULL;
8174
8175 if(u5==NULL)
8176 {
8177 // test all three possibilities for 4 arguments
8178 const short t1[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8179 const short t2[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD};
8180 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,IDEAL_CMD};
8181 const short t4[]={4,MODUL_CMD,MATRIX_CMD,MODUL_CMD,MODUL_CMD};
8182 const short t5[]={4,IDEAL_CMD,MATRIX_CMD,STRING_CMD,IDEAL_CMD};
8183 const short t6[]={4,MODUL_CMD,MATRIX_CMD,STRING_CMD,MODUL_CMD};
8184
8185 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8186 {
8187 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8188 idhdl hw=(idhdl)u3->data;
8189 syz=&(hw->data.uideal);
8190 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8191 }
8192 else if(iiCheckTypes(U,t3)||iiCheckTypes(U,t4))
8193 {
8194 if ((u3->rtyp!=IDHDL)||(u3->e!=NULL)) return TRUE;
8195 idhdl hw=(idhdl)u3->data;
8196 syz=&(hw->data.uideal);
8197 h11=(ideal)u4->Data();
8198 }
8199 else if(iiCheckTypes(U,t5)||iiCheckTypes(U,t6))
8200 {
8201 alg=syGetAlgorithm((char*)u3->Data(),currRing,(ideal)u->Data());
8202 h11=(ideal)u4->Data();
8203 }
8204 else
8205 {
8206 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8207 return TRUE;
8208 }
8209 }
8210 else
8211 {
8212 // we have 5 arguments
8213 const short t1[]={5,IDEAL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,IDEAL_CMD};
8214 const short t2[]={5,MODUL_CMD,MATRIX_CMD,MODUL_CMD,STRING_CMD,MODUL_CMD};
8215 if(iiCheckTypes(U,t1)||iiCheckTypes(U,t2))
8216 {
8217 idhdl hw=(idhdl)u3->data;
8218 syz=&(hw->data.uideal);
8219 alg=syGetAlgorithm((char*)u4->Data(),currRing,(ideal)u->Data());
8220 h11=(ideal)u5->Data();
8221 }
8222 else
8223 {
8224 Werror("%s(`ideal/module`,`matrix`[,`module`][,`string`][,`ideal/module`]) expected",Tok2Cmdname(iiOp));
8225 return TRUE;
8226 }
8227 }
8228
8229#ifdef HAVE_SHIFTBBA
8230 if (rIsLPRing(currRing))
8231 {
8232 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
8233 {
8234 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
8235 return TRUE;
8236 }
8237 }
8238#endif
8239
8240 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
8241 idhdl hv=(idhdl)v->data;
8242 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
8243 res->rtyp = u->Typ();
8244 res->data = (char *)idLiftStd((ideal)u->Data(),
8245 &(hv->data.umatrix),testHomog,
8246 syz,alg,h11);
8247 setFlag(res,FLAG_STD); v->flag=0;
8248 if(syz!=NULL)
8249 u3->flag=0;
8250 return FALSE;
8251}
@ GbDefault
Definition ideals.h:120

◆ jjLIFTSTD_SYZ()

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

Definition at line 7151 of file iparith.cc.

7152{
7153 if ((v->rtyp!=IDHDL)||(v->e!=NULL)) return TRUE;
7154 if ((w->rtyp!=IDHDL)||(w->e!=NULL)) return TRUE;
7155 idhdl hv=(idhdl)v->data;
7156 idhdl hw=(idhdl)w->data;
7157#ifdef HAVE_SHIFTBBA
7158 if (rIsLPRing(currRing))
7159 {
7160 if (currRing->LPncGenCount < IDELEMS((ideal)u->Data()))
7161 {
7162 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS((ideal)u->Data()));
7163 return TRUE;
7164 }
7165 }
7166#endif
7167 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
7168 res->data = (char *)idLiftStd((ideal)u->Data(),
7169 &(hv->data.umatrix),testHomog,
7170 &(hw->data.uideal));
7171 setFlag(res,FLAG_STD); v->flag=0; w->flag=0;
7172 return FALSE;
7173}

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv res,
leftv v )

Definition at line 8252 of file iparith.cc.

8253{
8254 int sl=0;
8255 if (v!=NULL) sl = v->listLength();
8256 lists L;
8257 if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
8258 {
8259 int add_row_shift = 0;
8260 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
8261 if (weights!=NULL) add_row_shift=weights->min_in();
8262 L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
8263 }
8264 else
8265 {
8267 leftv h=NULL;
8268 int i;
8269 int rt;
8270
8271 L->Init(sl);
8272 for (i=0;i<sl;i++)
8273 {
8274 if (h!=NULL)
8275 { /* e.g. not in the first step:
8276 * h is the pointer to the old sleftv,
8277 * v is the pointer to the next sleftv
8278 * (in this moment) */
8279 h->next=v;
8280 }
8281 h=v;
8282 v=v->next;
8283 h->next=NULL;
8284 rt=h->Typ();
8285 if (rt==0)
8286 {
8287 L->Clean();
8288 Werror("`%s` is undefined",h->Fullname());
8289 return TRUE;
8290 }
8291 if (rt==RING_CMD)
8292 {
8293 L->m[i].rtyp=rt;
8294 L->m[i].data=rIncRefCnt(((ring)h->Data()));
8295 }
8296 else
8297 L->m[i].Copy(h);
8298 }
8299 }
8300 res->data=(char *)L;
8301 return FALSE;
8302}
int min_in()
Definition intvec.h:122
@ RESOLUTION_CMD
Definition grammar.cc:291
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3178
static ring rIncRefCnt(ring r)
Definition ring.h:854

◆ jjLISTRING()

BOOLEAN jjLISTRING ( leftv res,
leftv v )
static

Definition at line 4639 of file iparith.cc.

4640{
4641 lists l=(lists)v->Data();
4642 long mm=(long)atGet(v,"maxExp",INT_CMD);
4643 int isLetterplace=(int)(long)atGet(v,"isLetterplaceRing",INT_CMD);
4644 ring r=rCompose(l,TRUE,mm,isLetterplace);
4645 res->data=(char *)r;
4646 return (r==NULL);
4647}
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition ipshell.cc:2782

◆ jjLOAD()

BOOLEAN jjLOAD ( const char * s,
BOOLEAN autoexport )

load lib/module given in v

Definition at line 5593 of file iparith.cc.

5594{
5595 char libnamebuf[1024];
5597
5598#ifdef HAVE_DYNAMIC_LOADING
5599 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5600#endif /* HAVE_DYNAMIC_LOADING */
5601 switch(LT)
5602 {
5603 default:
5604 case LT_NONE:
5605 Werror("%s: unknown type", s);
5606 break;
5607 case LT_NOTFOUND:
5608 Werror("cannot open %s", s);
5609 break;
5610
5611 case LT_SINGULAR:
5612 {
5613 char *plib = iiConvName(s);
5614 idhdl pl = IDROOT->get_level(plib,0);
5615 if (pl==NULL)
5616 {
5617 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5618 IDPACKAGE(pl)->language = LANG_SINGULAR;
5619 IDPACKAGE(pl)->libname=omStrDup(s);
5620 }
5621 else if (IDTYP(pl)!=PACKAGE_CMD)
5622 {
5623 Werror("can not create package `%s`",plib);
5624 omFreeBinAddr(plib);
5625 return TRUE;
5626 }
5627 else /* package */
5628 {
5629 package pa=IDPACKAGE(pl);
5630 if ((pa->language==LANG_C)
5631 || (pa->language==LANG_MIX))
5632 {
5633 Werror("can not create package `%s` - binaries exists",plib);
5634 omFreeBinAddr(plib);
5635 return TRUE;
5636 }
5637 }
5638 omFreeBinAddr(plib);
5639 package savepack=currPack;
5640 currPack=IDPACKAGE(pl);
5641 IDPACKAGE(pl)->loaded=TRUE;
5642 char libnamebuf[1024];
5643 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5644 BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5645 currPack=savepack;
5646 IDPACKAGE(pl)->loaded=(!bo);
5647 return bo;
5648 }
5649 case LT_BUILTIN:
5650 SModulFunc_t iiGetBuiltinModInit(const char*);
5651 return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5652 case LT_MACH_O:
5653 case LT_ELF:
5654 case LT_HPUX:
5655#ifdef HAVE_DYNAMIC_LOADING
5656 return load_modules(s, libnamebuf, autoexport);
5657#else /* HAVE_DYNAMIC_LOADING */
5658 WerrorS("Dynamic modules are not supported by this version of Singular");
5659 break;
5660#endif /* HAVE_DYNAMIC_LOADING */
5661 }
5662 return TRUE;
5663}
CanonicalForm fp
Definition cfModGcd.cc:4110
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition feFopen.cc:47
VAR package basePack
Definition ipid.cc:56
VAR package currPack
Definition ipid.cc:55
#define IDROOT
Definition ipid.h:19
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition iplib.cc:1304
int(* SModulFunc_t)(SModulFunctions *)
Definition ipid.h:81
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition iplib.cc:983
char * iiConvName(const char *libname)
Definition iplib.cc:1439
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition iplib.cc:1294
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition iplib.cc:816
VAR char libnamebuf[1024]
Definition libparse.cc:1098
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition mod_lib.cc:27
lib_types
Definition mod_raw.h:16
@ LT_MACH_O
Definition mod_raw.h:16
@ LT_HPUX
Definition mod_raw.h:16
@ LT_SINGULAR
Definition mod_raw.h:16
@ LT_BUILTIN
Definition mod_raw.h:16
@ LT_ELF
Definition mod_raw.h:16
@ LT_NONE
Definition mod_raw.h:16
@ LT_NOTFOUND
Definition mod_raw.h:16
@ LANG_SINGULAR
Definition subexpr.h:22
@ LANG_MIX
Definition subexpr.h:22
@ LANG_C
Definition subexpr.h:22

◆ jjLOAD1()

BOOLEAN jjLOAD1 ( leftv ,
leftv v )
static

Definition at line 4635 of file iparith.cc.

4636{
4637 return jjLOAD((char*)v->Data(),FALSE);
4638}
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition iparith.cc:5593

◆ jjLOAD2()

BOOLEAN jjLOAD2 ( leftv ,
leftv ,
leftv v )
static

Definition at line 2629 of file iparith.cc.

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

◆ jjLOAD_E()

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

Definition at line 2633 of file iparith.cc.

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

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char * s)

Definition at line 5669 of file iparith.cc.

5670{
5671 if (!iiGetLibStatus(s))
5672 {
5673 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5676 BOOLEAN bo=jjLOAD(s,TRUE);
5677 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5678 Print("loading of >%s< failed\n",s);
5679 WerrorS_callback=WerrorS_save;
5680 errorreported=0;
5681 }
5682 return FALSE;
5683}
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition iparith.cc:5664
static void WerrorS_dummy(const char *)
Definition iparith.cc:5665
BOOLEAN iiGetLibStatus(const char *lib)
Definition iplib.cc:77

◆ jjLT_BI()

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

Definition at line 1214 of file iparith.cc.

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

◆ jjLT_I()

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

Definition at line 1218 of file iparith.cc.

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

◆ jjLT_N()

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

Definition at line 1223 of file iparith.cc.

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

◆ jjLU_DECOMP()

BOOLEAN jjLU_DECOMP ( leftv res,
leftv v )
static

Definition at line 4666 of file iparith.cc.

4667{
4668 /* computes the LU-decomposition of a matrix M;
4669 i.e., M = P * L * U, where
4670 - P is a row permutation matrix,
4671 - L is in lower triangular form,
4672 - U is in upper row echelon form
4673 Then, we also have P * M = L * U.
4674 A list [P, L, U] is returned. */
4675 matrix mat = (matrix)v->Data();
4676 if (!idIsConstant((ideal)mat))
4677 {
4678 WerrorS("matrix must be constant");
4679 return TRUE;
4680 }
4681 matrix pMat;
4682 matrix lMat;
4683 matrix uMat;
4684
4685 luDecomp(mat, pMat, lMat, uMat);
4686
4688 ll->Init(3);
4689 ll->m[0].rtyp=MATRIX_CMD; ll->m[0].data=(void *)pMat;
4690 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)lMat;
4691 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)uMat;
4692 res->data=(char*)ll;
4693
4694 return FALSE;
4695}
#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()

BOOLEAN jjLU_INVERSE ( leftv res,
leftv v )
static

Definition at line 7740 of file iparith.cc.

7741{
7742 /* computation of the inverse of a quadratic matrix A
7743 using the L-U-decomposition of A;
7744 There are two valid parametrisations:
7745 1) exactly one argument which is just the matrix A,
7746 2) exactly three arguments P, L, U which already
7747 realise the L-U-decomposition of A, that is,
7748 P * A = L * U, and P, L, and U satisfy the
7749 properties decribed in method 'jjLU_DECOMP';
7750 see there;
7751 If A is invertible, the list [1, A^(-1)] is returned,
7752 otherwise the list [0] is returned. Thus, the user may
7753 inspect the first entry of the returned list to see
7754 whether A is invertible. */
7755 matrix iMat; int invertible;
7756 const short t1[]={1,MATRIX_CMD};
7757 const short t2[]={3,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7758 if (iiCheckTypes(v,t1))
7759 {
7760 matrix aMat = (matrix)v->Data();
7761 int rr = aMat->rows();
7762 int cc = aMat->cols();
7763 if (rr != cc)
7764 {
7765 Werror("given matrix (%d x %d) is not quadratic, hence not invertible", rr, cc);
7766 return TRUE;
7767 }
7768 if (!idIsConstant((ideal)aMat))
7769 {
7770 WerrorS("matrix must be constant");
7771 return TRUE;
7772 }
7773 invertible = luInverse(aMat, iMat);
7774 }
7775 else if (iiCheckTypes(v,t2))
7776 {
7777 matrix pMat = (matrix)v->Data();
7778 matrix lMat = (matrix)v->next->Data();
7779 matrix uMat = (matrix)v->next->next->Data();
7780 int rr = uMat->rows();
7781 int cc = uMat->cols();
7782 if (rr != cc)
7783 {
7784 Werror("third matrix (%d x %d) is not quadratic, hence not invertible",
7785 rr, cc);
7786 return TRUE;
7787 }
7788 if (!idIsConstant((ideal)pMat)
7789 || (!idIsConstant((ideal)lMat))
7790 || (!idIsConstant((ideal)uMat))
7791 )
7792 {
7793 WerrorS("matricesx must be constant");
7794 return TRUE;
7795 }
7796 invertible = luInverseFromLUDecomp(pMat, lMat, uMat, iMat);
7797 }
7798 else
7799 {
7800 Werror("expected either one or three matrices");
7801 return TRUE;
7802 }
7803
7804 /* build the return structure; a list with either one or two entries */
7806 if (invertible)
7807 {
7808 ll->Init(2);
7809 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7810 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)iMat;
7811 }
7812 else
7813 {
7814 ll->Init(1);
7815 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)invertible;
7816 }
7817
7818 res->data=(char*)ll;
7819 return FALSE;
7820}
int & cols()
Definition matpol.h:24
int & rows()
Definition matpol.h:23
bool luInverseFromLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, matrix &iMat, const ring R)
This code computes the inverse by inverting lMat and uMat, and then performing two matrix multiplicat...
bool luInverse(const matrix aMat, matrix &iMat, const ring R)
This code first computes the LU-decomposition of aMat, and then calls the method for inverting a matr...

◆ jjLU_SOLVE()

BOOLEAN jjLU_SOLVE ( leftv res,
leftv v )
static

Definition at line 7821 of file iparith.cc.

7822{
7823 /* for solving a linear equation system A * x = b, via the
7824 given LU-decomposition of the matrix A;
7825 There is one valid parametrisation:
7826 1) exactly four arguments P, L, U, b;
7827 P, L, and U realise the L-U-decomposition of A, that is,
7828 P * A = L * U, and P, L, and U satisfy the
7829 properties decribed in method 'jjLU_DECOMP';
7830 see there;
7831 b is the right-hand side vector of the equation system;
7832 The method will return a list of either 1 entry or three entries:
7833 1) [0] if there is no solution to the system;
7834 2) [1, x, H] if there is at least one solution;
7835 x is any solution of the given linear system,
7836 H is the matrix with column vectors spanning the homogeneous
7837 solution space.
7838 The method produces an error if matrix and vector sizes do not fit. */
7839 const short t[]={4,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD};
7840 if (!iiCheckTypes(v,t))
7841 {
7842 WerrorS("expected exactly three matrices and one vector as input");
7843 return TRUE;
7844 }
7845 matrix pMat = (matrix)v->Data();
7846 matrix lMat = (matrix)v->next->Data();
7847 matrix uMat = (matrix)v->next->next->Data();
7848 matrix bVec = (matrix)v->next->next->next->Data();
7849 matrix xVec; int solvable; matrix homogSolSpace;
7850 if (pMat->rows() != pMat->cols())
7851 {
7852 Werror("first matrix (%d x %d) is not quadratic",
7853 pMat->rows(), pMat->cols());
7854 return TRUE;
7855 }
7856 if (lMat->rows() != lMat->cols())
7857 {
7858 Werror("second matrix (%d x %d) is not quadratic",
7859 lMat->rows(), lMat->cols());
7860 return TRUE;
7861 }
7862 if (lMat->rows() != uMat->rows())
7863 {
7864 Werror("second matrix (%d x %d) and third matrix (%d x %d) do not fit",
7865 lMat->rows(), lMat->cols(), uMat->rows(), uMat->cols());
7866 return TRUE;
7867 }
7868 if (uMat->rows() != bVec->rows())
7869 {
7870 Werror("third matrix (%d x %d) and vector (%d x 1) do not fit",
7871 uMat->rows(), uMat->cols(), bVec->rows());
7872 return TRUE;
7873 }
7874 if (!idIsConstant((ideal)pMat)
7875 ||(!idIsConstant((ideal)lMat))
7876 ||(!idIsConstant((ideal)uMat))
7877 )
7878 {
7879 WerrorS("matrices must be constant");
7880 return TRUE;
7881 }
7882 solvable = luSolveViaLUDecomp(pMat, lMat, uMat, bVec, xVec, homogSolSpace);
7883
7884 /* build the return structure; a list with either one or three entries */
7886 if (solvable)
7887 {
7888 ll->Init(3);
7889 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7890 ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
7891 ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
7892 }
7893 else
7894 {
7895 ll->Init(1);
7896 ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
7897 }
7898
7899 res->data=(char*)ll;
7900 return FALSE;
7901}
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()

Subexpr jjMakeSub ( leftv e)
static

Definition at line 8972 of file iparith.cc.

8973{
8974 assume( e->Typ()==INT_CMD );
8975 Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8976 r->start =(int)(long)e->Data();
8977 return r;
8978}
VAR omBin sSubexpr_bin
Definition subexpr.cc:40

◆ jjMAP()

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

Definition at line 1653 of file iparith.cc.

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

◆ jjMATRIX_Id()

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

Definition at line 6952 of file iparith.cc.

6953{
6954 int mi=(int)(long)v->Data();
6955 int ni=(int)(long)w->Data();
6956 if ((mi<1)||(ni<1))
6957 {
6958 Werror("converting ideal to matrix: dimensions must be positive(%dx%d)",mi,ni);
6959 return TRUE;
6960 }
6961 matrix m=mpNew(mi,ni);
6962 ideal I=(ideal)u->CopyD(IDEAL_CMD);
6963 int i=si_min(IDELEMS(I),mi*ni);
6964 //for(i=i-1;i>=0;i--)
6965 //{
6966 // m->m[i]=I->m[i];
6967 // I->m[i]=NULL;
6968 //}
6969 memcpy(m->m,I->m,i*sizeof(poly));
6970 memset(I->m,0,i*sizeof(poly));
6971 id_Delete(&I,currRing);
6972 res->data = (char *)m;
6973 return FALSE;
6974}

◆ jjMATRIX_Ma()

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

Definition at line 6988 of file iparith.cc.

6989{
6990 int mi=(int)(long)v->Data();
6991 int ni=(int)(long)w->Data();
6992 if ((mi<1)||(ni<1))
6993 {
6994 Werror("converting matrix to matrix: dimensions must be positive(%dx%d)",mi,ni);
6995 return TRUE;
6996 }
6997 matrix m=mpNew(mi,ni);
6999 int r=si_min(MATROWS(I),mi);
7000 int c=si_min(MATCOLS(I),ni);
7001 int i,j;
7002 for(i=r;i>0;i--)
7003 {
7004 for(j=c;j>0;j--)
7005 {
7006 MATELEM(m,i,j)=MATELEM(I,i,j);
7007 MATELEM(I,i,j)=NULL;
7008 }
7009 }
7010 id_Delete((ideal *)&I,currRing);
7011 res->data = (char *)m;
7012 return FALSE;
7013}

◆ jjMATRIX_Mo()

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

Definition at line 6975 of file iparith.cc.

6976{
6977 int mi=(int)(long)v->Data();
6978 int ni=(int)(long)w->Data();
6979 if ((mi<0)||(ni<1))
6980 {
6981 Werror("converting module to matrix: dimensions must be positive(%dx%d)",mi,ni);
6982 return TRUE;
6983 }
6984 res->data = (char *)id_Module2formatedMatrix((ideal)u->CopyD(MODUL_CMD),
6985 mi,ni,currRing);
6986 return FALSE;
6987}

◆ jjMEMORY()

BOOLEAN jjMEMORY ( leftv res,
leftv v )
static

Definition at line 4696 of file iparith.cc.

4697{
4698 // clean out "_":
4699 sLastPrinted.CleanUp();
4700 // collect all info:
4701 omUpdateInfo();
4702 switch(((int)(long)v->Data()))
4703 {
4704 #ifdef HAVE_OMALLOC
4705 case 0:
4706 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4707 break;
4708 case 1:
4709 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4710 break;
4711 case 2:
4712 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4713 break;
4714 #endif
4715 default:
4716 omPrintStats(stdout);
4717 omPrintInfo(stdout);
4718 omPrintBinStats(stdout);
4719 res->data = (char *)0;
4720 res->rtyp = NONE;
4721 }
4722 return FALSE;
4723}
omInfo_t om_Info
Definition omStats.c:16
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
#define NONE
Definition tok.h:223
#define omPrintStats(F)
Definition xalloc.h:231
#define omPrintInfo(F)
Definition xalloc.h:232
#define omPrintBinStats(F)
Definition xalloc.h:233
#define omUpdateInfo()
Definition xalloc.h:230

◆ jjMINOR_M()

BOOLEAN jjMINOR_M ( leftv res,
leftv v )
static

Definition at line 6391 of file iparith.cc.

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

◆ jjMINRES_R()

BOOLEAN jjMINRES_R ( leftv res,
leftv v )
static

Definition at line 4749 of file iparith.cc.

4750{
4751 intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
4752
4753 syStrategy tmp=syCopy((syStrategy)v->Data());
4754 tmp = syMinimize(tmp); // enrich itself!
4755
4756 res->data=(char *)tmp;
4757
4758 if (weights!=NULL)
4759 atSet(res, omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
4760
4761 return FALSE;
4762}
syStrategy syMinimize(syStrategy syzstr)
Definition syz1.cc:2394
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1886

◆ jjMINUS_B()

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

Definition at line 919 of file iparith.cc.

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

◆ jjMINUS_B_P()

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

Definition at line 909 of file iparith.cc.

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

◆ jjMINUS_BI()

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

Definition at line 894 of file iparith.cc.

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

◆ jjMINUS_BIM()

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

Definition at line 942 of file iparith.cc.

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

◆ jjMINUS_I()

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

Definition at line 878 of file iparith.cc.

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

◆ jjMINUS_IV()

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

Definition at line 932 of file iparith.cc.

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

◆ jjMINUS_MA()

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

Definition at line 952 of file iparith.cc.

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

◆ jjMINUS_N()

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

Definition at line 899 of file iparith.cc.

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

◆ jjMINUS_SM()

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

Definition at line 965 of file iparith.cc.

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

◆ jjMINUS_V()

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

Definition at line 904 of file iparith.cc.

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

◆ jjMOD_BI()

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

Definition at line 2697 of file iparith.cc.

2698{
2699 number q=(number)v->Data();
2700 if (n_IsZero(q,coeffs_BIGINT))
2701 {
2703 return TRUE;
2704 }
2705 res->data =(char *) n_IntMod((number)u->Data(),q,coeffs_BIGINT);
2706 return FALSE;
2707}
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:631

◆ jjMOD_N()

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

Definition at line 2708 of file iparith.cc.

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

◆ jjMOD_P()

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

Definition at line 2719 of file iparith.cc.

2720{
2721 poly q=(poly)v->Data();
2722 if (q==NULL)
2723 {
2725 return TRUE;
2726 }
2727 poly p=(poly)(u->Data());
2728 if (p==NULL)
2729 {
2730 res->data=NULL;
2731 return FALSE;
2732 }
2733 res->data=(void*)(singclap_pmod(p /*(poly)(u->Data())*/ ,
2734 q /*(poly)(v->Data())*/ ,currRing));
2735 return FALSE;
2736}
poly singclap_pmod(poly f, poly g, const ring r)
Definition clapsing.cc:732

◆ jjMODULO()

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

Definition at line 2644 of file iparith.cc.

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

◆ jjMODULO3()

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

Definition at line 7014 of file iparith.cc.

7015{
7016 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
7017 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7018 tHomog hom=testHomog;
7019 if (w_u!=NULL)
7020 {
7021 w_u=ivCopy(w_u);
7022 hom=isHomog;
7023 }
7024 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
7025 if (w_v!=NULL)
7026 {
7027 w_v=ivCopy(w_v);
7028 hom=isHomog;
7029 }
7030 if ((w_u!=NULL) && (w_v==NULL))
7031 w_v=ivCopy(w_u);
7032 if ((w_v!=NULL) && (w_u==NULL))
7033 w_u=ivCopy(w_v);
7034 ideal u_id=(ideal)u->Data();
7035 ideal v_id=(ideal)v->Data();
7036 if (w_u!=NULL)
7037 {
7038 if ((*w_u).compare((w_v))!=0)
7039 {
7040 WarnS("incompatible weights");
7041 delete w_u; w_u=NULL;
7042 hom=testHomog;
7043 }
7044 else
7045 {
7046 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7047 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7048 {
7049 WarnS("wrong weights");
7050 delete w_u; w_u=NULL;
7051 hom=testHomog;
7052 }
7053 }
7054 }
7055 idhdl h=(idhdl)w->data;
7056 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix));
7057 if (w_u!=NULL)
7058 {
7059 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7060 }
7061 delete w_v;
7062 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7063 return FALSE;
7064}

◆ jjMODULO3S()

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

Definition at line 7065 of file iparith.cc.

7066{
7067 if (w->rtyp!=IDHDL) return TRUE; /* idhdhl required */
7068 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7069 tHomog hom=testHomog;
7070 if (w_u!=NULL)
7071 {
7072 w_u=ivCopy(w_u);
7073 hom=isHomog;
7074 }
7075 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
7076 if (w_v!=NULL)
7077 {
7078 w_v=ivCopy(w_v);
7079 hom=isHomog;
7080 }
7081 if ((w_u!=NULL) && (w_v==NULL))
7082 w_v=ivCopy(w_u);
7083 if ((w_v!=NULL) && (w_u==NULL))
7084 w_u=ivCopy(w_v);
7085 ideal u_id=(ideal)u->Data();
7086 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,u_id);
7087 ideal v_id=(ideal)v->Data();
7088 if (w_u!=NULL)
7089 {
7090 if ((*w_u).compare((w_v))!=0)
7091 {
7092 WarnS("incompatible weights");
7093 delete w_u; w_u=NULL;
7094 hom=testHomog;
7095 }
7096 else
7097 {
7098 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
7099 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
7100 {
7101 WarnS("wrong weights");
7102 delete w_u; w_u=NULL;
7103 hom=testHomog;
7104 }
7105 }
7106 }
7107 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, NULL,alg);
7108 if (w_u!=NULL)
7109 {
7110 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
7111 }
7112 delete w_v;
7113 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
7114 return FALSE;
7115}

◆ jjMODULO4()

BOOLEAN jjMODULO4 ( leftv res,
leftv u )
static

Definition at line 8303 of file iparith.cc.

8304{
8305 leftv v=u->next;
8306 leftv w=v->next;
8307 leftv u4=w->next;
8308 GbVariant alg;
8309 ideal u_id,v_id;
8310 // we have 4 arguments
8311 const short t1[]={4,IDEAL_CMD,IDEAL_CMD,MATRIX_CMD,STRING_CMD};
8312 const short t2[]={4,MODUL_CMD,MODUL_CMD,MATRIX_CMD,STRING_CMD};
8313 if(iiCheckTypes(u,t1)||iiCheckTypes(u,t2)||(w->rtyp!=IDHDL))
8314 {
8315 u_id=(ideal)u->Data();
8316 v_id=(ideal)v->Data();
8317 alg=syGetAlgorithm((char*)u4->Data(),currRing,u_id);
8318 }
8319 else
8320 {
8321 Werror("%s(`ideal/module`,`ideal/module`[,`matrix`][,`string`]) expected",Tok2Cmdname(iiOp));
8322 return TRUE;
8323 }
8324 intvec *w_u=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8325 tHomog hom=testHomog;
8326 if (w_u!=NULL)
8327 {
8328 w_u=ivCopy(w_u);
8329 hom=isHomog;
8330 }
8331 intvec *w_v=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
8332 if (w_v!=NULL)
8333 {
8334 w_v=ivCopy(w_v);
8335 hom=isHomog;
8336 }
8337 if ((w_u!=NULL) && (w_v==NULL))
8338 w_v=ivCopy(w_u);
8339 if ((w_v!=NULL) && (w_u==NULL))
8340 w_u=ivCopy(w_v);
8341 if (w_u!=NULL)
8342 {
8343 if ((*w_u).compare((w_v))!=0)
8344 {
8345 WarnS("incompatible weights");
8346 delete w_u; w_u=NULL;
8347 hom=testHomog;
8348 }
8349 else
8350 {
8351 if ((!idTestHomModule(u_id,currRing->qideal,w_v))
8352 || (!idTestHomModule(v_id,currRing->qideal,w_v)))
8353 {
8354 WarnS("wrong weights");
8355 delete w_u; w_u=NULL;
8356 hom=testHomog;
8357 }
8358 }
8359 }
8360 idhdl h=(idhdl)w->data;
8361 res->data = (char *)idModulo(u_id,v_id ,hom,&w_u, &(h->data.umatrix),alg);
8362 if (w_u!=NULL)
8363 {
8364 atSet(res,omStrDup("isHomog"),w_u,INTVEC_CMD);
8365 }
8366 delete w_v;
8367 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
8368 return FALSE;
8369}

◆ jjMONITOR1()

BOOLEAN jjMONITOR1 ( leftv res,
leftv v )
static

Definition at line 2738 of file iparith.cc.

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

◆ jjMONITOR2()

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

Definition at line 2742 of file iparith.cc.

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

◆ jjMONOM()

BOOLEAN jjMONOM ( leftv res,
leftv v )
static

Definition at line 2783 of file iparith.cc.

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

◆ jjmpTrace()

BOOLEAN jjmpTrace ( leftv res,
leftv v )
static

Definition at line 5743 of file iparith.cc.

5744{
5745 res->data = (char *)mp_Trace((matrix)v->Data(),currRing);
5746 return FALSE;
5747}
poly mp_Trace(matrix a, const ring R)
Definition matpol.cc:268

◆ jjmpTransp()

BOOLEAN jjmpTransp ( leftv res,
leftv v )
static

Definition at line 5748 of file iparith.cc.

5749{
5750 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5751 return FALSE;
5752}
matrix mp_Transp(matrix a, const ring R)
Definition matpol.cc:247

◆ jjMRES_MAP()

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

Definition at line 6587 of file iparith.cc.

6588{
6589 if ((ma->rtyp!=IDHDL)||(ma->e!=NULL))
6590 {
6591 WerrorS("3rd argument must have a name");
6592 return TRUE;
6593 }
6594 int maxl=(int)(long)v->Data();
6595 if (maxl<0)
6596 {
6597 WerrorS("length for res must not be negative");
6598 return TRUE;
6599 }
6600 syStrategy r;
6601 intvec *weights=NULL;
6602 int wmaxl=maxl;
6603 ideal u_id=(ideal)u->Data();
6604
6605 maxl--;
6606 if (/*(*/ maxl==-1 /*)*/)
6607 {
6608 maxl = currRing->N-1+2;
6609 if (currRing->qideal!=NULL)
6610 {
6611 Warn(
6612 "full resolution in a qring may be infinite, setting max length to %d",
6613 maxl+1);
6614 }
6615 }
6616 weights=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
6617 if (weights!=NULL)
6618 {
6619 if (!idTestHomModule(u_id,currRing->qideal,weights))
6620 {
6621 WarnS("wrong weights given:");weights->show();PrintLn();
6622 weights=NULL;
6623 }
6624 }
6625 intvec *ww=NULL;
6626 int add_row_shift=0;
6627 if (weights!=NULL)
6628 {
6629 ww=ivCopy(weights);
6630 add_row_shift = ww->min_in();
6631 (*ww) -= add_row_shift;
6632 }
6633 unsigned save_opt=si_opt_1;
6635 u_id=(ideal)u->CopyD();
6636 ideal mat;
6637 r=syMres_with_map(u_id,maxl,ww,mat);
6638 idhdl h=(idhdl)ma->data;
6639 idDelete(&IDIDEAL(h));
6640 IDIDEAL(h)=mat;
6641 if (r->list_length>wmaxl)
6642 {
6643 for(int i=wmaxl-1;i>=r->list_length;i--)
6644 {
6645 if (r->fullres[i]!=NULL) id_Delete(&r->fullres[i],currRing);
6646 if (r->minres[i]!=NULL) id_Delete(&r->minres[i],currRing);
6647 }
6648 }
6649 r->list_length=wmaxl;
6650 res->data=(void *)r;
6651 if ((weights!=NULL) && (ww!=NULL)) { delete ww; ww=NULL; }
6652 if ((r->weights!=NULL) && (r->weights[0]!=NULL))
6653 {
6654 ww=ivCopy(r->weights[0]);
6655 if (weights!=NULL) (*ww) += add_row_shift;
6656 atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
6657 }
6658 else
6659 {
6660 if (weights!=NULL)
6661 {
6662 atSet(res,omStrDup("isHomog"),ivCopy(weights),INTVEC_CMD);
6663 }
6664 }
6665 assume( (r->syRing != NULL) == (r->resPairs != NULL) );
6666 assume( (r->minres != NULL) || (r->fullres != NULL) );
6667 si_opt_1=save_opt;
6668 return FALSE;
6669}
void show(int mat=0, int spaces=0) const
Definition intvec.cc:149
#define IDIDEAL(a)
Definition ipid.h:133
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_REDTAIL_SYZ
Definition options.h:88
#define Sy_bit(x)
Definition options.h:31
syStrategy syMres_with_map(ideal arg, int maxlength, intvec *w, ideal &trans)
Definition syz.cc:1180
ring syRing
Definition syz.h:56
resolvente minres
Definition syz.h:58
short list_length
Definition syz.h:62
intvec ** weights
Definition syz.h:45
SRes resPairs
Definition syz.h:49

◆ jjMSTD()

BOOLEAN jjMSTD ( leftv res,
leftv v )
static

Definition at line 4728 of file iparith.cc.

4729{
4730 int t=v->Typ();
4731 ideal r,m;
4732 r=kMin_std2((ideal)v->Data(),currRing->qideal,testHomog,NULL,m,NULL);
4734 l->Init(2);
4735 l->m[0].rtyp=t;
4736 l->m[0].data=(char *)r;
4737 setFlag(&(l->m[0]),FLAG_STD);
4738 l->m[1].rtyp=t;
4739 l->m[1].data=(char *)m;
4740 res->data=(char *)l;
4741 return FALSE;
4742}
ideal kMin_std2(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
Definition kstd1.cc:3070

◆ jjMULT()

BOOLEAN jjMULT ( leftv res,
leftv v )
static

Definition at line 4743 of file iparith.cc.

4744{
4746 res->data = (char *)(long)scMultInt((ideal)(v->Data()),currRing->qideal);
4747 return FALSE;
4748}
int scMultInt(ideal S, ideal Q)
Definition hdegree.cc:901

◆ jjN2BI()

BOOLEAN jjN2BI ( leftv res,
leftv v )
static

Definition at line 4763 of file iparith.cc.

4764{
4765 number n,i; i=(number)v->Data();
4767 if (nMap!=NULL)
4768 n=nMap(i,currRing->cf,coeffs_BIGINT);
4769 else goto err;
4770 res->data=(void *)n;
4771 return FALSE;
4772err:
4773 WerrorS("cannot convert to bigint"); return TRUE;
4774}

◆ jjNAMEOF()

BOOLEAN jjNAMEOF ( leftv res,
leftv v )
static

Definition at line 4775 of file iparith.cc.

4776{
4777 if ((v->rtyp==IDHDL)||(v->rtyp==ALIAS_CMD))
4778 res->data=omStrDup(v->name);
4779 else if (v->name==NULL)
4780 res->data=omStrDup("");
4781 else
4782 {
4783 res->data = (char *)v->name;
4784 v->name=NULL;
4785 }
4786 return FALSE;
4787}

◆ jjNAMES()

BOOLEAN jjNAMES ( leftv res,
leftv v )
static

Definition at line 4788 of file iparith.cc.

4789{
4790 res->data=ipNameList(((ring)v->Data())->idroot);
4791 return FALSE;
4792}
lists ipNameList(idhdl root)
Definition ipid.cc:604

◆ jjNAMES0()

BOOLEAN jjNAMES0 ( leftv res,
leftv  )
static

Definition at line 8370 of file iparith.cc.

8371{
8372 res->data=(void *)ipNameList(IDROOT);
8373 return FALSE;
8374}

◆ jjNAMES_I()

BOOLEAN jjNAMES_I ( leftv res,
leftv v )
static

Definition at line 4793 of file iparith.cc.

4794{
4795 res->data=ipNameListLev((IDROOT),(int)(long)v->Data());
4796 return FALSE;
4797}
lists ipNameListLev(idhdl root, int lev)
Definition ipid.cc:627

◆ jjNEWSTRUCT2()

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

Definition at line 2807 of file iparith.cc.

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

◆ jjNEWSTRUCT3()

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

Definition at line 6670 of file iparith.cc.

6671{
6672 // u: the name of the new type
6673 // v: the parent type
6674 // w: the elements
6675 newstruct_desc d=newstructChildFromString((const char *)v->Data(),
6676 (const char *)w->Data());
6677 if (d!=NULL) newstruct_setup((const char *)u->Data(),d);
6678 return (d==NULL);
6679}
newstruct_desc newstructChildFromString(const char *parent, const char *s)
Definition newstruct.cc:810

◆ jjnInt()

BOOLEAN jjnInt ( leftv res,
leftv u )
static

Definition at line 5783 of file iparith.cc.

5784{
5785 number n=(number)u->CopyD(); // n_Int may call n_Normalize
5786 res->data=(char *)(long)iin_Int(n,currRing->cf);
5787 n_Delete(&n,currRing->cf);
5788 return FALSE;
5789}

◆ jjnlInt()

BOOLEAN jjnlInt ( leftv res,
leftv u )
static

Definition at line 5790 of file iparith.cc.

5791{
5792 number n=(number)u->Data();
5793 res->data=(char *)(long)iin_Int(n,coeffs_BIGINT );
5794 return FALSE;
5795}

◆ jjNOT()

BOOLEAN jjNOT ( leftv res,
leftv v )
static

Definition at line 4798 of file iparith.cc.

4799{
4800 res->data=(char*)(long)((long)v->Data()==0 ? 1 : 0);
4801 return FALSE;
4802}

◆ jjNULL()

BOOLEAN jjNULL ( leftv ,
leftv  )
static

Definition at line 3784 of file iparith.cc.

3785{
3786 return FALSE;
3787}

◆ jjNUMERATOR()

BOOLEAN jjNUMERATOR ( leftv res,
leftv v )
static

Return the numerator of the input number.

Definition at line 4088 of file iparith.cc.

4089{
4090 number n = reinterpret_cast<number>(v->CopyD());
4091 res->data = reinterpret_cast<void*>(n_GetNumerator(n, currRing->cf));
4092 n_Delete(&n,currRing->cf);
4093 return FALSE;
4094}
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:611

◆ jjNVARS()

BOOLEAN jjNVARS ( leftv res,
leftv v )
static

Definition at line 4803 of file iparith.cc.

4804{
4805 res->data = (char *)(long)(((ring)(v->Data()))->N);
4806 return FALSE;
4807}
const CanonicalForm CFMap CFMap & N
Definition cfEzgcd.cc:56

◆ jjOP_BI_BIM()

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

Definition at line 276 of file iparith.cc.

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

◆ jjOP_BIM_BI()

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

Definition at line 263 of file iparith.cc.

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

◆ jjOP_BIM_I()

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

Definition at line 244 of file iparith.cc.

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

◆ jjOP_I_BIM()

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

Definition at line 259 of file iparith.cc.

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

◆ jjOP_I_IM()

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

Definition at line 316 of file iparith.cc.

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

◆ jjOP_I_IV()

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

Definition at line 297 of file iparith.cc.

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

◆ jjOP_IM_I()

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

Definition at line 301 of file iparith.cc.

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

◆ jjOP_IV_I()

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

Definition at line 280 of file iparith.cc.

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

◆ jjOP_REST()

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

Definition at line 506 of file iparith.cc.

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

◆ jjOpenClose()

BOOLEAN jjOpenClose ( leftv ,
leftv v )
static

Definition at line 4808 of file iparith.cc.

4809{
4810 si_link l=(si_link)v->Data();
4811 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4812 else { slPrepClose(l); return slClose(l);}
4813}
@ OPEN_CMD
Definition tok.h:145

◆ jjOPPOSE()

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

Definition at line 2986 of file iparith.cc.

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

◆ jjOPPOSITE()

BOOLEAN jjOPPOSITE ( leftv res,
leftv a )
static

Definition at line 5312 of file iparith.cc.

5313{
5314#ifdef HAVE_PLURAL
5315 ring r = (ring)a->Data();
5316 //if (rIsPluralRing(r))
5317 if (r->OrdSgn==1)
5318 {
5319 res->data = rOpposite(r);
5320 }
5321 else
5322 {
5323 WarnS("opposite only for global orderings");
5324 res->data = rCopy(r);
5325 }
5326 return FALSE;
5327#else
5328 return TRUE;
5329#endif
5330}
ring rOpposite(ring src)
Definition ring.cc:5425

◆ jjOPTION_PL()

BOOLEAN jjOPTION_PL ( leftv res,
leftv v )
static

Definition at line 8375 of file iparith.cc.

8376{
8377 if(v==NULL)
8378 {
8379 res->data=(char *)showOption();
8380 return FALSE;
8381 }
8382 res->rtyp=NONE;
8383 return setOption(res,v);
8384}
BOOLEAN setOption(leftv res, leftv v)
Definition misc_ip.cc:570
char * showOption()
Definition misc_ip.cc:713

◆ jjOR_I()

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

Definition at line 1385 of file iparith.cc.

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

◆ jjORD()

BOOLEAN jjORD ( leftv res,
leftv v )
static

Definition at line 4814 of file iparith.cc.

4815{
4816 poly p=(poly)v->Data();
4817 res->data=(char *)( p==NULL ? -1 : currRing->pFDeg(p,currRing) );
4818 return FALSE;
4819}

◆ jjP2BI()

BOOLEAN jjP2BI ( leftv res,
leftv v )
static

Definition at line 4860 of file iparith.cc.

4861{
4862 poly p=(poly)v->Data();
4863 if (p==NULL) { res->data=(char *)n_Init(0,coeffs_BIGINT); return FALSE; }
4864 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4865 {
4866 WerrorS("poly must be constant");
4867 return TRUE;
4868 }
4869 number i=pGetCoeff(p);
4870 number n;
4872 if (nMap!=NULL)
4873 n=nMap(i,currRing->cf,coeffs_BIGINT);
4874 else goto err;
4875 res->data=(void *)n;
4876 return FALSE;
4877err:
4878 WerrorS("cannot convert to bigint"); return TRUE;
4879}

◆ jjP2I()

BOOLEAN jjP2I ( leftv res,
leftv v )
static

Definition at line 4880 of file iparith.cc.

4881{
4882 poly p=(poly)v->Data();
4883 if (p==NULL) { /*res->data=(char *)0;*/ return FALSE; }
4884 if ((pNext(p)!=NULL)|| (!pIsConstant(p)))
4885 {
4886 WerrorS("poly must be constant");
4887 return TRUE;
4888 }
4889 res->data = (char *)(long)iin_Int(pGetCoeff(p),currRing->cf);
4890 return FALSE;
4891}

◆ jjP2N()

BOOLEAN jjP2N ( leftv res,
leftv v )
static

Definition at line 4928 of file iparith.cc.

4929{
4930 number n;
4931 poly p;
4932 if (((p=(poly)v->Data())!=NULL)
4933 && (pIsConstant(p)))
4934 {
4935 n=nCopy(pGetCoeff(p));
4936 }
4937 else
4938 {
4939 n=nInit(0);
4940 }
4941 res->data = (char *)n;
4942 return FALSE;
4943}

◆ jjPAR1()

BOOLEAN jjPAR1 ( leftv res,
leftv v )
static

Definition at line 4820 of file iparith.cc.

4821{
4822 int i=(int)(long)v->Data();
4823 int p=0;
4824 p=rPar(currRing);
4825 if ((0<i) && (i<=p))
4826 {
4827 res->data=(char *)n_Param(i,currRing);
4828 }
4829 else
4830 {
4831 Werror("par number %d out of range 1..%d",i,p);
4832 return TRUE;
4833 }
4834 return FALSE;
4835}
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:775

◆ jjPARDEG()

BOOLEAN jjPARDEG ( leftv res,
leftv v )
static

Definition at line 4836 of file iparith.cc.

4837{
4838 number nn=(number)v->Data();
4839 res->data = (char *)(long)n_ParDeg(nn, currRing->cf);
4840 return FALSE;
4841}
static FORCE_INLINE int n_ParDeg(number n, const coeffs r)
Definition coeffs.h:762

◆ jjPARSTR1()

BOOLEAN jjPARSTR1 ( leftv res,
leftv v )
static

Definition at line 4842 of file iparith.cc.

4843{
4844 if (currRing==NULL)
4845 {
4846 WerrorS("no ring active (1)");
4847 return TRUE;
4848 }
4849 int i=(int)(long)v->Data();
4850 int p=0;
4851 if ((0<i) && (rParameter(currRing)!=NULL) && (i<=(p=rPar(currRing))))
4852 res->data=omStrDup(rParameter(currRing)[i-1]);
4853 else
4854 {
4855 Werror("par number %d out of range 1..%d",i,p);
4856 return TRUE;
4857 }
4858 return FALSE;
4859}

◆ jjPARSTR2()

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

Definition at line 2821 of file iparith.cc.

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

◆ jjPFAC1()

BOOLEAN jjPFAC1 ( leftv res,
leftv v )
static

Definition at line 4648 of file iparith.cc.

4649{
4650 /* call method jjPFAC2 with second argument = 0 (meaning that no
4651 valid bound for the prime factors has been given) */
4652 sleftv tmp;
4653 tmp.Init();
4654 tmp.rtyp = INT_CMD;
4655 return jjPFAC2(res, v, &tmp);
4656}
static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
Definition iparith.cc:3298

◆ jjPFAC2()

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

Definition at line 3298 of file iparith.cc.

3299{
3300 number n1; int i;
3301
3302 if ((u->Typ() == BIGINT_CMD) ||
3303 ((u->Typ() == NUMBER_CMD) && rField_is_Q(currRing)))
3304 {
3305 n1 = (number)u->CopyD();
3306 }
3307 else if (u->Typ() == INT_CMD)
3308 {
3309 i = (int)(long)u->Data();
3310 n1 = n_Init(i, coeffs_BIGINT);
3311 }
3312 else
3313 {
3314 return TRUE;
3315 }
3316
3317 i = (int)(long)v->Data();
3318
3319 lists l = primeFactorisation(n1, i);
3320 n_Delete(&n1, coeffs_BIGINT);
3321 res->data = (char*)l;
3322 return FALSE;
3323}
lists primeFactorisation(const number n, const int pBound)
Factorises a given bigint number n into its prime factors less than or equal to a given bound,...
Definition misc_ip.cc:358

◆ jjpHead()

BOOLEAN jjpHead ( leftv res,
leftv v )
static

Definition at line 5715 of file iparith.cc.

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

◆ jjpLength()

BOOLEAN jjpLength ( leftv res,
leftv v )
static

Definition at line 5690 of file iparith.cc.

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

◆ jjPlural_mat_mat()

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

Definition at line 2898 of file iparith.cc.

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

◆ jjPlural_mat_poly()

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

Definition at line 2878 of file iparith.cc.

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

◆ jjPlural_num_mat()

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

Definition at line 2858 of file iparith.cc.

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

◆ jjPlural_num_poly()

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

Definition at line 2838 of file iparith.cc.

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

◆ jjPLUS_B()

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

Definition at line 782 of file iparith.cc.

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

◆ jjPLUS_B_P()

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

Definition at line 795 of file iparith.cc.

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

◆ jjPLUS_BI()

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:653

◆ jjPLUS_BIM()

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

Definition at line 814 of file iparith.cc.

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

◆ jjPLUS_I()

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

Definition at line 755 of file iparith.cc.

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

◆ jjPLUS_ID()

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

Definition at line 873 of file iparith.cc.

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

◆ jjPLUS_IV()

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

Definition at line 804 of file iparith.cc.

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

◆ jjPLUS_MA()

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

Definition at line 824 of file iparith.cc.

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

◆ jjPLUS_MA_P()

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

Definition at line 848 of file iparith.cc.

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

◆ jjPLUS_N()

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:18

◆ jjPLUS_P_MA()

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

Definition at line 859 of file iparith.cc.

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

◆ jjPLUS_S()

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

Definition at line 863 of file iparith.cc.

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

◆ jjPLUS_SM()

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

Definition at line 836 of file iparith.cc.

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

◆ jjPLUS_V()

BOOLEAN jjPLUS_V ( 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}

◆ jjPLUSMINUS_Gen()

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)
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 {
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 {
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 {
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()

BOOLEAN jjPLUSPLUS ( leftv ,
leftv u )
static

Definition at line 3798 of file iparith.cc.

3799{
3800 if (IDTYP((idhdl)u->data)==INT_CMD)
3801 {
3802 int i=IDINT((idhdl)u->data);
3803 if (iiOp==PLUSPLUS) i++;
3804 else i--;
3805 IDDATA((idhdl)u->data)=(char *)(long)i;
3806 return FALSE;
3807 }
3808 return TRUE;
3809}
@ PLUSPLUS
Definition grammar.cc:274
#define IDINT(a)
Definition ipid.h:125

◆ jjpMaxComp()

BOOLEAN jjpMaxComp ( leftv res,
leftv v )
static

Definition at line 5738 of file iparith.cc.

5739{
5740 res->data = (char *)pMaxComp((poly)v->Data());
5741 return FALSE;
5742}

◆ jjPOWER_BI()

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

Definition at line 568 of file iparith.cc.

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

◆ jjPOWER_I()

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

Definition at line 522 of file iparith.cc.

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

◆ jjPOWER_ID()

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()

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

Definition at line 584 of file iparith.cc.

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

◆ jjPOWER_P()

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

Definition at line 602 of file iparith.cc.

603{
604 int v_i=(int)(long)v->Data();
605 if (v_i<0)
606 {
607 WerrorS("exponent must be non-negative");
608 return TRUE;
609 }
610 poly u_p=(poly)u->CopyD(POLY_CMD);
611 if ((u_p!=NULL)
612 && (!rIsLPRing(currRing))
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:283

◆ jjPREIMAGE()

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

Definition at line 6680 of file iparith.cc.

6681{
6682 // handles preimage(r,phi,i) and kernel(r,phi)
6683 idhdl h;
6684 ring rr;
6685 map mapping;
6686 BOOLEAN kernel_cmd= (iiOp==KERNEL_CMD);
6687
6688 if ((v->name==NULL) || (!kernel_cmd && (w->name==NULL)))
6689 {
6690 WerrorS("2nd/3rd arguments must have names");
6691 return TRUE;
6692 }
6693 rr=(ring)u->Data();
6694 const char *ring_name=u->Name();
6695 if ((h=rr->idroot->get(v->name,myynest))!=NULL)
6696 {
6697 if (h->typ==MAP_CMD)
6698 {
6699 mapping=IDMAP(h);
6700 idhdl preim_ring=IDROOT->get(mapping->preimage,myynest);
6701 if ((preim_ring==NULL)
6702 || (IDRING(preim_ring)!=currRing))
6703 {
6704 Werror("preimage ring `%s` is not the basering",mapping->preimage);
6705 return TRUE;
6706 }
6707 }
6708 else if (h->typ==IDEAL_CMD)
6709 {
6710 mapping=IDMAP(h);
6711 }
6712 else
6713 {
6714 Werror("`%s` is no map nor ideal",IDID(h));
6715 return TRUE;
6716 }
6717 }
6718 else
6719 {
6720 Werror("`%s` is not defined in `%s`",v->name,ring_name);
6721 return TRUE;
6722 }
6723 ideal image;
6724 if (kernel_cmd) image=idInit(1,1);
6725 else
6726 {
6727 if ((h=rr->idroot->get(w->name,myynest))!=NULL)
6728 {
6729 if (h->typ==IDEAL_CMD)
6730 {
6731 image=IDIDEAL(h);
6732 }
6733 else
6734 {
6735 Werror("`%s` is no ideal",IDID(h));
6736 return TRUE;
6737 }
6738 }
6739 else
6740 {
6741 Werror("`%s` is not defined in `%s`",w->name,ring_name);
6742 return TRUE;
6743 }
6744 }
6745 if (((currRing->qideal!=NULL) && (rHasLocalOrMixedOrdering(currRing)))
6746 || ((rr->qideal!=NULL) && (rHasLocalOrMixedOrdering(rr))))
6747 {
6748 WarnS("preimage in local qring may be wrong: use Ring::preimageLoc instead");
6749 }
6750 res->data=(char *)maGetPreimage(rr,mapping,image,currRing);
6751 if (kernel_cmd) idDelete(&image);
6752 return (res->data==NULL/* is of type ideal, should not be NULL*/);
6753}
#define IDMAP(a)
Definition ipid.h:135
#define IDID(a)
Definition ipid.h:122
ideal maGetPreimage(ring theImageRing, map theMap, ideal id, const ring dst_r)
Definition preimage.cc:57
@ KERNEL_CMD
Definition tok.h:107

◆ jjPREIMAGE_R()

BOOLEAN jjPREIMAGE_R ( leftv res,
leftv v )
static

Definition at line 4892 of file iparith.cc.

4893{
4894 map mapping=(map)v->Data();
4895 syMake(res,omStrDup(mapping->preimage));
4896 return FALSE;
4897}

◆ jjPRIME()

BOOLEAN jjPRIME ( leftv res,
leftv v )
static

Definition at line 4898 of file iparith.cc.

4899{
4900 int i = IsPrime((int)(long)(v->Data()));
4901 res->data = (char *)(long)(i > 1 ? i : 2);
4902 return FALSE;
4903}
int IsPrime(int p)
Definition prime.cc:61

◆ jjPROC()

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

Definition at line 1617 of file iparith.cc.

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

◆ jjPROC1()

BOOLEAN jjPROC1 ( leftv res,
leftv u )
static

Definition at line 3875 of file iparith.cc.

3876{
3877 return jjPROC(res,u,NULL);
3878}
BOOLEAN jjPROC(leftv res, leftv u, leftv v)
Definition iparith.cc:1617

◆ jjPROC3()

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

Definition at line 6078 of file iparith.cc.

6079{
6080 v->next=(leftv)omAllocBin(sleftv_bin);
6081 memcpy(v->next,w,sizeof(sleftv));
6082 w->Init();
6083 return jjPROC(res,u,v);
6084}

◆ jjPRUNE()

BOOLEAN jjPRUNE ( leftv res,
leftv v )
static

Definition at line 4904 of file iparith.cc.

4905{
4906 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
4907 ideal v_id=(ideal)v->Data();
4908 if (w!=NULL)
4909 {
4910 if (!idTestHomModule(v_id,currRing->qideal,w))
4911 {
4912 WarnS("wrong weights");
4913 w=NULL;
4914 // and continue at the non-homog case below
4915 }
4916 else
4917 {
4918 w=ivCopy(w);
4919 intvec **ww=&w;
4920 res->data = (char *)idMinEmbedding(v_id,FALSE,ww);
4921 atSet(res,omStrDup("isHomog"),*ww,INTVEC_CMD);
4922 return FALSE;
4923 }
4924 }
4925 res->data = (char *)idMinEmbedding(v_id);
4926 return FALSE;
4927}
ideal idMinEmbedding(ideal arg, BOOLEAN inPlace, intvec **w)
Definition ideals.cc:2858

◆ jjPRUNE_MAP()

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

Definition at line 3059 of file iparith.cc.

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

◆ jjQRDS()

BOOLEAN jjQRDS ( leftv res,
leftv INPUT )
static

Definition at line 8849 of file iparith.cc.

8850{
8851 if ((INPUT->Typ() != MATRIX_CMD) ||
8852 (INPUT->next->Typ() != NUMBER_CMD) ||
8853 (INPUT->next->next->Typ() != NUMBER_CMD) ||
8854 (INPUT->next->next->next->Typ() != NUMBER_CMD))
8855 {
8856 WerrorS("expected (matrix, number, number, number) as arguments");
8857 return TRUE;
8858 }
8859 leftv u = INPUT; leftv v = u->next; leftv w = v->next; leftv x = w->next;
8860 res->data = (char *)qrDoubleShift((matrix)(u->Data()),
8861 (number)(v->Data()),
8862 (number)(w->Data()),
8863 (number)(x->Data()));
8864 return FALSE;
8865}
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()

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

Definition at line 3105 of file iparith.cc.

3106{
3107 res->data = (char *)idQuot((ideal)u->Data(),(ideal)v->Data(),
3108 hasFlag(u,FLAG_STD),u->Typ()==v->Typ());
3109 //if (TEST_OPT_RETURN_SB) setFlag(res,FLAG_STD);
3110 return FALSE;
3111}
ideal idQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
Definition ideals.cc:1537

◆ jjRANDOM()

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

Definition at line 3112 of file iparith.cc.

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

◆ jjRANDOM_Im()

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

Definition at line 6763 of file iparith.cc.

6764{
6765 int di, k;
6766 int i=(int)(long)u->Data();
6767 int r=(int)(long)v->Data();
6768 int c=(int)(long)w->Data();
6769 if ((r<=0) || (c<=0)) return TRUE;
6770 intvec *iv = new intvec(r, c, 0);
6771 if (iv->rows()==0)
6772 {
6773 delete iv;
6774 return TRUE;
6775 }
6776 if (i!=0)
6777 {
6778 if (i<0) i = -i;
6779 di = 2 * i + 1;
6780 for (k=0; k<iv->length(); k++)
6781 {
6782 (*iv)[k] = ((siRand() % di) - i);
6783 }
6784 }
6785 res->data = (char *)iv;
6786 return FALSE;
6787}

◆ jjRANK1()

BOOLEAN jjRANK1 ( leftv res,
leftv v )
static

Definition at line 4966 of file iparith.cc.

4967{
4968 matrix m =(matrix)v->Data();
4969 int rank = luRank(m, 0);
4970 res->data =(char *)(long)rank;
4971 return FALSE;
4972}
int luRank(const matrix aMat, const bool isRowEchelon, const ring R)
Computes the rank of a given (m x n)-matrix.

◆ jjRANK2()

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

Definition at line 3120 of file iparith.cc.

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

◆ jjrCharStr()

BOOLEAN jjrCharStr ( leftv res,
leftv v )
static

Definition at line 5710 of file iparith.cc.

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

◆ jjREAD()

BOOLEAN jjREAD ( leftv res,
leftv v )
static

Definition at line 4973 of file iparith.cc.

4974{
4975 return jjREAD2(res,v,NULL);
4976}
static BOOLEAN jjREAD2(leftv res, leftv u, leftv v)
Definition iparith.cc:3129

◆ jjREAD2()

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

Definition at line 3129 of file iparith.cc.

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

◆ jjREDUCE3_CID()

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

Definition at line 7208 of file iparith.cc.

7209{
7211 if (!idIsZeroDim((ideal)v->Data()))
7212 {
7213 Werror("`%s` must be 0-dimensional",v->Name());
7214 return TRUE;
7215 }
7216 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7217 (matrix)w->CopyD());
7218 return FALSE;
7219}
static BOOLEAN idIsZeroDim(ideal i)
Definition ideals.h:180
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2307

◆ jjREDUCE3_CP()

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

Definition at line 7196 of file iparith.cc.

7197{
7199 if (!idIsZeroDim((ideal)v->Data()))
7200 {
7201 Werror("`%s` must be 0-dimensional",v->Name());
7202 return TRUE;
7203 }
7204 res->data = (char *)redNF((ideal)v->CopyD(),(poly)u->CopyD(),
7205 (poly)w->CopyD());
7206 return FALSE;
7207}

◆ jjREDUCE3_ID()

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

Definition at line 7227 of file iparith.cc.

7228{
7230 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(ideal)u->Data(),
7231 0,(int)(long)w->Data());
7232 return FALSE;
7233}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3230

◆ jjREDUCE3_P()

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

Definition at line 7220 of file iparith.cc.

7221{
7223 res->data = (char *)kNF((ideal)v->Data(),currRing->qideal,(poly)u->Data(),
7224 0,(int)(long)w->Data());
7225 return FALSE;
7226}

◆ jjREDUCE4()

BOOLEAN jjREDUCE4 ( leftv res,
leftv u )
static

Definition at line 8385 of file iparith.cc.

8386{
8387 leftv u1=u;
8388 leftv u2=u1->next;
8389 leftv u3=u2->next;
8390 leftv u4=u3->next;
8391 int u1t=u1->Typ(); if (u1t==BUCKET_CMD) u1t=POLY_CMD;
8392 int u2t=u2->Typ(); if (u2t==BUCKET_CMD) u2t=POLY_CMD;
8393 if((u3->Typ()==INT_CMD)&&(u4->Typ()==INTVEC_CMD))
8394 {
8395 int save_d=Kstd1_deg;
8396 Kstd1_deg=(int)(long)u3->Data();
8397 kModW=(intvec *)u4->Data();
8398 BITSET save2;
8399 SI_SAVE_OPT2(save2);
8401 u2->next=NULL;
8402 BOOLEAN r=jjCALL2ARG(res,u);
8403 kModW=NULL;
8404 Kstd1_deg=save_d;
8405 SI_RESTORE_OPT2(save2);
8406 u->next->next=u3;
8407 return r;
8408 }
8409 else
8410 if((u1t==IDEAL_CMD)&&(u2t==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8411 (u4->Typ()==INT_CMD))
8412 {
8413 assumeStdFlag(u3);
8414 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8415 {
8416 WerrorS("2nd argument must be a diagonal matrix of units");
8417 return TRUE;
8418 }
8419 res->data=(char*)redNF(
8420 idCopy((ideal)u3->Data()),
8421 idCopy((ideal)u1->Data()),
8422 mp_Copy((matrix)u2->Data(), currRing),
8423 (int)(long)u4->Data()
8424 );
8425 return FALSE;
8426 }
8427 else
8428 if((u1t==POLY_CMD)&&(u2t==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8429 (u4->Typ()==INT_CMD))
8430 {
8431 poly u1p;
8432 if (u1->Typ()==BUCKET_CMD) u1p=sBucketPeek((sBucket_pt)u1->Data());
8433 else u1p=(poly)u1->Data();
8434 poly u2p;
8435 if (u2->Typ()==BUCKET_CMD) u2p=sBucketPeek((sBucket_pt)u2->Data());
8436 else u2p=(poly)u2->Data();
8437 assumeStdFlag(u3);
8438 if(!pIsUnit(u2p))
8439 {
8440 WerrorS("2nd argument must be a unit");
8441 return TRUE;
8442 }
8443 res->rtyp=POLY_CMD;
8444 res->data=(char*)redNF((ideal)u3->CopyD(),pCopy(u1p),
8445 pCopy(u2p),(int)(long)u4->Data());
8446 return FALSE;
8447 }
8448 else
8449 {
8450 Werror("%s(`poly`,`ideal`,`int`,`intvec`) expected",Tok2Cmdname(iiOp));
8451 Werror("%s(`ideal`,`matrix`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8452 Werror("%s(`poly`,`poly`,`ideal`,`int`) expected",Tok2Cmdname(iiOp));
8453 return TRUE;
8454 }
8455}
#define BITSET
Definition auxiliary.h:85
static BOOLEAN jjCALL2ARG(leftv res, leftv u)
Definition iparith.cc:7362
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
VAR unsigned si_opt_2
Definition options.c:6
#define SI_SAVE_OPT2(A)
Definition options.h:22
#define SI_RESTORE_OPT2(A)
Definition options.h:25
#define V_DEG_STOP
Definition options.h:73
poly sBucketPeek(sBucket_pt b)
Definition sbuckets.cc:455

◆ jjREDUCE5()

BOOLEAN jjREDUCE5 ( leftv res,
leftv u )
static

Definition at line 8456 of file iparith.cc.

8457{
8458 leftv u1=u;
8459 leftv u2=u1->next;
8460 leftv u3=u2->next;
8461 leftv u4=u3->next;
8462 leftv u5=u4->next;
8463 if((u1->Typ()==IDEAL_CMD)&&(u2->Typ()==MATRIX_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8464 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8465 {
8466 assumeStdFlag(u3);
8467 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8468 {
8469 WerrorS("2nd argument must be a diagonal matrix of units");
8470 return TRUE;
8471 }
8472 res->data=(char*)redNF(
8473 idCopy((ideal)u3->Data()),
8474 idCopy((ideal)u1->Data()),
8475 mp_Copy((matrix)u2->Data(),currRing),
8476 (int)(long)u4->Data(),
8477 (intvec*)u5->Data()
8478 );
8479 return FALSE;
8480 }
8481 else
8482 if((u1->Typ()==POLY_CMD)&&(u2->Typ()==POLY_CMD)&&(u3->Typ()==IDEAL_CMD)&&
8483 (u4->Typ()==INT_CMD)&&(u5->Typ()==INTVEC_CMD))
8484 {
8485 assumeStdFlag(u3);
8486 if(!pIsUnit((poly)u2->Data()))
8487 {
8488 WerrorS("2nd argument must be a unit");
8489 return TRUE;
8490 }
8491 res->rtyp=POLY_CMD;
8492 res->data=(char*)redNF(idCopy((ideal)u3->Data()),pCopy((poly)u1->Data()),
8493 pCopy((poly)u2->Data()),
8494 (int)(long)u4->Data(),(intvec*)u5->Data());
8495 return FALSE;
8496 }
8497 else
8498 {
8499 Werror("%s(`ideal`,`ideal`,`matrix`,`int`,`intvec`) exppected",
8500 Tok2Cmdname(iiOp));
8501 return TRUE;
8502 }
8503}

◆ jjREDUCE_ID()

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

Definition at line 3153 of file iparith.cc.

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

◆ jjREDUCE_P()

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

Definition at line 3145 of file iparith.cc.

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

◆ jjREGULARITY()

BOOLEAN jjREGULARITY ( leftv res,
leftv v )
static

Definition at line 4977 of file iparith.cc.

4978{
4979 res->data = (char *)(long)iiRegularity((lists)v->Data());
4980 return FALSE;
4981}
int iiRegularity(lists L)
Definition ipshell.cc:1045

◆ jjREPART()

BOOLEAN jjREPART ( leftv res,
leftv v )
static

Definition at line 4982 of file iparith.cc.

4983{
4984 res->data = (char *)n_RePart((number)v->Data(),currRing->cf);
4985 return FALSE;
4986}
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
Definition coeffs.h:782

◆ jjRES()

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

Definition at line 3162 of file iparith.cc.

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

◆ jjRES3()

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

Definition at line 7235 of file iparith.cc.

7236{
7237 int maxl=(int)v->Data();
7238 ideal u_id=(ideal)u->Data();
7239 int l=0;
7240 resolvente r;
7241 intvec **weights=NULL;
7242 int wmaxl=maxl;
7243 maxl--;
7244 unsigned save_opt=si_opt_1;
7246 if ((maxl==-1) && (iiOp!=MRES_CMD))
7247 maxl = currRing->N-1;
7248 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7249 {
7250 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7251 if (iv!=NULL)
7252 {
7253 l=1;
7254 if (!idTestHomModule(u_id,currRing->qideal,iv))
7255 {
7256 WarnS("wrong weights");
7257 iv=NULL;
7258 }
7259 else
7260 {
7261 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7262 weights[0] = ivCopy(iv);
7263 }
7264 }
7265 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7266 }
7267 else
7268 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7269 if (r==NULL) return TRUE;
7270 int t3=u->Typ();
7271 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7272 si_opt_1=save_opt;
7273 return FALSE;
7274}
void iiMakeResolv(resolvente r, int length, int rlen, char *name, int typ0, intvec **weights)
Definition ipshell.cc:854
EXTERN_VAR omBin char_ptr_bin
Definition structs.h:73
resolvente syResolvente(ideal arg, int maxlength, int *length, intvec ***weights, BOOLEAN minim)
Definition syz.cc:403
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition syz0.cc:855

◆ jjRESERVED0()

BOOLEAN jjRESERVED0 ( leftv ,
leftv  )
static

Definition at line 8504 of file iparith.cc.

8505{
8506 unsigned i=1;
8507 unsigned nCount = (sArithBase.nCmdUsed-1)/3;
8508 if((3*nCount)<sArithBase.nCmdUsed) nCount++;
8509 //Print("CMDS: %d/%d\n", sArithBase.nCmdUsed,
8510 // sArithBase.nCmdAllocated);
8511 for(i=0; i<nCount; i++)
8512 {
8513 Print("%-20s",sArithBase.sCmds[i+1].name);
8514 if(i+1+nCount<sArithBase.nCmdUsed)
8515 Print("%-20s",sArithBase.sCmds[i+1+nCount].name);
8516 if(i+1+2*nCount<sArithBase.nCmdUsed)
8517 Print("%-20s",sArithBase.sCmds[i+1+2*nCount].name);
8518 //if ((i%3)==1) PrintLn();
8519 PrintLn();
8520 }
8521 PrintLn();
8523 return FALSE;
8524}
void printBlackboxTypes()
list all defined type (for debugging)
Definition blackbox.cc:236

◆ jjRESERVEDLIST0()

BOOLEAN jjRESERVEDLIST0 ( leftv res,
leftv  )
static

Definition at line 8526 of file iparith.cc.

8527{
8528 int l = 0;
8529 int k = 0;
8531 struct blackbox_list *bb_list = NULL;
8532 unsigned nCount = (sArithBase.nCmdUsed-1) / 3;
8533
8534 if ((3*nCount) < sArithBase.nCmdUsed)
8535 {
8536 nCount++;
8537 }
8538 bb_list = getBlackboxTypes();
8539 // count the number of entries;
8540 for (unsigned i=0; i<nCount; i++)
8541 {
8542 l++;
8543 if (i + 1 + nCount < sArithBase.nCmdUsed)
8544 {
8545 l++;
8546 }
8547 if(i+1+2*nCount<sArithBase.nCmdUsed)
8548 {
8549 l++;
8550 }
8551 }
8552 for (int i = 0; i < bb_list->count; i++)
8553 {
8554 if (bb_list->list[i] != NULL)
8555 {
8556 l++;
8557 }
8558 }
8559 // initiate list
8560 L->Init(l);
8561 k = 0;
8562 for (unsigned i=0; i<nCount; i++)
8563 {
8564 L->m[k].rtyp = STRING_CMD;
8565 L->m[k].data = omStrDup(sArithBase.sCmds[i+1].name);
8566 k++;
8567 // Print("%-20s", sArithBase.sCmds[i+1].name);
8568 if (i + 1 + nCount < sArithBase.nCmdUsed)
8569 {
8570 L->m[k].rtyp = STRING_CMD;
8571 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+nCount].name);
8572 k++;
8573 // Print("%-20s", sArithBase.sCmds[i+1 + nCount].name);
8574 }
8575 if(i+1+2*nCount<sArithBase.nCmdUsed)
8576 {
8577 L->m[k].rtyp = STRING_CMD;
8578 L->m[k].data = omStrDup(sArithBase.sCmds[i+1+2*nCount].name);
8579 k++;
8580 // Print("%-20s", sArithBase.sCmds[i+1+2*nCount].name);
8581 }
8582 // PrintLn();
8583 }
8584
8585 // assign blackbox types
8586 for (int i = 0; i < bb_list->count; i++)
8587 {
8588 if (bb_list->list[i] != NULL)
8589 {
8590 L->m[k].rtyp = STRING_CMD;
8591 // already used strdup in getBlackBoxTypes
8592 L->m[k].data = bb_list->list[i];
8593 k++;
8594 }
8595 }
8596 // free the struct (not the list entries itself, which were allocated
8597 // by strdup)
8598 omfree(bb_list->list);
8599 omfree(bb_list);
8600
8601 // pass the resultant list to the res datastructure
8602 res->data=(void *)L;
8603
8604 return FALSE;
8605}
struct blackbox_list * getBlackboxTypes()
return array of all define types.
Definition blackbox.cc:245
void ** list
Definition blackbox.h:86
struct for containing list of blackbox names and the number of them.
Definition blackbox.h:84
#define omfree(addr)

◆ jjRESERVEDNAME()

BOOLEAN jjRESERVEDNAME ( leftv res,
leftv v )
static

Definition at line 4944 of file iparith.cc.

4945{
4946 char *s= (char *)v->Data();
4947 // try system keywords
4948 for(unsigned i=0; i<sArithBase.nCmdUsed; i++)
4949 {
4950 //Print("test %d, >>%s<<, tab:>>%s<<\n",i,s,sArithBase.sCmds[i].name);
4951 if (strcmp(s, sArithBase.sCmds[i].name) == 0)
4952 {
4953 res->data = (char *)1;
4954 return FALSE;
4955 }
4956 }
4957 // try blackbox names
4958 int id;
4959 blackboxIsCmd(s,id);
4960 if (id>0)
4961 {
4962 res->data = (char *)1;
4963 }
4964 return FALSE;
4965}

◆ jjRESTART()

BOOLEAN jjRESTART ( leftv ,
leftv u )
static

Definition at line 8979 of file iparith.cc.

8980{
8981 int c=(int)(long)u->Data();
8982 switch(c)
8983 {
8984 case 0:{
8985 PrintS("delete all variables\n");
8986 killlocals(0);
8987 WerrorS("restarting...");
8988 break;
8989 };
8990 default: WerrorS("not implemented");
8991 }
8992 return FALSE;
8993}
void killlocals(int v)
Definition ipshell.cc:387

◆ jjRIGHTSTD()

BOOLEAN jjRIGHTSTD ( leftv res,
leftv v )
static

Definition at line 5365 of file iparith.cc.

5366{
5367#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5368 if (rIsLPRing(currRing))
5369 {
5371 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5372 ideal result;
5373 ideal v_id=(ideal)v->Data();
5374 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5375 /* tHomog hom=testHomog; */
5376 /* if (w!=NULL) */
5377 /* { */
5378 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5379 /* { */
5380 /* WarnS("wrong weights"); */
5381 /* w=NULL; */
5382 /* } */
5383 /* else */
5384 /* { */
5385 /* hom=isHomog; */
5386 /* w=ivCopy(w); */
5387 /* } */
5388 /* } */
5389 /* result=kStd2(v_id,currRing->qideal,hom,&w); */
5390 result = rightgb(v_id, currRing->qideal);
5391 if (errorreported) return TRUE;
5393 res->data = (char *)result;
5395 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5396 return FALSE;
5397 }
5398 else if (rIsPluralRing(currRing))
5399 {
5400 ideal I=(ideal)v->Data();
5401
5402 ring A = currRing;
5403 ring Aopp = rOpposite(A);
5404 currRing = Aopp;
5405 ideal Iopp = idOppose(A, I, Aopp);
5406 ideal Jopp = kStd2(Iopp,currRing->qideal,testHomog,NULL,(bigintmat*)NULL);
5407 if (errorreported) return TRUE;
5408 currRing = A;
5409 ideal J = idOppose(Aopp, Jopp, A);
5410
5411 id_Delete(&Iopp, Aopp);
5412 id_Delete(&Jopp, Aopp);
5413 rDelete(Aopp);
5414
5415 idSkipZeroes(J);
5416 res->data = (char *)J;
5418 return FALSE;
5419 }
5420 else
5421 {
5422 return jjSTD(res, v);
5423 }
5424#else
5425 return TRUE;
5426#endif
5427}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition iparith.cc:5165
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
ideal rightgb(ideal F, const ideal Q)
Definition kstd2.cc:4935
#define TEST_OPT_DEGBOUND
Definition options.h:115
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:526

◆ jjRING3()

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

Definition at line 7276 of file iparith.cc.

7277{
7278 res->data=(void *)rInit(u,v,w);
7279 return (res->data==NULL);
7280}
ring rInit(leftv pn, leftv rv, leftv ord)
Definition ipshell.cc:5628

◆ jjRING_1()

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

Definition at line 1673 of file iparith.cc.

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

◆ jjRING_2()

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

Definition at line 6085 of file iparith.cc.

6086{
6087 u->next=(leftv)omAlloc(sizeof(sleftv));
6088 memcpy(u->next,v,sizeof(sleftv));
6089 v->Init();
6090 u->next->next=(leftv)omAlloc(sizeof(sleftv));
6091 memcpy(u->next->next,w,sizeof(sleftv));
6092 w->Init();
6093 BOOLEAN bo=iiExprArithM(res,u,'[');
6094 u->next=NULL;
6095 return bo;
6096}

◆ jjRING_LIST()

BOOLEAN jjRING_LIST ( leftv res,
leftv v )
static

Definition at line 5009 of file iparith.cc.

5010{
5011 ring r=(ring)v->Data();
5012 if (r!=NULL)
5013 res->data = (char *)rDecompose_list_cf((ring)v->Data());
5014 return (r==NULL)||(res->data==NULL);
5015}
lists rDecompose_list_cf(const ring r)
Definition ipshell.cc:2114

◆ jjRING_PL()

BOOLEAN jjRING_PL ( leftv res,
leftv a )
static

Definition at line 8950 of file iparith.cc.

8951{
8952 //Print("construct ring\n");
8953 if (a->Typ()!=CRING_CMD)
8954 {
8955 WerrorS("expected `cring` [ `id` ... ]");
8956 return TRUE;
8957 }
8958 assume(a->next!=NULL);
8959 leftv names=a->next;
8960 int N=names->listLength();
8961 char **n=(char**)omAlloc0(N*sizeof(char*));
8962 for(int i=0; i<N;i++,names=names->next)
8963 {
8964 n[i]=(char *)names->Name();
8965 }
8966 coeffs cf=(coeffs)a->CopyD();
8967 res->data=rDefault(cf,N,n, ringorder_dp);
8968 omFreeSize(n,N*sizeof(char*));
8969 return FALSE;
8970}
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition ring.cc:103
@ ringorder_dp
Definition ring.h:79
@ CRING_CMD
Definition tok.h:56

◆ jjRINGLIST()

BOOLEAN jjRINGLIST ( leftv res,
leftv v )
static

Definition at line 4987 of file iparith.cc.

4988{
4989 ring r=(ring)v->Data();
4990 if (r!=NULL)
4991 {
4992 res->data = (char *)rDecompose((ring)v->Data());
4993 if (res->data!=NULL)
4994 {
4995 long mm=r->wanted_maxExp;
4996 if (mm!=0) atSet(res,omStrDup("maxExp"),(void*)mm,INT_CMD);
4997 return FALSE;
4998 }
4999 }
5000 return TRUE;
5001}
lists rDecompose(const ring r)
Definition ipshell.cc:2153

◆ jjRINGLIST_C()

BOOLEAN jjRINGLIST_C ( leftv res,
leftv v )
static

Definition at line 5002 of file iparith.cc.

5003{
5004 coeffs r=(coeffs)v->Data();
5005 if (r!=NULL)
5006 return rDecompose_CF(res,r);
5007 return TRUE;
5008}
BOOLEAN rDecompose_CF(leftv res, const coeffs C)
Definition ipshell.cc:1943

◆ jjRMINUS()

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

Definition at line 3324 of file iparith.cc.

3325{
3326 ring r=rMinusVar((ring)u->Data(),(char*)v->Data());
3327 res->data = (char *)r;
3328 return r==NULL;
3329}
ring rMinusVar(const ring r, char *v)
undo rPlusVar
Definition ring.cc:6024

◆ jjrOrdStr()

BOOLEAN jjrOrdStr ( leftv res,
leftv v )
static

Definition at line 5753 of file iparith.cc.

5754{
5755 res->data = rOrdStr((ring)v->Data());
5756 return FALSE;
5757}
char * rOrdStr(ring r)
Definition ring.cc:526

◆ jjROWS()

BOOLEAN jjROWS ( leftv res,
leftv v )
static

Definition at line 5016 of file iparith.cc.

5017{
5018 ideal i = (ideal)v->Data();
5019 res->data = (char *)i->rank;
5020 return FALSE;
5021}

◆ jjROWS_BIM()

BOOLEAN jjROWS_BIM ( leftv res,
leftv v )
static

Definition at line 5022 of file iparith.cc.

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

◆ jjROWS_IV()

BOOLEAN jjROWS_IV ( leftv res,
leftv v )
static

Definition at line 5027 of file iparith.cc.

5028{
5029 res->data = (char *)(long)((intvec*)(v->Data()))->rows();
5030 return FALSE;
5031}

◆ jjRPAR()

BOOLEAN jjRPAR ( leftv res,
leftv v )
static

Definition at line 5032 of file iparith.cc.

5033{
5034 res->data = (char *)(long)rPar(((ring)v->Data()));
5035 return FALSE;
5036}

◆ jjrParStr()

BOOLEAN jjrParStr ( leftv res,
leftv v )
static

Definition at line 5763 of file iparith.cc.

5764{
5765 res->data = rParStr((ring)v->Data());
5766 return FALSE;
5767}
char * rParStr(ring r)
Definition ring.cc:654

◆ jjRPLUS()

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

Definition at line 3330 of file iparith.cc.

3331{
3332 int left;
3333 if (u->Typ()==RING_CMD) left=0;
3334 else
3335 {
3336 leftv h=u;u=v;v=h;
3337 left=1;
3338 }
3339 ring r=rPlusVar((ring)u->Data(),(char*)v->Data(),left);
3340 res->data = (char *)r;
3341 return r==NULL;
3342}
ring rPlusVar(const ring r, char *v, int left)
K[x],"y" -> K[x,y] resp. K[y,x].
Definition ring.cc:5942

◆ jjRSUM()

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

Definition at line 3343 of file iparith.cc.

3344{
3345 ring r;
3346 int i=rSum((ring)u->Data(),(ring)v->Data(),r);
3347 res->data = (char *)r;
3348 return (i==-1);
3349}
int rSum(ring r1, ring r2, ring &sum)
Definition ring.cc:1408

◆ jjrVarStr()

BOOLEAN jjrVarStr ( leftv res,
leftv v )
static

Definition at line 5758 of file iparith.cc.

5759{
5760 res->data = rVarStr((ring)v->Data());
5761 return FALSE;
5762}
char * rVarStr(ring r)
Definition ring.cc:628

◆ jjS2I()

BOOLEAN jjS2I ( leftv res,
leftv v )
static

Definition at line 5037 of file iparith.cc.

5038{
5039 res->data = (char *)(long)atoi((char*)v->Data());
5040 return FALSE;
5041}

◆ jjSBA()

BOOLEAN jjSBA ( leftv res,
leftv v )
static

Definition at line 5084 of file iparith.cc.

5085{
5086 ideal result;
5087 ideal v_id=(ideal)v->Data();
5088 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5089 tHomog hom=testHomog;
5090 if (w!=NULL)
5091 {
5092 if (!idTestHomModule(v_id,currRing->qideal,w))
5093 {
5094 WarnS("wrong weights");
5095 w=NULL;
5096 }
5097 else
5098 {
5099 hom=isHomog;
5100 w=ivCopy(w);
5101 }
5102 }
5103 result=kSba(v_id,currRing->qideal,hom,&w,1,0,NULL);
5104 if (errorreported) return TRUE;
5106 res->data = (char *)result;
5108 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5109 return FALSE;
5110}
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw)
Definition kstd1.cc:2669

◆ jjSBA_1()

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

Definition at line 5111 of file iparith.cc.

5112{
5113 ideal result;
5114 ideal v_id=(ideal)v->Data();
5115 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5116 tHomog hom=testHomog;
5117 if (w!=NULL)
5118 {
5119 if (!idTestHomModule(v_id,currRing->qideal,w))
5120 {
5121 WarnS("wrong weights");
5122 w=NULL;
5123 }
5124 else
5125 {
5126 hom=isHomog;
5127 w=ivCopy(w);
5128 }
5129 }
5130 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),0,NULL);
5131 if (errorreported) return TRUE;
5133 res->data = (char *)result;
5135 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5136 return FALSE;
5137}

◆ jjSBA_2()

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

Definition at line 5138 of file iparith.cc.

5139{
5140 ideal result;
5141 ideal v_id=(ideal)v->Data();
5142 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5143 tHomog hom=testHomog;
5144 if (w!=NULL)
5145 {
5146 if (!idTestHomModule(v_id,currRing->qideal,w))
5147 {
5148 WarnS("wrong weights");
5149 w=NULL;
5150 }
5151 else
5152 {
5153 hom=isHomog;
5154 w=ivCopy(w);
5155 }
5156 }
5157 result=kSba(v_id,currRing->qideal,hom,&w,(int)(long)u->Data(),(int)(long)t->Data(),NULL);
5158 if (errorreported) return TRUE;
5160 res->data = (char *)result;
5162 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5163 return FALSE;
5164}

◆ jjSetRing()

BOOLEAN jjSetRing ( leftv ,
leftv u )
static

Definition at line 3855 of file iparith.cc.

3856{
3857 if (u->rtyp==IDHDL) rSetHdl((idhdl)u->data);
3858 else
3859 {
3860 ring r=(ring)u->Data();
3861 idhdl h=rFindHdl(r,NULL);
3862 if (h==NULL)
3863 {
3864 char name_buffer[100];
3865 STATIC_VAR int ending=1000000;
3866 ending++;
3867 snprintf(name_buffer,100, "PYTHON_RING_VAR%d",ending);
3868 h=enterid(name_buffer,0,RING_CMD,&IDROOT);
3869 IDRING(h)=rIncRefCnt(r);
3870 }
3871 rSetHdl(h);
3872 }
3873 return FALSE;
3874}
#define STATIC_VAR
Definition globaldefs.h:7
idhdl rFindHdl(ring r, idhdl n)
Definition ipshell.cc:1701
void rSetHdl(idhdl h)
Definition ipshell.cc:5129

◆ jjSIMPL_ID()

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

Definition at line 3357 of file iparith.cc.

3358{
3359 int sw = (int)(long)v->Data();
3360 // CopyD for IDEAL_CMD and MODUL_CMD are identical:
3361 ideal id = (ideal)u->CopyD(IDEAL_CMD);
3362 if (sw & SIMPL_LMDIV)
3363 {
3364 id_DelDiv(id,currRing);
3365 }
3366 if (sw & SIMPL_LMEQ)
3367 {
3369 }
3370 if (sw & SIMPL_MULT)
3371 {
3373 }
3374 else if(sw & SIMPL_EQU)
3375 {
3377 }
3378 if (sw & SIMPL_NULL)
3379 {
3380 idSkipZeroes(id);
3381 }
3382 if (sw & SIMPL_NORM)
3383 {
3384 id_Norm(id,currRing);
3385 }
3386 if (sw & SIMPL_NORMALIZE)
3387 {
3389 }
3390 res->data = (char * )id;
3391 return FALSE;
3392}
#define SIMPL_EQU
Definition iparith.cc:3354
#define SIMPL_NORM
Definition iparith.cc:3356
#define SIMPL_LMEQ
Definition iparith.cc:3352
#define SIMPL_NULL
Definition iparith.cc:3355
#define SIMPL_MULT
Definition iparith.cc:3353
#define SIMPL_NORMALIZE
Definition iparith.cc:3350
#define SIMPL_LMDIV
Definition iparith.cc:3351
void id_Norm(ideal id, const ring r)
ideal id = (id[i]), result is leadcoeff(id[i]) = 1
void id_Normalize(ideal I, const ring r)
normialize all polys in id
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i
void id_DelEquals(ideal id, const ring r)
ideal id = (id[i]) if id[i] = id[j] then id[j] is deleted for j > i
void id_DelLmEquals(ideal id, const ring r)
Delete id[j], if Lm(j) == Lm(i) and both LC(j), LC(i) are units and j > i.

◆ jjSIMPL_P()

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

Definition at line 3452 of file iparith.cc.

3453{
3454 int sw = (int)(long)v->Data();
3455 // CopyD for POLY_CMD and VECTOR_CMD are identical:
3456 poly p = (poly)u->CopyD(POLY_CMD);
3457 if (sw & SIMPL_NORM)
3458 {
3459 pNorm(p);
3460 }
3461 if (sw & SIMPL_NORMALIZE)
3462 {
3464 }
3465 res->data = (char * )p;
3466 return FALSE;
3467}
void p_Normalize(poly p, const ring r)
Definition p_polys.cc:3952
void pNorm(poly p)
Definition polys.h:363

◆ jjSLIM_GB()

BOOLEAN jjSLIM_GB ( leftv res,
leftv u )
static

Definition at line 5042 of file iparith.cc.

5043{
5044 const bool bIsSCA = rIsSCA(currRing);
5045
5046 if ((currRing->qideal!=NULL) && !bIsSCA)
5047 {
5048 WerrorS("qring not supported by slimgb at the moment");
5049 return TRUE;
5050 }
5052 {
5053 WerrorS("ordering must be global for slimgb");
5054 return TRUE;
5055 }
5057 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5058 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
5059 // tHomog hom=testHomog;
5060 ideal u_id=(ideal)u->Data();
5061 if (w!=NULL)
5062 {
5063 if (!idTestHomModule(u_id,currRing->qideal,w))
5064 {
5065 WarnS("wrong weights");
5066 w=NULL;
5067 }
5068 else
5069 {
5070 w=ivCopy(w);
5071 // hom=isHomog;
5072 }
5073 }
5074
5075 assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
5076 res->data=(char *)t_rep_gb(currRing,
5077 u_id,u_id->rank);
5078 //res->data=(char *)t_rep_gb(currRing, u_id);
5079
5081 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5082 return FALSE;
5083}
static bool rIsSCA(const ring r)
Definition nc.h:190
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition tgb.cc:3581

◆ jjSMATRIX_Mo()

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

Definition at line 7116 of file iparith.cc.

7117{
7118 int mi=(int)(long)v->Data();
7119 int ni=(int)(long)w->Data();
7120 if ((mi<0)||(ni<1))
7121 {
7122 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
7123 return TRUE;
7124 }
7125 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
7126 mi,ni,currRing);
7127 return FALSE;
7128}
ideal id_ResizeModule(ideal mod, int rows, int cols, const ring R)

◆ jjSort_Id()

BOOLEAN jjSort_Id ( leftv res,
leftv v )
static

Definition at line 5194 of file iparith.cc.

5195{
5196 res->data = (char *)idSort((ideal)v->Data());
5197 return FALSE;
5198}
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv ,
leftv arg )

Definition at line 10490 of file iparith.cc.

10491{
10492 lists l=(lists)arg->Data();
10493 if (l->nr>0)
10494 {
10495 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10496 }
10497 return FALSE;
10498}
static int jjCOMPARE_ALL(const void *aa, const void *bb)
Definition iparith.cc:10449

◆ jjSQR_FREE()

BOOLEAN jjSQR_FREE ( leftv res,
leftv u )
static

Definition at line 5199 of file iparith.cc.

5200{
5202 intvec *v=NULL;
5203 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5204 if (f==NULL) return TRUE;
5205 ivTest(v);
5207 l->Init(2);
5208 l->m[0].rtyp=IDEAL_CMD;
5209 l->m[0].data=(void *)f;
5210 l->m[1].rtyp=INTVEC_CMD;
5211 l->m[1].data=(void *)v;
5212 res->data=(void *)l;
5213 return FALSE;
5214}
ideal singclap_sqrfree(poly f, intvec **v, int with_exps, const ring r)
Definition clapsing.cc:1377

◆ jjSQR_FREE2()

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

Definition at line 3394 of file iparith.cc.

3395{
3396 intvec *v=NULL;
3397 int sw=(int)(long)dummy->Data();
3398 int fac_sw=sw;
3399 if (sw<0) fac_sw=1;
3401 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, fac_sw, currRing);
3402 if (f==NULL)
3403 return TRUE;
3404 switch(sw)
3405 {
3406 case 0:
3407 case 2:
3408 {
3410 l->Init(2);
3411 l->m[0].rtyp=IDEAL_CMD;
3412 l->m[0].data=(void *)f;
3413 l->m[1].rtyp=INTVEC_CMD;
3414 l->m[1].data=(void *)v;
3415 res->data=(void *)l;
3416 res->rtyp=LIST_CMD;
3417 return FALSE;
3418 }
3419 case 1:
3420 res->data=(void *)f;
3421 return FALSE;
3422 case 3:
3423 {
3424 poly p=f->m[0];
3425 int i=IDELEMS(f);
3426 f->m[0]=NULL;
3427 while(i>1)
3428 {
3429 i--;
3430 p=pMult(p,f->m[i]);
3431 f->m[i]=NULL;
3432 }
3433 res->data=(void *)p;
3434 res->rtyp=POLY_CMD;
3435 }
3436 return FALSE;
3437 }
3438 WerrorS("invalid switch");
3439 return FALSE;
3440}

◆ jjSTATUS2()

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

Definition at line 3441 of file iparith.cc.

3442{
3443 res->data = omStrDup(slStatus((si_link) u->Data(), (char *) v->Data()));
3444 return FALSE;
3445}

◆ jjSTATUS2L()

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

Definition at line 3446 of file iparith.cc.

3447{
3448 res->data = (void *)(long)slStatusSsiL((lists) u->Data(), (int)(long) v->Data());
3449 //return (res->data== (void*)(long)-2);
3450 return FALSE;
3451}

◆ jjSTATUS3()

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

Definition at line 7281 of file iparith.cc.

7282{
7283 int yes;
7284 jjSTATUS2(res, u, v);
7285 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7286 omFreeBinAddr((ADDRESS) res->data);
7287 res->data = (void *)(long)yes;
7288 return FALSE;
7289}
static BOOLEAN jjSTATUS2(leftv res, leftv u, leftv v)
Definition iparith.cc:3441

◆ jjSTATUS_M()

BOOLEAN jjSTATUS_M ( leftv res,
leftv v )
static

Definition at line 8791 of file iparith.cc.

8792{
8793 if ((v->Typ() != LINK_CMD) ||
8794 (v->next->Typ() != STRING_CMD) ||
8795 (v->next->next->Typ() != STRING_CMD) ||
8796 (v->next->next->next->Typ() != INT_CMD))
8797 return TRUE;
8798 jjSTATUS3(res, v, v->next, v->next->next);
8799#if defined(HAVE_USLEEP)
8800 if (((long) res->data) == 0L)
8801 {
8802 int i_s = (int)(long) v->next->next->next->Data();
8803 if (i_s > 0)
8804 {
8805 usleep((int)(long) v->next->next->next->Data());
8806 jjSTATUS3(res, v, v->next, v->next->next);
8807 }
8808 }
8809#elif defined(HAVE_SLEEP)
8810 if (((int) res->data) == 0)
8811 {
8812 int i_s = (int) v->next->next->next->Data();
8813 if (i_s > 0)
8814 {
8815 si_sleep((is - 1)/1000000 + 1);
8816 jjSTATUS3(res, v, v->next, v->next->next);
8817 }
8818 }
8819#endif
8820 return FALSE;
8821}
static BOOLEAN jjSTATUS3(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:7281
@ LINK_CMD
Definition tok.h:117

◆ jjSTD()

BOOLEAN jjSTD ( leftv res,
leftv v )
static

Definition at line 5165 of file iparith.cc.

5166{
5168 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5169 ideal result;
5170 ideal v_id=(ideal)v->Data();
5171 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5172 tHomog hom=testHomog;
5173 if (w!=NULL)
5174 {
5175 if (!idTestHomModule(v_id,currRing->qideal,w))
5176 {
5177 WarnS("wrong weights");
5178 w=NULL;
5179 }
5180 else
5181 {
5182 hom=isHomog;
5183 w=ivCopy(w);
5184 }
5185 }
5186 result=kStd2(v_id,currRing->qideal,hom,&w,(bigintmat*)NULL);
5187 if (errorreported) return TRUE;
5189 res->data = (char *)result;
5191 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5192 return FALSE;
5193}

◆ jjSTD_1()

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

Definition at line 3496 of file iparith.cc.

3497{
3498 ideal result;
3499 assumeStdFlag(u);
3500 ideal i1=(ideal)(u->Data());
3501 int ii1=idElem(i1); /* size of i1 */
3502 ideal i0;
3503 int r=v->Typ();
3504 BITSET save1;
3505 SI_SAVE_OPT1(save1);
3506 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3507 tHomog hom=testHomog;
3508 if ((/*v->Typ()*/r==POLY_CMD) ||(r==VECTOR_CMD))
3509 {
3510 poly p=(poly)v->Data();
3511 i0=idInit(1,i1->rank);
3512 i0->m[0]=p;
3513 i1=idSimpleAdd(i1,i0); //
3514 i0->m[0]=NULL;
3515 idDelete(&i0);
3516
3517 if (w!=NULL)
3518 {
3519 if (!idTestHomModule(i1,currRing->qideal,w))
3520 {
3521 // no warnung: this is legal, if i in std(i,p)
3522 // is homogeneous, but p not
3523 w=NULL;
3524 }
3525 else
3526 {
3527 w=ivCopy(w);
3528 hom=isHomog;
3529 }
3530 }
3532 /* ii1 appears to be the position of the first element of il that
3533 does not belong to the old SB ideal */
3534 result=kStd2(i1,currRing->qideal,hom,&w,(bigintmat*)NULL,0,ii1);
3535 }
3536 else /*IDEAL/MODULE*/
3537 {
3538 i0=(ideal)v->CopyD();
3539 i1=idSimpleAdd(i1,i0); //
3540 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
3541 idDelete(&i0);
3542
3543 if (w!=NULL)
3544 {
3545 if (!idTestHomModule(i1,currRing->qideal,w))
3546 {
3547 // no warnung: this is legal, if i in std(i,p)
3548 // is homogeneous, but p not
3549 w=NULL;
3550 hom=isNotHomog;
3551 }
3552 else
3553 {
3554 w=ivCopy(w);
3555 hom=isHomog;
3556 }
3557 }
3559 /* ii1 appears to be the position of the first element of i1 that
3560 does not belong to the old SB ideal */
3561 result=kStd2(i1,currRing->qideal,hom,&w,(bigintmat*)NULL,0,ii1);
3562 }
3563 SI_RESTORE_OPT1(save1);
3564 idDelete(&i1);
3565 if (errorreported) return TRUE;
3567 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3568 res->data = (char *)result;
3570 return FALSE;
3571}
#define OPT_SB_1
Definition options.h:96
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
@ isNotHomog
Definition structs.h:32

◆ jjSTD_HILB()

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

Definition at line 3468 of file iparith.cc.

3469{
3470 ideal result;
3471 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3472 tHomog hom=testHomog;
3473 ideal u_id=(ideal)(u->Data());
3474 if (w!=NULL)
3475 {
3476 if (!idTestHomModule(u_id,currRing->qideal,w))
3477 {
3478 WarnS("wrong weights:");w->show();PrintLn();
3479 w=NULL;
3480 }
3481 else
3482 {
3483 w=ivCopy(w);
3484 hom=isHomog;
3485 }
3486 }
3487 bigintmat *vv=(bigintmat*)v->Data();
3488 result=kStd2(u_id,currRing->qideal,hom,&w,vv);
3489 if (errorreported) return TRUE;
3491 res->data = (char *)result;
3493 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
3494 return FALSE;
3495}

◆ jjSTD_HILB_W()

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

Definition at line 7290 of file iparith.cc.

7291{
7292 intvec *vw=(intvec *)w->Data(); // weights of vars
7293 if (vw->length()!=currRing->N)
7294 {
7295 Werror("%d weights for %d variables",vw->length(),currRing->N);
7296 return TRUE;
7297 }
7298 ideal result;
7299 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
7300 tHomog hom=testHomog;
7301 ideal u_id=(ideal)(u->Data());
7302 if (ww!=NULL)
7303 {
7304 if (!idTestHomModule(u_id,currRing->qideal,ww))
7305 {
7306 WarnS("wrong weights");
7307 ww=NULL;
7308 }
7309 else
7310 {
7311 ww=ivCopy(ww);
7312 hom=isHomog;
7313 }
7314 }
7315 bigintmat *vv=(bigintmat*)v->Data();
7316 result=kStd2(u_id,
7317 currRing->qideal,
7318 hom,
7319 &ww, // module weights
7320 vv, // hilbert series
7321 0,0, // syzComp, newIdeal
7322 vw); // weights of vars
7323 if (errorreported) return TRUE;
7325 res->data = (char *)result;
7327 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
7328 return FALSE;
7329}

◆ jjSTD_HILB_WP()

BOOLEAN jjSTD_HILB_WP ( leftv res,
leftv INPUT )
static

Definition at line 8866 of file iparith.cc.

8867{ ideal result;
8868 leftv u = INPUT; /* an ideal, weighted homogeneous and standard */
8869 leftv v = u->next; /* one additional polynomial or ideal */
8870 leftv h = v->next; /* Hilbert vector */
8871 leftv w = h->next; /* weight vector */
8872 assumeStdFlag(u);
8873 ideal i1=(ideal)(u->Data());
8874 ideal i0;
8875 if (((u->Typ()!=IDEAL_CMD)&&(u->Typ()!=MODUL_CMD))
8876 || (h->Typ()!=BIGINTVEC_CMD)
8877 || (w->Typ()!=INTVEC_CMD))
8878 {
8879 WerrorS("expected `std(`ideal/module`,`poly/vector`,`bigintvec`,`intvec`)");
8880 return TRUE;
8881 }
8882 intvec *vw=(intvec *)w->Data(); // weights of vars
8883 /* merging std_hilb_w and std_1 */
8884 if (vw->length()!=currRing->N)
8885 {
8886 Werror("%d weights for %d variables",vw->length(),currRing->N);
8887 return TRUE;
8888 }
8889 int r=v->Typ();
8890 BOOLEAN cleanup_i0=FALSE;
8891 if ((r==POLY_CMD) ||(r==VECTOR_CMD))
8892 {
8893 i0=idInit(1,i1->rank);
8894 i0->m[0]=(poly)v->Data();
8895 cleanup_i0=TRUE;
8896 }
8897 else if (r==IDEAL_CMD)/* IDEAL */
8898 {
8899 i0=(ideal)v->Data();
8900 }
8901 else
8902 {
8903 WerrorS("expected `std(`ideal/module`,`poly/vector`,`intvec`,`intvec`)");
8904 return TRUE;
8905 }
8906 int ii0=idElem(i0);
8907 i1 = idSimpleAdd(i1,i0);
8908 if (cleanup_i0)
8909 {
8910 memset(i0->m,0,sizeof(poly)*IDELEMS(i0));
8911 idDelete(&i0);
8912 }
8913 intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
8914 tHomog hom=testHomog;
8915 /* u_id from jjSTD_W is now i1 as in jjSTD_1 */
8916 if (ww!=NULL)
8917 {
8918 if (!idTestHomModule(i1,currRing->qideal,ww))
8919 {
8920 WarnS("wrong weights");
8921 ww=NULL;
8922 }
8923 else
8924 {
8925 ww=ivCopy(ww);
8926 hom=isHomog;
8927 }
8928 }
8929 BITSET save1;
8930 SI_SAVE_OPT1(save1);
8932 result=kStd2(i1,
8933 currRing->qideal,
8934 hom,
8935 &ww, // module weights
8936 (bigintmat *)h->Data(), // hilbert series
8937 0, // syzComp, whatever it is...
8938 IDELEMS(i1)-ii0, // new ideal
8939 vw); // weights of vars
8940 SI_RESTORE_OPT1(save1);
8941 if (errorreported) return TRUE;
8942 idDelete(&i1);
8944 res->data = (char *)result;
8946 if (ww!=NULL) atSet(res,omStrDup("isHomog"),ww,INTVEC_CMD);
8947 return FALSE;
8948}

◆ jjSTRING_PL()

BOOLEAN jjSTRING_PL ( leftv res,
leftv v )
static

Definition at line 8606 of file iparith.cc.

8607{
8608 if (v == NULL)
8609 {
8610 res->data = omStrDup("");
8611 return FALSE;
8612 }
8613 int n = v->listLength();
8614 if (n == 1)
8615 {
8616 res->data = v->String();
8617 return FALSE;
8618 }
8619
8620 char** slist = (char**) omAlloc(n*sizeof(char*));
8621 int i, j;
8622
8623 for (i=0, j=0; i<n; i++, v = v ->next)
8624 {
8625 slist[i] = v->String();
8626 assume(slist[i] != NULL);
8627 j+=strlen(slist[i]);
8628 }
8629 char* s = (char*) omAlloc((j+1)*sizeof(char));
8630 *s='\0';
8631 for (i=0;i<n;i++)
8632 {
8633 strcat(s, slist[i]);
8634 omFree(slist[i]);
8635 }
8636 omFreeSize(slist, n*sizeof(char*));
8637 res->data = s;
8638 return FALSE;
8639}

◆ jjstrlen()

BOOLEAN jjstrlen ( leftv res,
leftv v )
static

Definition at line 5685 of file iparith.cc.

5686{
5687 res->data = (char *)strlen((char *)v->Data());
5688 return FALSE;
5689}

◆ jjSUBST_Bu()

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

Definition at line 6838 of file iparith.cc.

6839{
6840 // generic conversion from polyBucket to poly:
6841 // force this to be the first try everytime
6842 poly p; int l;
6843 sBucket_pt bu=(sBucket_pt)w->CopyD();
6844 sBucketDestroyAdd(bu,&p,&l);
6845 sleftv tmpw;
6846 tmpw.Init();
6847 tmpw.rtyp=POLY_CMD;
6848 tmpw.data=p;
6849 return iiExprArith3(res, iiOp, u, v, &tmpw);
6850}

◆ jjSUBST_Id()

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

Definition at line 6884 of file iparith.cc.

6885{
6886 int ringvar;
6887 poly monomexpr;
6888 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6889 if (nok) return TRUE;
6890 ideal id=(ideal)u->Data();
6891 if (ringvar>0)
6892 {
6893 BOOLEAN overflow=FALSE;
6894 if (!rIsLPRing(currRing) && (monomexpr!=NULL))
6895 {
6896 long deg_monexp=pTotaldegree(monomexpr);
6897 for(int i=IDELEMS(id)-1;i>=0;i--)
6898 {
6899 poly p=id->m[i];
6900 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6901 if ((p!=NULL) && (mm!=0) &&
6902 ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)mm/2)))
6903 {
6904 overflow=TRUE;
6905 break;
6906 }
6907 }
6908 }
6909 if (overflow)
6910 Warn("possible OVERFLOW in subst, max exponent is %ld",currRing->bitmask/2);
6911 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6912 {
6913 if (res->rtyp==MATRIX_CMD) id=(ideal)mp_Copy((matrix)id,currRing);
6914 else id=id_Copy(id,currRing);
6915 res->data = id_Subst(id, ringvar, monomexpr, currRing);
6916 }
6917 else
6918 res->data = idSubstPoly(id,ringvar,monomexpr);
6919 }
6920 else
6921 {
6922 if (rIsLPRing(currRing))
6923 {
6924 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6925 return TRUE;
6926 }
6927 res->data = idSubstPar(id,-ringvar,monomexpr);
6928 }
6929 return FALSE;
6930}
ideal id_Copy(ideal h1, const ring r)
copy an ideal
static BOOLEAN jjSUBST_Test(leftv v, leftv w, int &ringvar, poly &monomexpr)
Definition iparith.cc:6810
ideal idSubstPoly(ideal id, int n, poly e)
Definition maps_ip.cc:425
ideal idSubstPar(ideal id, int n, poly e)
Definition maps_ip.cc:386
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
Definition p_polys.cc:5159
ideal id_Subst(ideal id, int n, poly e, const ring r)

◆ jjSUBST_Id_I()

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

Definition at line 6934 of file iparith.cc.

6935{
6936 return jjSUBST_Id_X(res,u,v,w,INT_CMD);
6937}
static BOOLEAN jjSUBST_Id_X(leftv res, leftv u, leftv v, leftv w, int input_type)
Definition iparith.cc:6942

◆ jjSUBST_Id_N()

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

Definition at line 6938 of file iparith.cc.

6939{
6940 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6941}

◆ jjSUBST_Id_X()

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

Definition at line 6942 of file iparith.cc.

6943{
6944 sleftv tmp;
6945 tmp.Init();
6946 // do not check the result, conversion from int/number to poly works always
6947 iiConvert(input_type,POLY_CMD,iiTestConvert(input_type,POLY_CMD),w,&tmp);
6948 BOOLEAN b=jjSUBST_Id(res,u,v,&tmp);
6949 tmp.CleanUp();
6950 return b;
6951}
static BOOLEAN jjSUBST_Id(leftv res, leftv u, leftv v, leftv w)
Definition iparith.cc:6884

◆ jjSUBST_M()

BOOLEAN jjSUBST_M ( leftv res,
leftv u )
static

Definition at line 8822 of file iparith.cc.

8823{
8824 leftv v = u->next; // number of args > 0
8825 if (v==NULL) return TRUE;
8826 leftv w = v->next;
8827 if (w==NULL) return TRUE;
8828 leftv rest = w->next;
8829
8830 u->next = NULL;
8831 v->next = NULL;
8832 w->next = NULL;
8833 BOOLEAN b = iiExprArith3(res, iiOp, u, v, w);
8834 if ((rest!=NULL) && (!b))
8835 {
8836 leftv tmp_next=res->next;
8837 res->next=rest;
8838 sleftv tmp_res;
8839 tmp_res.Init();
8840 b = iiExprArithM(&tmp_res,res,iiOp);
8841 memcpy(res,&tmp_res,sizeof(tmp_res));
8842 res->next=tmp_next;
8843 }
8844 u->next = v;
8845 v->next = w;
8846 // rest was w->next, but is already cleaned
8847 return b;
8848}

◆ jjSUBST_P()

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

Definition at line 6851 of file iparith.cc.

6852{
6853 int ringvar;
6854 poly monomexpr;
6855 BOOLEAN nok=jjSUBST_Test(v,w,ringvar,monomexpr);
6856 if (nok) return TRUE;
6857 poly p=(poly)u->Data();
6858 if (ringvar>0)
6859 {
6860 int mm=p_MaxExpPerVar(p,ringvar,currRing);
6861 if (!rIsLPRing(currRing) &&
6862 (monomexpr!=NULL) && (p!=NULL) && (mm!=0) &&
6863 ((unsigned long)pTotaldegree(monomexpr) > (currRing->bitmask / (unsigned long)mm/2)))
6864 {
6865 Warn("possible OVERFLOW in subst, max exponent is %ld, substituting deg %d by deg %d",currRing->bitmask/2, pTotaldegree(monomexpr), mm);
6866 //return TRUE;
6867 }
6868 if ((monomexpr==NULL)||(pNext(monomexpr)==NULL))
6869 res->data = pSubst((poly)u->CopyD(res->rtyp),ringvar,monomexpr);
6870 else
6871 res->data= pSubstPoly(p,ringvar,monomexpr);
6872 }
6873 else
6874 {
6875 if (rIsLPRing(currRing))
6876 {
6877 WerrorS("Substituting parameters not implemented for Letterplace rings.");
6878 return TRUE;
6879 }
6880 res->data=pSubstPar(p,-ringvar,monomexpr);
6881 }
6882 return FALSE;
6883}
poly pSubstPoly(poly p, int var, poly image)
Definition maps_ip.cc:403
poly pSubstPar(poly p, int par, poly image)
Definition maps_ip.cc:266

◆ jjSUBST_Test()

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

Definition at line 6810 of file iparith.cc.

6812{
6813 monomexpr=(poly)w->Data();
6814 poly p=(poly)v->Data();
6815#if 0
6816 if (pLength(monomexpr)>1)
6817 {
6818 Werror("`%s` substitutes a ringvar only by a term",
6820 return TRUE;
6821 }
6822#endif
6823 if ((ringvar=pVar(p))==0)
6824 {
6825 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6826 {
6827 number n = pGetCoeff(p);
6828 ringvar= -n_IsParam(n, currRing);
6829 }
6830 if(ringvar==0)
6831 {
6832 WerrorS("ringvar/par expected");
6833 return TRUE;
6834 }
6835 }
6836 return FALSE;
6837}
int n_IsParam(const number m, const ring r)
TODO: rewrite somehow...
Definition ring.cc:5921
@ SUBST_CMD
Definition tok.h:188

◆ jjSYZ_2()

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

Definition at line 3572 of file iparith.cc.

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

◆ jjSYZYGY()

BOOLEAN jjSYZYGY ( leftv res,
leftv v )
static

Definition at line 5226 of file iparith.cc.

5227{
5228 ideal v_id=(ideal)v->Data();
5229#ifdef HAVE_SHIFTBBA
5230 if (rIsLPRing(currRing))
5231 {
5232 if (currRing->LPncGenCount < IDELEMS(v_id))
5233 {
5234 Werror("At least %d ncgen variables are needed for this computation.", IDELEMS(v_id));
5235 return TRUE;
5236 }
5237 }
5238#endif
5239 intvec *ww=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5240 intvec *w=NULL;
5241 tHomog hom=testHomog;
5242 if (ww!=NULL)
5243 {
5244 if (idTestHomModule(v_id,currRing->qideal,ww))
5245 {
5246 w=ivCopy(ww);
5247 int add_row_shift=w->min_in();
5248 (*w)-=add_row_shift;
5249 hom=isHomog;
5250 }
5251 else
5252 {
5253 //WarnS("wrong weights");
5254 delete ww; ww=NULL;
5255 hom=testHomog;
5256 }
5257 }
5258 else
5259 {
5260 if (v->Typ()==IDEAL_CMD)
5261 if (idHomIdeal(v_id,currRing->qideal))
5262 hom=isHomog;
5263 }
5264 ideal S=idSyzygies(v_id,hom,&w);
5265 res->data = (char *)S;
5266 if (hom==isHomog)
5267 {
5268 int vl=S->rank;
5269 intvec *vv=new intvec(vl);
5270 if ((v->Typ()==IDEAL_CMD)||(ww==NULL))
5271 {
5272 for(int i=0;i<vl;i++)
5273 {
5274 if (v_id->m[i]!=NULL)
5275 (*vv)[i]=p_Deg(v_id->m[i],currRing);
5276 }
5277 }
5278 else
5279 {
5280 p_SetModDeg(ww, currRing);
5281 for(int i=0;i<vl;i++)
5282 {
5283 if (v_id->m[i]!=NULL)
5284 (*vv)[i]=currRing->pFDeg(v_id->m[i],currRing);
5285 }
5287 }
5288 if (idTestHomModule(S,currRing->qideal,vv))
5289 atSet(res,omStrDup("isHomog"),vv,INTVEC_CMD);
5290 else
5291 delete vv;
5292 }
5293 if (w!=NULL) delete w;
5294 return FALSE;
5295}

◆ jjTENSOR()

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

Definition at line 3644 of file iparith.cc.

3645{
3646 ideal A=(ideal)u->Data();
3647 ideal B=(ideal)v->Data();
3648 res->data = (char *)sm_Tensor(A,B,currRing);
3649 return FALSE;
3650}
ideal sm_Tensor(ideal A, ideal B, const ring r)
Definition matpol.cc:1827

◆ jjTENSOR_Ma()

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

Definition at line 3651 of file iparith.cc.

3652{
3653 sleftv tmp_u,tmp_v,tmp_res;
3657 tmp_res.Init();
3658 tmp_res.rtyp=SMATRIX_CMD;
3659 BOOLEAN bo=jjTENSOR(&tmp_res,&tmp_u,&tmp_v);
3660 if (!bo)
3661 {
3664 }
3665 tmp_u.CleanUp();
3666 tmp_v.CleanUp();
3667 tmp_res.CleanUp();
3668 return bo;
3669}
static BOOLEAN jjTENSOR(leftv res, leftv u, leftv v)
Definition iparith.cc:3644
static int index(p_Length length, p_Ord ord)

◆ jjTEST()

BOOLEAN jjTEST ( leftv ,
leftv v )
static

Definition at line 8640 of file iparith.cc.

8641{
8642 do
8643 {
8644 if (v->Typ()!=INT_CMD)
8645 return TRUE;
8646 test_cmd((int)(long)v->Data());
8647 v=v->next;
8648 }
8649 while (v!=NULL);
8650 return FALSE;
8651}
void test_cmd(int i)
Definition ipshell.cc:513

◆ jjTIMES_BI()

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

Definition at line 991 of file iparith.cc.

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

◆ jjTIMES_BIM()

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

Definition at line 1074 of file iparith.cc.

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

◆ jjTIMES_I()

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

Definition at line 978 of file iparith.cc.

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

◆ jjTIMES_ID()

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

Definition at line 1055 of file iparith.cc.

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

◆ jjTIMES_IV()

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

Definition at line 1062 of file iparith.cc.

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

◆ jjTIMES_MA()

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

Definition at line 1138 of file iparith.cc.

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

◆ jjTIMES_MA_BI1()

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

Definition at line 1086 of file iparith.cc.

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

◆ jjTIMES_MA_BI2()

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

Definition at line 1096 of file iparith.cc.

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

◆ jjTIMES_MA_I1()

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

Definition at line 1129 of file iparith.cc.

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

◆ jjTIMES_MA_I2()

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

Definition at line 1134 of file iparith.cc.

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

◆ jjTIMES_MA_N1()

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

Definition at line 1118 of file iparith.cc.

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

◆ jjTIMES_MA_N2()

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

Definition at line 1125 of file iparith.cc.

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

◆ jjTIMES_MA_P1()

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

Definition at line 1100 of file iparith.cc.

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

◆ jjTIMES_MA_P2()

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

Definition at line 1109 of file iparith.cc.

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

◆ jjTIMES_N()

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

Definition at line 998 of file iparith.cc.

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

◆ jjTIMES_P()

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

Definition at line 1008 of file iparith.cc.

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

◆ jjTIMES_SM()

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

Definition at line 1152 of file iparith.cc.

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

◆ jjTRACE_IV()

BOOLEAN jjTRACE_IV ( leftv res,
leftv v )
static

Definition at line 5297 of file iparith.cc.

5298{
5299 res->data = (char *)(long)ivTrace((intvec*)(v->Data()));
5300 return FALSE;
5301}
int ivTrace(intvec *o)
Definition intvec.cc:339

◆ jjTRANSP_BIM()

BOOLEAN jjTRANSP_BIM ( leftv res,
leftv v )
static

Definition at line 5302 of file iparith.cc.

5303{
5304 res->data = (char *)(((bigintmat*)(v->Data()))->transpose());
5305 return FALSE;
5306}

◆ jjTRANSP_IV()

BOOLEAN jjTRANSP_IV ( leftv res,
leftv v )
static

Definition at line 5307 of file iparith.cc.

5308{
5309 res->data = (char *)ivTranp((intvec*)(v->Data()));
5310 return FALSE;
5311}
intvec * ivTranp(intvec *o)
Definition intvec.cc:327

◆ jjTWOSTD()

BOOLEAN jjTWOSTD ( leftv res,
leftv a )
static

Definition at line 5346 of file iparith.cc.

5347{
5348#ifdef HAVE_PLURAL
5349 ideal result;
5350 ideal v_id=(ideal)a->Data();
5352 result=(ideal)twostd(v_id);
5353 else /*commutative or shiftalgebra*/
5354 {
5355 return jjSTD(res,a);
5356 }
5357 res->data = (char *)result;
5360 return FALSE;
5361#else
5362 return TRUE;
5363#endif
5364}
#define FLAG_TWOSTD
Definition ipid.h:107
ideal twostd(ideal I)
Compute two-sided GB:
Definition nc.cc:18

◆ jjTYPEOF()

BOOLEAN jjTYPEOF ( leftv res,
leftv v )
static

Definition at line 5428 of file iparith.cc.

5429{
5430 int t=(int)(long)v->data;
5431 switch (t)
5432 {
5433 case CRING_CMD:
5434 case INT_CMD:
5435 case POLY_CMD:
5436 case VECTOR_CMD:
5437 case STRING_CMD:
5438 case INTVEC_CMD:
5439 case IDEAL_CMD:
5440 case MATRIX_CMD:
5441 case MODUL_CMD:
5442 case MAP_CMD:
5443 case PROC_CMD:
5444 case RING_CMD:
5445 case SMATRIX_CMD:
5446 //case QRING_CMD:
5447 case INTMAT_CMD:
5448 case BIGINTMAT_CMD:
5449 case BIGINTVEC_CMD:
5450 case NUMBER_CMD:
5451 #ifdef SINGULAR_4_2
5452 case CNUMBER_CMD:
5453 #endif
5454 case BIGINT_CMD:
5455 case BUCKET_CMD:
5456 case LIST_CMD:
5457 case PACKAGE_CMD:
5458 case LINK_CMD:
5459 case RESOLUTION_CMD:
5460 #ifdef HTABLE
5461 case HTABLE_CMD:
5462 #endif
5463 res->data=omStrDup(Tok2Cmdname(t)); break;
5464 case DEF_CMD:
5465 case NONE: res->data=omStrDup("none"); break;
5466 default:
5467 {
5468 if (t>MAX_TOK)
5469 res->data=omStrDup(getBlackboxName(t));
5470 else
5471 res->data=omStrDup("?unknown type?");
5472 break;
5473 }
5474 }
5475 return FALSE;
5476}
const char * getBlackboxName(const int t)
return the name to the type given by t (r/o)
Definition blackbox.cc:213
@ CNUMBER_CMD
Definition tok.h:47

◆ jjUMINUS_BI()

BOOLEAN jjUMINUS_BI ( leftv res,
leftv u )
static

Definition at line 3810 of file iparith.cc.

3811{
3812 number n=(number)u->CopyD(BIGINT_CMD);
3814 res->data = (char *)n;
3815 return FALSE;
3816}
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:560

◆ jjUMINUS_BIM()

BOOLEAN jjUMINUS_BIM ( leftv res,
leftv u )
static

Definition at line 3847 of file iparith.cc.

3848{
3850 (*bim)*=(-1);
3851 res->data = (char *)bim;
3852 return FALSE;
3853}

◆ jjUMINUS_I()

BOOLEAN jjUMINUS_I ( leftv res,
leftv u )
static

Definition at line 3817 of file iparith.cc.

3818{
3819 res->data = (char *)(-(long)u->Data());
3820 return FALSE;
3821}

◆ jjUMINUS_IV()

BOOLEAN jjUMINUS_IV ( leftv res,
leftv u )
static

Definition at line 3840 of file iparith.cc.

3841{
3842 intvec *iv=(intvec *)u->CopyD(INTVEC_CMD);
3843 (*iv)*=(-1);
3844 res->data = (char *)iv;
3845 return FALSE;
3846}

◆ jjUMINUS_MA()

BOOLEAN jjUMINUS_MA ( leftv res,
leftv u )
static

Definition at line 3834 of file iparith.cc.

3835{
3836 poly m1=pISet(-1);
3837 res->data = (char *)mp_MultP((matrix)u->CopyD(MATRIX_CMD),m1,currRing);
3838 return FALSE;
3839}
#define pISet(i)
Definition polys.h:313

◆ jjUMINUS_N()

BOOLEAN jjUMINUS_N ( leftv res,
leftv u )
static

Definition at line 3822 of file iparith.cc.

3823{
3824 number n=(number)u->CopyD(NUMBER_CMD);
3825 n=nInpNeg(n);
3826 res->data = (char *)n;
3827 return FALSE;
3828}
#define nInpNeg(n)
Definition numbers.h:21

◆ jjUMINUS_P()

BOOLEAN jjUMINUS_P ( leftv res,
leftv u )
static

Definition at line 3829 of file iparith.cc.

3830{
3831 res->data = (char *)pNeg((poly)u->CopyD(POLY_CMD));
3832 return FALSE;
3833}

◆ jjUNIQLIST()

BOOLEAN jjUNIQLIST ( leftv ,
leftv arg )

Definition at line 10499 of file iparith.cc.

10500{
10501 lists l=(lists)arg->Data();
10502 if (l->nr>0)
10503 {
10504 qsort(l->m,l->nr+1,sizeof(sleftv),jjCOMPARE_ALL);
10505 int i, j, len;
10506 len=l->nr;
10507 i=0;
10508 while(i<len)
10509 {
10510 if(jjCOMPARE_ALL(&(l->m[i]),&(l->m[i+1]))==0)
10511 {
10512 l->m[i].CleanUp();
10513 for(j=i; j<len;j++) l->m[j]=l->m[j+1];
10514 l->m[len].Init();
10515 l->m[len].rtyp=DEF_CMD;
10516 len--;
10517 }
10518 else
10519 i++;
10520 }
10521 //Print("new len:%d\n",len);
10522 }
10523 return FALSE;
10524}

◆ jjUNIVARIATE()

BOOLEAN jjUNIVARIATE ( leftv res,
leftv v )
static

Definition at line 5477 of file iparith.cc.

5478{
5479 res->data=(char *)(long)pIsUnivariate((poly)v->Data());
5480 return FALSE;
5481}
#define pIsUnivariate(p)
Definition polys.h:250

◆ jjVAR1()

BOOLEAN jjVAR1 ( leftv res,
leftv v )
static

Definition at line 5482 of file iparith.cc.

5483{
5484 int i=(int)(long)v->Data();
5485 if ((0<i) && (i<=currRing->N))
5486 {
5487 poly p=pOne();
5488 pSetExp(p,i,1);
5489 pSetm(p);
5490 res->data=(char *)p;
5491 }
5492 else
5493 {
5494 Werror("var number %d out of range 1..%d",i,currRing->N);
5495 return TRUE;
5496 }
5497 return FALSE;
5498}

◆ jjVARSTR1()

BOOLEAN jjVARSTR1 ( leftv res,
leftv v )
static

Definition at line 5499 of file iparith.cc.

5500{
5501 if (currRing==NULL)
5502 {
5503 WerrorS("no ring active (2)");
5504 return TRUE;
5505 }
5506 int i=(int)(long)v->Data();
5507 if ((0<i) && (i<=currRing->N))
5508 res->data=omStrDup(currRing->names[i-1]);
5509 else
5510 {
5511 Werror("var number %d out of range 1..%d",i,currRing->N);
5512 return TRUE;
5513 }
5514 return FALSE;
5515}

◆ jjVARSTR2()

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

Definition at line 3670 of file iparith.cc.

3671{
3672 idhdl h=(idhdl)u->data;
3673 int i=(int)(long)v->Data();
3674 if ((0<i) && (i<=IDRING(h)->N))
3675 res->data=omStrDup(IDRING(h)->names[i-1]);
3676 else
3677 {
3678 Werror("var number %d out of range 1..%d",i,IDRING(h)->N);
3679 return TRUE;
3680 }
3681 return FALSE;
3682}

◆ jjVDIM()

BOOLEAN jjVDIM ( leftv res,
leftv v )
static

Definition at line 5516 of file iparith.cc.

5517{
5519#ifdef HAVE_SHIFTBBA
5520 if (rIsLPRing(currRing))
5521 {
5523 {
5524 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5525 return TRUE;
5526 }
5527 if (currRing->qideal != NULL)
5528 {
5529 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5530 return TRUE;
5531 }
5532 int kDim = lp_kDim((ideal)(v->Data()));
5533 res->data = (char *)(long)kDim;
5534 return (kDim == -2);
5535 }
5536#endif
5537 long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5538 if (l<-1L)
5539 WerrorS("int overflow in vdim");
5540 res->data = (char *)l;
5541 return FALSE;
5542}
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
int lp_kDim(const ideal _G)
Definition hdegree.cc:2081

◆ jjWAIT1ST1()

BOOLEAN jjWAIT1ST1 ( leftv res,
leftv u )

Definition at line 5543 of file iparith.cc.

5544{
5545// input: u: a list with links of type
5546// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5547// returns: -1: the read state of all links is eof or error
5548// i>0: (at least) u[i] is ready
5549 lists L = (lists)u->Data();
5550 int i = slStatusSsiL(L, -1);
5551 if(i == -2) /* error */
5552 {
5553 return TRUE;
5554 }
5555 res->data = (void*)(long)i;
5556 return FALSE;
5557}

◆ jjWAIT1ST2()

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

Definition at line 3683 of file iparith.cc.

3684{
3685// input: u: a list with links of type
3686// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
3687// v: timeout for select in milliseconds
3688// or 0 for polling
3689// returns: ERROR (via Werror): timeout negative
3690// -1: the read state of all links is eof
3691// 0: timeout (or polling): none ready
3692// i>0: (at least) L[i] is ready
3693 lists L = (lists)u->Data();
3694 int t = (int)(long)v->Data();
3695 if(t < 0)
3696 {
3697 t= -1;
3698 }
3699 int i = slStatusSsiL(L, t);
3700 if(i == -2) /* error */
3701 {
3702 return TRUE;
3703 }
3704 res->data = (void*)(long)i;
3705 return FALSE;
3706}

◆ jjWAITALL1()

BOOLEAN jjWAITALL1 ( leftv res,
leftv u )

Definition at line 5558 of file iparith.cc.

5559{
5560// input: u: a list with links of type
5561// ssi-fork, ssi-tcp, MPtcp-fork or MPtcp-launch
5562// returns: -1: the read state of all links is eof or error
5563// 1: all links are ready
5564// (caution: at least one is ready, but some maybe dead)
5565 lists L = (lists)u->Data();
5566 int i;
5567 int j = -1;
5568 BOOLEAN* ignore=(BOOLEAN*)omAlloc0((L->nr+1)*sizeof(BOOLEAN));
5569 for(int nfinished = 0; nfinished <= L->nr; nfinished++)
5570 {
5571 i = slStatusSsiL(L, -1, ignore);
5572 if(i == -2) /* error */
5573 {
5574 omFreeSize(ignore,(L->nr+1)*sizeof(BOOLEAN));
5575 return TRUE;
5576 }
5577 if((i == -1)||(j==0))
5578 {
5579 j=-1;
5580 break;
5581 }
5582 if (i>0)
5583 {
5584 j=1;
5585 ignore[i-1]=TRUE;
5586 }
5587 }
5588 omFreeSize(ignore,(L->nr+1)*sizeof(BOOLEAN));
5589 res->data = (void*)(long)j;
5590 return FALSE;
5591}

◆ jjWAITALL2()

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

Definition at line 3707 of file iparith.cc.

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

◆ jjWEDGE()

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

Definition at line 3755 of file iparith.cc.

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

◆ jjWRONG()

BOOLEAN jjWRONG ( leftv ,
leftv  )
static

Definition at line 3760 of file iparith.cc.

3761{
3762 return TRUE;
3763}

◆ jjWRONG2()

BOOLEAN jjWRONG2 ( leftv ,
leftv ,
leftv  )
static

Definition at line 3764 of file iparith.cc.

3765{
3766 return TRUE;
3767}

◆ jjWRONG3()

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

Definition at line 3768 of file iparith.cc.

3769{
3770 return TRUE;
3771}

◆ Tok2Cmdname()

const char * Tok2Cmdname ( int tok)

Definition at line 9899 of file iparith.cc.

9900{
9901 if (tok <= 0)
9902 {
9903 return sArithBase.sCmds[0].name;
9904 }
9905 if (tok==ANY_TYPE) return "any_type";
9906 if (tok==COMMAND) return "command";
9907 if (tok==NONE) return "nothing";
9908 if (tok < 128)
9909 {
9910 Tok2Cmdname_buf[0]=(char)tok;
9911 return Tok2Cmdname_buf;
9912 }
9913 //if (tok==IFBREAK) return "if_break";
9914 //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
9915 //if (tok==ORDER_VECTOR) return "ordering";
9916 //if (tok==REF_VAR) return "ref";
9917 //if (tok==OBJECT) return "object";
9918 //if (tok==PRINT_EXPR) return "print_expr";
9919 if (tok==IDHDL) return "identifier";
9920 if (tok>MAX_TOK) return getBlackboxName(tok);
9921 unsigned i;
9922 for(i=0; i<sArithBase.nCmdUsed; i++)
9923 //while (sArithBase.sCmds[i].tokval!=0)
9924 {
9925 if ((sArithBase.sCmds[i].tokval == tok)&&
9926 (sArithBase.sCmds[i].alias==0))
9927 {
9928 return sArithBase.sCmds[i].name;
9929 }
9930 }
9931 // try gain for alias/old names:
9932 for(i=0; i<sArithBase.nCmdUsed; i++)
9933 {
9934 if (sArithBase.sCmds[i].tokval == tok)
9935 {
9936 return sArithBase.sCmds[i].name;
9937 }
9938 }
9939 return sArithBase.sCmds[0].name;
9940}
STATIC_VAR si_char_2 Tok2Cmdname_buf
Definition iparith.cc:9898
#define ANY_TYPE
Definition tok.h:30

◆ WerrorS_dummy()

void WerrorS_dummy ( const char * )
static

Definition at line 5665 of file iparith.cc.

5666{
5668}

Variable Documentation

◆ all_farey

long all_farey =0L

Definition at line 8 of file iparith.cc.

◆ cmdtok

EXTERN_VAR int cmdtok

Definition at line 214 of file iparith.cc.

◆ expected_parms

EXTERN_VAR BOOLEAN expected_parms

Definition at line 215 of file iparith.cc.

◆ farey_cnt

long farey_cnt =0L

Definition at line 9 of file iparith.cc.

◆ iiOp

VAR int iiOp

Definition at line 219 of file iparith.cc.

◆ sArithBase

STATIC_VAR SArithBase sArithBase

Base entry for arithmetic.

Definition at line 198 of file iparith.cc.

◆ singclap_factorize_retry

EXTERN_VAR int singclap_factorize_retry

Definition at line 2064 of file iparith.cc.

◆ Tok2Cmdname_buf

STATIC_VAR si_char_2 Tok2Cmdname_buf =" "

Definition at line 9898 of file iparith.cc.

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5664 of file iparith.cc.