My Project  UNKNOWN_GIT_VERSION
Data Structures | Typedefs | Functions | Variables
ipshell.h File Reference
#include <stdio.h>
#include "kernel/ideals.h"
#include "Singular/lists.h"
#include "Singular/fevoices.h"

Go to the source code of this file.

Data Structures

struct  sValCmd1
 
struct  sValCmd2
 
struct  sValCmd3
 
struct  sValCmdM
 
struct  sValAssign_sys
 
struct  sValAssign
 

Typedefs

typedef BOOLEAN(* proc1) (leftv, leftv)
 
typedef BOOLEAN(* proc2) (leftv, leftv, leftv)
 
typedef BOOLEAN(* proc3) (leftv, leftv, leftv, leftv)
 
typedef BOOLEAN(* proci) (leftv, leftv, Subexpr)
 

Functions

BOOLEAN spectrumProc (leftv, leftv)
 
BOOLEAN spectrumfProc (leftv, leftv)
 
BOOLEAN spaddProc (leftv, leftv, leftv)
 
BOOLEAN spmulProc (leftv, leftv, leftv)
 
BOOLEAN semicProc (leftv, leftv, leftv)
 
BOOLEAN semicProc3 (leftv, leftv, leftv, leftv)
 
BOOLEAN iiAssignCR (leftv, leftv)
 
BOOLEAN iiARROW (leftv, char *, char *)
 
int IsCmd (const char *n, int &tok)
 
BOOLEAN iiPStart (idhdl pn, leftv sl)
 
BOOLEAN iiEStart (char *example, procinfo *pi)
 
BOOLEAN iiAllStart (procinfov pi, char *p, feBufferTypes t, int l)
 
void type_cmd (leftv v)
 
void test_cmd (int i)
 
void list_cmd (int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname=FALSE)
 
void killlocals (int v)
 
int exprlist_length (leftv v)
 
const char * Tok2Cmdname (int i)
 
const char * iiTwoOps (int t)
 
int iiOpsTwoChar (const char *s)
 
BOOLEAN iiWRITE (leftv res, leftv exprlist)
 
BOOLEAN iiExport (leftv v, int toLev)
 
BOOLEAN iiExport (leftv v, int toLev, package pack)
 
BOOLEAN iiInternalExport (leftv v, int toLev, package pack)
 
static char * iiGetLibName (const procinfov pi)
 find the library of an proc More...
 
char * iiGetLibProcBuffer (procinfov pi, int part=1)
 
char * iiProcName (char *buf, char &ct, char *&e)
 
char * iiProcArgs (char *e, BOOLEAN withParenth)
 
BOOLEAN iiLibCmd (char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
 
BOOLEAN jjLOAD (const char *s, BOOLEAN autoexport=FALSE)
 load lib/module given in v More...
 
BOOLEAN jjLOAD_TRY (const char *s)
 
BOOLEAN iiLocateLib (const char *lib, char *where)
 
leftv iiMap (map theMap, const char *what)
 
void iiMakeResolv (resolvente r, int length, int rlen, char *name, int typ0, intvec **weights=NULL)
 
BOOLEAN jjMINRES (leftv res, leftv v)
 
BOOLEAN jjBETTI (leftv res, leftv v)
 
BOOLEAN jjBETTI2 (leftv res, leftv u, leftv v)
 
BOOLEAN jjBETTI2_ID (leftv res, leftv u, leftv v)
 
BOOLEAN jjIMPORTFROM (leftv res, leftv u, leftv v)
 
BOOLEAN jjLIST_PL (leftv res, leftv v)
 
BOOLEAN jjVARIABLES_P (leftv res, leftv u)
 
BOOLEAN jjVARIABLES_ID (leftv res, leftv u)
 
int iiRegularity (lists L)
 
leftv singular_system (sleftv h)
 
BOOLEAN jjSYSTEM (leftv res, leftv v)
 
void iiDebug ()
 
BOOLEAN iiCheckRing (int i)
 
poly iiHighCorner (ideal i, int ak)
 
char * iiConvName (const char *libname)
 
BOOLEAN iiLoadLIB (FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
 
lists syConvRes (syStrategy syzstr, BOOLEAN toDel=FALSE, int add_row_shift=0)
 
syStrategy syForceMin (lists li)
 
syStrategy syConvList (lists li)
 
BOOLEAN syBetti1 (leftv res, leftv u)
 
BOOLEAN syBetti2 (leftv res, leftv u, leftv w)
 
BOOLEAN iiExprArith1 (leftv res, sleftv *a, int op)
 
BOOLEAN iiExprArith2 (leftv res, sleftv *a, int op, sleftv *b, BOOLEAN proccall=FALSE)
 
BOOLEAN iiExprArith3 (leftv res, int op, leftv a, leftv b, leftv c)
 
BOOLEAN iiExprArithM (leftv res, sleftv *a, int op)
 
BOOLEAN iiApply (leftv res, leftv a, int op, leftv proc)
 
BOOLEAN iiAssign (leftv left, leftv right, BOOLEAN toplevel=TRUE)
 
BOOLEAN iiParameter (leftv p)
 
BOOLEAN iiAlias (leftv p)
 
int iiTokType (int op)
 
int iiDeclCommand (leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring=FALSE, BOOLEAN init_b=TRUE)
 
BOOLEAN iiMake_proc (idhdl pn, package pack, leftv sl)
 
void * iiCallLibProc1 (const char *n, void *arg, int arg_type, BOOLEAN &err)
 
void * iiCallLibProcM (const char *n, void **args, int *arg_types, BOOLEAN &err)
 args: NULL terminated arry of arguments arg_types: 0 terminated array of corresponding types More...
 
char * showOption ()
 
BOOLEAN setOption (leftv res, leftv v)
 
char * versionString ()
 
void singular_example (char *str)
 
BOOLEAN iiTryLoadLib (leftv v, const char *id)
 
int iiAddCproc (const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
 
void iiCheckPack (package &p)
 
void rSetHdl (idhdl h)
 
ring rInit (leftv pn, leftv rv, leftv ord)
 
idhdl rDefault (const char *s)
 
idhdl rSimpleFindHdl (ring r, idhdl root, idhdl n=NULL)
 
idhdl rFindHdl (ring r, idhdl n)
 
void rKill (idhdl h)
 
void rKill (ring r)
 
lists scIndIndset (ideal S, BOOLEAN all, ideal Q)
 
BOOLEAN mpKoszul (leftv res, leftv c, leftv b, leftv id)
 
BOOLEAN mpJacobi (leftv res, leftv a)
 
BOOLEAN jjRESULTANT (leftv res, leftv u, leftv v, leftv w)
 
BOOLEAN kQHWeight (leftv res, leftv v)
 
BOOLEAN kWeight (leftv res, leftv id)
 
BOOLEAN loSimplex (leftv res, leftv args)
 Implementation of the Simplex Algorithm. More...
 
BOOLEAN loNewtonP (leftv res, leftv arg1)
 compute Newton Polytopes of input polynomials More...
 
BOOLEAN nuMPResMat (leftv res, leftv arg1, leftv arg2)
 returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default) More...
 
BOOLEAN nuLagSolve (leftv res, leftv arg1, leftv arg2, leftv arg3)
 find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver. More...
 
BOOLEAN nuVanderSys (leftv res, leftv arg1, leftv arg2, leftv arg3)
 COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d. More...
 
BOOLEAN nuUResSolve (leftv res, leftv args)
 solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal). More...
 
BOOLEAN jjCHARSERIES (leftv res, leftv u)
 
void paPrint (const char *n, package p)
 
BOOLEAN iiTestAssume (leftv a, leftv b)
 
BOOLEAN iiExprArith1Tab (leftv res, leftv a, int op, const struct sValCmd1 *dA1, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, const struct sValCmd2 *dA2, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a and a->next return TRUE on failure More...
 
BOOLEAN iiExprArith3Tab (leftv res, leftv a, int op, const struct sValCmd3 *dA3, int at, const struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to arguments a, a->next and a->next->next return TRUE on failure More...
 
BOOLEAN iiCheckTypes (leftv args, const short *type_list, int report=0)
 check a list of arguemys against a given field of types return TRUE if the types match return FALSE (and, if report) report an error via Werror otherwise More...
 
BOOLEAN iiBranchTo (leftv r, leftv args)
 
lists rDecompose (const ring r)
 
lists rDecompose_list_cf (const ring r)
 
BOOLEAN rDecompose_CF (leftv res, const coeffs C)
 
ring rCompose (const lists L, const BOOLEAN check_comp=TRUE, const long bitmask=0x7fff, const int isLetterplace=FALSE)
 

Variables

leftv iiCurrArgs
 
idhdl iiCurrProc
 
int iiOp
 
const char * currid
 
int iiRETURNEXPR_len
 
sleftv iiRETURNEXPR
 
ring * iiLocalRing
 
const char * lastreserved
 
int myynest
 
int printlevel
 
int si_echo
 
BOOLEAN yyInRingConstruction
 
const struct sValCmd2 dArith2 []
 
const struct sValCmd1 dArith1 []
 
const struct sValCmd3 dArith3 []
 
const struct sValCmdM dArithM []
 

Data Structure Documentation

◆ sValCmd1

struct sValCmd1

Definition at line 78 of file gentable.cc.

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

◆ sValCmd2

struct sValCmd2

Definition at line 69 of file gentable.cc.

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

◆ sValCmd3

struct sValCmd3

Definition at line 86 of file gentable.cc.

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

◆ sValCmdM

struct sValCmdM

Definition at line 96 of file gentable.cc.

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

◆ sValAssign_sys

struct sValAssign_sys

Definition at line 104 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res

◆ sValAssign

struct sValAssign

Definition at line 111 of file gentable.cc.

Data Fields
short arg
int p
proci p
short res

Typedef Documentation

◆ proc1

typedef BOOLEAN(* proc1) (leftv, leftv)

Definition at line 121 of file ipshell.h.

◆ proc2

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

Definition at line 133 of file ipshell.h.

◆ proc3

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

Definition at line 144 of file ipshell.h.

◆ proci

typedef BOOLEAN(* proci) (leftv, leftv, Subexpr)

Definition at line 173 of file ipshell.h.

Function Documentation

◆ exprlist_length()

int exprlist_length ( leftv  v)

Definition at line 549 of file ipshell.cc.

550 {
551  int rc = 0;
552  while (v!=NULL)
553  {
554  switch (v->Typ())
555  {
556  case INT_CMD:
557  case POLY_CMD:
558  case VECTOR_CMD:
559  case NUMBER_CMD:
560  rc++;
561  break;
562  case INTVEC_CMD:
563  case INTMAT_CMD:
564  rc += ((intvec *)(v->Data()))->length();
565  break;
566  case MATRIX_CMD:
567  case IDEAL_CMD:
568  case MODUL_CMD:
569  {
570  matrix mm = (matrix)(v->Data());
571  rc += mm->rows() * mm->cols();
572  }
573  break;
574  case LIST_CMD:
575  rc+=((lists)v->Data())->nr+1;
576  break;
577  default:
578  rc++;
579  }
580  v = v->next;
581  }
582  return rc;
583 }

◆ iiAddCproc()

int iiAddCproc ( const char *  libname,
const char *  procname,
BOOLEAN  pstatic,
BOOLEAN(*)(leftv res, leftv v func 
)

Definition at line 1005 of file iplib.cc.

1007 {
1008  procinfov pi;
1009  idhdl h;
1010 
1011  #ifndef SING_NDEBUG
1012  int dummy;
1013  if (IsCmd(procname,dummy))
1014  {
1015  Werror(">>%s< is a reserved name",procname);
1016  return 0;
1017  }
1018  #endif
1019 
1020  h=IDROOT->get(procname,0);
1021  if ((h!=NULL)
1022  && (IDTYP(h)==PROC_CMD))
1023  {
1024  pi = IDPROC(h);
1025  if ((pi->language == LANG_SINGULAR)
1026  &&(BVERBOSE(V_REDEFINE)))
1027  Warn("extend `%s`",procname);
1028  }
1029  else
1030  {
1031  h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
1032  }
1033  if ( h!= NULL )
1034  {
1035  pi = IDPROC(h);
1036  if((pi->language == LANG_SINGULAR)
1037  ||(pi->language == LANG_NONE))
1038  {
1039  omfree(pi->libname);
1040  pi->libname = omStrDup(libname);
1041  omfree(pi->procname);
1042  pi->procname = omStrDup(procname);
1043  pi->language = LANG_C;
1044  pi->ref = 1;
1045  pi->is_static = pstatic;
1046  pi->data.o.function = func;
1047  }
1048  else if(pi->language == LANG_C)
1049  {
1050  if(pi->data.o.function == func)
1051  {
1052  pi->ref++;
1053  }
1054  else
1055  {
1056  omfree(pi->libname);
1057  pi->libname = omStrDup(libname);
1058  omfree(pi->procname);
1059  pi->procname = omStrDup(procname);
1060  pi->language = LANG_C;
1061  pi->ref = 1;
1062  pi->is_static = pstatic;
1063  pi->data.o.function = func;
1064  }
1065  }
1066  else
1067  Warn("internal error: unknown procedure type %d",pi->language);
1068  if (currPack->language==LANG_SINGULAR) currPack->language=LANG_MIX;
1069  return(1);
1070  }
1071  else
1072  {
1073  WarnS("iiAddCproc: failed.");
1074  }
1075  return(0);
1076 }

◆ iiAlias()

BOOLEAN iiAlias ( leftv  p)

Definition at line 765 of file ipid.cc.

766 {
767  if (iiCurrArgs==NULL)
768  {
769  Werror("not enough arguments for proc %s",VoiceName());
770  p->CleanUp();
771  return TRUE;
772  }
774  iiCurrArgs=h->next;
775  h->next=NULL;
776  if (h->rtyp!=IDHDL)
777  {
779  h->CleanUp();
781  return res;
782  }
783  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
784  {
785  WerrorS("type mismatch");
786  return TRUE;
787  }
788  idhdl pp=(idhdl)p->data;
789  switch(pp->typ)
790  {
791  case CRING_CMD:
792  nKillChar((coeffs)pp);
793  break;
794  case DEF_CMD:
795  case INT_CMD:
796  break;
797  case INTVEC_CMD:
798  case INTMAT_CMD:
799  delete IDINTVEC(pp);
800  break;
801  case NUMBER_CMD:
802  nDelete(&IDNUMBER(pp));
803  break;
804  case BIGINT_CMD:
806  break;
807  case MAP_CMD:
808  {
809  map im = IDMAP(pp);
810  omFree((ADDRESS)im->preimage);
811  }
812  // continue as ideal:
813  case IDEAL_CMD:
814  case MODUL_CMD:
815  case MATRIX_CMD:
816  idDelete(&IDIDEAL(pp));
817  break;
818  case PROC_CMD:
819  case RESOLUTION_CMD:
820  case STRING_CMD:
822  break;
823  case LIST_CMD:
824  IDLIST(pp)->Clean();
825  break;
826  case LINK_CMD:
828  break;
829  // case ring: cannot happen
830  default:
831  Werror("unknown type %d",p->Typ());
832  return TRUE;
833  }
834  pp->typ=ALIAS_CMD;
835  IDDATA(pp)=(char*)h->data;
836  int eff_typ=h->Typ();
837  if ((RingDependend(eff_typ))
838  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
839  {
840  ipSwapId(pp,IDROOT,currRing->idroot);
841  }
842  h->CleanUp();
844  return FALSE;
845 }

◆ iiAllStart()

BOOLEAN iiAllStart ( procinfov  pi,
char *  p,
feBufferTypes  t,
int  l 
)

Definition at line 293 of file iplib.cc.

294 {
295  // see below:
296  BITSET save1=si_opt_1;
297  BITSET save2=si_opt_2;
298  newBuffer( omStrDup(p /*pi->data.s.body*/), t /*BT_proc*/,
299  pi, l );
300  BOOLEAN err=yyparse();
301  if (sLastPrinted.rtyp!=0)
302  {
304  }
305  // the access to optionStruct and verboseStruct do not work
306  // on x86_64-Linux for pic-code
307  if ((TEST_V_ALLWARN) &&
308  (t==BT_proc) &&
309  ((save1!=si_opt_1)||(save2!=si_opt_2)) &&
310  (pi->libname!=NULL) && (pi->libname[0]!='\0'))
311  {
312  if ((pi->libname!=NULL) && (pi->libname[0]!='\0'))
313  Warn("option changed in proc %s from %s",pi->procname,pi->libname);
314  else
315  Warn("option changed in proc %s",pi->procname);
316  int i;
317  for (i=0; optionStruct[i].setval!=0; i++)
318  {
319  if ((optionStruct[i].setval & si_opt_1)
320  && (!(optionStruct[i].setval & save1)))
321  {
322  Print(" +%s",optionStruct[i].name);
323  }
324  if (!(optionStruct[i].setval & si_opt_1)
325  && ((optionStruct[i].setval & save1)))
326  {
327  Print(" -%s",optionStruct[i].name);
328  }
329  }
330  for (i=0; verboseStruct[i].setval!=0; i++)
331  {
332  if ((verboseStruct[i].setval & si_opt_2)
333  && (!(verboseStruct[i].setval & save2)))
334  {
335  Print(" +%s",verboseStruct[i].name);
336  }
337  if (!(verboseStruct[i].setval & si_opt_2)
338  && ((verboseStruct[i].setval & save2)))
339  {
340  Print(" -%s",verboseStruct[i].name);
341  }
342  }
343  PrintLn();
344  }
345  return err;
346 }

◆ iiApply()

BOOLEAN iiApply ( leftv  res,
leftv  a,
int  op,
leftv  proc 
)

Definition at line 6407 of file ipshell.cc.

6408 {
6409  memset(res,0,sizeof(sleftv));
6410  res->rtyp=a->Typ();
6411  switch (res->rtyp /*a->Typ()*/)
6412  {
6413  case INTVEC_CMD:
6414  case INTMAT_CMD:
6415  return iiApplyINTVEC(res,a,op,proc);
6416  case BIGINTMAT_CMD:
6417  return iiApplyBIGINTMAT(res,a,op,proc);
6418  case IDEAL_CMD:
6419  case MODUL_CMD:
6420  case MATRIX_CMD:
6421  return iiApplyIDEAL(res,a,op,proc);
6422  case LIST_CMD:
6423  return iiApplyLIST(res,a,op,proc);
6424  }
6425  WerrorS("first argument to `apply` must allow an index");
6426  return TRUE;
6427 }

◆ iiARROW()

BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6456 of file ipshell.cc.

6457 {
6458  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6459  // find end of s:
6460  int end_s=strlen(s);
6461  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6462  s[end_s+1]='\0';
6463  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6464  sprintf(name,"%s->%s",a,s);
6465  // find start of last expression
6466  int start_s=end_s-1;
6467  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6468  if (start_s<0) // ';' not found
6469  {
6470  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6471  }
6472  else // s[start_s] is ';'
6473  {
6474  s[start_s]='\0';
6475  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6476  }
6477  memset(r,0,sizeof(*r));
6478  // now produce procinfo for PROC_CMD:
6479  r->data = (void *)omAlloc0Bin(procinfo_bin);
6480  ((procinfo *)(r->data))->language=LANG_NONE;
6481  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6482  ((procinfo *)r->data)->data.s.body=ss;
6483  omFree(name);
6484  r->rtyp=PROC_CMD;
6485  //r->rtyp=STRING_CMD;
6486  //r->data=ss;
6487  return FALSE;
6488 }

◆ iiAssign()

BOOLEAN iiAssign ( leftv  left,
leftv  right,
BOOLEAN  toplevel = TRUE 
)

Definition at line 1819 of file ipassign.cc.

1820 {
1821  if (errorreported) return TRUE;
1822  int ll=l->listLength();
1823  int rl;
1824  int lt=l->Typ();
1825  int rt=NONE;
1826  BOOLEAN b;
1827  if (l->rtyp==ALIAS_CMD)
1828  {
1829  Werror("`%s` is read-only",l->Name());
1830  }
1831 
1832  if (l->rtyp==IDHDL)
1833  {
1834  atKillAll((idhdl)l->data);
1835  IDFLAG((idhdl)l->data)=0;
1836  l->attribute=NULL;
1837  toplevel=FALSE;
1838  }
1839  else if (l->attribute!=NULL)
1840  atKillAll((idhdl)l);
1841  l->flag=0;
1842  if (ll==1)
1843  {
1844  /* l[..] = ... */
1845  if(l->e!=NULL)
1846  {
1847  BOOLEAN like_lists=0;
1848  blackbox *bb=NULL;
1849  int bt;
1850  if (((bt=l->rtyp)>MAX_TOK)
1851  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1852  {
1853  bb=getBlackboxStuff(bt);
1854  like_lists=BB_LIKE_LIST(bb); // bb like a list
1855  }
1856  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1857  || (l->rtyp==LIST_CMD))
1858  {
1859  like_lists=2; // bb in a list
1860  }
1861  if(like_lists)
1862  {
1863  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1864  if (like_lists==1)
1865  {
1866  // check blackbox/newtype type:
1867  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1868  }
1869  b=jiAssign_list(l,r);
1870  if((!b) && (like_lists==2))
1871  {
1872  //Print("jjA_L_LIST: - 2 \n");
1873  if((l->rtyp==IDHDL) && (l->data!=NULL))
1874  {
1875  ipMoveId((idhdl)l->data);
1876  l->attribute=IDATTR((idhdl)l->data);
1877  l->flag=IDFLAG((idhdl)l->data);
1878  }
1879  }
1880  r->CleanUp();
1881  Subexpr h;
1882  while (l->e!=NULL)
1883  {
1884  h=l->e->next;
1886  l->e=h;
1887  }
1888  return b;
1889  }
1890  }
1891  if (lt>MAX_TOK)
1892  {
1893  blackbox *bb=getBlackboxStuff(lt);
1894 #ifdef BLACKBOX_DEVEL
1895  Print("bb-assign: bb=%lx\n",bb);
1896 #endif
1897  return (bb==NULL) || bb->blackbox_Assign(l,r);
1898  }
1899  // end of handling elems of list and similar
1900  rl=r->listLength();
1901  if (rl==1)
1902  {
1903  /* system variables = ... */
1904  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1905  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1906  {
1907  b=iiAssign_sys(l,r);
1908  r->CleanUp();
1909  //l->CleanUp();
1910  return b;
1911  }
1912  rt=r->Typ();
1913  /* a = ... */
1914  if ((lt!=MATRIX_CMD)
1915  &&(lt!=BIGINTMAT_CMD)
1916  &&(lt!=CMATRIX_CMD)
1917  &&(lt!=INTMAT_CMD)
1918  &&((lt==rt)||(lt!=LIST_CMD)))
1919  {
1920  b=jiAssign_1(l,r,toplevel);
1921  if (l->rtyp==IDHDL)
1922  {
1923  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1924  {
1925  ipMoveId((idhdl)l->data);
1926  }
1927  l->attribute=IDATTR((idhdl)l->data);
1928  l->flag=IDFLAG((idhdl)l->data);
1929  l->CleanUp();
1930  }
1931  r->CleanUp();
1932  return b;
1933  }
1934  if (((lt!=LIST_CMD)
1935  &&((rt==MATRIX_CMD)
1936  ||(rt==BIGINTMAT_CMD)
1937  ||(rt==CMATRIX_CMD)
1938  ||(rt==INTMAT_CMD)
1939  ||(rt==INTVEC_CMD)
1940  ||(rt==MODUL_CMD)))
1941  ||((lt==LIST_CMD)
1942  &&(rt==RESOLUTION_CMD))
1943  )
1944  {
1945  b=jiAssign_1(l,r,toplevel);
1946  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1947  {
1948  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1949  {
1950  //Print("ipAssign - 3.0\n");
1951  ipMoveId((idhdl)l->data);
1952  }
1953  l->attribute=IDATTR((idhdl)l->data);
1954  l->flag=IDFLAG((idhdl)l->data);
1955  }
1956  r->CleanUp();
1957  Subexpr h;
1958  while (l->e!=NULL)
1959  {
1960  h=l->e->next;
1962  l->e=h;
1963  }
1964  return b;
1965  }
1966  }
1967  if (rt==NONE) rt=r->Typ();
1968  }
1969  else if (ll==(rl=r->listLength()))
1970  {
1971  b=jiAssign_rec(l,r);
1972  return b;
1973  }
1974  else
1975  {
1976  if (rt==NONE) rt=r->Typ();
1977  if (rt==INTVEC_CMD)
1978  return jiA_INTVEC_L(l,r);
1979  else if (rt==VECTOR_CMD)
1980  return jiA_VECTOR_L(l,r);
1981  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1982  return jiA_MATRIX_L(l,r);
1983  else if ((rt==STRING_CMD)&&(rl==1))
1984  return jiA_STRING_L(l,r);
1985  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1986  ll,rl);
1987  return TRUE;
1988  }
1989 
1990  leftv hh=r;
1991  BOOLEAN nok=FALSE;
1992  BOOLEAN map_assign=FALSE;
1993  switch (lt)
1994  {
1995  case INTVEC_CMD:
1996  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1997  break;
1998  case INTMAT_CMD:
1999  {
2000  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
2001  break;
2002  }
2003  case BIGINTMAT_CMD:
2004  {
2005  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
2006  break;
2007  }
2008  case MAP_CMD:
2009  {
2010  // first element in the list sl (r) must be a ring
2011  if ((rt == RING_CMD)&&(r->e==NULL))
2012  {
2013  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
2014  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
2015  /* advance the expressionlist to get the next element after the ring */
2016  hh = r->next;
2017  }
2018  else
2019  {
2020  WerrorS("expected ring-name");
2021  nok=TRUE;
2022  break;
2023  }
2024  if (hh==NULL) /* map-assign: map f=r; */
2025  {
2026  WerrorS("expected image ideal");
2027  nok=TRUE;
2028  break;
2029  }
2030  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
2031  {
2032  BOOLEAN bo=jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
2033  omFreeBin(hh,sleftv_bin);
2034  return bo;
2035  }
2036  //no break, handle the rest like an ideal:
2037  map_assign=TRUE;
2038  }
2039  case MATRIX_CMD:
2040  case IDEAL_CMD:
2041  case MODUL_CMD:
2042  {
2043  sleftv t;
2044  matrix olm = (matrix)l->Data();
2045  int rk;
2046  char *pr=((map)olm)->preimage;
2047  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
2048  matrix lm ;
2049  int num;
2050  int j,k;
2051  int i=0;
2052  int mtyp=MATRIX_CMD; /*Type of left side object*/
2053  int etyp=POLY_CMD; /*Type of elements of left side object*/
2054 
2055  if (lt /*l->Typ()*/==MATRIX_CMD)
2056  {
2057  rk=olm->rows();
2058  num=olm->cols()*rk /*olm->rows()*/;
2059  lm=mpNew(olm->rows(),olm->cols());
2060  int el;
2061  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2062  {
2063  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2064  }
2065  }
2066  else /* IDEAL_CMD or MODUL_CMD */
2067  {
2068  num=exprlist_length(hh);
2069  lm=(matrix)idInit(num,1);
2070  if (module_assign)
2071  {
2072  rk=0;
2073  mtyp=MODUL_CMD;
2074  etyp=VECTOR_CMD;
2075  }
2076  else
2077  rk=1;
2078  }
2079 
2080  int ht;
2081  loop
2082  {
2083  if (hh==NULL)
2084  break;
2085  else
2086  {
2087  matrix rm;
2088  ht=hh->Typ();
2089  if ((j=iiTestConvert(ht,etyp))!=0)
2090  {
2091  nok=iiConvert(ht,etyp,j,hh,&t);
2092  hh->next=t.next;
2093  if (nok) break;
2094  lm->m[i]=(poly)t.CopyD(etyp);
2095  pNormalize(lm->m[i]);
2096  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
2097  i++;
2098  }
2099  else
2100  if ((j=iiTestConvert(ht,mtyp))!=0)
2101  {
2102  nok=iiConvert(ht,mtyp,j,hh,&t);
2103  hh->next=t.next;
2104  if (nok) break;
2105  rm = (matrix)t.CopyD(mtyp);
2106  if (module_assign)
2107  {
2108  j = si_min(num,rm->cols());
2109  rk=si_max(rk,(int)rm->rank);
2110  }
2111  else
2112  j = si_min(num-i,rm->rows() * rm->cols());
2113  for(k=0;k<j;k++,i++)
2114  {
2115  lm->m[i]=rm->m[k];
2116  pNormalize(lm->m[i]);
2117  rm->m[k]=NULL;
2118  }
2119  idDelete((ideal *)&rm);
2120  }
2121  else
2122  {
2123  nok=TRUE;
2124  break;
2125  }
2126  t.next=NULL;t.CleanUp();
2127  if (i==num) break;
2128  hh=hh->next;
2129  }
2130  }
2131  if (nok)
2132  idDelete((ideal *)&lm);
2133  else
2134  {
2135  idDelete((ideal *)&olm);
2136  if (module_assign) lm->rank=rk;
2137  else if (map_assign) ((map)lm)->preimage=pr;
2138  l=l->LData();
2139  if (l->rtyp==IDHDL)
2140  IDMATRIX((idhdl)l->data)=lm;
2141  else
2142  l->data=(char *)lm;
2143  }
2144  break;
2145  }
2146  case STRING_CMD:
2147  nok=jjA_L_STRING(l,r);
2148  break;
2149  //case DEF_CMD:
2150  case LIST_CMD:
2151  nok=jjA_L_LIST(l,r);
2152  break;
2153  case NONE:
2154  case 0:
2155  Werror("cannot assign to %s",l->Fullname());
2156  nok=TRUE;
2157  break;
2158  default:
2159  WerrorS("assign not impl.");
2160  nok=TRUE;
2161  break;
2162  } /* end switch: typ */
2163  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
2164  r->CleanUp();
2165  return nok;
2166 }

◆ iiAssignCR()

BOOLEAN iiAssignCR ( leftv  ,
leftv   
)

Definition at line 6490 of file ipshell.cc.

6491 {
6492  char* ring_name=omStrDup((char*)r->Name());
6493  int t=arg->Typ();
6494  if (t==RING_CMD)
6495  {
6496  sleftv tmp;
6497  memset(&tmp,0,sizeof(tmp));
6498  tmp.rtyp=IDHDL;
6499  tmp.data=(char*)rDefault(ring_name);
6500  if (tmp.data!=NULL)
6501  {
6502  BOOLEAN b=iiAssign(&tmp,arg);
6503  if (b) return TRUE;
6504  rSetHdl(ggetid(ring_name));
6505  omFree(ring_name);
6506  return FALSE;
6507  }
6508  else
6509  return TRUE;
6510  }
6511  else if (t==CRING_CMD)
6512  {
6513  sleftv tmp;
6514  sleftv n;
6515  memset(&n,0,sizeof(n));
6516  n.name=ring_name;
6517  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6518  if (iiAssign(&tmp,arg)) return TRUE;
6519  //Print("create %s\n",r->Name());
6520  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6521  return FALSE;
6522  }
6523  //Print("create %s\n",r->Name());
6524  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6525  return TRUE;// not handled -> error for now
6526 }

◆ iiBranchTo()

BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1184 of file ipshell.cc.

1185 {
1186  // must be inside a proc, as we simultae an proc_end at the end
1187  if (myynest==0)
1188  {
1189  WerrorS("branchTo can only occur in a proc");
1190  return TRUE;
1191  }
1192  // <string1...stringN>,<proc>
1193  // known: args!=NULL, l>=1
1194  int l=args->listLength();
1195  int ll=0;
1196  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1197  if (ll!=(l-1)) return FALSE;
1198  leftv h=args;
1199  // set up the table for type test:
1200  short *t=(short*)omAlloc(l*sizeof(short));
1201  t[0]=l-1;
1202  int b;
1203  int i;
1204  for(i=1;i<l;i++,h=h->next)
1205  {
1206  if (h->Typ()!=STRING_CMD)
1207  {
1208  omFree(t);
1209  Werror("arg %d is not a string",i);
1210  return TRUE;
1211  }
1212  int tt;
1213  b=IsCmd((char *)h->Data(),tt);
1214  if(b) t[i]=tt;
1215  else
1216  {
1217  omFree(t);
1218  Werror("arg %d is not a type name",i);
1219  return TRUE;
1220  }
1221  }
1222  if (h->Typ()!=PROC_CMD)
1223  {
1224  omFree(t);
1225  Werror("last(%d.) arg.(%s) is not a proc(but %s(%d)), nesting=%d",
1226  i,h->name,Tok2Cmdname(h->Typ()),h->Typ(),myynest);
1227  return TRUE;
1228  }
1229  b=iiCheckTypes(iiCurrArgs,t,0);
1230  omFree(t);
1231  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1232  {
1233  // get the proc:
1234  iiCurrProc=(idhdl)h->data;
1236  // already loaded ?
1237  if( pi->data.s.body==NULL )
1238  {
1240  if (pi->data.s.body==NULL) return TRUE;
1241  }
1242  // set currPackHdl/currPack
1243  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1244  {
1245  currPack=pi->pack;
1248  //Print("set pack=%s\n",IDID(currPackHdl));
1249  }
1250  // see iiAllStart:
1251  BITSET save1=si_opt_1;
1252  BITSET save2=si_opt_2;
1253  newBuffer( omStrDup(pi->data.s.body), BT_proc,
1254  pi, pi->data.s.body_lineno-(iiCurrArgs==NULL) );
1255  BOOLEAN err=yyparse();
1256  si_opt_1=save1;
1257  si_opt_2=save2;
1258  // now save the return-expr.
1260  memcpy(&sLastPrinted,&iiRETURNEXPR,sizeof(sleftv));
1261  iiRETURNEXPR.Init();
1262  // warning about args.:
1263  if (iiCurrArgs!=NULL)
1264  {
1265  if (err==0) Warn("too many arguments for %s",IDID(iiCurrProc));
1266  iiCurrArgs->CleanUp();
1268  iiCurrArgs=NULL;
1269  }
1270  // similate proc_end:
1271  // - leave input
1272  void myychangebuffer();
1273  myychangebuffer();
1274  // - set the current buffer to its end (this is a pointer in a buffer,
1275  // not a file ptr) "branchTo" is only valid in proc)
1277  // - kill local vars
1279  // - return
1280  newBuffer(omStrDup("\n;return(_);\n"),BT_execute);
1281  return (err!=0);
1282  }
1283  return FALSE;
1284 }

◆ iiCallLibProc1()

void* iiCallLibProc1 ( const char *  n,
void *  arg,
int  arg_type,
BOOLEAN err 
)

Definition at line 613 of file iplib.cc.

614 {
615  idhdl h=ggetid(n);
616  if ((h==NULL)
617  || (IDTYP(h)!=PROC_CMD))
618  {
619  err=2;
620  return NULL;
621  }
622  // ring handling
623  idhdl save_ringhdl=currRingHdl;
624  ring save_ring=currRing;
626  // argument:
627  sleftv tmp;
628  tmp.Init();
629  tmp.data=arg;
630  tmp.rtyp=arg_type;
631  // call proc
632  err=iiMake_proc(h,currPack,&tmp);
633  // clean up ring
634  iiCallLibProcEnd(save_ringhdl,save_ring);
635  // return
636  if (err==FALSE)
637  {
638  void*r=iiRETURNEXPR.data;
641  return r;
642  }
643  return NULL;
644 }

◆ iiCallLibProcM()

void* iiCallLibProcM ( const char *  n,
void **  args,
int *  arg_types,
BOOLEAN err 
)

args: NULL terminated arry of arguments arg_types: 0 terminated array of corresponding types

Definition at line 647 of file iplib.cc.

648 {
649  idhdl h=ggetid(n);
650  if ((h==NULL)
651  || (IDTYP(h)!=PROC_CMD))
652  {
653  err=2;
654  return NULL;
655  }
656  // ring handling
657  idhdl save_ringhdl=currRingHdl;
658  ring save_ring=currRing;
660  // argument:
661  if (arg_types[0]!=0)
662  {
663  sleftv tmp;
664  leftv tt=&tmp;
665  int i=1;
666  tmp.Init();
667  tmp.data=args[0];
668  tmp.rtyp=arg_types[0];
669  while(arg_types[i]!=0)
670  {
671  tt->next=(leftv)omAlloc0(sizeof(sleftv));
672  tt=tt->next;
673  tt->rtyp=arg_types[i];
674  tt->data=args[i];
675  i++;
676  }
677  // call proc
678  err=iiMake_proc(h,currPack,&tmp);
679  }
680  else
681  // call proc
682  err=iiMake_proc(h,currPack,NULL);
683  // clean up ring
684  iiCallLibProcEnd(save_ringhdl,save_ring);
685  // return
686  if (err==FALSE)
687  {
688  void*r=iiRETURNEXPR.data;
691  return r;
692  }
693  return NULL;
694 }

◆ iiCheckPack()

void iiCheckPack ( package p)

Definition at line 1541 of file ipshell.cc.

1542 {
1543  if (p!=basePack)
1544  {
1545  idhdl t=basePack->idroot;
1546  while ((t!=NULL) && (IDTYP(t)!=PACKAGE_CMD) && (IDPACKAGE(t)!=p)) t=t->next;
1547  if (t==NULL)
1548  {
1549  WarnS("package not found\n");
1550  p=basePack;
1551  }
1552  }
1553 }

◆ iiCheckRing()

BOOLEAN iiCheckRing ( int  i)

Definition at line 1497 of file ipshell.cc.

1498 {
1499  if (currRing==NULL)
1500  {
1501  #ifdef SIQ
1502  if (siq<=0)
1503  {
1504  #endif
1505  if (RingDependend(i))
1506  {
1507  WerrorS("no ring active");
1508  return TRUE;
1509  }
1510  #ifdef SIQ
1511  }
1512  #endif
1513  }
1514  return FALSE;
1515 }

◆ iiCheckTypes()

BOOLEAN iiCheckTypes ( leftv  args,
const short *  type_list,
int  report = 0 
)

check a list of arguemys against a given field of types return TRUE if the types match return FALSE (and, if report) report an error via Werror otherwise

Parameters
type_list< [in] argument list (may be NULL) [in] field of types len, t1,t2,...
report;in] report error?

Definition at line 6546 of file ipshell.cc.

6547 {
6548  int l=0;
6549  if (args==NULL)
6550  {
6551  if (type_list[0]==0) return TRUE;
6552  }
6553  else l=args->listLength();
6554  if (l!=(int)type_list[0])
6555  {
6556  if (report) iiReportTypes(0,l,type_list);
6557  return FALSE;
6558  }
6559  for(int i=1;i<=l;i++,args=args->next)
6560  {
6561  short t=type_list[i];
6562  if (t!=ANY_TYPE)
6563  {
6564  if (((t==IDHDL)&&(args->rtyp!=IDHDL))
6565  || (t!=args->Typ()))
6566  {
6567  if (report) iiReportTypes(i,args->Typ(),type_list);
6568  return FALSE;
6569  }
6570  }
6571  }
6572  return TRUE;
6573 }

◆ iiConvName()

char* iiConvName ( const char *  libname)

Definition at line 1331 of file iplib.cc.

1332 {
1333  char *tmpname = omStrDup(libname);
1334  char *p = strrchr(tmpname, DIR_SEP);
1335  char *r;
1336  if(p==NULL) p = tmpname; else p++;
1337  // p is now the start of the file name (without path)
1338  r=p;
1339  while(isalnum(*r)||(*r=='_')) r++;
1340  // r point the the end of the main part of the filename
1341  *r = '\0';
1342  r = omStrDup(p);
1343  *r = mytoupper(*r);
1344  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1345  omFree((ADDRESS)tmpname);
1346 
1347  return(r);
1348 }

◆ iiDebug()

void iiDebug ( )

Definition at line 989 of file ipshell.cc.

990 {
991 #ifdef HAVE_SDB
992  sdb_flags=1;
993 #endif
994  Print("\n-- break point in %s --\n",VoiceName());
996  char * s;
998  s = (char *)omAlloc(BREAK_LINE_LENGTH+4);
999  loop
1000  {
1001  memset(s,0,80);
1003  if (s[BREAK_LINE_LENGTH-1]!='\0')
1004  {
1005  Print("line too long, max is %d chars\n",BREAK_LINE_LENGTH);
1006  }
1007  else
1008  break;
1009  }
1010  if (*s=='\n')
1011  {
1013  }
1014 #if MDEBUG
1015  else if(strncmp(s,"cont;",5)==0)
1016  {
1018  }
1019 #endif /* MDEBUG */
1020  else
1021  {
1022  strcat( s, "\n;~\n");
1024  }
1025 }

◆ iiDeclCommand()

int iiDeclCommand ( leftv  sy,
leftv  name,
int  lev,
int  t,
idhdl root,
BOOLEAN  isring = FALSE,
BOOLEAN  init_b = TRUE 
)

Definition at line 1127 of file ipshell.cc.

1128 {
1129  BOOLEAN res=FALSE;
1130  const char *id = name->name;
1131 
1132  memset(sy,0,sizeof(sleftv));
1133  if ((name->name==NULL)||(isdigit(name->name[0])))
1134  {
1135  WerrorS("object to declare is not a name");
1136  res=TRUE;
1137  }
1138  else
1139  {
1140  if (t==QRING_CMD) t=RING_CMD; // qring is always RING_CMD
1141 
1142  if (TEST_V_ALLWARN
1143  && (name->rtyp!=0)
1144  && (name->rtyp!=IDHDL)
1145  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1146  {
1147  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1149  }
1150  {
1151  sy->data = (char *)enterid(id,lev,t,root,init_b);
1152  }
1153  if (sy->data!=NULL)
1154  {
1155  sy->rtyp=IDHDL;
1156  currid=sy->name=IDID((idhdl)sy->data);
1157  // name->name=NULL; /* used in enterid */
1158  //sy->e = NULL;
1159  if (name->next!=NULL)
1160  {
1162  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1163  }
1164  }
1165  else res=TRUE;
1166  }
1167  name->CleanUp();
1168  return res;
1169 }

◆ iiEStart()

BOOLEAN iiEStart ( char *  example,
procinfo pi 
)

Definition at line 699 of file iplib.cc.

700 {
701  BOOLEAN err;
702  int old_echo=si_echo;
703 
704  iiCheckNest();
705  procstack->push(example);
708  {
709  if (traceit&TRACE_SHOW_LINENO) printf("\n");
710  printf("entering example (level %d)\n",myynest);
711  }
712  myynest++;
713 
714  err=iiAllStart(pi,example,BT_example,(pi != NULL ? pi->data.s.example_lineno: 0));
715 
717  myynest--;
718  si_echo=old_echo;
720  {
721  if (traceit&TRACE_SHOW_LINENO) printf("\n");
722  printf("leaving -example- (level %d)\n",myynest);
723  }
724  if (iiLocalRing[myynest] != currRing)
725  {
726  if (iiLocalRing[myynest]!=NULL)
727  {
730  }
731  else
732  {
734  currRing=NULL;
735  }
736  }
737  procstack->pop();
738  return err;
739 }

◆ iiExport() [1/2]

BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1419 of file ipshell.cc.

1420 {
1421  BOOLEAN nok=FALSE;
1422  leftv r=v;
1423  while (v!=NULL)
1424  {
1425  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL))
1426  {
1427  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1428  nok=TRUE;
1429  }
1430  else
1431  {
1432  if(iiInternalExport(v, toLev))
1433  {
1434  r->CleanUp();
1435  return TRUE;
1436  }
1437  }
1438  v=v->next;
1439  }
1440  r->CleanUp();
1441  return nok;
1442 }

◆ iiExport() [2/2]

BOOLEAN iiExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1445 of file ipshell.cc.

1446 {
1447 // if ((pack==basePack)&&(pack!=currPack))
1448 // { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1449  BOOLEAN nok=FALSE;
1450  leftv rv=v;
1451  while (v!=NULL)
1452  {
1453  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1454  )
1455  {
1456  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1457  nok=TRUE;
1458  }
1459  else
1460  {
1461  idhdl old=pack->idroot->get( v->name,toLev);
1462  if (old!=NULL)
1463  {
1464  if ((pack==currPack) && (old==(idhdl)v->data))
1465  {
1466  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1467  break;
1468  }
1469  else if (IDTYP(old)==v->Typ())
1470  {
1471  if (BVERBOSE(V_REDEFINE))
1472  {
1473  Warn("redefining %s (%s)",IDID(old),my_yylinebuf);
1474  }
1475  v->name=omStrDup(v->name);
1476  killhdl2(old,&(pack->idroot),currRing);
1477  }
1478  else
1479  {
1480  rv->CleanUp();
1481  return TRUE;
1482  }
1483  }
1484  //Print("iiExport: pack=%s\n",IDID(root));
1485  if(iiInternalExport(v, toLev, pack))
1486  {
1487  rv->CleanUp();
1488  return TRUE;
1489  }
1490  }
1491  v=v->next;
1492  }
1493  rv->CleanUp();
1494  return nok;
1495 }

◆ iiExprArith1()

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

◆ 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]res[out] pre-allocated result
[in]a[in] argument
[in]op[in] operation
[in]dA1[in] table of possible proc assumes dArith1[0].cmd==op
[in]at[in] a->Typ()
[in]dConvertTypes[in] table of type conversions

