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 8992 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 8994 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 8993 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 9895 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 9951 of file iparith.cc.

9952{
9953 cmdnames *pCmdL = (cmdnames*)a;
9954 cmdnames *pCmdR = (cmdnames*)b;
9955
9956 if(a==NULL || b==NULL) return 0;
9957
9958 /* empty entries goes to the end of the list for later reuse */
9959 if(pCmdL->name==NULL) return 1;
9960 if(pCmdR->name==NULL) return -1;
9961
9962 /* $INVALID$ must come first */
9963 if(strcmp(pCmdL->name, "$INVALID$")==0) return -1;
9964 if(strcmp(pCmdR->name, "$INVALID$")==0) return 1;
9965
9966 /* tokval=-1 are reserved names at the end */
9967 if (pCmdL->tokval==-1)
9968 {
9969 if (pCmdR->tokval==-1)
9970 return strcmp(pCmdL->name, pCmdR->name);
9971 /* pCmdL->tokval==-1, pCmdL goes at the end */
9972 return 1;
9973 }
9974 /* pCmdR->tokval==-1, pCmdR goes at the end */
9975 if(pCmdR->tokval==-1) return -1;
9976
9977 return strcmp(pCmdL->name, pCmdR->name);
9978}
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 10177 of file iparith.cc.

10178{
10180 {
10181 if ((p & NC_MASK)==NO_NC)
10182 {
10183 WerrorS("not implemented for non-commutative rings");
10184 return TRUE;
10185 }
10186 else if ((p & NC_MASK)==COMM_PLURAL)
10187 {
10188 Warn("assume commutative subalgebra for cmd `%s` in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10189 return FALSE;
10190 }
10191 /* else, ALLOW_PLURAL */
10192 }
10193 else if (rIsLPRing(currRing))
10194 {
10195 if ((p & ALLOW_LP)==0)
10196 {
10197 Werror("`%s` not implemented for letterplace rings in >>%s<<",Tok2Cmdname(op),my_yylinebuf);
10198 return TRUE;
10199 }
10200 }
10202 {
10203 if ((p & RING_MASK)==0 /*NO_RING*/)
10204 {
10205 WerrorS("not implemented for rings with rings as coeffients");
10206 return TRUE;
10207 }
10209 {
10210 WerrorS("not implemented for rings with rings as coeffients and non-global orderings");
10211 return TRUE;
10212 }
10213 /* else ALLOW_RING */
10214 else if (((p & ZERODIVISOR_MASK)==NO_ZERODIVISOR)
10216 {
10217 WerrorS("domain required as coeffients");
10218 return TRUE;
10219 }
10220 /* else ALLOW_ZERODIVISOR */
10221 else if(((p & WARN_RING)==WARN_RING)&&(myynest==0))
10222 {
10223 WarnS("considering the image in Q[...]");
10224 }
10225 }
10226 return FALSE;
10227}
#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:9897
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
#define rField_is_Ring(R)
Definition ring.h:491

◆ iiArithAddCmd()

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

Definition at line 10118 of file iparith.cc.

10125{
10126 //printf("AddCmd(%s, %d, %d, %d, %d)\n", szName, nAlias,
10127 // nTokval, nToktype, nPos);
10128 if(nPos>=0)
10129 {
10130 // no checks: we rely on a correct generated code in iparith.inc
10131 assume((unsigned)nPos < sArithBase.nCmdAllocated);
10132 assume(szName!=NULL);
10133 sArithBase.sCmds[nPos].name = omStrDup(szName);
10134 sArithBase.sCmds[nPos].alias = nAlias;
10135 sArithBase.sCmds[nPos].tokval = nTokval;
10136 sArithBase.sCmds[nPos].toktype = nToktype;
10137 sArithBase.nCmdUsed++;
10138 //if(nTokval>0) sArithBase.nLastIdentifier++;
10139 }
10140 else
10141 {
10142 if(szName==NULL) return -1;
10143 int nIndex = iiArithFindCmd(szName);
10144 if(nIndex>=0)
10145 {
10146 Print("'%s' already exists at %d\n", szName, nIndex);
10147 return -1;
10148 }
10149
10150 if(sArithBase.nCmdUsed>=sArithBase.nCmdAllocated)
10151 {
10152 /* needs to create new slots */
10153 unsigned long nSize = (sArithBase.nCmdAllocated+1)*sizeof(cmdnames);
10154 sArithBase.sCmds = (cmdnames *)omRealloc(sArithBase.sCmds, nSize);
10155 if(sArithBase.sCmds==NULL) return -1;
10156 sArithBase.nCmdAllocated++;
10157 }
10158 /* still free slots available */
10159 sArithBase.sCmds[sArithBase.nCmdUsed].name = omStrDup(szName);
10160 sArithBase.sCmds[sArithBase.nCmdUsed].alias = nAlias;
10161 sArithBase.sCmds[sArithBase.nCmdUsed].tokval = nTokval;
10162 sArithBase.sCmds[sArithBase.nCmdUsed].toktype = nToktype;
10163 sArithBase.nCmdUsed++;
10164
10165 qsort(sArithBase.sCmds, sArithBase.nCmdUsed, sizeof(cmdnames),
10167 for(sArithBase.nLastIdentifier=sArithBase.nCmdUsed-1;
10168 sArithBase.nLastIdentifier>0; sArithBase.nLastIdentifier--)
10169 {
10170 if(sArithBase.sCmds[sArithBase.nLastIdentifier].tokval>=0) break;
10171 }
10172 //Print("L=%d\n", sArithBase.nLastIdentifier);
10173 }
10174 return 0;
10175}
#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:10023
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 10023 of file iparith.cc.

10024{
10025 int an=0;
10026 int i = 0,v = 0;
10027 int en=sArithBase.nLastIdentifier;
10028
10029 loop
10030 //for(an=0; an<sArithBase.nCmdUsed; )
10031 {
10032 if(an>=en-1)
10033 {
10034 if (strcmp(szName, sArithBase.sCmds[an].name) == 0)
10035 {
10036 //Print("RET-an=%d %s\n", an, sArithBase.sCmds[an].name);
10037 return an;
10038 }
10039 else if (strcmp(szName, sArithBase.sCmds[en].name) == 0)
10040 {
10041 //Print("RET-en=%d %s\n", en, sArithBase.sCmds[en].name);
10042 return en;
10043 }
10044 else
10045 {
10046 //Print("RET- 1\n");
10047 return -1;
10048 }
10049 }
10050 i=(an+en)/2;
10051 if (*szName < *(sArithBase.sCmds[i].name))
10052 {
10053 en=i-1;
10054 }
10055 else if (*szName > *(sArithBase.sCmds[i].name))
10056 {
10057 an=i+1;
10058 }
10059 else
10060 {
10061 v=strcmp(szName,sArithBase.sCmds[i].name);
10062 if(v<0)
10063 {
10064 en=i-1;
10065 }
10066 else if(v>0)
10067 {
10068 an=i+1;
10069 }
10070 else /*v==0*/
10071 {
10072 //Print("RET-i=%d %s\n", i, sArithBase.sCmds[i].name);
10073 return i;
10074 }
10075 }
10076 }
10077 //if(i>=0 && i<sArithBase.nCmdUsed)
10078 // return i;
10079 //PrintS("RET-2\n");
10080 return -2;
10081}
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 10083 of file iparith.cc.

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

◆ iiArithRemoveCmd() [1/2]

int iiArithRemoveCmd ( char * szName)
extern

◆ iiArithRemoveCmd() [2/2]

int iiArithRemoveCmd ( const char * szName)

Definition at line 10091 of file iparith.cc.

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

◆ iiExprArith1()

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

Definition at line 9365 of file iparith.cc.

9366{
9367 if (!errorreported)
9368 {
9369 res->Init();
9370#ifdef SIQ
9371 if (siq>0)
9372 {
9373 //Print("siq:%d\n",siq);
9375 memcpy(&d->arg1,a,sizeof(sleftv));
9376 a->Init();
9377 d->op=op;
9378 d->argc=1;
9379 res->data=(char *)d;
9380 res->rtyp=COMMAND;
9381 return FALSE;
9382 }
9383#endif
9384 int at=a->Typ();
9385 // handling bb-objects ----------------------------------------------------
9386 if(op>MAX_TOK) // explicit type conversion to bb
9387 {
9388 blackbox *bb=getBlackboxStuff(op);
9389 if (bb!=NULL)
9390 {
9391 res->rtyp=op;
9392 res->data=bb->blackbox_Init(bb);
9393 return bb->blackbox_Assign(res,a);
9394 }
9395 else
9396 return TRUE;
9397 }
9398 else if (at>MAX_TOK) // argument is of bb-type
9399 {
9400 blackbox *bb=getBlackboxStuff(at);
9401 if (bb!=NULL)
9402 {
9403 if(!bb->blackbox_Op1(op,res,a)) return FALSE;
9404 // if not defined, try generic routines (attrib, defined,..)
9405 }
9406 else
9407 return TRUE;
9408 }
9409 if (errorreported) return TRUE;
9410
9411 int i=iiTabIndex(dArithTab1,JJTAB1LEN,op);
9412 return iiExprArith1Tab(res,a,op, dArith1+i,at,dConvertTypes);
9413 }
9414 a->CleanUp();
9415 return TRUE;
9416}
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:9235
static int iiTabIndex(const jjValCmdTab dArithTab, const int len, const int op)
Definition iparith.cc:9872
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 9235 of file iparith.cc.

9236{
9237 res->Init();
9238 BOOLEAN call_failed=FALSE;
9239
9240 if (!errorreported)
9241 {
9242 BOOLEAN failed=FALSE;
9243 iiOp=op;
9244 int i = 0;
9245 while (dA1[i].cmd==op)
9246 {
9247 if (at==dA1[i].arg)
9248 {
9249 if (currRing!=NULL)
9250 {
9251 if (check_valid(dA1[i].valid_for,op)) break;
9252 }
9253 else
9254 {
9255 if (RingDependend(dA1[i].res))
9256 {
9257 WerrorS("no ring active (5)");
9258 break;
9259 }
9260 }
9261 if (traceit&TRACE_CALL)
9262 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
9263 res->rtyp=dA1[i].res;
9264 if ((call_failed=dA1[i].p(res,a)))
9265 {
9266 break;// leave loop, goto error handling
9267 }
9268 if (a->Next()!=NULL)
9269 {
9271 failed=iiExprArith1(res->next,a->next,op);
9272 }
9273 a->CleanUp();
9274 return failed;
9275 }
9276 i++;
9277 }
9278 // implicite type conversion --------------------------------------------
9279 if (dA1[i].cmd!=op)
9280 {
9282 i=0;
9283 //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
9284 while (dA1[i].cmd==op)
9285 {
9286 int ai;
9287 //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
9288 if ((dA1[i].valid_for & NO_CONVERSION)==0)
9289 {
9290 if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
9291 {
9292 if (currRing!=NULL)
9293 {
9294 if (check_valid(dA1[i].valid_for,op)) break;
9295 }
9296 else
9297 {
9298 if (RingDependend(dA1[i].res))
9299 {
9300 WerrorS("no ring active (6)");
9301 break;
9302 }
9303 }
9304 if (traceit&TRACE_CALL)
9305 Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
9306 res->rtyp=dA1[i].res;
9307 failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
9308 || (call_failed=dA1[i].p(res,an)));
9309 // everything done, clean up temp. variables
9310 if (failed)
9311 {
9312 // leave loop, goto error handling
9313 break;
9314 }
9315 else
9316 {
9317 if (an->Next() != NULL)
9318 {
9319 res->next = (leftv)omAllocBin(sleftv_bin);
9320 failed=iiExprArith1(res->next,an->next,op);
9321 }
9322 // everything ok, clean up and return
9323 an->CleanUp();
9325 return failed;
9326 }
9327 }
9328 }
9329 i++;
9330 }
9331 an->CleanUp();
9333 }
9334 // error handling
9335 if (!errorreported)
9336 {
9337 if ((at==0) && (a->Fullname()!=sNoName_fe))
9338 {
9339 Werror("`%s` is not defined",a->Fullname());
9340 }
9341 else
9342 {
9343 i=0;
9344 const char *s = iiTwoOps(op);
9345 Werror("%s(`%s`) failed"
9346 ,s,Tok2Cmdname(at));
9347 if ((!call_failed) && BVERBOSE(V_SHOW_USE))
9348 {
9349 while (dA1[i].cmd==op)
9350 {
9351 if ((dA1[i].res!=0)
9352 && (dA1[i].p!=jjWRONG))
9353 Werror("expected %s(`%s`)"
9354 ,s,Tok2Cmdname(dA1[i].arg));
9355 i++;
9356 }
9357 }
9358 }
9359 }
9360 res->rtyp = UNKNOWN;
9361 }
9362 a->CleanUp();
9363 return TRUE;
9364}
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:9365
static BOOLEAN check_valid(const int p, const int op)
Definition iparith.cc:10177
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 9176 of file iparith.cc.

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

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

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

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

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

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

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

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

◆ iiExprArithM()

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

Definition at line 9666 of file iparith.cc.

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

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

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

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

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

9774{
9775 int i;
9776 int an=1;
9777 int en=sArithBase.nLastIdentifier;
9778
9779 loop
9780 //for(an=0; an<sArithBase.nCmdUsed; )
9781 {
9782 if(an>=en-1)
9783 {
9784 if (strcmp(n, sArithBase.sCmds[an].name) == 0)
9785 {
9786 i=an;
9787 break;
9788 }
9789 else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
9790 {
9791 i=en;
9792 break;
9793 }
9794 else
9795 {
9796 // -- blackbox extensions:
9797 // return 0;
9798 return blackboxIsCmd(n,tok);
9799 }
9800 }
9801 i=(an+en)/2;
9802 if (*n < *(sArithBase.sCmds[i].name))
9803 {
9804 en=i-1;
9805 }
9806 else if (*n > *(sArithBase.sCmds[i].name))
9807 {
9808 an=i+1;
9809 }
9810 else
9811 {
9812 int v=strcmp(n,sArithBase.sCmds[i].name);
9813 if(v<0)
9814 {
9815 en=i-1;
9816 }
9817 else if(v>0)
9818 {
9819 an=i+1;
9820 }
9821 else /*v==0*/
9822 {
9823 break;
9824 }
9825 }
9826 }
9827 lastreserved=sArithBase.sCmds[i].name;
9828 tok=sArithBase.sCmds[i].tokval;
9829 if(sArithBase.sCmds[i].alias==2)
9830 {
9831 Warn("outdated identifier `%s` used - please change your code",
9832 sArithBase.sCmds[i].name);
9833 sArithBase.sCmds[i].alias=1;
9834 }
9835 #if 0
9836 if (currRingHdl==NULL)
9837 {
9838 #ifdef SIQ
9839 if (siq<=0)
9840 {
9841 #endif
9842 if ((tok>=BEGIN_RING) && (tok<=END_RING))
9843 {
9844 WerrorS("no ring active");
9845 return 0;
9846 }
9847 #ifdef SIQ
9848 }
9849 #endif
9850 }
9851 #endif
9852 if (!expected_parms)
9853 {
9854 switch (tok)
9855 {
9856 case IDEAL_CMD:
9857 case INT_CMD:
9858 case INTVEC_CMD:
9859 case MAP_CMD:
9860 case MATRIX_CMD:
9861 case MODUL_CMD:
9862 case POLY_CMD:
9863 case PROC_CMD:
9864 case RING_CMD:
9865 case STRING_CMD:
9866 cmdtok = tok;
9867 break;
9868 }
9869 }
9870 return sArithBase.sCmds[i].toktype;
9871}
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:4860
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 6095 of file iparith.cc.

6096{
6097 intvec *iv;
6098 ideal m;
6100 int k=(int)(long)w->Data();
6101 if (k>=0)
6102 {
6103 sm_CallBareiss((ideal)u->Data(),(int)(long)v->Data(),(int)(long)w->Data(),m,&iv, currRing);
6104 l->Init(2);
6105 l->m[0].rtyp=MODUL_CMD;
6106 l->m[1].rtyp=INTVEC_CMD;
6107 l->m[0].data=(void *)m;
6108 l->m[1].data=(void *)iv;
6109 }
6110 else
6111 {
6112 m=sm_CallSolv((ideal)u->Data(), currRing);
6113 l->Init(1);
6114 l->m[0].rtyp=IDEAL_CMD;
6115 l->m[0].data=(void *)m;
6116 }
6117 res->data = (char *)l;
6118 return FALSE;
6119}
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:962
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 7932 of file iparith.cc.

7933{
7934 leftv h=v;
7935 int l=0;
7936 while (h!=NULL)
7937 {
7938 if(h->Typ()==INT_CMD) l++;
7939 else if (h->Typ()==BIGINT_CMD) l++;
7940 else if (h->Typ()==INTVEC_CMD)
7941 {
7942 intvec *ivv=(intvec*)h->Data();
7943 l+=ivv->rows();
7944 }
7945 else if (h->Typ()==BIGINTVEC_CMD)
7946 {
7947 bigintmat *ivv=(bigintmat *)h->Data();
7948 l+=ivv->rows();
7949 }
7950 else return TRUE;
7951 h=h->next;
7952 }
7953 bigintmat *bim=new bigintmat(1,l,coeffs_BIGINT);
7954 h=v;
7955 int i=0;
7956 while (h!=NULL)
7957 {
7958 if(h->Typ()==INT_CMD)
7959 {
7960 number tp = n_Init((long)(h->Data()), coeffs_BIGINT);
7961 bim->set(i++, tp);
7962 n_Delete(&tp, coeffs_BIGINT);
7963 }
7964 else if (h->Typ()==INTVEC_CMD)
7965 {
7966 intvec *ivv=(intvec*)h->Data();
7967 for(int j=0;j<ivv->length();j++)
7968 {
7969 number tp = n_Init((long)(*ivv)[j], coeffs_BIGINT);
7970 bim->set(i++, tp);
7971 n_Delete(&tp, coeffs_BIGINT);
7972 }
7973 }
7974 else if(h->Typ()==BIGINT_CMD)
7975 {
7976 number tp = (number)h->Data();
7977 bim->set(i++, tp);
7978 }
7979 else if(h->Typ()==BIGINTVEC_CMD)
7980 {
7981 bigintmat *b=(bigintmat*)h->Data();
7982 for(int j=0;j<b->cols();j++)
7983 {
7984 number tp=BIMATELEM((*b),1,j);
7985 bim->set(i++, tp);
7986 }
7987 }
7988 h=h->next;
7989 }
7990 res->data=(char *)bim;
7991 return FALSE;
7992}
#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 5840 of file iparith.cc.

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

◆ jjBRACK_Im()

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

Definition at line 5813 of file iparith.cc.

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

◆ jjBRACK_Ma()

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

Definition at line 5868 of file iparith.cc.

5869{
5870 matrix m= (matrix)u->Data();
5871 int r = (int)(long)v->Data();
5872 int c = (int)(long)w->Data();
5873 //Print("gen. elem %d, %d\n",r,c);
5874 if ((r<1)||(r>MATROWS(m))||(c<1)||(c>MATCOLS(m)))
5875 {
5876 Werror("wrong range[%d,%d] in matrix %s(%d x %d)",r,c,u->Fullname(),
5877 MATROWS(m),MATCOLS(m));
5878 return TRUE;
5879 }
5880 res->data=u->data; u->data=NULL;
5881 res->rtyp=u->rtyp; u->rtyp=0;
5882 res->name=u->name; u->name=NULL;
5883 Subexpr e=jjMakeSub(v);
5884 e->next=jjMakeSub(w);
5885 if (u->e==NULL)
5886 res->e=e;
5887 else
5888 {
5889 Subexpr h=u->e;
5890 while (h->next!=NULL) h=h->next;
5891 h->next=e;
5892 res->e=u->e;
5893 u->e=NULL;
5894 }
5895 return FALSE;
5896}
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 5926 of file iparith.cc.

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

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

◆ jjBRACK_Ma_IV_IV()

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

Definition at line 6025 of file iparith.cc.

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

◆ jjBRACK_S()

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

Definition at line 5797 of file iparith.cc.

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

◆ jjBRACK_SM()

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

Definition at line 5897 of file iparith.cc.

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

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

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

◆ jjBREAK1()

BOOLEAN jjBREAK1 ( leftv ,
leftv v )
static

Definition at line 7339 of file iparith.cc.

7340{
7341#ifdef HAVE_SDB
7342 if(v->Typ()==PROC_CMD)
7343 {
7344 int lineno=0;
7345 if((v->next!=NULL) && (v->next->Typ()==INT_CMD))
7346 {
7347 lineno=(int)(long)v->next->Data();
7348 }
7349 return sdb_set_breakpoint(v->Name(),lineno);
7350 }
7351 return TRUE;
7352#else
7353 return FALSE;
7354#endif
7355}
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 7356 of file iparith.cc.

7357{
7358 return iiExprArith1(res,v,iiOp);
7359}

◆ 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:9666

◆ jjCALL2ARG()

BOOLEAN jjCALL2ARG ( leftv res,
leftv u )
static

Definition at line 7360 of file iparith.cc.

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

◆ jjCALL3ARG()

BOOLEAN jjCALL3ARG ( leftv res,
leftv u )
static

Definition at line 7368 of file iparith.cc.

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

◆ 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:759
#define omFree(addr)

◆ jjCHINREM_ID()

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

Definition at line 10229 of file iparith.cc.

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

7381{
7382 const short t[]={4,VECTOR_CMD,POLY_CMD,MATRIX_CMD,MATRIX_CMD};
7383 if (iiCheckTypes(v,t,1))
7384 {
7385 idhdl c=(idhdl)v->next->next->data;
7386 if (v->next->next->next->rtyp!=IDHDL) return TRUE;
7387 idhdl m=(idhdl)v->next->next->next->data;
7388 idDelete((ideal *)&(c->data.uideal));
7389 idDelete((ideal *)&(m->data.uideal));
7390 mp_Coef2((poly)v->Data(),(poly)v->next->Data(),
7391 (matrix *)&(c->data.umatrix),(matrix *)&(m->data.umatrix),currRing);
7392 return FALSE;
7393 }
7394 return TRUE;
7395}
@ 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:2668
#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 6120 of file iparith.cc.

6121{
6122 if ((w->rtyp!=IDHDL)||(w->e!=NULL))
6123 {
6124 WerrorS("3rd argument must be a name of a matrix");
6125 return TRUE;
6126 }
6127 ideal i=(ideal)u->Data();
6128 int rank=(int)i->rank;
6129 BOOLEAN r=jjCOEFFS_Id(res,u,v);
6130 if (r) return TRUE;
6131 mp_Monomials((matrix)res->data, rank, pVar((poly)v->Data()),(matrix)w->Data(),currRing);
6132 return FALSE;
6133}
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 6134 of file iparith.cc.

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

◆ jjCOEFFS3_P()

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

Definition at line 6140 of file iparith.cc.

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

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

◆ 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:2202

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

5767{
5768 res->data=(char *)(long)sySize((syStrategy)v->Data());
5769 return FALSE;
5770}
int sySize(syStrategy syzstr)
Definition syz1.cc:1830
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:535
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rField_is_GF(const ring r)
Definition ring.h:527

◆ jjDEFINED()

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:598
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:2057
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:913
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:2189

◆ 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:770

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

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

◆ 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:1111
#define hasFlag(A, F)
Definition ipid.h:112
#define FLAG_STD
Definition ipid.h:106
STATIC_VAR jList * T
Definition janet.cc:30
matrix id_Module2formatedMatrix(ideal mod, int rows, int cols, const ring R)
#define R
Definition sirandom.c:27

◆ jjDIVISION4()

BOOLEAN jjDIVISION4 ( leftv res,
leftv v )
static

Definition at line 7397 of file iparith.cc.

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

◆ jjELIMIN_ALG()

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

Definition at line 6167 of file iparith.cc.

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

◆ jjELIMIN_HILB()

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

Definition at line 6175 of file iparith.cc.

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

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

5330{
5331#ifdef HAVE_PLURAL
5332 ring r = (ring)a->Data();
5333 if (rIsPluralRing(r))
5334 {
5335 ring s = rEnvelope(r);
5336 res->data = s;
5337 }
5338 else res->data = rCopy(r);
5339 return FALSE;
5340#else
5341 return TRUE;
5342#endif
5343}
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 8657 of file iparith.cc.

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

◆ 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:3103
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 10428 of file iparith.cc.

10429{
10430 lists c=(lists)u->CopyD();
10432 res_l->Init(c->nr+1);
10433 BOOLEAN bo=FALSE;
10434 int tab_pos=iiTabIndex(dArithTab2,JJTAB2LEN,FAREY_CMD);
10435 for (unsigned i=0;i<=(unsigned)c->nr;i++)
10436 {
10437 sleftv tmp;
10438 tmp.Copy(v);
10439 bo=iiExprArith2TabIntern(&res_l->m[i],&c->m[i],FAREY_CMD,&tmp,TRUE,dArith2+tab_pos,c->m[i].rtyp,tmp.rtyp,dConvertTypes);
10440 if (bo) { Werror("farey failed for list entry %d",i+1); break;}
10441 }
10442 c->Clean();
10443 res->data=res_l;
10444 return bo;
10445}
@ 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:958
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:605
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition ring.h:631
@ ALIAS_CMD
Definition tok.h:34

◆ jjFETCH_M()

BOOLEAN jjFETCH_M ( leftv res,
leftv u )
static

Definition at line 7539 of file iparith.cc.

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

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

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

6216{
6217 if ((int)(long)w->Data()==0)
6218 res->data=(char *)walkProc(u,v);
6219 else
6220 res->data=(char *)fractalWalkProc(u,v);
6221 setFlag( res, FLAG_STD );
6222 return FALSE;
6223}
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:1514
bigintmat * hFirstSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2019
bigintmat * hSecondSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2041
const char feNotImplemented[]
Definition reporter.cc:54

◆ jjHILBERT3()

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

Definition at line 6224 of file iparith.cc.

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

◆ jjHILBERT3Qt()

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

Definition at line 6254 of file iparith.cc.

6255{
6256 if (rField_is_Z(currRing))
6257 {
6258 PrintS("// NOTE: computation of Hilbert series etc. is being\n");
6259 PrintS("// performed for generic fibre, that is, over Q\n");
6260 }
6261 assumeStdFlag(u);
6262 ring Qt =(ring)v->Data();
6263 char *name=(char*)w->Data();
6264 poly h;
6265 if (u->Typ()==IDEAL_CMD)
6266 h=hFirstSeries0p((ideal)u->Data(),currRing->qideal,NULL,currRing,Qt);
6267 else
6268 {
6269 intvec *module_w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
6270 h=hFirstSeries0m((ideal)u->Data(),currRing->qideal,NULL,module_w,currRing,Qt);
6271 }
6272 idhdl hh=enterid(name,myynest,POLY_CMD,&(Qt->idroot),FALSE,FALSE);
6273 IDPOLY(hh)=h;
6274 return FALSE;
6275}
char name(const Variable &v)
Definition factory.h:189
poly hFirstSeries0m(ideal A, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const ring Qt)
Definition hilb.cc:1427
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:279
#define IDPOLY(a)
Definition ipid.h:130

◆ 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:2120
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 6276 of file iparith.cc.

6277{
6278 PrintS("TODO\n");
6279 int i=pVar((poly)v->Data());
6280 if (i==0)
6281 {
6282 WerrorS("ringvar expected");
6283 return TRUE;
6284 }
6285 poly p=pOne(); pSetExp(p,i,1); pSetm(p);
6286 int d=pWTotaldegree(p);
6287 pLmDelete(p);
6288 if (d==1)
6289 res->data = (char *)id_Homogen((ideal)u->Data(), i, currRing);
6290 else
6291 WerrorS("variable must have weight 1");
6292 return (d!=1);
6293}
#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 6294 of file iparith.cc.

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

◆ jjHOMOG_W_M()

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

Definition at line 6312 of file iparith.cc.

6313{
6314 intvec *w=(intvec *)v3->Data();
6315 intvec *vw=(intvec*)v2->Data();
6316 ideal v_id=(ideal)v1->Data();
6317 res->data=(void *)(long)id_HomModuleW(v_id,currRing->qideal,vw,w,currRing);
6318 return FALSE;
6319}
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 7496 of file iparith.cc.

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

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

◆ jjidFreeModule()

BOOLEAN jjidFreeModule ( leftv res,
leftv v )
static

Definition at line 5698 of file iparith.cc.

5699{
5700 res->data = (char *)id_FreeModule((int)(long)v->Data(), currRing);
5701 return FALSE;
5702}
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 5718 of file iparith.cc.

5719{
5720 res->data = (char *)id_Head((ideal)v->Data(),currRing);
5722 return FALSE;
5723}
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 5724 of file iparith.cc.

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

◆ jjidTransp()

BOOLEAN jjidTransp ( leftv res,
leftv v )
static

Definition at line 5776 of file iparith.cc.

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

◆ jjidVec2Ideal()

BOOLEAN jjidVec2Ideal ( leftv res,
leftv v )
static

Definition at line 5703 of file iparith.cc.

5704{
5705 res->data = (char *)id_Vec2Ideal((poly)v->Data(), currRing);
5706 return FALSE;
5707}
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:788

◆ 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:3802
#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 6347 of file iparith.cc.

6348{
6349 ideal I=(ideal)u->Data();
6350 GbVariant alg=syGetAlgorithm((char*)w->Data(),currRing,I);
6351 res->data=(char *)idSect(I,(ideal)v->Data(),alg);
6353 return FALSE;
6354}
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 6334 of file iparith.cc.

6335{
6336 ideal I1=(ideal)u->Data();
6337 ideal I2=(ideal)v->Data();
6338 ideal I3=(ideal)w->Data();
6339 resolvente r=(resolvente)omAlloc0(3*sizeof(ideal));
6340 r[0]=I1;
6341 r[1]=I2;
6342 r[2]=I3;
6343 res->data=(char *)idMultSect(r,3);
6344 omFreeSize((ADDRESS)r,3*sizeof(ideal));
6345 return FALSE;
6346}
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 7664 of file iparith.cc.

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

◆ jjINTMAT3()

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

Definition at line 6320 of file iparith.cc.

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

◆ jjINTVEC_PL()

BOOLEAN jjINTVEC_PL ( leftv res,
leftv v )
static

Definition at line 7900 of file iparith.cc.

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

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

7994{
7995 const short t1[]={4,POLY_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7996 const short t2[]={4,VECTOR_CMD,POLY_CMD,POLY_CMD,INTVEC_CMD};
7997 const short t3[]={4,IDEAL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7998 const short t4[]={4,MODUL_CMD,MATRIX_CMD,INT_CMD,INTVEC_CMD};
7999 leftv u1=u;
8000 leftv u2=u1->next;
8001 leftv u3=u2->next;
8002 leftv u4=u3->next;
8003 if (iiCheckTypes(u,t1)||iiCheckTypes(u,t2))
8004 {
8005 if(!pIsUnit((poly)u2->Data()))
8006 {
8007 WerrorS("2nd argument must be a unit");
8008 return TRUE;
8009 }
8010 res->rtyp=u1->Typ();
8011 res->data=(char*)pSeries((int)(long)u3->Data(),pCopy((poly)u1->Data()),
8012 pCopy((poly)u2->Data()),(intvec*)u4->Data());
8013 return FALSE;
8014 }
8015 else
8016 if (iiCheckTypes(u,t3)||iiCheckTypes(u,t4))
8017 {
8018 if(!mp_IsDiagUnit((matrix)u2->Data(), currRing))
8019 {
8020 WerrorS("2nd argument must be a diagonal matrix of units");
8021 return TRUE;
8022 }
8023 res->rtyp=u1->Typ();
8024 res->data=(char*)idSeries(
8025 (int)(long)u3->Data(),
8026 idCopy((ideal)u1->Data()),
8027 mp_Copy((matrix)u2->Data(), currRing),
8028 (intvec*)u4->Data()
8029 );
8030 return FALSE;
8031 }
8032 else
8033 {
8034 Werror("%s(`poly`,`poly`,`int`,`intvec`) exppected",
8035 Tok2Cmdname(iiOp));
8036 return TRUE;
8037 }
8038}
ideal idSeries(int n, ideal M, matrix U, intvec *w)
Definition ideals.cc:2172
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 6372 of file iparith.cc.

6373{
6374 res->data = (char *)id_JetW((ideal)u->Data(),(int)(long)v->Data(),
6375 (intvec *)w->Data(),currRing);
6376 return FALSE;
6377}
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 6378 of file iparith.cc.

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

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

6356{
6357 int *iw=iv2array((intvec *)w->Data(),currRing);
6358 res->data = (char *)ppJetW((poly)u->Data(),(int)(long)v->Data(),iw);
6359 omFreeSize( (ADDRESS)iw, (rVar(currRing)+1)*sizeof(int) );
6360 return FALSE;
6361}
#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 6362 of file iparith.cc.

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

◆ 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:6678

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

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

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

◆ jjLIFT_4()

BOOLEAN jjLIFT_4 ( leftv res,
leftv U )
static

Definition at line 8129 of file iparith.cc.

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

◆ 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:982

◆ jjLIFTSTD_ALG()

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

Definition at line 7172 of file iparith.cc.

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

◆ jjLIFTSTD_M()

BOOLEAN jjLIFTSTD_M ( leftv res,
leftv U )
static

Definition at line 8160 of file iparith.cc.

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

◆ jjLIFTSTD_SYZ()

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

Definition at line 7149 of file iparith.cc.

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

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv res,
leftv v )

Definition at line 8250 of file iparith.cc.

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

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

5592{
5593 char libnamebuf[1024];
5595
5596#ifdef HAVE_DYNAMIC_LOADING
5597 extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5598#endif /* HAVE_DYNAMIC_LOADING */
5599 switch(LT)
5600 {
5601 default:
5602 case LT_NONE:
5603 Werror("%s: unknown type", s);
5604 break;
5605 case LT_NOTFOUND:
5606 Werror("cannot open %s", s);
5607 break;
5608
5609 case LT_SINGULAR:
5610 {
5611 char *plib = iiConvName(s);
5612 idhdl pl = IDROOT->get_level(plib,0);
5613 if (pl==NULL)
5614 {
5615 pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5616 IDPACKAGE(pl)->language = LANG_SINGULAR;
5617 IDPACKAGE(pl)->libname=omStrDup(s);
5618 }
5619 else if (IDTYP(pl)!=PACKAGE_CMD)
5620 {
5621 Werror("can not create package `%s`",plib);
5622 omFreeBinAddr(plib);
5623 return TRUE;
5624 }
5625 else /* package */
5626 {
5627 package pa=IDPACKAGE(pl);
5628 if ((pa->language==LANG_C)
5629 || (pa->language==LANG_MIX))
5630 {
5631 Werror("can not create package `%s` - binaries exists",plib);
5632 omFreeBinAddr(plib);
5633 return TRUE;
5634 }
5635 }
5636 omFreeBinAddr(plib);
5637 package savepack=currPack;
5638 currPack=IDPACKAGE(pl);
5639 IDPACKAGE(pl)->loaded=TRUE;
5640 char libnamebuf[1024];
5641 FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5642 BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5643 currPack=savepack;
5644 IDPACKAGE(pl)->loaded=(!bo);
5645 return bo;
5646 }
5647 case LT_BUILTIN:
5648 SModulFunc_t iiGetBuiltinModInit(const char*);
5649 return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5650 case LT_MACH_O:
5651 case LT_ELF:
5652 case LT_HPUX:
5653#ifdef HAVE_DYNAMIC_LOADING
5654 return load_modules(s, libnamebuf, autoexport);
5655#else /* HAVE_DYNAMIC_LOADING */
5656 WerrorS("Dynamic modules are not supported by this version of Singular");
5657 break;
5658#endif /* HAVE_DYNAMIC_LOADING */
5659 }
5660 return TRUE;
5661}
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:5591

◆ 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:5667

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char * s)

Definition at line 5667 of file iparith.cc.

5668{
5669 if (!iiGetLibStatus(s))
5670 {
5671 void (*WerrorS_save)(const char *s) = WerrorS_callback;
5674 BOOLEAN bo=jjLOAD(s,TRUE);
5675 if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5676 Print("loading of >%s< failed\n",s);
5677 WerrorS_callback=WerrorS_save;
5678 errorreported=0;
5679 }
5680 return FALSE;
5681}
VAR void(* WerrorS_callback)(const char *s)
Definition feFopen.cc:21
STATIC_VAR int WerrorS_dummy_cnt
Definition iparith.cc:5662
static void WerrorS_dummy(const char *)
Definition iparith.cc:5663
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 7738 of file iparith.cc.

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

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

8971{
8972 assume( e->Typ()==INT_CMD );
8973 Subexpr r=(Subexpr)omAlloc0Bin(sSubexpr_bin);
8974 r->start =(int)(long)e->Data();
8975 return r;
8976}
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 6950 of file iparith.cc.

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

◆ jjMATRIX_Ma()

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

Definition at line 6986 of file iparith.cc.

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

◆ jjMATRIX_Mo()

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

Definition at line 6973 of file iparith.cc.

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

◆ 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 case 0:
4705 res->data=(char *)n_Init(om_Info.UsedBytes,coeffs_BIGINT);
4706 break;
4707 case 1:
4708 res->data = (char *)n_Init(om_Info.CurrentBytesSystem,coeffs_BIGINT);
4709 break;
4710 case 2:
4711 res->data = (char *)n_Init(om_Info.MaxBytesSystem,coeffs_BIGINT);
4712 break;
4713 default:
4714 omPrintStats(stdout);
4715 omPrintInfo(stdout);
4716 omPrintBinStats(stdout);
4717 res->data = (char *)0;
4718 res->rtyp = NONE;
4719 }
4720 return FALSE;
4721}
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 6389 of file iparith.cc.

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

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