Definition at line 8318 of file iparith.cc.

8319 {
8320  memset(res,0,sizeof(sleftv));
8321  BOOLEAN call_failed=FALSE;
8322 
8323  if (!errorreported)
8324  {
8325  BOOLEAN failed=FALSE;
8326  iiOp=op;
8327  int i = 0;
8328  while (dA1[i].cmd==op)
8329  {
8330  if (at==dA1[i].arg)
8331  {
8332  if (currRing!=NULL)
8333  {
8334  if (check_valid(dA1[i].valid_for,op)) break;
8335  }
8336  else
8337  {
8338  if (RingDependend(dA1[i].res))
8339  {
8340  WerrorS("no ring active");
8341  break;
8342  }
8343  }
8344  if (traceit&TRACE_CALL)
8345  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8346  res->rtyp=dA1[i].res;
8347  if ((call_failed=dA1[i].p(res,a)))
8348  {
8349  break;// leave loop, goto error handling
8350  }
8351  if (a->Next()!=NULL)
8352  {
8353  res->next=(leftv)omAllocBin(sleftv_bin);
8354  failed=iiExprArith1(res->next,a->next,op);
8355  }
8356  a->CleanUp();
8357  return failed;
8358  }
8359  i++;
8360  }
8361  // implicite type conversion --------------------------------------------
8362  if (dA1[i].cmd!=op)
8363  {
8365  i=0;
8366  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8367  while (dA1[i].cmd==op)
8368  {
8369  int ai;
8370  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8371  if ((dA1[i].valid_for & NO_CONVERSION)==0)
8372  {
8373  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8374  {
8375  if (currRing!=NULL)
8376  {
8377  if (check_valid(dA1[i].valid_for,op)) break;
8378  }
8379  else
8380  {
8381  if (RingDependend(dA1[i].res))
8382  {
8383  WerrorS("no ring active");
8384  break;
8385  }
8386  }
8387  if (traceit&TRACE_CALL)
8388  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8389  res->rtyp=dA1[i].res;
8390  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8391  || (call_failed=dA1[i].p(res,an)));
8392  // everything done, clean up temp. variables
8393  if (failed)
8394  {
8395  // leave loop, goto error handling
8396  break;
8397  }
8398  else
8399  {
8400  if (an->Next() != NULL)
8401  {
8402  res->next = (leftv)omAllocBin(sleftv_bin);
8403  failed=iiExprArith1(res->next,an->next,op);
8404  }
8405  // everything ok, clean up and return
8406  an->CleanUp();
8408  return failed;
8409  }
8410  }
8411  }
8412  i++;
8413  }
8414  an->CleanUp();
8416  }
8417  // error handling
8418  if (!errorreported)
8419  {
8420  if ((at==0) && (a->Fullname()!=sNoName_fe))
8421  {
8422  Werror("`%s` is not defined",a->Fullname());
8423  }
8424  else
8425  {
8426  i=0;
8427  const char *s = iiTwoOps(op);
8428  Werror("%s(`%s`) failed"
8429  ,s,Tok2Cmdname(at));
8430  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8431  {
8432  while (dA1[i].cmd==op)
8433  {
8434  if ((dA1[i].res!=0)
8435  && (dA1[i].p!=jjWRONG))
8436  Werror("expected %s(`%s`)"
8437  ,s,Tok2Cmdname(dA1[i].arg));
8438  i++;
8439  }
8440  }
8441  }
8442  }
8443  res->rtyp = UNKNOWN;
8444  }
8445  a->CleanUp();
8446  return TRUE;
8447 }

◆ iiExprArith2()

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

◆ 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]res[out] pre-allocated result
[in]a[in] 2 arguments
[in]op[in] operation
[in]dA2[in] table of possible proc assumes dA2[0].cmd==op
[in]at[in] a->Typ()
[in]dConvertTypes[in] table of type conversions

Definition at line 8246 of file iparith.cc.

8250 {
8251  leftv b=a->next;
8252  a->next=NULL;
8253  int bt=b->Typ();
8254  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8255  a->next=b;
8256  a->CleanUp(); // to clean up the chain, content already done in iiExprArith2TabIntern
8257  return bo;
8258 }

◆ iiExprArith3()

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

Definition at line 8661 of file iparith.cc.

8662 {
8663  memset(res,0,sizeof(sleftv));
8664 
8665  if (!errorreported)
8666  {
8667 #ifdef SIQ
8668  if (siq>0)
8669  {
8670  //Print("siq:%d\n",siq);
8672  memcpy(&d->arg1,a,sizeof(sleftv));
8673  a->Init();
8674  memcpy(&d->arg2,b,sizeof(sleftv));
8675  b->Init();
8676  memcpy(&d->arg3,c,sizeof(sleftv));
8677  c->Init();
8678  d->op=op;
8679  d->argc=3;
8680  res->data=(char *)d;
8681  res->rtyp=COMMAND;
8682  return FALSE;
8683  }
8684 #endif
8685  int at=a->Typ();
8686  // handling bb-objects ----------------------------------------------
8687  if (at>MAX_TOK)
8688  {
8689  blackbox *bb=getBlackboxStuff(at);
8690  if (bb!=NULL)
8691  {
8692  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8693  // else: no op defined
8694  }
8695  else
8696  return TRUE;
8697  if (errorreported) return TRUE;
8698  }
8699  int bt=b->Typ();
8700  int ct=c->Typ();
8701 
8702  iiOp=op;
8703  int i=0;
8704  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8705  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8706  }
8707  a->CleanUp();
8708  b->CleanUp();
8709  c->CleanUp();
8710  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8711  return TRUE;
8712 }

◆ 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]res[out] pre-allocated result
[in]a[in] 3 arguments
[in]op[in] operation
[in]dA3[in] table of possible proc assumes dA3[0].cmd==op
[in]at[in] a->Typ()
[in]dConvertTypes[in] table of type conversions

Definition at line 8713 of file iparith.cc.

8717 {
8718  leftv b=a->next;
8719  a->next=NULL;
8720  int bt=b->Typ();
8721  leftv c=b->next;
8722  b->next=NULL;
8723  int ct=c->Typ();
8724  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8725  b->next=c;
8726  a->next=b;
8727  a->CleanUp(); // to cleanup the chain, content already done
8728  return bo;
8729 }

◆ iiExprArithM()

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

◆ iiGetLibName()

static char* iiGetLibName ( const procinfov  pi)
inlinestatic

find the library of an proc

Definition at line 66 of file ipshell.h.

66 { return pi->libname; }

◆ iiGetLibProcBuffer()

char* iiGetLibProcBuffer ( procinfov  pi,
int  part = 1 
)

◆ iiHighCorner()

poly iiHighCorner ( ideal  i,
int  ak 
)

Definition at line 1517 of file ipshell.cc.

1518 {
1519  int i;
1520  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1521  poly po=NULL;
1523  {
1524  scComputeHC(I,currRing->qideal,ak,po);
1525  if (po!=NULL)
1526  {
1527  pGetCoeff(po)=nInit(1);
1528  for (i=rVar(currRing); i>0; i--)
1529  {
1530  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1531  }
1532  pSetComp(po,ak);
1533  pSetm(po);
1534  }
1535  }
1536  else
1537  po=pOne();
1538  return po;
1539 }

◆ iiInternalExport()

BOOLEAN iiInternalExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1373 of file ipshell.cc.

1374 {
1375  idhdl h=(idhdl)v->data;
1376  if(h==NULL)
1377  {
1378  Warn("'%s': no such identifier\n", v->name);
1379  return FALSE;
1380  }
1381  package frompack=v->req_packhdl;
1382  if (frompack==NULL) frompack=currPack;
1383  if ((RingDependend(IDTYP(h)))
1384  || ((IDTYP(h)==LIST_CMD)
1385  && (lRingDependend(IDLIST(h)))
1386  )
1387  )
1388  {
1389  //Print("// ==> Ringdependent set nesting to 0\n");
1390  return (iiInternalExport(v, toLev));
1391  }
1392  else
1393  {
1394  IDLEV(h)=toLev;
1395  v->req_packhdl=rootpack;
1396  if (h==frompack->idroot)
1397  {
1398  frompack->idroot=h->next;
1399  }
1400  else
1401  {
1402  idhdl hh=frompack->idroot;
1403  while ((hh!=NULL) && (hh->next!=h))
1404  hh=hh->next;
1405  if ((hh!=NULL) && (hh->next==h))
1406  hh->next=h->next;
1407  else
1408  {
1409  Werror("`%s` not found",v->Name());
1410  return TRUE;
1411  }
1412  }
1413  h->next=rootpack->idroot;
1414  rootpack->idroot=h;
1415  }
1416  return FALSE;
1417 }

◆ iiLibCmd()

BOOLEAN iiLibCmd ( char *  newlib,
BOOLEAN  autoexport,
BOOLEAN  tellerror,
BOOLEAN  force 
)

Definition at line 826 of file iplib.cc.

827 {
828  char libnamebuf[1024];
829  // procinfov pi;
830  // idhdl h;
831  idhdl pl;
832  // idhdl hl;
833  // long pos = 0L;
834  char *plib = iiConvName(newlib);
835  FILE * fp = feFopen( newlib, "r", libnamebuf, tellerror );
836  // int lines = 1;
837  BOOLEAN LoadResult = TRUE;
838 
839  if (fp==NULL)
840  {
841  return TRUE;
842  }
843  pl = basePack->idroot->get(plib,0);
844  if (pl==NULL)
845  {
846  pl = enterid( plib,0, PACKAGE_CMD,
847  &(basePack->idroot), TRUE );
848  IDPACKAGE(pl)->language = LANG_SINGULAR;
849  IDPACKAGE(pl)->libname=omStrDup(newlib);
850  }
851  else
852  {
853  if(IDTYP(pl)!=PACKAGE_CMD)
854  {
855  WarnS("not of type package.");
856  fclose(fp);
857  return TRUE;
858  }
859  if (!force) return FALSE;
860  }
861  LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, autoexport, tellerror);
862  omFree((ADDRESS)newlib);
863 
864  if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE;
865  omFree((ADDRESS)plib);
866 
867  return LoadResult;
868 }

◆ iiLoadLIB()

BOOLEAN iiLoadLIB ( FILE *  fp,
const char *  libnamebuf,
const char *  newlib,
idhdl  pl,
BOOLEAN  autoexport,
BOOLEAN  tellerror 
)

Definition at line 915 of file iplib.cc.

917 {
918  extern FILE *yylpin;
919  libstackv ls_start = library_stack;
920  lib_style_types lib_style;
921 
922  yylpin = fp;
923  #if YYLPDEBUG > 1
924  print_init();
925  #endif
926  extern int lpverbose;
928  else lpverbose=0;
929  // yylplex sets also text_buffer
930  if (text_buffer!=NULL) *text_buffer='\0';
931  yylplex(newlib, libnamebuf, &lib_style, pl, autoexport);
932  if(yylp_errno)
933  {
934  Werror("Library %s: ERROR occurred: in line %d, %d.", newlib, yylplineno,
935  current_pos(0));
937  {
941  }
942  else
944  WerrorS("Cannot load library,... aborting.");
945  reinit_yylp();
946  fclose( yylpin );
948  return TRUE;
949  }
950  if (BVERBOSE(V_LOAD_LIB))
951  Print( "// ** loaded %s %s\n", libnamebuf, text_buffer);
952  if( (lib_style == OLD_LIBSTYLE) && (BVERBOSE(V_LOAD_LIB)))
953  {
954  Warn( "library %s has old format. This format is still accepted,", newlib);
955  WarnS( "but for functionality you may wish to change to the new");
956  WarnS( "format. Please refer to the manual for further information.");
957  }
958  reinit_yylp();
959  fclose( yylpin );
960  fp = NULL;
961  iiRunInit(IDPACKAGE(pl));
962 
963  {
964  libstackv ls;
965  for(ls = library_stack; (ls != NULL) && (ls != ls_start); )
966  {
967  if(ls->to_be_done)
968  {
969  ls->to_be_done=FALSE;
970  iiLibCmd(ls->get(),autoexport,tellerror,FALSE);
971  ls = ls->pop(newlib);
972  }
973  }
974 #if 0
975  PrintS("--------------------\n");
976  for(ls = library_stack; ls != NULL; ls = ls->next)
977  {
978  Print("%s: LIB-stack:(%d), %s %s\n", newlib, ls->cnt, ls->get(),
979  ls->to_be_done ? "not loaded" : "loaded");
980  }
981  PrintS("--------------------\n");
982 #endif
983  }
984 
985  if(fp != NULL) fclose(fp);
986  return FALSE;
987 }

◆ iiLocateLib()

BOOLEAN iiLocateLib ( const char *  lib,
char *  where 
)

Definition at line 812 of file iplib.cc.

813 {
814  char *plib = iiConvName(lib);
815  idhdl pl = basePack->idroot->get(plib,0);
816  if( (pl!=NULL) && (IDTYP(pl)==PACKAGE_CMD) &&
817  (IDPACKAGE(pl)->language == LANG_SINGULAR))
818  {
819  strncpy(where,IDPACKAGE(pl)->libname,127);
820  return TRUE;
821  }
822  else
823  return FALSE;;
824 }

◆ iiMake_proc()

BOOLEAN iiMake_proc ( idhdl  pn,
package  pack,
leftv  sl 
)

Definition at line 485 of file iplib.cc.

486 {
487  int err;
488  procinfov pi = IDPROC(pn);
489  if(pi->is_static && myynest==0)
490  {
491  Werror("'%s::%s()' is a local procedure and cannot be accessed by an user.",
492  pi->libname, pi->procname);
493  return TRUE;
494  }
495  iiCheckNest();
497  //Print("currRing(%d):%s(%x) in %s\n",myynest,IDID(currRingHdl),currRing,IDID(pn));
498  iiRETURNEXPR.Init();
499  procstack->push(pi->procname);
501  || (pi->trace_flag&TRACE_SHOW_PROC))
502  {
504  Print("entering%-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
505  }
506 #ifdef RDEBUG
508 #endif
509  switch (pi->language)
510  {
511  default:
512  case LANG_NONE:
513  WerrorS("undefined proc");
514  err=TRUE;
515  break;
516 
517  case LANG_SINGULAR:
518  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
519  {
520  currPack=pi->pack;
523  //Print("set pack=%s\n",IDID(currPackHdl));
524  }
525  else if ((pack!=NULL)&&(currPack!=pack))
526  {
527  currPack=pack;
530  //Print("set pack=%s\n",IDID(currPackHdl));
531  }
532  err=iiPStart(pn,sl);
533  break;
534  case LANG_C:
536  err = (pi->data.o.function)(res, sl);
537  memcpy(&iiRETURNEXPR,res,sizeof(iiRETURNEXPR));
539  break;
540  }
542  || (pi->trace_flag&TRACE_SHOW_PROC))
543  {
545  Print("leaving %-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
546  }
547  //const char *n="NULL";
548  //if (currRingHdl!=NULL) n=IDID(currRingHdl);
549  //Print("currRing(%d):%s(%x) after %s\n",myynest,n,currRing,IDID(pn));
550 #ifdef RDEBUG
552 #endif
553  if (err)
554  {
556  //iiRETURNEXPR.Init(); //done by CleanUp
557  }
558  if (iiCurrArgs!=NULL)
559  {
560  if (!err) Warn("too many arguments for %s",IDID(pn));
561  iiCurrArgs->CleanUp();
564  }
565  procstack->pop();
566  if (err)
567  return TRUE;
568  return FALSE;
569 }

◆ iiMakeResolv()

void iiMakeResolv ( resolvente  r,
int  length,
int  rlen,
char *  name,
int  typ0,
intvec **  weights = NULL 
)

Definition at line 771 of file ipshell.cc.

773 {
774  lists L=liMakeResolv(r,length,rlen,typ0,weights);
775  int i=0;
776  idhdl h;
777  char * s=(char *)omAlloc(strlen(name)+5);
778 
779  while (i<=L->nr)
780  {
781  sprintf(s,"%s(%d)",name,i+1);
782  if (i==0)
783  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
784  else
785  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
786  if (h!=NULL)
787  {
788  h->data.uideal=(ideal)L->m[i].data;
789  h->attribute=L->m[i].attribute;
791  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
792  }
793  else
794  {
795  idDelete((ideal *)&(L->m[i].data));
796  Warn("cannot define %s",s);
797  }
798  //L->m[i].data=NULL;
799  //L->m[i].rtyp=0;
800  //L->m[i].attribute=NULL;
801  i++;
802  }
803  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
805  omFreeSize((ADDRESS)s,strlen(name)+5);
806 }

◆ iiMap()

leftv iiMap ( map  theMap,
const char *  what 
)

Definition at line 612 of file ipshell.cc.

613 {
614  idhdl w,r;
615  leftv v;
616  int i;
617  nMapFunc nMap;
618 
619  r=IDROOT->get(theMap->preimage,myynest);
620  if ((currPack!=basePack)
621  &&((r==NULL) || ((r->typ != RING_CMD) )))
622  r=basePack->idroot->get(theMap->preimage,myynest);
623  if ((r==NULL) && (currRingHdl!=NULL)
624  && (strcmp(theMap->preimage,IDID(currRingHdl))==0))
625  {
626  r=currRingHdl;
627  }
628  if ((r!=NULL) && (r->typ == RING_CMD))
629  {
630  ring src_ring=IDRING(r);
631  if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL)
632  {
633  Werror("can not map from ground field of %s to current ground field",
634  theMap->preimage);
635  return NULL;
636  }
637  if (IDELEMS(theMap)<src_ring->N)
638  {
639  theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m,
640  IDELEMS(theMap)*sizeof(poly),
641  (src_ring->N)*sizeof(poly));
642  for(i=IDELEMS(theMap);i<src_ring->N;i++)
643  theMap->m[i]=NULL;
644  IDELEMS(theMap)=src_ring->N;
645  }
646  if (what==NULL)
647  {
648  WerrorS("argument of a map must have a name");
649  }
650  else if ((w=src_ring->idroot->get(what,myynest))!=NULL)
651  {
652  char *save_r=NULL;
654  sleftv tmpW;
655  memset(&tmpW,0,sizeof(sleftv));
656  tmpW.rtyp=IDTYP(w);
657  if (tmpW.rtyp==MAP_CMD)
658  {
659  tmpW.rtyp=IDEAL_CMD;
660  save_r=IDMAP(w)->preimage;
661  IDMAP(w)->preimage=0;
662  }
663  tmpW.data=IDDATA(w);
664  // check overflow
665  BOOLEAN overflow=FALSE;
666  if ((tmpW.rtyp==IDEAL_CMD)
667  || (tmpW.rtyp==MODUL_CMD)
668  || (tmpW.rtyp==MAP_CMD))
669  {
670  ideal id=(ideal)tmpW.data;
671  long *degs=(long*)omAlloc(IDELEMS(id)*sizeof(long));
672  for(int i=IDELEMS(id)-1;i>=0;i--)
673  {
674  poly p=id->m[i];
675  if (p!=NULL) degs[i]=p_Totaldegree(p,src_ring);
676  else degs[i]=0;
677  }
678  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
679  {
680  if (theMap->m[j]!=NULL)
681  {
682  long deg_monexp=pTotaldegree(theMap->m[j]);
683 
684  for(int i=IDELEMS(id)-1;i>=0;i--)
685  {
686  poly p=id->m[i];
687  if ((p!=NULL) && (degs[i]!=0) &&
688  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)degs[i])/2)))
689  {
690  overflow=TRUE;
691  break;
692  }
693  }
694  }
695  }
696  omFreeSize(degs,IDELEMS(id)*sizeof(long));
697  }
698  else if (tmpW.rtyp==POLY_CMD)
699  {
700  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
701  {
702  if (theMap->m[j]!=NULL)
703  {
704  long deg_monexp=pTotaldegree(theMap->m[j]);
705  poly p=(poly)tmpW.data;
706  long deg=0;
707  if ((p!=NULL) && ((deg=p_Totaldegree(p,src_ring))!=0) &&
708  ((unsigned long)deg_monexp > (currRing->bitmask / ((unsigned long)deg)/2)))
709  {
710  overflow=TRUE;
711  break;
712  }
713  }
714  }
715  }
716  if (overflow)
717  Warn("possible OVERFLOW in map, max exponent is %ld",currRing->bitmask/2);
718 #if 0
719  if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
720  {
721  v->rtyp=tmpW.rtyp;
722  v->data=idInit(IDELEMS(IDIDEAL(w)),IDIDEAL(w)->rank);
723  }
724  else
725 #endif
726  {
727  if ((tmpW.rtyp==IDEAL_CMD)
728  ||(tmpW.rtyp==MODUL_CMD)
729  ||(tmpW.rtyp==MATRIX_CMD)
730  ||(tmpW.rtyp==MAP_CMD))
731  {
732  v->rtyp=tmpW.rtyp;
733  char *tmp = theMap->preimage;
734  theMap->preimage=(char*)1L;
735  // map gets 1 as its rank (as an ideal)
736  v->data=maMapIdeal(IDIDEAL(w), src_ring, (ideal)theMap, currRing,nMap);
737  theMap->preimage=tmp; // map gets its preimage back
738  }
739  if (v->data==NULL) /*i.e. not IDEAL_CMD/MODUL_CMD/MATRIX_CMD/MAP */
740  {
741  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,src_ring,NULL,NULL,0,nMap))
742  {
743  Werror("cannot map %s(%d)",Tok2Cmdname(w->typ),w->typ);
745  if (save_r!=NULL) IDMAP(w)->preimage=save_r;
746  return NULL;
747  }
748  }
749  }
750  if (save_r!=NULL)
751  {
752  IDMAP(w)->preimage=save_r;
753  IDMAP((idhdl)v)->preimage=omStrDup(save_r);
754  v->rtyp=MAP_CMD;
755  }
756  return v;
757  }
758  else
759  {
760  Werror("%s undefined in %s",what,theMap->preimage);
761  }
762  }
763  else
764  {
765  Werror("cannot find preimage %s",theMap->preimage);
766  }
767  return NULL;
768 }

◆ iiOpsTwoChar()

int iiOpsTwoChar ( const char *  s)

Definition at line 119 of file ipshell.cc.

120 {
121 /* not handling: &&, ||, ** */
122  if (s[1]=='\0') return s[0];
123  else if (s[2]!='\0') return 0;
124  switch(s[0])
125  {
126  case '.': if (s[1]=='.') return DOTDOT;
127  else return 0;
128  case ':': if (s[1]==':') return COLONCOLON;
129  else return 0;
130  case '-': if (s[1]=='-') return MINUSMINUS;
131  else return 0;
132  case '+': if (s[1]=='+') return PLUSPLUS;
133  else return 0;
134  case '=': if (s[1]=='=') return EQUAL_EQUAL;
135  else return 0;
136  case '<': if (s[1]=='=') return LE;
137  else if (s[1]=='>') return NOTEQUAL;
138  else return 0;
139  case '>': if (s[1]=='=') return GE;
140  else return 0;
141  case '!': if (s[1]=='=') return NOTEQUAL;
142  else return 0;
143  }
144  return 0;
145 }

◆ iiParameter()

BOOLEAN iiParameter ( leftv  p)

Definition at line 1285 of file ipshell.cc.

1286 {
1287  if (iiCurrArgs==NULL)
1288  {
1289  if (strcmp(p->name,"#")==0)
1290  return iiDefaultParameter(p);
1291  Werror("not enough arguments for proc %s",VoiceName());
1292  p->CleanUp();
1293  return TRUE;
1294  }
1295  leftv h=iiCurrArgs;
1296  leftv rest=h->next; /*iiCurrArgs is not NULL here*/
1297  BOOLEAN is_default_list=FALSE;
1298  if (strcmp(p->name,"#")==0)
1299  {
1300  is_default_list=TRUE;
1301  rest=NULL;
1302  }
1303  else
1304  {
1305  h->next=NULL;
1306  }
1307  BOOLEAN res=iiAssign(p,h);
1308  if (is_default_list)
1309  {
1310  iiCurrArgs=NULL;
1311  }
1312  else
1313  {
1314  iiCurrArgs=rest;
1315  }
1316  h->CleanUp();
1318  return res;
1319 }

◆ iiProcArgs()

char* iiProcArgs ( char *  e,
BOOLEAN  withParenth 
)

Definition at line 109 of file iplib.cc.

110 {
111  while ((*e==' ') || (*e=='\t') || (*e=='(')) e++;
112  if (*e<' ')
113  {
114  if (withParenth)
115  {
116  // no argument list, allow list #
117  return omStrDup("parameter list #;");
118  }
119  else
120  {
121  // empty list
122  return omStrDup("");
123  }
124  }
125  BOOLEAN in_args;
126  BOOLEAN args_found;
127  char *s;
128  char *argstr=(char *)omAlloc(127); // see ../omalloc/omTables.inc
129  int argstrlen=127;
130  *argstr='\0';
131  int par=0;
132  do
133  {
134  args_found=FALSE;
135  s=e; // set s to the starting point of the arg
136  // and search for the end
137  // skip leading spaces:
138  loop
139  {
140  if ((*s==' ')||(*s=='\t'))
141  s++;
142  else if ((*s=='\n')&&(*(s+1)==' '))
143  s+=2;
144  else // start of new arg or \0 or )
145  break;
146  }
147  e=s;
148  while ((*e!=',')
149  &&((par!=0) || (*e!=')'))
150  &&(*e!='\0'))
151  {
152  if (*e=='(') par++;
153  else if (*e==')') par--;
154  args_found=args_found || (*e>' ');
155  e++;
156  }
157  in_args=(*e==',');
158  if (args_found)
159  {
160  *e='\0';
161  // check for space:
162  if ((int)strlen(argstr)+12 /* parameter + ;*/ +(int)strlen(s)>= argstrlen)
163  {
164  argstrlen*=2;
165  char *a=(char *)omAlloc( argstrlen);
166  strcpy(a,argstr);
167  omFree((ADDRESS)argstr);
168  argstr=a;
169  }
170  // copy the result to argstr
171  if(strncmp(s,"alias ",6)!=0)
172  {
173  strcat(argstr,"parameter ");
174  }
175  strcat(argstr,s);
176  strcat(argstr,"; ");
177  e++; // e was pointing to ','
178  }
179  } while (in_args);
180  return argstr;
181 }

◆ iiProcName()

char* iiProcName ( char *  buf,
char &  ct,
char *&  e 
)

Definition at line 95 of file iplib.cc.

96 {
97  char *s=buf+5;
98  while (*s==' ') s++;
99  e=s+1;
100  while ((*e>' ') && (*e!='(')) e++;
101  ct=*e;
102  *e='\0';
103  return s;
104 }

◆ iiPStart()

BOOLEAN iiPStart ( idhdl  pn,
leftv  sl 
)

Definition at line 353 of file iplib.cc.

354 {
355  procinfov pi=NULL;
356  int old_echo=si_echo;
357  BOOLEAN err=FALSE;
358  char save_flags=0;
359 
360  /* init febase ======================================== */
361  /* we do not enter this case if filename != NULL !! */
362  if (pn!=NULL)
363  {
364  pi = IDPROC(pn);
365  if(pi!=NULL)
366  {
367  save_flags=pi->trace_flag;
368  if( pi->data.s.body==NULL )
369  {
371  if (pi->data.s.body==NULL) return TRUE;
372  }
373 // omUpdateInfo();
374 // int m=om_Info.UsedBytes;
375 // Print("proc %s, mem=%d\n",IDID(pn),m);
376  }
377  }
378  else return TRUE;
379  /* generate argument list ======================================*/
380  //iiCurrArgs should be NULL here, as the assignment for the parameters
381  // of the prevouis call are already done befor calling another routine
382  if (v!=NULL)
383  {
385  memcpy(iiCurrArgs,v,sizeof(sleftv)); // keeps track of v->next etc.
386  memset(v,0,sizeof(sleftv));
387  }
388  else
389  {
391  }
392  iiCurrProc=pn;
393  /* start interpreter ======================================*/
394  myynest++;
395  if (myynest > SI_MAX_NEST)
396  {
397  WerrorS("nesting too deep");
398  err=TRUE;
399  }
400  else
401  {
402  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(v!=NULL));
403 
404  if (iiLocalRing[myynest-1] != currRing)
405  {
407  {
408  //idhdl hn;
409  const char *n;
410  const char *o;
411  idhdl nh=NULL, oh=NULL;
412  if (iiLocalRing[myynest-1]!=NULL)
414  if (oh!=NULL) o=oh->id;
415  else o="none";
416  if (currRing!=NULL)
417  nh=rFindHdl(currRing,NULL);
418  if (nh!=NULL) n=nh->id;
419  else n="none";
420  Werror("ring change during procedure call %s: %s -> %s (level %d)",pi->procname,o,n,myynest);
422  err=TRUE;
423  }
425  }
426  if ((currRing==NULL)
427  && (currRingHdl!=NULL))
429  else
430  if ((currRing!=NULL) &&
432  ||(IDLEV(currRingHdl)>=myynest-1)))
433  {
436  }
437  //Print("kill locals for %s (level %d)\n",IDID(pn),myynest);
439 #ifndef SING_NDEBUG
440  checkall();
441 #endif
442  //Print("end kill locals for %s (%d)\n",IDID(pn),myynest);
443  }
444  myynest--;
445  si_echo=old_echo;
446  if (pi!=NULL)
447  pi->trace_flag=save_flags;
448 // omUpdateInfo();
449 // int m=om_Info.UsedBytes;
450 // Print("exit %s, mem=%d\n",IDID(pn),m);
451  return err;
452 }

◆ iiRegularity()

int iiRegularity ( lists  L)

Definition at line 961 of file ipshell.cc.

962 {
963  int len,reg,typ0;
964 
965  resolvente r=liFindRes(L,&len,&typ0);
966 
967  if (r==NULL)
968  return -2;
969  intvec *weights=NULL;
970  int add_row_shift=0;
971  intvec *ww=(intvec *)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
972  if (ww!=NULL)
973  {
974  weights=ivCopy(ww);
975  add_row_shift = ww->min_in();
976  (*weights) -= add_row_shift;
977  }
978  //Print("attr:%x\n",weights);
979 
980  intvec *dummy=syBetti(r,len,&reg,weights);
981  if (weights!=NULL) delete weights;
982  delete dummy;
983  omFreeSize((ADDRESS)r,len*sizeof(ideal));
984  return reg+1+add_row_shift;
985 }

◆ iiTestAssume()

BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6429 of file ipshell.cc.

6430 {
6431  // assume a: level
6432  if ((a->Typ()==INT_CMD)&&((long)a->Data()>=0))
6433  {
6434  if ((TEST_V_ALLWARN) && (myynest==0)) WarnS("ASSUME at top level is of no use: see documentation");
6435  char assume_yylinebuf[80];
6436  strncpy(assume_yylinebuf,my_yylinebuf,79);
6437  int lev=(long)a->Data();
6438  int startlev=0;
6439  idhdl h=ggetid("assumeLevel");
6440  if ((h!=NULL)&&(IDTYP(h)==INT_CMD)) startlev=(long)IDINT(h);
6441  if(lev <=startlev)
6442  {
6443  BOOLEAN bo=b->Eval();
6444  if (bo) { WerrorS("syntax error in ASSUME");return TRUE;}
6445  if (b->Typ()!=INT_CMD) { WerrorS("ASUMME(<level>,<int expr>)");return TRUE; }
6446  if (b->Data()==NULL) { Werror("ASSUME failed:%s",assume_yylinebuf);return TRUE;}
6447  }
6448  }
6449  b->CleanUp();
6450  a->CleanUp();
6451  return FALSE;
6452 }