◆ 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:2463
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 7012 of file iparith.cc.

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

◆ jjMODULO3S()

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

Definition at line 7063 of file iparith.cc.

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

◆ jjMODULO4()

BOOLEAN jjMODULO4 ( leftv res,
leftv u )
static

Definition at line 8301 of file iparith.cc.

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

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

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

◆ jjmpTransp()

BOOLEAN jjmpTransp ( leftv res,
leftv v )
static

Definition at line 5746 of file iparith.cc.

5747{
5748 res->data = (char *)mp_Transp((matrix)v->Data(),currRing);
5749 return FALSE;
5750}
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 6585 of file iparith.cc.

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

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

◆ jjMULT()

BOOLEAN jjMULT ( leftv res,
leftv v )
static

Definition at line 4741 of file iparith.cc.

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

◆ jjN2BI()

BOOLEAN jjN2BI ( leftv res,
leftv v )
static

Definition at line 4761 of file iparith.cc.

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

◆ jjNAMEOF()

BOOLEAN jjNAMEOF ( leftv res,
leftv v )
static

Definition at line 4773 of file iparith.cc.

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

◆ jjNAMES()

BOOLEAN jjNAMES ( leftv res,
leftv v )
static

Definition at line 4786 of file iparith.cc.

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

◆ jjNAMES0()

BOOLEAN jjNAMES0 ( leftv res,
leftv  )
static

Definition at line 8368 of file iparith.cc.

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

◆ jjNAMES_I()

BOOLEAN jjNAMES_I ( leftv res,
leftv v )
static

Definition at line 4791 of file iparith.cc.

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

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

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

◆ jjnInt()

BOOLEAN jjnInt ( leftv res,
leftv u )
static

Definition at line 5781 of file iparith.cc.

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

◆ jjnlInt()

BOOLEAN jjnlInt ( leftv res,
leftv u )
static

Definition at line 5788 of file iparith.cc.

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

◆ jjNOT()

BOOLEAN jjNOT ( leftv res,
leftv v )
static

Definition at line 4796 of file iparith.cc.

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

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

4802{
4803 res->data = (char *)(long)(((ring)(v->Data()))->N);
4804 return FALSE;
4805}
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 4806 of file iparith.cc.

4807{
4808 si_link l=(si_link)v->Data();
4809 if (iiOp==OPEN_CMD) return slOpen(l, SI_LINK_OPEN,v);
4810 else { slPrepClose(l); return slClose(l);}
4811}
@ 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 5310 of file iparith.cc.

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

◆ jjOPTION_PL()

BOOLEAN jjOPTION_PL ( leftv res,
leftv v )
static