◆ iiTokType()

int iiTokType ( int  op)

Definition at line 233 of file iparith.cc.

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

◆ iiTryLoadLib()

BOOLEAN iiTryLoadLib ( leftv  v,
const char *  id 
)

Definition at line 764 of file iplib.cc.

765 {
766  BOOLEAN LoadResult = TRUE;
767  char libnamebuf[1024];
768  char *libname = (char *)omAlloc(strlen(id)+5);
769  const char *suffix[] = { "", ".lib", ".so", ".sl", NULL };
770  int i = 0;
771  // FILE *fp;
772  // package pack;
773  // idhdl packhdl;
774  lib_types LT;
775  for(i=0; suffix[i] != NULL; i++)
776  {
777  sprintf(libname, "%s%s", id, suffix[i]);
778  *libname = mytolower(*libname);
779  if((LT = type_of_LIB(libname, libnamebuf)) > LT_NOTFOUND)
780  {
781  char *s=omStrDup(libname);
782  #ifdef HAVE_DYNAMIC_LOADING
783  char libnamebuf[1024];
784  #endif
785 
786  if (LT==LT_SINGULAR)
787  LoadResult = iiLibCmd(s, FALSE, FALSE,TRUE);
788  #ifdef HAVE_DYNAMIC_LOADING
789  else if ((LT==LT_ELF) || (LT==LT_HPUX))
790  LoadResult = load_modules(s,libnamebuf,FALSE);
791  #endif
792  else if (LT==LT_BUILTIN)
793  {
794  LoadResult=load_builtin(s,FALSE, iiGetBuiltinModInit(s));
795  }
796  if(!LoadResult )
797  {
798  v->name = iiConvName(libname);
799  break;
800  }
801  }
802  }
803  omFree(libname);
804  return LoadResult;
805 }

◆ iiTwoOps()

const char* iiTwoOps ( int  t)

Definition at line 261 of file gentable.cc.

262 {
263  if (t<127)
264  {
265  static char ch[2];
266  switch (t)
267  {
268  case '&':
269  return "and";
270  case '|':
271  return "or";
272  default:
273  ch[0]=t;
274  ch[1]='\0';
275  return ch;
276  }
277  }
278  switch (t)
279  {
280  case COLONCOLON: return "::";
281  case DOTDOT: return "..";
282  //case PLUSEQUAL: return "+=";
283  //case MINUSEQUAL: return "-=";
284  case MINUSMINUS: return "--";
285  case PLUSPLUS: return "++";
286  case EQUAL_EQUAL: return "==";
287  case LE: return "<=";
288  case GE: return ">=";
289  case NOTEQUAL: return "<>";
290  default: return Tok2Cmdname(t);
291  }
292 }

◆ iiWRITE()

BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 585 of file ipshell.cc.

586 {
587  sleftv vf;
588  if (iiConvert(v->Typ(),LINK_CMD,iiTestConvert(v->Typ(),LINK_CMD),v,&vf))
589  {
590  WerrorS("link expected");
591  return TRUE;
592  }
593  si_link l=(si_link)vf.Data();
594  if (vf.next == NULL)
595  {
596  WerrorS("write: need at least two arguments");
597  return TRUE;
598  }
599 
600  BOOLEAN b=slWrite(l,vf.next); /* iiConvert preserves next */
601  if (b)
602  {
603  const char *s;
604  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
605  else s=sNoName_fe;
606  Werror("cannot write to %s",s);
607  }
608  vf.CleanUp();
609  return b;
610 }

◆ IsCmd()

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

Definition at line 8860 of file iparith.cc.

8861 {
8862  int i;
8863  int an=1;
8864  int en=sArithBase.nLastIdentifier;
8865 
8866  loop
8867  //for(an=0; an<sArithBase.nCmdUsed; )
8868  {
8869  if(an>=en-1)
8870  {
8871  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8872  {
8873  i=an;
8874  break;
8875  }
8876  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8877  {
8878  i=en;
8879  break;
8880  }
8881  else
8882  {
8883  // -- blackbox extensions:
8884  // return 0;
8885  return blackboxIsCmd(n,tok);
8886  }
8887  }
8888  i=(an+en)/2;
8889  if (*n < *(sArithBase.sCmds[i].name))
8890  {
8891  en=i-1;
8892  }
8893  else if (*n > *(sArithBase.sCmds[i].name))
8894  {
8895  an=i+1;
8896  }
8897  else
8898  {
8899  int v=strcmp(n,sArithBase.sCmds[i].name);
8900  if(v<0)
8901  {
8902  en=i-1;
8903  }
8904  else if(v>0)
8905  {
8906  an=i+1;
8907  }
8908  else /*v==0*/
8909  {
8910  break;
8911  }
8912  }
8913  }
8915  tok=sArithBase.sCmds[i].tokval;
8916  if(sArithBase.sCmds[i].alias==2)
8917  {
8918  Warn("outdated identifier `%s` used - please change your code",
8919  sArithBase.sCmds[i].name);
8920  sArithBase.sCmds[i].alias=1;
8921  }
8922  #if 0
8923  if (currRingHdl==NULL)
8924  {
8925  #ifdef SIQ
8926  if (siq<=0)
8927  {
8928  #endif
8929  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8930  {
8931  WerrorS("no ring active");
8932  return 0;
8933  }
8934  #ifdef SIQ
8935  }
8936  #endif
8937  }
8938  #endif
8939  if (!expected_parms)
8940  {
8941  switch (tok)
8942  {
8943  case IDEAL_CMD:
8944  case INT_CMD:
8945  case INTVEC_CMD:
8946  case MAP_CMD:
8947  case MATRIX_CMD:
8948  case MODUL_CMD:
8949  case POLY_CMD:
8950  case PROC_CMD:
8951  case RING_CMD:
8952  case STRING_CMD:
8953  cmdtok = tok;
8954  break;
8955  }
8956  }
8957  return sArithBase.sCmds[i].toktype;
8958 }

◆ jjBETTI()

BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 891 of file ipshell.cc.

892 {
893  sleftv tmp;
894  memset(&tmp,0,sizeof(tmp));
895  tmp.rtyp=INT_CMD;
896  tmp.data=(void *)1;
897  if ((u->Typ()==IDEAL_CMD)
898  || (u->Typ()==MODUL_CMD))
899  return jjBETTI2_ID(res,u,&tmp);
900  else
901  return jjBETTI2(res,u,&tmp);
902 }

◆ jjBETTI2()

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

Definition at line 925 of file ipshell.cc.

926 {
927  resolvente r;
928  int len;
929  int reg,typ0;
930  lists l=(lists)u->Data();
931 
932  intvec *weights=NULL;
933  int add_row_shift=0;
934  intvec *ww=NULL;
935  if (l->nr>=0) ww=(intvec *)atGet(&(l->m[0]),"isHomog",INTVEC_CMD);
936  if (ww!=NULL)
937  {
938  weights=ivCopy(ww);
939  add_row_shift = ww->min_in();
940  (*weights) -= add_row_shift;
941  }
942  //Print("attr:%x\n",weights);
943 
944  r=liFindRes(l,&len,&typ0);
945  if (r==NULL) return TRUE;
946  intvec* res_im=syBetti(r,len,&reg,weights,(int)(long)v->Data());
947  res->data=(void*)res_im;
948  omFreeSize((ADDRESS)r,(len)*sizeof(ideal));
949  //Print("rowShift: %d ",add_row_shift);
950  for(int i=1;i<=res_im->rows();i++)
951  {
952  if (IMATELEM(*res_im,1,i)==0) { add_row_shift--; }
953  else break;
954  }
955  //Print(" %d\n",add_row_shift);
956  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
957  if (weights!=NULL) delete weights;
958  return FALSE;
959 }

◆ jjBETTI2_ID()

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

Definition at line 904 of file ipshell.cc.

905 {
907  l->Init(1);
908  l->m[0].rtyp=u->Typ();
909  l->m[0].data=u->Data();
910  attr *a=u->Attribute();
911  if (a!=NULL)
912  l->m[0].attribute=*a;
913  sleftv tmp2;
914  memset(&tmp2,0,sizeof(tmp2));
915  tmp2.rtyp=LIST_CMD;
916  tmp2.data=(void *)l;
917  BOOLEAN r=jjBETTI2(res,&tmp2,v);
918  l->m[0].data=NULL;
919  l->m[0].attribute=NULL;
920  l->m[0].rtyp=DEF_CMD;
921  l->Clean();
922  return r;
923 }

◆ jjCHARSERIES()

BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 3316 of file ipshell.cc.

3317 {
3318  res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
3319  return (res->data==NULL);
3320 }

◆ jjIMPORTFROM()

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

Definition at line 2214 of file ipassign.cc.

2215 {
2216  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2217  assume(u->Typ()==PACKAGE_CMD);
2218  char *vn=(char *)v->Name();
2219  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2220  if (h!=NULL)
2221  {
2222  //check for existence
2223  if (((package)(u->Data()))==basePack)
2224  {
2225  WarnS("source and destination packages are identical");
2226  return FALSE;
2227  }
2228  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2229  if (t!=NULL)
2230  {
2231  if (BVERBOSE(V_REDEFINE)) Warn("redefining %s (%s)",vn,my_yylinebuf);
2232  killhdl(t);
2233  }
2234  sleftv tmp_expr;
2235  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2236  sleftv h_expr;
2237  memset(&h_expr,0,sizeof(h_expr));
2238  h_expr.rtyp=IDHDL;
2239  h_expr.data=h;
2240  h_expr.name=vn;
2241  return iiAssign(&tmp_expr,&h_expr);
2242  }
2243  else
2244  {
2245  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2246  return TRUE;
2247  }
2248  return FALSE;
2249 }

◆ jjLIST_PL()

BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7480 of file iparith.cc.

7481 {
7482  int sl=0;
7483  if (v!=NULL) sl = v->listLength();
7484  lists L;
7485  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7486  {
7487  int add_row_shift = 0;
7488  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7489  if (weights!=NULL) add_row_shift=weights->min_in();
7490  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7491  }
7492  else
7493  {
7495  leftv h=NULL;
7496  int i;
7497  int rt;
7498 
7499  L->Init(sl);
7500  for (i=0;i<sl;i++)
7501  {
7502  if (h!=NULL)
7503  { /* e.g. not in the first step:
7504  * h is the pointer to the old sleftv,
7505  * v is the pointer to the next sleftv
7506  * (in this moment) */
7507  h->next=v;
7508  }
7509  h=v;
7510  v=v->next;
7511  h->next=NULL;
7512  rt=h->Typ();
7513  if (rt==0)
7514  {
7515  L->Clean();
7516  Werror("`%s` is undefined",h->Fullname());
7517  return TRUE;
7518  }
7519  if (rt==RING_CMD)
7520  {
7521  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7522  ((ring)L->m[i].data)->ref++;
7523  }
7524  else
7525  L->m[i].Copy(h);
7526  }
7527  }
7528  res->data=(char *)L;
7529  return FALSE;
7530 }

◆ jjLOAD()

BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport = FALSE 
)

load lib/module given in v

Definition at line 5218 of file iparith.cc.

5219 {
5220  char libnamebuf[1024];
5222 
5223 #ifdef HAVE_DYNAMIC_LOADING
5224  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5225 #endif /* HAVE_DYNAMIC_LOADING */
5226  switch(LT)
5227  {
5228  default:
5229  case LT_NONE:
5230  Werror("%s: unknown type", s);
5231  break;
5232  case LT_NOTFOUND:
5233  Werror("cannot open %s", s);
5234  break;
5235 
5236  case LT_SINGULAR:
5237  {
5238  char *plib = iiConvName(s);
5239  idhdl pl = IDROOT->get(plib,0);
5240  if (pl==NULL)
5241  {
5242  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5243  IDPACKAGE(pl)->language = LANG_SINGULAR;
5244  IDPACKAGE(pl)->libname=omStrDup(s);
5245  }
5246  else if (IDTYP(pl)!=PACKAGE_CMD)
5247  {
5248  Werror("can not create package `%s`",plib);
5249  omFree(plib);
5250  return TRUE;
5251  }
5252  else /* package */
5253  {
5254  package pa=IDPACKAGE(pl);
5255  if ((pa->language==LANG_C)
5256  || (pa->language==LANG_MIX))
5257  {
5258  Werror("can not create package `%s` - binaries exists",plib);
5259  omfree(plib);
5260  return TRUE;
5261  }
5262  }
5263  omFree(plib);
5264  package savepack=currPack;
5265  currPack=IDPACKAGE(pl);
5266  IDPACKAGE(pl)->loaded=TRUE;
5267  char libnamebuf[1024];
5268  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5269  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5270  currPack=savepack;
5271  IDPACKAGE(pl)->loaded=(!bo);
5272  return bo;
5273  }
5274  case LT_BUILTIN:
5275  SModulFunc_t iiGetBuiltinModInit(const char*);
5276  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5277  case LT_MACH_O:
5278  case LT_ELF:
5279  case LT_HPUX:
5280 #ifdef HAVE_DYNAMIC_LOADING
5281  return load_modules(s, libnamebuf, autoexport);
5282 #else /* HAVE_DYNAMIC_LOADING */
5283  WerrorS("Dynamic modules are not supported by this version of Singular");
5284  break;
5285 #endif /* HAVE_DYNAMIC_LOADING */
5286  }
5287  return TRUE;
5288 }

◆ jjLOAD_TRY()

BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5294 of file iparith.cc.

5295 {
5296  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5299  BOOLEAN bo=jjLOAD(s,TRUE);
5300  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5301  Print("loading of >%s< failed\n",s);
5302  WerrorS_callback=WerrorS_save;
5303  errorreported=0;
5304  return FALSE;
5305 }

◆ jjMINRES()

BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 870 of file ipshell.cc.

871 {
872  int len=0;
873  int typ0;
874  lists L=(lists)v->Data();
875  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
876  int add_row_shift = 0;
877  if (weights==NULL)
878  weights=(intvec*)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
879  if (weights!=NULL) add_row_shift=weights->min_in();
880  resolvente rr=liFindRes(L,&len,&typ0);
881  if (rr==NULL) return TRUE;
882  resolvente r=iiCopyRes(rr,len);
883 
884  syMinimizeResolvente(r,len,0);
885  omFreeSize((ADDRESS)rr,len*sizeof(ideal));
886  len++;
887  res->data=(char *)liMakeResolv(r,len,-1,typ0,NULL,add_row_shift);
888  return FALSE;
889 }

◆ jjRESULTANT()

BOOLEAN jjRESULTANT ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)

Definition at line 3309 of file ipshell.cc.

3310 {
3311  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
3312  (poly)w->CopyD(), currRing);
3313  return errorreported;
3314 }

◆ jjSYSTEM()

BOOLEAN jjSYSTEM ( leftv  res,
leftv  v 
)

Definition at line 228 of file extra.cc.