Definition at line 8373 of file iparith.cc.

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

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

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

◆ jjP2BI()

BOOLEAN jjP2BI ( leftv res,
leftv v )
static

Definition at line 4858 of file iparith.cc.

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

◆ jjP2I()

BOOLEAN jjP2I ( leftv res,
leftv v )
static

Definition at line 4878 of file iparith.cc.

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

◆ jjP2N()

BOOLEAN jjP2N ( leftv res,
leftv v )
static

Definition at line 4926 of file iparith.cc.

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

◆ jjPAR1()

BOOLEAN jjPAR1 ( leftv res,
leftv v )
static

Definition at line 4818 of file iparith.cc.

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

◆ jjPARDEG()

BOOLEAN jjPARDEG ( leftv res,
leftv v )
static

Definition at line 4834 of file iparith.cc.

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

◆ jjPARSTR1()

BOOLEAN jjPARSTR1 ( leftv res,
leftv v )
static

Definition at line 4840 of file iparith.cc.

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

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

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

◆ jjpLength()

BOOLEAN jjpLength ( leftv res,
leftv v )
static

Definition at line 5688 of file iparith.cc.

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

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

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

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

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

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

◆ jjPRIME()

BOOLEAN jjPRIME ( leftv res,
leftv v )
static

Definition at line 4896 of file iparith.cc.

4897{
4898 int i = IsPrime((int)(long)(v->Data()));
4899 res->data = (char *)(long)(i > 1 ? i : 2);
4900 return FALSE;
4901}
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 6076 of file iparith.cc.

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

◆ jjPRUNE()

BOOLEAN jjPRUNE ( leftv res,
leftv v )
static

Definition at line 4902 of file iparith.cc.

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

◆ 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:2874

◆ jjQRDS()

BOOLEAN jjQRDS ( leftv res,
leftv INPUT )
static

Definition at line 8847 of file iparith.cc.

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

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

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

◆ jjRANK1()

BOOLEAN jjRANK1 ( leftv res,
leftv v )
static

Definition at line 4964 of file iparith.cc.

4965{
4966 matrix m =(matrix)v->Data();
4967 int rank = luRank(m, 0);
4968 res->data =(char *)(long)rank;
4969 return FALSE;
4970}
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 5708 of file iparith.cc.

5709{
5710 res->data = rCharStr((ring)v->Data());
5711 return FALSE;
5712}
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 4971 of file iparith.cc.

4972{
4973 return jjREAD2(res,v,NULL);
4974}
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 7206 of file iparith.cc.

7207{
7209 if (!idIsZeroDim((ideal)v->Data()))
7210 {
7211 Werror("`%s` must be 0-dimensional",v->Name());
7212 return TRUE;
7213 }
7214 res->data = (char *)redNF((ideal)v->CopyD(),(ideal)u->CopyD(),
7215 (matrix)w->CopyD());
7216 return FALSE;
7217}
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 7194 of file iparith.cc.

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

◆ jjREDUCE3_ID()

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

Definition at line 7225 of file iparith.cc.

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

◆ jjREDUCE3_P()

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

Definition at line 7218 of file iparith.cc.

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

◆ jjREDUCE4()

BOOLEAN jjREDUCE4 ( leftv res,
leftv u )
static

Definition at line 8383 of file iparith.cc.

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

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

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

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

◆ jjREPART()

BOOLEAN jjREPART ( leftv res,
leftv v )
static

Definition at line 4980 of file iparith.cc.

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

◆ 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:2432
@ LRES_CMD
Definition tok.h:120
@ HRES_CMD
Definition tok.h:91
@ KRES_CMD
Definition tok.h:109
@ MRES_CMD
Definition tok.h:131
@ SRES_CMD
Definition tok.h:184
@ RES_CMD
Definition tok.h:169

◆ jjRES3()

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

Definition at line 7233 of file iparith.cc.

7234{
7235 int maxl=(int)v->Data();
7236 ideal u_id=(ideal)u->Data();
7237 int l=0;
7238 resolvente r;
7239 intvec **weights=NULL;
7240 int wmaxl=maxl;
7241 maxl--;
7242 unsigned save_opt=si_opt_1;
7244 if ((maxl==-1) && (iiOp!=MRES_CMD))
7245 maxl = currRing->N-1;
7246 if ((iiOp == RES_CMD) || (iiOp == MRES_CMD))
7247 {
7248 intvec * iv=(intvec*)atGet(u,"isHomog",INTVEC_CMD);
7249 if (iv!=NULL)
7250 {
7251 l=1;
7252 if (!idTestHomModule(u_id,currRing->qideal,iv))
7253 {
7254 WarnS("wrong weights");
7255 iv=NULL;
7256 }
7257 else
7258 {
7259 weights = (intvec**)omAlloc0Bin(char_ptr_bin);
7260 weights[0] = ivCopy(iv);
7261 }
7262 }
7263 r=syResolvente(u_id,maxl,&l, &weights, iiOp==MRES_CMD);
7264 }
7265 else
7266 r=sySchreyerResolvente((ideal)u->Data(),maxl+1,&l);
7267 if (r==NULL) return TRUE;
7268 int t3=u->Typ();
7269 iiMakeResolv(r,l,wmaxl,w->name,t3,weights);
7270 si_opt_1=save_opt;
7271 return FALSE;
7272}
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 8502 of file iparith.cc.

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

◆ jjRESERVEDLIST0()

BOOLEAN jjRESERVEDLIST0 ( leftv res,
leftv  )
static

Definition at line 8524 of file iparith.cc.

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

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

◆ jjRESTART()

BOOLEAN jjRESTART ( leftv ,
leftv u )
static

Definition at line 8977 of file iparith.cc.

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

◆ jjRIGHTSTD()

BOOLEAN jjRIGHTSTD ( leftv res,
leftv v )
static

Definition at line 5363 of file iparith.cc.