229 {
230  if(args->Typ() == STRING_CMD)
231  {
232  const char *sys_cmd=(char *)(args->Data());
233  leftv h=args->next;
234 // ONLY documented system calls go here
235 // Undocumented system calls go down into jjEXTENDED_SYSTEM (#ifdef HAVE_EXTENDED_SYSTEM)
236 /*==================== nblocks ==================================*/
237  if (strcmp(sys_cmd, "nblocks") == 0)
238  {
239  ring r;
240  if (h == NULL)
241  {
242  if (currRingHdl != NULL)
243  {
244  r = IDRING(currRingHdl);
245  }
246  else
247  {
248  WerrorS("no ring active");
249  return TRUE;
250  }
251  }
252  else
253  {
254  if (h->Typ() != RING_CMD)
255  {
256  WerrorS("ring expected");
257  return TRUE;
258  }
259  r = (ring) h->Data();
260  }
261  res->rtyp = INT_CMD;
262  res->data = (void*) (long)(rBlocks(r) - 1);
263  return FALSE;
264  }
265 /*==================== version ==================================*/
266  if(strcmp(sys_cmd,"version")==0)
267  {
268  res->rtyp=INT_CMD;
269  res->data=(void *)SINGULAR_VERSION;
270  return FALSE;
271  }
272  else
273 /*==================== alarm ==================================*/
274  if(strcmp(sys_cmd,"alarm")==0)
275  {
276  if ((h!=NULL) &&(h->Typ()==INT_CMD))
277  {
278  // standard variant -> SIGALARM (standard: abort)
279  //alarm((unsigned)h->next->Data());
280  // process time (user +system): SIGVTALARM
281  struct itimerval t,o;
282  memset(&t,0,sizeof(t));
283  t.it_value.tv_sec =(unsigned)((unsigned long)h->Data());
284  setitimer(ITIMER_VIRTUAL,&t,&o);
285  return FALSE;
286  }
287  else
288  WerrorS("int expected");
289  }
290  else
291 /*==================== cpu ==================================*/
292  if(strcmp(sys_cmd,"cpu")==0)
293  {
294  long cpu=1; //feOptValue(FE_OPT_CPUS);
295  #ifdef _SC_NPROCESSORS_ONLN
296  cpu=sysconf(_SC_NPROCESSORS_ONLN);
297  #elif defined(_SC_NPROCESSORS_CONF)
298  cpu=sysconf(_SC_NPROCESSORS_CONF);
299  #endif
300  res->data=(void *)cpu;
301  res->rtyp=INT_CMD;
302  return FALSE;
303  }
304  else
305 /*==================== executable ==================================*/
306  if(strcmp(sys_cmd,"executable")==0)
307  {
308  if ((h!=NULL) && (h->Typ()==STRING_CMD))
309  {
310  char tbuf[MAXPATHLEN];
311  char *s=omFindExec((char*)h->Data(),tbuf);
312  if(s==NULL) s=(char*)"";
313  res->data=(void *)omStrDup(s);
314  res->rtyp=STRING_CMD;
315  return FALSE;
316  }
317  return TRUE;
318  }
319  else
320  /*==================== flatten =============================*/
321  if(strcmp(sys_cmd,"flatten")==0)
322  {
323  if ((h!=NULL) &&(h->Typ()==SMATRIX_CMD))
324  {
325  res->data=(char*)sm_Flatten((ideal)h->Data(),currRing);
326  res->rtyp=SMATRIX_CMD;
327  return FALSE;
328  }
329  else
330  WerrorS("smatrix expected");
331  }
332  else
333  /*==================== unflatten =============================*/
334  if(strcmp(sys_cmd,"unflatten")==0)
335  {
336  const short t1[]={2,SMATRIX_CMD,INT_CMD};
337  if (iiCheckTypes(h,t1,1))
338  {
339  res->data=(char*)sm_UnFlatten((ideal)h->Data(),(int)(long)h->next->Data(),currRing);
340  res->rtyp=SMATRIX_CMD;
341  return res->data==NULL;
342  }
343  else return TRUE;
344  }
345  else
346  /*==================== neworder =============================*/
347  if(strcmp(sys_cmd,"neworder")==0)
348  {
349  if ((h!=NULL) &&(h->Typ()==IDEAL_CMD))
350  {
351  res->rtyp=STRING_CMD;
352  res->data=(void *)singclap_neworder((ideal)h->Data(), currRing);
353  return FALSE;
354  }
355  else
356  WerrorS("ideal expected");
357  }
358  else
359 /*===== nc_hilb ===============================================*/
360  // Hilbert series of non-commutative monomial algebras
361  if(strcmp(sys_cmd,"nc_hilb") == 0)
362  {
363  ideal i; int lV;
364  bool ig = FALSE;
365  bool mgrad = FALSE;
366  bool autop = FALSE;
367  int trunDegHs=0;
368  if((h != NULL)&&(h->Typ() == IDEAL_CMD))
369  i = (ideal)h->Data();
370  else
371  {
372  WerrorS("nc_Hilb:ideal expected");
373  return TRUE;
374  }
375  h = h->next;
376  if((h != NULL)&&(h->Typ() == INT_CMD))
377  lV = (int)(long)h->Data();
378  else
379  {
380  WerrorS("nc_Hilb:int expected");
381  return TRUE;
382  }
383  h = h->next;
384  while(h != NULL)
385  {
386  if((int)(long)h->Data() == 1)
387  ig = TRUE;
388  else if((int)(long)h->Data() == 2)
389  mgrad = TRUE;
390  else if(h->Typ()==STRING_CMD)
391  autop = TRUE;
392  else if(h->Typ() == INT_CMD)
393  trunDegHs = (int)(long)h->Data();
394  h = h->next;
395  }
396  if(h != NULL)
397  {
398  WerrorS("nc_Hilb:int 1,2, total degree for the truncation, and a string for printing the details are expected");
399  return TRUE;
400  }
401 
402  HilbertSeries_OrbitData(i, lV, ig, mgrad, autop, trunDegHs);
403  return(FALSE);
404  }
405  else
406 /*===== rcolon ===============================================*/
407  if(strcmp(sys_cmd,"rcolon") == 0)
408  {
409  const short t1[]={3,IDEAL_CMD,POLY_CMD,INT_CMD};
410  if (iiCheckTypes(h,t1,1))
411  {
412  ideal i = (ideal)h->Data();
413  h = h->next;
414  poly w=(poly)h->Data();
415  h = h->next;
416  int lV = (int)(long)h->Data();
417  res->rtyp = IDEAL_CMD;
418  res->data = RightColonOperation(i, w, lV);
419  return(FALSE);
420  }
421  else
422  return TRUE;
423  }
424  else
425 
426 /*==================== sh ==================================*/
427  if(strcmp(sys_cmd,"sh")==0)
428  {
429  if (feOptValue(FE_OPT_NO_SHELL))
430  {
431  WerrorS("shell execution is disallowed in restricted mode");
432  return TRUE;
433  }
434  res->rtyp=INT_CMD;
435  if (h==NULL) res->data = (void *)(long) system("sh");
436  else if (h->Typ()==STRING_CMD)
437  res->data = (void*)(long) system((char*)(h->Data()));
438  else
439  WerrorS("string expected");
440  return FALSE;
441  }
442  else
443 /*========reduce procedure like the global one but with jet bounds=======*/
444  if(strcmp(sys_cmd,"reduce_bound")==0)
445  {
446  poly p;
447  ideal pid=NULL;
448  const short t1[]={3,POLY_CMD,IDEAL_CMD,INT_CMD};
449  const short t2[]={3,IDEAL_CMD,IDEAL_CMD,INT_CMD};
450  const short t3[]={3,VECTOR_CMD,MODUL_CMD,INT_CMD};
451  const short t4[]={3,MODUL_CMD,MODUL_CMD,INT_CMD};
452  if ((iiCheckTypes(h,t1,0))||((iiCheckTypes(h,t3,0))))
453  {
454  p = (poly)h->CopyD();
455  }
456  else if ((iiCheckTypes(h,t2,0))||(iiCheckTypes(h,t4,1)))
457  {
458  pid = (ideal)h->CopyD();
459  }
460  else return TRUE;
461  //int htype;
462  res->rtyp= h->Typ(); /*htype*/
463  ideal q = (ideal)h->next->CopyD();
464  int bound = (int)(long)h->next->next->Data();
465  if (pid==NULL) /*(htype == POLY_CMD || htype == VECTOR_CMD)*/
466  res->data = (char *)kNFBound(q,currRing->qideal,p,bound);
467  else /*(htype == IDEAL_CMD || htype == MODUL_CMD)*/
468  res->data = (char *)kNFBound(q,currRing->qideal,pid,bound);
469  return FALSE;
470  }
471  else
472 /*==================== uname ==================================*/
473  if(strcmp(sys_cmd,"uname")==0)
474  {
475  res->rtyp=STRING_CMD;
476  res->data = omStrDup(S_UNAME);
477  return FALSE;
478  }
479  else
480 /*==================== with ==================================*/
481  if(strcmp(sys_cmd,"with")==0)
482  {
483  if (h==NULL)
484  {
485  res->rtyp=STRING_CMD;
486  res->data=(void *)versionString();
487  return FALSE;
488  }
489  else if (h->Typ()==STRING_CMD)
490  {
491  #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
492  char *s=(char *)h->Data();
493  res->rtyp=INT_CMD;
494  #ifdef HAVE_DBM
495  TEST_FOR("DBM")
496  #endif
497  #ifdef HAVE_DLD
498  TEST_FOR("DLD")
499  #endif
500  //TEST_FOR("factory")
501  //TEST_FOR("libfac")
502  #ifdef HAVE_READLINE
503  TEST_FOR("readline")
504  #endif
505  #ifdef TEST_MAC_ORDER
506  TEST_FOR("MAC_ORDER")
507  #endif
508  // unconditional since 3-1-0-6
509  TEST_FOR("Namespaces")
510  #ifdef HAVE_DYNAMIC_LOADING
511  TEST_FOR("DynamicLoading")
512  #endif
513  #ifdef HAVE_EIGENVAL
514  TEST_FOR("eigenval")
515  #endif
516  #ifdef HAVE_GMS
517  TEST_FOR("gms")
518  #endif
519  #ifdef OM_NDEBUG
520  TEST_FOR("om_ndebug")
521  #endif
522  #ifdef SING_NDEBUG
523  TEST_FOR("ndebug")
524  #endif
525  {};
526  return FALSE;
527  #undef TEST_FOR
528  }
529  return TRUE;
530  }
531  else
532  /*==================== browsers ==================================*/
533  if (strcmp(sys_cmd,"browsers")==0)
534  {
535  res->rtyp = STRING_CMD;
536  StringSetS("");
538  res->data = StringEndS();
539  return FALSE;
540  }
541  else
542  /*==================== pid ==================================*/
543  if (strcmp(sys_cmd,"pid")==0)
544  {
545  res->rtyp=INT_CMD;
546  res->data=(void *)(long) getpid();
547  return FALSE;
548  }
549  else
550  /*==================== getenv ==================================*/
551  if (strcmp(sys_cmd,"getenv")==0)
552  {
553  if ((h!=NULL) && (h->Typ()==STRING_CMD))
554  {
555  res->rtyp=STRING_CMD;
556  const char *r=getenv((char *)h->Data());
557  if (r==NULL) r="";
558  res->data=(void *)omStrDup(r);
559  return FALSE;
560  }
561  else
562  {
563  WerrorS("string expected");
564  return TRUE;
565  }
566  }
567  else
568  /*==================== setenv ==================================*/
569  if (strcmp(sys_cmd,"setenv")==0)
570  {
571  #ifdef HAVE_SETENV
572  const short t[]={2,STRING_CMD,STRING_CMD};
573  if (iiCheckTypes(h,t,1))
574  {
575  res->rtyp=STRING_CMD;
576  setenv((char *)h->Data(), (char *)h->next->Data(), 1);
577  res->data=(void *)omStrDup((char *)h->next->Data());
579  return FALSE;
580  }
581  else
582  {
583  return TRUE;
584  }
585  #else
586  WerrorS("setenv not supported on this platform");
587  return TRUE;
588  #endif
589  }
590  else
591  /*==================== Singular ==================================*/
592  if (strcmp(sys_cmd, "Singular") == 0)
593  {
594  res->rtyp=STRING_CMD;
595  const char *r=feResource("Singular");
596  if (r == NULL) r="";
597  res->data = (void*) omStrDup( r );
598  return FALSE;
599  }
600  else
601  if (strcmp(sys_cmd, "SingularLib") == 0)
602  {
603  res->rtyp=STRING_CMD;
604  const char *r=feResource("SearchPath");
605  if (r == NULL) r="";
606  res->data = (void*) omStrDup( r );
607  return FALSE;
608  }
609  else
610  /*==================== options ==================================*/
611  if (strstr(sys_cmd, "--") == sys_cmd)
612  {
613  if (strcmp(sys_cmd, "--") == 0)
614  {
616  return FALSE;
617  }
618  feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
619  if (opt == FE_OPT_UNDEF)
620  {
621  Werror("Unknown option %s", sys_cmd);
622  WerrorS("Use 'system(\"--\");' for listing of available options");
623  return TRUE;
624  }
625  // for Untyped Options (help version),
626  // setting it just triggers action
627  if (feOptSpec[opt].type == feOptUntyped)
628  {
629  feSetOptValue(opt,0);
630  return FALSE;
631  }
632  if (h == NULL)
633  {
634  if (feOptSpec[opt].type == feOptString)
635  {
636  res->rtyp = STRING_CMD;
637  const char *r=(const char*)feOptSpec[opt].value;
638  if (r == NULL) r="";
639  res->data = omStrDup(r);
640  }
641  else
642  {
643  res->rtyp = INT_CMD;
644  res->data = feOptSpec[opt].value;
645  }
646  return FALSE;
647  }
648  if (h->Typ() != STRING_CMD &&
649  h->Typ() != INT_CMD)
650  {
651  WerrorS("Need string or int argument to set option value");
652  return TRUE;
653  }
654  const char* errormsg;
655  if (h->Typ() == INT_CMD)
656  {
657  if (feOptSpec[opt].type == feOptString)
658  {
659  Werror("Need string argument to set value of option %s", sys_cmd);
660  return TRUE;
661  }
662  errormsg = feSetOptValue(opt, (int)((long) h->Data()));
663  if (errormsg != NULL)
664  Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
665  }
666  else
667  {
668  errormsg = feSetOptValue(opt, (char*) h->Data());
669  if (errormsg != NULL)
670  Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
671  }
672  if (errormsg != NULL) return TRUE;
673  return FALSE;
674  }
675  else
676  /*==================== HC ==================================*/
677  if (strcmp(sys_cmd,"HC")==0)
678  {
679  res->rtyp=INT_CMD;
680  res->data=(void *)(long) HCord;
681  return FALSE;
682  }
683  else
684  /*==================== random ==================================*/
685  if(strcmp(sys_cmd,"random")==0)
686  {
687  const short t[]={1,INT_CMD};
688  if (h!=NULL)
689  {
690  if (iiCheckTypes(h,t,1))
691  {
692  siRandomStart=(int)((long)h->Data());
695  return FALSE;
696  }
697  else
698  {
699  return TRUE;
700  }
701  }
702  res->rtyp=INT_CMD;
703  res->data=(void*)(long) siSeed;
704  return FALSE;
705  }
706  else
707  /*==================== std_syz =================*/
708  if (strcmp(sys_cmd, "std_syz") == 0)
709  {
710  ideal i1;
711  int i2;
712  if ((h!=NULL) && (h->Typ()==MODUL_CMD))
713  {
714  i1=(ideal)h->CopyD();
715  h=h->next;
716  }
717  else return TRUE;
718  if ((h!=NULL) && (h->Typ()==INT_CMD))
719  {
720  i2=(int)((long)h->Data());
721  }
722  else return TRUE;
723  res->rtyp=MODUL_CMD;
724  res->data=idXXX(i1,i2);
725  return FALSE;
726  }
727  else
728  /*======================= demon_list =====================*/
729  if (strcmp(sys_cmd,"denom_list")==0)
730  {
731  res->rtyp=LIST_CMD;
732  extern lists get_denom_list();
733  res->data=(lists)get_denom_list();
734  return FALSE;
735  }
736  else
737  /*==================== complexNearZero ======================*/
738  if(strcmp(sys_cmd,"complexNearZero")==0)
739  {
740  const short t[]={2,NUMBER_CMD,INT_CMD};
741  if (iiCheckTypes(h,t,1))
742  {
743  if ( !rField_is_long_C(currRing) )
744  {
745  WerrorS( "unsupported ground field!");
746  return TRUE;
747  }
748  else
749  {
750  res->rtyp=INT_CMD;
751  res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
752  (int)((long)(h->next->Data())));
753  return FALSE;
754  }
755  }
756  else
757  {
758  return TRUE;
759  }
760  }
761  else
762  /*==================== getPrecDigits ======================*/
763  if(strcmp(sys_cmd,"getPrecDigits")==0)
764  {
765  if ( (currRing==NULL)
767  {
768  WerrorS( "unsupported ground field!");
769  return TRUE;
770  }
771  res->rtyp=INT_CMD;
772  res->data=(void*)(long)gmp_output_digits;
773  //if (gmp_output_digits!=getGMPFloatDigits())
774  //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
775  return FALSE;
776  }
777  else
778  /*==================== lduDecomp ======================*/
779  if(strcmp(sys_cmd, "lduDecomp")==0)
780  {
781  const short t[]={1,MATRIX_CMD};
782  if (iiCheckTypes(h,t,1))
783  {
784  matrix aMat = (matrix)h->Data();
785  matrix pMat; matrix lMat; matrix dMat; matrix uMat;
786  poly l; poly u; poly prodLU;
787  lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
789  L->Init(7);
790  L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
791  L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
792  L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
793  L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
794  L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
795  L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
796  L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
797  res->rtyp = LIST_CMD;
798  res->data = (char *)L;
799  return FALSE;
800  }
801  else
802  {
803  return TRUE;
804  }
805  }
806  else
807  /*==================== lduSolve ======================*/
808  if(strcmp(sys_cmd, "lduSolve")==0)
809  {
810  /* for solving a linear equation system A * x = b, via the
811  given LDU-decomposition of the matrix A;
812  There is one valid parametrisation:
813  1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
814  P, L, D, and U realise the LDU-decomposition of A, that is,
815  P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
816  properties decribed in method 'luSolveViaLDUDecomp' in
817  linearAlgebra.h; see there;
818  l, u, and lTimesU are as described in the same location;
819  b is the right-hand side vector of the linear equation system;
820  The method will return a list of either 1 entry or three entries:
821  1) [0] if there is no solution to the system;
822  2) [1, x, H] if there is at least one solution;
823  x is any solution of the given linear system,
824  H is the matrix with column vectors spanning the homogeneous
825  solution space.
826  The method produces an error if matrix and vector sizes do not
827  fit. */
829  if (!iiCheckTypes(h,t,1))
830  {
831  return TRUE;
832  }
834  {
835  WerrorS("field required");
836  return TRUE;
837  }
838  matrix pMat = (matrix)h->Data();
839  matrix lMat = (matrix)h->next->Data();
840  matrix dMat = (matrix)h->next->next->Data();
841  matrix uMat = (matrix)h->next->next->next->Data();
842  poly l = (poly) h->next->next->next->next->Data();
843  poly u = (poly) h->next->next->next->next->next->Data();
844  poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
845  matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
846  matrix xVec; int solvable; matrix homogSolSpace;
847  if (pMat->rows() != pMat->cols())
848  {
849  Werror("first matrix (%d x %d) is not quadratic",
850  pMat->rows(), pMat->cols());
851  return TRUE;
852  }
853  if (lMat->rows() != lMat->cols())
854  {
855  Werror("second matrix (%d x %d) is not quadratic",
856  lMat->rows(), lMat->cols());
857  return TRUE;
858  }
859  if (dMat->rows() != dMat->cols())
860  {
861  Werror("third matrix (%d x %d) is not quadratic",
862  dMat->rows(), dMat->cols());
863  return TRUE;
864  }
865  if (dMat->cols() != uMat->rows())
866  {
867  Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
868  dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
869  "do not t");
870  return TRUE;
871  }
872  if (uMat->rows() != bVec->rows())
873  {
874  Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
875  uMat->rows(), uMat->cols(), bVec->rows());
876  return TRUE;
877  }
878  solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
879  bVec, xVec, homogSolSpace);
880 
881  /* build the return structure; a list with either one or
882  three entries */
884  if (solvable)
885  {
886  ll->Init(3);
887  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
888  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
889  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
890  }
891  else
892  {
893  ll->Init(1);
894  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
895  }
896  res->rtyp = LIST_CMD;
897  res->data=(char*)ll;
898  return FALSE;
899  }
900  else
901  /*==== countedref: reference and shared ====*/
902  if (strcmp(sys_cmd, "shared") == 0)
903  {
904  #ifndef SI_COUNTEDREF_AUTOLOAD
905  void countedref_shared_load();
907  #endif
908  res->rtyp = NONE;
909  return FALSE;
910  }
911  else if (strcmp(sys_cmd, "reference") == 0)
912  {
913  #ifndef SI_COUNTEDREF_AUTOLOAD
916  #endif
917  res->rtyp = NONE;
918  return FALSE;
919  }
920  else
921 /*==================== semaphore =================*/
922 #ifdef HAVE_SIMPLEIPC
923  if (strcmp(sys_cmd,"semaphore")==0)
924  {
925  if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
926  {
927  int v=1;
928  if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
929  v=(int)(long)h->next->next->Data();
930  res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
931  res->rtyp=INT_CMD;
932  return FALSE;
933  }
934  else
935  {
936  WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
937  return TRUE;
938  }
939  }
940  else
941 #endif
942 /*==================== reserved port =================*/
943  if (strcmp(sys_cmd,"reserve")==0)
944  {
945  int ssiReservePort(int clients);
946  const short t[]={1,INT_CMD};
947  if (iiCheckTypes(h,t,1))
948  {
949  res->rtyp=INT_CMD;
950  int p=ssiReservePort((int)(long)h->Data());
951  res->data=(void*)(long)p;
952  return (p==0);
953  }
954  return TRUE;
955  }
956  else
957 /*==================== reserved link =================*/
958  if (strcmp(sys_cmd,"reservedLink")==0)
959  {
960  res->rtyp=LINK_CMD;
962  res->data=(void*)p;
963  return (p==NULL);
964  }
965  else
966 /*==================== install newstruct =================*/
967  if (strcmp(sys_cmd,"install")==0)
968  {
969  const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
970  if (iiCheckTypes(h,t,1))
971  {
972  return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
973  (int)(long)h->next->next->next->Data(),
974  (procinfov)h->next->next->Data());
975  }
976  return TRUE;
977  }
978  else
979 /*==================== newstruct =================*/
980  if (strcmp(sys_cmd,"newstruct")==0)
981  {
982  const short t[]={1,STRING_CMD};
983  if (iiCheckTypes(h,t,1))
984  {
985  int id=0;
986  char *n=(char*)h->Data();
987  blackboxIsCmd(n,id);
988  if (id>0)
989  {
990  blackbox *bb=getBlackboxStuff(id);
991  if (BB_LIKE_LIST(bb))
992  {
993  newstruct_desc desc=(newstruct_desc)bb->data;
994  newstructShow(desc);
995  return FALSE;
996  }
997  else Werror("'%s' is not a newstruct",n);
998  }
999  else Werror("'%s' is not a blackbox object",n);
1000  }
1001  return TRUE;
1002  }
1003  else
1004 /*==================== blackbox =================*/
1005  if (strcmp(sys_cmd,"blackbox")==0)
1006  {
1008  return FALSE;
1009  }
1010  else
1011  /*================= absBiFact ======================*/
1012  #ifdef HAVE_NTL
1013  if (strcmp(sys_cmd, "absFact") == 0)
1014  {
1015  const short t[]={1,POLY_CMD};
1016  if (iiCheckTypes(h,t,1)
1017  && (currRing!=NULL)
1018  && (getCoeffType(currRing->cf)==n_transExt))
1019  {
1020  res->rtyp=LIST_CMD;
1021  intvec *v=NULL;
1022  ideal mipos= NULL;
1023  int n= 0;
1024  ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
1025  if (f==NULL) return TRUE;
1026  ivTest(v);
1028  l->Init(4);
1029  l->m[0].rtyp=IDEAL_CMD;
1030  l->m[0].data=(void *)f;
1031  l->m[1].rtyp=INTVEC_CMD;
1032  l->m[1].data=(void *)v;
1033  l->m[2].rtyp=IDEAL_CMD;
1034  l->m[2].data=(void*) mipos;
1035  l->m[3].rtyp=INT_CMD;
1036  l->m[3].data=(void*) (long) n;
1037  res->data=(void *)l;
1038  return FALSE;
1039  }
1040  else return TRUE;
1041  }
1042  else
1043  #endif
1044  /* =================== LLL via NTL ==============================*/
1045  #ifdef HAVE_NTL
1046  if (strcmp(sys_cmd, "LLL") == 0)
1047  {
1048  if (h!=NULL)
1049  {
1050  res->rtyp=h->Typ();
1051  if (h->Typ()==MATRIX_CMD)
1052  {
1053  res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
1054  return FALSE;
1055  }
1056  else if (h->Typ()==INTMAT_CMD)
1057  {
1058  res->data=(char *)singntl_LLL((intvec*)h->Data());
1059  return FALSE;
1060  }
1061  else return TRUE;
1062  }
1063  else return TRUE;
1064  }
1065  else
1066  #endif
1067  /* =================== LLL via Flint ==============================*/
1068  #ifdef HAVE_FLINT
1069  #if __FLINT_RELEASE >= 20500
1070  if (strcmp(sys_cmd, "LLL_Flint") == 0)
1071  {
1072  if (h!=NULL)
1073  {
1074  if(h->next == NULL)
1075  {
1076  res->rtyp=h->Typ();
1077  if (h->Typ()==BIGINTMAT_CMD)
1078  {
1079  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1080  return FALSE;
1081  }
1082  else if (h->Typ()==INTMAT_CMD)
1083  {
1084  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1085  return FALSE;
1086  }
1087  else return TRUE;
1088  }
1089  if(h->next->Typ()!= INT_CMD)
1090  {
1091  WerrorS("matrix,int or bigint,int expected");
1092  return TRUE;
1093  }
1094  if(h->next->Typ()== INT_CMD)
1095  {
1096  if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
1097  {
1098  WerrorS("int is different from 0, 1");
1099  return TRUE;
1100  }
1101  res->rtyp=h->Typ();
1102  if((long)(h->next->Data()) == 0)
1103  {
1104  if (h->Typ()==BIGINTMAT_CMD)
1105  {
1106  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
1107  return FALSE;
1108  }
1109  else if (h->Typ()==INTMAT_CMD)
1110  {
1111  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1112  return FALSE;
1113  }
1114  else return TRUE;
1115  }
1116  // This will give also the transformation matrix U s.t. res = U * m
1117  if((long)(h->next->Data()) == 1)
1118  {
1119  if (h->Typ()==BIGINTMAT_CMD)
1120  {
1121  bigintmat* m = (bigintmat*)h->Data();
1122  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1123  for(int i = 1; i<=m->rows(); i++)
1124  {
1125  n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1126  BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1127  }
1128  m = singflint_LLL(m,T);
1130  L->Init(2);
1131  L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1132  L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1133  res->data=L;
1134  res->rtyp=LIST_CMD;
1135  return FALSE;
1136  }
1137  else if (h->Typ()==INTMAT_CMD)
1138  {
1139  intvec* m = (intvec*)h->Data();
1140  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1141  for(int i = 1; i<=m->rows(); i++)
1142  IMATELEM(*T,i,i)=1;
1143  m = singflint_LLL(m,T);
1145  L->Init(2);
1146  L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1147  L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1148  res->data=L;
1149  res->rtyp=LIST_CMD;
1150  return FALSE;
1151  }
1152  else return TRUE;
1153  }
1154  }
1155 
1156  }
1157  else return TRUE;
1158  }
1159  else
1160  #endif
1161  #endif
1162  /*==================== shift-test for freeGB =================*/
1163  #ifdef HAVE_SHIFTBBA
1164  if (strcmp(sys_cmd, "stest") == 0)
1165  {
1166  const short t[]={4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};
1167  if (iiCheckTypes(h,t,1))
1168  {
1169  poly p=(poly)h->CopyD();
1170  h=h->next;
1171  int sh=(int)((long)(h->Data()));
1172  h=h->next;
1173  int uptodeg=(int)((long)(h->Data()));
1174  h=h->next;
1175  int lVblock=(int)((long)(h->Data()));
1176  if (sh<0)
1177  {
1178  WerrorS("negative shift for pLPshift");
1179  return TRUE;
1180  }
1181  int L = pLastVblock(p,lVblock);
1182  if (L+sh > uptodeg)
1183  {
1184  WerrorS("pLPshift: too big shift requested\n");
1185  return TRUE;
1186  }
1187  res->data = p_LPshift(p,sh,uptodeg,lVblock,currRing);
1188  res->rtyp = POLY_CMD;
1189  return FALSE;
1190  }
1191  else return TRUE;
1192  }
1193  else
1194  #endif
1195  /*==================== block-test for freeGB =================*/
1196  #ifdef HAVE_SHIFTBBA
1197  if (strcmp(sys_cmd, "btest") == 0)
1198  {
1199  const short t[]={2,POLY_CMD,INT_CMD};
1200  if (iiCheckTypes(h,t,1))
1201  {
1202  poly p=(poly)h->CopyD();
1203  h=h->next;
1204  int lV=(int)((long)(h->Data()));
1205  res->rtyp = INT_CMD;
1206  res->data = (void*)(long)pLastVblock(p, lV);
1207  return FALSE;
1208  }
1209  else return TRUE;
1210  }
1211  else
1212  #endif
1213  /*==================== shrink-test for freeGB =================*/
1214  #ifdef HAVE_SHIFTBBA
1215  if (strcmp(sys_cmd, "shrinktest") == 0)
1216  {
1217  const short t[]={2,POLY_CMD,INT_CMD};
1218  if (iiCheckTypes(h,t,1))
1219  {
1220  poly p=(poly)h->Data();
1221  h=h->next;
1222  int lV=(int)((long)(h->Data()));
1223  res->rtyp = POLY_CMD;
1224  // res->data = p_mShrink(p, lV, currRing);
1225  // kStrategy strat=new skStrategy;
1226  // strat->tailRing = currRing;
1227  res->data = p_Shrink(p, lV, currRing);
1228  return FALSE;
1229  }
1230  else return TRUE;
1231  }
1232  else
1233  #endif
1234  /*==================== pcv ==================================*/
1235  #ifdef HAVE_PCV
1236  if(strcmp(sys_cmd,"pcvLAddL")==0)
1237  {
1238  return pcvLAddL(res,h);
1239  }
1240  else
1241  if(strcmp(sys_cmd,"pcvPMulL")==0)
1242  {
1243  return pcvPMulL(res,h);
1244  }
1245  else
1246  if(strcmp(sys_cmd,"pcvMinDeg")==0)
1247  {
1248  return pcvMinDeg(res,h);
1249  }
1250  else
1251  if(strcmp(sys_cmd,"pcvP2CV")==0)
1252  {
1253  return pcvP2CV(res,h);
1254  }
1255  else
1256  if(strcmp(sys_cmd,"pcvCV2P")==0)
1257  {
1258  return pcvCV2P(res,h);
1259  }
1260  else
1261  if(strcmp(sys_cmd,"pcvDim")==0)
1262  {
1263  return pcvDim(res,h);
1264  }
1265  else
1266  if(strcmp(sys_cmd,"pcvBasis")==0)
1267  {
1268  return pcvBasis(res,h);
1269  }
1270  else
1271  #endif
1272  /*==================== hessenberg/eigenvalues ==================================*/
1273  #ifdef HAVE_EIGENVAL
1274  if(strcmp(sys_cmd,"hessenberg")==0)
1275  {
1276  return evHessenberg(res,h);
1277  }
1278  else
1279  #endif
1280  /*==================== eigenvalues ==================================*/
1281  #ifdef HAVE_EIGENVAL
1282  if(strcmp(sys_cmd,"eigenvals")==0)
1283  {
1284  return evEigenvals(res,h);
1285  }
1286  else
1287  #endif
1288  /*==================== rowelim ==================================*/
1289  #ifdef HAVE_EIGENVAL
1290  if(strcmp(sys_cmd,"rowelim")==0)
1291  {
1292  return evRowElim(res,h);
1293  }
1294  else
1295  #endif
1296  /*==================== rowcolswap ==================================*/
1297  #ifdef HAVE_EIGENVAL
1298  if(strcmp(sys_cmd,"rowcolswap")==0)
1299  {
1300  return evSwap(res,h);
1301  }
1302  else
1303  #endif
1304  /*==================== Gauss-Manin system ==================================*/
1305  #ifdef HAVE_GMS
1306  if(strcmp(sys_cmd,"gmsnf")==0)
1307  {
1308  return gmsNF(res,h);
1309  }
1310  else
1311  #endif
1312  /*==================== contributors =============================*/
1313  if(strcmp(sys_cmd,"contributors") == 0)
1314  {
1315  res->rtyp=STRING_CMD;
1316  res->data=(void *)omStrDup(
1317  "Olaf Bachmann, Michael Brickenstein, Hubert Grassmann, Kai Krueger, Victor Levandovskyy, Wolfgang Neumann, Thomas Nuessler, Wilfred Pohl, Jens Schmidt, Mathias Schulze, Thomas Siebert, Ruediger Stobbe, Moritz Wenk, Tim Wichmann");
1318  return FALSE;
1319  }
1320  else
1321  /*==================== spectrum =============================*/
1322  #ifdef HAVE_SPECTRUM
1323  if(strcmp(sys_cmd,"spectrum") == 0)
1324  {
1325  if ((h==NULL) || (h->Typ()!=POLY_CMD))
1326  {
1327  WerrorS("poly expected");
1328  return TRUE;
1329  }
1330  if (h->next==NULL)
1331  return spectrumProc(res,h);
1332  if (h->next->Typ()!=INT_CMD)
1333  {
1334  WerrorS("poly,int expected");
1335  return TRUE;
1336  }
1337  if(((long)h->next->Data())==1L)
1338  return spectrumfProc(res,h);
1339  return spectrumProc(res,h);
1340  }
1341  else
1342  /*==================== semic =============================*/
1343  if(strcmp(sys_cmd,"semic") == 0)
1344  {
1345  if ((h->next!=NULL)
1346  && (h->Typ()==LIST_CMD)
1347  && (h->next->Typ()==LIST_CMD))
1348  {
1349  if (h->next->next==NULL)
1350  return semicProc(res,h,h->next);
1351  else if (h->next->next->Typ()==INT_CMD)
1352  return semicProc3(res,h,h->next,h->next->next);
1353  }
1354  return TRUE;
1355  }
1356  else
1357  /*==================== spadd =============================*/
1358  if(strcmp(sys_cmd,"spadd") == 0)
1359  {
1360  const short t[]={2,LIST_CMD,LIST_CMD};
1361  if (iiCheckTypes(h,t,1))
1362  {
1363  return spaddProc(res,h,h->next);
1364  }
1365  return TRUE;
1366  }
1367  else
1368  /*==================== spmul =============================*/
1369  if(strcmp(sys_cmd,"spmul") == 0)
1370  {
1371  const short t[]={2,LIST_CMD,INT_CMD};
1372  if (iiCheckTypes(h,t,1))
1373  {
1374  return spmulProc(res,h,h->next);
1375  }
1376  return TRUE;
1377  }
1378  else
1379  #endif
1380 /*==================== tensorModuleMult ========================= */
1381  #define HAVE_SHEAFCOH_TRICKS 1
1382 
1383  #ifdef HAVE_SHEAFCOH_TRICKS
1384  if(strcmp(sys_cmd,"tensorModuleMult")==0)
1385  {
1386  const short t[]={2,INT_CMD,MODUL_CMD};
1387  // WarnS("tensorModuleMult!");
1388  if (iiCheckTypes(h,t,1))
1389  {
1390  int m = (int)( (long)h->Data() );
1391  ideal M = (ideal)h->next->Data();
1392  res->rtyp=MODUL_CMD;
1393  res->data=(void *)id_TensorModuleMult(m, M, currRing);
1394  return FALSE;
1395  }
1396  return TRUE;
1397  }
1398  else
1399  #endif
1400  /*==================== twostd =================*/
1401  #ifdef HAVE_PLURAL
1402  if (strcmp(sys_cmd, "twostd") == 0)
1403  {
1404  ideal I;
1405  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1406  {
1407  I=(ideal)h->CopyD();
1408  res->rtyp=IDEAL_CMD;
1409  if (rIsPluralRing(currRing)) res->data=twostd(I);
1410  else res->data=I;
1412  setFlag(res,FLAG_STD);
1413  }
1414  else return TRUE;
1415  return FALSE;
1416  }
1417  else
1418  #endif
1419  /*==================== lie bracket =================*/
1420  #ifdef HAVE_PLURAL
1421  if (strcmp(sys_cmd, "bracket") == 0)
1422  {
1423  const short t[]={2,POLY_CMD,POLY_CMD};
1424  if (iiCheckTypes(h,t,1))
1425  {
1426  poly p=(poly)h->CopyD();
1427  h=h->next;
1428  poly q=(poly)h->Data();
1429  res->rtyp=POLY_CMD;
1431  return FALSE;
1432  }
1433  return TRUE;
1434  }
1435  else
1436  #endif
1437  /*==================== env ==================================*/
1438  #ifdef HAVE_PLURAL
1439  if (strcmp(sys_cmd, "env")==0)
1440  {
1441  if ((h!=NULL) && (h->Typ()==RING_CMD))
1442  {
1443  ring r = (ring)h->Data();
1444  res->data = rEnvelope(r);
1445  res->rtyp = RING_CMD;
1446  return FALSE;
1447  }
1448  else
1449  {
1450  WerrorS("`system(\"env\",<ring>)` expected");
1451  return TRUE;
1452  }
1453  }
1454  else
1455  #endif
1456 /* ============ opp ======================== */
1457  #ifdef HAVE_PLURAL
1458  if (strcmp(sys_cmd, "opp")==0)
1459  {
1460  if ((h!=NULL) && (h->Typ()==RING_CMD))
1461  {
1462  ring r=(ring)h->Data();
1463  res->data=rOpposite(r);
1464  res->rtyp=RING_CMD;
1465  return FALSE;
1466  }
1467  else
1468  {
1469  WerrorS("`system(\"opp\",<ring>)` expected");
1470  return TRUE;
1471  }
1472  }
1473  else
1474  #endif
1475  /*==================== oppose ==================================*/
1476  #ifdef HAVE_PLURAL
1477  if (strcmp(sys_cmd, "oppose")==0)
1478  {
1479  if ((h!=NULL) && (h->Typ()==RING_CMD)
1480  && (h->next!= NULL))
1481  {
1482  ring Rop = (ring)h->Data();
1483  h = h->next;
1484  idhdl w;
1485  if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1486  {
1487  poly p = (poly)IDDATA(w);
1488  res->data = pOppose(Rop, p, currRing); // into CurrRing?
1489  res->rtyp = POLY_CMD;
1490  return FALSE;
1491  }
1492  }
1493  else
1494  {
1495  WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1496  return TRUE;
1497  }
1498  }
1499  else
1500  #endif
1501  /*==================== freeGB, twosided GB in free algebra =================*/
1502  #ifdef HAVE_PLURAL
1503  #ifdef HAVE_SHIFTBBA
1504  if (strcmp(sys_cmd, "freegb") == 0)
1505  {
1506  const short t[]={3,IDEAL_CMD,INT_CMD,INT_CMD};
1507  const short tM[]={3,MODUL_CMD,INT_CMD,INT_CMD};
1508  if (iiCheckTypes(h,tM,0)
1509  || (iiCheckTypes(h,t,0)))
1510  {
1511  res->rtyp=h->Typ();
1512  ideal I=(ideal)h->CopyD();
1513  h=h->next;
1514  int uptodeg=(int)((long)(h->Data()));
1515  h=h->next;
1516  int lVblock=(int)((long)(h->Data()));
1517  res->data = freegb(I,uptodeg,lVblock);
1518  if (res->data == NULL)
1519  {
1520  /* that is there were input errors */
1521  res->data = I;
1522  }
1523  return FALSE;
1524  }
1525  else
1526  {
1527  WerrorS("system(\"freegb\",`ideal/module`,`int`,`int`) expected");
1528  return TRUE;
1529  }
1530  }
1531  else
1532  #endif /*SHIFTBBA*/
1533  #endif /*PLURAL*/
1534  /*==================== walk stuff =================*/
1535  /*==================== walkNextWeight =================*/
1536  #ifdef HAVE_WALK
1537  #ifdef OWNW
1538  if (strcmp(sys_cmd, "walkNextWeight") == 0)
1539  {
1540  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1541  if (!iiCheckTypes(h,t,1)) return TRUE;
1542  if (((intvec*) h->Data())->length() != currRing->N ||
1543  ((intvec*) h->next->Data())->length() != currRing->N)
1544  {
1545  Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1546  currRing->N);
1547  return TRUE;
1548  }
1549  res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1550  ((intvec*) h->next->Data()),
1551  (ideal) h->next->next->Data());
1552  if (res->data == NULL || res->data == (void*) 1L)
1553  {
1554  res->rtyp = INT_CMD;
1555  }
1556  else
1557  {
1558  res->rtyp = INTVEC_CMD;
1559  }
1560  return FALSE;
1561  }
1562  else
1563  #endif
1564  #endif
1565  /*==================== walkNextWeight =================*/
1566  #ifdef HAVE_WALK
1567  #ifdef OWNW
1568  if (strcmp(sys_cmd, "walkInitials") == 0)
1569  {
1570  if (h == NULL || h->Typ() != IDEAL_CMD)
1571  {
1572  WerrorS("system(\"walkInitials\", ideal) expected");
1573  return TRUE;
1574  }
1575  res->data = (void*) walkInitials((ideal) h->Data());
1576  res->rtyp = IDEAL_CMD;
1577  return FALSE;
1578  }
1579  else
1580  #endif
1581  #endif
1582  /*==================== walkAddIntVec =================*/
1583  #ifdef HAVE_WALK
1584  #ifdef WAIV
1585  if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1586  {
1587  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1588  if (!iiCheckTypes(h,t,1)) return TRUE;
1589  intvec* arg1 = (intvec*) h->Data();
1590  intvec* arg2 = (intvec*) h->next->Data();
1591  res->data = (intvec*) walkAddIntVec(arg1, arg2);
1592  res->rtyp = INTVEC_CMD;
1593  return FALSE;
1594  }
1595  else
1596  #endif
1597  #endif
1598  /*==================== MwalkNextWeight =================*/
1599  #ifdef HAVE_WALK
1600  #ifdef MwaklNextWeight
1601  if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1602  {
1603  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1604  if (!iiCheckTypes(h,t,1)) return TRUE;
1605  if (((intvec*) h->Data())->length() != currRing->N ||
1606  ((intvec*) h->next->Data())->length() != currRing->N)
1607  {
1608  Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1609  currRing->N);
1610  return TRUE;
1611  }
1612  intvec* arg1 = (intvec*) h->Data();
1613  intvec* arg2 = (intvec*) h->next->Data();
1614  ideal arg3 = (ideal) h->next->next->Data();
1615  intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1616  res->rtyp = INTVEC_CMD;
1617  res->data = result;
1618  return FALSE;
1619  }
1620  else
1621  #endif //MWalkNextWeight
1622  #endif
1623  /*==================== Mivdp =================*/
1624  #ifdef HAVE_WALK
1625  if(strcmp(sys_cmd, "Mivdp") == 0)
1626  {
1627  if (h == NULL || h->Typ() != INT_CMD)
1628  {
1629  WerrorS("system(\"Mivdp\", int) expected");
1630  return TRUE;
1631  }
1632  if ((int) ((long)(h->Data())) != currRing->N)
1633  {
1634  Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1635  currRing->N);
1636  return TRUE;
1637  }
1638  int arg1 = (int) ((long)(h->Data()));
1639  intvec* result = (intvec*) Mivdp(arg1);
1640  res->rtyp = INTVEC_CMD;
1641  res->data = result;
1642  return FALSE;
1643  }
1644  else
1645  #endif
1646  /*==================== Mivlp =================*/
1647  #ifdef HAVE_WALK
1648  if(strcmp(sys_cmd, "Mivlp") == 0)
1649  {
1650  if (h == NULL || h->Typ() != INT_CMD)
1651  {
1652  WerrorS("system(\"Mivlp\", int) expected");
1653  return TRUE;
1654  }
1655  if ((int) ((long)(h->Data())) != currRing->N)
1656  {
1657  Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1658  currRing->N);
1659  return TRUE;
1660  }
1661  int arg1 = (int) ((long)(h->Data()));
1662  intvec* result = (intvec*) Mivlp(arg1);
1663  res->rtyp = INTVEC_CMD;
1664  res->data = result;
1665  return FALSE;
1666  }
1667  else
1668  #endif
1669  /*==================== MpDiv =================*/
1670  #ifdef HAVE_WALK
1671  #ifdef MpDiv
1672  if(strcmp(sys_cmd, "MpDiv") == 0)
1673  {
1674  const short t[]={2,POLY_CMD,POLY_CMD};
1675  if (!iiCheckTypes(h,t,1)) return TRUE;
1676  poly arg1 = (poly) h->Data();
1677  poly arg2 = (poly) h->next->Data();
1678  poly result = MpDiv(arg1, arg2);
1679  res->rtyp = POLY_CMD;
1680  res->data = result;
1681  return FALSE;
1682  }
1683  else
1684  #endif
1685  #endif
1686  /*==================== MpMult =================*/
1687  #ifdef HAVE_WALK
1688  #ifdef MpMult
1689  if(strcmp(sys_cmd, "MpMult") == 0)
1690  {
1691  const short t[]={2,POLY_CMD,POLY_CMD};
1692  if (!iiCheckTypes(h,t,1)) return TRUE;
1693  poly arg1 = (poly) h->Data();
1694  poly arg2 = (poly) h->next->Data();
1695  poly result = MpMult(arg1, arg2);
1696  res->rtyp = POLY_CMD;
1697  res->data = result;
1698  return FALSE;
1699  }
1700  else
1701  #endif
1702  #endif
1703  /*==================== MivSame =================*/
1704  #ifdef HAVE_WALK
1705  if (strcmp(sys_cmd, "MivSame") == 0)
1706  {
1707  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1708  if (!iiCheckTypes(h,t,1)) return TRUE;
1709  /*
1710  if (((intvec*) h->Data())->length() != currRing->N ||
1711  ((intvec*) h->next->Data())->length() != currRing->N)
1712  {
1713  Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1714  currRing->N);
1715  return TRUE;
1716  }
1717  */
1718  intvec* arg1 = (intvec*) h->Data();
1719  intvec* arg2 = (intvec*) h->next->Data();
1720  /*
1721  poly result = (poly) MivSame(arg1, arg2);
1722  res->rtyp = POLY_CMD;
1723  res->data = (poly) result;
1724  */
1725  res->rtyp = INT_CMD;
1726  res->data = (void*)(long) MivSame(arg1, arg2);
1727  return FALSE;
1728  }
1729  else
1730  #endif
1731  /*==================== M3ivSame =================*/
1732  #ifdef HAVE_WALK
1733  if (strcmp(sys_cmd, "M3ivSame") == 0)
1734  {
1735  const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1736  if (!iiCheckTypes(h,t,1)) return TRUE;
1737  /*
1738  if (((intvec*) h->Data())->length() != currRing->N ||
1739  ((intvec*) h->next->Data())->length() != currRing->N ||
1740  ((intvec*) h->next->next->Data())->length() != currRing->N )
1741  {
1742  Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1743  currRing->N);
1744  return TRUE;
1745  }
1746  */
1747  intvec* arg1 = (intvec*) h->Data();
1748  intvec* arg2 = (intvec*) h->next->Data();
1749  intvec* arg3 = (intvec*) h->next->next->Data();
1750  /*
1751  poly result = (poly) M3ivSame(arg1, arg2, arg3);
1752  res->rtyp = POLY_CMD;
1753  res->data = (poly) result;
1754  */
1755  res->rtyp = INT_CMD;
1756  res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1757  return FALSE;
1758  }
1759  else
1760  #endif
1761  /*==================== MwalkInitialForm =================*/
1762  #ifdef HAVE_WALK
1763  if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1764  {
1765  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1766  if (!iiCheckTypes(h,t,1)) return TRUE;
1767  if(((intvec*) h->next->Data())->length() != currRing->N)
1768  {
1769  Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1770  currRing->N);
1771  return TRUE;
1772  }
1773  ideal id = (ideal) h->Data();
1774  intvec* int_w = (intvec*) h->next->Data();
1775  ideal result = (ideal) MwalkInitialForm(id, int_w);
1776  res->rtyp = IDEAL_CMD;
1777  res->data = result;
1778  return FALSE;
1779  }
1780  else
1781  #endif
1782  /*==================== MivMatrixOrder =================*/
1783  #ifdef HAVE_WALK
1784  /************** Perturbation walk **********/
1785  if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1786  {
1787  if(h==NULL || h->Typ() != INTVEC_CMD)
1788  {
1789  WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1790  return TRUE;
1791  }
1792  intvec* arg1 = (intvec*) h->Data();
1793  intvec* result = MivMatrixOrder(arg1);
1794  res->rtyp = INTVEC_CMD;
1795  res->data = result;
1796  return FALSE;
1797  }
1798  else
1799  #endif
1800  /*==================== MivMatrixOrderdp =================*/
1801  #ifdef HAVE_WALK
1802  if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1803  {
1804  if(h==NULL || h->Typ() != INT_CMD)
1805  {
1806  WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1807  return TRUE;
1808  }
1809  int arg1 = (int) ((long)(h->Data()));
1810  intvec* result = (intvec*) MivMatrixOrderdp(arg1);
1811  res->rtyp = INTVEC_CMD;
1812  res->data = result;
1813  return FALSE;
1814  }
1815  else
1816  #endif
1817  /*==================== MPertVectors =================*/
1818  #ifdef HAVE_WALK
1819  if(strcmp(sys_cmd, "MPertVectors") == 0)
1820  {
1821  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1822  if (!iiCheckTypes(h,t,1)) return TRUE;
1823  ideal arg1 = (ideal) h->Data();
1824  intvec* arg2 = (intvec*) h->next->Data();
1825  int arg3 = (int) ((long)(h->next->next->Data()));
1826  intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1827  res->rtyp = INTVEC_CMD;
1828  res->data = result;
1829  return FALSE;
1830  }
1831  else
1832  #endif
1833  /*==================== MPertVectorslp =================*/
1834  #ifdef HAVE_WALK
1835  if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1836  {
1837  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1838  if (!iiCheckTypes(h,t,1)) return TRUE;
1839  ideal arg1 = (ideal) h->Data();
1840  intvec* arg2 = (intvec*) h->next->Data();
1841  int arg3 = (int) ((long)(h->next->next->Data()));
1842  intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1843  res->rtyp = INTVEC_CMD;
1844  res->data = result;
1845  return FALSE;
1846  }
1847  else
1848  #endif
1849  /************** fractal walk **********/
1850  #ifdef HAVE_WALK
1851  if(strcmp(sys_cmd, "Mfpertvector") == 0)
1852  {
1853  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1854  if (!iiCheckTypes(h,t,1)) return TRUE;
1855  ideal arg1 = (ideal) h->Data();
1856  intvec* arg2 = (intvec*) h->next->Data();
1857  intvec* result = Mfpertvector(arg1, arg2);
1858  res->rtyp = INTVEC_CMD;
1859  res->data = result;
1860  return FALSE;
1861  }
1862  else
1863  #endif
1864  /*==================== MivUnit =================*/
1865  #ifdef HAVE_WALK
1866  if(strcmp(sys_cmd, "MivUnit") == 0)
1867  {
1868  const short t[]={1,INT_CMD};
1869  if (!iiCheckTypes(h,t,1)) return TRUE;
1870  int arg1 = (int) ((long)(h->Data()));
1871  intvec* result = (intvec*) MivUnit(arg1);
1872  res->rtyp = INTVEC_CMD;
1873  res->data = result;
1874  return FALSE;
1875  }
1876  else
1877  #endif
1878  /*==================== MivWeightOrderlp =================*/
1879  #ifdef HAVE_WALK
1880  if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1881  {
1882  const short t[]={1,INTVEC_CMD};
1883  if (!iiCheckTypes(h,t,1)) return TRUE;
1884  intvec* arg1 = (intvec*) h->Data();
1885  intvec* result = MivWeightOrderlp(arg1);
1886  res->rtyp = INTVEC_CMD;
1887  res->data = result;
1888  return FALSE;
1889  }
1890  else
1891  #endif
1892  /*==================== MivWeightOrderdp =================*/
1893  #ifdef HAVE_WALK
1894  if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1895  {
1896  if(h==NULL || h->Typ() != INTVEC_CMD)
1897  {
1898  WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1899  return TRUE;
1900  }
1901  intvec* arg1 = (intvec*) h->Data();
1902  //int arg2 = (int) h->next->Data();
1903  intvec* result = MivWeightOrderdp(arg1);
1904  res->rtyp = INTVEC_CMD;
1905  res->data = result;
1906  return FALSE;
1907  }
1908  else
1909  #endif
1910  /*==================== MivMatrixOrderlp =================*/
1911  #ifdef HAVE_WALK
1912  if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1913  {
1914  if(h==NULL || h->Typ() != INT_CMD)
1915  {
1916  WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1917  return TRUE;
1918  }
1919  int arg1 = (int) ((long)(h->Data()));
1920  intvec* result = (intvec*) MivMatrixOrderlp(arg1);
1921  res->rtyp = INTVEC_CMD;
1922  res->data = result;
1923  return FALSE;
1924  }
1925  else
1926  #endif
1927  /*==================== MkInterRedNextWeight =================*/
1928  #ifdef HAVE_WALK
1929  if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1930  {
1931  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1932  if (!iiCheckTypes(h,t,1)) return TRUE;
1933  if (((intvec*) h->Data())->length() != currRing->N ||
1934  ((intvec*) h->next->Data())->length() != currRing->N)
1935  {
1936  Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1937  currRing->N);
1938  return TRUE;
1939  }
1940  intvec* arg1 = (intvec*) h->Data();
1941  intvec* arg2 = (intvec*) h->next->Data();
1942  ideal arg3 = (ideal) h->next->next->Data();
1943  intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1944  res->rtyp = INTVEC_CMD;
1945  res->data = result;
1946  return FALSE;
1947  }
1948  else
1949  #endif
1950  /*==================== MPertNextWeight =================*/
1951  #ifdef HAVE_WALK
1952  #ifdef MPertNextWeight
1953  if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1954  {
1955  const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1956  if (!iiCheckTypes(h,t,1)) return TRUE;
1957  if (((intvec*) h->Data())->length() != currRing->N)
1958  {
1959  Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1960  currRing->N);
1961  return TRUE;
1962  }
1963  intvec* arg1 = (intvec*) h->Data();
1964  ideal arg2 = (ideal) h->next->Data();
1965  int arg3 = (int) h->next->next->Data();
1966  intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1967  res->rtyp = INTVEC_CMD;
1968  res->data = result;
1969  return FALSE;
1970  }
1971  else
1972  #endif //MPertNextWeight
1973  #endif
1974  /*==================== Mivperttarget =================*/
1975  #ifdef HAVE_WALK
1976  #ifdef Mivperttarget
1977  if (strcmp(sys_cmd, "Mivperttarget") == 0)
1978  {
1979  const short t[]={2,IDEAL_CMD,INT_CMD};
1980  if (!iiCheckTypes(h,t,1)) return TRUE;
1981  ideal arg1 = (ideal) h->Data();
1982  int arg2 = (int) h->next->Data();
1983  intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1984  res->rtyp = INTVEC_CMD;
1985  res->data = result;
1986  return FALSE;
1987  }
1988  else
1989  #endif //Mivperttarget
1990  #endif
1991  /*==================== Mwalk =================*/
1992  #ifdef HAVE_WALK
1993  if (strcmp(sys_cmd, "Mwalk") == 0)
1994  {
1995  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD,INT_CMD,INT_CMD};
1996  if (!iiCheckTypes(h,t,1)) return TRUE;
1997  if (((intvec*) h->next->Data())->length() != currRing->N &&
1998  ((intvec*) h->next->next->Data())->length() != currRing->N )
1999  {
2000  Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
2001  currRing->N);
2002  return TRUE;
2003  }
2004  ideal arg1 = (ideal) h->CopyD();
2005  intvec* arg2 = (intvec*) h->next->Data();
2006  intvec* arg3 = (intvec*) h->next->next->Data();
2007  ring arg4 = (ring) h->next->next->next->Data();
2008  int arg5 = (int) (long) h->next->next->next->next->Data();
2009  int arg6 = (int) (long) h->next->next->next->next->next->Data();
2010  ideal result = (ideal) Mwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2011  res->rtyp = IDEAL_CMD;
2012  res->data = result;
2013  return FALSE;
2014  }
2015  else
2016  #endif
2017  /*==================== Mpwalk =================*/
2018  #ifdef HAVE_WALK
2019  #ifdef MPWALK_ORIG
2020  if (strcmp(sys_cmd, "Mwalk") == 0)
2021  {
2022  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
2023  if (!iiCheckTypes(h,t,1)) return TRUE;
2024  if ((((intvec*) h->next->Data())->length() != currRing->N &&
2025  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2026  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2027  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
2028  {
2029  Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
2030  currRing->N,(currRing->N)*(currRing->N));
2031  return TRUE;
2032  }
2033  ideal arg1 = (ideal) h->Data();
2034  intvec* arg2 = (intvec*) h->next->Data();
2035  intvec* arg3 = (intvec*) h->next->next->Data();
2036  ring arg4 = (ring) h->next->next->next->Data();
2037  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
2038  res->rtyp = IDEAL_CMD;
2039  res->data = result;
2040  return FALSE;
2041  }
2042  else
2043  #else
2044  if (strcmp(sys_cmd, "Mpwalk") == 0)
2045  {
2047  if (!iiCheckTypes(h,t,1)) return TRUE;
2048  if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2049  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2050  {
2051  Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
2052  return TRUE;
2053  }
2054  ideal arg1 = (ideal) h->Data();
2055  int arg2 = (int) (long) h->next->Data();
2056  int arg3 = (int) (long) h->next->next->Data();
2057  intvec* arg4 = (intvec*) h->next->next->next->Data();
2058  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2059  int arg6 = (int) (long) h->next->next->next->next->next->Data();
2060  int arg7 = (int) (long) h->next->next->next->next->next->next->Data();
2061  int arg8 = (int) (long) h->next->next->next->next->next->next->next->Data();
2062  ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
2063  res->rtyp = IDEAL_CMD;
2064  res->data = result;
2065  return FALSE;
2066  }
2067  else
2068  #endif
2069  #endif
2070  /*==================== Mrwalk =================*/
2071  #ifdef HAVE_WALK
2072  if (strcmp(sys_cmd, "Mrwalk") == 0)
2073  {
2075  if (!iiCheckTypes(h,t,1)) return TRUE;
2076  if(((intvec*) h->next->Data())->length() != currRing->N &&
2077  ((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2078  ((intvec*) h->next->next->Data())->length() != currRing->N &&
2079  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) )
2080  {
2081  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2082  currRing->N,(currRing->N)*(currRing->N));
2083  return TRUE;
2084  }
2085  ideal arg1 = (ideal) h->Data();
2086  intvec* arg2 = (intvec*) h->next->Data();
2087  intvec* arg3 = (intvec*) h->next->next->Data();
2088  int arg4 = (int)(long) h->next->next->next->Data();
2089  int arg5 = (int)(long) h->next->next->next->next->Data();
2090  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2091  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2092  ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2093  res->rtyp = IDEAL_CMD;
2094  res->data = result;
2095  return FALSE;
2096  }
2097  else
2098  #endif
2099  /*==================== MAltwalk1 =================*/
2100  #ifdef HAVE_WALK
2101  if (strcmp(sys_cmd, "MAltwalk1") == 0)
2102  {
2103  const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
2104  if (!iiCheckTypes(h,t,1)) return TRUE;
2105  if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
2106  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
2107  {
2108  Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
2109  currRing->N);
2110  return TRUE;
2111  }
2112  ideal arg1 = (ideal) h->Data();
2113  int arg2 = (int) ((long)(h->next->Data()));
2114  int arg3 = (int) ((long)(h->next->next->Data()));
2115  intvec* arg4 = (intvec*) h->next->next->next->Data();
2116  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
2117  ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
2118  res->rtyp = IDEAL_CMD;
2119  res->data = result;
2120  return FALSE;
2121  }
2122  else
2123  #endif
2124  /*==================== MAltwalk1 =================*/
2125  #ifdef HAVE_WALK
2126  #ifdef MFWALK_ALT
2127  if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
2128  {
2129  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2130  if (!iiCheckTypes(h,t,1)) return TRUE;
2131  if (((intvec*) h->next->Data())->length() != currRing->N &&
2132  ((intvec*) h->next->next->Data())->length() != currRing->N )
2133  {
2134  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2135  currRing->N);
2136  return TRUE;
2137  }
2138  ideal arg1 = (ideal) h->Data();
2139  intvec* arg2 = (intvec*) h->next->Data();
2140  intvec* arg3 = (intvec*) h->next->next->Data();
2141  int arg4 = (int) h->next->next->next->Data();
2142  ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2143  res->rtyp = IDEAL_CMD;
2144  res->data = result;
2145  return FALSE;
2146  }
2147  else
2148  #endif
2149  #endif
2150  /*==================== Mfwalk =================*/
2151  #ifdef HAVE_WALK
2152  if (strcmp(sys_cmd, "Mfwalk") == 0)
2153  {
2154  const short t[]={5,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD};
2155  if (!iiCheckTypes(h,t,1)) return TRUE;
2156  if (((intvec*) h->next->Data())->length() != currRing->N &&
2157  ((intvec*) h->next->next->Data())->length() != currRing->N )
2158  {
2159  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2160  currRing->N);
2161  return TRUE;
2162  }
2163  ideal arg1 = (ideal) h->Data();
2164  intvec* arg2 = (intvec*) h->next->Data();
2165  intvec* arg3 = (intvec*) h->next->next->Data();
2166  int arg4 = (int)(long) h->next->next->next->Data();
2167  int arg5 = (int)(long) h->next->next->next->next->Data();
2168  ideal result = (ideal) Mfwalk(arg1, arg2, arg3, arg4, arg5);
2169  res->rtyp = IDEAL_CMD;
2170  res->data = result;
2171  return FALSE;
2172  }
2173  else
2174  #endif
2175  /*==================== Mfrwalk =================*/
2176  #ifdef HAVE_WALK
2177  if (strcmp(sys_cmd, "Mfrwalk") == 0)
2178  {
2179  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,INT_CMD};
2180  if (!iiCheckTypes(h,t,1)) return TRUE;
2181 /*
2182  if (((intvec*) h->next->Data())->length() != currRing->N &&
2183  ((intvec*) h->next->next->Data())->length() != currRing->N)
2184  {
2185  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2186  return TRUE;
2187  }
2188 */
2189  if((((intvec*) h->next->Data())->length() != currRing->N &&
2190  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2191  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2192  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2193  {
2194  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d or %d\n",
2195  currRing->N,(currRing->N)*(currRing->N));
2196  return TRUE;
2197  }
2198 
2199  ideal arg1 = (ideal) h->Data();
2200  intvec* arg2 = (intvec*) h->next->Data();
2201  intvec* arg3 = (intvec*) h->next->next->Data();
2202  int arg4 = (int)(long) h->next->next->next->Data();
2203  int arg5 = (int)(long) h->next->next->next->next->Data();
2204  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2205  ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2206  res->rtyp = IDEAL_CMD;
2207  res->data = result;
2208  return FALSE;
2209  }
2210  else
2211  /*==================== Mprwalk =================*/
2212  if (strcmp(sys_cmd, "Mprwalk") == 0)
2213  {
2215  if (!iiCheckTypes(h,t,1)) return TRUE;
2216  if((((intvec*) h->next->Data())->length() != currRing->N &&
2217  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
2218  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
2219  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
2220  {
2221  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
2222  currRing->N,(currRing->N)*(currRing->N));
2223  return TRUE;
2224  }
2225  ideal arg1 = (ideal) h->Data();
2226  intvec* arg2 = (intvec*) h->next->Data();
2227  intvec* arg3 = (intvec*) h->next->next->Data();
2228  int arg4 = (int)(long) h->next->next->next->Data();
2229  int arg5 = (int)(long) h->next->next->next->next->Data();
2230  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2231  int arg7 = (int)(long) h->next->next->next->next->next->next->Data();
2232  int arg8 = (int)(long) h->next->next->next->next->next->next->next->Data();
2233  int arg9 = (int)(long) h->next->next->next->next->next->next->next->next->Data();
2234  ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
2235  res->rtyp = IDEAL_CMD;
2236  res->data = result;
2237  return FALSE;
2238  }
2239  else
2240  #endif
2241  /*==================== TranMImprovwalk =================*/
2242  #ifdef HAVE_WALK
2243  #ifdef TRAN_Orig
2244  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2245  {
2246  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2247  if (!iiCheckTypes(h,t,1)) return TRUE;
2248  if (((intvec*) h->next->Data())->length() != currRing->N &&
2249  ((intvec*) h->next->next->Data())->length() != currRing->N )
2250  {
2251  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2252  currRing->N);
2253  return TRUE;
2254  }
2255  ideal arg1 = (ideal) h->Data();
2256  intvec* arg2 = (intvec*) h->next->Data();
2257  intvec* arg3 = (intvec*) h->next->next->Data();
2258  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2259  res->rtyp = IDEAL_CMD;
2260  res->data = result;
2261  return FALSE;
2262  }
2263  else
2264  #endif
2265  #endif
2266  /*==================== MAltwalk2 =================*/
2267  #ifdef HAVE_WALK
2268  if (strcmp(sys_cmd, "MAltwalk2") == 0)
2269  {
2270  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2271  if (!iiCheckTypes(h,t,1)) return TRUE;
2272  if (((intvec*) h->next->Data())->length() != currRing->N &&
2273  ((intvec*) h->next->next->Data())->length() != currRing->N )
2274  {
2275  Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2276  currRing->N);
2277  return TRUE;
2278  }
2279  ideal arg1 = (ideal) h->Data();
2280  intvec* arg2 = (intvec*) h->next->Data();
2281  intvec* arg3 = (intvec*) h->next->next->Data();
2282  ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2283  res->rtyp = IDEAL_CMD;
2284  res->data = result;
2285  return FALSE;
2286  }
2287  else
2288  #endif
2289  /*==================== MAltwalk2 =================*/
2290  #ifdef HAVE_WALK
2291  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2292  {
2293  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2294  if (!iiCheckTypes(h,t,1)) return TRUE;
2295  if (((intvec*) h->next->Data())->length() != currRing->N &&
2296  ((intvec*) h->next->next->Data())->length() != currRing->N )
2297  {
2298  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2299  currRing->N);
2300  return TRUE;
2301  }
2302  ideal arg1 = (ideal) h->Data();
2303  intvec* arg2 = (intvec*) h->next->Data();
2304  intvec* arg3 = (intvec*) h->next->next->Data();
2305  int arg4 = (int) ((long)(h->next->next->next->Data()));
2306  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2307  res->rtyp = IDEAL_CMD;
2308  res->data = result;
2309  return FALSE;
2310  }
2311  else
2312  #endif
2313  /*==================== TranMrImprovwalk =================*/
2314  #if 0
2315  #ifdef HAVE_WALK
2316  if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2317  {
2318  if (h == NULL || h->Typ() != IDEAL_CMD ||
2319  h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2320  h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2321  h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2322  h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2323  h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2324  {
2325  WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2326  return TRUE;
2327  }
2328  if (((intvec*) h->next->Data())->length() != currRing->N &&
2329  ((intvec*) h->next->next->Data())->length() != currRing->N )
2330  {
2331  Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2332  return TRUE;
2333  }
2334  ideal arg1 = (ideal) h->Data();
2335  intvec* arg2 = (intvec*) h->next->Data();
2336  intvec* arg3 = (intvec*) h->next->next->Data();
2337  int arg4 = (int)(long) h->next->next->next->Data();
2338  int arg5 = (int)(long) h->next->next->next->next->Data();
2339  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2340  ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2341  res->rtyp = IDEAL_CMD;
2342  res->data = result;
2343  return FALSE;
2344  }
2345  else
2346  #endif
2347  #endif
2348  /*================= Extended system call ========================*/
2349  {
2350  #ifndef MAKE_DISTRIBUTION
2351  return(jjEXTENDED_SYSTEM(res, args));
2352  #else
2353  Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2354  #endif
2355  }
2356  } /* typ==string */
2357  return TRUE;
2358 }

◆ jjVARIABLES_ID()

BOOLEAN jjVARIABLES_ID ( leftv  res,
leftv  u 
)

Definition at line 6301 of file ipshell.cc.

6302 {
6303  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6304  ideal I=(ideal)u->Data();
6305  int i;
6306  int n=0;
6307  for(i=I->nrows*I->ncols-1;i>=0;i--)
6308  {
6309  int n0=pGetVariables(I->m[i],e);
6310  if (n0>n) n=n0;
6311  }
6312  jjINT_S_TO_ID(n,e,res);
6313  return FALSE;
6314 }

◆ jjVARIABLES_P()

BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 6293 of file ipshell.cc.

6294 {
6295  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
6296  int n=pGetVariables((poly)u->Data(),e);
6297  jjINT_S_TO_ID(n,e,res);
6298  return FALSE;
6299 }

◆ killlocals()

void killlocals ( int  v)

Definition at line 383 of file ipshell.cc.

384 {
385  BOOLEAN changed=FALSE;
386  idhdl sh=currRingHdl;
387  ring cr=currRing;
388  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
389  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
390 
391  killlocals_rec(&(basePack->idroot),v,currRing);
392 
394  {
395  int t=iiRETURNEXPR.Typ();
396  if (/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
397  {
399  if (((ring)h->data)->idroot!=NULL)
400  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
401  }
402  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
403  {
405  changed |=killlocals_list(v,(lists)h->data);
406  }
407  }
408  if (changed)
409  {
411  if (currRingHdl==NULL)
412  currRing=NULL;
413  else if(cr!=currRing)
414  rChangeCurrRing(cr);
415  }
416 
417  if (myynest<=1) iiNoKeepRing=TRUE;
418  //Print("end killlocals >= %d\n",v);
419  //listall();
420 }

◆ kQHWeight()

BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 3292 of file ipshell.cc.

3293 {
3294  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
3295  if (res->data==NULL)
3296  res->data=(char *)new intvec(rVar(currRing));
3297  return FALSE;
3298 }

◆ kWeight()

BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 3270 of file ipshell.cc.

3271 {
3272  ideal F=(ideal)id->Data();
3273  intvec * iv = new intvec(rVar(currRing));
3274  polyset s;
3275  int sl, n, i;
3276  int *x;
3277 
3278  res->data=(char *)iv;
3279  s = F->m;
3280  sl = IDELEMS(F) - 1;
3281  n = rVar(currRing);
3282  double wNsqr = (double)2.0 / (double)n;
3284  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
3285  wCall(s, sl, x, wNsqr, currRing);
3286  for (i = n; i!=0; i--)
3287  (*iv)[i-1] = x[i + n + 1];
3288  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
3289  return FALSE;
3290 }

◆ list_cmd()

void list_cmd ( int  typ,
const char *  what,
const char *  prefix,
BOOLEAN  iterate,
BOOLEAN  fullname = FALSE 
)

Definition at line 422 of file ipshell.cc.

423 {
424  package savePack=currPack;
425  idhdl h,start;
426  BOOLEAN all = typ<0;
427  BOOLEAN really_all=FALSE;
428 
429  if ( typ==0 )
430  {
431  if (strcmp(what,"all")==0)
432  {
433  if (currPack!=basePack)
434  list_cmd(-1,NULL,prefix,iterate,fullname); // list current package
435  really_all=TRUE;
436  h=basePack->idroot;
437  }
438  else
439  {
440  h = ggetid(what);
441  if (h!=NULL)
442  {
443  if (iterate) list1(prefix,h,TRUE,fullname);
444  if (IDTYP(h)==ALIAS_CMD) PrintS("A");
445  if ((IDTYP(h)==RING_CMD)
446  //|| (IDTYP(h)==PACKAGE_CMD)
447  )
448  {
449  h=IDRING(h)->idroot;
450  }
451  else if(IDTYP(h)==PACKAGE_CMD)
452  {
454  //Print("list_cmd:package\n");
455  all=TRUE;typ=PROC_CMD;fullname=TRUE;really_all=TRUE;
456  h=IDPACKAGE(h)->idroot;
457  }
458  else
459  {
460  currPack=savePack;
461  return;
462  }
463  }
464  else
465  {
466  Werror("%s is undefined",what);
467  currPack=savePack;
468  return;
469  }
470  }
471  all=TRUE;
472  }
473  else if (RingDependend(typ))
474  {
475  h = currRing->idroot;
476  }
477  else
478  h = IDROOT;
479  start=h;
480  while (h!=NULL)
481  {
482  if ((all
483  && (IDTYP(h)!=PROC_CMD)
484  &&(IDTYP(h)!=PACKAGE_CMD)
485  &&(IDTYP(h)!=CRING_CMD)
486  )
487  || (typ == IDTYP(h))
488  || ((IDTYP(h)==CRING_CMD) && (typ==RING_CMD))
489  )
490  {
491  list1(prefix,h,start==currRingHdl, fullname);
492  if ((IDTYP(h)==RING_CMD)
493  && (really_all || (all && (h==currRingHdl)))
494  && ((IDLEV(h)==0)||(IDLEV(h)==myynest)))
495  {
496  list_cmd(0,IDID(h),"// ",FALSE);
497  }
498  if (IDTYP(h)==PACKAGE_CMD && really_all)
499  {
500  package save_p=currPack;
502  list_cmd(0,IDID(h),"// ",FALSE);
503  currPack=save_p;
504  }
505  }
506  h = IDNEXT(h);
507  }
508  currPack=savePack;
509 }

◆ loNewtonP()

BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4532 of file ipshell.cc.

4533 {
4534  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4535  return FALSE;
4536 }

◆ loSimplex()

BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4538 of file ipshell.cc.

4539 {
4540  if ( !(rField_is_long_R(currRing)) )
4541  {
4542  WerrorS("Ground field not implemented!");
4543  return TRUE;
4544  }
4545 
4546  simplex * LP;
4547  matrix m;
4548 
4549  leftv v= args;
4550  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4551  return TRUE;
4552  else
4553  m= (matrix)(v->CopyD());
4554 
4555  LP = new simplex(MATROWS(m),MATCOLS(m));
4556  LP->mapFromMatrix(m);
4557 
4558  v= v->next;
4559  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4560  return TRUE;
4561  else
4562  LP->m= (int)(long)(v->Data());
4563 
4564  v= v->next;
4565  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4566  return TRUE;
4567  else
4568  LP->n= (int)(long)(v->Data());
4569 
4570  v= v->next;
4571  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4572  return TRUE;
4573  else
4574  LP->m1= (int)(long)(v->Data());
4575 
4576  v= v->next;
4577  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4578  return TRUE;
4579  else
4580  LP->m2= (int)(long)(v->Data());
4581 
4582  v= v->next;
4583  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4584  return TRUE;
4585  else
4586  LP->m3= (int)(long)(v->Data());
4587 
4588 #ifdef mprDEBUG_PROT
4589  Print("m (constraints) %d\n",LP->m);
4590  Print("n (columns) %d\n",LP->n);
4591  Print("m1 (<=) %d\n",LP->m1);
4592  Print("m2 (>=) %d\n",LP->m2);
4593  Print("m3 (==) %d\n",LP->m3);
4594 #endif
4595 
4596  LP->compute();
4597 
4598  lists lres= (lists)omAlloc( sizeof(slists) );
4599  lres->Init( 6 );
4600 
4601  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4602  lres->m[0].data=(void*)LP->mapToMatrix(m);
4603 
4604  lres->m[1].rtyp= INT_CMD; // found a solution?
4605  lres->m[1].data=(void*)(long)LP->icase;
4606 
4607  lres->m[2].rtyp= INTVEC_CMD;
4608  lres->m[2].data=(void*)LP->posvToIV();
4609 
4610  lres->m[3].rtyp= INTVEC_CMD;
4611  lres->m[3].data=(void*)LP->zrovToIV();
4612 
4613  lres->m[4].rtyp= INT_CMD;
4614  lres->m[4].data=(void*)(long)LP->m;
4615 
4616  lres->m[5].rtyp= INT_CMD;
4617  lres->m[5].data=(void*)(long)LP->n;
4618 
4619  res->data= (void*)lres;
4620 
4621  return FALSE;
4622 }

◆ mpJacobi()

BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 3040 of file ipshell.cc.

3041 {
3042  int i,j;
3043  matrix result;
3044  ideal id=(ideal)a->Data();
3045 
3046  result =mpNew(IDELEMS(id),rVar(currRing));
3047  for (i=1; i<=IDELEMS(id); i++)
3048  {
3049  for (j=1; j<=rVar(currRing); j++)
3050  {
3051  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
3052  }
3053  }
3054  res->data=(char *)result;
3055  return FALSE;
3056 }

◆ mpKoszul()

BOOLEAN mpKoszul ( leftv  res,
leftv  c,
leftv  b,
leftv  id 
)

Definition at line 3062 of file ipshell.cc.

3063 {
3064  int n=(int)(long)b->Data();
3065  int d=(int)(long)c->Data();
3066  int k,l,sign,row,col;
3067  matrix result;
3068  ideal temp;
3069  BOOLEAN bo;
3070  poly p;
3071 
3072  if ((d>n) || (d<1) || (n<1))
3073  {
3074  res->data=(char *)mpNew(1,1);
3075  return FALSE;
3076  }
3077  int *choise = (int*)omAlloc(d*sizeof(int));
3078  if (id==NULL)
3079  temp=idMaxIdeal(1);
3080  else
3081  temp=(ideal)id->Data();
3082 
3083  k = binom(n,d);
3084  l = k*d;
3085  l /= n-d+1;
3086  result =mpNew(l,k);
3087  col = 1;
3088  idInitChoise(d,1,n,&bo,choise);
3089  while (!bo)
3090  {
3091  sign = 1;
3092  for (l=1;l<=d;l++)
3093  {
3094  if (choise[l-1]<=IDELEMS(temp))
3095  {
3096  p = pCopy(temp->m[choise[l-1]-1]);
3097  if (sign == -1) p = pNeg(p);
3098  sign *= -1;
3099  row = idGetNumberOfChoise(l-1,d,1,n,choise);
3100  MATELEM(result,row,col) = p;
3101  }
3102  }
3103  col++;
3104  idGetNextChoise(d,n,&bo,choise);
3105  }
3106  omFreeSize(choise,d*sizeof(int));
3107  if (id==NULL) idDelete(&temp);
3108 
3109  res->data=(char *)result;
3110  return FALSE;
3111 }

◆ nuLagSolve()

BOOLEAN nuLagSolve ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

find the (complex) roots an univariate polynomial Determines the roots of an univariate polynomial using Laguerres' root-solver.

Good for polynomials with low and middle degree (<40). Arguments 3: poly arg1 , int arg2 , int arg3 arg2>0: defines precision of fractional part if ground field is Q arg3: number of iterations for approximation of roots (default=2) Returns a list of all (complex) roots of the polynomial arg1

Definition at line 4647 of file ipshell.cc.

4648 {
4649 
4650  poly gls;
4651  gls= (poly)(arg1->Data());
4652  int howclean= (int)(long)arg3->Data();
4653 
4654  if ( !(rField_is_R(currRing) ||
4655  rField_is_Q(currRing) ||
4658  {
4659  WerrorS("Ground field not implemented!");
4660  return TRUE;
4661  }
4662 
4665  {
4666  unsigned long int ii = (unsigned long int)arg2->Data();
4667  setGMPFloatDigits( ii, ii );
4668  }
4669 
4670  if ( gls == NULL || pIsConstant( gls ) )
4671  {
4672  WerrorS("Input polynomial is constant!");
4673  return TRUE;
4674  }
4675 
4676  int ldummy;
4677  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4678  int i,vpos=0;
4679  poly piter;
4680  lists elist;
4681  lists rlist;
4682 
4683  elist= (lists)omAlloc( sizeof(slists) );
4684  elist->Init( 0 );
4685 
4686  if ( rVar(currRing) > 1 )
4687  {
4688  piter= gls;
4689  for ( i= 1; i <= rVar(currRing); i++ )
4690  if ( pGetExp( piter, i ) )
4691  {
4692  vpos= i;
4693  break;
4694  }
4695  while ( piter )
4696  {
4697  for ( i= 1; i <= rVar(currRing); i++ )
4698  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4699  {
4700  WerrorS("The input polynomial must be univariate!");
4701  return TRUE;
4702  }
4703  pIter( piter );
4704  }
4705  }
4706 
4707  rootContainer * roots= new rootContainer();
4708  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4709  piter= gls;
4710  for ( i= deg; i >= 0; i-- )
4711  {
4712  if ( piter && pTotaldegree(piter) == i )
4713  {
4714  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4715  //nPrint( pcoeffs[i] );PrintS(" ");
4716  pIter( piter );
4717  }
4718  else
4719  {
4720  pcoeffs[i]= nInit(0);
4721  }
4722  }
4723 
4724 #ifdef mprDEBUG_PROT
4725  for (i=deg; i >= 0; i--)
4726  {
4727  nPrint( pcoeffs[i] );PrintS(" ");
4728  }
4729  PrintLn();
4730 #endif
4731 
4732  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4733  roots->solver( howclean );
4734 
4735  int elem= roots->getAnzRoots();
4736  char *dummy;
4737  int j;
4738 
4739  rlist= (lists)omAlloc( sizeof(slists) );
4740  rlist->Init( elem );
4741 
4743  {
4744  for ( j= 0; j < elem; j++ )
4745  {
4746  rlist->m[j].rtyp=NUMBER_CMD;
4747  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4748  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4749  }
4750  }
4751  else
4752  {
4753  for ( j= 0; j < elem; j++ )
4754  {
4755  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4756  rlist->m[j].rtyp=STRING_CMD;
4757  rlist->m[j].data=(void *)dummy;
4758  }
4759  }
4760 
4761  elist->Clean();
4762  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4763 
4764  // this is (via fillContainer) the same data as in root
4765  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4766  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4767 
4768  delete roots;
4769 
4770  res->rtyp= LIST_CMD;
4771  res->data= (void*)rlist;
4772 
4773  return FALSE;
4774 }

◆ nuMPResMat()

BOOLEAN nuMPResMat ( leftv  res,
leftv  arg1,
leftv  arg2 
)

returns module representing the multipolynomial resultant matrix Arguments 2: ideal i, int k k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default)

Definition at line 4624 of file ipshell.cc.

4625 {
4626  ideal gls = (ideal)(arg1->Data());
4627  int imtype= (int)(long)arg2->Data();
4628 
4629  uResultant::resMatType mtype= determineMType( imtype );
4630 
4631  // check input ideal ( = polynomial system )
4632  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4633  {
4634  return TRUE;
4635  }
4636 
4637  uResultant *resMat= new uResultant( gls, mtype, false );
4638  if (resMat!=NULL)
4639  {
4640  res->rtyp = MODUL_CMD;
4641  res->data= (void*)resMat->accessResMat()->getMatrix();
4642  if (!errorreported) delete resMat;
4643  }
4644  return errorreported;
4645 }

◆ nuUResSolve()

BOOLEAN nuUResSolve ( leftv  res,
leftv  args 
)

solve a multipolynomial system using the u-resultant Input ideal must be 0-dimensional and (currRing->N) == IDELEMS(ideal).

Resultant method can be MPR_DENSE, which uses Macaulay Resultant (good for dense homogeneous polynoms) or MPR_SPARSE, which uses Sparse Resultant (Gelfand, Kapranov, Zelevinsky). Arguments 4: ideal i, int k, int l, int m k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky k=1: use resultant matrix of Macaulay (k=0 is default) l>0: defines precision of fractional part if ground field is Q m=0,1,2: number of iterations for approximation of roots (default=2) Returns a list containing the roots of the system.

Definition at line 4877 of file ipshell.cc.

4878 {
4879  leftv v= args;
4880 
4881  ideal gls;
4882  int imtype;
4883  int howclean;
4884 
4885  // get ideal
4886  if ( v->Typ() != IDEAL_CMD )
4887  return TRUE;
4888  else gls= (ideal)(v->Data());
4889  v= v->next;
4890 
4891  // get resultant matrix type to use (0,1)
4892  if ( v->Typ() != INT_CMD )
4893  return TRUE;
4894  else imtype= (int)(long)v->Data();
4895  v= v->next;
4896 
4897  if (imtype==0)
4898  {
4899  ideal test_id=idInit(1,1);
4900  int j;
4901  for(j=IDELEMS(gls)-1;j>=0;j--)
4902  {
4903  if (gls->m[j]!=NULL)
4904  {
4905  test_id->m[0]=gls->m[j];
4906  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4907  if (dummy_w!=NULL)
4908  {
4909  WerrorS("Newton polytope not of expected dimension");
4910  delete dummy_w;
4911  return TRUE;
4912  }
4913  }
4914  }
4915  }
4916 
4917  // get and set precision in digits ( > 0 )
4918  if ( v->Typ() != INT_CMD )
4919  return TRUE;
4920  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4922  {
4923  unsigned long int ii=(unsigned long int)v->Data();
4924  setGMPFloatDigits( ii, ii );
4925  }
4926  v= v->next;
4927 
4928  // get interpolation steps (0,1,2)
4929  if ( v->Typ() != INT_CMD )
4930  return TRUE;
4931  else howclean= (int)(long)v->Data();
4932 
4933  uResultant::resMatType mtype= determineMType( imtype );
4934  int i,count;
4935  lists listofroots= NULL;
4936  number smv= NULL;
4937  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4938 
4939  //emptylist= (lists)omAlloc( sizeof(slists) );
4940  //emptylist->Init( 0 );
4941 
4942  //res->rtyp = LIST_CMD;
4943  //res->data= (void *)emptylist;
4944 
4945  // check input ideal ( = polynomial system )
4946  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4947  {
4948  return TRUE;
4949  }
4950 
4951  uResultant * ures;
4952  rootContainer ** iproots;
4953  rootContainer ** muiproots;
4954  rootArranger * arranger;
4955 
4956  // main task 1: setup of resultant matrix
4957  ures= new uResultant( gls, mtype );
4958  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4959  {
4960  WerrorS("Error occurred during matrix setup!");
4961  return TRUE;
4962  }
4963 
4964  // if dense resultant, check if minor nonsingular
4965  if ( mtype == uResultant::denseResMat )
4966  {
4967  smv= ures->accessResMat()->getSubDet();
4968 #ifdef mprDEBUG_PROT
4969  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4970 #endif
4971  if ( nIsZero(smv) )
4972  {
4973  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4974  return TRUE;
4975  }
4976  }
4977 
4978  // main task 2: Interpolate specialized resultant polynomials
4979  if ( interpolate_det )
4980  iproots= ures->interpolateDenseSP( false, smv );
4981  else
4982  iproots= ures->specializeInU( false, smv );
4983 
4984  // main task 3: Interpolate specialized resultant polynomials
4985  if ( interpolate_det )
4986  muiproots= ures->interpolateDenseSP( true, smv );
4987  else
4988  muiproots= ures->specializeInU( true, smv );
4989 
4990 #ifdef mprDEBUG_PROT
4991  int c= iproots[0]->getAnzElems();
4992  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4993  c= muiproots[0]->getAnzElems();
4994  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4995 #endif
4996 
4997  // main task 4: Compute roots of specialized polys and match them up
4998  arranger= new rootArranger( iproots, muiproots, howclean );
4999  arranger->solve_all();
5000 
5001  // get list of roots
5002  if ( arranger->success() )
5003  {
5004  arranger->arrange();
5005  listofroots= listOfRoots(arranger, gmp_output_digits );
5006  }
5007  else
5008  {
5009  WerrorS("Solver was unable to find any roots!");
5010  return TRUE;
5011  }
5012 
5013  // free everything
5014  count= iproots[0]->getAnzElems();
5015  for (i=0; i < count; i++) delete iproots[i];
5016  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
5017  count= muiproots[0]->getAnzElems();
5018  for (i=0; i < count; i++) delete muiproots[i];
5019  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
5020 
5021  delete ures;
5022  delete arranger;
5023  nDelete( &smv );
5024 
5025  res->data= (void *)listofroots;
5026 
5027  //emptylist->Clean();
5028  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
5029 
5030  return FALSE;
5031 }

◆ nuVanderSys()

BOOLEAN nuVanderSys ( leftv  res,
leftv  arg1,
leftv  arg2,
leftv  arg3 
)

COMPUTE: polynomial p with values given by v at points p1,..,pN derived from p; more precisely: consider p as point in K^n and v as N elements in K, let p1,..,pN be the points in K^n obtained by evaluating all monomials of degree 0,1,...,N at p in lexicographical order, then the procedure computes the polynomial f satisfying f(pi) = v[i] RETURN: polynomial f of degree d.

Definition at line 4776 of file ipshell.cc.

4777 {
4778  int i;
4779  ideal p,w;
4780  p= (ideal)arg1->Data();
4781  w= (ideal)arg2->Data();
4782 
4783  // w[0] = f(p^0)
4784  // w[1] = f(p^1)
4785  // ...
4786  // p can be a vector of numbers (multivariate polynom)
4787  // or one number (univariate polynom)
4788  // tdg = deg(f)
4789 
4790  int n= IDELEMS( p );
4791  int m= IDELEMS( w );
4792  int tdg= (int)(long)arg3->Data();
4793 
4794  res->data= (void*)NULL;
4795 
4796  // check the input
4797  if ( tdg < 1 )
4798  {
4799  WerrorS("Last input parameter must be > 0!");
4800  return TRUE;
4801  }
4802  if ( n != rVar(currRing) )
4803  {
4804  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4805  return TRUE;
4806  }
4807  if ( m != (int)pow((double)tdg+1,(double)n) )
4808  {
4809  Werror("Size of second input ideal must be equal to %d!",
4810  (int)pow((double)tdg+1,(double)n));
4811  return TRUE;
4812  }
4813  if ( !(rField_is_Q(currRing) /* ||
4814  rField_is_R() || rField_is_long_R() ||
4815  rField_is_long_C()*/ ) )
4816  {
4817  WerrorS("Ground field not implemented!");
4818  return TRUE;
4819  }
4820 
4821  number tmp;
4822  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4823  for ( i= 0; i < n; i++ )
4824  {
4825  pevpoint[i]=nInit(0);
4826  if ( (p->m)[i] )
4827  {
4828  tmp = pGetCoeff( (p->m)[i] );
4829  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4830  {
4831  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4832  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4833  return TRUE;
4834  }
4835  } else tmp= NULL;
4836  if ( !nIsZero(tmp) )
4837  {
4838  if ( !pIsConstant((p->m)[i]))
4839  {
4840  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4841  WerrorS("Elements of first input ideal must be numbers!");
4842  return TRUE;
4843  }
4844  pevpoint[i]= nCopy( tmp );
4845  }
4846  }
4847 
4848  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4849  for ( i= 0; i < m; i++ )
4850  {
4851  wresults[i]= nInit(0);
4852  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4853  {
4854  if ( !pIsConstant((w->m)[i]))
4855  {
4856  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4857  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4858  WerrorS("Elements of second input ideal must be numbers!");
4859  return TRUE;
4860  }
4861  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4862  }
4863  }
4864 
4865  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4866  number *ncpoly= vm.interpolateDense( wresults );
4867  // do not free ncpoly[]!!
4868  poly rpoly= vm.numvec2poly( ncpoly );
4869 
4870  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4871  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4872 
4873  res->data= (void*)rpoly;
4874  return FALSE;
4875 }

◆ paPrint()

void paPrint ( const char *  n,
package  p 
)

Definition at line 6316 of file ipshell.cc.

6317 {
6318  Print(" %s (",n);
6319  switch (p->language)
6320  {
6321  case LANG_SINGULAR: PrintS("S"); break;
6322  case LANG_C: PrintS("C"); break;
6323  case LANG_TOP: PrintS("T"); break;
6324  case LANG_MAX: PrintS("M"); break;
6325  case LANG_NONE: PrintS("N"); break;
6326  default: PrintS("U");
6327  }
6328  if(p->libname!=NULL)
6329  Print(",%s", p->libname);
6330  PrintS(")");
6331 }

◆ rCompose()

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

Definition at line 2760 of file ipshell.cc.

2761 {
2762  if ((L->nr!=3)
2763 #ifdef HAVE_PLURAL
2764  &&(L->nr!=5)
2765 #endif
2766  )
2767  return NULL;
2768  int is_gf_char=0;
2769  // 0: char/ cf - ring
2770  // 1: list (var)
2771  // 2: list (ord)
2772  // 3: qideal
2773  // possibly:
2774  // 4: C
2775  // 5: D
2776 
2777  ring R = (ring) omAlloc0Bin(sip_sring_bin);
2778 
2779  // ------------------------------------------------------------------
2780  // 0: char:
2781  if (L->m[0].Typ()==CRING_CMD)
2782  {
2783  R->cf=(coeffs)L->m[0].Data();
2784  R->cf->ref++;
2785  }
2786  else if (L->m[0].Typ()==INT_CMD)
2787  {
2788  int ch = (int)(long)L->m[0].Data();
2789  assume( ch >= 0 );
2790 
2791  if (ch == 0) // Q?
2792  R->cf = nInitChar(n_Q, NULL);
2793  else
2794  {
2795  int l = IsPrime(ch); // Zp?
2796  if( l != ch )
2797  {
2798  Warn("%d is invalid characteristic of ground field. %d is used.", ch, l);
2799  ch = l;
2800  }
2801  #ifndef TEST_ZN_AS_ZP
2802  R->cf = nInitChar(n_Zp, (void*)(long)ch);
2803  #else
2804  mpz_t modBase;
2805  mpz_init_set_ui(modBase,(long) ch);
2806  ZnmInfo info;
2807  info.base= modBase;
2808  info.exp= 1;
2809  R->cf=nInitChar(n_Zn,(void*) &info); //exponent is missing
2810  R->cf->is_field=1;
2811  R->cf->is_domain=1;
2812  R->cf->has_simple_Inverse=1;
2813  #endif
2814  }
2815  }
2816  else if (L->m[0].Typ()==LIST_CMD) // something complicated...
2817  {
2818  lists LL=(lists)L->m[0].Data();
2819 
2820 #ifdef HAVE_RINGS
2821  if (LL->m[0].Typ() == STRING_CMD) // 1st comes a string?
2822  {
2823  rComposeRing(LL, R); // Ring!?
2824  }
2825  else
2826 #endif
2827  if (LL->nr < 3)
2828  rComposeC(LL,R); // R, long_R, long_C
2829  else
2830  {
2831  if (LL->m[0].Typ()==INT_CMD)
2832  {
2833  int ch = (int)(long)LL->m[0].Data();
2834  while ((ch!=fftable[is_gf_char]) && (fftable[is_gf_char])) is_gf_char++;
2835  if (fftable[is_gf_char]==0) is_gf_char=-1;
2836 
2837  if(is_gf_char!= -1)
2838  {
2839  GFInfo param;
2840 
2841  param.GFChar = ch;
2842  param.GFDegree = 1;
2843  param.GFPar_name = (const char*)(((lists)(LL->m[1].Data()))->m[0].Data());
2844 
2845  // nfInitChar should be able to handle the case when ch is in fftables!
2846  R->cf = nInitChar(n_GF, (void*)&param);
2847  }
2848  }
2849 
2850  if( R->cf == NULL )
2851  {
2852  ring extRing = rCompose((lists)L->m[0].Data(),FALSE,0x7fff);
2853 
2854  if (extRing==NULL)
2855  {
2856  WerrorS("could not create the specified coefficient field");
2857  goto rCompose_err;
2858  }
2859 
2860  if( extRing->qideal != NULL ) // Algebraic extension
2861  {
2862  AlgExtInfo extParam;
2863 
2864  extParam.r = extRing;
2865 
2866  R->cf = nInitChar(n_algExt, (void*)&extParam);
2867  }
2868  else // Transcendental extension
2869  {
2870  TransExtInfo extParam;
2871  extParam.r = extRing;
2872  assume( extRing->qideal == NULL );
2873 
2874  R->cf = nInitChar(n_transExt, &extParam);
2875  }
2876  }
2877  }
2878  }
2879  else
2880  {
2881  WerrorS("coefficient field must be described by `int` or `list`");
2882  goto rCompose_err;
2883  }
2884 
2885  if( R->cf == NULL )
2886  {
2887  WerrorS("could not create coefficient field described by the input!");
2888  goto rCompose_err;
2889  }
2890 
2891  // ------------------------- VARS ---------------------------
2892  if (rComposeVar(L,R)) goto rCompose_err;
2893  // ------------------------ ORDER ------------------------------
2894  if (rComposeOrder(L,check_comp,R)) goto rCompose_err;
2895 
2896  // ------------------------ ??????? --------------------
2897 
2898  if (!isLetterplace) rRenameVars(R);
2899  else R->isLPring=isLetterplace;
2900  if (bitmask!=0x7fff) R->bitmask=bitmask*2;
2901  rComplete(R);
2902 
2903  // ------------------------ Q-IDEAL ------------------------
2904 
2905  if (L->m[3].Typ()==IDEAL_CMD)
2906  {
2907  ideal q=(ideal)L->m[3].Data();
2908  if (q->m[0]!=NULL)
2909  {
2910  if (R->cf != currRing->cf) //->cf->ch!=currRing->cf->ch)
2911  {
2912  #if 0
2913  WerrorS("coefficient fields must be equal if q-ideal !=0");
2914  goto rCompose_err;
2915  #else
2916  ring orig_ring=currRing;
2917  rChangeCurrRing(R);
2918  int *perm=NULL;
2919  int *par_perm=NULL;
2920  int par_perm_size=0;
2921  nMapFunc nMap;
2922 
2923  if ((nMap=nSetMap(orig_ring->cf))==NULL)
2924  {
2925  if (rEqual(orig_ring,currRing))
2926  {
2927  nMap=n_SetMap(currRing->cf, currRing->cf);
2928  }
2929  else
2930  // Allow imap/fetch to be make an exception only for:
2931  if ( (rField_is_Q_a(orig_ring) && // Q(a..) -> Q(a..) || Q || Zp || Zp(a)
2935  ||
2936  (rField_is_Zp_a(orig_ring) && // Zp(a..) -> Zp(a..) || Zp
2937  (rField_is_Zp(currRing, rInternalChar(orig_ring)) ||
2938  rField_is_Zp_a(currRing, rInternalChar(orig_ring)))) )
2939  {
2940  par_perm_size=rPar(orig_ring);
2941 
2942 // if ((orig_ring->minpoly != NULL) || (orig_ring->qideal != NULL))
2943 // naSetChar(rInternalChar(orig_ring),orig_ring);
2944 // else ntSetChar(rInternalChar(orig_ring),orig_ring);
2945 
2946  nSetChar(currRing->cf);
2947  }
2948  else
2949  {
2950  WerrorS("coefficient fields must be equal if q-ideal !=0");
2951  goto rCompose_err;
2952  }
2953  }
2954  perm=(int *)omAlloc0((orig_ring->N+1)*sizeof(int));
2955  if (par_perm_size!=0)
2956  par_perm=(int *)omAlloc0(par_perm_size*sizeof(int));
2957  int i;
2958  #if 0
2959  // use imap:
2960  maFindPerm(orig_ring->names,orig_ring->N,orig_ring->parameter,orig_ring->P,
2961  currRing->names,currRing->N,currRing->parameter, currRing->P,
2962  perm,par_perm, currRing->ch);
2963  #else
2964  // use fetch
2965  if ((rPar(orig_ring)>0) && (rPar(currRing)==0))
2966  {
2967  for(i=si_min(rPar(orig_ring),rVar(currRing))-1;i>=0;i--) par_perm[i]=i+1;
2968  }
2969  else if (par_perm_size!=0)
2970  for(i=si_min(rPar(orig_ring),rPar(currRing))-1;i>=0;i--) par_perm[i]=-(i+1);
2971  for(i=si_min(orig_ring->N,rVar(currRing));i>0;i--) perm[i]=i;
2972  #endif
2973  ideal dest_id=idInit(IDELEMS(q),1);
2974  for(i=IDELEMS(q)-1; i>=0; i--)
2975  {
2976  dest_id->m[i]=p_PermPoly(q->m[i],perm,orig_ring, currRing,nMap,
2977  par_perm,par_perm_size);
2978  // PrintS("map:");pWrite(dest_id->m[i]);PrintLn();
2979  pTest(dest_id->m[i]);
2980  }
2981  R->qideal=dest_id;
2982  if (perm!=NULL)
2983  omFreeSize((ADDRESS)perm,(orig_ring->N+1)*sizeof(int));
2984  if (par_perm!=NULL)
2985  omFreeSize((ADDRESS)par_perm,par_perm_size*sizeof(int));
2986  rChangeCurrRing(orig_ring);
2987  #endif
2988  }
2989  else
2990  R->qideal=idrCopyR(q,currRing,R);
2991  }
2992  }
2993  else
2994  {
2995  WerrorS("q-ideal must be given as `ideal`");
2996  goto rCompose_err;
2997  }
2998 
2999 
3000  // ---------------------------------------------------------------
3001  #ifdef HAVE_PLURAL
3002  if (L->nr==5)
3003  {
3004  if (nc_CallPlural((matrix)L->m[4].Data(),
3005  (matrix)L->m[5].Data(),
3006  NULL,NULL,
3007  R,
3008  true, // !!!
3009  true, false,
3010  currRing, FALSE)) goto rCompose_err;
3011  // takes care about non-comm. quotient! i.e. calls "nc_SetupQuotient" due to last true
3012  }
3013  #endif
3014  return R;
3015 
3016 rCompose_err:
3017  if (R->N>0)
3018  {
3019  int i;
3020  if (R->names!=NULL)
3021  {
3022  i=R->N-1;
3023  while (i>=0) { omfree(R->names[i]); i--; }
3024  omFree(R->names);
3025  }
3026  }
3027  omfree(R->order);
3028  omfree(R->block0);
3029  omfree(R->block1);
3030  omfree(R->wvhdl);
3031  omFree(R);
3032  return NULL;
3033 }

◆ rDecompose()

lists rDecompose ( const ring  r)

Definition at line 2058 of file ipshell.cc.

2059 {
2060  assume( r != NULL );
2061  const coeffs C = r->cf;
2062  assume( C != NULL );
2063 
2064  // sanity check: require currRing==r for rings with polynomial data
2065  if ( (r!=currRing) && (
2066  (nCoeff_is_algExt(C) && (C != currRing->cf))
2067  || (r->qideal != NULL)
2068 #ifdef HAVE_PLURAL
2069  || (rIsPluralRing(r))
2070 #endif
2071  )
2072  )
2073  {
2074  WerrorS("ring with polynomial data must be the base ring or compatible");
2075  return NULL;
2076  }
2077  // 0: char/ cf - ring
2078  // 1: list (var)
2079  // 2: list (ord)
2080  // 3: qideal
2081  // possibly:
2082  // 4: C
2083  // 5: D
2085  if (rIsPluralRing(r))
2086  L->Init(6);
2087  else
2088  L->Init(4);
2089  // ----------------------------------------
2090  // 0: char/ cf - ring
2091  if (rField_is_numeric(r))
2092  {
2093  rDecomposeC(&(L->m[0]),r);
2094  }
2095  else if (rField_is_Ring(r))
2096  {
2097  rDecomposeRing(&(L->m[0]),r);
2098  }
2099  else if ( r->cf->extRing!=NULL )// nCoeff_is_algExt(r->cf))
2100  {
2101  rDecomposeCF(&(L->m[0]), r->cf->extRing, r);
2102  }
2103  else if(rField_is_GF(r))
2104  {
2106  Lc->Init(4);
2107  // char:
2108  Lc->m[0].rtyp=INT_CMD;
2109  Lc->m[0].data=(void*)(long)r->cf->m_nfCharQ;
2110  // var:
2112  Lv->Init(1);
2113  Lv->m[0].rtyp=STRING_CMD;
2114  Lv->m[0].data=(void *)omStrDup(*rParameter(r));
2115  Lc->m[1].rtyp=LIST_CMD;
2116  Lc->m[1].data=(void*)Lv;
2117  // ord:
2119  Lo->Init(1);
2121  Loo->Init(2);
2122  Loo->m[0].rtyp=STRING_CMD;
2123  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
2124 
2125  intvec *iv=new intvec(1); (*iv)[0]=1;
2126  Loo->m[1].rtyp=INTVEC_CMD;
2127  Loo->m[1].data=(void *)iv;
2128 
2129  Lo->m[0].rtyp=LIST_CMD;
2130  Lo->m[0].data=(void*)Loo;
2131 
2132  Lc->m[2].rtyp=LIST_CMD;
2133  Lc->m[2].data=(void*)Lo;
2134  // q-ideal:
2135  Lc->m[3].rtyp=IDEAL_CMD;
2136  Lc->m[3].data=(void *)idInit(1,1);
2137  // ----------------------
2138  L->m[0].rtyp=LIST_CMD;
2139  L->m[0].data=(void*)Lc;
2140  }
2141  else
2142  {
2143  L->m[0].rtyp=INT_CMD;
2144  L->m[0].data=(void *)(long)r->cf->ch;
2145  }
2146  // ----------------------------------------
2147  // 1: list (var)
2149  LL->Init(r->N);
2150  int i;
2151  for(i=0; i<r->N; i++)
2152  {
2153  LL->m[i].rtyp=STRING_CMD;
2154  LL->m[i].data=(void *)omStrDup(r->names[i]);
2155  }
2156  L->m[1].rtyp=LIST_CMD;
2157  L->m[1].data=(void *)LL;
2158  // ----------------------------------------
2159  // 2: list (ord)
2161  i=rBlocks(r)-1;
2162  LL->Init(i);
2163  i--;
2164  lists LLL;
2165  for(; i>=0; i--)
2166  {
2167  intvec *iv;
2168  int j;
2169  LL->m[i].rtyp=LIST_CMD;
2171  LLL->Init(2);
2172  LLL->m[0].rtyp=STRING_CMD;
2173  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
2174 
2175  if((r->order[i] == ringorder_IS)
2176  || (r->order[i] == ringorder_s)) //|| r->order[i] == ringorder_S)
2177  {
2178  assume( r->block0[i] == r->block1[i] );
2179  const int s = r->block0[i];
2180  assume( (-2 < s && s < 2)||(r->order[i] != ringorder_IS));
2181 
2182  iv=new intvec(1);
2183  (*iv)[0] = s;
2184  }
2185  else if (r->block1[i]-r->block0[i] >=0 )
2186  {
2187  int bl=j=r->block1[i]-r->block0[i];
2188  if (r->order[i]==ringorder_M)
2189  {
2190  j=(j+1)*(j+1)-1;
2191  bl=j+1;
2192  }
2193  else if (r->order[i]==ringorder_am)
2194  {
2195  j+=r->wvhdl[i][bl+1];
2196  }
2197  iv=new intvec(j+1);
2198  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
2199  {
2200  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
2201  }
2202  else switch (r->order[i])
2203  {
2204  case ringorder_dp:
2205  case ringorder_Dp:
2206  case ringorder_ds:
2207  case ringorder_Ds:
2208  case ringorder_lp:
2209  for(;j>=0; j--) (*iv)[j]=1;
2210  break;
2211  default: /* do nothing */;
2212  }
2213  }
2214  else
2215  {
2216  iv=new intvec(1);
2217  }
2218  LLL->m[1].rtyp=INTVEC_CMD;
2219  LLL->m[1].data=(void *)iv;
2220  LL->m[i].data=(void *)LLL;
2221  }
2222  L->m[2].rtyp=LIST_CMD;
2223  L->m[2].data=(void *)LL;
2224  // ----------------------------------------
2225  // 3: qideal
2226  L->m[3].rtyp=IDEAL_CMD;
2227  if (r->qideal==NULL)
2228  L->m[3].data=(void *)idInit(1,1);
2229  else
2230  L->m[3].data=(void *)idCopy(r->qideal);
2231  // ----------------------------------------
2232 #ifdef HAVE_PLURAL // NC! in rDecompose
2233  if (rIsPluralRing(r))
2234  {
2235  L->m[4].rtyp=MATRIX_CMD;
2236  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2237  L->m[5].rtyp=MATRIX_CMD;
2238  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2239  }
2240 #endif
2241  return L;
2242 }

◆ rDecompose_CF()

BOOLEAN rDecompose_CF ( leftv  res,
const coeffs  C 
)

Definition at line 1856 of file ipshell.cc.

1857 {
1858  assume( C != NULL );
1859 
1860  // sanity check: require currRing==r for rings with polynomial data
1861  if ( nCoeff_is_algExt(C) && (C != currRing->cf))
1862  {
1863  WerrorS("ring with polynomial data must be the base ring or compatible");
1864  return TRUE;
1865  }
1866  if (nCoeff_is_numeric(C))
1867  {
1868  rDecomposeC_41(res,C);
1869  }
1870 #ifdef HAVE_RINGS
1871  else if (nCoeff_is_Ring(C))
1872  {
1874  }
1875 #endif
1876  else if ( C->extRing!=NULL )// nCoeff_is_algExt(r->cf))
1877  {
1878  rDecomposeCF(res, C->extRing, currRing);
1879  }
1880  else if(nCoeff_is_GF(C))
1881  {
1883  Lc->Init(4);
1884  // char:
1885  Lc->m[0].rtyp=INT_CMD;
1886  Lc->m[0].data=(void*)(long)C->m_nfCharQ;
1887  // var:
1889  Lv->Init(1);
1890  Lv->m[0].rtyp=STRING_CMD;
1891  Lv->m[0].data=(void *)omStrDup(*n_ParameterNames(C));
1892  Lc->m[1].rtyp=LIST_CMD;
1893  Lc->m[1].data=(void*)Lv;
1894  // ord:
1896  Lo->Init(1);
1898  Loo->Init(2);
1899  Loo->m[0].rtyp=STRING_CMD;
1900  Loo->m[0].data=(void *)omStrDup(rSimpleOrdStr(ringorder_lp));
1901 
1902  intvec *iv=new intvec(1); (*iv)[0]=1;
1903  Loo->m[1].rtyp=INTVEC_CMD;
1904  Loo->m[1].data=(void *)iv;
1905 
1906  Lo->m[0].rtyp=LIST_CMD;
1907  Lo->m[0].data=(void*)Loo;
1908 
1909  Lc->m[2].rtyp=LIST_CMD;
1910  Lc->m[2].data=(void*)Lo;
1911  // q-ideal:
1912  Lc->m[3].rtyp=IDEAL_CMD;
1913  Lc->m[3].data=(void *)idInit(1,1);
1914  // ----------------------
1915  res->rtyp=LIST_CMD;
1916  res->data=(void*)Lc;
1917  }
1918  else
1919  {
1920  res->rtyp=INT_CMD;
1921  res->data=(void *)(long)C->ch;
1922  }
1923  // ----------------------------------------
1924  return FALSE;
1925 }

◆ rDecompose_list_cf()

lists rDecompose_list_cf ( const ring  r)

Definition at line 1927 of file ipshell.cc.

1928 {
1929  assume( r != NULL );
1930  const coeffs C = r->cf;
1931  assume( C != NULL );
1932 
1933  // sanity check: require currRing==r for rings with polynomial data
1934  if ( (r!=currRing) && (
1935  (r->qideal != NULL)
1936 #ifdef HAVE_PLURAL
1937  || (rIsPluralRing(r))
1938 #endif
1939  )
1940  )
1941  {
1942  WerrorS("ring with polynomial data must be the base ring or compatible");
1943  return NULL;
1944  }
1945  // 0: char/ cf - ring
1946  // 1: list (var)
1947  // 2: list (ord)
1948  // 3: qideal
1949  // possibly:
1950  // 4: C
1951  // 5: D
1953  if (rIsPluralRing(r))
1954  L->Init(6);
1955  else
1956  L->Init(4);
1957  // ----------------------------------------
1958  // 0: char/ cf - ring
1959  L->m[0].rtyp=CRING_CMD;
1960  L->m[0].data=(char*)r->cf; r->cf->ref++;
1961  // ----------------------------------------
1962  // 1: list (var)
1964  LL->Init(r->N);
1965  int i;
1966  for(i=0; i<r->N; i++)
1967  {
1968  LL->m[i].rtyp=STRING_CMD;
1969  LL->m[i].data=(void *)omStrDup(r->names[i]);
1970  }
1971  L->m[1].rtyp=LIST_CMD;
1972  L->m[1].data=(void *)LL;
1973  // ----------------------------------------
1974  // 2: list (ord)
1976  i=rBlocks(r)-1;
1977  LL->Init(i);
1978  i--;
1979  lists LLL;
1980  for(; i>=0; i--)
1981  {
1982  intvec *iv;
1983  int j;
1984  LL->m[i].rtyp=LIST_CMD;
1986  LLL->Init(2);
1987  LLL->m[0].rtyp=STRING_CMD;
1988  LLL->m[0].data=(void *)omStrDup(rSimpleOrdStr(r->order[i]));
1989 
1990  if(r->order[i] == ringorder_IS) // || r->order[i] == ringorder_s || r->order[i] == ringorder_S)
1991  {
1992  assume( r->block0[i] == r->block1[i] );
1993  const int s = r->block0[i];
1994  assume( -2 < s && s < 2);
1995 
1996  iv=new intvec(1);
1997  (*iv)[0] = s;
1998  }
1999  else if (r->block1[i]-r->block0[i] >=0 )
2000  {
2001  int bl=j=r->block1[i]-r->block0[i];
2002  if (r->order[i]==ringorder_M)
2003  {
2004  j=(j+1)*(j+1)-1;
2005  bl=j+1;
2006  }
2007  else if (r->order[i]==ringorder_am)
2008  {
2009  j+=r->wvhdl[i][bl+1];
2010  }
2011  iv=new intvec(j+1);
2012  if ((r->wvhdl!=NULL) && (r->wvhdl[i]!=NULL))
2013  {
2014  for(;j>=0; j--) (*iv)[j]=r->wvhdl[i][j+(j>bl)];
2015  }
2016  else switch (r->order[i])
2017  {
2018  case ringorder_dp:
2019  case ringorder_Dp:
2020  case ringorder_ds:
2021  case ringorder_Ds:
2022  case ringorder_lp:
2023  for(;j>=0; j--) (*iv)[j]=1;
2024  break;
2025  default: /* do nothing */;
2026  }
2027  }
2028  else
2029  {
2030  iv=new intvec(1);
2031  }
2032  LLL->m[1].rtyp=INTVEC_CMD;
2033  LLL->m[1].data=(void *)iv;
2034  LL->m[i].data=(void *)LLL;
2035  }
2036  L->m[2].rtyp=LIST_CMD;
2037  L->m[2].data=(void *)LL;
2038  // ----------------------------------------
2039  // 3: qideal
2040  L->m[3].rtyp=IDEAL_CMD;
2041  if (r->qideal==NULL)
2042  L->m[3].data=(void *)idInit(1,1);
2043  else
2044  L->m[3].data=(void *)idCopy(r->qideal);
2045  // ----------------------------------------
2046 #ifdef HAVE_PLURAL // NC! in rDecompose
2047  if (rIsPluralRing(r))
2048  {
2049  L->m[4].rtyp=MATRIX_CMD;
2050  L->m[4].data=(void *)mp_Copy(r->GetNC()->C, r, r);
2051  L->m[5].rtyp=MATRIX_CMD;
2052  L->m[5].data=(void *)mp_Copy(r->GetNC()->D, r, r);
2053  }
2054 #endif
2055  return L;
2056 }

◆ rDefault()

idhdl rDefault ( const char *  s)

Definition at line 1555 of file ipshell.cc.

1556 {
1557  idhdl tmp=NULL;
1558 
1559  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1560  if (tmp==NULL) return NULL;
1561 
1562 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1564  {
1566  memset(&sLastPrinted,0,sizeof(sleftv));
1567  }
1568 
1569  ring r = IDRING(tmp) = (ring) omAlloc0Bin(sip_sring_bin);
1570 
1571  #ifndef TEST_ZN_AS_ZP
1572  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1573  #else
1574  mpz_t modBase;
1575  mpz_init_set_ui(modBase, (long)32003);
1576  ZnmInfo info;
1577  info.base= modBase;
1578  info.exp= 1;
1579  r->cf=nInitChar(n_Zn,(void*) &info);
1580  r->cf->is_field=1;
1581  r->cf->is_domain=1;
1582  r->cf->has_simple_Inverse=1;
1583  #endif
1584  r->N = 3;
1585  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1586  /*names*/
1587  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1588  r->names[0] = omStrDup("x");
1589  r->names[1] = omStrDup("y");
1590  r->names[2] = omStrDup("z");
1591  /*weights: entries for 3 blocks: NULL*/
1592  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1593  /*order: dp,C,0*/
1594  r->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *));
1595  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1596  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1597  /* ringorder dp for the first block: var 1..3 */
1598  r->order[0] = ringorder_dp;
1599  r->block0[0] = 1;
1600  r->block1[0] = 3;
1601  /* ringorder C for the second block: no vars */
1602  r->order[1] = ringorder_C;
1603  /* the last block: everything is 0 */
1604  r->order[2] = (rRingOrder_t)0;
1605 
1606  /* complete ring intializations */
1607  rComplete(r);
1608  rSetHdl(tmp);
1609  return currRingHdl;
1610 }

◆ rFindHdl()

idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1612 of file ipshell.cc.

1613 {
1615  if (h!=NULL) return h;
1616  if (IDROOT!=basePack->idroot) h=rSimpleFindHdl(r,basePack->idroot,n);
1617  if (h!=NULL) return h;
1619  while(p!=NULL)
1620  {
1621  if ((p->cPack!=basePack)
1622  && (p->cPack!=currPack))
1623  h=rSimpleFindHdl(r,p->cPack->idroot,n);
1624  if (h!=NULL) return h;
1625  p=p->next;
1626  }
1627  idhdl tmp=basePack->idroot;
1628  while (tmp!=NULL)
1629  {
1630  if (IDTYP(tmp)==PACKAGE_CMD)
1631  h=rSimpleFindHdl(r,IDPACKAGE(tmp)->idroot,n);
1632  if (h!=NULL) return h;
1633  tmp=IDNEXT(tmp);
1634  }
1635  return NULL;
1636 }

◆ rInit()

ring rInit ( leftv  pn,
leftv  rv,
leftv  ord 
)

Definition at line 5574 of file ipshell.cc.

5575 {
5576  int float_len=0;
5577  int float_len2=0;
5578  ring R = NULL;
5579  //BOOLEAN ffChar=FALSE;
5580 
5581  /* ch -------------------------------------------------------*/
5582  // get ch of ground field
5583 
5584  // allocated ring
5585  R = (ring) omAlloc0Bin(sip_sring_bin);
5586 
5587  coeffs cf = NULL;
5588 
5589  assume( pn != NULL );
5590  const int P = pn->listLength();
5591 
5592  if (pn->Typ()==CRING_CMD)
5593  {
5594  cf=(coeffs)pn->CopyD();
5595  leftv pnn=pn;
5596  if(P>1) /*parameter*/
5597  {
5598  pnn = pnn->next;
5599  const int pars = pnn->listLength();
5600  assume( pars > 0 );
5601  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5602 
5603  if (rSleftvList2StringArray(pnn, names))
5604  {
5605  WerrorS("parameter expected");
5606  goto rInitError;
5607  }
5608 
5609  TransExtInfo extParam;
5610 
5611  extParam.r = rDefault( cf, pars, names); // Q/Zp [ p_1, ... p_pars ]
5612  for(int i=pars-1; i>=0;i--)
5613  {
5614  omFree(names[i]);
5615  }
5616  omFree(names);
5617 
5618  cf = nInitChar(n_transExt, &extParam);
5619  }
5620  assume( cf != NULL );
5621  }
5622  else if (pn->Typ()==INT_CMD)
5623  {
5624  int ch = (int)(long)pn->Data();
5625  leftv pnn=pn;
5626 
5627  /* parameter? -------------------------------------------------------*/
5628  pnn = pnn->next;
5629 
5630  if (pnn == NULL) // no params!?
5631  {
5632  if (ch!=0)
5633  {
5634  int ch2=IsPrime(ch);
5635  if ((ch<2)||(ch!=ch2))
5636  {
5637  Warn("%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5638  ch=32003;
5639  }
5640  #ifndef TEST_ZN_AS_ZP
5641  cf = nInitChar(n_Zp, (void*)(long)ch);
5642  #else
5643  mpz_t modBase;
5644  mpz_init_set_ui(modBase, (long)ch);
5645  ZnmInfo info;
5646  info.base= modBase;
5647  info.exp= 1;
5648  cf=nInitChar(n_Zn,(void*) &info);
5649  cf->is_field=1;
5650  cf->is_domain=1;
5651  cf->has_simple_Inverse=1;
5652  #endif
5653  }
5654  else
5655  cf = nInitChar(n_Q, (void*)(long)ch);
5656  }
5657  else
5658  {
5659  const int pars = pnn->listLength();
5660 
5661  assume( pars > 0 );
5662 
5663  // predefined finite field: (p^k, a)
5664  if ((ch!=0) && (ch!=IsPrime(ch)) && (pars == 1))
5665  {
5666  GFInfo param;
5667 
5668  param.GFChar = ch;
5669  param.GFDegree = 1;
5670  param.GFPar_name = pnn->name;
5671 
5672  cf = nInitChar(n_GF, &param);
5673  }
5674  else // (0/p, a, b, ..., z)
5675  {
5676  if ((ch!=0) && (ch!=IsPrime(ch)))
5677  {
5678  WerrorS("too many parameters");
5679  goto rInitError;
5680  }
5681 
5682  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5683 
5684  if (rSleftvList2StringArray(pnn, names))
5685  {
5686  WerrorS("parameter expected");
5687  goto rInitError;
5688  }
5689 
5690  TransExtInfo extParam;
5691 
5692  extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ]
5693  for(int i=pars-1; i>=0;i--)
5694  {
5695  omFree(names[i]);
5696  }
5697  omFree(names);
5698 
5699  cf = nInitChar(n_transExt, &extParam);
5700  }
5701  }
5702 
5703  //if (cf==NULL) ->Error: Invalid ground field specification
5704  }
5705  else if ((pn->name != NULL)
5706  && ((strcmp(pn->name,"real")==0) || (strcmp(pn->name,"complex")==0)))
5707  {
5708  leftv pnn=pn->next;
5709  BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0);
5710  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
5711  {
5712  float_len=(int)(long)pnn->Data();
5713  float_len2=float_len;
5714  pnn=pnn->next;
5715  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
5716  {
5717  float_len2=(int)(long)pnn->Data();
5718  pnn=pnn->next;
5719  }
5720  }
5721 
5722  if (!complex_flag)
5723  complex_flag= (pnn!=NULL) && (pnn->name!=NULL);
5724  if( !complex_flag && (float_len2 <= (short)SHORT_REAL_LENGTH))
5725  cf=nInitChar(n_R, NULL);
5726  else // longR or longC?
5727  {
5728  LongComplexInfo param;
5729 
5730  param.float_len = si_min (float_len, 32767);
5731  param.float_len2 = si_min (float_len2, 32767);
5732 
5733  // set the parameter name
5734  if (complex_flag)
5735  {
5736  if (param.float_len < SHORT_REAL_LENGTH)
5737  {
5740  }
5741  if ((pnn == NULL) || (pnn->name == NULL))
5742  param.par_name=(const char*)"i"; //default to i
5743  else
5744  param.par_name = (const char*)pnn->name;
5745  }
5746 
5747  cf = nInitChar(complex_flag ? n_long_C: n_long_R, (void*)&param);
5748  }
5749  assume( cf != NULL );
5750  }
5751 #ifdef HAVE_RINGS
5752  else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0))
5753  {
5754  // TODO: change to use coeffs_BIGINT!?
5755  mpz_t modBase;
5756  unsigned int modExponent = 1;
5757  mpz_init_set_si(modBase, 0);
5758  if (pn->next!=NULL)
5759  {
5760  leftv pnn=pn;
5761  if (pnn->next->Typ()==INT_CMD)
5762  {
5763  pnn=pnn->next;
5764  mpz_set_ui(modBase, (long) pnn->Data());
5765  if ((pnn->next!=NULL) && (pnn->next->Typ()==INT_CMD))
5766  {
5767  pnn=pnn->next;
5768  modExponent = (long) pnn->Data();
5769  }
5770  while ((pnn->next!=NULL) && (pnn->next->Typ()==INT_CMD))
5771  {
5772  pnn=pnn->next;
5773  mpz_mul_ui(modBase, modBase, (int)(long) pnn->Data());
5774  }
5775  }
5776  else if (pnn->next->Typ()==BIGINT_CMD)
5777  {
5778  number p=(number)pnn->next->CopyD();
5779  nlGMP(p,modBase,coeffs_BIGINT); // TODO? // extern void nlGMP(number &i, mpz_t n, const coeffs r); // FIXME: n_MPZ( modBase, p, coeffs_BIGINT); ?
5781  }
5782  }
5783  else
5784  cf=nInitChar(n_Z,NULL);
5785 
5786  if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_sgn1(modBase) < 0))
5787  {
5788  WerrorS("Wrong ground ring specification (module is 1)");
5789  goto rInitError;
5790  }
5791  if (modExponent < 1)
5792  {
5793  WerrorS("Wrong ground ring specification (exponent smaller than 1");
5794  goto rInitError;
5795  }
5796  // module is 0 ---> integers ringtype = 4;
5797  // we have an exponent
5798  if (modExponent > 1 && cf == NULL)
5799  {
5800  if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
5801  {
5802  /* this branch should be active for modExponent = 2..32 resp. 2..64,
5803  depending on the size of a long on the respective platform */
5804  //ringtype = 1; // Use Z/2^ch
5805  cf=nInitChar(n_Z2m,(void*)(long)modExponent);
5806  }
5807  else
5808  {
5809  if (mpz_sgn1(modBase)==0)
5810  {
5811  WerrorS("modulus must not be 0 or parameter not allowed");
5812  goto rInitError;
5813  }
5814  //ringtype = 3;
5815  ZnmInfo info;
5816  info.base= modBase;
5817  info.exp= modExponent;
5818  cf=nInitChar(n_Znm,(void*) &info); //exponent is missing
5819  }
5820  }
5821  // just a module m > 1
5822  else if (cf == NULL)
5823  {
5824  if (mpz_sgn1(modBase)==0)
5825  {
5826  WerrorS("modulus must not be 0 or parameter not allowed");
5827  goto rInitError;
5828  }
5829  //ringtype = 2;
5830  ZnmInfo info;
5831  info.base= modBase;
5832  info.exp= modExponent;
5833  cf=nInitChar(n_Zn,(void*) &info);
5834  }
5835  assume( cf != NULL );
5836  mpz_clear(modBase);
5837  }
5838 #endif
5839  // ring NEW = OLD, (), (); where OLD is a polynomial ring...
5840  else if ((pn->Typ()==RING_CMD) && (P == 1))
5841  {
5842  TransExtInfo extParam;
5843  extParam.r = (ring)pn->Data();
5844  cf = nInitChar(n_transExt, &extParam);
5845  }
5846  //else if ((pn->Typ()==QRING_CMD) && (P == 1)) // same for qrings - which should be fields!?
5847  //{
5848  // AlgExtInfo extParam;
5849  // extParam.r = (ring)pn->Data();
5850 
5851  // cf = nInitChar(n_algExt, &extParam); // Q[a]/<minideal>
5852  //}
5853  else
5854  {
5855  WerrorS("Wrong or unknown ground field specification");
5856 #if 0
5857 // debug stuff for unknown cf descriptions:
5858  sleftv* p = pn;
5859  while (p != NULL)
5860  {
5861  Print( "pn[%p]: type: %d [%s]: %p, name: %s", (void*)p, p->Typ(), Tok2Cmdname(p->Typ()), p->Data(), (p->name == NULL? "NULL" : p->name) );
5862  PrintLn();
5863  p = p->next;
5864  }
5865 #endif
5866  goto rInitError;
5867  }
5868 
5869  /*every entry in the new ring is initialized to 0*/
5870 
5871  /* characteristic -----------------------------------------------*/
5872  /* input: 0 ch=0 : Q parameter=NULL ffChar=FALSE float_len
5873  * 0 1 : Q(a,...) *names FALSE
5874  * 0 -1 : R NULL FALSE 0
5875  * 0 -1 : R NULL FALSE prec. >6
5876  * 0 -1 : C *names FALSE prec. 0..?
5877  * p p : Fp NULL FALSE
5878  * p -p : Fp(a) *names FALSE
5879  * q q : GF(q=p^n) *names TRUE
5880  */
5881  if (cf==NULL)
5882  {
5883  WerrorS("Invalid ground field specification");
5884  goto rInitError;
5885 // const int ch=32003;
5886 // cf=nInitChar(n_Zp, (void*)(long)ch);
5887  }
5888 
5889  assume( R != NULL );
5890 
5891  R->cf = cf;
5892 
5893  /* names and number of variables-------------------------------------*/
5894  {
5895  int l=rv->listLength();
5896 
5897  if (l>MAX_SHORT)
5898  {
5899  Werror("too many ring variables(%d), max is %d",l,MAX_SHORT);
5900  goto rInitError;
5901  }
5902  R->N = l; /*rv->listLength();*/
5903  }
5904  R->names = (char **)omAlloc0(R->N * sizeof(char_ptr));
5905  if (rSleftvList2StringArray(rv, R->names))
5906  {
5907  WerrorS("name of ring variable expected");
5908  goto rInitError;
5909  }
5910 
5911  /* check names and parameters for conflicts ------------------------- */
5912  rRenameVars(R); // conflicting variables will be renamed
5913  /* ordering -------------------------------------------------------------*/
5914  if (rSleftvOrdering2Ordering(ord, R))
5915  goto rInitError;
5916 
5917  // Complete the initialization
5918  if (rComplete(R,1))
5919  goto rInitError;
5920 
5921 /*#ifdef HAVE_RINGS
5922 // currently, coefficients which are ring elements require a global ordering:
5923  if (rField_is_Ring(R) && (R->OrdSgn==-1))
5924  {
5925  WerrorS("global ordering required for these coefficients");
5926  goto rInitError;
5927  }
5928 #endif*/
5929 
5930  rTest(R);
5931 
5932  // try to enter the ring into the name list
5933  // need to clean up sleftv here, before this ring can be set to
5934  // new currRing or currRing can be killed beacuse new ring has
5935  // same name
5936  pn->CleanUp();
5937  rv->CleanUp();
5938  ord->CleanUp();
5939  //if ((tmp = enterid(s, myynest, RING_CMD, &IDROOT))==NULL)
5940  // goto rInitError;
5941 
5942  //memcpy(IDRING(tmp),R,sizeof(*R));
5943  // set current ring
5944  //omFreeBin(R, ip_sring_bin);
5945  //return tmp;
5946  return R;
5947 
5948  // error case:
5949  rInitError:
5950  if ((R != NULL)&&(R->cf!=NULL)) rDelete(R);
5951  pn->CleanUp();
5952  rv->CleanUp();
5953  ord->CleanUp();
5954  return NULL;
5955 }