5364{
5365#if defined(HAVE_SHIFTBBA) || defined(HAVE_PLURAL)// do not place above jjSTD in this file because we need to reference it
5366 if (rIsLPRing(currRing))
5367 {
5369 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5370 ideal result;
5371 ideal v_id=(ideal)v->Data();
5372 /* intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD); */
5373 /* tHomog hom=testHomog; */
5374 /* if (w!=NULL) */
5375 /* { */
5376 /* if (!idTestHomModule(v_id,currRing->qideal,w)) */
5377 /* { */
5378 /* WarnS("wrong weights"); */
5379 /* w=NULL; */
5380 /* } */
5381 /* else */
5382 /* { */
5383 /* hom=isHomog; */
5384 /* w=ivCopy(w); */
5385 /* } */
5386 /* } */
5387 /* result=kStd2(v_id,currRing->qideal,hom,&w); */
5388 result = rightgb(v_id, currRing->qideal);
5389 if (errorreported) return TRUE;
5391 res->data = (char *)result;
5393 /* if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD); */
5394 return FALSE;
5395 }
5396 else if (rIsPluralRing(currRing))
5397 {
5398 ideal I=(ideal)v->Data();
5399
5400 ring A = currRing;
5401 ring Aopp = rOpposite(A);
5402 currRing = Aopp;
5403 ideal Iopp = idOppose(A, I, Aopp);
5404 ideal Jopp = kStd2(Iopp,currRing->qideal,testHomog,NULL,(bigintmat*)NULL);
5405 if (errorreported) return TRUE;
5406 currRing = A;
5407 ideal J = idOppose(Aopp, Jopp, A);
5408
5409 id_Delete(&Iopp, Aopp);
5410 id_Delete(&Jopp, Aopp);
5411 rDelete(Aopp);
5412
5413 idSkipZeroes(J);
5414 res->data = (char *)J;
5416 return FALSE;
5417 }
5418 else
5419 {
5420 return jjSTD(res, v);
5421 }
5422#else
5423 return TRUE;
5424#endif
5425}
static BOOLEAN jjSTD(leftv res, leftv v)
Definition iparith.cc:5163
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:521

◆ jjRING3()

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

Definition at line 7274 of file iparith.cc.

7275{
7276 res->data=(void *)rInit(u,v,w);
7277 return (res->data==NULL);
7278}
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 6083 of file iparith.cc.

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

◆ jjRING_LIST()

BOOLEAN jjRING_LIST ( leftv res,
leftv v )
static

Definition at line 5007 of file iparith.cc.

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

◆ jjRING_PL()

BOOLEAN jjRING_PL ( leftv res,
leftv a )
static

Definition at line 8948 of file iparith.cc.

8949{
8950 //Print("construct ring\n");
8951 if (a->Typ()!=CRING_CMD)
8952 {
8953 WerrorS("expected `cring` [ `id` ... ]");
8954 return TRUE;
8955 }
8956 assume(a->next!=NULL);
8957 leftv names=a->next;
8958 int N=names->listLength();
8959 char **n=(char**)omAlloc0(N*sizeof(char*));
8960 for(int i=0; i<N;i++,names=names->next)
8961 {
8962 n[i]=(char *)names->Name();
8963 }
8964 coeffs cf=(coeffs)a->CopyD();
8965 res->data=rDefault(cf,N,n, ringorder_dp);
8966 omFreeSize(n,N*sizeof(char*));
8967 return FALSE;
8968}
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 4985 of file iparith.cc.

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

◆ jjRINGLIST_C()

BOOLEAN jjRINGLIST_C ( leftv res,
leftv v )
static

Definition at line 5000 of file iparith.cc.

5001{
5002 coeffs r=(coeffs)v->Data();
5003 if (r!=NULL)
5004 return rDecompose_CF(res,r);
5005 return TRUE;
5006}
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 5751 of file iparith.cc.

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

◆ jjROWS()

BOOLEAN jjROWS ( leftv res,
leftv v )
static

Definition at line 5014 of file iparith.cc.

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

◆ jjROWS_BIM()

BOOLEAN jjROWS_BIM ( leftv res,
leftv v )
static

Definition at line 5020 of file iparith.cc.

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

◆ jjROWS_IV()

BOOLEAN jjROWS_IV ( leftv res,
leftv v )
static

Definition at line 5025 of file iparith.cc.

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

◆ jjRPAR()

BOOLEAN jjRPAR ( leftv res,
leftv v )
static

Definition at line 5030 of file iparith.cc.

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

◆ jjrParStr()

BOOLEAN jjrParStr ( leftv res,
leftv v )
static

Definition at line 5761 of file iparith.cc.

5762{
5763 res->data = rParStr((ring)v->Data());
5764 return FALSE;
5765}
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 5756 of file iparith.cc.

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

◆ jjS2I()

BOOLEAN jjS2I ( leftv res,
leftv v )
static

Definition at line 5035 of file iparith.cc.

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

◆ jjSBA()

BOOLEAN jjSBA ( leftv res,
leftv v )
static

Definition at line 5082 of file iparith.cc.

5083{
5084 ideal result;
5085 ideal v_id=(ideal)v->Data();
5086 intvec *w=(intvec *)atGet(v,"isHomog",INTVEC_CMD);
5087 tHomog hom=testHomog;
5088 if (w!=NULL)
5089 {
5090 if (!idTestHomModule(v_id,currRing->qideal,w))
5091 {
5092 WarnS("wrong weights");
5093 w=NULL;
5094 }
5095 else
5096 {
5097 hom=isHomog;
5098 w=ivCopy(w);
5099 }
5100 }
5101 result=kSba(v_id,currRing->qideal,hom,&w,1,0,NULL);
5102 if (errorreported) return TRUE;
5104 res->data = (char *)result;
5106 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5107 return FALSE;
5108}
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:2668

◆ jjSBA_1()

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

Definition at line 5109 of file iparith.cc.

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

◆ jjSBA_2()

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

Definition at line 5136 of file iparith.cc.

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

◆ 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:3939
void pNorm(poly p)
Definition polys.h:363

◆ jjSLIM_GB()

BOOLEAN jjSLIM_GB ( leftv res,
leftv u )
static

Definition at line 5040 of file iparith.cc.

5041{
5042 const bool bIsSCA = rIsSCA(currRing);
5043
5044 if ((currRing->qideal!=NULL) && !bIsSCA)
5045 {
5046 WerrorS("qring not supported by slimgb at the moment");
5047 return TRUE;
5048 }
5050 {
5051 WerrorS("ordering must be global for slimgb");
5052 return TRUE;
5053 }
5055 WarnS("groebner base computations with inexact coefficients can not be trusted due to rounding errors");
5056 intvec *w=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
5057 // tHomog hom=testHomog;
5058 ideal u_id=(ideal)u->Data();
5059 if (w!=NULL)
5060 {
5061 if (!idTestHomModule(u_id,currRing->qideal,w))
5062 {
5063 WarnS("wrong weights");
5064 w=NULL;
5065 }
5066 else
5067 {
5068 w=ivCopy(w);
5069 // hom=isHomog;
5070 }
5071 }
5072
5073 assume(u_id->rank>=id_RankFreeModule(u_id, currRing));
5074 res->data=(char *)t_rep_gb(currRing,
5075 u_id,u_id->rank);
5076 //res->data=(char *)t_rep_gb(currRing, u_id);
5077
5079 if (w!=NULL) atSet(res,omStrDup("isHomog"),w,INTVEC_CMD);
5080 return FALSE;
5081}
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 7114 of file iparith.cc.

7115{
7116 int mi=(int)(long)v->Data();
7117 int ni=(int)(long)w->Data();
7118 if ((mi<0)||(ni<1))
7119 {
7120 Werror("converting to smatrix: dimensions must be positive(%dx%d)",mi,ni);
7121 return TRUE;
7122 }
7123 res->data = (char *)id_ResizeModule((ideal)u->CopyD(),
7124 mi,ni,currRing);
7125 return FALSE;
7126}
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 5192 of file iparith.cc.

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

◆ jjSORTLIST()

BOOLEAN jjSORTLIST ( leftv ,
leftv arg )