◆ rKill() [1/2]

void rKill ( idhdl  h)

Definition at line 6165 of file ipshell.cc.

6166 {
6167  ring r = IDRING(h);
6168  int ref=0;
6169  if (r!=NULL)
6170  {
6171  // avoid, that sLastPrinted is the last reference to the base ring:
6172  // clean up before killing the last "named" refrence:
6173  if ((sLastPrinted.rtyp==RING_CMD)
6174  && (sLastPrinted.data==(void*)r))
6175  {
6176  sLastPrinted.CleanUp(r);
6177  }
6178  ref=r->ref;
6179  if ((ref<=0)&&(r==currRing))
6180  {
6181  // cleanup DENOMINATOR_LIST
6182  if (DENOMINATOR_LIST!=NULL)
6183  {
6185  if (TEST_V_ALLWARN)
6186  Warn("deleting denom_list for ring change from %s",IDID(h));
6187  do
6188  {
6189  n_Delete(&(dd->n),currRing->cf);
6190  dd=dd->next;
6192  DENOMINATOR_LIST=dd;
6193  } while(DENOMINATOR_LIST!=NULL);
6194  }
6195  }
6196  rKill(r);
6197  }
6198  if (h==currRingHdl)
6199  {
6200  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
6201  else
6202  {
6204  }
6205  }
6206 }

◆ rKill() [2/2]

void rKill ( ring  r)

Definition at line 6119 of file ipshell.cc.

6120 {
6121  if ((r->ref<=0)&&(r->order!=NULL))
6122  {
6123 #ifdef RDEBUG
6124  if (traceit &TRACE_SHOW_RINGS) Print("kill ring %lx\n",(long)r);
6125 #endif
6126  int j;
6127  for (j=0;j<myynest;j++)
6128  {
6129  if (iiLocalRing[j]==r)
6130  {
6131  if (j==0) WarnS("killing the basering for level 0");
6132  iiLocalRing[j]=NULL;
6133  }
6134  }
6135 // any variables depending on r ?
6136  while (r->idroot!=NULL)
6137  {
6138  r->idroot->lev=myynest; // avoid warning about kill global objects
6139  killhdl2(r->idroot,&(r->idroot),r);
6140  }
6141  if (r==currRing)
6142  {
6143  // all dependend stuff is done, clean global vars:
6144  if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
6146  {
6148  }
6149  //if ((myynest>0) && (iiRETURNEXPR.RingDependend()))
6150  //{
6151  // WerrorS("return value depends on local ring variable (export missing ?)");
6152  // iiRETURNEXPR.CleanUp();
6153  //}
6154  currRing=NULL;
6155  currRingHdl=NULL;
6156  }
6157 
6158  /* nKillChar(r); will be called from inside of rDelete */
6159  rDelete(r);
6160  return;
6161  }
6162  r->ref--;
6163 }

◆ rSetHdl()

void rSetHdl ( idhdl  h)

Definition at line 5081 of file ipshell.cc.

5082 {
5083  ring rg = NULL;
5084  if (h!=NULL)
5085  {
5086 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
5087  rg = IDRING(h);
5088  if (rg==NULL) return; //id <>NULL, ring==NULL
5089  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
5090  if (IDID(h)) // OB: ????
5092  rTest(rg);
5093  }
5094  else return;
5095 
5096  // clean up history
5097  if (currRing!=NULL)
5098  {
5100  {
5102  //memset(&sLastPrinted,0,sizeof(sleftv)); // done by Cleanup,Init
5103  }
5104 
5105  if (rg!=currRing)/*&&(currRing!=NULL)*/
5106  {
5107  if (rg->cf!=currRing->cf)
5108  {
5110  if (DENOMINATOR_LIST!=NULL)
5111  {
5112  if (TEST_V_ALLWARN)
5113  Warn("deleting denom_list for ring change to %s",IDID(h));
5114  do
5115  {
5116  n_Delete(&(dd->n),currRing->cf);
5117  dd=dd->next;
5119  DENOMINATOR_LIST=dd;
5120  } while(DENOMINATOR_LIST!=NULL);
5121  }
5122  }
5123  }
5124  }
5125 
5126  // test for valid "currRing":
5127  if ((rg!=NULL) && (rg->idroot==NULL))
5128  {
5129  ring old=rg;
5130  rg=rAssure_HasComp(rg);
5131  if (old!=rg)
5132  {
5133  rKill(old);
5134  IDRING(h)=rg;
5135  }
5136  }
5137  /*------------ change the global ring -----------------------*/
5138  rChangeCurrRing(rg);
5139  currRingHdl = h;
5140 }

◆ rSimpleFindHdl()

idhdl rSimpleFindHdl ( ring  r,
idhdl  root,
idhdl  n = NULL 
)

Definition at line 6208 of file ipshell.cc.

6209 {
6210  idhdl h=root;
6211  while (h!=NULL)
6212  {
6213  if ((IDTYP(h)==RING_CMD)
6214  && (h!=n)
6215  && (IDRING(h)==r)
6216  )
6217  {
6218  return h;
6219  }
6220  h=IDNEXT(h);
6221  }
6222  return NULL;
6223 }

◆ scIndIndset()

lists scIndIndset ( ideal  S,
BOOLEAN  all,
ideal  Q 
)

Definition at line 1027 of file ipshell.cc.

1028 {
1029  int i;
1030  indset save;
1032 
1033  hexist = hInit(S, Q, &hNexist, currRing);
1034  if (hNexist == 0)
1035  {
1036  intvec *iv=new intvec(rVar(currRing));
1037  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1038  res->Init(1);
1039  res->m[0].rtyp=INTVEC_CMD;
1040  res->m[0].data=(intvec*)iv;
1041  return res;
1042  }
1043  else if (hisModule!=0)
1044  {
1045  res->Init(0);
1046  return res;
1047  }
1048  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1049  hMu = 0;
1050  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1051  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1052  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1053  hrad = hexist;
1054  hNrad = hNexist;
1055  radmem = hCreate(rVar(currRing) - 1);
1056  hCo = rVar(currRing) + 1;
1057  hNvar = rVar(currRing);
1058  hRadical(hrad, &hNrad, hNvar);
1059  hSupp(hrad, hNrad, hvar, &hNvar);
1060  if (hNvar)
1061  {
1062  hCo = hNvar;
1063  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1064  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1065  hLexR(hrad, hNrad, hvar, hNvar);
1067  }
1068  if (hCo && (hCo < rVar(currRing)))
1069  {
1071  }
1072  if (hMu!=0)
1073  {
1074  ISet = save;
1075  hMu2 = 0;
1076  if (all && (hCo+1 < rVar(currRing)))
1077  {
1080  i=hMu+hMu2;
1081  res->Init(i);
1082  if (hMu2 == 0)
1083  {
1085  }
1086  }
1087  else
1088  {
1089  res->Init(hMu);
1090  }
1091  for (i=0;i<hMu;i++)
1092  {
1093  res->m[i].data = (void *)save->set;
1094  res->m[i].rtyp = INTVEC_CMD;
1095  ISet = save;
1096  save = save->nx;
1098  }
1099  omFreeBin((ADDRESS)save, indlist_bin);
1100  if (hMu2 != 0)
1101  {
1102  save = JSet;
1103  for (i=hMu;i<hMu+hMu2;i++)
1104  {
1105  res->m[i].data = (void *)save->set;
1106  res->m[i].rtyp = INTVEC_CMD;
1107  JSet = save;
1108  save = save->nx;
1110  }
1111  omFreeBin((ADDRESS)save, indlist_bin);
1112  }
1113  }
1114  else
1115  {
1116  res->Init(0);
1118  }
1119  hKill(radmem, rVar(currRing) - 1);
1120  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1121  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1122  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1124  return res;
1125 }

◆ semicProc()

BOOLEAN semicProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4520 of file ipshell.cc.

4521 {
4522  sleftv tmp;
4523  memset(&tmp,0,sizeof(tmp));
4524  tmp.rtyp=INT_CMD;
4525  /* tmp.data = (void *)0; -- done by memset */
4526 
4527  return semicProc3(res,u,v,&tmp);
4528 }

◆ semicProc3()

BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4480 of file ipshell.cc.

4481 {
4482  semicState state;
4483  BOOLEAN qh=(((int)(long)w->Data())==1);
4484 
4485  // -----------------
4486  // check arguments
4487  // -----------------
4488 
4489  lists l1 = (lists)u->Data( );
4490  lists l2 = (lists)v->Data( );
4491 
4492  if( (state=list_is_spectrum( l1 ))!=semicOK )
4493  {
4494  WerrorS( "first argument is not a spectrum" );
4495  list_error( state );
4496  }
4497  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4498  {
4499  WerrorS( "second argument is not a spectrum" );
4500  list_error( state );
4501  }
4502  else
4503  {
4504  spectrum s1= spectrumFromList( l1 );
4505  spectrum s2= spectrumFromList( l2 );
4506 
4507  res->rtyp = INT_CMD;
4508  if (qh)
4509  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4510  else
4511  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4512  }
4513 
4514  // -----------------
4515  // check status
4516  // -----------------
4517 
4518  return (state!=semicOK);
4519 }

◆ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 586 of file misc_ip.cc.

587 {
588  const char *n;
589  do
590  {
591  if (v->Typ()==STRING_CMD)
592  {
593  n=(const char *)v->CopyD(STRING_CMD);
594  }
595  else
596  {
597  if (v->name==NULL)
598  return TRUE;
599  if (v->rtyp==0)
600  {
601  n=v->name;
602  v->name=NULL;
603  }
604  else
605  {
606  n=omStrDup(v->name);
607  }
608  }
609 
610  int i;
611 
612  if(strcmp(n,"get")==0)
613  {
614  intvec *w=new intvec(2);
615  (*w)[0]=si_opt_1;
616  (*w)[1]=si_opt_2;
617  res->rtyp=INTVEC_CMD;
618  res->data=(void *)w;
619  goto okay;
620  }
621  if(strcmp(n,"set")==0)
622  {
623  if((v->next!=NULL)
624  &&(v->next->Typ()==INTVEC_CMD))
625  {
626  v=v->next;
627  intvec *w=(intvec*)v->Data();
628  si_opt_1=(*w)[0];
629  si_opt_2=(*w)[1];
630 #if 0
634  ) {
636  }
637 #endif
638  goto okay;
639  }
640  }
641  if(strcmp(n,"none")==0)
642  {
643  si_opt_1=0;
644  si_opt_2=0;
645  goto okay;
646  }
647  for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
648  {
649  if (strcmp(n,optionStruct[i].name)==0)
650  {
651  if (optionStruct[i].setval & validOpts)
652  {
654  // optOldStd disables redthrough
655  if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
657  }
658  else
659  WarnS("cannot set option");
660 #if 0
664  ) {
666  }
667 #endif
668  goto okay;
669  }
670  else if ((strncmp(n,"no",2)==0)
671  && (strcmp(n+2,optionStruct[i].name)==0))
672  {
673  if (optionStruct[i].setval & validOpts)
674  {
676  }
677  else
678  WarnS("cannot clear option");
679  goto okay;
680  }
681  }
682  for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
683  {
684  if (strcmp(n,verboseStruct[i].name)==0)
685  {
687  #ifdef YYDEBUG
688  #if YYDEBUG
689  /*debugging the bison grammar --> grammar.cc*/
690  extern int yydebug;
691  if (BVERBOSE(V_YACC)) yydebug=1;
692  else yydebug=0;
693  #endif
694  #endif
695  goto okay;
696  }
697  else if ((strncmp(n,"no",2)==0)
698  && (strcmp(n+2,verboseStruct[i].name)==0))
699  {
701  #ifdef YYDEBUG
702  #if YYDEBUG
703  /*debugging the bison grammar --> grammar.cc*/
704  extern int yydebug;
705  if (BVERBOSE(V_YACC)) yydebug=1;
706  else yydebug=0;
707  #endif
708  #endif
709  goto okay;
710  }
711  }
712  Werror("unknown option `%s`",n);
713  okay:
714  if (currRing != NULL)
715  currRing->options = si_opt_1 & TEST_RINGDEP_OPTS;
716  omFree((ADDRESS)n);
717  v=v->next;
718  } while (v!=NULL);
719 
720  // set global variable to show memory usage
721  extern int om_sing_opt_show_mem;
722  if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1;
723  else om_sing_opt_show_mem = 0;
724 
725  return FALSE;
726 }

◆ showOption()

char* showOption ( )

Definition at line 728 of file misc_ip.cc.

729 {
730  int i;
731  BITSET tmp;
732 
733  StringSetS("//options:");
734  if ((si_opt_1!=0)||(si_opt_2!=0))
735  {
736  tmp=si_opt_1;
737  if(tmp)
738  {
739  for (i=0; optionStruct[i].setval!=0; i++)
740  {
741  if (optionStruct[i].setval & tmp)
742  {
744  tmp &=optionStruct[i].resetval;
745  }
746  }
747  for (i=0; i<32; i++)
748  {
749  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
750  }
751  }
752  tmp=si_opt_2;
753  if (tmp)
754  {
755  for (i=0; verboseStruct[i].setval!=0; i++)
756  {
757  if (verboseStruct[i].setval & tmp)
758  {
760  tmp &=verboseStruct[i].resetval;
761  }
762  }
763  for (i=1; i<32; i++)
764  {
765  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
766  }
767  }
768  return StringEndS();
769  }
770  StringAppendS(" none");
771  return StringEndS();
772 }

◆ singular_example()

void singular_example ( char *  str)

Definition at line 449 of file misc_ip.cc.

450 {
451  assume(str!=NULL);
452  char *s=str;
453  while (*s==' ') s++;
454  char *ss=s;
455  while (*ss!='\0') ss++;
456  while (*ss<=' ')
457  {
458  *ss='\0';
459  ss--;
460  }
461  idhdl h=IDROOT->get(s,myynest);
462  if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
463  {
464  char *lib=iiGetLibName(IDPROC(h));
465  if((lib!=NULL)&&(*lib!='\0'))
466  {
467  Print("// proc %s from lib %s\n",s,lib);
469  if (s!=NULL)
470  {
471  if (strlen(s)>5)
472  {
473  iiEStart(s,IDPROC(h));
474  omFree((ADDRESS)s);
475  return;
476  }
477  else omFree((ADDRESS)s);
478  }
479  }
480  }
481  else
482  {
483  char sing_file[MAXPATHLEN];
484  FILE *fd=NULL;
485  char *res_m=feResource('m', 0);
486  if (res_m!=NULL)
487  {
488  sprintf(sing_file, "%s/%s.sing", res_m, s);
489  fd = feFopen(sing_file, "r");
490  }
491  if (fd != NULL)
492  {
493 
494  int old_echo = si_echo;
495  int length, got;
496  char* s;
497 
498  fseek(fd, 0, SEEK_END);
499  length = ftell(fd);
500  fseek(fd, 0, SEEK_SET);
501  s = (char*) omAlloc((length+20)*sizeof(char));
502  got = fread(s, sizeof(char), length, fd);
503  fclose(fd);
504  if (got != length)
505  {
506  Werror("Error while reading file %s", sing_file);
507  }
508  else
509  {
510  s[length] = '\0';
511  strcat(s, "\n;return();\n\n");
512  si_echo = 2;
513  iiEStart(s, NULL);
514  si_echo = old_echo;
515  }
516  omFree(s);
517  }
518  else
519  {
520  Werror("no example for %s", str);
521  }
522  }
523 }

◆ singular_system()

leftv singular_system ( sleftv  h)

◆ spaddProc()

BOOLEAN spaddProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4397 of file ipshell.cc.

4398 {
4399  semicState state;
4400 
4401  // -----------------
4402  // check arguments
4403  // -----------------
4404 
4405  lists l1 = (lists)first->Data( );
4406  lists l2 = (lists)second->Data( );
4407 
4408  if( (state=list_is_spectrum( l1 )) != semicOK )
4409  {
4410  WerrorS( "first argument is not a spectrum:" );
4411  list_error( state );
4412  }
4413  else if( (state=list_is_spectrum( l2 )) != semicOK )
4414  {
4415  WerrorS( "second argument is not a spectrum:" );
4416  list_error( state );
4417  }
4418  else
4419  {
4420  spectrum s1= spectrumFromList ( l1 );
4421  spectrum s2= spectrumFromList ( l2 );
4422  spectrum sum( s1+s2 );
4423 
4424  result->rtyp = LIST_CMD;
4425  result->data = (char*)(getList(sum));
4426  }
4427 
4428  return (state!=semicOK);
4429 }

◆ spectrumfProc()

BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 4153 of file ipshell.cc.

4154 {
4155  spectrumState state = spectrumOK;
4156 
4157  // -------------------
4158  // check consistency
4159  // -------------------
4160 
4161  // check for a local polynomial ring
4162 
4163  if( currRing->OrdSgn != -1 )
4164  // ?? HS: the test above is also true for k[x][[y]], k[[x]][y]
4165  // or should we use:
4166  //if( !ringIsLocal( ) )
4167  {
4168  WerrorS( "only works for local orderings" );
4169  state = spectrumWrongRing;
4170  }
4171  else if( currRing->qideal != NULL )
4172  {
4173  WerrorS( "does not work in quotient rings" );
4174  state = spectrumWrongRing;
4175  }
4176  else
4177  {
4178  lists L = (lists)NULL;
4179  int flag = 2; // symmetric optimization
4180 
4181  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4182 
4183  if( state==spectrumOK )
4184  {
4185  result->rtyp = LIST_CMD;
4186  result->data = (char*)L;
4187  }
4188  else
4189  {
4190  spectrumPrintError(state);
4191  }
4192  }
4193 
4194  return (state!=spectrumOK);
4195 }

◆ spectrumProc()

BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 4102 of file ipshell.cc.

4103 {
4104  spectrumState state = spectrumOK;
4105 
4106  // -------------------
4107  // check consistency
4108  // -------------------
4109 
4110  // check for a local ring
4111 
4112  if( !ringIsLocal(currRing ) )
4113  {
4114  WerrorS( "only works for local orderings" );
4115  state = spectrumWrongRing;
4116  }
4117 
4118  // no quotient rings are allowed
4119 
4120  else if( currRing->qideal != NULL )
4121  {
4122  WerrorS( "does not work in quotient rings" );
4123  state = spectrumWrongRing;
4124  }
4125  else
4126  {
4127  lists L = (lists)NULL;
4128  int flag = 1; // weight corner optimization is safe
4129 
4130  state = spectrumCompute( (poly)first->Data( ),&L,flag );
4131 
4132  if( state==spectrumOK )
4133  {
4134  result->rtyp = LIST_CMD;
4135  result->data = (char*)L;
4136  }
4137  else
4138  {
4139  spectrumPrintError(state);
4140  }
4141  }
4142 
4143  return (state!=spectrumOK);
4144 }

◆ spmulProc()

BOOLEAN spmulProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4439 of file ipshell.cc.

4440 {
4441  semicState state;
4442 
4443  // -----------------
4444  // check arguments
4445  // -----------------
4446 
4447  lists l = (lists)first->Data( );
4448  int k = (int)(long)second->Data( );
4449 
4450  if( (state=list_is_spectrum( l ))!=semicOK )
4451  {
4452  WerrorS( "first argument is not a spectrum" );
4453  list_error( state );
4454  }
4455  else if( k < 0 )
4456  {
4457  WerrorS( "second argument should be positive" );
4458  state = semicMulNegative;
4459  }
4460  else
4461  {
4463  spectrum product( k*s );
4464 
4465  result->rtyp = LIST_CMD;
4466  result->data = (char*)getList(product);
4467  }
4468 
4469  return (state!=semicOK);
4470 }

◆ syBetti1()

BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 3141 of file ipshell.cc.

3142 {
3143  sleftv tmp;
3144  memset(&tmp,0,sizeof(tmp));
3145  tmp.rtyp=INT_CMD;
3146  tmp.data=(void *)1;
3147  return syBetti2(res,u,&tmp);
3148 }

◆ syBetti2()

BOOLEAN syBetti2 ( leftv  res,
leftv  u,
leftv  w 
)

Definition at line 3118 of file ipshell.cc.

3119 {
3120  syStrategy syzstr=(syStrategy)u->Data();
3121 
3122  BOOLEAN minim=(int)(long)w->Data();
3123  int row_shift=0;
3124  int add_row_shift=0;
3125  intvec *weights=NULL;
3126  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
3127  if (ww!=NULL)
3128  {
3129  weights=ivCopy(ww);
3130  add_row_shift = ww->min_in();
3131  (*weights) -= add_row_shift;
3132  }
3133 
3134  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
3135  //row_shift += add_row_shift;
3136  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
3137  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
3138 
3139  return FALSE;
3140 }

◆ syConvList()

syStrategy syConvList ( lists  li)

Definition at line 3225 of file ipshell.cc.

3226 {
3227  int typ0;
3229 
3230  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
3231  if (fr != NULL)
3232  {
3233 
3234  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3235  for (int i=result->length-1;i>=0;i--)
3236  {
3237  if (fr[i]!=NULL)
3238  result->fullres[i] = idCopy(fr[i]);
3239  }
3240  result->list_length=result->length;
3241  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3242  }
3243  else
3244  {
3245  omFreeSize(result, sizeof(ssyStrategy));
3246  result = NULL;
3247  }
3248  return result;
3249 }

◆ syConvRes()

lists syConvRes ( syStrategy  syzstr,
BOOLEAN  toDel = FALSE,
int  add_row_shift = 0 
)

Definition at line 3153 of file ipshell.cc.

3154 {
3155  resolvente fullres = syzstr->fullres;
3156  resolvente minres = syzstr->minres;
3157 
3158  const int length = syzstr->length;
3159 
3160  if ((fullres==NULL) && (minres==NULL))
3161  {
3162  if (syzstr->hilb_coeffs==NULL)
3163  { // La Scala
3164  fullres = syReorder(syzstr->res, length, syzstr);
3165  }
3166  else
3167  { // HRES
3168  minres = syReorder(syzstr->orderedRes, length, syzstr);
3169  syKillEmptyEntres(minres, length);
3170  }
3171  }
3172 
3173  resolvente tr;
3174  int typ0=IDEAL_CMD;
3175 
3176  if (minres!=NULL)
3177  tr = minres;
3178  else
3179  tr = fullres;
3180 
3181  resolvente trueres=NULL;
3182  intvec ** w=NULL;
3183 
3184  if (length>0)
3185  {
3186  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
3187  for (int i=length-1;i>=0;i--)
3188  {
3189  if (tr[i]!=NULL)
3190  {
3191  trueres[i] = idCopy(tr[i]);
3192  }
3193  }
3194  if ( id_RankFreeModule(trueres[0], currRing) > 0)
3195  typ0 = MODUL_CMD;
3196  if (syzstr->weights!=NULL)
3197  {
3198  w = (intvec**)omAlloc0(length*sizeof(intvec*));
3199  for (int i=length-1;i>=0;i--)
3200  {
3201  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
3202  }
3203  }
3204  }
3205 
3206  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
3207  w, add_row_shift);
3208 
3209  if (toDel)
3210  syKillComputation(syzstr);
3211  else
3212  {
3213  if( fullres != NULL && syzstr->fullres == NULL )
3214  syzstr->fullres = fullres;
3215 
3216  if( minres != NULL && syzstr->minres == NULL )
3217  syzstr->minres = minres;
3218  }
3219  return li;
3220 }

◆ syForceMin()

syStrategy syForceMin ( lists  li)

Definition at line 3254 of file ipshell.cc.

3255 {
3256  int typ0;
3258 
3259  resolvente fr = liFindRes(li,&(result->length),&typ0);
3260  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
3261  for (int i=result->length-1;i>=0;i--)
3262  {
3263  if (fr[i]!=NULL)
3264  result->minres[i] = idCopy(fr[i]);
3265  }
3266  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
3267  return result;
3268 }

◆ test_cmd()

void test_cmd ( int  i)

Definition at line 511 of file ipshell.cc.

512 {
513  int ii;
514 
515  if (i<0)
516  {
517  ii= -i;
518  if (ii < 32)
519  {
520  si_opt_1 &= ~Sy_bit(ii);
521  }
522  else if (ii < 64)
523  {
524  si_opt_2 &= ~Sy_bit(ii-32);
525  }
526  else
527  WerrorS("out of bounds\n");
528  }
529  else if (i<32)
530  {
531  ii=i;
532  if (Sy_bit(ii) & kOptions)
533  {
534  WarnS("Gerhard, use the option command");
535  si_opt_1 |= Sy_bit(ii);
536  }
537  else if (Sy_bit(ii) & validOpts)
538  si_opt_1 |= Sy_bit(ii);
539  }
540  else if (i<64)
541  {
542  ii=i-32;
543  si_opt_2 |= Sy_bit(ii);
544  }
545  else
546  WerrorS("out of bounds\n");
547 }

◆ Tok2Cmdname()

const char* Tok2Cmdname ( int  i)

Definition at line 140 of file gentable.cc.

141 {
142  if (tok < 0)
143  {
144  return cmds[0].name;
145  }
146  if (tok==COMMAND) return "command";
147  if (tok==ANY_TYPE) return "any_type";
148  if (tok==NONE) return "nothing";
149  //if (tok==IFBREAK) return "if_break";
150  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
151  //if (tok==ORDER_VECTOR) return "ordering";
152  //if (tok==REF_VAR) return "ref";
153  //if (tok==OBJECT) return "object";
154  //if (tok==PRINT_EXPR) return "print_expr";
155  if (tok==IDHDL) return "identifier";
156  // we do not blackbox objects during table generation:
157  //if (tok>MAX_TOK) return getBlackboxName(tok);
158  int i = 0;
159  while (cmds[i].tokval!=0)
160  {
161  if ((cmds[i].tokval == tok)&&(cmds[i].alias==0))
162  {
163  return cmds[i].name;
164  }
165  i++;
166  }
167  i=0;// try again for old/alias names:
168  while (cmds[i].tokval!=0)
169  {
170  if (cmds[i].tokval == tok)
171  {
172  return cmds[i].name;
173  }
174  i++;
175  }
176  #if 0
177  char *s=(char*)malloc(10);
178  sprintf(s,"(%d)",tok);
179  return s;
180  #else
181  return cmds[0].name;
182  #endif
183 }

◆ type_cmd()

void type_cmd ( leftv  v)

Definition at line 251 of file ipshell.cc.

252 {
253  BOOLEAN oldShortOut = FALSE;
254 
255  if (currRing != NULL)
256  {
257  oldShortOut = currRing->ShortOut;
258  currRing->ShortOut = 1;
259  }
260  int t=v->Typ();
261  Print("// %s %s ",v->Name(),Tok2Cmdname(t));
262  switch (t)
263  {
264  case MAP_CMD:Print(" from %s\n",((map)(v->Data()))->preimage); break;
265  case INTMAT_CMD: Print(" %d x %d\n",((intvec*)(v->Data()))->rows(),
266  ((intvec*)(v->Data()))->cols()); break;
267  case MATRIX_CMD:Print(" %u x %u\n" ,
268  MATROWS((matrix)(v->Data())),
269  MATCOLS((matrix)(v->Data())));break;
270  case MODUL_CMD: Print(", rk %d\n", (int)(((ideal)(v->Data()))->rank));break;
271  case LIST_CMD: Print(", size %d\n",((lists)(v->Data()))->nr+1); break;
272 
273  case PROC_CMD:
274  case RING_CMD:
275  case IDEAL_CMD: PrintLn(); break;
276 
277  //case INT_CMD:
278  //case STRING_CMD:
279  //case INTVEC_CMD:
280  //case POLY_CMD:
281  //case VECTOR_CMD:
282  //case PACKAGE_CMD:
283 
284  default:
285  break;
286  }
287  v->Print();
288  if (currRing != NULL)
289  currRing->ShortOut = oldShortOut;
290 }

◆ versionString()

char* versionString ( )

Definition at line 789 of file misc_ip.cc.

790 {
791  StringSetS("");
792  StringAppend("Singular for %s version %s (%d, %d bit) %s #%s",
793  S_UNAME, VERSION, // SINGULAR_VERSION,
794  SINGULAR_VERSION, sizeof(void*)*8,
795 #ifdef MAKE_DISTRIBUTION
796  VERSION_DATE, GIT_VERSION);
797 #else
798  singular_date, GIT_VERSION);
799 #endif
800  StringAppendS("\nwith\n\t");
801 
802 #if defined(mpir_version)
803  StringAppend("MPIR(%s)~GMP(%s),", mpir_version, gmp_version);
804 #elif defined(gmp_version)
805  // #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
806  // StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
807  StringAppend("GMP(%s),", gmp_version);
808 #endif
809 #ifdef HAVE_NTL
810  StringAppend("NTL(%s),",NTL_VERSION);
811 #endif
812 
813 #ifdef HAVE_FLINT
814  StringAppend("FLINT(%s),",flint_version);
815 #endif
816  StringAppendS("factory(" FACTORYVERSION "),\n\t");
817 #ifdef XMEMORY_H
818  StringAppendS("xalloc,");
819 #else
820  StringAppendS("omalloc,");
821 #endif
822 #if defined(HAVE_DYN_RL)
824  StringAppendS("no input,");
825  else if (fe_fgets_stdin==fe_fgets)
826  StringAppendS("fgets,");
828  StringAppend("dynamic readline%d),",RL_VERSION_MAJOR);
829  #ifdef HAVE_FEREAD
831  StringAppendS("emulated readline,");
832  #endif
833  else
834  StringAppendS("unknown fgets method,");
835 #else
836  #if defined(HAVE_READLINE) && !defined(FEREAD)
837  StringAppend("static readline(%d),",RL_VERSION_MAJOR);
838  #else
839  #ifdef HAVE_FEREAD
840  StringAppendS("emulated readline,");
841  #else
842  StringAppendS("fgets,");
843  #endif
844  #endif
845 #endif
846 #ifdef HAVE_PLURAL
847  StringAppendS("Plural,");
848 #endif
849 #ifdef HAVE_DBM
850  StringAppendS("DBM,\n\t");
851 #else
852  StringAppendS("\n\t");
853 #endif
854 #ifdef HAVE_DYNAMIC_LOADING
855  StringAppendS("dynamic modules,");
856 #endif
857  if (p_procs_dynamic) StringAppendS("dynamic p_Procs,");
858 #if YYDEBUG
859  StringAppendS("YYDEBUG=1,");
860 #endif
861 #ifdef MDEBUG
862  StringAppend("MDEBUG=%d,",MDEBUG);
863 #endif
864 #ifdef OM_CHECK
865  StringAppend("OM_CHECK=%d,",OM_CHECK);
866 #endif
867 #ifdef OM_TRACK
868  StringAppend("OM_TRACK=%d,",OM_TRACK);
869 #endif
870 #ifdef OM_NDEBUG
871  StringAppendS("OM_NDEBUG,");
872 #endif
873 #ifdef SING_NDEBUG
874  StringAppendS("SING_NDEBUG,");
875 #endif
876 #ifdef PDEBUG
877  StringAppendS("PDEBUG,");
878 #endif
879 #ifdef KDEBUG
880  StringAppendS("KDEBUG,");
881 #endif
882  StringAppendS("\n\t");
883 #ifdef __OPTIMIZE__
884  StringAppendS("CC:OPTIMIZE,");
885 #endif
886 #ifdef __OPTIMIZE_SIZE__
887  StringAppendS("CC:OPTIMIZE_SIZE,");
888 #endif
889 #ifdef __NO_INLINE__
890  StringAppendS("CC:NO_INLINE,");
891 #endif
892 #ifdef HAVE_GENERIC_ADD
893  StringAppendS("GenericAdd,");
894 #else
895  StringAppendS("AvoidBranching,");
896 #endif
897 #ifdef HAVE_GENERIC_MULT
898  StringAppendS("GenericMult,");
899 #else
900  StringAppendS("TableMult,");
901 #endif
902 #ifdef HAVE_INVTABLE
903  StringAppendS("invTable,");
904 #else
905  StringAppendS("no invTable,");
906 #endif
907  StringAppendS("\n\t");
908 #ifdef HAVE_EIGENVAL
909  StringAppendS("eigenvalues,");
910 #endif
911 #ifdef HAVE_GMS
912  StringAppendS("Gauss-Manin system,");
913 #endif
914 #ifdef HAVE_RATGRING
915  StringAppendS("ratGB,");
916 #endif
917  StringAppend("random=%d\n",siRandomStart);
918 
919 #define SI_SHOW_BUILTIN_MODULE(name) StringAppend(" %s", #name);
920  StringAppendS("built-in modules: {");
922  StringAppendS("}\n");
923 #undef SI_SHOW_BUILTIN_MODULE
924 
925  StringAppend("AC_CONFIGURE_ARGS = %s,\n"
926  "CC = %s,FLAGS : %s,\n"
927  "CXX = %s,FLAGS : %s,\n"
928  "DEFS : %s,CPPFLAGS : %s,\n"
929  "LDFLAGS : %s,LIBS : %s "
930 #ifdef __GNUC__
931  "(ver: " __VERSION__ ")"
932 #endif
933  "\n",AC_CONFIGURE_ARGS, CC,CFLAGS " " PTHREAD_CFLAGS,
934  CXX,CXXFLAGS " " PTHREAD_CFLAGS, DEFS,CPPFLAGS, LDFLAGS,
935  LIBS " " PTHREAD_LIBS);
938  StringAppendS("\n");
939  return StringEndS();
940 }

Variable Documentation

◆ currid

const char* currid

Definition at line 171 of file grammar.cc.

◆ dArith1

const struct sValCmd1 dArith1[]

Definition at line 1 of file table.h.

◆ dArith2

const struct sValCmd2 dArith2[]

Definition at line 1 of file table.h.

◆ dArith3

const struct sValCmd3 dArith3[]

Definition at line 1 of file table.h.

◆ dArithM

const struct sValCmdM dArithM[]

Definition at line 1 of file table.h.

◆ iiCurrArgs

leftv iiCurrArgs

Definition at line 78 of file ipshell.cc.

◆ iiCurrProc

idhdl iiCurrProc

Definition at line 79 of file ipshell.cc.

◆ iiLocalRing

ring* iiLocalRing

Definition at line 454 of file iplib.cc.

◆ iiOp

int iiOp

Definition at line 218 of file iparith.cc.

◆ iiRETURNEXPR

sleftv iiRETURNEXPR

Definition at line 455 of file iplib.cc.

◆ iiRETURNEXPR_len

int iiRETURNEXPR_len

Definition at line 456 of file iplib.cc.

◆ lastreserved

const char* lastreserved

Definition at line 80 of file ipshell.cc.

◆ myynest

int myynest

Definition at line 41 of file febase.cc.

◆ printlevel

int printlevel

Definition at line 36 of file febase.cc.

◆ si_echo

int si_echo

Definition at line 35 of file febase.cc.

◆ yyInRingConstruction

BOOLEAN yyInRingConstruction

Definition at line 172 of file grammar.cc.

getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
test
CanonicalForm test
Definition: cfModGcd.cc:4037
iiConvert
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, const struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:436
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
SEEK_END
#define SEEK_END
Definition: mod2.h:112
IDINT
#define IDINT(a)
Definition: ipid.h:120
FALSE
#define FALSE
Definition: auxiliary.h:94
fe_fgets_dummy
char * fe_fgets_dummy(const char *, char *, int)
Definition: feread.cc:451
ivTest
#define ivTest(v)
Definition: intvec.h:156
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:60
rDecomposeC
static void rDecomposeC(leftv h, const ring R)
Definition: ipshell.cc:1760
rComposeRing
void rComposeRing(lists L, ring R)
Definition: ipshell.cc:2315
LongComplexInfo::float_len2
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
omCheckAddrSize
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
hIndMult
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:313
n_Zn
@ n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:45
matrix
ip_smatrix * matrix
Definition: matpol.h:31
wFunctionalBuch
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:78
sleftv::Data
void * Data()
Definition: subexpr.cc:1182
p_procs_dynamic
const BOOLEAN p_procs_dynamic
Definition: p_Procs_Dynamic.cc:30
rField_is_Zn
static BOOLEAN rField_is_Zn(const ring r)
Definition: ring.h:503
IDMAP
#define IDMAP(a)
Definition: ipid.h:130
jiAssign_1
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1105
iiGetLibName
static char * iiGetLibName(const procinfov pi)
find the library of an proc
Definition: ipshell.h:66
nCoeff_is_numeric
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
Definition: coeffs.h:854
countedref_shared_load
void countedref_shared_load()
Definition: countedref.cc:724
si_echo
int si_echo
Definition: febase.cc:35
rField_is_long_R
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:533
GFInfo::GFChar
int GFChar
Definition: coeffs.h:94
rootContainer::onepoly
@ onepoly
Definition: mpr_numeric.h:68
jjBETTI2_ID
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:904
iiCheckPack
void iiCheckPack(package &p)
Definition: ipshell.cc:1541
twostd
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:18
fePrintOptValues
void fePrintOptValues()
Definition: feOpt.cc:316
getenv
char * getenv()
feReInitResources
void feReInitResources()
Definition: feResource.cc:207
pIsConstant
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
SEEK_SET
#define SEEK_SET
Definition: mod2.h:116
libstack::cnt
int cnt
Definition: subexpr.h:166
TranMImprovwalk
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:8396
Voice::buffer
char * buffer
Definition: fevoices.h:69
ringorder_Ds
@ ringorder_Ds
Definition: ring.h:86
libstack::to_be_done
BOOLEAN to_be_done
Definition: subexpr.h:165
ip_smatrix
Definition: matpol.h:15
MDEBUG
#define MDEBUG
Definition: mod2.h:181
simplex::m
int m
Definition: mpr_numeric.h:198
TransExtInfo
struct for passing initialization parameters to naInitChar
Definition: transext.h:88
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:107
atKillAll
#define atKillAll(H)
Definition: attrib.h:47
mytolower
char mytolower(char c)
Definition: iplib.cc:1318
syMinimizeResolvente
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:356
nSetChar
static FORCE_INLINE void nSetChar(const coeffs r)
initialisations after each ring change
Definition: coeffs.h:436
FACTORYVERSION
#define FACTORYVERSION
Definition: factoryconf.h:52
IsPrime
int IsPrime(int p)
Definition: prime.cc:61
Mwalk
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing, int reduction, int printout)
Definition: walk.cc:5302
FLAG_TWOSTD
#define FLAG_TWOSTD
Definition: ipid.h:105
uResultant::denseResMat
@ denseResMat
Definition: mpr_base.h:65
j
int j
Definition: facHensel.cc:105
versionString
char * versionString()
Definition: misc_ip.cc:789
f
FILE * f
Definition: checklibs.c:9
spectrumfProc
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:4153
feFopen
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
omFree
#define omFree(addr)
Definition: omAllocDecl.h:261
gmp_output_digits
size_t gmp_output_digits
Definition: mpr_complex.cc:43
resMatrixBase::initState
virtual IStateType initState() const
Definition: mpr_base.h:41
iiCallLibProcBegin
static void iiCallLibProcBegin()
Definition: iplib.cc:570
jiA_INTVEC_L
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition: ipassign.cc:1352
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:102
errorreported
short errorreported
Definition: feFopen.cc:23
k
int k
Definition: cfEzgcd.cc:92
idDelete
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
scComputeHC
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
CRING_CMD
@ CRING_CMD
Definition: tok.h:56
iiEStart
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:699
LongComplexInfo
Definition: coeffs.h:100
mprOk
@ mprOk
Definition: mpr_base.h:98
iiApplyLIST
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6375
iiOp
int iiOp
Definition: iparith.cc:218
LT_SINGULAR
@ LT_SINGULAR
Definition: mod_raw.h:18
TRACE_CALL
#define TRACE_CALL
Definition: reporter.h:43
x
Variable x
Definition: cfModGcd.cc:4023
SI_FOREACH_BUILTIN
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0) }
gmsNF
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
NUMBER_CMD
@ NUMBER_CMD
Definition: grammar.cc:288
MATELEM
#define MATELEM(mat, i, j)
Definition: matpol.h:30
bigintmat
Definition: bigintmat.h:52
lastreserved
const char * lastreserved
Definition: ipshell.cc:80
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition: polys.cc:15
NO_CONVERSION
#define NO_CONVERSION
Definition: iparith.cc:118
COLONCOLON
@ COLONCOLON
Definition: grammar.cc:275
nc_p_Bracket_qq
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2243
result
return result
Definition: facAbsBiFact.cc:76
VERSION
#define VERSION
Definition: mod2.h:18
LANG_TOP
@ LANG_TOP
Definition: subexpr.h:24
V_DEF_RES
#define V_DEF_RES
Definition: options.h:50
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:58
BT_execute
@ BT_execute
Definition: fevoices.h:25
LANG_SINGULAR
@ LANG_SINGULAR
Definition: subexpr.h:24
IDBIMAT
#define IDBIMAT(a)
Definition: ipid.h:124
GFInfo
Creation data needed for finite fields.
Definition: coeffs.h:93
BIGINT_CMD
@ BIGINT_CMD
Definition: tok.h:38
iiDebugMarker
BOOLEAN iiDebugMarker
Definition: ipshell.cc:987
n_long_C
@ n_long_C
complex floating point (GMP) numbers
Definition: coeffs.h:42
iiExprArith1
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8448
iiMake_proc
BOOLEAN iiMake_proc(idhdl pn, package pack, leftv sl)
Definition: iplib.cc:485
polyset
poly * polyset
Definition: polys.h:254
LIST_CMD
@ LIST_CMD
Definition: tok.h:118
syBetti2
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:3118
uResultant::resMatType
resMatType
Definition: mpr_base.h:65
syStrategy
ssyStrategy * syStrategy
Definition: syz.h:35
pGetExp
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
evRowElim
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
Mivdp
intvec * Mivdp(int nR)
Definition: walk.cc:1007
ringorder_ds
@ ringorder_ds
Definition: ring.h:85
OLD_LIBSTYLE
@ OLD_LIBSTYLE
Definition: libparse.h:11
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
proclevel::push
void push(char *)
Definition: ipid.cc:724
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:267
mpz_sgn1
#define mpz_sgn1(A)
Definition: si_gmp.h:13
hRadical
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:417
libstack
Definition: subexpr.h:161
MODUL_CMD
@ MODUL_CMD
Definition: grammar.cc:287
MwalkNextWeight
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
n_ParameterNames
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:800
STRING_CMD
@ STRING_CMD
Definition: tok.h:183
feOptIndex
feOptIndex
Definition: feOptGen.h:15
OPT_OLDSTD
#define OPT_OLDSTD
Definition: options.h:85
LANG_MAX
@ LANG_MAX
Definition: subexpr.h:24
ssyStrategy::fullres
resolvente fullres
Definition: syz.h:57
VALTVARS
@ VALTVARS
Definition: grammar.cc:305
resMatrixBase::getSubDet
virtual number getSubDet()
Definition: mpr_base.h:37
jjBETTI2
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:925
num
CanonicalForm num(const CanonicalForm &f)
Definition: canonicalform.h:330
MPertVectorslp
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1299
rootContainer::solver
bool solver(const int polishmode=PM_NONE)
Definition: mpr_numeric.cc:441
hMu
int hMu
Definition: hdegree.cc:22
map
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
BITSET
#define BITSET
Definition: structs.h:18
M3ivSame
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:914
currid
const char * currid
Definition: grammar.cc:171
feGetOptIndex
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:101
NONE
#define NONE
Definition: tok.h:219
TRACE_SHOW_PROC
#define TRACE_SHOW_PROC
Definition: reporter.h:28
BT_proc
@ BT_proc
Definition: fevoices.h:22
n_Z2m
@ n_Z2m
only used if HAVE_RINGS is defined
Definition: coeffs.h:47
semicMulNegative
@ semicMulNegative
Definition: ipshell.cc:3406
uResultant::interpolateDenseSP
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:2923
iiExprArith3TabIntern
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, const struct sValCmd3 *dA3, int at, int bt, int ct, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8507
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
myychangebuffer
void myychangebuffer()
Definition: scanner.cc:2330
freegb
ideal freegb(ideal I, int uptodeg, int lVblock)
Definition: kstd2.cc:4200
MAX_TOK
@ MAX_TOK
Definition: tok.h:216
syBetti
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:771
loNewtonPolytope
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3192
IDDATA
#define IDDATA(a)
Definition: ipid.h:121
hNrad
int hNrad
Definition: hutil.cc:22
feOptUntyped
@ feOptUntyped
Definition: fegetopt.h:77
yylplex
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
BREAK_LINE_LENGTH
#define BREAK_LINE_LENGTH
Definition: ipshell.cc:988
id_QHomWeight
intvec * id_QHomWeight(ideal id, const ring r)
Definition: simpleideals.cc:1568
ip_smatrix::cols
int & cols()
Definition: matpol.h:26
rKill
void rKill(ring r)
Definition: ipshell.cc:6119
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:855
iiDeclCommand
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1127
libstack::get
char * get()
Definition: subexpr.h:169
rComposeVar
static BOOLEAN rComposeVar(const lists L, ring R)
Definition: ipshell.cc:2449
vandermonde
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:29
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
rDefault
idhdl rDefault(const char *s)
Definition: ipshell.cc:1555
idrec::get
idhdl get(const char *s, int lev)
Definition: ipid.cc:86
procinfo
Definition: subexpr.h:54
Mpwalk
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP, int reduction, int printout)
Definition: walk.cc:5947
optionStruct
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:526
yylineno
int yylineno
Definition: febase.cc:40
sattr
Definition: attrib.h:21
iiAllStart
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:293
MivUnit
intvec * MivUnit(int nV)
Definition: walk.cc:1496
jjA_L_STRING
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1582
jjA_L_INTVEC
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1484
liMakeResolv
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
sign
static int sign(int x)
Definition: ring.cc:3346
spmulProc
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4439
indset
indlist * indset
Definition: hutil.h:28
list1
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
Definition: ipshell.cc:147
feSetOptValue
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:150
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
Voice::filename
char * filename
Definition: fevoices.h:63
ssyStrategy::minres
resolvente minres
Definition: syz.h:58
DEF_CMD
@ DEF_CMD
Definition: tok.h:58
n_GF
@ n_GF
\GF{p^n < 2^16}
Definition: coeffs.h:33
V_LOAD_LIB
#define V_LOAD_LIB
Definition: options.h:47
iiLocalRing
ring * iiLocalRing
Definition: iplib.cc:454
LT_MACH_O
@ LT_MACH_O
Definition: mod_raw.h:18
pNeg
#define pNeg(p)
Definition: polys.h:193
sleftv::attribute
attr attribute
Definition: subexpr.h:89
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:350
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
n_Q
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:31
iiCopyRes
static resolvente iiCopyRes(resolvente r, int l)
Definition: ipshell.cc:860
feStringAppendBrowsers
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:344
list_is_spectrum
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:4222
ssyStrategy::list_length
short list_length
Definition: syz.h:62
BIGINTMAT_CMD
@ BIGINTMAT_CMD
Definition: grammar.cc:278
omAlloc0Bin
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
semicProc3
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4480
n_Znm
@ n_Znm
only used if HAVE_RINGS is defined
Definition: coeffs.h:46
pDelete
#define pDelete(p_ptr)
Definition: polys.h:181
hDimSolve
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
spectrumOK
@ spectrumOK
Definition: ipshell.cc:3521
currPack
package currPack
Definition: ipid.cc:59
rTest
#define rTest(r)
Definition: ring.h:776
nIsMOne
#define nIsMOne(n)
Definition: numbers.h:27
hexist
scfmon hexist
Definition: hutil.cc:19
rField_is_Zp_a
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:520
cmdtok
int cmdtok
Definition: grammar.cc:174
nCoeff_is_GF
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:861
scfmon
scmon * scfmon
Definition: hutil.h:15
syReorder
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
Definition: syz1.cc:1642
Variable::next
Variable next() const
Definition: factory.h:137
fe_fgets_stdin
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:34
sleftv::RingDependend
BOOLEAN RingDependend()
Definition: subexpr.cc:424
kOptions
BITSET kOptions
Definition: kstd1.cc:44
StringEndS
char * StringEndS()
Definition: reporter.cc:151
IDMATRIX
#define IDMATRIX(a)
Definition: ipid.h:129
pcvBasis
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:430
printBlackboxTypes
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:209
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:768
siRandomStart
int siRandomStart
Definition: cntrlc.cc:98
kNFBound
poly kNFBound(ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
Definition: kstd1.cc:2868
loop
#define loop
Definition: structs.h:78
verboseStruct
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:556
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
slists::nr
int nr
Definition: lists.h:43
pSetComp
#define pSetComp(p, v)
Definition: polys.h:38
idhdl
idrec * idhdl
Definition: ring.h:22
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
rSleftvOrdering2Ordering
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
Definition: ipshell.cc:5254
pcvMinDeg
int pcvMinDeg(poly p)
Definition: pcv.cc:135
sip_command_bin
omBin sip_command_bin
Definition: ipid.cc:47
RING_CMD
@ RING_CMD
Definition: grammar.cc:281
procstack
proclevel * procstack
Definition: ipid.cc:54
b
CanonicalForm b
Definition: cfModGcd.cc:4044
BT_example
@ BT_example
Definition: fevoices.h:23
jiA_VECTOR_L
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1378
currRingHdl
idhdl currRingHdl
Definition: ipid.cc:61
slists_bin
omBin slists_bin
Definition: lists.cc:23
sValCmd1::res
short res
Definition: gentable.cc:82
simplex::posvToIV
intvec * posvToIV()
Definition: mpr_numeric.cc:1077
mprIdealCheck
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
evSwap
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
proclevel::pop
void pop()
Definition: ipid.cc:734
fftable
const unsigned short fftable[]
Definition: ffields.cc:31
pOppose
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3368
RingDependend
int RingDependend(int t)
Definition: gentable.cc:28
simplex::m1
int m1
Definition: mpr_numeric.h:200
maApplyFetch
BOOLEAN maApplyFetch(int what, map theMap, leftv res, leftv w, ring preimage_r, int *perm, int *par_perm, int P, nMapFunc nMap)
Definition: maps_ip.cc:46
iiGetBuiltinModInit
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:751
MATRIX_CMD
@ MATRIX_CMD
Definition: grammar.cc:286
iiTwoOps
const char * iiTwoOps(int t)
Definition: gentable.cc:261
IDLIST
#define IDLIST(a)
Definition: ipid.h:132
pTotaldegree
static long pTotaldegree(poly p)
Definition: polys.h:276
spectrumFromList
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:3353
ANY_TYPE
#define ANY_TYPE
Definition: tok.h:30
YYLP_BAD_CHAR
#define YYLP_BAD_CHAR
Definition: libparse.h:93
feStringAppendResources
void feStringAppendResources(int warn)
Definition: reporter.cc:398
n_long_R
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:34
leftv
sleftv * leftv
Definition: structs.h:60
factoryseed
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
iiCleanProcs
static void iiCleanProcs(idhdl &root)
Definition: iplib.cc:870
current_pos
int current_pos(int i=0)
Definition: libparse.cc:3344
ringorder_C
@ ringorder_C
Definition: ring.h:74
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
IDLEV
#define IDLEV(a)
Definition: ipid.h:116
IDLINK
#define IDLINK(a)
Definition: ipid.h:133
HilbertSeries_OrbitData
void HilbertSeries_OrbitData(ideal S, int lV, bool IG_CASE, bool mgrad, bool odp, int trunDegHs)
Definition: hilb.cc:1969
rEqual
BOOLEAN rEqual(ring r1, ring r2, BOOLEAN qr)
returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise,...
Definition: ring.cc:1635
singclap_resultant
poly singclap_resultant(poly f, poly g, poly x, const ring r)
Definition: clapsing.cc:278
sleftv::Fullname
const char * Fullname()
Definition: subexpr.h:125
fe_fgets
char * fe_fgets(const char *pr, char *s, int size)
Definition: feread.cc:310
pi
#define pi
Definition: libparse.cc:1143
rComposeOrder
static BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
Definition: ipshell.cc:2494
packFindHdl
idhdl packFindHdl(package r)
Definition: ipid.cc:752
V_DEBUG_LIB
#define V_DEBUG_LIB
Definition: options.h:48
hNexist
int hNexist
Definition: hutil.cc:22
VMINPOLY
@ VMINPOLY
Definition: grammar.cc:309
TransExtInfo::r
ring r
Definition: transext.h:90
get_denom_list
lists get_denom_list()
Definition: denom_list.cc:8
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
BEGIN_RING
@ BEGIN_RING
Definition: grammar.cc:282
V_SHOW_USE
#define V_SHOW_USE
Definition: options.h:52
check_valid
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9264
MAltwalk2
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4280
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:582
sleftv::name
const char * name
Definition: subexpr.h:87
V_SHOW_MEM
#define V_SHOW_MEM
Definition: options.h:43
IDINTVEC
#define IDINTVEC(a)
Definition: ipid.h:123
LT_NONE
@ LT_NONE
Definition: mod_raw.h:18
sSubexpr_bin
omBin sSubexpr_bin
Definition: subexpr.cc:46
TRUE
#define TRUE
Definition: auxiliary.h:98
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
i
int i
Definition: cfEzgcd.cc:125
Lc
CanonicalForm Lc(const CanonicalForm &f)
Definition: canonicalform.h:300
ivCopy
intvec * ivCopy(const intvec *o)
Definition: intvec.h:133
rHasLocalOrMixedOrdering
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
AlgExtInfo
struct for passing initialization parameters to naInitChar
Definition: algext.h:37
p_PermPoly
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4028
ip_smatrix::rows
int & rows()
Definition: matpol.h:25
res
CanonicalForm res
Definition: facAbsFact.cc:64
nIsOne
#define nIsOne(n)
Definition: numbers.h:26
INT_CMD
@ INT_CMD
Definition: tok.h:96
countedref_reference_load
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
Definition: countedref.cc:700
ssyStrategy::orderedRes
resolvente orderedRes
Definition: syz.h:48
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:782
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
fp
CanonicalForm fp
Definition: cfModGcd.cc:4043
idIsZeroDim
static BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:178
indlist_bin
omBin indlist_bin
Definition: hdegree.cc:23
rField_is_Q_a
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:530
Mprwalk
ideal Mprwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int op_deg, int tp_deg, int nP, int reduction, int printout)
Definition: walk.cc:6388
COMMAND
#define COMMAND
Definition: tok.h:29
jiAssign_list
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1728
ringorder_Dp
@ ringorder_Dp
Definition: ring.h:81
iiLoadLIB
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:915
Sy_bit
#define Sy_bit(x)
Definition: options.h:32
intvec::min_in
int min_in()
Definition: intvec.h:121
M
#define M
Definition: sirandom.c:24
buf
int status int void * buf
Definition: si_signals.h:59
IDFLAG
#define IDFLAG(a)
Definition: ipid.h:115
setGMPFloatDigits
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
Definition: mpr_complex.cc:61
hpure
scmon hpure
Definition: hutil.cc:20
killlocals_rec
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:327
PrintS
void PrintS(const char *s)
Definition: reporter.cc:284
pcvPMulL
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:76
luSolveViaLDUDecomp
bool luSolveViaLDUDecomp(const matrix pMat, const matrix lMat, const matrix dMat, const matrix uMat, const poly l, const poly u, const poly lTimesU, 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 LDU-decomposit...
Definition: linearAlgebra.cc:1461
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
nCoeff_is_algExt
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:932
proclevel
Definition: ipid.h:55
VPRINTLEVEL
@ VPRINTLEVEL
Definition: tok.h:213
killlocals
void killlocals(int v)
Definition: ipshell.cc:383
Mivperttarget
intvec * Mivperttarget(ideal G, int ndeg)
pTest
#define pTest(p)
Definition: polys.h:409
killhdl2
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:417
hwork
scfmon hwork
Definition: hutil.cc:19
hvar
varset hvar
Definition: hutil.cc:21
SI_SHOW_BUILTIN_MODULE
#define SI_SHOW_BUILTIN_MODULE(name)
soptionStruct::resetval
unsigned resetval
Definition: ipid.h:149
lduDecomp
void lduDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &dMat, matrix &uMat, poly &l, poly &u, poly &lTimesU)
LU-decomposition of a given (m x n)-matrix with performing only those divisions that yield zero remai...
Definition: linearAlgebra.cc:1343
rComposeC
void rComposeC(lists L, ring R)
Definition: ipshell.cc:2244
iiAssign_sys
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1278
sNoName_fe
const char sNoName_fe[]
Definition: fevoices.cc:56
PROC_CMD
@ PROC_CMD
Definition: grammar.cc:280
simplex::m2
int m2
Definition: mpr_numeric.h:200
MivSame
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:893
hMu2
int hMu2
Definition: hdegree.cc:22
iiApplyIDEAL
BOOLEAN iiApplyIDEAL(leftv, leftv, int, leftv)
Definition: ipshell.cc:6370
procinfo_bin
omBin procinfo_bin
Definition: subexpr.cc:48
simplex::icase
int icase
Definition: mpr_numeric.h:201
rootContainer::getRoot
gmp_complex * getRoot(const int i)
Definition: mpr_numeric.h:88
malloc
void * malloc(size_t size)
Definition: omalloc.c:92
maMapIdeal
ideal maMapIdeal(const ideal map_id, const ring preimage_r, const ideal image_id, const ring image_r, const nMapFunc nMap)
polynomial map for ideals/module/matrix map_id: the ideal to map map_r: the base ring for map_id imag...
Definition: gen_maps.cc:88
nPrint
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:47
dArith3
const struct sValCmd3 dArith3[]
Definition: table.h:763
T
static jList * T
Definition: janet.cc:31
iiRETURNEXPR_len
int iiRETURNEXPR_len
Definition: iplib.cc:456
currentVoice
Voice * currentVoice
Definition: fevoices.cc:48
Mfwalk
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget, int reduction, int printout)
Definition: walk.cc:8031
iiCurrProc
idhdl iiCurrProc
Definition: ipshell.cc:79
TRACE_SHOW_LINENO
#define TRACE_SHOW_LINENO
Definition: reporter.h:30
iiGetLibProcBuffer
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:192
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
iiConvName
char * iiConvName(const char *libname)
Definition: iplib.cc:1331
denominator_list_s
Definition: kutil.h:61
IDROOT
#define IDROOT
Definition: ipid.h:18
rOpposite
ring rOpposite(ring src)
Definition: ring.cc:5194
load_modules
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1091
ringorder_M
@ ringorder_M
Definition: ring.h:75
sleftv::Init
void Init()
Definition: subexpr.h:107
char_ptr
char * char_ptr
Definition: structs.h:56
resolvente
ideal * resolvente
Definition: ideals.h:18
nCoeff_is_Ring
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition: coeffs.h:752
hrad
scfmon hrad
Definition: hutil.cc:19
load_builtin
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1197
IDEAL_CMD
@ IDEAL_CMD
Definition: grammar.cc:284
RightColonOperation
ideal RightColonOperation(ideal S, poly w, int lV)
Definition: hilb.cc:2309
pcvCV2P
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:297
h
static Poly * h
Definition: janet.cc:972
lRingDependend
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
semicProc
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4520
GFInfo::GFDegree
int GFDegree
Definition: coeffs.h:95
sm_Flatten
ideal sm_Flatten(ideal a, const ring R)
Definition: matpol.cc:1929
spectrumWrongRing
@ spectrumWrongRing
Definition: ipshell.cc:3527
ip_smatrix::m
poly * m
Definition: matpol.h:20
hKill
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
library_stack
libstackv library_stack
Definition: iplib.cc:65
coeffs
pOne
#define pOne()
Definition: polys.h:309
MivMatrixOrderdp
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1417
atSet
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:152
EQUAL_EQUAL
@ EQUAL_EQUAL
Definition: grammar.cc:268
singclap_irrCharSeries
matrix singclap_irrCharSeries(ideal I, const ring r)
Definition: clapsing.cc:1449
SModulFunc_t
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:80
TRACE_SHOW_RINGS
#define TRACE_SHOW_RINGS
Definition: reporter.h:35
sleftv::Next
leftv Next()
Definition: subexpr.h:136
IDATTR
#define IDATTR(a)
Definition: ipid.h:118
LE
@ LE
Definition: grammar.cc:270
IDPROC
#define IDPROC(a)
Definition: ipid.h:135
intvec
Definition: intvec.h:21
blackboxIsCmd
int blackboxIsCmd(const char *n, int &tok)
used by scanner: returns ROOT_DECL for known types (and the type number in tok)
Definition: blackbox.cc:192
n_Z
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
jjLOAD
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5218
sleftv::data
void * data
Definition: subexpr.h:88
pIter
#define pIter(p)
Definition: monomials.h:38
list_cmd
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
Definition: ipshell.cc:422
SArithBase::nLastIdentifier
unsigned nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:189
rRenameVars
static void rRenameVars(ring R)
Definition: ipshell.cc:2408
soptionStruct::setval
unsigned setval
Definition: ipid.h:148
singular_date
const char * singular_date
Definition: misc_ip.cc:786
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
PLUSPLUS
@ PLUSPLUS
Definition: grammar.cc:274
ssyStrategy::length
int length
Definition: syz.h:60
yylplineno
int yylplineno
Definition: libparse.cc:1102
spaddProc
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4397
LANG_C
@ LANG_C
Definition: subexpr.h:24
lib_types
lib_types
Definition: mod_raw.h:16
jiA_STRING_L
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1692
rPar
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:589
mytoupper
char mytoupper(char c)
Definition: iplib.cc:1312
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
GFInfo::GFPar_name
const char * GFPar_name
Definition: coeffs.h:96
hDelete
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
killhdl
void killhdl(idhdl h, package proot)
Definition: ipid.cc:386
iiNoKeepRing
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:82
ipMoveId
void ipMoveId(idhdl tomove)
Definition: ipid.cc:623
END_RING
@ END_RING
Definition: grammar.cc:310
uResultant::accessResMat
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
LongComplexInfo::float_len
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
SINGULAR_VERSION
#define SINGULAR_VERSION
Definition: mod2.h:88
syBettiOfComputation
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
Definition: syz1.cc:1756
MAX_SHORT
const short MAX_SHORT
Definition: ipshell.cc:5562
rootArranger
Definition: mpr_numeric.h:150
VECTOR_CMD
@ VECTOR_CMD
Definition: grammar.cc:292
myynest
int myynest
Definition: febase.cc:41
rField_is_R
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:509
wFunctional
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:26
pp
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
ringorder_am
@ ringorder_am
Definition: ring.h:89
IDTYP
#define IDTYP(a)
Definition: ipid.h:114
ipSwapId
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:598
slists::m
sleftv * m
Definition: lists.h:45
MivMatrixOrder
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:963
pMaxComp
#define pMaxComp(p)
Definition: polys.h:293
WerrorS_dummy
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5290
type_of_LIB
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:22
hCo
int hCo
Definition: hdegree.cc:22
rBlocks
static int rBlocks(ring r)
Definition: ring.h:558
iiTestConvert
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:301
rCompose
ring rCompose(const lists L, const BOOLEAN check_comp, const long bitmask, const int isLetterplace)
Definition: ipshell.cc:2760
VoiceBackTrack
void VoiceBackTrack()
Definition: fevoices.cc:68
my_yylinebuf
char my_yylinebuf[80]
Definition: febase.cc:43
LANG_NONE
@ LANG_NONE
Definition: subexpr.h:24
sleftv::CleanUp
void CleanUp(ring r=currRing)
Definition: subexpr.cc:354
rSimpleFindHdl
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Definition: ipshell.cc:6208
wCall
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:114
idGetNumberOfChoise
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
Definition: simpleideals.cc:881
hIndAllMult
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:496
scmon
int * scmon
Definition: hutil.h:14
omFindExec
char * omFindExec(const char *name, char *exec)
Definition: omFindExec.c:252
MivWeightOrderdp
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1456
siq
BOOLEAN siq
Definition: subexpr.cc:54
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
rootContainer::fillContainer
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
Definition: mpr_numeric.cc:304
ringorder_lp
@ ringorder_lp
Definition: ring.h:78
complexToStr
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:705
OPT_INTSTRATEGY
#define OPT_INTSTRATEGY
Definition: options.h:91
MwalkInitialForm
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:761
LT_ELF
@ LT_ELF
Definition: mod_raw.h:18
DENOMINATOR_LIST
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:87
libstack::pop
libstackv pop(const char *p)
Definition: iplib.cc:1422
n_transExt
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
IDRING
#define IDRING(a)
Definition: ipid.h:122
Tok2Cmdname
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8984
libnamebuf
char libnamebuf[1024]
Definition: libparse.cc:1096
ringorder_dp
@ ringorder_dp
Definition: ring.h:79
iiDefaultParameter
BOOLEAN iiDefaultParameter(leftv p)
Definition: ipshell.cc:1171
MPertVectors
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1088
simplex
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:195
exprlist_length
int exprlist_length(leftv v)
Definition: ipshell.cc:549
iiInternalExport
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1321
hNpure
int hNpure
Definition: hutil.cc:22
n_R
@ n_R
single prescision (6,6) real numbers
Definition: coeffs.h:32
pDecrExp
#define pDecrExp(p, i)
Definition: polys.h:44
slists
Definition: lists.h:23
feOptSpec
struct fe_option feOptSpec[]
uResultant
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:63
expected_parms
BOOLEAN expected_parms
Definition: grammar.cc:173
hPure
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
SArithBase::sCmds
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:182
liFindRes
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:315
UNKNOWN
#define UNKNOWN
Definition: tok.h:220
idrec::next
idhdl next
Definition: idrec.h:38
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:437
fe_fgets_stdin_drl
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition: feread.cc:270
INTVEC_CMD
@ INTVEC_CMD
Definition: tok.h:101
determineMType
uResultant::resMatType determineMType(int imtype)
MAltwalk1
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:9671
MivMatrixOrderlp
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1401
iiCallLibProcEnd
static void iiCallLibProcEnd(idhdl save_ringhdl, ring save_ring)
Definition: iplib.cc:588
INTMAT_CMD
@ INTMAT_CMD
Definition: grammar.cc:279
iiReportTypes
static void iiReportTypes(int nr, int t, const short *T)
Definition: ipshell.cc:6528
rFindHdl
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1612
sip_sring_bin
omBin sip_sring_bin
Definition: ring.cc:44
nIsZero
#define nIsZero(n)
Definition: numbers.h:20
IMATELEM
#define IMATELEM(M, I, J)
Definition: intvec.h:85
coeffs_BIGINT
coeffs coeffs_BIGINT
Definition: ipid.cc:52
idrec
Definition: idrec.h:35
iiShowLevRings
static void iiShowLevRings()
Definition: iplib.cc:459
feResource
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
iiInitSingularProcinfo
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int, long pos, BOOLEAN pstatic)
Definition: iplib.cc:991
varset
int * varset
Definition: hutil.h:16
Mivlp
intvec * Mivlp(int nR)
Definition: walk.cc:1022
rEnvelope
ring rEnvelope(ring R)
Definition: ring.cc:5524
hInit
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
jjEXTENDED_SYSTEM
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2372
IsCmd
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8860
rField_is_numeric
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:506
newstruct_set_proc
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:859
rField_is_GF
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:512
complexNearZero
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:766
nc_CallPlural
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2682
ALIAS_CMD
@ ALIAS_CMD
Definition: tok.h:34
text_buffer
char * text_buffer
Definition: libparse.cc:1097
system
void system(sys)
sleftv::Attribute
attr * Attribute()
Definition: subexpr.cc:1476
DIR_SEP
#define DIR_SEP
Definition: feResource.h:6
rootContainer::getAnzRoots
int getAnzRoots()
Definition: mpr_numeric.h:97
MkInterRedNextWeight
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2570
hNvar
int hNvar
Definition: hutil.cc:22
VECHO
@ VECHO
Definition: tok.h:206
pDiff
#define pDiff(a, b)
Definition: polys.h:290
rDecomposeCF
void rDecomposeCF(leftv h, const ring r, const ring R)
Definition: ipshell.cc:1638
simplex::m3
int m3
Definition: mpr_numeric.h:200
IDPACKAGE
#define IDPACKAGE(a)
Definition: ipid.h:134
HCord
int HCord
Definition: kutil.cc:235
print_init
void print_init()
Definition: libparse.cc:3480
pcvDim
int pcvDim(int d0, int d1)
Definition: pcv.cc:400
n_Zp
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:30
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:128
iiRunInit
static void iiRunInit(package p)
Definition: iplib.cc:899
spectrumProc
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:4102
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
p_Shrink
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:370
jjA_L_BIGINTMAT
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1533
OM_TRACK
#define OM_TRACK
Definition: omalloc_debug.c:10
simplex::zrovToIV
intvec * zrovToIV()
Definition: mpr_numeric.cc:1088
list_error
void list_error(semicState state)
Definition: ipshell.cc:3437
resMatrixBase::ready
@ ready
Definition: mpr_base.h:26
spectrum::mult_spectrum
int mult_spectrum(spectrum &)
Definition: semic.cc:396
LANG_MIX
@ LANG_MIX
Definition: subexpr.h:24
ringIsLocal
BOOLEAN ringIsLocal(const ring r)
Definition: spectrum.cc:461
BVERBOSE
#define BVERBOSE(a)
Definition: options.h:35
Print
#define Print
Definition: emacs.cc:80
QRING_CMD
@ QRING_CMD
Definition: tok.h:158
pcvP2CV
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:280
spectrumPrintError
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:4071
iiRETURNEXPR
sleftv iiRETURNEXPR
Definition: iplib.cc:455
VoiceName
const char * VoiceName()
Definition: fevoices.cc:57
iiApplyINTVEC
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:6333
hSupp
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180
lib_style_types
lib_style_types
Definition: libparse.h:9
ringorder_IS
@ ringorder_IS
Induced (Schreyer) ordering.
Definition: ring.h:94
atGet
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:131
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
idXXX
ideal idXXX(ideal h1, int k)
Definition: ideals.cc:878
pLastVblock
#define pLastVblock(p, lV)
Definition: shiftgb.h:30
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:833
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
TRACE_ASSIGN
#define TRACE_ASSIGN
Definition: reporter.h:45
fe_fgets_stdin_emu
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
Definition: feread.cc:254
FE_OPT_UNDEF
@ FE_OPT_UNDEF
Definition: feOptGen.h:15
rSimpleOrdStr
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:78
PACKAGE_CMD
@ PACKAGE_CMD
Definition: tok.h:149
LT_BUILTIN
@ LT_BUILTIN
Definition: mod_raw.h:18
sArithBase
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:197
rootArranger::success
bool success()
Definition: mpr_numeric.h:162
name
char name(const Variable &v)
Definition: factory.h:180
command
ip_command * command
Definition: ipid.h:22
IDHDL
#define IDHDL
Definition: tok.h:31
yyparse
int yyparse(void)
Definition: grammar.cc:2111
pow
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:414
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
JSet
indset JSet
Definition: hdegree.cc:279
V_YACC
#define V_YACC
Definition: options.h:44
rootArranger::arrange
void arrange()
Definition: mpr_numeric.cc:887
ringorder_s
@ ringorder_s
s?
Definition: ring.h:77
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
sleftv::Typ
int Typ()
Definition: subexpr.cc:1039
m
int m
Definition: cfEzgcd.cc:121
idrec::typ
int typ
Definition: idrec.h:43
singntl_LLL
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1793
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:29
TEST_FOR
#define TEST_FOR(A)
WerrorS_callback
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
WarnS
#define WarnS
Definition: emacs.cc:78
Variable::name
char name() const
Definition: variable.cc:122
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
basePack
package basePack
Definition: ipid.cc:60
assume
#define assume(x)
Definition: mod2.h:390
hisModule
int hisModule
Definition: hutil.cc:23
OPT_REDTHROUGH
#define OPT_REDTHROUGH
Definition: options.h:81
sLastPrinted
sleftv sLastPrinted
Definition: subexpr.cc:52
sleftv::listLength
int listLength()
Definition: subexpr.cc:57
ip_smatrix::rank
long rank
Definition: matpol.h:21
NULL
#define NULL
Definition: omList.c:10
resMatrixBase::getMatrix
virtual ideal getMatrix()
Definition: mpr_base.h:31
MAP_CMD
@ MAP_CMD
Definition: grammar.cc:285
sleftv::CopyD
void * CopyD(int t)
Definition: subexpr.cc:745
lists
slists * lists
Definition: mpr_numeric.h:146
sleftv::Copy
void Copy(leftv e)
Definition: subexpr.cc:720
pSetm
#define pSetm(p)
Definition: polys.h:265
siSeed
int siSeed
Definition: sirandom.c:29
MPertNextWeight
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
rSleftvList2StringArray
static BOOLEAN rSleftvList2StringArray(leftv sl, char **p)
Definition: ipshell.cc:5526
simpleipc_cmd
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:167
BIMATELEM
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
MAXPATHLEN
#define MAXPATHLEN
Definition: omRet2Info.c:22
fe_option::value
void * value
Definition: fegetopt.h:93
pcvLAddL
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
maFindPerm
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:165
evEigenvals
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
jjINT_S_TO_ID
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:6271
currPackHdl
idhdl currPackHdl
Definition: ipid.cc:57
l
int l
Definition: cfEzgcd.cc:93
IDSTRING
#define IDSTRING(a)
Definition: ipid.h:131
Mrwalk
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, int reduction, int printout)
Definition: walk.cc:5603
killlocals0
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:292
iiExprArith2TabIntern
static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b, BOOLEAN proccall, const struct sValCmd2 *dA2, int at, int bt, const struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8086
nDelete
#define nDelete(n)
Definition: numbers.h:17
simplex::compute
void compute()
Definition: mpr_numeric.cc:1099
IDNEXT
#define IDNEXT(a)
Definition: ipid.h:113
OM_CHECK
#define OM_CHECK
Definition: omalloc_debug.c:15
feNotImplemented
const char feNotImplemented[]
Definition: reporter.cc:54
IDNUMBER
#define IDNUMBER(a)
Definition: ipid.h:127
binom
int binom(int n, int r)
Definition: simpleideals.cc:913
R
#define R
Definition: sirandom.c:26
rootArranger::solve_all
void solve_all()
Definition: mpr_numeric.cc:862
WerrorS_dummy_cnt
static int WerrorS_dummy_cnt
Definition: iparith.cc:5289
spectrum
Definition: semic.h:64
intvec::rows
int rows() const
Definition: intvec.h:96
evHessenberg
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
validOpts
BITSET validOpts
Definition: kstd1.cc:59
SI_MAX_NEST
#define SI_MAX_NEST
Definition: iplib.cc:24
rAssure_HasComp
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4558
listOfRoots
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:5034
iiPStart
BOOLEAN iiPStart(idhdl pn, leftv v)
Definition: iplib.cc:353
Warn
#define Warn
Definition: emacs.cc:77
lpverbose
int lpverbose
Definition: libparse.cc:1104
jiA_MATRIX_L
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1616
StringAppend
#define StringAppend
Definition: emacs.cc:79
traceit
int traceit
Definition: febase.cc:42
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
sleftv_bin
omBin sleftv_bin
Definition: subexpr.cc:47
denominator_list_s::next
denominator_list next
Definition: kutil.h:61
dConvertTypes
const struct sConvertTypes dConvertTypes[]
Definition: table.h:1251
omCheckAddr
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
slists::Init
INLINE_THIS void Init(int l=0)
ISet
indset ISet
Definition: hdegree.cc:279
GE
@ GE
Definition: grammar.cc:269
jjWRONG
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3513
simplex::mapFromMatrix
BOOLEAN mapFromMatrix(matrix m)
Definition: mpr_numeric.cc:1015
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1444
SArithBase::nCmdUsed
unsigned nCmdUsed
number of commands used
Definition: iparith.cc:187
jjA_L_LIST
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1419
p
int p
Definition: cfModGcd.cc:4019
LongComplexInfo::par_name
const char * par_name
parameter name
Definition: coeffs.h:103
iiCurrArgs
leftv iiCurrArgs
Definition: ipshell.cc:78
sleftv::Name
const char * Name()
Definition: subexpr.h:120
setFlag
#define setFlag(A, F)
Definition: ipid.h:108
ZnmInfo
Definition: rmodulon.h:18
iiApplyBIGINTMAT
BOOLEAN iiApplyBIGINTMAT(leftv, leftv, int, leftv)
Definition: ipshell.cc:6365
load_builtin
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1197
MivWeightOrderlp
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1436
spectrum::mult_spectrumh
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
reinit_yylp
void reinit_yylp()
Definition: libparse.cc:3374
ggetid
idhdl ggetid(const char *n)
Definition: ipid.cc:523
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
RESOLUTION_CMD
@ RESOLUTION_CMD
Definition: grammar.cc:290
optionStruct
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:526
iiCheckTypes
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:6546
nInit
#define nInit(i)
Definition: numbers.h:25
Mfpertvector
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1512
POLY_CMD
@ POLY_CMD
Definition: grammar.cc:289
count
int status int void size_t count
Definition: si_signals.h:59
Tok2Cmdname
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:140
NOTEQUAL
@ NOTEQUAL
Definition: grammar.cc:273
IDID
#define IDID(a)
Definition: ipid.h:117
rootContainer::getAnzElems
int getAnzElems()
Definition: mpr_numeric.h:95
jiAssign_rec
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1796
ssyStrategy::hilb_coeffs
intvec ** hilb_coeffs
Definition: syz.h:46
feOptValue
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
spectrumCompute
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3779
n_SetMap
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:721
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:26
LT_HPUX
@ LT_HPUX
Definition: mod_raw.h:18
pNormalize
#define pNormalize(p)
Definition: polys.h:311
rDecomposeRing_41
void rDecomposeRing_41(leftv h, const coeffs C)
Definition: ipshell.cc:1796
Q
#define Q
Definition: sirandom.c:25
idrec::id
const char * id
Definition: idrec.h:39
semicState
semicState
Definition: ipshell.cc:3404
int_ptr
int * int_ptr
Definition: structs.h:57
FLAG_STD
#define FLAG_STD
Definition: ipid.h:104
radmem
monf radmem
Definition: hutil.cc:24
Mfrwalk
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad, int reduction, int printout)
Definition: walk.cc:8212
rootContainer
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:66
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:45
getList
lists getList(spectrum &spec)
Definition: ipshell.cc:3365
fd
int status int fd
Definition: si_signals.h:59
tmp2
CFList tmp2
Definition: facFqBivar.cc:70
denominator_list_s::n
number n
Definition: kutil.h:61
TEST_RINGDEP_OPTS
#define TEST_RINGDEP_OPTS
Definition: options.h:99
V_REDEFINE
#define V_REDEFINE
Definition: options.h:45
PrintLn
void PrintLn()
Definition: reporter.cc:310
simplex::n
int n
Definition: mpr_numeric.h:199
ssyStrategy::res
resolvente res
Definition: syz.h:47
rParameter
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:615
iiCheckNest
static void iiCheckNest()
Definition: iplib.cc:474
syConvRes
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3153
mp_Copy
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
rField_is_long_C
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:536
iiLibCmd
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:826
MATROWS
#define MATROWS(i)
Definition: matpol.h:28
proc
unsigned char * proc[NUM_PROC]
Definition: checklibs.c:16
omFreeBin
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
MINUSMINUS
@ MINUSMINUS
Definition: grammar.cc:271
p_LPshift
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:74
rField_is_Zp
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:491
newBuffer
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:157
TEST_V_ALLWARN
#define TEST_V_ALLWARN
Definition: options.h:140
getBlackboxStuff
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
AlgExtInfo::r
ring r
Definition: algext.h:39
pGetVariables
#define pGetVariables(p, e)
Definition: polys.h:246
hLexR
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:571
nCopy
#define nCopy(n)
Definition: numbers.h:16
iiAssign
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1819
info
const ExtensionInfo & info
< [in] sqrfree poly
Definition: facFqFactorize.h:38
rRingOrder_t
rRingOrder_t
order stuff
Definition: ring.h:69
libstack::next
libstackv next
Definition: subexpr.h:163
LINK_CMD
@ LINK_CMD
Definition: tok.h:117
yylp_errlist
char * yylp_errlist[]
Definition: libparse.cc:1112
ssyStrategy::weights
intvec ** weights
Definition: syz.h:45
CMATRIX_CMD
@ CMATRIX_CMD
Definition: tok.h:46
simplex::mapToMatrix
matrix mapToMatrix(matrix m)
Definition: mpr_numeric.cc:1044
yydebug
int yydebug
Definition: grammar.cc:1805
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
nSetMap
#define nSetMap(R)
Definition: numbers.h:44
Voice::fptr
long fptr
Definition: fevoices.h:70
semicOK
@ semicOK
Definition: ipshell.cc:3405
rDecomposeC_41
static void rDecomposeC_41(leftv h, const coeffs C)
Definition: ipshell.cc:1726
newstructShow
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:839
singclap_absFactorize
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1849
spectrumState
spectrumState
Definition: ipshell.cc:3520
LT_NOTFOUND
@ LT_NOTFOUND
Definition: mod_raw.h:18
rSetHdl
void rSetHdl(idhdl h)
Definition: ipshell.cc:5081
if
if(yy_init)
Definition: libparse.cc:1418
syKillComputation
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1496
package
ip_package * package
Definition: structs.h:46
syKillEmptyEntres
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2201
sleftv::next
leftv next
Definition: subexpr.h:86
IDIDEAL
#define IDIDEAL(a)
Definition: ipid.h:128
killlocals_list
BOOLEAN killlocals_list(int v, lists L)
Definition: ipshell.cc:363
nKillChar
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:511
uResultant::specializeInU
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:3061
sdb_flags
int sdb_flags
Definition: sdb.cc:32
si_opt_2
unsigned si_opt_2
Definition: options.c:6
idrCopyR
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
gmp_complex
gmp_complex numbers based on
Definition: mpr_complex.h:179
rDecomposeRing
void rDecomposeRing(leftv h, const ring R)
Definition: ipshell.cc:1824
BB_LIKE_LIST
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
ssyStrategy
Definition: syz.h:37
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
hCreate
monf hCreate(int Nvar)
Definition: hutil.cc:1002
singclap_neworder
char * singclap_neworder(ideal I, const ring r)
Definition: clapsing.cc:1542
SMATRIX_CMD
@ SMATRIX_CMD
Definition: grammar.cc:291
sm_UnFlatten
ideal sm_UnFlatten(ideal a, int col, const ring R)
Definition: matpol.cc:1949
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:497
feOptString
@ feOptString
Definition: fegetopt.h:77
id_TensorModuleMult
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
Definition: simpleideals.cc:1717
rInternalChar
static int rInternalChar(const ring r)
Definition: ring.h:679
cmds
cmdnames cmds[]
Definition: table.h:964
rComplete
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3369
pWrite
void pWrite(poly p)
Definition: polys.h:302
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
nlGMP
void nlGMP(number &i, mpz_t n, const coeffs r)
Definition: longrat.cc:1478
omfree
#define omfree(addr)
Definition: omAllocDecl.h:237
slists::Clean
void Clean(ring r=currRing)
Definition: lists.h:25
DOTDOT
@ DOTDOT
Definition: grammar.cc:267
verboseStruct
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:556
yylp_errno
int yylp_errno
Definition: libparse.cc:1128
idMaxIdeal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
si_opt_1
unsigned si_opt_1
Definition: options.c:5