Definition at line 10488 of file iparith.cc.

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

◆ jjSQR_FREE()

BOOLEAN jjSQR_FREE ( leftv res,
leftv u )
static

Definition at line 5197 of file iparith.cc.

5198{
5200 intvec *v=NULL;
5201 ideal f=singclap_sqrfree((poly)(u->CopyD()), &v, 0, currRing);
5202 if (f==NULL) return TRUE;
5203 ivTest(v);
5205 l->Init(2);
5206 l->m[0].rtyp=IDEAL_CMD;
5207 l->m[0].data=(void *)f;
5208 l->m[1].rtyp=INTVEC_CMD;
5209 l->m[1].data=(void *)v;
5210 res->data=(void *)l;
5211 return FALSE;
5212}
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 7279 of file iparith.cc.

7280{
7281 int yes;
7282 jjSTATUS2(res, u, v);
7283 yes = (strcmp((char *) res->data, (char *) w->Data()) == 0);
7284 omFreeBinAddr((ADDRESS) res->data);
7285 res->data = (void *)(long)yes;
7286 return FALSE;
7287}
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 8789 of file iparith.cc.

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

◆ jjSTD()

BOOLEAN jjSTD ( leftv res,
leftv v )
static

Definition at line 5163 of file iparith.cc.

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

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

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

◆ jjSTD_HILB_WP()

BOOLEAN jjSTD_HILB_WP ( leftv res,
leftv INPUT )
static

Definition at line 8864 of file iparith.cc.

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

◆ jjSTRING_PL()

BOOLEAN jjSTRING_PL ( leftv res,
leftv v )
static

Definition at line 8604 of file iparith.cc.

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

◆ jjstrlen()

BOOLEAN jjstrlen ( leftv res,
leftv v )
static

Definition at line 5683 of file iparith.cc.

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

◆ jjSUBST_Bu()

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

Definition at line 6836 of file iparith.cc.

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

◆ jjSUBST_Id()

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

Definition at line 6882 of file iparith.cc.

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

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

◆ jjSUBST_Id_N()

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

Definition at line 6936 of file iparith.cc.

6937{
6938 return jjSUBST_Id_X(res,u,v,w,NUMBER_CMD);
6939}

◆ jjSUBST_Id_X()

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

Definition at line 6940 of file iparith.cc.

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

◆ jjSUBST_M()

BOOLEAN jjSUBST_M ( leftv res,
leftv u )
static

Definition at line 8820 of file iparith.cc.

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

◆ jjSUBST_P()

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

Definition at line 6849 of file iparith.cc.

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

6810{
6811 monomexpr=(poly)w->Data();
6812 poly p=(poly)v->Data();
6813#if 0
6814 if (pLength(monomexpr)>1)
6815 {
6816 Werror("`%s` substitutes a ringvar only by a term",
6818 return TRUE;
6819 }
6820#endif
6821 if ((ringvar=pVar(p))==0)
6822 {
6823 if ((p!=NULL) && (currRing->cf->extRing!=NULL))
6824 {
6825 number n = pGetCoeff(p);
6826 ringvar= -n_IsParam(n, currRing);
6827 }
6828 if(ringvar==0)
6829 {
6830 WerrorS("ringvar/par expected");
6831 return TRUE;
6832 }
6833 }
6834 return FALSE;
6835}
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:836
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 5224 of file iparith.cc.

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

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

8639{
8640 do
8641 {
8642 if (v->Typ()!=INT_CMD)
8643 return TRUE;
8644 test_cmd((int)(long)v->Data());
8645 v=v->next;
8646 }
8647 while (v!=NULL);
8648 return FALSE;
8649}
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 5295 of file iparith.cc.

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

◆ jjTRANSP_BIM()

BOOLEAN jjTRANSP_BIM ( leftv res,
leftv v )
static

Definition at line 5300 of file iparith.cc.

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

◆ jjTRANSP_IV()

BOOLEAN jjTRANSP_IV ( leftv res,
leftv v )
static

Definition at line 5305 of file iparith.cc.

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

◆ jjTWOSTD()

BOOLEAN jjTWOSTD ( leftv res,
leftv a )
static

Definition at line 5344 of file iparith.cc.

5345{
5346#ifdef HAVE_PLURAL
5347 ideal result;
5348 ideal v_id=(ideal)a->Data();
5350 result=(ideal)twostd(v_id);
5351 else /*commutative or shiftalgebra*/
5352 {
5353 return jjSTD(res,a);
5354 }
5355 res->data = (char *)result;
5358 return FALSE;
5359#else
5360 return TRUE;
5361#endif
5362}
#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 5426 of file iparith.cc.

5427{
5428 int t=(int)(long)v->data;
5429 switch (t)
5430 {
5431 case CRING_CMD:
5432 case INT_CMD:
5433 case POLY_CMD:
5434 case VECTOR_CMD:
5435 case STRING_CMD:
5436 case INTVEC_CMD:
5437 case IDEAL_CMD:
5438 case MATRIX_CMD:
5439 case MODUL_CMD:
5440 case MAP_CMD:
5441 case PROC_CMD:
5442 case RING_CMD:
5443 case SMATRIX_CMD:
5444 //case QRING_CMD:
5445 case INTMAT_CMD:
5446 case BIGINTMAT_CMD:
5447 case BIGINTVEC_CMD:
5448 case NUMBER_CMD:
5449 #ifdef SINGULAR_4_2
5450 case CNUMBER_CMD:
5451 #endif
5452 case BIGINT_CMD:
5453 case BUCKET_CMD:
5454 case LIST_CMD:
5455 case PACKAGE_CMD:
5456 case LINK_CMD:
5457 case RESOLUTION_CMD:
5458 #ifdef HTABLE
5459 case HTABLE_CMD:
5460 #endif
5461 res->data=omStrDup(Tok2Cmdname(t)); break;
5462 case DEF_CMD:
5463 case NONE: res->data=omStrDup("none"); break;
5464 default:
5465 {
5466 if (t>MAX_TOK)
5467 res->data=omStrDup(getBlackboxName(t));
5468 else
5469 res->data=omStrDup("?unknown type?");
5470 break;
5471 }
5472 }
5473 return FALSE;
5474}
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 10497 of file iparith.cc.

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

◆ jjUNIVARIATE()

BOOLEAN jjUNIVARIATE ( leftv res,
leftv v )
static

Definition at line 5475 of file iparith.cc.

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

◆ jjVAR1()

BOOLEAN jjVAR1 ( leftv res,
leftv v )
static

Definition at line 5480 of file iparith.cc.

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

◆ jjVARSTR1()

BOOLEAN jjVARSTR1 ( leftv res,
leftv v )
static

Definition at line 5497 of file iparith.cc.

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

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

5515{
5517#ifdef HAVE_SHIFTBBA
5518 if (rIsLPRing(currRing))
5519 {
5521 {
5522 WerrorS("`vdim` is not implemented for letterplace rings over rings");
5523 return TRUE;
5524 }
5525 if (currRing->qideal != NULL)
5526 {
5527 WerrorS("qring not supported by `vdim` for letterplace rings at the moment");
5528 return TRUE;
5529 }
5530 int kDim = lp_kDim((ideal)(v->Data()));
5531 res->data = (char *)(long)kDim;
5532 return (kDim == -2);
5533 }
5534#endif
5535 long l=scMult0Int((ideal)v->Data(),currRing->qideal);
5536 if (l<-1L)
5537 WerrorS("int overflow in vdim");
5538 res->data = (char *)l;
5539 return FALSE;
5540}
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 5541 of file iparith.cc.

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

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

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

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

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

◆ WerrorS_dummy()

void WerrorS_dummy ( const char * )
static

Definition at line 5663 of file iparith.cc.

5664{
5666}

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

◆ WerrorS_dummy_cnt

STATIC_VAR int WerrorS_dummy_cnt =0

Definition at line 5662 of file iparith.cc.