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 char *(* Proc1) (char *)
 
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, sleftv *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)
 
char * iiGetLibName (procinfov v)
 
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 toDel)
 
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, sleftv *sl)
 
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 checkall ()
 
void rSetHdl (idhdl h)
 
ring rInit (sleftv *pn, sleftv *rv, sleftv *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, struct sValCmd1 *dA1, int at, struct sConvertTypes *dConvertTypes)
 apply an operation 'op' to an argument a return TRUE on failure More...
 
BOOLEAN iiExprArith2Tab (leftv res, leftv a, int op, struct sValCmd2 *dA2, int at, 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, struct sValCmd3 *dA3, int at, 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)
 

Variables

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

Data Structure Documentation

struct sValCmd1

Definition at line 66 of file gentable.cc.

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

Definition at line 57 of file gentable.cc.

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

Definition at line 74 of file gentable.cc.

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

Definition at line 84 of file gentable.cc.

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

Definition at line 92 of file gentable.cc.

Data Fields
short arg
int p
proc1 p
short res
struct sValAssign

Definition at line 99 of file gentable.cc.

Data Fields
short arg
int p
proci p
short res

Typedef Documentation

typedef BOOLEAN(* proc1) (leftv, leftv)

Definition at line 123 of file ipshell.h.

typedef char*(* Proc1) (char *)

Definition at line 126 of file ipshell.h.

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

Definition at line 136 of file ipshell.h.

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

Definition at line 147 of file ipshell.h.

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

Definition at line 176 of file ipshell.h.

Function Documentation

void checkall ( )

Definition at line 1016 of file misc_ip.cc.

1017 {
1018  idhdl hh=basePack->idroot;
1019  while (hh!=NULL)
1020  {
1021  omCheckAddr(hh);
1022  omCheckAddr((ADDRESS)IDID(hh));
1023  if (RingDependend(IDTYP(hh)))
1024  {
1025  Print("%s typ %d in Top (should be in ring)\n",IDID(hh),IDTYP(hh));
1026  }
1027  hh=IDNEXT(hh);
1028  }
1029  hh=basePack->idroot;
1030  while (hh!=NULL)
1031  {
1032  if (IDTYP(hh)==PACKAGE_CMD)
1033  {
1034  idhdl h2=IDPACKAGE(hh)->idroot;
1035  if (IDPACKAGE(hh)!=basePack)
1036  {
1037  while (h2!=NULL)
1038  {
1039  omCheckAddr(h2);
1040  omCheckAddr((ADDRESS)IDID(h2));
1041  if (RingDependend(IDTYP(h2)))
1042  {
1043  Print("%s typ %d in %s (should be in ring)\n",IDID(h2),IDTYP(h2),IDID(hh));
1044  }
1045  h2=IDNEXT(h2);
1046  }
1047  }
1048  }
1049  hh=IDNEXT(hh);
1050  }
1051 }
#define Print
Definition: emacs.cc:83
#define IDID(a)
Definition: ipid.h:121
#define IDNEXT(a)
Definition: ipid.h:117
void * ADDRESS
Definition: auxiliary.h:161
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
int RingDependend(int t)
Definition: gentable.cc:23
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int exprlist_length ( leftv  v)

Definition at line 552 of file ipshell.cc.

553 {
554  int rc = 0;
555  while (v!=NULL)
556  {
557  switch (v->Typ())
558  {
559  case INT_CMD:
560  case POLY_CMD:
561  case VECTOR_CMD:
562  case NUMBER_CMD:
563  rc++;
564  break;
565  case INTVEC_CMD:
566  case INTMAT_CMD:
567  rc += ((intvec *)(v->Data()))->length();
568  break;
569  case MATRIX_CMD:
570  case IDEAL_CMD:
571  case MODUL_CMD:
572  {
573  matrix mm = (matrix)(v->Data());
574  rc += mm->rows() * mm->cols();
575  }
576  break;
577  case LIST_CMD:
578  rc+=((lists)v->Data())->nr+1;
579  break;
580  default:
581  rc++;
582  }
583  v = v->next;
584  }
585  return rc;
586 }
int & rows()
Definition: matpol.h:24
Definition: tok.h:85
int Typ()
Definition: subexpr.cc:955
Definition: intvec.h:16
ip_smatrix * matrix
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
int iiAddCproc ( const char *  libname,
const char *  procname,
BOOLEAN  pstatic,
BOOLEAN(*)(leftv res, leftv v func 
)

Definition at line 1001 of file iplib.cc.

1003 {
1004  procinfov pi;
1005  idhdl h;
1006 
1007  #ifndef SING_NDEBUG
1008  int dummy;
1009  if (IsCmd(procname,dummy))
1010  {
1011  Werror(">>%s< is a reserved name",procname);
1012  return 0;
1013  }
1014  #endif
1015 
1016  h = enterid(procname,0, PROC_CMD, &IDROOT, TRUE);
1017  if ( h!= NULL )
1018  {
1019  pi = IDPROC(h);
1020  pi->libname = omStrDup(libname);
1021  pi->procname = omStrDup(procname);
1022  pi->language = LANG_C;
1023  pi->ref = 1;
1024  pi->is_static = pstatic;
1025  pi->data.o.function = func;
1026  return(1);
1027  }
1028  else
1029  {
1030  PrintS("iiAddCproc: failed.\n");
1031  }
1032  return(0);
1033 }
language_defs language
Definition: subexpr.h:58
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
short ref
Definition: subexpr.h:59
Definition: idrec.h:34
char * procname
Definition: subexpr.h:56
Definition: subexpr.h:20
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
char * libname
Definition: subexpr.h:55
procinfodata data
Definition: subexpr.h:62
void PrintS(const char *s)
Definition: reporter.cc:294
char is_static
Definition: subexpr.h:60
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8722
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiAlias ( leftv  p)

Definition at line 742 of file ipid.cc.

743 {
744  if (iiCurrArgs==NULL)
745  {
746  Werror("not enough arguments for proc %s",VoiceName());
747  p->CleanUp();
748  return TRUE;
749  }
751  iiCurrArgs=h->next;
752  h->next=NULL;
753  if (h->rtyp!=IDHDL)
754  {
755  BOOLEAN res=iiAssign(p,h);
756  h->CleanUp();
758  return res;
759  }
760  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
761  {
762  WerrorS("type mismatch");
763  return TRUE;
764  }
765  idhdl pp=(idhdl)p->data;
766  switch(pp->typ)
767  {
768 #ifdef SINGULAR_4_1
769  case CRING_CMD:
770  nKillChar((coeffs)pp);
771  break;
772 #endif
773  case DEF_CMD:
774  case INT_CMD:
775  break;
776  case INTVEC_CMD:
777  case INTMAT_CMD:
778  delete IDINTVEC(pp);
779  break;
780  case NUMBER_CMD:
781  nDelete(&IDNUMBER(pp));
782  break;
783  case BIGINT_CMD:
785  break;
786  case MAP_CMD:
787  {
788  map im = IDMAP(pp);
789  omFree((ADDRESS)im->preimage);
790  }
791  // continue as ideal:
792  case IDEAL_CMD:
793  case MODUL_CMD:
794  case MATRIX_CMD:
795  idDelete(&IDIDEAL(pp));
796  break;
797  case PROC_CMD:
798  case RESOLUTION_CMD:
799  case STRING_CMD:
800  omFree((ADDRESS)IDSTRING(pp));
801  break;
802  case LIST_CMD:
803  IDLIST(pp)->Clean();
804  break;
805  case LINK_CMD:
807  break;
808  // case ring: cannot happen
809  default:
810  Werror("unknown type %d",p->Typ());
811  return TRUE;
812  }
813  pp->typ=ALIAS_CMD;
814  IDDATA(pp)=(char*)h->data;
815  int eff_typ=h->Typ();
816  if ((RingDependend(eff_typ))
817  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
818  {
819  ipSwapId(pp,IDROOT,currRing->idroot);
820  }
821  h->CleanUp();
823  return FALSE;
824 }
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
#define IDLIST(a)
Definition: ipid.h:136
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
#define IDLINK(a)
Definition: ipid.h:137
Definition: lists.h:22
#define IDINTVEC(a)
Definition: ipid.h:127
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:42
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define IDIDEAL(a)
Definition: ipid.h:132
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
poly pp
Definition: myNF.cc:296
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int RingDependend(int t)
Definition: gentable.cc:23
Definition: tok.h:56
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
#define IDSTRING(a)
Definition: ipid.h:135
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
Definition: tok.h:88
const char * VoiceName()
Definition: fevoices.cc:66
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:134
leftv next
Definition: subexpr.h:87
#define IDNUMBER(a)
Definition: ipid.h:131
Definition: tok.h:38
Definition: tok.h:95
#define NULL
Definition: omList.c:10
leftv iiCurrArgs
Definition: ipshell.cc:84
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
int typ
Definition: idrec.h:43
Definition: tok.h:96
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:576
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
BOOLEAN iiAllStart ( procinfov  pi,
char *  p,
feBufferTypes  t,
int  l 
)

Definition at line 322 of file iplib.cc.

323 {
324  // see below:
325  BITSET save1=si_opt_1;
326  BITSET save2=si_opt_2;
327  newBuffer( omStrDup(p /*pi->data.s.body*/), t /*BT_proc*/,
328  pi, l );
329  BOOLEAN err=yyparse();
330  if (sLastPrinted.rtyp!=0)
331  {
333  }
334  // the access to optionStruct and verboseStruct do not work
335  // on x86_64-Linux for pic-code
336  if ((TEST_V_ALLWARN) &&
337  (t==BT_proc) &&
338  ((save1!=si_opt_1)||(save2!=si_opt_2)) &&
339  (pi->libname!=NULL) && (pi->libname[0]!='\0'))
340  {
341  if ((pi->libname!=NULL) && (pi->libname[0]!='\0'))
342  Warn("option changed in proc %s from %s",pi->procname,pi->libname);
343  else
344  Warn("option changed in proc %s",pi->procname);
345  int i;
346  for (i=0; optionStruct[i].setval!=0; i++)
347  {
348  if ((optionStruct[i].setval & si_opt_1)
349  && (!(optionStruct[i].setval & save1)))
350  {
351  Print(" +%s",optionStruct[i].name);
352  }
353  if (!(optionStruct[i].setval & si_opt_1)
354  && ((optionStruct[i].setval & save1)))
355  {
356  Print(" -%s",optionStruct[i].name);
357  }
358  }
359  for (i=0; verboseStruct[i].setval!=0; i++)
360  {
361  if ((verboseStruct[i].setval & si_opt_2)
362  && (!(verboseStruct[i].setval & save2)))
363  {
364  Print(" +%s",verboseStruct[i].name);
365  }
366  if (!(verboseStruct[i].setval & si_opt_2)
367  && ((verboseStruct[i].setval & save2)))
368  {
369  Print(" -%s",verboseStruct[i].name);
370  }
371  }
372  PrintLn();
373  }
374  return err;
375 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
#define BITSET
Definition: structs.h:17
char * procname
Definition: subexpr.h:56
unsigned setval
Definition: iplib.cc:315
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551
char * libname
Definition: subexpr.h:55
int i
Definition: cfEzgcd.cc:123
int yyparse(void)
Definition: grammar.cc:2168
char name(const Variable &v)
Definition: variable.h:95
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:171
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:131
#define TEST_V_ALLWARN
Definition: options.h:135
int l
Definition: cfEzgcd.cc:94
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiApply ( leftv  res,
leftv  a,
int  op,
leftv  proc 
)

Definition at line 5984 of file ipshell.cc.

5985 {
5986  memset(res,0,sizeof(sleftv));
5987  res->rtyp=a->Typ();
5988  switch (res->rtyp /*a->Typ()*/)
5989  {
5990  case INTVEC_CMD:
5991  case INTMAT_CMD:
5992  return iiApplyINTVEC(res,a,op,proc);
5993  case BIGINTMAT_CMD:
5994  return iiApplyBIGINTMAT(res,a,op,proc);
5995  case IDEAL_CMD:
5996  case MODUL_CMD:
5997  case MATRIX_CMD:
5998  return iiApplyIDEAL(res,a,op,proc);
5999  case LIST_CMD:
6000  return iiApplyLIST(res,a,op,proc);
6001  }
6002  WerrorS("first argument to `apply` must allow an index");
6003  return TRUE;
6004 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
BOOLEAN iiApplyBIGINTMAT(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:5942
BOOLEAN iiApplyIDEAL(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:5947
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
BOOLEAN iiApplyLIST(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:5952
Definition: tok.h:88
int rtyp
Definition: subexpr.h:92
Definition: tok.h:96
BOOLEAN iiApplyINTVEC(leftv res, leftv a, int op, leftv proc)
Definition: ipshell.cc:5910
BOOLEAN iiARROW ( leftv  ,
char *  ,
char *   
)

Definition at line 6033 of file ipshell.cc.

6034 {
6035  char *ss=(char*)omAlloc(strlen(a)+strlen(s)+30); /* max. 27 currently */
6036  // find end of s:
6037  int end_s=strlen(s);
6038  while ((end_s>0) && ((s[end_s]<=' ')||(s[end_s]==';'))) end_s--;
6039  s[end_s+1]='\0';
6040  char *name=(char *)omAlloc(strlen(a)+strlen(s)+30);
6041  sprintf(name,"%s->%s",a,s);
6042  // find start of last expression
6043  int start_s=end_s-1;
6044  while ((start_s>=0) && (s[start_s]!=';')) start_s--;
6045  if (start_s<0) // ';' not found
6046  {
6047  sprintf(ss,"parameter def %s;return(%s);\n",a,s);
6048  }
6049  else // s[start_s] is ';'
6050  {
6051  s[start_s]='\0';
6052  sprintf(ss,"parameter def %s;%s;return(%s);\n",a,s,s+start_s+1);
6053  }
6054  memset(r,0,sizeof(*r));
6055  // now produce procinfo for PROC_CMD:
6056  r->data = (void *)omAlloc0Bin(procinfo_bin);
6057  ((procinfo *)(r->data))->language=LANG_NONE;
6058  iiInitSingularProcinfo((procinfo *)r->data,"",name,0,0);
6059  ((procinfo *)r->data)->data.s.body=ss;
6060  omFree(name);
6061  r->rtyp=PROC_CMD;
6062  //r->rtyp=STRING_CMD;
6063  //r->data=ss;
6064  return FALSE;
6065 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
procinfo * iiInitSingularProcinfo(procinfov pi, const char *libname, const char *procname, int line, long pos, BOOLEAN pstatic)
Definition: iplib.cc:976
#define FALSE
Definition: auxiliary.h:140
#define omAlloc(size)
Definition: omAllocDecl.h:210
omBin procinfo_bin
Definition: subexpr.cc:51
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
char name(const Variable &v)
Definition: variable.h:95
BOOLEAN iiAssign ( leftv  left,
leftv  right,
BOOLEAN  toplevel = TRUE 
)

Definition at line 1772 of file ipassign.cc.

1773 {
1774  if (errorreported) return TRUE;
1775  int ll=l->listLength();
1776  int rl;
1777  int lt=l->Typ();
1778  int rt=NONE;
1779  BOOLEAN b;
1780  if (l->rtyp==ALIAS_CMD)
1781  {
1782  Werror("`%s` is read-only",l->Name());
1783  }
1784 
1785  if (l->rtyp==IDHDL)
1786  {
1787  atKillAll((idhdl)l->data);
1788  IDFLAG((idhdl)l->data)=0;
1789  l->attribute=NULL;
1790  toplevel=FALSE;
1791  }
1792  else if (l->attribute!=NULL)
1793  atKillAll((idhdl)l);
1794  l->flag=0;
1795  if (ll==1)
1796  {
1797  /* l[..] = ... */
1798  if(l->e!=NULL)
1799  {
1800  BOOLEAN like_lists=0;
1801  blackbox *bb=NULL;
1802  int bt;
1803  if (((bt=l->rtyp)>MAX_TOK)
1804  || ((l->rtyp==IDHDL) && ((bt=IDTYP((idhdl)l->data))>MAX_TOK)))
1805  {
1806  bb=getBlackboxStuff(bt);
1807  like_lists=BB_LIKE_LIST(bb); // bb like a list
1808  }
1809  else if (((l->rtyp==IDHDL) && (IDTYP((idhdl)l->data)==LIST_CMD))
1810  || (l->rtyp==LIST_CMD))
1811  {
1812  like_lists=2; // bb in a list
1813  }
1814  if(like_lists)
1815  {
1816  if (traceit&TRACE_ASSIGN) PrintS("assign list[..]=...or similar\n");
1817  if (like_lists==1)
1818  {
1819  // check blackbox/newtype type:
1820  if(bb->blackbox_CheckAssign(bb,l,r)) return TRUE;
1821  }
1822  b=jiAssign_list(l,r);
1823  if((!b) && (like_lists==2))
1824  {
1825  //Print("jjA_L_LIST: - 2 \n");
1826  if((l->rtyp==IDHDL) && (l->data!=NULL))
1827  {
1828  ipMoveId((idhdl)l->data);
1829  l->attribute=IDATTR((idhdl)l->data);
1830  l->flag=IDFLAG((idhdl)l->data);
1831  }
1832  }
1833  r->CleanUp();
1834  Subexpr h;
1835  while (l->e!=NULL)
1836  {
1837  h=l->e->next;
1839  l->e=h;
1840  }
1841  return b;
1842  }
1843  }
1844  if (lt>MAX_TOK)
1845  {
1846  blackbox *bb=getBlackboxStuff(lt);
1847 #ifdef BLACKBOX_DEVEL
1848  Print("bb-assign: bb=%lx\n",bb);
1849 #endif
1850  return (bb==NULL) || bb->blackbox_Assign(l,r);
1851  }
1852  // end of handling elems of list and similar
1853  rl=r->listLength();
1854  if (rl==1)
1855  {
1856  /* system variables = ... */
1857  if(((l->rtyp>=VECHO)&&(l->rtyp<=VPRINTLEVEL))
1858  ||((l->rtyp>=VALTVARS)&&(l->rtyp<=VMINPOLY)))
1859  {
1860  b=iiAssign_sys(l,r);
1861  r->CleanUp();
1862  //l->CleanUp();
1863  return b;
1864  }
1865  rt=r->Typ();
1866  /* a = ... */
1867  if ((lt!=MATRIX_CMD)
1868  &&(lt!=BIGINTMAT_CMD)
1869  &&(lt!=CMATRIX_CMD)
1870  &&(lt!=INTMAT_CMD)
1871  &&((lt==rt)||(lt!=LIST_CMD)))
1872  {
1873  b=jiAssign_1(l,r,toplevel);
1874  if (l->rtyp==IDHDL)
1875  {
1876  if ((lt==DEF_CMD)||(lt==LIST_CMD))
1877  {
1878  ipMoveId((idhdl)l->data);
1879  }
1880  l->attribute=IDATTR((idhdl)l->data);
1881  l->flag=IDFLAG((idhdl)l->data);
1882  l->CleanUp();
1883  }
1884  r->CleanUp();
1885  return b;
1886  }
1887  if (((lt!=LIST_CMD)
1888  &&((rt==MATRIX_CMD)
1889  ||(rt==BIGINTMAT_CMD)
1890  ||(rt==CMATRIX_CMD)
1891  ||(rt==INTMAT_CMD)
1892  ||(rt==INTVEC_CMD)
1893  ||(rt==MODUL_CMD)))
1894  ||((lt==LIST_CMD)
1895  &&(rt==RESOLUTION_CMD))
1896  )
1897  {
1898  b=jiAssign_1(l,r,toplevel);
1899  if((l->rtyp==IDHDL)&&(l->data!=NULL))
1900  {
1901  if ((lt==DEF_CMD) || (lt==LIST_CMD))
1902  {
1903  //Print("ipAssign - 3.0\n");
1904  ipMoveId((idhdl)l->data);
1905  }
1906  l->attribute=IDATTR((idhdl)l->data);
1907  l->flag=IDFLAG((idhdl)l->data);
1908  }
1909  r->CleanUp();
1910  Subexpr h;
1911  while (l->e!=NULL)
1912  {
1913  h=l->e->next;
1915  l->e=h;
1916  }
1917  return b;
1918  }
1919  }
1920  if (rt==NONE) rt=r->Typ();
1921  }
1922  else if (ll==(rl=r->listLength()))
1923  {
1924  b=jiAssign_rec(l,r);
1925  return b;
1926  }
1927  else
1928  {
1929  if (rt==NONE) rt=r->Typ();
1930  if (rt==INTVEC_CMD)
1931  return jiA_INTVEC_L(l,r);
1932  else if (rt==VECTOR_CMD)
1933  return jiA_VECTOR_L(l,r);
1934  else if ((rt==IDEAL_CMD)||(rt==MATRIX_CMD))
1935  return jiA_MATRIX_L(l,r);
1936  else if ((rt==STRING_CMD)&&(rl==1))
1937  return jiA_STRING_L(l,r);
1938  Werror("length of lists in assignment does not match (l:%d,r:%d)",
1939  ll,rl);
1940  return TRUE;
1941  }
1942 
1943  leftv hh=r;
1944  BOOLEAN nok=FALSE;
1945  BOOLEAN map_assign=FALSE;
1946  switch (lt)
1947  {
1948  case INTVEC_CMD:
1949  nok=jjA_L_INTVEC(l,r,new intvec(exprlist_length(r)));
1950  break;
1951  case INTMAT_CMD:
1952  {
1953  nok=jjA_L_INTVEC(l,r,new intvec(IDINTVEC((idhdl)l->data)));
1954  break;
1955  }
1956  case BIGINTMAT_CMD:
1957  {
1958  nok=jjA_L_BIGINTMAT(l, r, new bigintmat(IDBIMAT((idhdl)l->data)));
1959  break;
1960  }
1961  case MAP_CMD:
1962  {
1963  // first element in the list sl (r) must be a ring
1964  if (((rt == RING_CMD)||(rt == QRING_CMD))&&(r->e==NULL))
1965  {
1966  omFree((ADDRESS)IDMAP((idhdl)l->data)->preimage);
1967  IDMAP((idhdl)l->data)->preimage = omStrDup (r->Fullname());
1968  /* advance the expressionlist to get the next element after the ring */
1969  hh = r->next;
1970  //r=hh;
1971  }
1972  else
1973  {
1974  WerrorS("expected ring-name");
1975  nok=TRUE;
1976  break;
1977  }
1978  if (hh==NULL) /* map-assign: map f=r; */
1979  {
1980  WerrorS("expected image ideal");
1981  nok=TRUE;
1982  break;
1983  }
1984  if ((hh->next==NULL)&&(hh->Typ()==IDEAL_CMD))
1985  return jiAssign_1(l,hh,toplevel); /* map-assign: map f=r,i; */
1986  //no break, handle the rest like an ideal:
1987  map_assign=TRUE;
1988  }
1989  case MATRIX_CMD:
1990  case IDEAL_CMD:
1991  case MODUL_CMD:
1992  {
1993  sleftv t;
1994  matrix olm = (matrix)l->Data();
1995  int rk;
1996  char *pr=((map)olm)->preimage;
1997  BOOLEAN module_assign=(/*l->Typ()*/ lt==MODUL_CMD);
1998  matrix lm ;
1999  int num;
2000  int j,k;
2001  int i=0;
2002  int mtyp=MATRIX_CMD; /*Type of left side object*/
2003  int etyp=POLY_CMD; /*Type of elements of left side object*/
2004 
2005  if (lt /*l->Typ()*/==MATRIX_CMD)
2006  {
2007  rk=olm->rows();
2008  num=olm->cols()*rk /*olm->rows()*/;
2009  lm=mpNew(olm->rows(),olm->cols());
2010  int el;
2011  if ((traceit&TRACE_ASSIGN) && (num!=(el=exprlist_length(hh))))
2012  {
2013  Warn("expression list length(%d) does not match matrix size(%d)",el,num);
2014  }
2015  }
2016  else /* IDEAL_CMD or MODUL_CMD */
2017  {
2018  num=exprlist_length(hh);
2019  lm=(matrix)idInit(num,1);
2020  if (module_assign)
2021  {
2022  rk=0;
2023  mtyp=MODUL_CMD;
2024  etyp=VECTOR_CMD;
2025  }
2026  else
2027  rk=1;
2028  }
2029 
2030  int ht;
2031  loop
2032  {
2033  if (hh==NULL)
2034  break;
2035  else
2036  {
2037  matrix rm;
2038  ht=hh->Typ();
2039  if ((j=iiTestConvert(ht,etyp))!=0)
2040  {
2041  nok=iiConvert(ht,etyp,j,hh,&t);
2042  hh->next=t.next;
2043  if (nok) break;
2044  lm->m[i]=(poly)t.CopyD(etyp);
2045  pNormalize(lm->m[i]);
2046  if (module_assign) rk=si_max(rk,(int)pMaxComp(lm->m[i]));
2047  i++;
2048  }
2049  else
2050  if ((j=iiTestConvert(ht,mtyp))!=0)
2051  {
2052  nok=iiConvert(ht,mtyp,j,hh,&t);
2053  hh->next=t.next;
2054  if (nok) break;
2055  rm = (matrix)t.CopyD(mtyp);
2056  if (module_assign)
2057  {
2058  j = si_min(num,rm->cols());
2059  rk=si_max(rk,(int)rm->rank);
2060  }
2061  else
2062  j = si_min(num-i,rm->rows() * rm->cols());
2063  for(k=0;k<j;k++,i++)
2064  {
2065  lm->m[i]=rm->m[k];
2066  pNormalize(lm->m[i]);
2067  rm->m[k]=NULL;
2068  }
2069  idDelete((ideal *)&rm);
2070  }
2071  else
2072  {
2073  nok=TRUE;
2074  break;
2075  }
2076  t.next=NULL;t.CleanUp();
2077  if (i==num) break;
2078  hh=hh->next;
2079  }
2080  }
2081  if (nok)
2082  idDelete((ideal *)&lm);
2083  else
2084  {
2085  idDelete((ideal *)&olm);
2086  if (module_assign) lm->rank=rk;
2087  else if (map_assign) ((map)lm)->preimage=pr;
2088  l=l->LData();
2089  if (l->rtyp==IDHDL)
2090  IDMATRIX((idhdl)l->data)=lm;
2091  else
2092  l->data=(char *)lm;
2093  }
2094  break;
2095  }
2096  case STRING_CMD:
2097  nok=jjA_L_STRING(l,r);
2098  break;
2099  //case DEF_CMD:
2100  case LIST_CMD:
2101  nok=jjA_L_LIST(l,r);
2102  break;
2103  case NONE:
2104  case 0:
2105  Werror("cannot assign to %s",l->Fullname());
2106  nok=TRUE;
2107  break;
2108  default:
2109  WerrorS("assign not impl.");
2110  nok=TRUE;
2111  break;
2112  } /* end switch: typ */
2113  if (nok && (!errorreported)) WerrorS("incompatible type in list assignment");
2114  r->CleanUp();
2115  return nok;
2116 }
int & rows()
Definition: matpol.h:24
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
static BOOLEAN jiA_INTVEC_L(leftv l, leftv r)
Definition: ipassign.cc:1303
void ipMoveId(idhdl tomove)
Definition: ipid.cc:601
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Definition: tok.h:157
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_ASSIGN
Definition: reporter.h:43
static BOOLEAN jjA_L_INTVEC(leftv l, leftv r, intvec *iv)
Definition: ipassign.cc:1435
#define Print
Definition: emacs.cc:83
CanonicalForm num(const CanonicalForm &f)
#define IDINTVEC(a)
Definition: ipid.h:127
#define pMaxComp(p)
Definition: polys.h:270
loop
Definition: myNF.cc:98
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
int exprlist_length(leftv v)
Definition: ipshell.cc:552
Matrices of numbers.
Definition: bigintmat.h:32
static BOOLEAN jiAssign_list(leftv l, leftv r)
Definition: ipassign.cc:1679
Definition: tok.h:167
static BOOLEAN jiAssign_1(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1065
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define IDBIMAT(a)
Definition: ipid.h:128
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
int traceit
Definition: febase.cc:47
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
static BOOLEAN jjA_L_BIGINTMAT(leftv l, leftv r, bigintmat *bim)
Definition: ipassign.cc:1484
static BOOLEAN iiAssign_sys(leftv l, leftv r)
Definition: ipassign.cc:1229
#define IDTYP(a)
Definition: ipid.h:118
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
int j
Definition: myNF.cc:70
Definition: tok.h:58
#define omFree(addr)
Definition: omAllocDecl.h:261
pNormalize(P.p)
static BOOLEAN jiA_VECTOR_L(leftv l, leftv r)
Definition: ipassign.cc:1329
omBin sSubexpr_bin
Definition: subexpr.cc:49
ip_smatrix * matrix
static BOOLEAN jjA_L_STRING(leftv l, leftv r)
Definition: ipassign.cc:1533
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
Definition: tok.h:88
#define IDMAP(a)
Definition: ipid.h:134
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
Definition: tok.h:38
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define atKillAll(H)
Definition: attrib.h:42
static BOOLEAN jiA_STRING_L(leftv l, leftv r)
Definition: ipassign.cc:1643
int & cols()
Definition: matpol.h:25
#define NULL
Definition: omList.c:10
static BOOLEAN jiAssign_rec(leftv l, leftv r)
Definition: ipassign.cc:1749
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
static BOOLEAN jiA_MATRIX_L(leftv l, leftv r)
Definition: ipassign.cc:1567
static BOOLEAN jjA_L_LIST(leftv l, leftv r)
Definition: ipassign.cc:1370
#define IDFLAG(a)
Definition: ipid.h:119
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define IDATTR(a)
Definition: ipid.h:122
Definition: tok.h:96
Definition: tok.h:126
polyrec * poly
Definition: hilb.h:10
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
#define NONE
Definition: tok.h:170
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
void * CopyD(int t)
Definition: subexpr.cc:662
int l
Definition: cfEzgcd.cc:94
long rank
Definition: matpol.h:20
#define IDMATRIX(a)
Definition: ipid.h:133
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiAssignCR ( leftv  ,
leftv   
)

Definition at line 6067 of file ipshell.cc.

6068 {
6069  int t=arg->Typ();
6070  char* ring_name=(char*)r->Name();
6071  ring_name=omStrDup(ring_name);
6072  if ((t==RING_CMD) ||(t==QRING_CMD))
6073  {
6074  sleftv tmp;
6075  memset(&tmp,0,sizeof(tmp));
6076  tmp.rtyp=IDHDL;
6077  tmp.data=(char*)rDefault(ring_name);
6078  if (tmp.data!=NULL)
6079  {
6080  BOOLEAN b=iiAssign(&tmp,arg);
6081  if (b) return TRUE;
6082  rSetHdl(ggetid(ring_name));
6083  omFree(ring_name);
6084  return FALSE;
6085  }
6086  else
6087  return TRUE;
6088  }
6089  else if (t==CRING_CMD)
6090  {
6091  sleftv tmp;
6092  sleftv n;
6093  memset(&n,0,sizeof(n));
6094  n.name=ring_name;
6095  if (iiDeclCommand(&tmp,&n,myynest,CRING_CMD,&IDROOT)) return TRUE;
6096  if (iiAssign(&tmp,arg)) return TRUE;
6097  //Print("create %s\n",r->Name());
6098  //Print("from %s(%d)\n",Tok2Cmdname(arg->Typ()),arg->Typ());
6099  return FALSE;
6100  }
6101  return TRUE;// not handled -> error for now
6102 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define IDHDL
Definition: tok.h:35
idhdl rDefault(const char *s)
Definition: ipshell.cc:1520
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:56
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1112
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
Definition: tok.h:126
void rSetHdl(idhdl h)
Definition: ipshell.cc:4696
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiBranchTo ( leftv  r,
leftv  args 
)

Definition at line 1167 of file ipshell.cc.

1168 {
1169  // <string1...stringN>,<proc>
1170  // known: args!=NULL, l>=1
1171  int l=args->listLength();
1172  int ll=0;
1173  if (iiCurrArgs!=NULL) ll=iiCurrArgs->listLength();
1174  if (ll!=(l-1)) return FALSE;
1175  leftv h=args;
1176  short *t=(short*)omAlloc(l*sizeof(short));
1177  t[0]=l-1;
1178  int b;
1179  int i;
1180  for(i=1;i<l;i++,h=h->next)
1181  {
1182  if (h->Typ()!=STRING_CMD)
1183  {
1184  omFree(t);
1185  Werror("arg %d is not a string",i);
1186  return TRUE;
1187  }
1188  int tt;
1189  b=IsCmd((char *)h->Data(),tt);
1190  if(b) t[i]=tt;
1191  else
1192  {
1193  omFree(t);
1194  Werror("arg %d is not a type name",i);
1195  return TRUE;
1196  }
1197  }
1198  if (h->Typ()!=PROC_CMD)
1199  {
1200  omFree(t);
1201  Werror("last arg (%d) is not a proc",i);
1202  return TRUE;
1203  }
1204  b=iiCheckTypes(iiCurrArgs,t,0);
1205  omFree(t);
1206  if (b && (h->rtyp==IDHDL) && (h->e==NULL))
1207  {
1208  BOOLEAN err;
1209  //Print("branchTo: %s\n",h->Name());
1210  iiCurrProc=(idhdl)h->data;
1212  if( pi->data.s.body==NULL )
1213  {
1215  if (pi->data.s.body==NULL) return TRUE;
1216  }
1217  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
1218  {
1219  currPack=pi->pack;
1222  //Print("set pack=%s\n",IDID(currPackHdl));
1223  }
1224  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(iiCurrArgs==NULL));
1226  if (iiCurrArgs!=NULL)
1227  {
1228  if (!err) Warn("too many arguments for %s",IDID(iiCurrProc));
1229  iiCurrArgs->CleanUp();
1231  iiCurrArgs=NULL;
1232  }
1233  return 2-err;
1234  }
1235  return FALSE;
1236 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
idhdl currPackHdl
Definition: ipid.cc:60
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN exitBuffer(feBufferTypes typ)
Definition: fevoices.cc:233
#define IDHDL
Definition: tok.h:35
idhdl iiCurrProc
Definition: ipshell.cc:85
#define omFree(addr)
Definition: omAllocDecl.h:261
idrec * idhdl
Definition: ring.h:18
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:322
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
#define NULL
Definition: omList.c:10
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:6122
package currPack
Definition: ipid.cc:62
leftv iiCurrArgs
Definition: ipshell.cc:84
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
idhdl packFindHdl(package r)
Definition: ipid.cc:729
void iiCheckPack(package &p)
Definition: ipshell.cc:1504
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
utypes data
Definition: idrec.h:40
int IsCmd(const char *n, int &tok)
Definition: iparith.cc:8722
#define Warn
Definition: emacs.cc:80
void iiCheckPack ( package p)

Definition at line 1504 of file ipshell.cc.

1505 {
1506  if (p==basePack) return;
1507 
1508  idhdl t=basePack->idroot;
1509 
1510  while ((t!=NULL) && (IDTYP(t)!=PACKAGE_CMD) && (IDPACKAGE(t)!=p)) t=t->next;
1511 
1512  if (t==NULL)
1513  {
1514  WarnS("package not found\n");
1515  p=basePack;
1516  }
1517  return;
1518 }
return P p
Definition: myNF.cc:203
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl next
Definition: idrec.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
BOOLEAN iiCheckRing ( int  i)

Definition at line 1460 of file ipshell.cc.

1461 {
1462  if (currRing==NULL)
1463  {
1464  #ifdef SIQ
1465  if (siq<=0)
1466  {
1467  #endif
1468  if (RingDependend(i))
1469  {
1470  WerrorS("no ring active");
1471  return TRUE;
1472  }
1473  #ifdef SIQ
1474  }
1475  #endif
1476  }
1477  return FALSE;
1478 }
#define FALSE
Definition: auxiliary.h:140
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int RingDependend(int t)
Definition: gentable.cc:23
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
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 6122 of file ipshell.cc.

6123 {
6124  if (args==NULL)
6125  {
6126  if (type_list[0]==0) return TRUE;
6127  else
6128  {
6129  if (report) WerrorS("no arguments expected");
6130  return FALSE;
6131  }
6132  }
6133  int l=args->listLength();
6134  if (l!=(int)type_list[0])
6135  {
6136  if (report) iiReportTypes(0,l,type_list);
6137  return FALSE;
6138  }
6139  for(int i=1;i<=l;i++,args=args->next)
6140  {
6141  short t=type_list[i];
6142  if (t!=ANY_TYPE)
6143  {
6144  if (((t==IDHDL)&&(args->rtyp!=IDHDL))
6145  || (t!=args->Typ()))
6146  {
6147  if (report) iiReportTypes(i,args->Typ(),type_list);
6148  return FALSE;
6149  }
6150  }
6151  }
6152  return TRUE;
6153 }
#define ANY_TYPE
Definition: tok.h:34
#define FALSE
Definition: auxiliary.h:140
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define IDHDL
Definition: tok.h:35
static void iiReportTypes(int nr, int t, const short *T)
Definition: ipshell.cc:6104
int i
Definition: cfEzgcd.cc:123
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
char* iiConvName ( const char *  libname)

Definition at line 1277 of file iplib.cc.

1278 {
1279  char *tmpname = omStrDup(libname);
1280  char *p = strrchr(tmpname, DIR_SEP);
1281  char *r;
1282  if(p==NULL) p = tmpname;
1283  else p++;
1284  r = (char *)strchr(p, '.');
1285  if( r!= NULL) *r = '\0';
1286  r = omStrDup(p);
1287  *r = mytoupper(*r);
1288  // printf("iiConvName: '%s' '%s' => '%s'\n", libname, tmpname, r);
1289  omFree((ADDRESS)tmpname);
1290 
1291  return(r);
1292 }
char mytoupper(char c)
Definition: iplib.cc:1258
return P p
Definition: myNF.cc:203
void * ADDRESS
Definition: auxiliary.h:161
#define DIR_SEP
Definition: feResource.h:6
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
#define omStrDup(s)
Definition: omAllocDecl.h:263
void iiDebug ( )

Definition at line 974 of file ipshell.cc.

975 {
976 #ifdef HAVE_SDB
977  sdb_flags=1;
978 #endif
979  Print("\n-- break point in %s --\n",VoiceName());
981  char * s;
983  s = (char *)omAlloc(BREAK_LINE_LENGTH+4);
984  loop
985  {
986  memset(s,0,80);
988  if (s[BREAK_LINE_LENGTH-1]!='\0')
989  {
990  Print("line too long, max is %d chars\n",BREAK_LINE_LENGTH);
991  }
992  else
993  break;
994  }
995  if (*s=='\n')
996  {
998  }
999 #if MDEBUG
1000  else if(strncmp(s,"cont;",5)==0)
1001  {
1003  }
1004 #endif /* MDEBUG */
1005  else
1006  {
1007  strcat( s, "\n;~\n");
1008  newBuffer(s,BT_execute);
1009  }
1010 }
void VoiceBackTrack()
Definition: fevoices.cc:77
const CanonicalForm int s
Definition: facAbsFact.cc:55
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
int sdb_flags
Definition: sdb.cc:32
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiDebugMarker
Definition: ipshell.cc:972
const char * VoiceName()
Definition: fevoices.cc:66
#define BREAK_LINE_LENGTH
Definition: ipshell.cc:973
void newBuffer(char *s, feBufferTypes t, procinfo *pi, int lineno)
Definition: fevoices.cc:171
int iiDeclCommand ( leftv  sy,
leftv  name,
int  lev,
int  t,
idhdl root,
BOOLEAN  isring = FALSE,
BOOLEAN  init_b = TRUE 
)

Definition at line 1112 of file ipshell.cc.

1113 {
1114  BOOLEAN res=FALSE;
1115  const char *id = name->name;
1116 
1117  memset(sy,0,sizeof(sleftv));
1118  if ((name->name==NULL)||(isdigit(name->name[0])))
1119  {
1120  WerrorS("object to declare is not a name");
1121  res=TRUE;
1122  }
1123  else
1124  {
1125  if (TEST_V_ALLWARN
1126  && (name->rtyp!=0)
1127  && (name->rtyp!=IDHDL)
1128  && (currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1129  {
1130  Warn("`%s` is %s in %s:%d:%s",name->name,Tok2Cmdname(name->rtyp),
1132  }
1133  {
1134  sy->data = (char *)enterid(id,lev,t,root,init_b);
1135  }
1136  if (sy->data!=NULL)
1137  {
1138  sy->rtyp=IDHDL;
1139  currid=sy->name=IDID((idhdl)sy->data);
1140  // name->name=NULL; /* used in enterid */
1141  //sy->e = NULL;
1142  if (name->next!=NULL)
1143  {
1145  res=iiDeclCommand(sy->next,name->next,lev,t,root, isring);
1146  }
1147  }
1148  else res=TRUE;
1149  }
1150  name->CleanUp();
1151  return res;
1152 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int yylineno
Definition: febase.cc:45
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
char * filename
Definition: fevoices.h:62
#define TRUE
Definition: auxiliary.h:144
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
const char * currid
Definition: grammar.cc:172
void * data
Definition: subexpr.h:89
poly res
Definition: myNF.cc:322
int myynest
Definition: febase.cc:46
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
#define IDLEV(a)
Definition: ipid.h:120
leftv next
Definition: subexpr.h:87
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1112
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
Voice * currentVoice
Definition: fevoices.cc:57
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80
BOOLEAN iiEStart ( char *  example,
procinfo pi 
)

Definition at line 665 of file iplib.cc.

666 {
667  BOOLEAN err;
668  int old_echo=si_echo;
669 
670  iiCheckNest();
671  procstack->push(example);
672 #ifdef USE_IILOCALRING
674 #endif
676  {
677  if (traceit&TRACE_SHOW_LINENO) printf("\n");
678  printf("entering example (level %d)\n",myynest);
679  }
680  myynest++;
681 
682  err=iiAllStart(pi,example,BT_example,(pi != NULL ? pi->data.s.example_lineno: 0));
683 
685  myynest--;
686  si_echo=old_echo;
687  if (traceit&TRACE_SHOW_PROC)
688  {
689  if (traceit&TRACE_SHOW_LINENO) printf("\n");
690  printf("leaving -example- (level %d)\n",myynest);
691  }
692 #ifdef USE_IILOCALRING
693  if (iiLocalRing[myynest] != currRing)
694  {
695  if (iiLocalRing[myynest]!=NULL)
696  {
699  }
700  else
701  {
703  currRing=NULL;
704  }
705  }
706 #else /* USE_IILOCALRING */
707 #endif /* USE_IILOCALRING */
708  if (NS_LRING != currRing)
709  {
710  if (NS_LRING!=NULL)
711  {
713  if ((rh==NULL)||(IDRING(rh)!=NS_LRING))
714  rh=rFindHdl(NS_LRING,NULL);
715  rSetHdl(rh);
716  }
717  else
718  {
720  currRing=NULL;
721  }
722  }
723 //#endif /* USE_IILOCALRING */
724  procstack->pop();
725  return err;
726 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:28
proclevel * procstack
Definition: ipid.cc:57
int traceit
Definition: febase.cc:47
idhdl cRingHdl
Definition: ipid.h:60
static void iiCheckNest()
Definition: iplib.cc:560
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void killlocals(int v)
Definition: ipshell.cc:385
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1565
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:322
ring * iiLocalRing
Definition: iplib.cc:525
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
#define TRACE_SHOW_PROC
Definition: reporter.h:26
void rSetHdl(idhdl h)
Definition: ipshell.cc:4696
void push(char *)
Definition: ipid.cc:699
void pop()
Definition: ipid.cc:711
int BOOLEAN
Definition: auxiliary.h:131
#define NS_LRING
Definition: iplib.cc:60
int si_echo
Definition: febase.cc:41
BOOLEAN iiExport ( leftv  v,
int  toLev 
)

Definition at line 1380 of file ipshell.cc.

1381 {
1382  BOOLEAN nok=FALSE;
1383  leftv r=v;
1384  while (v!=NULL)
1385  {
1386  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL))
1387  {
1388  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1389  nok=TRUE;
1390  }
1391  else
1392  {
1393  if(iiInternalExport(v, toLev))
1394  {
1395  r->CleanUp();
1396  return TRUE;
1397  }
1398  }
1399  v=v->next;
1400  }
1401  r->CleanUp();
1402  return nok;
1403 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
const char * name
Definition: subexpr.h:88
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1272
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1406 of file ipshell.cc.

1407 {
1408 #ifdef SINGULAR_4_1
1409  if ((pack==basePack)&&(pack!=currPack))
1410  { Warn("'exportto' to Top is depreciated in >>%s<<",my_yylinebuf);}
1411 #endif
1412  BOOLEAN nok=FALSE;
1413  leftv rv=v;
1414  while (v!=NULL)
1415  {
1416  if ((v->name==NULL)||(v->rtyp==0)||(v->e!=NULL)
1417  )
1418  {
1419  Werror("cannot export:%s of internal type %d",v->name,v->rtyp);
1420  nok=TRUE;
1421  }
1422  else
1423  {
1424  idhdl old=pack->idroot->get( v->name,toLev);
1425  if (old!=NULL)
1426  {
1427  if ((pack==currPack) && (old==(idhdl)v->data))
1428  {
1429  if (BVERBOSE(V_REDEFINE)) Warn("`%s` is already global",IDID(old));
1430  break;
1431  }
1432  else if (IDTYP(old)==v->Typ())
1433  {
1434  if (BVERBOSE(V_REDEFINE))
1435  {
1436  Warn("redefining %s",IDID(old));
1437  }
1438  v->name=omStrDup(v->name);
1439  killhdl2(old,&(pack->idroot),currRing);
1440  }
1441  else
1442  {
1443  rv->CleanUp();
1444  return TRUE;
1445  }
1446  }
1447  //Print("iiExport: pack=%s\n",IDID(root));
1448  if(iiInternalExport(v, toLev, pack))
1449  {
1450  rv->CleanUp();
1451  return TRUE;
1452  }
1453  }
1454  v=v->next;
1455  }
1456  rv->CleanUp();
1457  return nok;
1458 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Subexpr e
Definition: subexpr.h:106
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
char my_yylinebuf[80]
Definition: febase.cc:48
const char * name
Definition: subexpr.h:88
leftv next
Definition: subexpr.h:87
#define BVERBOSE(a)
Definition: options.h:33
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1272
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
#define V_REDEFINE
Definition: options.h:43
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiExprArith1 ( leftv  res,
sleftv a,
int  op 
)
BOOLEAN iiExprArith1Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd1 dA1,
int  at,
struct sConvertTypes dConvertTypes 
)

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

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

Definition at line 8185 of file iparith.cc.

8186 {
8187  memset(res,0,sizeof(sleftv));
8188  BOOLEAN call_failed=FALSE;
8189 
8190  if (!errorreported)
8191  {
8192  BOOLEAN failed=FALSE;
8193  iiOp=op;
8194  int i = 0;
8195  while (dA1[i].cmd==op)
8196  {
8197  if (at==dA1[i].arg)
8198  {
8199  if (currRing!=NULL)
8200  {
8201  if (check_valid(dA1[i].valid_for,op)) break;
8202  }
8203  else
8204  {
8205  if (RingDependend(dA1[i].res))
8206  {
8207  WerrorS("no ring active");
8208  break;
8209  }
8210  }
8211  if (traceit&TRACE_CALL)
8212  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(at));
8213  res->rtyp=dA1[i].res;
8214  if ((call_failed=dA1[i].p(res,a)))
8215  {
8216  break;// leave loop, goto error handling
8217  }
8218  if (a->Next()!=NULL)
8219  {
8221  failed=iiExprArith1(res->next,a->next,op);
8222  }
8223  a->CleanUp();
8224  return failed;
8225  }
8226  i++;
8227  }
8228  // implicite type conversion --------------------------------------------
8229  if (dA1[i].cmd!=op)
8230  {
8232  i=0;
8233  //Print("fuer %c , typ: %s\n",op,Tok2Cmdname(at));
8234  while (dA1[i].cmd==op)
8235  {
8236  int ai;
8237  //Print("test %s\n",Tok2Cmdname(dA1[i].arg));
8238  if ((ai=iiTestConvert(at,dA1[i].arg,dConvertTypes))!=0)
8239  {
8240  if (currRing!=NULL)
8241  {
8242  if (check_valid(dA1[i].valid_for,op)) break;
8243  }
8244  else
8245  {
8246  if (RingDependend(dA1[i].res))
8247  {
8248  WerrorS("no ring active");
8249  break;
8250  }
8251  }
8252  if (traceit&TRACE_CALL)
8253  Print("call %s(%s)\n",iiTwoOps(op),Tok2Cmdname(dA1[i].arg));
8254  res->rtyp=dA1[i].res;
8255  failed= ((iiConvert(at,dA1[i].arg,ai,a,an,dConvertTypes))
8256  || (call_failed=dA1[i].p(res,an)));
8257  // everything done, clean up temp. variables
8258  if (failed)
8259  {
8260  // leave loop, goto error handling
8261  break;
8262  }
8263  else
8264  {
8265  if (an->Next() != NULL)
8266  {
8267  res->next = (leftv)omAllocBin(sleftv_bin);
8268  failed=iiExprArith1(res->next,an->next,op);
8269  }
8270  // everything ok, clean up and return
8271  an->CleanUp();
8273  a->CleanUp();
8274  return failed;
8275  }
8276  }
8277  i++;
8278  }
8279  an->CleanUp();
8281  }
8282  // error handling
8283  if (!errorreported)
8284  {
8285  if ((at==0) && (a->Fullname()!=sNoName))
8286  {
8287  Werror("`%s` is not defined",a->Fullname());
8288  }
8289  else
8290  {
8291  i=0;
8292  const char *s = iiTwoOps(op);
8293  Werror("%s(`%s`) failed"
8294  ,s,Tok2Cmdname(at));
8295  if ((!call_failed) && BVERBOSE(V_SHOW_USE))
8296  {
8297  while (dA1[i].cmd==op)
8298  {
8299  if ((dA1[i].res!=0)
8300  && (dA1[i].p!=jjWRONG))
8301  Werror("expected %s(`%s`)"
8302  ,s,Tok2Cmdname(dA1[i].arg));
8303  i++;
8304  }
8305  }
8306  }
8307  }
8308  res->rtyp = UNKNOWN;
8309  }
8310  a->CleanUp();
8311  return TRUE;
8312 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8313
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:144
#define UNKNOWN
Definition: tok.h:171
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
short res
Definition: gentable.cc:70
const char * Fullname()
Definition: subexpr.h:126
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define V_SHOW_USE
Definition: options.h:50
static BOOLEAN check_valid(const int p, const int op)
Definition: iparith.cc:9121
const char * Tok2Cmdname(int tok)
Definition: iparith.cc:8844
int RingDependend(int t)
Definition: gentable.cc:23
const char * iiTwoOps(int t)
Definition: gentable.cc:250
static BOOLEAN jjWRONG(leftv, leftv)
Definition: iparith.cc:3664
leftv Next()
Definition: subexpr.h:137
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define TRACE_CALL
Definition: reporter.h:41
short errorreported
Definition: feFopen.cc:22
leftv next
Definition: subexpr.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int iiOp
Definition: iparith.cc:239
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiExprArith2 ( leftv  res,
sleftv a,
int  op,
sleftv b,
BOOLEAN  proccall = FALSE 
)
BOOLEAN iiExprArith2Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd2 dA2,
int  at,
struct sConvertTypes dConvertTypes 
)

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

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

Definition at line 8113 of file iparith.cc.

8117 {
8118  leftv b=a->next;
8119  a->next=NULL;
8120  int bt=b->Typ();
8121  BOOLEAN bo=iiExprArith2TabIntern(res,a,op,b,TRUE,dA2,at,bt,dConvertTypes);
8122  a->next=b;
8123  a->CleanUp();
8124  return bo;
8125 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
leftv next
Definition: subexpr.h:87
static BOOLEAN iiExprArith2TabIntern(leftv res, leftv a, int op, leftv b, BOOLEAN proccall, struct sValCmd2 *dA2, int at, int bt, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:7954
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
BOOLEAN iiExprArith3 ( leftv  res,
int  op,
leftv  a,
leftv  b,
leftv  c 
)

Definition at line 8525 of file iparith.cc.

8526 {
8527  memset(res,0,sizeof(sleftv));
8528 
8529  if (!errorreported)
8530  {
8531 #ifdef SIQ
8532  if (siq>0)
8533  {
8534  //Print("siq:%d\n",siq);
8536  memcpy(&d->arg1,a,sizeof(sleftv));
8537  //a->Init();
8538  memcpy(&d->arg2,b,sizeof(sleftv));
8539  //b->Init();
8540  memcpy(&d->arg3,c,sizeof(sleftv));
8541  //c->Init();
8542  d->op=op;
8543  d->argc=3;
8544  res->data=(char *)d;
8545  res->rtyp=COMMAND;
8546  return FALSE;
8547  }
8548 #endif
8549  int at=a->Typ();
8550  // handling bb-objects ----------------------------------------------
8551  if (at>MAX_TOK)
8552  {
8553  blackbox *bb=getBlackboxStuff(at);
8554  if (bb!=NULL)
8555  {
8556  if(!bb->blackbox_Op3(op,res,a,b,c)) return FALSE;
8557  if (errorreported) return TRUE;
8558  // else: no op defined
8559  }
8560  else return TRUE;
8561  if (errorreported) return TRUE;
8562  }
8563  int bt=b->Typ();
8564  int ct=c->Typ();
8565 
8566  iiOp=op;
8567  int i=0;
8568  while ((dArith3[i].cmd!=op)&&(dArith3[i].cmd!=0)) i++;
8569  return iiExprArith3TabIntern(res,op,a,b,c,dArith3+i,at,bt,ct,dConvertTypes);
8570  }
8571  a->CleanUp();
8572  b->CleanUp();
8573  c->CleanUp();
8574  //Print("op: %d,result typ:%d\n",op,res->rtyp);
8575  return TRUE;
8576 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
ip_command * command
Definition: ipid.h:24
#define FALSE
Definition: auxiliary.h:140
Definition: tok.h:167
BOOLEAN siq
Definition: subexpr.cc:58
#define TRUE
Definition: auxiliary.h:144
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
struct sValCmd3 dArith3[]
Definition: table.h:663
int i
Definition: cfEzgcd.cc:123
short errorreported
Definition: feFopen.cc:22
struct sConvertTypes dConvertTypes[]
Definition: table.h:1117
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, struct sValCmd3 *dA3, int at, int bt, int ct, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8371
#define NULL
Definition: omList.c:10
omBin sip_command_bin
Definition: ipid.cc:48
int rtyp
Definition: subexpr.h:92
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int iiOp
Definition: iparith.cc:239
#define COMMAND
Definition: tok.h:33
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
BOOLEAN iiExprArith3Tab ( leftv  res,
leftv  a,
int  op,
struct sValCmd3 dA3,
int  at,
struct sConvertTypes dConvertTypes 
)

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

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

Definition at line 8577 of file iparith.cc.

8581 {
8582  leftv b=a->next;
8583  a->next=NULL;
8584  int bt=b->Typ();
8585  leftv c=b->next;
8586  b->next=NULL;
8587  int ct=c->Typ();
8588  BOOLEAN bo=iiExprArith3TabIntern(res,op,a,b,c,dA3,at,bt,ct,dConvertTypes);
8589  b->next=c;
8590  a->next=b;
8591  a->CleanUp();
8592  return bo;
8593 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Typ()
Definition: subexpr.cc:955
leftv next
Definition: subexpr.h:87
static BOOLEAN iiExprArith3TabIntern(leftv res, int op, leftv a, leftv b, leftv c, struct sValCmd3 *dA3, int at, int bt, int ct, struct sConvertTypes *dConvertTypes)
Definition: iparith.cc:8371
#define NULL
Definition: omList.c:10
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
BOOLEAN iiExprArithM ( leftv  res,
sleftv a,
int  op 
)
char* iiGetLibName ( procinfov  v)

Definition at line 101 of file iplib.cc.

102 {
103  return pi->libname;
104 }
#define pi
Definition: libparse.cc:1143
char* iiGetLibProcBuffer ( procinfov  pi,
int  part = 1 
)
poly iiHighCorner ( ideal  i,
int  ak 
)

Definition at line 1480 of file ipshell.cc.

1481 {
1482  int i;
1483  if(!idIsZeroDim(I)) return NULL; // not zero-dim.
1484  poly po=NULL;
1486  {
1487  scComputeHC(I,currRing->qideal,ak,po);
1488  if (po!=NULL)
1489  {
1490  pGetCoeff(po)=nInit(1);
1491  for (i=rVar(currRing); i>0; i--)
1492  {
1493  if (pGetExp(po, i) > 0) pDecrExp(po,i);
1494  }
1495  pSetComp(po,ak);
1496  pSetm(po);
1497  }
1498  }
1499  else
1500  po=pOne();
1501  return po;
1502 }
#define pSetm(p)
Definition: polys.h:241
#define pDecrExp(p, i)
Definition: polys.h:44
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define rHasLocalOrMixedOrdering_currRing()
Definition: ring.h:760
#define NULL
Definition: omList.c:10
strat ak
Definition: myNF.cc:321
BOOLEAN idIsZeroDim(ideal i)
Definition: ideals.h:176
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
BOOLEAN iiInternalExport ( leftv  v,
int  toLev,
package  pack 
)

Definition at line 1334 of file ipshell.cc.

1335 {
1336  idhdl h=(idhdl)v->data;
1337  if(h==NULL)
1338  {
1339  Warn("'%s': no such identifier\n", v->name);
1340  return FALSE;
1341  }
1342  package frompack=v->req_packhdl;
1343  if (frompack==NULL) frompack=currPack;
1344  if ((RingDependend(IDTYP(h)))
1345  || ((IDTYP(h)==LIST_CMD)
1346  && (lRingDependend(IDLIST(h)))
1347  )
1348  )
1349  {
1350  //Print("// ==> Ringdependent set nesting to 0\n");
1351  return (iiInternalExport(v, toLev));
1352  }
1353  else
1354  {
1355  IDLEV(h)=toLev;
1356  v->req_packhdl=rootpack;
1357  if (h==frompack->idroot)
1358  {
1359  frompack->idroot=h->next;
1360  }
1361  else
1362  {
1363  idhdl hh=frompack->idroot;
1364  while ((hh!=NULL) && (hh->next!=h))
1365  hh=hh->next;
1366  if ((hh!=NULL) && (hh->next==h))
1367  hh->next=h->next;
1368  else
1369  {
1370  Werror("`%s` not found",v->Name());
1371  return TRUE;
1372  }
1373  }
1374  h->next=rootpack->idroot;
1375  rootpack->idroot=h;
1376  }
1377  return FALSE;
1378 }
#define IDLIST(a)
Definition: ipid.h:136
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
#define IDTYP(a)
Definition: ipid.h:118
int RingDependend(int t)
Definition: gentable.cc:23
const char * name
Definition: subexpr.h:88
idrec * idhdl
Definition: ring.h:18
idhdl next
Definition: idrec.h:38
#define IDLEV(a)
Definition: ipid.h:120
static BOOLEAN iiInternalExport(leftv v, int toLev)
Definition: ipshell.cc:1272
#define NULL
Definition: omList.c:10
package req_packhdl
Definition: subexpr.h:107
package currPack
Definition: ipid.cc:62
Definition: tok.h:96
static Poly * h
Definition: janet.cc:978
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
BOOLEAN iiLibCmd ( char *  newlib,
BOOLEAN  autoexport,
BOOLEAN  tellerror,
BOOLEAN  force 
)

Definition at line 811 of file iplib.cc.

812 {
813  char libnamebuf[128];
814  // procinfov pi;
815  // idhdl h;
816  idhdl pl;
817  // idhdl hl;
818  // long pos = 0L;
819  char *plib = iiConvName(newlib);
820  FILE * fp = feFopen( newlib, "r", libnamebuf, tellerror );
821  // int lines = 1;
822  BOOLEAN LoadResult = TRUE;
823 
824  if (fp==NULL)
825  {
826  return TRUE;
827  }
828  pl = basePack->idroot->get(plib,0);
829  if (pl==NULL)
830  {
831  pl = enterid( plib,0, PACKAGE_CMD,
832  &(basePack->idroot), TRUE );
833  IDPACKAGE(pl)->language = LANG_SINGULAR;
834  IDPACKAGE(pl)->libname=omStrDup(newlib);
835  }
836  else
837  {
838  if(IDTYP(pl)!=PACKAGE_CMD)
839  {
840  WarnS("not of type package.");
841  fclose(fp);
842  return TRUE;
843  }
844  if (!force) return FALSE;
845  }
846  LoadResult = iiLoadLIB(fp, libnamebuf, newlib, pl, autoexport, tellerror);
847  omFree((ADDRESS)newlib);
848 
849  if(!LoadResult) IDPACKAGE(pl)->loaded = TRUE;
850  omFree((ADDRESS)plib);
851 
852  return LoadResult;
853 }
CanonicalForm fp
Definition: cfModGcd.cc:4043
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
#define WarnS
Definition: emacs.cc:81
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define omFree(addr)
Definition: omAllocDecl.h:261
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
char libnamebuf[128]
Definition: libparse.cc:1096
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:900
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
int BOOLEAN
Definition: auxiliary.h:131
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN iiLoadLIB ( FILE *  fp,
const char *  libnamebuf,
const char *  newlib,
idhdl  pl,
BOOLEAN  autoexport,
BOOLEAN  tellerror 
)

Definition at line 900 of file iplib.cc.

902 {
903  extern FILE *yylpin;
904  libstackv ls_start = library_stack;
905  lib_style_types lib_style;
906 
907  yylpin = fp;
908  #if YYLPDEBUG > 1
909  print_init();
910  #endif
911  extern int lpverbose;
912  if (BVERBOSE(V_DEBUG_LIB)) lpverbose=1;
913  else lpverbose=0;
914  // yylplex sets also text_buffer
915  if (text_buffer!=NULL) *text_buffer='\0';
916  yylplex(newlib, libnamebuf, &lib_style, pl, autoexport);
917  if(yylp_errno)
918  {
919  Werror("Library %s: ERROR occured: in line %d, %d.", newlib, yylplineno,
920  current_pos(0));
922  {
926  }
927  else
929  Werror("Cannot load library,... aborting.");
930  reinit_yylp();
931  fclose( yylpin );
933  return TRUE;
934  }
935  if (BVERBOSE(V_LOAD_LIB))
936  Print( "// ** loaded %s %s\n", libnamebuf, text_buffer);
937  if( (lib_style == OLD_LIBSTYLE) && (BVERBOSE(V_LOAD_LIB)))
938  {
939  Warn( "library %s has old format. This format is still accepted,", newlib);
940  Warn( "but for functionality you may wish to change to the new");
941  Warn( "format. Please refer to the manual for further information.");
942  }
943  reinit_yylp();
944  fclose( yylpin );
945  fp = NULL;
946  iiRunInit(IDPACKAGE(pl));
947 
948  {
949  libstackv ls;
950  for(ls = library_stack; (ls != NULL) && (ls != ls_start); )
951  {
952  if(ls->to_be_done)
953  {
954  ls->to_be_done=FALSE;
955  iiLibCmd(ls->get(),autoexport,tellerror,FALSE);
956  ls = ls->pop(newlib);
957  }
958  }
959 #if 0
960  PrintS("--------------------\n");
961  for(ls = library_stack; ls != NULL; ls = ls->next)
962  {
963  Print("%s: LIB-stack:(%d), %s %s\n", newlib, ls->cnt, ls->get(),
964  ls->to_be_done ? "not loaded" : "loaded");
965  }
966  PrintS("--------------------\n");
967 #endif
968  }
969 
970  if(fp != NULL) fclose(fp);
971  return FALSE;
972 }
int cnt
Definition: subexpr.h:167
#define Print
Definition: emacs.cc:83
CanonicalForm fp
Definition: cfModGcd.cc:4043
int yylplex(const char *libname, const char *libfile, lib_style_types *lib_style, idhdl pl, BOOLEAN autoexport=FALSE, lp_modes=LOAD_LIB)
libstackv next
Definition: subexpr.h:164
#define FALSE
Definition: auxiliary.h:140
static void iiRunInit(package p)
Definition: iplib.cc:884
#define V_LOAD_LIB
Definition: options.h:45
#define IDROOT
Definition: ipid.h:20
BOOLEAN to_be_done
Definition: subexpr.h:166
#define TRUE
Definition: auxiliary.h:144
void print_init()
Definition: libparse.cc:3483
void * ADDRESS
Definition: auxiliary.h:161
char * get()
Definition: subexpr.h:170
#define V_DEBUG_LIB
Definition: options.h:46
libstackv pop(const char *p)
Definition: iplib.cc:1366
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:811
#define IDPACKAGE(a)
Definition: ipid.h:138
#define YYLP_BAD_CHAR
Definition: libparse.h:93
int lpverbose
Definition: libparse.cc:1104
int yylp_errno
Definition: libparse.cc:1128
#define omFree(addr)
Definition: omAllocDecl.h:261
char * yylp_errlist[]
Definition: libparse.cc:1112
void PrintS(const char *s)
Definition: reporter.cc:294
#define BVERBOSE(a)
Definition: options.h:33
#define NULL
Definition: omList.c:10
char * text_buffer
Definition: libparse.cc:1097
int current_pos(int i=0)
Definition: libparse.cc:3347
lib_style_types
Definition: libparse.h:9
char libnamebuf[128]
Definition: libparse.cc:1096
static void iiCleanProcs(idhdl &root)
Definition: iplib.cc:855
void Werror(const char *fmt,...)
Definition: reporter.cc:199
libstackv library_stack
Definition: iplib.cc:74
int yylplineno
Definition: libparse.cc:1102
#define Warn
Definition: emacs.cc:80
void reinit_yylp()
Definition: libparse.cc:3377
BOOLEAN iiLocateLib ( const char *  lib,
char *  where 
)

Definition at line 797 of file iplib.cc.

798 {
799  char *plib = iiConvName(lib);
800  idhdl pl = basePack->idroot->get(plib,0);
801  if( (pl!=NULL) && (IDTYP(pl)==PACKAGE_CMD) &&
802  (IDPACKAGE(pl)->language == LANG_SINGULAR))
803  {
804  strncpy(where,IDPACKAGE(pl)->libname,127);
805  return TRUE;
806  }
807  else
808  return FALSE;;
809 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
BOOLEAN iiMake_proc ( idhdl  pn,
package  pack,
sleftv sl 
)

Definition at line 573 of file iplib.cc.

574 {
575  int err;
576  procinfov pi = IDPROC(pn);
577  if(pi->is_static && myynest==0)
578  {
579  Werror("'%s::%s()' is a local procedure and cannot be accessed by an user.",
580  pi->libname, pi->procname);
581  return TRUE;
582  }
583  iiCheckNest();
584 #ifdef USE_IILOCALRING
586  //Print("currRing(%d):%s(%x) in %s\n",myynest,IDID(currRingHdl),currRing,IDID(pn));
587 #endif
588  iiRETURNEXPR.Init();
589  procstack->push(pi->procname);
591  || (pi->trace_flag&TRACE_SHOW_PROC))
592  {
594  Print("entering%-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
595  }
596 #ifdef RDEBUG
598 #endif
599  switch (pi->language)
600  {
601  default:
602  case LANG_NONE:
603  WerrorS("undefined proc");
604  err=TRUE;
605  break;
606 
607  case LANG_SINGULAR:
608  if ((pi->pack!=NULL)&&(currPack!=pi->pack))
609  {
610  currPack=pi->pack;
613  //Print("set pack=%s\n",IDID(currPackHdl));
614  }
615  else if ((pack!=NULL)&&(currPack!=pack))
616  {
617  currPack=pack;
620  //Print("set pack=%s\n",IDID(currPackHdl));
621  }
622  err=iiPStart(pn,sl);
623  break;
624  case LANG_C:
626  err = (pi->data.o.function)(res, sl);
627  memcpy(&iiRETURNEXPR,res,sizeof(iiRETURNEXPR));
629  break;
630  }
631  if ((traceit&TRACE_SHOW_PROC)
632  || (pi->trace_flag&TRACE_SHOW_PROC))
633  {
634  if (traceit&TRACE_SHOW_LINENO) PrintLn();
635  Print("leaving %-*.*s %s (level %d)\n",myynest*2,myynest*2," ",IDID(pn),myynest);
636  }
637  //const char *n="NULL";
638  //if (currRingHdl!=NULL) n=IDID(currRingHdl);
639  //Print("currRing(%d):%s(%x) after %s\n",myynest,n,currRing,IDID(pn));
640 #ifdef RDEBUG
641  if (traceit&TRACE_SHOW_RINGS) iiShowLevRings();
642 #endif
643  if (err)
644  {
646  //iiRETURNEXPR.Init(); //done by CleanUp
647  }
648  if (iiCurrArgs!=NULL)
649  {
650  if (!err) Warn("too many arguments for %s",IDID(pn));
651  iiCurrArgs->CleanUp();
654  }
655  procstack->pop();
656  if (err)
657  return TRUE;
658  return FALSE;
659 }
#define TRACE_SHOW_LINENO
Definition: reporter.h:28
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define TRACE_SHOW_RINGS
Definition: reporter.h:33
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
package pack
Definition: subexpr.h:57
idhdl currPackHdl
Definition: ipid.cc:60
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:527
language_defs language
Definition: subexpr.h:58
proclevel * procstack
Definition: ipid.cc:57
static void iiShowLevRings()
Definition: iplib.cc:531
#define TRUE
Definition: auxiliary.h:144
void Init()
Definition: subexpr.h:108
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
int traceit
Definition: febase.cc:47
static void iiCheckNest()
Definition: iplib.cc:560
char * procname
Definition: subexpr.h:56
poly res
Definition: myNF.cc:322
Definition: subexpr.h:20
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
char * libname
Definition: subexpr.h:55
procinfodata data
Definition: subexpr.h:62
omBin sleftv_bin
Definition: subexpr.cc:50
char is_static
Definition: subexpr.h:60
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
ring * iiLocalRing
Definition: iplib.cc:525
#define NULL
Definition: omList.c:10
BOOLEAN iiPStart(idhdl pn, sleftv *v)
Definition: iplib.cc:382
package currPack
Definition: ipid.cc:62
leftv iiCurrArgs
Definition: ipshell.cc:84
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define TRACE_SHOW_PROC
Definition: reporter.h:26
idhdl packFindHdl(package r)
Definition: ipid.cc:729
void iiCheckPack(package &p)
Definition: ipshell.cc:1504
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:699
void pop()
Definition: ipid.cc:711
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
void iiMakeResolv ( resolvente  r,
int  length,
int  rlen,
char *  name,
int  typ0,
intvec **  weights = NULL 
)

Definition at line 765 of file ipshell.cc.

767 {
768  lists L=liMakeResolv(r,length,rlen,typ0,weights);
769  int i=0;
770  idhdl h;
771  char * s=(char *)omAlloc(strlen(name)+5);
772 
773  while (i<=L->nr)
774  {
775  sprintf(s,"%s(%d)",name,i+1);
776  if (i==0)
777  h=enterid(s,myynest,typ0,&(currRing->idroot), FALSE);
778  else
779  h=enterid(s,myynest,MODUL_CMD,&(currRing->idroot), FALSE);
780  if (h!=NULL)
781  {
782  h->data.uideal=(ideal)L->m[i].data;
783  h->attribute=L->m[i].attribute;
785  Print("//defining: %s as %d-th syzygy module\n",s,i+1);
786  }
787  else
788  {
789  idDelete((ideal *)&(L->m[i].data));
790  Warn("cannot define %s",s);
791  }
792  //L->m[i].data=NULL;
793  //L->m[i].rtyp=0;
794  //L->m[i].attribute=NULL;
795  i++;
796  }
797  omFreeSize((ADDRESS)L->m,(L->nr+1)*sizeof(sleftv));
799  omFreeSize((ADDRESS)s,strlen(name)+5);
800 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define V_DEF_RES
Definition: options.h:48
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define BVERBOSE(a)
Definition: options.h:33
int nr
Definition: lists.h:43
char name(const Variable &v)
Definition: variable.h:95
#define NULL
Definition: omList.c:10
attr attribute
Definition: idrec.h:41
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
utypes data
Definition: idrec.h:40
#define Warn
Definition: emacs.cc:80
leftv iiMap ( map  theMap,
const char *  what 
)

Definition at line 615 of file ipshell.cc.

616 {
617  idhdl w,r;
618  leftv v;
619  int i;
620  nMapFunc nMap;
621 
622  r=IDROOT->get(theMap->preimage,myynest);
623  if ((currPack!=basePack)
624  &&((r==NULL) || ((r->typ != RING_CMD) && (r->typ != QRING_CMD))))
625  r=basePack->idroot->get(theMap->preimage,myynest);
626  if ((r==NULL) && (currRingHdl!=NULL)
627  && (strcmp(theMap->preimage,IDID(currRingHdl))==0))
628  {
629  r=currRingHdl;
630  }
631  if ((r!=NULL) && ((r->typ == RING_CMD) || (r->typ== QRING_CMD)))
632  {
633  ring src_ring=IDRING(r);
634  if ((nMap=n_SetMap(src_ring->cf, currRing->cf))==NULL)
635  {
636  Werror("can not map from ground field of %s to current ground field",
637  theMap->preimage);
638  return NULL;
639  }
640  if (IDELEMS(theMap)<src_ring->N)
641  {
642  theMap->m=(polyset)omReallocSize((ADDRESS)theMap->m,
643  IDELEMS(theMap)*sizeof(poly),
644  (src_ring->N)*sizeof(poly));
645  for(i=IDELEMS(theMap);i<src_ring->N;i++)
646  theMap->m[i]=NULL;
647  IDELEMS(theMap)=src_ring->N;
648  }
649  if (what==NULL)
650  {
651  WerrorS("argument of a map must have a name");
652  }
653  else if ((w=src_ring->idroot->get(what,myynest))!=NULL)
654  {
655  char *save_r=NULL;
657  sleftv tmpW;
658  memset(&tmpW,0,sizeof(sleftv));
659  tmpW.rtyp=IDTYP(w);
660  if (tmpW.rtyp==MAP_CMD)
661  {
662  tmpW.rtyp=IDEAL_CMD;
663  save_r=IDMAP(w)->preimage;
664  IDMAP(w)->preimage=0;
665  }
666  tmpW.data=IDDATA(w);
667  // check overflow
668  BOOLEAN overflow=FALSE;
669  if ((tmpW.rtyp==IDEAL_CMD)
670  || (tmpW.rtyp==MODUL_CMD)
671  || (tmpW.rtyp==MAP_CMD))
672  {
673  ideal id=(ideal)tmpW.data;
674  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
675  {
676  if (theMap->m[j]!=NULL)
677  {
678  long deg_monexp=pTotaldegree(theMap->m[j]);
679  for(int i=IDELEMS(id)-1;i>=0;i--)
680  {
681  poly p=id->m[i];
682  if ((p!=NULL) && (p_Totaldegree(p,src_ring)!=0) &&
683  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)p_Totaldegree(p,src_ring)/2)))
684  {
685  overflow=TRUE;
686  break;
687  }
688  }
689  }
690  }
691  }
692  else if (tmpW.rtyp==POLY_CMD)
693  {
694  for(int j=IDELEMS(theMap)-1;j>=0 && !overflow;j--)
695  {
696  if (theMap->m[j]!=NULL)
697  {
698  long deg_monexp=pTotaldegree(theMap->m[j]);
699  poly p=(poly)tmpW.data;
700  if ((p!=NULL) && (p_Totaldegree(p,src_ring)!=0) &&
701  ((unsigned long)deg_monexp > (currRing->bitmask / (unsigned long)p_Totaldegree(p,src_ring)/2)))
702  {
703  overflow=TRUE;
704  break;
705  }
706  }
707  }
708  }
709  if (overflow)
710  Warn("possible OVERFLOW in map, max exponent is %ld",currRing->bitmask/2);
711 #if 0
712  if (((tmpW.rtyp==IDEAL_CMD)||(tmpW.rtyp==MODUL_CMD)) && idIs0(IDIDEAL(w)))
713  {
714  v->rtyp=tmpW.rtyp;
715  v->data=idInit(IDELEMS(IDIDEAL(w)),IDIDEAL(w)->rank);
716  }
717  else
718 #endif
719  {
720 #ifdef FAST_MAP
721  if ((tmpW.rtyp==IDEAL_CMD) && (nMap == ndCopyMap)
722 #ifdef HAVE_PLURAL
723  && (!rIsPluralRing(currRing))
724 #endif
725  )
726  {
727  v->rtyp=IDEAL_CMD;
728  char *tmp = theMap->preimage;
729  theMap->preimage=(char*)1L;
730  // map gets 1 as its rank (as an ideal)
731  v->data=fast_map(IDIDEAL(w), src_ring, (ideal)theMap, currRing);
732  theMap->preimage=tmp; // map gets its preimage back
733  }
734  else
735 #endif
736  if (maApplyFetch(MAP_CMD,theMap,v,&tmpW,src_ring,NULL,NULL,0,nMap))
737  {
738  Werror("cannot map %s(%d)",Tok2Cmdname(w->typ),w->typ);
740  if (save_r!=NULL) IDMAP(w)->preimage=save_r;
741  return NULL;
742  }
743  }
744  if (save_r!=NULL)
745  {
746  IDMAP(w)->preimage=save_r;
747  IDMAP((idhdl)v)->preimage=omStrDup(save_r);
748  v->rtyp=MAP_CMD;
749  }
750  return v;
751  }
752  else
753  {
754  Werror("%s undefined in %s",what,theMap->preimage);
755  }
756  }
757  else
758  {
759  Werror("cannot find preimage %s",theMap->preimage);
760  }
761  return NULL;
762 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
number ndCopyMap(number a, const coeffs aRing, const coeffs r)
Definition: numbers.cc:239
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
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:54
#define IDIDEAL(a)
Definition: ipid.h:132
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void * ADDRESS
Definition: auxiliary.h:161
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
int int kStrategy strat if(h==NULL) return NULL
Definition: idrec.h:34
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
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:720
#define IDMAP(a)
Definition: ipid.h:134
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:17
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
const CanonicalForm & w
Definition: facAbsFact.cc:55
package currPack
Definition: ipid.cc:62
int rtyp
Definition: subexpr.h:92
ideal fast_map(ideal map_id, ring map_r, ideal image_id, ring image_r)
Definition: fast_maps.cc:354
int typ
Definition: idrec.h:43
Definition: tok.h:126
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:125
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
int iiOpsTwoChar ( const char *  s)

Definition at line 125 of file ipshell.cc.

126 {
127 /* not handling: &&, ||, ** */
128  if (s[1]=='\0') return s[0];
129  else if (s[2]!='\0') return 0;
130  switch(s[0])
131  {
132  case '.': if (s[1]=='.') return DOTDOT;
133  else return 0;
134  case ':': if (s[1]==':') return COLONCOLON;
135  else return 0;
136  case '-': if (s[1]=='-') return MINUSMINUS;
137  else return 0;
138  case '+': if (s[1]=='+') return PLUSPLUS;
139  else return 0;
140  case '=': if (s[1]=='=') return EQUAL_EQUAL;
141  else return 0;
142  case '<': if (s[1]=='=') return LE;
143  else if (s[1]=='>') return NOTEQUAL;
144  else return 0;
145  case '>': if (s[1]=='=') return GE;
146  else return 0;
147  case '!': if (s[1]=='=') return NOTEQUAL;
148  else return 0;
149  }
150  return 0;
151 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: grammar.cc:271
Definition: grammar.cc:270
BOOLEAN iiParameter ( leftv  p)

Definition at line 1237 of file ipshell.cc.

1238 {
1239  if (iiCurrArgs==NULL)
1240  {
1241  if (strcmp(p->name,"#")==0)
1242  return iiDefaultParameter(p);
1243  Werror("not enough arguments for proc %s",VoiceName());
1244  p->CleanUp();
1245  return TRUE;
1246  }
1247  leftv h=iiCurrArgs;
1248  leftv rest=h->next; /*iiCurrArgs is not NULL here*/
1249  BOOLEAN is_default_list=FALSE;
1250  if (strcmp(p->name,"#")==0)
1251  {
1252  is_default_list=TRUE;
1253  rest=NULL;
1254  }
1255  else
1256  {
1257  h->next=NULL;
1258  }
1259  BOOLEAN res=iiAssign(p,h);
1260  if (is_default_list)
1261  {
1262  iiCurrArgs=NULL;
1263  }
1264  else
1265  {
1266  iiCurrArgs=rest;
1267  }
1268  h->CleanUp();
1270  return res;
1271 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
poly res
Definition: myNF.cc:322
const char * name
Definition: subexpr.h:88
omBin sleftv_bin
Definition: subexpr.cc:50
const char * VoiceName()
Definition: fevoices.cc:66
leftv next
Definition: subexpr.h:87
#define NULL
Definition: omList.c:10
BOOLEAN iiDefaultParameter(leftv p)
Definition: ipshell.cc:1154
leftv iiCurrArgs
Definition: ipshell.cc:84
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
char* iiProcArgs ( char *  e,
BOOLEAN  withParenth 
)

Definition at line 127 of file iplib.cc.

128 {
129  while ((*e==' ') || (*e=='\t') || (*e=='(')) e++;
130  if (*e<' ')
131  {
132  if (withParenth)
133  {
134  // no argument list, allow list #
135  return omStrDup("parameter list #;");
136  }
137  else
138  {
139  // empty list
140  return omStrDup("");
141  }
142  }
143  BOOLEAN in_args;
144  BOOLEAN args_found;
145  char *s;
146  char *argstr=(char *)omAlloc(127); // see ../omalloc/omTables.inc
147  int argstrlen=127;
148  *argstr='\0';
149  int par=0;
150  do
151  {
152  args_found=FALSE;
153  s=e; // set s to the starting point of the arg
154  // and search for the end
155  // skip leading spaces:
156  loop
157  {
158  if ((*s==' ')||(*s=='\t'))
159  s++;
160  else if ((*s=='\n')&&(*(s+1)==' '))
161  s+=2;
162  else // start of new arg or \0 or )
163  break;
164  }
165  e=s;
166  while ((*e!=',')
167  &&((par!=0) || (*e!=')'))
168  &&(*e!='\0'))
169  {
170  if (*e=='(') par++;
171  else if (*e==')') par--;
172  args_found=args_found || (*e>' ');
173  e++;
174  }
175  in_args=(*e==',');
176  if (args_found)
177  {
178  *e='\0';
179  // check for space:
180  if ((int)strlen(argstr)+12 /* parameter + ;*/ +(int)strlen(s)>= argstrlen)
181  {
182  argstrlen*=2;
183  char *a=(char *)omAlloc( argstrlen);
184  strcpy(a,argstr);
185  omFree((ADDRESS)argstr);
186  argstr=a;
187  }
188  // copy the result to argstr
189  if(strncmp(s,"alias ",6)!=0)
190  {
191  strcat(argstr,"parameter ");
192  }
193  strcat(argstr,s);
194  strcat(argstr,"; ");
195  e++; // e was pointing to ','
196  }
197  } while (in_args);
198  return argstr;
199 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
const poly a
Definition: syzextra.cc:212
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
int BOOLEAN
Definition: auxiliary.h:131
#define omStrDup(s)
Definition: omAllocDecl.h:263
char* iiProcName ( char *  buf,
char &  ct,
char *&  e 
)

Definition at line 113 of file iplib.cc.

114 {
115  char *s=buf+5;
116  while (*s==' ') s++;
117  e=s+1;
118  while ((*e>' ') && (*e!='(')) e++;
119  ct=*e;
120  *e='\0';
121  return s;
122 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int status int void * buf
Definition: si_signals.h:59
BOOLEAN iiPStart ( idhdl  pn,
sleftv sl 
)

Definition at line 382 of file iplib.cc.

383 {
384  procinfov pi=NULL;
385  int old_echo=si_echo;
386  BOOLEAN err=FALSE;
387  char save_flags=0;
388 
389  /* init febase ======================================== */
390  /* we do not enter this case if filename != NULL !! */
391  if (pn!=NULL)
392  {
393  pi = IDPROC(pn);
394  if(pi!=NULL)
395  {
396  save_flags=pi->trace_flag;
397  if( pi->data.s.body==NULL )
398  {
399  iiGetLibProcBuffer(pi);
400  if (pi->data.s.body==NULL) return TRUE;
401  }
402 // omUpdateInfo();
403 // int m=om_Info.UsedBytes;
404 // Print("proc %s, mem=%d\n",IDID(pn),m);
405  }
406  }
407  else return TRUE;
408  /* generate argument list ======================================*/
409  if (v!=NULL)
410  {
412  memcpy(iiCurrArgs,v,sizeof(sleftv));
413  memset(v,0,sizeof(sleftv));
414  }
415  else
416  {
418  }
419  iiCurrProc=pn;
420  /* start interpreter ======================================*/
421  myynest++;
422  if (myynest > SI_MAX_NEST)
423  {
424  WerrorS("nesting too deep");
425  err=TRUE;
426  }
427  else
428  {
429  err=iiAllStart(pi,pi->data.s.body,BT_proc,pi->data.s.body_lineno-(v!=NULL));
430 
431 #ifdef USE_IILOCALRING
432 #if 0
433  if(procstack->cRing != iiLocalRing[myynest]) Print("iiMake_proc: 1 ring not saved procs:%x, iiLocal:%x\n",procstack->cRing, iiLocalRing[myynest]);
434 #endif
435  if (iiLocalRing[myynest-1] != currRing)
436  {
438  {
439  //idhdl hn;
440  const char *n;
441  const char *o;
442  idhdl nh=NULL, oh=NULL;
443  if (iiLocalRing[myynest-1]!=NULL)
444  oh=rFindHdl(iiLocalRing[myynest-1],NULL);
445  if (oh!=NULL) o=oh->id;
446  else o="none";
447  if (currRing!=NULL)
448  nh=rFindHdl(currRing,NULL);
449  if (nh!=NULL) n=nh->id;
450  else n="none";
451  Werror("ring change during procedure call: %s -> %s (level %d)",o,n,myynest);
453  err=TRUE;
454  }
455  currRing=iiLocalRing[myynest-1];
456  }
457  if ((currRing==NULL)
458  && (currRingHdl!=NULL))
460  else
461  if ((currRing!=NULL) &&
463  ||(IDLEV(currRingHdl)>=myynest-1)))
464  {
466  iiLocalRing[myynest-1]=NULL;
467  }
468 #else /* USE_IILOCALRING */
469  if (procstack->cRing != currRing)
470  {
471  //if (procstack->cRingHdl!=NULL)
472  //Print("procstack:%s,",IDID(procstack->cRingHdl));
473  //if (currRingHdl!=NULL)
474  //Print(" curr:%s\n",IDID(currRingHdl));
475  //Print("pr:%x, curr: %x\n",procstack->cRing,currRing);
477  {
478  //idhdl hn;
479  const char *n;
480  const char *o;
481  if (procstack->cRing!=NULL)
482  {
483  //PrintS("reset ring\n");
485  o=IDID(procstack->cRingHdl);
488  }
489  else o="none";
490  if (currRing!=NULL) n=IDID(currRingHdl);
491  else n="none";
492  if (currRing==NULL)
493  {
494  Werror("ring change during procedure call: %s -> %s (level %d)",o,n,myynest);
496  err=TRUE;
497  }
498  }
499  if (procstack->cRingHdl!=NULL)
500  {
502  }
503  else
505  }
506 #endif /* USE_IILOCALRING */
507  //Print("kill locals for %s (level %d)\n",IDID(pn),myynest);
508  killlocals(myynest);
509 #ifndef SING_NDEBUG
510  checkall();
511 #endif
512  //Print("end kill locals for %s (%d)\n",IDID(pn),myynest);
513  }
514  myynest--;
515  si_echo=old_echo;
516  if (pi!=NULL)
517  pi->trace_flag=save_flags;
518 // omUpdateInfo();
519 // int m=om_Info.UsedBytes;
520 // Print("exit %s, mem=%d\n",IDID(pn),m);
521  return err;
522 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define Print
Definition: emacs.cc:83
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:527
proclevel * procstack
Definition: ipid.cc:57
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
sleftv * leftv
Definition: structs.h:60
void WerrorS(const char *s)
Definition: feFopen.cc:23
idhdl cRingHdl
Definition: ipid.h:60
Definition: idrec.h:34
idhdl iiCurrProc
Definition: ipshell.cc:85
#define SI_MAX_NEST
Definition: iplib.cc:32
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN RingDependend()
Definition: subexpr.cc:375
void checkall()
Definition: misc_ip.cc:1016
void killlocals(int v)
Definition: ipshell.cc:385
procinfodata data
Definition: subexpr.h:62
idhdl currRingHdl
Definition: ipid.cc:64
omBin sleftv_bin
Definition: subexpr.cc:50
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1565
#define IDLEV(a)
Definition: ipid.h:120
BOOLEAN iiAllStart(procinfov pi, char *p, feBufferTypes t, int l)
Definition: iplib.cc:322
#define IDPROC(a)
Definition: ipid.h:139
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
ring * iiLocalRing
Definition: iplib.cc:525
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
ring cRing
Definition: ipid.h:61
leftv iiCurrArgs
Definition: ipshell.cc:84
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
const char * id
Definition: idrec.h:39
void rSetHdl(idhdl h)
Definition: ipshell.cc:4696
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
int BOOLEAN
Definition: auxiliary.h:131
char trace_flag
Definition: subexpr.h:61
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int si_echo
Definition: febase.cc:41
int iiRegularity ( lists  L)

Definition at line 946 of file ipshell.cc.

947 {
948  int len,reg,typ0;
949 
950  resolvente r=liFindRes(L,&len,&typ0);
951 
952  if (r==NULL)
953  return -2;
954  intvec *weights=NULL;
955  int add_row_shift=0;
956  intvec *ww=(intvec *)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
957  if (ww!=NULL)
958  {
959  weights=ivCopy(ww);
960  add_row_shift = ww->min_in();
961  (*weights) -= add_row_shift;
962  }
963  //Print("attr:%x\n",weights);
964 
965  intvec *dummy=syBetti(r,len,&reg,weights);
966  if (weights!=NULL) delete weights;
967  delete dummy;
968  omFreeSize((ADDRESS)r,len*sizeof(ideal));
969  return reg+1+add_row_shift;
970 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:137
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:110
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:793
BOOLEAN iiTestAssume ( leftv  a,
leftv  b 
)

Definition at line 6006 of file ipshell.cc.

6007 {
6008  // assume a: level
6009  if ((a->Typ()==INT_CMD)&&((long)a->Data()>=0))
6010  {
6011  if ((TEST_V_ALLWARN) && (myynest==0)) WarnS("ASSUME at top level is of no use: see documentation");
6012  char assume_yylinebuf[80];
6013  strncpy(assume_yylinebuf,my_yylinebuf,79);
6014  int lev=(long)a->Data();
6015  int startlev=0;
6016  idhdl h=ggetid("assumeLevel");
6017  if ((h!=NULL)&&(IDTYP(h)==INT_CMD)) startlev=(long)IDINT(h);
6018  if(lev <=startlev)
6019  {
6020  BOOLEAN bo=b->Eval();
6021  if (bo) { WerrorS("syntax error in ASSUME");return TRUE;}
6022  if (b->Typ()!=INT_CMD) { WerrorS("ASUMME(<level>,<int expr>)");return TRUE; }
6023  if (b->Data()==NULL) { Werror("ASSUME failed:%s",assume_yylinebuf);return TRUE;}
6024  }
6025  }
6026  b->CleanUp();
6027  a->CleanUp();
6028  return FALSE;
6029 }
int Eval()
Definition: subexpr.cc:1721
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:118
char my_yylinebuf[80]
Definition: febase.cc:48
#define NULL
Definition: omList.c:10
#define IDINT(a)
Definition: ipid.h:124
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
int iiTokType ( int  op)

Definition at line 254 of file iparith.cc.

255 {
256  for (int i=0;i<sArithBase.nCmdUsed;i++)
257  {
258  if (sArithBase.sCmds[i].tokval==op)
259  return sArithBase.sCmds[i].toktype;
260  }
261  return 0;
262 }
int nCmdUsed
number of commands used
Definition: iparith.cc:208
int i
Definition: cfEzgcd.cc:123
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:218
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:203
BOOLEAN iiTryLoadLib ( leftv  v,
const char *  id 
)

Definition at line 751 of file iplib.cc.

752 {
753  BOOLEAN LoadResult = TRUE;
754  char libnamebuf[128];
755  char *libname = (char *)omAlloc(strlen(id)+5);
756  const char *suffix[] = { "", ".lib", ".so", ".sl", NULL };
757  int i = 0;
758  // FILE *fp;
759  // package pack;
760  // idhdl packhdl;
761  lib_types LT;
762  for(i=0; suffix[i] != NULL; i++)
763  {
764  sprintf(libname, "%s%s", id, suffix[i]);
765  *libname = mytolower(*libname);
766  if((LT = type_of_LIB(libname, libnamebuf)) > LT_NOTFOUND)
767  {
768  char *s=omStrDup(libname);
769  char libnamebuf[256];
770 
771  if (LT==LT_SINGULAR)
772  LoadResult = iiLibCmd(s, FALSE, FALSE,TRUE);
773  #ifdef HAVE_DYNAMIC_LOADING
774  else if ((LT==LT_ELF) || (LT==LT_HPUX))
775  LoadResult = load_modules(s,libnamebuf,FALSE);
776  #endif
777  else if (LT==LT_BUILTIN)
778  {
779  LoadResult=load_builtin(s,FALSE, iiGetBuiltinModInit(s));
780  }
781  if(!LoadResult )
782  {
783  v->name = iiConvName(libname);
784  break;
785  }
786  }
787  }
788  omFree(libname);
789  return LoadResult;
790 }
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1145
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
Definition: mod_raw.h:16
#define TRUE
Definition: auxiliary.h:144
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:24
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:811
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
lib_types
Definition: mod_raw.h:16
char mytolower(char c)
Definition: iplib.cc:1264
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:738
char libnamebuf[128]
Definition: libparse.cc:1096
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1048
#define omStrDup(s)
Definition: omAllocDecl.h:263
const char* iiTwoOps ( int  t)

Definition at line 250 of file gentable.cc.

251 {
252  if (t<127)
253  {
254  static char ch[2];
255  switch (t)
256  {
257  case '&':
258  return "and";
259  case '|':
260  return "or";
261  default:
262  ch[0]=t;
263  ch[1]='\0';
264  return ch;
265  }
266  }
267  switch (t)
268  {
269  case COLONCOLON: return "::";
270  case DOTDOT: return "..";
271  //case PLUSEQUAL: return "+=";
272  //case MINUSEQUAL: return "-=";
273  case MINUSMINUS: return "--";
274  case PLUSPLUS: return "++";
275  case EQUAL_EQUAL: return "==";
276  case LE: return "<=";
277  case GE: return ">=";
278  case NOTEQUAL: return "<>";
279  default: return Tok2Cmdname(t);
280  }
281 }
Definition: grammar.cc:271
Definition: grammar.cc:270
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
BOOLEAN iiWRITE ( leftv  res,
leftv  exprlist 
)

Definition at line 588 of file ipshell.cc.

589 {
590  sleftv vf;
591  if (iiConvert(v->Typ(),LINK_CMD,iiTestConvert(v->Typ(),LINK_CMD),v,&vf))
592  {
593  WerrorS("link expected");
594  return TRUE;
595  }
596  si_link l=(si_link)vf.Data();
597  if (vf.next == NULL)
598  {
599  WerrorS("write: need at least two arguments");
600  return TRUE;
601  }
602 
603  BOOLEAN b=slWrite(l,vf.next); /* iiConvert preserves next */
604  if (b)
605  {
606  const char *s;
607  if ((l!=NULL)&&(l->name!=NULL)) s=l->name;
608  else s=sNoName;
609  Werror("cannot write to %s",s);
610  }
611  vf.CleanUp();
612  return b;
613 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
int iiTestConvert(int inputType, int outputType)
Definition: gentable.cc:290
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const char sNoName[]
Definition: subexpr.cc:56
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
Definition: tok.h:95
#define NULL
Definition: omList.c:10
BOOLEAN iiConvert(int inputType, int outputType, int index, leftv input, leftv output, struct sConvertTypes *dConvertTypes)
Definition: ipconv.cc:287
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int l
Definition: cfEzgcd.cc:94
int IsCmd ( const char *  n,
int &  tok 
)

Definition at line 8722 of file iparith.cc.

8723 {
8724  int i;
8725  int an=1;
8726  int en=sArithBase.nLastIdentifier;
8727 
8728  loop
8729  //for(an=0; an<sArithBase.nCmdUsed; )
8730  {
8731  if(an>=en-1)
8732  {
8733  if (strcmp(n, sArithBase.sCmds[an].name) == 0)
8734  {
8735  i=an;
8736  break;
8737  }
8738  else if ((an!=en) && (strcmp(n, sArithBase.sCmds[en].name) == 0))
8739  {
8740  i=en;
8741  break;
8742  }
8743  else
8744  {
8745  // -- blackbox extensions:
8746  // return 0;
8747  return blackboxIsCmd(n,tok);
8748  }
8749  }
8750  i=(an+en)/2;
8751  if (*n < *(sArithBase.sCmds[i].name))
8752  {
8753  en=i-1;
8754  }
8755  else if (*n > *(sArithBase.sCmds[i].name))
8756  {
8757  an=i+1;
8758  }
8759  else
8760  {
8761  int v=strcmp(n,sArithBase.sCmds[i].name);
8762  if(v<0)
8763  {
8764  en=i-1;
8765  }
8766  else if(v>0)
8767  {
8768  an=i+1;
8769  }
8770  else /*v==0*/
8771  {
8772  break;
8773  }
8774  }
8775  }
8777  tok=sArithBase.sCmds[i].tokval;
8778  if(sArithBase.sCmds[i].alias==2)
8779  {
8780  Warn("outdated identifier `%s` used - please change your code",
8781  sArithBase.sCmds[i].name);
8782  sArithBase.sCmds[i].alias=1;
8783  }
8784  #if 0
8785  if (currRingHdl==NULL)
8786  {
8787  #ifdef SIQ
8788  if (siq<=0)
8789  {
8790  #endif
8791  if ((tok>=BEGIN_RING) && (tok<=END_RING))
8792  {
8793  WerrorS("no ring active");
8794  return 0;
8795  }
8796  #ifdef SIQ
8797  }
8798  #endif
8799  }
8800  #endif
8801  if (!expected_parms)
8802  {
8803  switch (tok)
8804  {
8805  case IDEAL_CMD:
8806  case INT_CMD:
8807  case INTVEC_CMD:
8808  case MAP_CMD:
8809  case MATRIX_CMD:
8810  case MODUL_CMD:
8811  case POLY_CMD:
8812  case PROC_CMD:
8813  case RING_CMD:
8814  case STRING_CMD:
8815  cmdtok = tok;
8816  break;
8817  }
8818  }
8819  return sArithBase.sCmds[i].toktype;
8820 }
Definition: tok.h:85
loop
Definition: myNF.cc:98
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
BOOLEAN siq
Definition: subexpr.cc:58
int cmdtok
Definition: grammar.cc:175
void WerrorS(const char *s)
Definition: feFopen.cc:23
BOOLEAN expected_parms
Definition: grammar.cc:174
int nLastIdentifier
valid indentifieres are slot 1..nLastIdentifier
Definition: iparith.cc:210
idhdl currRingHdl
Definition: ipid.cc:64
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
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:193
static SArithBase sArithBase
Base entry for arithmetic.
Definition: iparith.cc:218
cmdnames * sCmds
array of existing commands
Definition: iparith.cc:203
const char * lastreserved
Definition: ipshell.cc:86
#define Warn
Definition: emacs.cc:80
BOOLEAN jjBETTI ( leftv  res,
leftv  v 
)

Definition at line 885 of file ipshell.cc.

886 {
887  sleftv tmp;
888  memset(&tmp,0,sizeof(tmp));
889  tmp.rtyp=INT_CMD;
890  tmp.data=(void *)1;
891  if ((u->Typ()==IDEAL_CMD)
892  || (u->Typ()==MODUL_CMD))
893  return jjBETTI2_ID(res,u,&tmp);
894  else
895  return jjBETTI2(res,u,&tmp);
896 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:919
void * data
Definition: subexpr.h:89
int rtyp
Definition: subexpr.h:92
BOOLEAN jjBETTI2_ID(leftv res, leftv u, leftv v)
Definition: ipshell.cc:898
BOOLEAN jjBETTI2 ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 919 of file ipshell.cc.

920 {
921  resolvente r;
922  int len;
923  int reg,typ0;
924  lists l=(lists)u->Data();
925 
926  intvec *weights=NULL;
927  int add_row_shift=0;
928  intvec *ww=(intvec *)atGet(&(l->m[0]),"isHomog",INTVEC_CMD);
929  if (ww!=NULL)
930  {
931  weights=ivCopy(ww);
932  add_row_shift = ww->min_in();
933  (*weights) -= add_row_shift;
934  }
935  //Print("attr:%x\n",weights);
936 
937  r=liFindRes(l,&len,&typ0);
938  if (r==NULL) return TRUE;
939  res->data=(char *)syBetti(r,len,&reg,weights,(int)(long)v->Data());
940  omFreeSize((ADDRESS)r,(len)*sizeof(ideal));
941  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
942  if (weights!=NULL) delete weights;
943  return FALSE;
944 }
sleftv * m
Definition: lists.h:45
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:85
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:137
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:110
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
void * Data()
Definition: subexpr.cc:1097
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:793
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjBETTI2_ID ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 898 of file ipshell.cc.

899 {
901  l->Init(1);
902  l->m[0].rtyp=u->Typ();
903  l->m[0].data=u->Data();
904  attr *a=u->Attribute();
905  if (a!=NULL)
906  l->m[0].attribute=*a;
907  sleftv tmp2;
908  memset(&tmp2,0,sizeof(tmp2));
909  tmp2.rtyp=LIST_CMD;
910  tmp2.data=(void *)l;
911  BOOLEAN r=jjBETTI2(res,&tmp2,v);
912  l->m[0].data=NULL;
913  l->m[0].attribute=NULL;
914  l->m[0].rtyp=DEF_CMD;
915  l->Clean();
916  return r;
917 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
const poly a
Definition: syzextra.cc:212
Definition: attrib.h:15
Definition: lists.h:22
attr * Attribute()
Definition: subexpr.cc:1352
BOOLEAN jjBETTI2(leftv res, leftv u, leftv v)
Definition: ipshell.cc:919
int Typ()
Definition: subexpr.cc:955
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: tok.h:58
CFList tmp2
Definition: facFqBivar.cc:70
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
attr attribute
Definition: subexpr.h:90
omBin slists_bin
Definition: lists.cc:23
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
BOOLEAN jjCHARSERIES ( leftv  res,
leftv  u 
)

Definition at line 2928 of file ipshell.cc.

2929 {
2930  res->data=singclap_irrCharSeries((ideal)u->Data(), currRing);
2931  return (res->data==NULL);
2932 }
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
matrix singclap_irrCharSeries(ideal I, const ring r)
Definition: clapsing.cc:1398
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
BOOLEAN jjIMPORTFROM ( leftv  res,
leftv  u,
leftv  v 
)

Definition at line 2183 of file ipassign.cc.

2184 {
2185  //Print("importfrom %s::%s ->.\n",v->Name(),u->Name() );
2186  assume(u->Typ()==PACKAGE_CMD);
2187  char *vn=(char *)v->Name();
2188  idhdl h=((package)(u->Data()))->idroot->get(vn /*v->Name()*/, myynest);
2189  if (h!=NULL)
2190  {
2191  //check for existence
2192  if (((package)(u->Data()))==basePack)
2193  {
2194  WarnS("source and destination packages are identical");
2195  return FALSE;
2196  }
2197  idhdl t=basePack->idroot->get(vn /*v->Name()*/, myynest);
2198  if (t!=NULL)
2199  {
2200  Warn("redefining `%s`",vn);
2201  killhdl(t);
2202  }
2203  sleftv tmp_expr;
2204  if (iiDeclCommand(&tmp_expr,v,myynest,DEF_CMD,&IDROOT)) return TRUE;
2205  sleftv h_expr;
2206  memset(&h_expr,0,sizeof(h_expr));
2207  h_expr.rtyp=IDHDL;
2208  h_expr.data=h;
2209  h_expr.name=vn;
2210  return iiAssign(&tmp_expr,&h_expr);
2211  }
2212  else
2213  {
2214  Werror("`%s` not found in `%s`",v->Name(), u->Name());
2215  return TRUE;
2216  }
2217  return FALSE;
2218 }
ip_package * package
Definition: structs.h:46
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define FALSE
Definition: auxiliary.h:140
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define assume(x)
Definition: mod2.h:405
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1112
#define NULL
Definition: omList.c:10
void killhdl(idhdl h, package proot)
Definition: ipid.cc:369
package basePack
Definition: ipid.cc:63
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1772
#define Warn
Definition: emacs.cc:80
BOOLEAN jjLIST_PL ( leftv  res,
leftv  v 
)

Definition at line 7394 of file iparith.cc.

7395 {
7396  int sl=0;
7397  if (v!=NULL) sl = v->listLength();
7398  lists L;
7399  if((sl==1)&&(v->Typ()==RESOLUTION_CMD))
7400  {
7401  int add_row_shift = 0;
7402  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
7403  if (weights!=NULL) add_row_shift=weights->min_in();
7404  L=syConvRes((syStrategy)v->Data(),FALSE,add_row_shift);
7405  }
7406  else
7407  {
7409  leftv h=NULL;
7410  int i;
7411  int rt;
7412 
7413  L->Init(sl);
7414  for (i=0;i<sl;i++)
7415  {
7416  if (h!=NULL)
7417  { /* e.g. not in the first step:
7418  * h is the pointer to the old sleftv,
7419  * v is the pointer to the next sleftv
7420  * (in this moment) */
7421  h->next=v;
7422  }
7423  h=v;
7424  v=v->next;
7425  h->next=NULL;
7426  rt=h->Typ();
7427  if (rt==0)
7428  {
7429  L->Clean();
7430  Werror("`%s` is undefined",h->Fullname());
7431  return TRUE;
7432  }
7433  if ((rt==RING_CMD)||(rt==QRING_CMD))
7434  {
7435  L->m[i].rtyp=rt; L->m[i].data=h->Data();
7436  ((ring)L->m[i].data)->ref++;
7437  }
7438  else
7439  L->m[i].Copy(h);
7440  }
7441  }
7442  res->data=(char *)L;
7443  return FALSE;
7444 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:2760
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
int min_in()
Definition: intvec.h:110
int Typ()
Definition: subexpr.cc:955
const char * Fullname()
Definition: subexpr.h:126
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
void Copy(leftv e)
Definition: subexpr.cc:643
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:92
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1097
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN jjLOAD ( const char *  s,
BOOLEAN  autoexport = FALSE 
)

load lib/module given in v

Definition at line 5274 of file iparith.cc.

5275 {
5276  char libnamebuf[256];
5277  lib_types LT = type_of_LIB(s, libnamebuf);
5278 
5279 #ifdef HAVE_DYNAMIC_LOADING
5280  extern BOOLEAN load_modules(const char *newlib, char *fullpath, BOOLEAN autoexport);
5281 #endif /* HAVE_DYNAMIC_LOADING */
5282  switch(LT)
5283  {
5284  default:
5285  case LT_NONE:
5286  Werror("%s: unknown type", s);
5287  break;
5288  case LT_NOTFOUND:
5289  Werror("cannot open %s", s);
5290  break;
5291 
5292  case LT_SINGULAR:
5293  {
5294  char *plib = iiConvName(s);
5295  idhdl pl = IDROOT->get(plib,0);
5296  if (pl==NULL)
5297  {
5298  pl = enterid( plib,0, PACKAGE_CMD, &(basePack->idroot), TRUE );
5299  IDPACKAGE(pl)->language = LANG_SINGULAR;
5300  IDPACKAGE(pl)->libname=omStrDup(plib);
5301  }
5302  else if (IDTYP(pl)!=PACKAGE_CMD)
5303  {
5304  Werror("can not create package `%s`",plib);
5305  omFree(plib);
5306  return TRUE;
5307  }
5308  package savepack=currPack;
5309  currPack=IDPACKAGE(pl);
5310  IDPACKAGE(pl)->loaded=TRUE;
5311  char libnamebuf[256];
5312  FILE * fp = feFopen( s, "r", libnamebuf, TRUE );
5313  BOOLEAN bo=iiLoadLIB(fp, libnamebuf, s, pl, autoexport, TRUE);
5314  currPack=savepack;
5315  IDPACKAGE(pl)->loaded=(!bo);
5316  return bo;
5317  }
5318  case LT_BUILTIN:
5319  SModulFunc_t iiGetBuiltinModInit(const char*);
5320  return load_builtin(s,autoexport, iiGetBuiltinModInit(s));
5321  case LT_MACH_O:
5322  case LT_ELF:
5323  case LT_HPUX:
5324 #ifdef HAVE_DYNAMIC_LOADING
5325  return load_modules(s, libnamebuf, autoexport);
5326 #else /* HAVE_DYNAMIC_LOADING */
5327  WerrorS("Dynamic modules are not supported by this version of Singular");
5328  break;
5329 #endif /* HAVE_DYNAMIC_LOADING */
5330  }
5331  return TRUE;
5332 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
CanonicalForm fp
Definition: cfModGcd.cc:4043
Definition: mod_raw.h:16
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
lib_types type_of_LIB(const char *newlib, char *libnamebuf)
Definition: mod_lib.cc:24
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
#define omFree(addr)
Definition: omAllocDecl.h:261
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
lib_types
Definition: mod_raw.h:16
BOOLEAN load_builtin(const char *newlib, BOOLEAN autoexport, SModulFunc_t init)
Definition: iplib.cc:1145
#define NULL
Definition: omList.c:10
SModulFunc_t iiGetBuiltinModInit(const char *libname)
Definition: iplib.cc:738
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
int(* SModulFunc_t)(SModulFunctions *)
Definition: ipid.h:84
char libnamebuf[128]
Definition: libparse.cc:1096
BOOLEAN iiLoadLIB(FILE *fp, const char *libnamebuf, const char *newlib, idhdl pl, BOOLEAN autoexport, BOOLEAN tellerror)
Definition: iplib.cc:900
char * iiConvName(const char *libname)
Definition: iplib.cc:1277
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN load_modules(const char *newlib, char *fullname, BOOLEAN autoexport)
Definition: iplib.cc:1048
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjLOAD_TRY ( const char *  s)

Definition at line 5338 of file iparith.cc.

5339 {
5340  void (*WerrorS_save)(const char *s) = WerrorS_callback;
5343  BOOLEAN bo=jjLOAD(s,TRUE);
5344  if (TEST_OPT_PROT && (bo || (WerrorS_dummy_cnt>0)))
5345  Print("loading of >%s< failed\n",s);
5346  WerrorS_callback=WerrorS_save;
5347  errorreported=0;
5348  return FALSE;
5349 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
static int WerrorS_dummy_cnt
Definition: iparith.cc:5333
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
BOOLEAN jjLOAD(const char *s, BOOLEAN autoexport)
load lib/module given in v
Definition: iparith.cc:5274
static void WerrorS_dummy(const char *)
Definition: iparith.cc:5334
void(* WerrorS_callback)(const char *s)
Definition: feFopen.cc:21
short errorreported
Definition: feFopen.cc:22
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN jjMINRES ( leftv  res,
leftv  v 
)

Definition at line 864 of file ipshell.cc.

865 {
866  int len=0;
867  int typ0;
868  lists L=(lists)v->Data();
869  intvec *weights=(intvec*)atGet(v,"isHomog",INTVEC_CMD);
870  int add_row_shift = 0;
871  if (weights==NULL)
872  weights=(intvec*)atGet(&(L->m[0]),"isHomog",INTVEC_CMD);
873  if (weights!=NULL) add_row_shift=weights->min_in();
874  resolvente rr=liFindRes(L,&len,&typ0);
875  if (rr==NULL) return TRUE;
876  resolvente r=iiCopyRes(rr,len);
877 
878  syMinimizeResolvente(r,len,0);
879  omFreeSize((ADDRESS)rr,len*sizeof(ideal));
880  len++;
881  res->data=(char *)liMakeResolv(r,len,-1,typ0,NULL,add_row_shift);
882  return FALSE;
883 }
sleftv * m
Definition: lists.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
void syMinimizeResolvente(resolvente res, int length, int first)
Definition: syz.cc:360
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int min_in()
Definition: intvec.h:110
void * data
Definition: subexpr.h:89
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
static resolvente iiCopyRes(resolvente r, int l)
Definition: ipshell.cc:854
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
void * Data()
Definition: subexpr.cc:1097
ideal * resolvente
Definition: ideals.h:20
BOOLEAN jjRESULTANT ( leftv  res,
leftv  u,
leftv  v,
leftv  w 
)

Definition at line 2921 of file ipshell.cc.

2922 {
2923  res->data=singclap_resultant((poly)u->CopyD(),(poly)v->CopyD(),
2924  (poly)w->CopyD(), currRing);
2925  return errorreported;
2926 }
poly singclap_resultant(poly f, poly g, poly x, const ring r)
Definition: clapsing.cc:317
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
short errorreported
Definition: feFopen.cc:22
polyrec * poly
Definition: hilb.h:10
void * CopyD(int t)
Definition: subexpr.cc:662
BOOLEAN jjSYSTEM ( leftv  res,
leftv  v 
)

Definition at line 245 of file extra.cc.

246 {
247  if(args->Typ() == STRING_CMD)
248  {
249  const char *sys_cmd=(char *)(args->Data());
250  leftv h=args->next;
251 // ONLY documented system calls go here
252 // Undocumented system calls go down into jjEXTENDED_SYSTEM (#ifdef HAVE_EXTENDED_SYSTEM)
253 /*==================== nblocks ==================================*/
254  if (strcmp(sys_cmd, "nblocks") == 0)
255  {
256  ring r;
257  if (h == NULL)
258  {
259  if (currRingHdl != NULL)
260  {
261  r = IDRING(currRingHdl);
262  }
263  else
264  {
265  WerrorS("no ring active");
266  return TRUE;
267  }
268  }
269  else
270  {
271  if (h->Typ() != RING_CMD)
272  {
273  WerrorS("ring expected");
274  return TRUE;
275  }
276  r = (ring) h->Data();
277  }
278  res->rtyp = INT_CMD;
279  res->data = (void*) (long)(rBlocks(r) - 1);
280  return FALSE;
281  }
282 /*==================== version ==================================*/
283  if(strcmp(sys_cmd,"version")==0)
284  {
285  res->rtyp=INT_CMD;
286  res->data=(void *)SINGULAR_VERSION;
287  return FALSE;
288  }
289  else
290 /*==================== cpu ==================================*/
291  if(strcmp(sys_cmd,"cpu")==0)
292  {
293  long cpu=1; //feOptValue(FE_OPT_CPUS);
294  #ifdef _SC_NPROCESSORS_ONLN
295  cpu=sysconf(_SC_NPROCESSORS_ONLN);
296  #elif defined(_SC_NPROCESSORS_CONF)
297  cpu=sysconf(_SC_NPROCESSORS_CONF);
298  #endif
299  res->data=(void *)cpu;
300  res->rtyp=INT_CMD;
301  return FALSE;
302  }
303  else
304 
305 /*==================== sh ==================================*/
306  if(strcmp(sys_cmd,"sh")==0)
307  {
308  if (feOptValue(FE_OPT_NO_SHELL))
309  {
310  WerrorS("shell execution is disallowed in restricted mode");
311  return TRUE;
312  }
313  res->rtyp=INT_CMD;
314  if (h==NULL) res->data = (void *)(long) system("sh");
315  else if (h->Typ()==STRING_CMD)
316  res->data = (void*)(long) system((char*)(h->Data()));
317  else
318  WerrorS("string expected");
319  return FALSE;
320  }
321  else
322  #if 0
323  if(strcmp(sys_cmd,"power1")==0)
324  {
325  res->rtyp=POLY_CMD;
326  poly f=(poly)h->CopyD();
327  poly g=pPower(f,2000);
328  res->data=(void *)g;
329  return FALSE;
330  }
331  else
332  if(strcmp(sys_cmd,"power2")==0)
333  {
334  res->rtyp=POLY_CMD;
335  poly f=(poly)h->Data();
336  poly g=pOne();
337  for(int i=0;i<2000;i++)
338  g=pMult(g,pCopy(f));
339  res->data=(void *)g;
340  return FALSE;
341  }
342  if(strcmp(sys_cmd,"power3")==0)
343  {
344  res->rtyp=POLY_CMD;
345  poly f=(poly)h->Data();
346  poly p2=pMult(pCopy(f),pCopy(f));
347  poly p4=pMult(pCopy(p2),pCopy(p2));
348  poly p8=pMult(pCopy(p4),pCopy(p4));
349  poly p16=pMult(pCopy(p8),pCopy(p8));
350  poly p32=pMult(pCopy(p16),pCopy(p16));
351  poly p64=pMult(pCopy(p32),pCopy(p32));
352  poly p128=pMult(pCopy(p64),pCopy(p64));
353  poly p256=pMult(pCopy(p128),pCopy(p128));
354  poly p512=pMult(pCopy(p256),pCopy(p256));
355  poly p1024=pMult(pCopy(p512),pCopy(p512));
356  poly p1536=pMult(p1024,p512);
357  poly p1792=pMult(p1536,p256);
358  poly p1920=pMult(p1792,p128);
359  poly p1984=pMult(p1920,p64);
360  poly p2000=pMult(p1984,p16);
361  res->data=(void *)p2000;
362  pDelete(&p2);
363  pDelete(&p4);
364  pDelete(&p8);
365  //pDelete(&p16);
366  pDelete(&p32);
367  //pDelete(&p64);
368  //pDelete(&p128);
369  //pDelete(&p256);
370  //pDelete(&p512);
371  //pDelete(&p1024);
372  //pDelete(&p1536);
373  //pDelete(&p1792);
374  //pDelete(&p1920);
375  //pDelete(&p1984);
376  return FALSE;
377  }
378  else
379  #endif
380 /*==================== uname ==================================*/
381  if(strcmp(sys_cmd,"uname")==0)
382  {
383  res->rtyp=STRING_CMD;
384  res->data = omStrDup(S_UNAME);
385  return FALSE;
386  }
387  else
388 /*==================== with ==================================*/
389  if(strcmp(sys_cmd,"with")==0)
390  {
391  if (h==NULL)
392  {
393  res->rtyp=STRING_CMD;
394  res->data=(void *)versionString();
395  return FALSE;
396  }
397  else if (h->Typ()==STRING_CMD)
398  {
399  #define TEST_FOR(A) if(strcmp(s,A)==0) res->data=(void *)1; else
400  char *s=(char *)h->Data();
401  res->rtyp=INT_CMD;
402  #ifdef HAVE_DBM
403  TEST_FOR("DBM")
404  #endif
405  #ifdef HAVE_DLD
406  TEST_FOR("DLD")
407  #endif
408  //TEST_FOR("factory")
409  //TEST_FOR("libfac")
410  #ifdef HAVE_READLINE
411  TEST_FOR("readline")
412  #endif
413  #ifdef TEST_MAC_ORDER
414  TEST_FOR("MAC_ORDER")
415  #endif
416  // unconditional since 3-1-0-6
417  TEST_FOR("Namespaces")
418  #ifdef HAVE_DYNAMIC_LOADING
419  TEST_FOR("DynamicLoading")
420  #endif
421  #ifdef HAVE_EIGENVAL
422  TEST_FOR("eigenval")
423  #endif
424  #ifdef HAVE_GMS
425  TEST_FOR("gms")
426  #endif
427  #ifdef OM_NDEBUG
428  TEST_FOR("om_ndebug")
429  #endif
430  #ifdef SING_NDEBUG
431  TEST_FOR("ndebug")
432  #endif
433  {};
434  return FALSE;
435  #undef TEST_FOR
436  }
437  return TRUE;
438  }
439  else
440  /*==================== browsers ==================================*/
441  if (strcmp(sys_cmd,"browsers")==0)
442  {
443  res->rtyp = STRING_CMD;
444  StringSetS("");
446  res->data = StringEndS();
447  return FALSE;
448  }
449  else
450  /*==================== pid ==================================*/
451  if (strcmp(sys_cmd,"pid")==0)
452  {
453  res->rtyp=INT_CMD;
454  res->data=(void *)(long) getpid();
455  return FALSE;
456  }
457  else
458  /*==================== getenv ==================================*/
459  if (strcmp(sys_cmd,"getenv")==0)
460  {
461  if ((h!=NULL) && (h->Typ()==STRING_CMD))
462  {
463  res->rtyp=STRING_CMD;
464  const char *r=getenv((char *)h->Data());
465  if (r==NULL) r="";
466  res->data=(void *)omStrDup(r);
467  return FALSE;
468  }
469  else
470  {
471  WerrorS("string expected");
472  return TRUE;
473  }
474  }
475  else
476  /*==================== setenv ==================================*/
477  if (strcmp(sys_cmd,"setenv")==0)
478  {
479  #ifdef HAVE_SETENV
480  const short t[]={2,STRING_CMD,STRING_CMD};
481  if (iiCheckTypes(h,t,1))
482  {
483  res->rtyp=STRING_CMD;
484  setenv((char *)h->Data(), (char *)h->next->Data(), 1);
485  res->data=(void *)omStrDup((char *)h->next->Data());
487  return FALSE;
488  }
489  else
490  {
491  return TRUE;
492  }
493  #else
494  WerrorS("setenv not supported on this platform");
495  return TRUE;
496  #endif
497  }
498  else
499  /*==================== Singular ==================================*/
500  if (strcmp(sys_cmd, "Singular") == 0)
501  {
502  res->rtyp=STRING_CMD;
503  const char *r=feResource("Singular");
504  if (r == NULL) r="";
505  res->data = (void*) omStrDup( r );
506  return FALSE;
507  }
508  else
509  if (strcmp(sys_cmd, "SingularLib") == 0)
510  {
511  res->rtyp=STRING_CMD;
512  const char *r=feResource("SearchPath");
513  if (r == NULL) r="";
514  res->data = (void*) omStrDup( r );
515  return FALSE;
516  }
517  else
518  /*==================== options ==================================*/
519  if (strstr(sys_cmd, "--") == sys_cmd)
520  {
521  if (strcmp(sys_cmd, "--") == 0)
522  {
524  return FALSE;
525  }
526  feOptIndex opt = feGetOptIndex(&sys_cmd[2]);
527  if (opt == FE_OPT_UNDEF)
528  {
529  Werror("Unknown option %s", sys_cmd);
530  WerrorS("Use 'system(\"--\");' for listing of available options");
531  return TRUE;
532  }
533  // for Untyped Options (help version),
534  // setting it just triggers action
535  if (feOptSpec[opt].type == feOptUntyped)
536  {
537  feSetOptValue(opt,0);
538  return FALSE;
539  }
540  if (h == NULL)
541  {
542  if (feOptSpec[opt].type == feOptString)
543  {
544  res->rtyp = STRING_CMD;
545  const char *r=(const char*)feOptSpec[opt].value;
546  if (r == NULL) r="";
547  res->data = omStrDup(r);
548  }
549  else
550  {
551  res->rtyp = INT_CMD;
552  res->data = feOptSpec[opt].value;
553  }
554  return FALSE;
555  }
556  if (h->Typ() != STRING_CMD &&
557  h->Typ() != INT_CMD)
558  {
559  WerrorS("Need string or int argument to set option value");
560  return TRUE;
561  }
562  const char* errormsg;
563  if (h->Typ() == INT_CMD)
564  {
565  if (feOptSpec[opt].type == feOptString)
566  {
567  Werror("Need string argument to set value of option %s", sys_cmd);
568  return TRUE;
569  }
570  errormsg = feSetOptValue(opt, (int)((long) h->Data()));
571  if (errormsg != NULL)
572  Werror("Option '--%s=%d' %s", sys_cmd, (int) ((long)h->Data()), errormsg);
573  }
574  else
575  {
576  errormsg = feSetOptValue(opt, (char*) h->Data());
577  if (errormsg != NULL)
578  Werror("Option '--%s=%s' %s", sys_cmd, (char*) h->Data(), errormsg);
579  }
580  if (errormsg != NULL) return TRUE;
581  return FALSE;
582  }
583  else
584  /*==================== HC ==================================*/
585  if (strcmp(sys_cmd,"HC")==0)
586  {
587  res->rtyp=INT_CMD;
588  res->data=(void *)(long) HCord;
589  return FALSE;
590  }
591  else
592  /*==================== random ==================================*/
593  if(strcmp(sys_cmd,"random")==0)
594  {
595  const short t[]={1,INT_CMD};
596  if (h!=NULL)
597  {
598  if (iiCheckTypes(h,t,1))
599  {
600  siRandomStart=(int)((long)h->Data());
603  return FALSE;
604  }
605  else
606  {
607  return TRUE;
608  }
609  }
610  res->rtyp=INT_CMD;
611  res->data=(void*)(long) siSeed;
612  return FALSE;
613  }
614  else
615  /*======================= demon_list =====================*/
616  if (strcmp(sys_cmd,"denom_list")==0)
617  {
618  res->rtyp=LIST_CMD;
619  extern lists get_denom_list();
620  res->data=(lists)get_denom_list();
621  return FALSE;
622  }
623  else
624  /*==================== complexNearZero ======================*/
625  if(strcmp(sys_cmd,"complexNearZero")==0)
626  {
627  const short t[]={2,NUMBER_CMD,INT_CMD};
628  if (iiCheckTypes(h,t,1))
629  {
630  if ( !rField_is_long_C(currRing) )
631  {
632  WerrorS( "unsupported ground field!");
633  return TRUE;
634  }
635  else
636  {
637  res->rtyp=INT_CMD;
638  res->data=(void*)complexNearZero((gmp_complex*)h->Data(),
639  (int)((long)(h->next->Data())));
640  return FALSE;
641  }
642  }
643  else
644  {
645  return TRUE;
646  }
647  }
648  else
649  /*==================== getPrecDigits ======================*/
650  if(strcmp(sys_cmd,"getPrecDigits")==0)
651  {
652  if ( (currRing==NULL)
654  {
655  WerrorS( "unsupported ground field!");
656  return TRUE;
657  }
658  res->rtyp=INT_CMD;
659  res->data=(void*)(long)gmp_output_digits;
660  //if (gmp_output_digits!=getGMPFloatDigits())
661  //{ Print("%d, %d\n",getGMPFloatDigits(),gmp_output_digits);}
662  return FALSE;
663  }
664  else
665  /*==================== lduDecomp ======================*/
666  if(strcmp(sys_cmd, "lduDecomp")==0)
667  {
668  const short t[]={1,MATRIX_CMD};
669  if (iiCheckTypes(h,t,1))
670  {
671  matrix aMat = (matrix)h->Data();
672  matrix pMat; matrix lMat; matrix dMat; matrix uMat;
673  poly l; poly u; poly prodLU;
674  lduDecomp(aMat, pMat, lMat, dMat, uMat, l, u, prodLU);
676  L->Init(7);
677  L->m[0].rtyp = MATRIX_CMD; L->m[0].data=(void*)pMat;
678  L->m[1].rtyp = MATRIX_CMD; L->m[1].data=(void*)lMat;
679  L->m[2].rtyp = MATRIX_CMD; L->m[2].data=(void*)dMat;
680  L->m[3].rtyp = MATRIX_CMD; L->m[3].data=(void*)uMat;
681  L->m[4].rtyp = POLY_CMD; L->m[4].data=(void*)l;
682  L->m[5].rtyp = POLY_CMD; L->m[5].data=(void*)u;
683  L->m[6].rtyp = POLY_CMD; L->m[6].data=(void*)prodLU;
684  res->rtyp = LIST_CMD;
685  res->data = (char *)L;
686  return FALSE;
687  }
688  else
689  {
690  return TRUE;
691  }
692  }
693  else
694  /*==================== lduSolve ======================*/
695  if(strcmp(sys_cmd, "lduSolve")==0)
696  {
697  /* for solving a linear equation system A * x = b, via the
698  given LDU-decomposition of the matrix A;
699  There is one valid parametrisation:
700  1) exactly eight arguments P, L, D, U, l, u, lTimesU, b;
701  P, L, D, and U realise the LDU-decomposition of A, that is,
702  P * A = L * D^(-1) * U, and P, L, D, and U satisfy the
703  properties decribed in method 'luSolveViaLDUDecomp' in
704  linearAlgebra.h; see there;
705  l, u, and lTimesU are as described in the same location;
706  b is the right-hand side vector of the linear equation system;
707  The method will return a list of either 1 entry or three entries:
708  1) [0] if there is no solution to the system;
709  2) [1, x, H] if there is at least one solution;
710  x is any solution of the given linear system,
711  H is the matrix with column vectors spanning the homogeneous
712  solution space.
713  The method produces an error if matrix and vector sizes do not
714  fit. */
715  const short t[]={7,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,MATRIX_CMD,POLY_CMD,POLY_CMD,MATRIX_CMD};
716  if (!iiCheckTypes(h,t,1))
717  {
718  return TRUE;
719  }
721  {
722  WerrorS("field required");
723  return TRUE;
724  }
725  matrix pMat = (matrix)h->Data();
726  matrix lMat = (matrix)h->next->Data();
727  matrix dMat = (matrix)h->next->next->Data();
728  matrix uMat = (matrix)h->next->next->next->Data();
729  poly l = (poly) h->next->next->next->next->Data();
730  poly u = (poly) h->next->next->next->next->next->Data();
731  poly lTimesU = (poly) h->next->next->next->next->next->next->Data();
732  matrix bVec = (matrix)h->next->next->next->next->next->next->next->Data();
733  matrix xVec; int solvable; matrix homogSolSpace;
734  if (pMat->rows() != pMat->cols())
735  {
736  Werror("first matrix (%d x %d) is not quadratic",
737  pMat->rows(), pMat->cols());
738  return TRUE;
739  }
740  if (lMat->rows() != lMat->cols())
741  {
742  Werror("second matrix (%d x %d) is not quadratic",
743  lMat->rows(), lMat->cols());
744  return TRUE;
745  }
746  if (dMat->rows() != dMat->cols())
747  {
748  Werror("third matrix (%d x %d) is not quadratic",
749  dMat->rows(), dMat->cols());
750  return TRUE;
751  }
752  if (dMat->cols() != uMat->rows())
753  {
754  Werror("third matrix (%d x %d) and fourth matrix (%d x %d) %s",
755  dMat->rows(), dMat->cols(), uMat->rows(), uMat->cols(),
756  "do not t");
757  return TRUE;
758  }
759  if (uMat->rows() != bVec->rows())
760  {
761  Werror("fourth matrix (%d x %d) and vector (%d x 1) do not fit",
762  uMat->rows(), uMat->cols(), bVec->rows());
763  return TRUE;
764  }
765  solvable = luSolveViaLDUDecomp(pMat, lMat, dMat, uMat, l, u, lTimesU,
766  bVec, xVec, homogSolSpace);
767 
768  /* build the return structure; a list with either one or
769  three entries */
771  if (solvable)
772  {
773  ll->Init(3);
774  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
775  ll->m[1].rtyp=MATRIX_CMD; ll->m[1].data=(void *)xVec;
776  ll->m[2].rtyp=MATRIX_CMD; ll->m[2].data=(void *)homogSolSpace;
777  }
778  else
779  {
780  ll->Init(1);
781  ll->m[0].rtyp=INT_CMD; ll->m[0].data=(void *)(long)solvable;
782  }
783  res->rtyp = LIST_CMD;
784  res->data=(char*)ll;
785  return FALSE;
786  }
787  else
788  /*==== countedref: reference and shared ====*/
789  if (strcmp(sys_cmd, "shared") == 0)
790  {
791  #ifndef SI_COUNTEDREF_AUTOLOAD
792  void countedref_shared_load();
794  #endif
795  res->rtyp = NONE;
796  return FALSE;
797  }
798  else if (strcmp(sys_cmd, "reference") == 0)
799  {
800  #ifndef SI_COUNTEDREF_AUTOLOAD
803  #endif
804  res->rtyp = NONE;
805  return FALSE;
806  }
807  else
808 /*==================== semaphore =================*/
809 #ifdef HAVE_SIMPLEIPC
810  if (strcmp(sys_cmd,"semaphore")==0)
811  {
812  if((h!=NULL) && (h->Typ()==STRING_CMD) && (h->next!=NULL) && (h->next->Typ()==INT_CMD))
813  {
814  int v=1;
815  if ((h->next->next!=NULL)&& (h->next->next->Typ()==INT_CMD))
816  v=(int)(long)h->next->next->Data();
817  res->data=(char *)(long)simpleipc_cmd((char *)h->Data(),(int)(long)h->next->Data(),v);
818  res->rtyp=INT_CMD;
819  return FALSE;
820  }
821  else
822  {
823  WerrorS("Usage: system(\"semaphore\",<cmd>,int)");
824  return TRUE;
825  }
826  }
827  else
828 #endif
829 /*==================== reserved port =================*/
830  if (strcmp(sys_cmd,"reserve")==0)
831  {
832  int ssiReservePort(int clients);
833  const short t[]={1,INT_CMD};
834  if (iiCheckTypes(h,t,1))
835  {
836  res->rtyp=INT_CMD;
837  int p=ssiReservePort((int)(long)h->Data());
838  res->data=(void*)(long)p;
839  return (p==0);
840  }
841  return TRUE;
842  }
843  else
844 /*==================== reserved link =================*/
845  if (strcmp(sys_cmd,"reservedLink")==0)
846  {
847  extern si_link ssiCommandLink();
848  res->rtyp=LINK_CMD;
850  res->data=(void*)p;
851  return (p==NULL);
852  }
853  else
854 /*==================== install newstruct =================*/
855  if (strcmp(sys_cmd,"install")==0)
856  {
857  const short t[]={4,STRING_CMD,STRING_CMD,PROC_CMD,INT_CMD};
858  if (iiCheckTypes(h,t,1))
859  {
860  return newstruct_set_proc((char*)h->Data(),(char*)h->next->Data(),
861  (int)(long)h->next->next->next->Data(),
862  (procinfov)h->next->next->Data());
863  }
864  return TRUE;
865  }
866  else
867 /*==================== newstruct =================*/
868  if (strcmp(sys_cmd,"newstruct")==0)
869  {
870  const short t[]={1,STRING_CMD};
871  if (iiCheckTypes(h,t,1))
872  {
873  int id=0;
874  char *n=(char*)h->Data();
875  blackboxIsCmd(n,id);
876  if (id>0)
877  {
878  blackbox *bb=getBlackboxStuff(id);
879  if (BB_LIKE_LIST(bb))
880  {
881  newstruct_desc desc=(newstruct_desc)bb->data;
882  newstructShow(desc);
883  return FALSE;
884  }
885  else Werror("'%s' is not a newstruct",n);
886  }
887  else Werror("'%s' is not a blackbox object",n);
888  }
889  return TRUE;
890  }
891  else
892 /*==================== blackbox =================*/
893  if (strcmp(sys_cmd,"blackbox")==0)
894  {
896  return FALSE;
897  }
898  else
899  /*================= absBiFact ======================*/
900  #ifdef HAVE_NTL
901  if (strcmp(sys_cmd, "absFact") == 0)
902  {
903  const short t[]={1,POLY_CMD};
904  if (iiCheckTypes(h,t,1)
905  && (currRing!=NULL)
906  && (getCoeffType(currRing->cf)==n_transExt))
907  {
908  res->rtyp=LIST_CMD;
909  intvec *v=NULL;
910  ideal mipos= NULL;
911  int n= 0;
912  ideal f=singclap_absFactorize((poly)(h->Data()), mipos, &v, n, currRing);
913  if (f==NULL) return TRUE;
914  ivTest(v);
916  l->Init(4);
917  l->m[0].rtyp=IDEAL_CMD;
918  l->m[0].data=(void *)f;
919  l->m[1].rtyp=INTVEC_CMD;
920  l->m[1].data=(void *)v;
921  l->m[2].rtyp=IDEAL_CMD;
922  l->m[2].data=(void*) mipos;
923  l->m[3].rtyp=INT_CMD;
924  l->m[3].data=(void*) (long) n;
925  res->data=(void *)l;
926  return FALSE;
927  }
928  else return TRUE;
929  }
930  else
931  #endif
932  /* =================== LLL via NTL ==============================*/
933  #ifdef HAVE_NTL
934  if (strcmp(sys_cmd, "LLL") == 0)
935  {
936  if (h!=NULL)
937  {
938  res->rtyp=h->Typ();
939  if (h->Typ()==MATRIX_CMD)
940  {
941  res->data=(char *)singntl_LLL((matrix)h->Data(), currRing);
942  return FALSE;
943  }
944  else if (h->Typ()==INTMAT_CMD)
945  {
946  res->data=(char *)singntl_LLL((intvec*)h->Data());
947  return FALSE;
948  }
949  else return TRUE;
950  }
951  else return TRUE;
952  }
953  else
954  #endif
955  /* =================== LLL via Flint ==============================*/
956  #ifdef HAVE_FLINT
957  #ifdef FLINT_VER_2_4_5
958  if (strcmp(sys_cmd, "LLL_Flint") == 0)
959  {
960  if (h!=NULL)
961  {
962  if(h->next == NULL)
963  {
964  res->rtyp=h->Typ();
965  if (h->Typ()==BIGINTMAT_CMD)
966  {
967  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
968  return FALSE;
969  }
970  else if (h->Typ()==INTMAT_CMD)
971  {
972  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
973  return FALSE;
974  }
975  else return TRUE;
976  }
977  if(h->next->Typ()!= INT_CMD)
978  {
979  WerrorS("matrix,int or bigint,int expected");
980  return TRUE;
981  }
982  if(h->next->Typ()== INT_CMD)
983  {
984  if(((int)((long)(h->next->Data())) != 0) && (int)((long)(h->next->Data()) != 1))
985  {
986  WerrorS("int is different from 0, 1");
987  return TRUE;
988  }
989  res->rtyp=h->Typ();
990  if((long)(h->next->Data()) == 0)
991  {
992  if (h->Typ()==BIGINTMAT_CMD)
993  {
994  res->data=(char *)singflint_LLL((bigintmat*)h->Data(), NULL);
995  return FALSE;
996  }
997  else if (h->Typ()==INTMAT_CMD)
998  {
999  res->data=(char *)singflint_LLL((intvec*)h->Data(), NULL);
1000  return FALSE;
1001  }
1002  else return TRUE;
1003  }
1004  // This will give also the transformation matrix U s.t. res = U * m
1005  if((long)(h->next->Data()) == 1)
1006  {
1007  if (h->Typ()==BIGINTMAT_CMD)
1008  {
1009  bigintmat* m = (bigintmat*)h->Data();
1010  bigintmat* T = new bigintmat(m->rows(),m->rows(),m->basecoeffs());
1011  for(int i = 1; i<=m->rows(); i++)
1012  {
1013  n_Delete(&(BIMATELEM(*T,i,i)),T->basecoeffs());
1014  BIMATELEM(*T,i,i)=n_Init(1, T->basecoeffs());
1015  }
1016  m = singflint_LLL(m,T);
1018  L->Init(2);
1019  L->m[0].rtyp = BIGINTMAT_CMD; L->m[0].data = (void*)m;
1020  L->m[1].rtyp = BIGINTMAT_CMD; L->m[1].data = (void*)T;
1021  res->data=L;
1022  res->rtyp=LIST_CMD;
1023  return FALSE;
1024  }
1025  else if (h->Typ()==INTMAT_CMD)
1026  {
1027  intvec* m = (intvec*)h->Data();
1028  intvec* T = new intvec(m->rows(),m->rows(),(int)0);
1029  for(int i = 1; i<=m->rows(); i++)
1030  IMATELEM(*T,i,i)=1;
1031  m = singflint_LLL(m,T);
1033  L->Init(2);
1034  L->m[0].rtyp = INTMAT_CMD; L->m[0].data = (void*)m;
1035  L->m[1].rtyp = INTMAT_CMD; L->m[1].data = (void*)T;
1036  res->data=L;
1037  res->rtyp=LIST_CMD;
1038  return FALSE;
1039  }
1040  else return TRUE;
1041  }
1042  }
1043 
1044  }
1045  else return TRUE;
1046  }
1047  else
1048  #endif
1049  #endif
1050  /*==================== shift-test for freeGB =================*/
1051  #ifdef HAVE_SHIFTBBA
1052  if (strcmp(sys_cmd, "stest") == 0)
1053  {
1054  const short t[]={4,POLY_CMD,INT_CMD,INT_CMD,INT_CMD};
1055  if (iiCheckTypes(h,t,1))
1056  {
1057  poly p=(poly)h->CopyD();
1058  h=h->next;
1059  int sh=(int)((long)(h->Data()));
1060  h=h->next;
1061  int uptodeg=(int)((long)(h->Data()));
1062  h=h->next;
1063  int lVblock=(int)((long)(h->Data()));
1064  res->data = pLPshift(p,sh,uptodeg,lVblock);
1065  res->rtyp = POLY_CMD;
1066  return FALSE;
1067  }
1068  else return TRUE;
1069  }
1070  else
1071  #endif
1072  /*==================== block-test for freeGB =================*/
1073  #ifdef HAVE_SHIFTBBA
1074  if (strcmp(sys_cmd, "btest") == 0)
1075  {
1076  const short t[]={2,POLY_CMD,INT_CMD};
1077  if (iiCheckTypes(h,t,1))
1078  {
1079  poly p=(poly)h->CopyD();
1080  h=h->next;
1081  int lV=(int)((long)(h->Data()));
1082  res->rtyp = INT_CMD;
1083  res->data = (void*)(long)pLastVblock(p, lV);
1084  return FALSE;
1085  }
1086  else return TRUE;
1087  }
1088  else
1089  #endif
1090  /*==================== shrink-test for freeGB =================*/
1091  #ifdef HAVE_SHIFTBBA
1092  if (strcmp(sys_cmd, "shrinktest") == 0)
1093  {
1094  const short t[]={2,POLY_CMD,INT_CMD};
1095  if (iiCheckTypes(h,t,1))
1096  {
1097  poly p=(poly)h->Data();
1098  h=h->next;
1099  int lV=(int)((long)(h->Data()));
1100  res->rtyp = POLY_CMD;
1101  // res->data = p_mShrink(p, lV, currRing);
1102  // kStrategy strat=new skStrategy;
1103  // strat->tailRing = currRing;
1104  res->data = p_Shrink(p, lV, currRing);
1105  return FALSE;
1106  }
1107  else return TRUE;
1108  }
1109  else
1110  #endif
1111  /*==================== pcv ==================================*/
1112  #ifdef HAVE_PCV
1113  if(strcmp(sys_cmd,"pcvLAddL")==0)
1114  {
1115  return pcvLAddL(res,h);
1116  }
1117  else
1118  if(strcmp(sys_cmd,"pcvPMulL")==0)
1119  {
1120  return pcvPMulL(res,h);
1121  }
1122  else
1123  if(strcmp(sys_cmd,"pcvMinDeg")==0)
1124  {
1125  return pcvMinDeg(res,h);
1126  }
1127  else
1128  if(strcmp(sys_cmd,"pcvP2CV")==0)
1129  {
1130  return pcvP2CV(res,h);
1131  }
1132  else
1133  if(strcmp(sys_cmd,"pcvCV2P")==0)
1134  {
1135  return pcvCV2P(res,h);
1136  }
1137  else
1138  if(strcmp(sys_cmd,"pcvDim")==0)
1139  {
1140  return pcvDim(res,h);
1141  }
1142  else
1143  if(strcmp(sys_cmd,"pcvBasis")==0)
1144  {
1145  return pcvBasis(res,h);
1146  }
1147  else
1148  #endif
1149  /*==================== hessenberg/eigenvalues ==================================*/
1150  #ifdef HAVE_EIGENVAL
1151  if(strcmp(sys_cmd,"hessenberg")==0)
1152  {
1153  return evHessenberg(res,h);
1154  }
1155  else
1156  #endif
1157  /*==================== eigenvalues ==================================*/
1158  #ifdef HAVE_EIGENVAL
1159  if(strcmp(sys_cmd,"eigenvals")==0)
1160  {
1161  return evEigenvals(res,h);
1162  }
1163  else
1164  #endif
1165  /*==================== rowelim ==================================*/
1166  #ifdef HAVE_EIGENVAL
1167  if(strcmp(sys_cmd,"rowelim")==0)
1168  {
1169  return evRowElim(res,h);
1170  }
1171  else
1172  #endif
1173  /*==================== rowcolswap ==================================*/
1174  #ifdef HAVE_EIGENVAL
1175  if(strcmp(sys_cmd,"rowcolswap")==0)
1176  {
1177  return evSwap(res,h);
1178  }
1179  else
1180  #endif
1181  /*==================== Gauss-Manin system ==================================*/
1182  #ifdef HAVE_GMS
1183  if(strcmp(sys_cmd,"gmsnf")==0)
1184  {
1185  return gmsNF(res,h);
1186  }
1187  else
1188  #endif
1189  /*==================== contributors =============================*/
1190  if(strcmp(sys_cmd,"contributors") == 0)
1191  {
1192  res->rtyp=STRING_CMD;
1193  res->data=(void *)omStrDup(
1194  "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");
1195  return FALSE;
1196  }
1197  else
1198  /*==================== spectrum =============================*/
1199  #ifdef HAVE_SPECTRUM
1200  if(strcmp(sys_cmd,"spectrum") == 0)
1201  {
1202  if ((h==NULL) || (h->Typ()!=POLY_CMD))
1203  {
1204  WerrorS("poly expected");
1205  return TRUE;
1206  }
1207  if (h->next==NULL)
1208  return spectrumProc(res,h);
1209  if (h->next->Typ()!=INT_CMD)
1210  {
1211  WerrorS("poly,int expected");
1212  return TRUE;
1213  }
1214  if(((long)h->next->Data())==1L)
1215  return spectrumfProc(res,h);
1216  return spectrumProc(res,h);
1217  }
1218  else
1219  /*==================== semic =============================*/
1220  if(strcmp(sys_cmd,"semic") == 0)
1221  {
1222  if ((h->next!=NULL)
1223  && (h->Typ()==LIST_CMD)
1224  && (h->next->Typ()==LIST_CMD))
1225  {
1226  if (h->next->next==NULL)
1227  return semicProc(res,h,h->next);
1228  else if (h->next->next->Typ()==INT_CMD)
1229  return semicProc3(res,h,h->next,h->next->next);
1230  }
1231  return TRUE;
1232  }
1233  else
1234  /*==================== spadd =============================*/
1235  if(strcmp(sys_cmd,"spadd") == 0)
1236  {
1237  const short t[]={2,LIST_CMD,LIST_CMD};
1238  if (iiCheckTypes(h,t,1))
1239  {
1240  return spaddProc(res,h,h->next);
1241  }
1242  return TRUE;
1243  }
1244  else
1245  /*==================== spmul =============================*/
1246  if(strcmp(sys_cmd,"spmul") == 0)
1247  {
1248  const short t[]={2,LIST_CMD,INT_CMD};
1249  if (iiCheckTypes(h,t,1))
1250  {
1251  return spmulProc(res,h,h->next);
1252  }
1253  return TRUE;
1254  }
1255  else
1256  #endif
1257 /*==================== tensorModuleMult ========================= */
1258  #define HAVE_SHEAFCOH_TRICKS 1
1259 
1260  #ifdef HAVE_SHEAFCOH_TRICKS
1261  if(strcmp(sys_cmd,"tensorModuleMult")==0)
1262  {
1263  const short t[]={2,INT_CMD,MODUL_CMD};
1264  // WarnS("tensorModuleMult!");
1265  if (iiCheckTypes(h,t,1))
1266  {
1267  int m = (int)( (long)h->Data() );
1268  ideal M = (ideal)h->next->Data();
1269  res->rtyp=MODUL_CMD;
1270  res->data=(void *)id_TensorModuleMult(m, M, currRing);
1271  return FALSE;
1272  }
1273  return TRUE;
1274  }
1275  else
1276  #endif
1277  /*==================== twostd =================*/
1278  #ifdef HAVE_PLURAL
1279  if (strcmp(sys_cmd, "twostd") == 0)
1280  {
1281  ideal I;
1282  if ((h!=NULL) && (h->Typ()==IDEAL_CMD))
1283  {
1284  I=(ideal)h->CopyD();
1285  res->rtyp=IDEAL_CMD;
1286  if (rIsPluralRing(currRing)) res->data=twostd(I);
1287  else res->data=I;
1288  setFlag(res,FLAG_TWOSTD);
1289  setFlag(res,FLAG_STD);
1290  }
1291  else return TRUE;
1292  return FALSE;
1293  }
1294  else
1295  #endif
1296  /*==================== lie bracket =================*/
1297  #ifdef HAVE_PLURAL
1298  if (strcmp(sys_cmd, "bracket") == 0)
1299  {
1300  const short t[]={2,POLY_CMD,POLY_CMD};
1301  if (iiCheckTypes(h,t,1))
1302  {
1303  poly p=(poly)h->CopyD();
1304  h=h->next;
1305  poly q=(poly)h->Data();
1306  res->rtyp=POLY_CMD;
1308  return FALSE;
1309  }
1310  return TRUE;
1311  }
1312  else
1313  #endif
1314  /*==================== env ==================================*/
1315  #ifdef HAVE_PLURAL
1316  if (strcmp(sys_cmd, "env")==0)
1317  {
1318  if ((h!=NULL) && (h->Typ()==RING_CMD))
1319  {
1320  ring r = (ring)h->Data();
1321  res->data = rEnvelope(r);
1322  res->rtyp = RING_CMD;
1323  return FALSE;
1324  }
1325  else
1326  {
1327  WerrorS("`system(\"env\",<ring>)` expected");
1328  return TRUE;
1329  }
1330  }
1331  else
1332  #endif
1333 /* ============ opp ======================== */
1334  #ifdef HAVE_PLURAL
1335  if (strcmp(sys_cmd, "opp")==0)
1336  {
1337  if ((h!=NULL) && (h->Typ()==RING_CMD))
1338  {
1339  ring r=(ring)h->Data();
1340  res->data=rOpposite(r);
1341  res->rtyp=RING_CMD;
1342  return FALSE;
1343  }
1344  else
1345  {
1346  WerrorS("`system(\"opp\",<ring>)` expected");
1347  return TRUE;
1348  }
1349  }
1350  else
1351  #endif
1352  /*==================== oppose ==================================*/
1353  #ifdef HAVE_PLURAL
1354  if (strcmp(sys_cmd, "oppose")==0)
1355  {
1356  if ((h!=NULL) && (h->Typ()==RING_CMD)
1357  && (h->next!= NULL))
1358  {
1359  ring Rop = (ring)h->Data();
1360  h = h->next;
1361  idhdl w;
1362  if ((w=Rop->idroot->get(h->Name(),myynest))!=NULL)
1363  {
1364  poly p = (poly)IDDATA(w);
1365  res->data = pOppose(Rop, p, currRing); // into CurrRing?
1366  res->rtyp = POLY_CMD;
1367  return FALSE;
1368  }
1369  }
1370  else
1371  {
1372  WerrorS("`system(\"oppose\",<ring>,<poly>)` expected");
1373  return TRUE;
1374  }
1375  }
1376  else
1377  #endif
1378  /*==================== freeGB, twosided GB in free algebra =================*/
1379  #ifdef HAVE_PLURAL
1380  #ifdef HAVE_SHIFTBBA
1381  if (strcmp(sys_cmd, "freegb") == 0)
1382  {
1383  const short t[]={3,IDEAL_CMD,INT_CMD,INT_CMD};
1384  if (iiCheckTypes(h,t,1))
1385  {
1386  ideal I=(ideal)h->CopyD();
1387  h=h->next;
1388  int uptodeg=(int)((long)(h->Data()));
1389  h=h->next;
1390  int lVblock=(int)((long)(h->Data()));
1391  res->data = freegb(I,uptodeg,lVblock);
1392  if (res->data == NULL)
1393  {
1394  /* that is there were input errors */
1395  res->data = I;
1396  }
1397  res->rtyp = IDEAL_CMD;
1398  return FALSE;
1399  }
1400  else return TRUE;
1401  }
1402  else
1403  #endif /*SHIFTBBA*/
1404  #endif /*PLURAL*/
1405  /*==================== walk stuff =================*/
1406  /*==================== walkNextWeight =================*/
1407  #ifdef HAVE_WALK
1408  #ifdef OWNW
1409  if (strcmp(sys_cmd, "walkNextWeight") == 0)
1410  {
1411  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1412  if (!iiCheckTypes(h,t,1)) return TRUE;
1413  if (((intvec*) h->Data())->length() != currRing->N ||
1414  ((intvec*) h->next->Data())->length() != currRing->N)
1415  {
1416  Werror("system(\"walkNextWeight\" ...) intvecs not of length %d\n",
1417  currRing->N);
1418  return TRUE;
1419  }
1420  res->data = (void*) walkNextWeight(((intvec*) h->Data()),
1421  ((intvec*) h->next->Data()),
1422  (ideal) h->next->next->Data());
1423  if (res->data == NULL || res->data == (void*) 1L)
1424  {
1425  res->rtyp = INT_CMD;
1426  }
1427  else
1428  {
1429  res->rtyp = INTVEC_CMD;
1430  }
1431  return FALSE;
1432  }
1433  else
1434  #endif
1435  #endif
1436  /*==================== walkNextWeight =================*/
1437  #ifdef HAVE_WALK
1438  #ifdef OWNW
1439  if (strcmp(sys_cmd, "walkInitials") == 0)
1440  {
1441  if (h == NULL || h->Typ() != IDEAL_CMD)
1442  {
1443  WerrorS("system(\"walkInitials\", ideal) expected");
1444  return TRUE;
1445  }
1446  res->data = (void*) walkInitials((ideal) h->Data());
1447  res->rtyp = IDEAL_CMD;
1448  return FALSE;
1449  }
1450  else
1451  #endif
1452  #endif
1453  /*==================== walkAddIntVec =================*/
1454  #ifdef HAVE_WALK
1455  #ifdef WAIV
1456  if (strcmp(sys_cmd, "walkAddIntVec") == 0)
1457  {
1458  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1459  if (!iiCheckTypes(h,t,1)) return TRUE;
1460  intvec* arg1 = (intvec*) h->Data();
1461  intvec* arg2 = (intvec*) h->next->Data();
1462  res->data = (intvec*) walkAddIntVec(arg1, arg2);
1463  res->rtyp = INTVEC_CMD;
1464  return FALSE;
1465  }
1466  else
1467  #endif
1468  #endif
1469  /*==================== MwalkNextWeight =================*/
1470  #ifdef HAVE_WALK
1471  #ifdef MwaklNextWeight
1472  if (strcmp(sys_cmd, "MwalkNextWeight") == 0)
1473  {
1474  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1475  if (!iiCheckTypes(h,t,1)) return TRUE;
1476  if (((intvec*) h->Data())->length() != currRing->N ||
1477  ((intvec*) h->next->Data())->length() != currRing->N)
1478  {
1479  Werror("system(\"MwalkNextWeight\" ...) intvecs not of length %d\n",
1480  currRing->N);
1481  return TRUE;
1482  }
1483  intvec* arg1 = (intvec*) h->Data();
1484  intvec* arg2 = (intvec*) h->next->Data();
1485  ideal arg3 = (ideal) h->next->next->Data();
1486  intvec* result = (intvec*) MwalkNextWeight(arg1, arg2, arg3);
1487  res->rtyp = INTVEC_CMD;
1488  res->data = result;
1489  return FALSE;
1490  }
1491  else
1492  #endif //MWalkNextWeight
1493  #endif
1494  /*==================== Mivdp =================*/
1495  #ifdef HAVE_WALK
1496  if(strcmp(sys_cmd, "Mivdp") == 0)
1497  {
1498  if (h == NULL || h->Typ() != INT_CMD)
1499  {
1500  WerrorS("system(\"Mivdp\", int) expected");
1501  return TRUE;
1502  }
1503  if ((int) ((long)(h->Data())) != currRing->N)
1504  {
1505  Werror("system(\"Mivdp\" ...) intvecs not of length %d\n",
1506  currRing->N);
1507  return TRUE;
1508  }
1509  int arg1 = (int) ((long)(h->Data()));
1510  intvec* result = (intvec*) Mivdp(arg1);
1511  res->rtyp = INTVEC_CMD;
1512  res->data = result;
1513  return FALSE;
1514  }
1515  else
1516  #endif
1517  /*==================== Mivlp =================*/
1518  #ifdef HAVE_WALK
1519  if(strcmp(sys_cmd, "Mivlp") == 0)
1520  {
1521  if (h == NULL || h->Typ() != INT_CMD)
1522  {
1523  WerrorS("system(\"Mivlp\", int) expected");
1524  return TRUE;
1525  }
1526  if ((int) ((long)(h->Data())) != currRing->N)
1527  {
1528  Werror("system(\"Mivlp\" ...) intvecs not of length %d\n",
1529  currRing->N);
1530  return TRUE;
1531  }
1532  int arg1 = (int) ((long)(h->Data()));
1533  intvec* result = (intvec*) Mivlp(arg1);
1534  res->rtyp = INTVEC_CMD;
1535  res->data = result;
1536  return FALSE;
1537  }
1538  else
1539  #endif
1540  /*==================== MpDiv =================*/
1541  #ifdef HAVE_WALK
1542  #ifdef MpDiv
1543  if(strcmp(sys_cmd, "MpDiv") == 0)
1544  {
1545  const short t[]={2,POLY_CMD,POLY_CMD};
1546  if (!iiCheckTypes(h,t,1)) return TRUE;
1547  poly arg1 = (poly) h->Data();
1548  poly arg2 = (poly) h->next->Data();
1549  poly result = MpDiv(arg1, arg2);
1550  res->rtyp = POLY_CMD;
1551  res->data = result;
1552  return FALSE;
1553  }
1554  else
1555  #endif
1556  #endif
1557  /*==================== MpMult =================*/
1558  #ifdef HAVE_WALK
1559  #ifdef MpMult
1560  if(strcmp(sys_cmd, "MpMult") == 0)
1561  {
1562  const short t[]={2,POLY_CMD,POLY_CMD};
1563  if (!iiCheckTypes(h,t,1)) return TRUE;
1564  poly arg1 = (poly) h->Data();
1565  poly arg2 = (poly) h->next->Data();
1566  poly result = MpMult(arg1, arg2);
1567  res->rtyp = POLY_CMD;
1568  res->data = result;
1569  return FALSE;
1570  }
1571  else
1572  #endif
1573  #endif
1574  /*==================== MivSame =================*/
1575  #ifdef HAVE_WALK
1576  if (strcmp(sys_cmd, "MivSame") == 0)
1577  {
1578  const short t[]={2,INTVEC_CMD,INTVEC_CMD};
1579  if (!iiCheckTypes(h,t,1)) return TRUE;
1580  /*
1581  if (((intvec*) h->Data())->length() != currRing->N ||
1582  ((intvec*) h->next->Data())->length() != currRing->N)
1583  {
1584  Werror("system(\"MivSame\" ...) intvecs not of length %d\n",
1585  currRing->N);
1586  return TRUE;
1587  }
1588  */
1589  intvec* arg1 = (intvec*) h->Data();
1590  intvec* arg2 = (intvec*) h->next->Data();
1591  /*
1592  poly result = (poly) MivSame(arg1, arg2);
1593  res->rtyp = POLY_CMD;
1594  res->data = (poly) result;
1595  */
1596  res->rtyp = INT_CMD;
1597  res->data = (void*)(long) MivSame(arg1, arg2);
1598  return FALSE;
1599  }
1600  else
1601  #endif
1602  /*==================== M3ivSame =================*/
1603  #ifdef HAVE_WALK
1604  if (strcmp(sys_cmd, "M3ivSame") == 0)
1605  {
1606  const short t[]={3,INTVEC_CMD,INTVEC_CMD,INTVEC_CMD};
1607  if (!iiCheckTypes(h,t,1)) return TRUE;
1608  /*
1609  if (((intvec*) h->Data())->length() != currRing->N ||
1610  ((intvec*) h->next->Data())->length() != currRing->N ||
1611  ((intvec*) h->next->next->Data())->length() != currRing->N )
1612  {
1613  Werror("system(\"M3ivSame\" ...) intvecs not of length %d\n",
1614  currRing->N);
1615  return TRUE;
1616  }
1617  */
1618  intvec* arg1 = (intvec*) h->Data();
1619  intvec* arg2 = (intvec*) h->next->Data();
1620  intvec* arg3 = (intvec*) h->next->next->Data();
1621  /*
1622  poly result = (poly) M3ivSame(arg1, arg2, arg3);
1623  res->rtyp = POLY_CMD;
1624  res->data = (poly) result;
1625  */
1626  res->rtyp = INT_CMD;
1627  res->data = (void*)(long) M3ivSame(arg1, arg2, arg3);
1628  return FALSE;
1629  }
1630  else
1631  #endif
1632  /*==================== MwalkInitialForm =================*/
1633  #ifdef HAVE_WALK
1634  if(strcmp(sys_cmd, "MwalkInitialForm") == 0)
1635  {
1636  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1637  if (!iiCheckTypes(h,t,1)) return TRUE;
1638  if(((intvec*) h->next->Data())->length() != currRing->N)
1639  {
1640  Werror("system \"MwalkInitialForm\"...) intvec not of length %d\n",
1641  currRing->N);
1642  return TRUE;
1643  }
1644  ideal id = (ideal) h->Data();
1645  intvec* int_w = (intvec*) h->next->Data();
1646  ideal result = (ideal) MwalkInitialForm(id, int_w);
1647  res->rtyp = IDEAL_CMD;
1648  res->data = result;
1649  return FALSE;
1650  }
1651  else
1652  #endif
1653  /*==================== MivMatrixOrder =================*/
1654  #ifdef HAVE_WALK
1655  /************** Perturbation walk **********/
1656  if(strcmp(sys_cmd, "MivMatrixOrder") == 0)
1657  {
1658  if(h==NULL || h->Typ() != INTVEC_CMD)
1659  {
1660  WerrorS("system(\"MivMatrixOrder\",intvec) expected");
1661  return TRUE;
1662  }
1663  intvec* arg1 = (intvec*) h->Data();
1664  intvec* result = MivMatrixOrder(arg1);
1665  res->rtyp = INTVEC_CMD;
1666  res->data = result;
1667  return FALSE;
1668  }
1669  else
1670  #endif
1671  /*==================== MivMatrixOrderdp =================*/
1672  #ifdef HAVE_WALK
1673  if(strcmp(sys_cmd, "MivMatrixOrderdp") == 0)
1674  {
1675  if(h==NULL || h->Typ() != INT_CMD)
1676  {
1677  WerrorS("system(\"MivMatrixOrderdp\",intvec) expected");
1678  return TRUE;
1679  }
1680  int arg1 = (int) ((long)(h->Data()));
1681  intvec* result = (intvec*) MivMatrixOrderdp(arg1);
1682  res->rtyp = INTVEC_CMD;
1683  res->data = result;
1684  return FALSE;
1685  }
1686  else
1687  #endif
1688  /*==================== MPertVectors =================*/
1689  #ifdef HAVE_WALK
1690  if(strcmp(sys_cmd, "MPertVectors") == 0)
1691  {
1692  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1693  if (!iiCheckTypes(h,t,1)) return TRUE;
1694  ideal arg1 = (ideal) h->Data();
1695  intvec* arg2 = (intvec*) h->next->Data();
1696  int arg3 = (int) ((long)(h->next->next->Data()));
1697  intvec* result = (intvec*) MPertVectors(arg1, arg2, arg3);
1698  res->rtyp = INTVEC_CMD;
1699  res->data = result;
1700  return FALSE;
1701  }
1702  else
1703  #endif
1704  /*==================== MPertVectorslp =================*/
1705  #ifdef HAVE_WALK
1706  if(strcmp(sys_cmd, "MPertVectorslp") == 0)
1707  {
1708  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INT_CMD};
1709  if (!iiCheckTypes(h,t,1)) return TRUE;
1710  ideal arg1 = (ideal) h->Data();
1711  intvec* arg2 = (intvec*) h->next->Data();
1712  int arg3 = (int) ((long)(h->next->next->Data()));
1713  intvec* result = (intvec*) MPertVectorslp(arg1, arg2, arg3);
1714  res->rtyp = INTVEC_CMD;
1715  res->data = result;
1716  return FALSE;
1717  }
1718  else
1719  #endif
1720  /************** fractal walk **********/
1721  #ifdef HAVE_WALK
1722  if(strcmp(sys_cmd, "Mfpertvector") == 0)
1723  {
1724  const short t[]={2,IDEAL_CMD,INTVEC_CMD};
1725  if (!iiCheckTypes(h,t,1)) return TRUE;
1726  ideal arg1 = (ideal) h->Data();
1727  intvec* arg2 = (intvec*) h->next->Data();
1728  intvec* result = Mfpertvector(arg1, arg2);
1729  res->rtyp = INTVEC_CMD;
1730  res->data = result;
1731  return FALSE;
1732  }
1733  else
1734  #endif
1735  /*==================== MivUnit =================*/
1736  #ifdef HAVE_WALK
1737  if(strcmp(sys_cmd, "MivUnit") == 0)
1738  {
1739  const short t[]={1,INT_CMD};
1740  if (!iiCheckTypes(h,t,1)) return TRUE;
1741  int arg1 = (int) ((long)(h->Data()));
1742  intvec* result = (intvec*) MivUnit(arg1);
1743  res->rtyp = INTVEC_CMD;
1744  res->data = result;
1745  return FALSE;
1746  }
1747  else
1748  #endif
1749  /*==================== MivWeightOrderlp =================*/
1750  #ifdef HAVE_WALK
1751  if(strcmp(sys_cmd, "MivWeightOrderlp") == 0)
1752  {
1753  const short t[]={1,INTVEC_CMD};
1754  if (!iiCheckTypes(h,t,1)) return TRUE;
1755  intvec* arg1 = (intvec*) h->Data();
1756  intvec* result = MivWeightOrderlp(arg1);
1757  res->rtyp = INTVEC_CMD;
1758  res->data = result;
1759  return FALSE;
1760  }
1761  else
1762  #endif
1763  /*==================== MivWeightOrderdp =================*/
1764  #ifdef HAVE_WALK
1765  if(strcmp(sys_cmd, "MivWeightOrderdp") == 0)
1766  {
1767  if(h==NULL || h->Typ() != INTVEC_CMD)
1768  {
1769  WerrorS("system(\"MivWeightOrderdp\",intvec) expected");
1770  return TRUE;
1771  }
1772  intvec* arg1 = (intvec*) h->Data();
1773  //int arg2 = (int) h->next->Data();
1774  intvec* result = MivWeightOrderdp(arg1);
1775  res->rtyp = INTVEC_CMD;
1776  res->data = result;
1777  return FALSE;
1778  }
1779  else
1780  #endif
1781  /*==================== MivMatrixOrderlp =================*/
1782  #ifdef HAVE_WALK
1783  if(strcmp(sys_cmd, "MivMatrixOrderlp") == 0)
1784  {
1785  if(h==NULL || h->Typ() != INT_CMD)
1786  {
1787  WerrorS("system(\"MivMatrixOrderlp\",int) expected");
1788  return TRUE;
1789  }
1790  int arg1 = (int) ((long)(h->Data()));
1791  intvec* result = (intvec*) MivMatrixOrderlp(arg1);
1792  res->rtyp = INTVEC_CMD;
1793  res->data = result;
1794  return FALSE;
1795  }
1796  else
1797  #endif
1798  /*==================== MkInterRedNextWeight =================*/
1799  #ifdef HAVE_WALK
1800  if (strcmp(sys_cmd, "MkInterRedNextWeight") == 0)
1801  {
1802  const short t[]={3,INTVEC_CMD,INTVEC_CMD,IDEAL_CMD};
1803  if (!iiCheckTypes(h,t,1)) return TRUE;
1804  if (((intvec*) h->Data())->length() != currRing->N ||
1805  ((intvec*) h->next->Data())->length() != currRing->N)
1806  {
1807  Werror("system(\"MkInterRedNextWeight\" ...) intvecs not of length %d\n",
1808  currRing->N);
1809  return TRUE;
1810  }
1811  intvec* arg1 = (intvec*) h->Data();
1812  intvec* arg2 = (intvec*) h->next->Data();
1813  ideal arg3 = (ideal) h->next->next->Data();
1814  intvec* result = (intvec*) MkInterRedNextWeight(arg1, arg2, arg3);
1815  res->rtyp = INTVEC_CMD;
1816  res->data = result;
1817  return FALSE;
1818  }
1819  else
1820  #endif
1821  /*==================== MPertNextWeight =================*/
1822  #ifdef HAVE_WALK
1823  #ifdef MPertNextWeight
1824  if (strcmp(sys_cmd, "MPertNextWeight") == 0)
1825  {
1826  const short t[]={3,INTVEC_CMD,IDEAL_CMD,INT_CMD};
1827  if (!iiCheckTypes(h,t,1)) return TRUE;
1828  if (((intvec*) h->Data())->length() != currRing->N)
1829  {
1830  Werror("system(\"MPertNextWeight\" ...) intvecs not of length %d\n",
1831  currRing->N);
1832  return TRUE;
1833  }
1834  intvec* arg1 = (intvec*) h->Data();
1835  ideal arg2 = (ideal) h->next->Data();
1836  int arg3 = (int) h->next->next->Data();
1837  intvec* result = (intvec*) MPertNextWeight(arg1, arg2, arg3);
1838  res->rtyp = INTVEC_CMD;
1839  res->data = result;
1840  return FALSE;
1841  }
1842  else
1843  #endif //MPertNextWeight
1844  #endif
1845  /*==================== Mivperttarget =================*/
1846  #ifdef HAVE_WALK
1847  #ifdef Mivperttarget
1848  if (strcmp(sys_cmd, "Mivperttarget") == 0)
1849  {
1850  const short t[]={2,IDEAL_CMD,INT_CMD};
1851  if (!iiCheckTypes(h,t,1)) return TRUE;
1852  ideal arg1 = (ideal) h->Data();
1853  int arg2 = (int) h->next->Data();
1854  intvec* result = (intvec*) Mivperttarget(arg1, arg2);
1855  res->rtyp = INTVEC_CMD;
1856  res->data = result;
1857  return FALSE;
1858  }
1859  else
1860  #endif //Mivperttarget
1861  #endif
1862  /*==================== Mwalk =================*/
1863  #ifdef HAVE_WALK
1864  if (strcmp(sys_cmd, "Mwalk") == 0)
1865  {
1866  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1867  if (!iiCheckTypes(h,t,1)) return TRUE;
1868  if (((intvec*) h->next->Data())->length() != currRing->N &&
1869  ((intvec*) h->next->next->Data())->length() != currRing->N )
1870  {
1871  Werror("system(\"Mwalk\" ...) intvecs not of length %d\n",
1872  currRing->N);
1873  return TRUE;
1874  }
1875  ideal arg1 = (ideal) h->Data();
1876  intvec* arg2 = (intvec*) h->next->Data();
1877  intvec* arg3 = (intvec*) h->next->next->Data();
1878  ring arg4 = (ring) h->next->next->next->Data();
1879  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1880  res->rtyp = IDEAL_CMD;
1881  res->data = result;
1882  return FALSE;
1883  }
1884  else
1885  #endif
1886  /*==================== Mpwalk =================*/
1887  #ifdef HAVE_WALK
1888  #ifdef MPWALK_ORIG
1889  if (strcmp(sys_cmd, "Mwalk") == 0)
1890  {
1891  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,RING_CMD};
1892  if (!iiCheckTypes(h,t,1)) return TRUE;
1893  if ((((intvec*) h->next->Data())->length() != currRing->N &&
1894  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1895  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1896  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N)))
1897  {
1898  Werror("system(\"Mwalk\" ...) intvecs not of length %d or %d\n",
1899  currRing->N,(currRing->N)*(currRing->N));
1900  return TRUE;
1901  }
1902  ideal arg1 = (ideal) h->Data();
1903  intvec* arg2 = (intvec*) h->next->Data();
1904  intvec* arg3 = (intvec*) h->next->next->Data();
1905  ring arg4 = (ring) h->next->next->next->Data();
1906  ideal result = (ideal) Mwalk(arg1, arg2, arg3,arg4);
1907  res->rtyp = IDEAL_CMD;
1908  res->data = result;
1909  return FALSE;
1910  }
1911  else
1912  #else
1913  if (strcmp(sys_cmd, "Mpwalk") == 0)
1914  {
1915  const short t[]={6,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
1916  if (!iiCheckTypes(h,t,1)) return TRUE;
1917  if(((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1918  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1919  {
1920  Werror("system(\"Mpwalk\" ...) intvecs not of length %d\n",currRing->N);
1921  return TRUE;
1922  }
1923  ideal arg1 = (ideal) h->Data();
1924  int arg2 = (int) (long) h->next->Data();
1925  int arg3 = (int) (long) h->next->next->Data();
1926  intvec* arg4 = (intvec*) h->next->next->next->Data();
1927  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1928  int arg6 = (int) (long) h->next->next->next->next->next->Data();
1929  ideal result = (ideal) Mpwalk(arg1, arg2, arg3, arg4, arg5,arg6);
1930  res->rtyp = IDEAL_CMD;
1931  res->data = result;
1932  return FALSE;
1933  }
1934  else
1935  #endif
1936  #endif
1937  /*==================== Mrwalk =================*/
1938  #ifdef HAVE_WALK
1939  if (strcmp(sys_cmd, "Mrwalk") == 0)
1940  {
1941  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};
1942  if (!iiCheckTypes(h,t,1)) return TRUE;
1943  if((((intvec*) h->next->Data())->length() != currRing->N &&
1944  ((intvec*) h->next->next->Data())->length() != currRing->N ) &&
1945  (((intvec*) h->next->Data())->length() != (currRing->N)*(currRing->N) &&
1946  ((intvec*) h->next->next->Data())->length() != (currRing->N)*(currRing->N) ))
1947  {
1948  Werror("system(\"Mrwalk\" ...) intvecs not of length %d or %d\n",
1949  currRing->N,(currRing->N)*(currRing->N));
1950  return TRUE;
1951  }
1952  ideal arg1 = (ideal) h->Data();
1953  intvec* arg2 = (intvec*) h->next->Data();
1954  intvec* arg3 = (intvec*) h->next->next->Data();
1955  int arg4 = (int)(long) h->next->next->next->Data();
1956  int arg5 = (int)(long) h->next->next->next->next->Data();
1957  ring arg6 = (ring) h->next->next->next->next->next->Data();
1958  ideal result = (ideal) Mrwalk(arg1, arg2, arg3, arg4, arg5, arg6);
1959  res->rtyp = IDEAL_CMD;
1960  res->data = result;
1961  return FALSE;
1962  }
1963  else
1964  #endif
1965  /*==================== MAltwalk1 =================*/
1966  #ifdef HAVE_WALK
1967  if (strcmp(sys_cmd, "MAltwalk1") == 0)
1968  {
1969  const short t[]={5,IDEAL_CMD,INT_CMD,INT_CMD,INTVEC_CMD,INTVEC_CMD};
1970  if (!iiCheckTypes(h,t,1)) return TRUE;
1971  if (((intvec*) h->next->next->next->Data())->length() != currRing->N &&
1972  ((intvec*) h->next->next->next->next->Data())->length()!=currRing->N)
1973  {
1974  Werror("system(\"MAltwalk1\" ...) intvecs not of length %d\n",
1975  currRing->N);
1976  return TRUE;
1977  }
1978  ideal arg1 = (ideal) h->Data();
1979  int arg2 = (int) ((long)(h->next->Data()));
1980  int arg3 = (int) ((long)(h->next->next->Data()));
1981  intvec* arg4 = (intvec*) h->next->next->next->Data();
1982  intvec* arg5 = (intvec*) h->next->next->next->next->Data();
1983  ideal result = (ideal) MAltwalk1(arg1, arg2, arg3, arg4, arg5);
1984  res->rtyp = IDEAL_CMD;
1985  res->data = result;
1986  return FALSE;
1987  }
1988  else
1989  #endif
1990  /*==================== MAltwalk1 =================*/
1991  #ifdef HAVE_WALK
1992  #ifdef MFWALK_ALT
1993  if (strcmp(sys_cmd, "Mfwalk_alt") == 0)
1994  {
1995  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_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(\"Mfwalk\" ...) intvecs not of length %d\n",
2001  currRing->N);
2002  return TRUE;
2003  }
2004  ideal arg1 = (ideal) h->Data();
2005  intvec* arg2 = (intvec*) h->next->Data();
2006  intvec* arg3 = (intvec*) h->next->next->Data();
2007  int arg4 = (int) h->next->next->next->Data();
2008  ideal result = (ideal) Mfwalk_alt(arg1, arg2, arg3, arg4);
2009  res->rtyp = IDEAL_CMD;
2010  res->data = result;
2011  return FALSE;
2012  }
2013  else
2014  #endif
2015  #endif
2016  /*==================== Mfwalk =================*/
2017  #ifdef HAVE_WALK
2018  if (strcmp(sys_cmd, "Mfwalk") == 0)
2019  {
2020  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2021  if (!iiCheckTypes(h,t,1)) return TRUE;
2022  if (((intvec*) h->next->Data())->length() != currRing->N &&
2023  ((intvec*) h->next->next->Data())->length() != currRing->N )
2024  {
2025  Werror("system(\"Mfwalk\" ...) intvecs not of length %d\n",
2026  currRing->N);
2027  return TRUE;
2028  }
2029  ideal arg1 = (ideal) h->Data();
2030  intvec* arg2 = (intvec*) h->next->Data();
2031  intvec* arg3 = (intvec*) h->next->next->Data();
2032  ideal result = (ideal) Mfwalk(arg1, arg2, arg3);
2033  res->rtyp = IDEAL_CMD;
2034  res->data = result;
2035  return FALSE;
2036  }
2037  else
2038  #endif
2039  /*==================== Mfrwalk =================*/
2040  #ifdef HAVE_WALK
2041  if (strcmp(sys_cmd, "Mfrwalk") == 0)
2042  {
2043  const short t[]={6,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD,INT_CMD,RING_CMD};
2044  if (!iiCheckTypes(h,t,1)) return TRUE;
2045  if (((intvec*) h->next->Data())->length() != currRing->N &&
2046  ((intvec*) h->next->next->Data())->length() != currRing->N)
2047  {
2048  Werror("system(\"Mfrwalk\" ...) intvecs not of length %d\n",currRing->N);
2049  return TRUE;
2050  }
2051  ideal arg1 = (ideal) h->Data();
2052  intvec* arg2 = (intvec*) h->next->Data();
2053  intvec* arg3 = (intvec*) h->next->next->Data();
2054  int arg4 = (int)(long) h->next->next->next->Data();
2055  ideal result = (ideal) Mfrwalk(arg1, arg2, arg3, arg4);
2056  res->rtyp = IDEAL_CMD;
2057  res->data = result;
2058  return FALSE;
2059  }
2060  else
2061  /*==================== Mprwalk =================*/
2062  if (strcmp(sys_cmd, "Mprwalk") == 0)
2063  {
2065  if (!iiCheckTypes(h,t,1)) return TRUE;
2066  if (((intvec*) h->next->Data())->length() != currRing->N &&
2067  ((intvec*) h->next->next->Data())->length() != currRing->N )
2068  {
2069  Werror("system(\"Mrwalk\" ...) intvecs not of length %d\n",
2070  currRing->N);
2071  return TRUE;
2072  }
2073  ideal arg1 = (ideal) h->Data();
2074  intvec* arg2 = (intvec*) h->next->Data();
2075  intvec* arg3 = (intvec*) h->next->next->Data();
2076  int arg4 = (int)(long) h->next->next->next->Data();
2077  int arg5 = (int)(long) h->next->next->next->next->Data();
2078  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2079  ring arg7 = (ring) h->next->next->next->next->next->next->Data();
2080  ideal result = (ideal) Mprwalk(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
2081  res->rtyp = IDEAL_CMD;
2082  res->data = result;
2083  return FALSE;
2084  }
2085  else
2086  #endif
2087  /*==================== TranMImprovwalk =================*/
2088  #ifdef HAVE_WALK
2089  #ifdef TRAN_Orig
2090  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2091  {
2092  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2093  if (!iiCheckTypes(h,t,1)) return TRUE;
2094  if (((intvec*) h->next->Data())->length() != currRing->N &&
2095  ((intvec*) h->next->next->Data())->length() != currRing->N )
2096  {
2097  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2098  currRing->N);
2099  return TRUE;
2100  }
2101  ideal arg1 = (ideal) h->Data();
2102  intvec* arg2 = (intvec*) h->next->Data();
2103  intvec* arg3 = (intvec*) h->next->next->Data();
2104  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3);
2105  res->rtyp = IDEAL_CMD;
2106  res->data = result;
2107  return FALSE;
2108  }
2109  else
2110  #endif
2111  #endif
2112  /*==================== MAltwalk2 =================*/
2113  #ifdef HAVE_WALK
2114  if (strcmp(sys_cmd, "MAltwalk2") == 0)
2115  {
2116  const short t[]={3,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD};
2117  if (!iiCheckTypes(h,t,1)) return TRUE;
2118  if (((intvec*) h->next->Data())->length() != currRing->N &&
2119  ((intvec*) h->next->next->Data())->length() != currRing->N )
2120  {
2121  Werror("system(\"MAltwalk2\" ...) intvecs not of length %d\n",
2122  currRing->N);
2123  return TRUE;
2124  }
2125  ideal arg1 = (ideal) h->Data();
2126  intvec* arg2 = (intvec*) h->next->Data();
2127  intvec* arg3 = (intvec*) h->next->next->Data();
2128  ideal result = (ideal) MAltwalk2(arg1, arg2, arg3);
2129  res->rtyp = IDEAL_CMD;
2130  res->data = result;
2131  return FALSE;
2132  }
2133  else
2134  #endif
2135  /*==================== MAltwalk2 =================*/
2136  #ifdef HAVE_WALK
2137  if (strcmp(sys_cmd, "TranMImprovwalk") == 0)
2138  {
2139  const short t[]={4,IDEAL_CMD,INTVEC_CMD,INTVEC_CMD,INT_CMD};
2140  if (!iiCheckTypes(h,t,1)) return TRUE;
2141  if (((intvec*) h->next->Data())->length() != currRing->N &&
2142  ((intvec*) h->next->next->Data())->length() != currRing->N )
2143  {
2144  Werror("system(\"TranMImprovwalk\" ...) intvecs not of length %d\n",
2145  currRing->N);
2146  return TRUE;
2147  }
2148  ideal arg1 = (ideal) h->Data();
2149  intvec* arg2 = (intvec*) h->next->Data();
2150  intvec* arg3 = (intvec*) h->next->next->Data();
2151  int arg4 = (int) ((long)(h->next->next->next->Data()));
2152  ideal result = (ideal) TranMImprovwalk(arg1, arg2, arg3, arg4);
2153  res->rtyp = IDEAL_CMD;
2154  res->data = result;
2155  return FALSE;
2156  }
2157  else
2158  #endif
2159  /*==================== TranMrImprovwalk =================*/
2160  #if 0
2161  #ifdef HAVE_WALK
2162  if (strcmp(sys_cmd, "TranMrImprovwalk") == 0)
2163  {
2164  if (h == NULL || h->Typ() != IDEAL_CMD ||
2165  h->next == NULL || h->next->Typ() != INTVEC_CMD ||
2166  h->next->next == NULL || h->next->next->Typ() != INTVEC_CMD ||
2167  h->next->next->next == NULL || h->next->next->next->Typ() != INT_CMD ||
2168  h->next->next->next == NULL || h->next->next->next->next->Typ() != INT_CMD ||
2169  h->next->next->next == NULL || h->next->next->next->next->next->Typ() != INT_CMD)
2170  {
2171  WerrorS("system(\"TranMrImprovwalk\", ideal, intvec, intvec) expected");
2172  return TRUE;
2173  }
2174  if (((intvec*) h->next->Data())->length() != currRing->N &&
2175  ((intvec*) h->next->next->Data())->length() != currRing->N )
2176  {
2177  Werror("system(\"TranMrImprovwalk\" ...) intvecs not of length %d\n", currRing->N);
2178  return TRUE;
2179  }
2180  ideal arg1 = (ideal) h->Data();
2181  intvec* arg2 = (intvec*) h->next->Data();
2182  intvec* arg3 = (intvec*) h->next->next->Data();
2183  int arg4 = (int)(long) h->next->next->next->Data();
2184  int arg5 = (int)(long) h->next->next->next->next->Data();
2185  int arg6 = (int)(long) h->next->next->next->next->next->Data();
2186  ideal result = (ideal) TranMrImprovwalk(arg1, arg2, arg3, arg4, arg5, arg6);
2187  res->rtyp = IDEAL_CMD;
2188  res->data = result;
2189  return FALSE;
2190  }
2191  else
2192  #endif
2193  #endif
2194  /*================= Extended system call ========================*/
2195  {
2196  #ifndef MAKE_DISTRIBUTION
2197  return(jjEXTENDED_SYSTEM(res, args));
2198  #else
2199  Werror( "system(\"%s\",...) %s", sys_cmd, feNotImplemented );
2200  #endif
2201  }
2202  } /* typ==string */
2203  return TRUE;
2204 }
feOptIndex
Definition: feOptGen.h:15
int & rows()
Definition: matpol.h:24
lists get_denom_list()
Definition: denom_list.cc:8
poly pOppose(ring Rop_src, poly p, const ring Rop_dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3427
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
ideal Mfwalk(ideal G, intvec *ivstart, intvec *ivtarget)
Definition: walk.cc:6814
const CanonicalForm int s
Definition: facAbsFact.cc:55
ring rEnvelope(ring R)
Definition: ring.cc:5517
sleftv * m
Definition: lists.h:45
intvec * MivMatrixOrder(intvec *iv)
Definition: walk.cc:938
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2308
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int HCord
Definition: kutil.cc:227
matrix singntl_LLL(matrix m, const ring s)
Definition: clapsing.cc:1706
intvec * Mfpertvector(ideal G, intvec *ivtarget)
Definition: walk.cc:1492
Definition: tok.h:85
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
matrix evRowElim(matrix M, int i, int j, int k)
Definition: eigenval.cc:47
Definition: lists.h:22
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
char * versionString()
Definition: misc_ip.cc:783
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
intvec * MivWeightOrderlp(intvec *ivstart)
Definition: walk.cc:1416
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4092
Matrices of numbers.
Definition: bigintmat.h:32
#define SINGULAR_VERSION
Definition: mod2.h:94
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:252
lists pcvPMulL(poly p, lists l1)
Definition: pcv.cc:56
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
ring rOpposite(ring src)
Definition: ring.cc:5189
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
int siRandomStart
Definition: cntrlc.cc:103
ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing)
char * getenv()
BOOLEAN spectrumProc(leftv result, leftv first)
Definition: ipshell.cc:3714
#define TRUE
Definition: auxiliary.h:144
int MivSame(intvec *u, intvec *v)
Definition: walk.cc:868
intvec * MivWeightOrderdp(intvec *ivstart)
Definition: walk.cc:1436
BOOLEAN spmulProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4051
void * value
Definition: fegetopt.h:93
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:153
g
Definition: cfModGcd.cc:4031
void WerrorS(const char *s)
Definition: feFopen.cc:23
gmp_complex numbers based on
Definition: mpr_complex.h:178
char * StringEndS()
Definition: reporter.cc:151
bool complexNearZero(gmp_complex *c, int digits)
Definition: mpr_complex.cc:778
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...
int Typ()
Definition: subexpr.cc:955
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
ideal Mfrwalk(ideal G, intvec *ivstart, intvec *ivtarget, int weight_rad)
Definition: walk.cc:6940
const char * Name()
Definition: subexpr.h:121
matrix evSwap(matrix M, int i, int j)
Definition: eigenval.cc:25
Definition: idrec.h:34
#define ivTest(v)
Definition: intvec.h:161
idhdl get(const char *s, int lev)
Definition: ipid.cc:90
intvec * MPertVectorslp(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1279
void * data
Definition: subexpr.h:89
void printBlackboxTypes()
list all defined type (for debugging)
Definition: blackbox.cc:210
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:510
int myynest
Definition: febase.cc:46
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int rBlocks(ring r)
Definition: ring.h:516
const ring r
Definition: syzextra.cc:208
ideal MAltwalk1(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:8446
#define FLAG_TWOSTD
Definition: ipid.h:109
Definition: intvec.h:16
int pcvDim(int d0, int d1)
Definition: pcv.cc:361
ideal Mprwalk(ideal Go, intvec *curr_weight, intvec *target_weight, int weight_rad, int op_deg, int tp_deg, ring baseRing)
Definition: walk.cc:8246
void newstructShow(newstruct_desc d)
Definition: newstruct.cc:829
void StringSetS(const char *st)
Definition: reporter.cc:128
static BOOLEAN jjEXTENDED_SYSTEM(leftv res, leftv h)
Definition: extra.cc:2218
int M3ivSame(intvec *temp, intvec *u, intvec *v)
Definition: walk.cc:889
ideal Mrwalk(ideal Go, intvec *orig_M, intvec *target_M, int weight_rad, int pert_deg, ring baseRing)
Definition: walk.cc:5341
poly pLPshift(poly p, int sh, int uptodeg, int lV)
Definition: shiftgb.cc:155
const char feNotImplemented[]
Definition: reporter.cc:54
struct fe_option feOptSpec[]
ideal Mpwalk(ideal Go, int op_deg, int tp_deg, intvec *curr_weight, intvec *target_weight, int nP)
Definition: walk.cc:5752
intvec * MwalkNextWeight(intvec *curr_weight, intvec *target_weight, ideal G)
ip_smatrix * matrix
intvec * MPertNextWeight(intvec *iva, ideal G, int deg)
idhdl currRingHdl
Definition: ipid.cc:64
#define setFlag(A, F)
Definition: ipid.h:112
int simpleipc_cmd(char *cmd, int id, int v)
Definition: semaphore.c:122
int m
Definition: cfEzgcd.cc:119
void fePrintOptValues()
Definition: feOpt.cc:321
poly pcvCV2P(poly cv, int d0, int d1)
Definition: pcv.cc:263
FILE * f
Definition: checklibs.c:7
int i
Definition: cfEzgcd.cc:123
intvec * Mivperttarget(ideal G, int ndeg)
BOOLEAN spectrumfProc(leftv result, leftv first)
Definition: ipshell.cc:3765
lists pcvLAddL(lists l1, lists l2)
Definition: pcv.cc:31
#define pOne()
Definition: polys.h:286
int pcvBasis(lists b, int i, poly m, int d, int n)
Definition: pcv.cc:391
Definition: tok.h:88
intvec * MPertVectors(ideal G, intvec *ivtarget, int pdeg)
Definition: walk.cc:1061
ideal freegb(ideal I, int uptodeg, int lVblock)
Definition: kstd2.cc:3406
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
#define FLAG_STD
Definition: ipid.h:108
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:494
intvec * Mivdp(int nR)
Definition: walk.cc:980
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:117
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
int pLastVblock(poly p, int lV)
Definition: shiftgb.cc:223
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
matrix evHessenberg(matrix M)
Definition: eigenval.cc:100
int rows() const
Definition: bigintmat.h:129
int & cols()
Definition: matpol.h:25
Definition: tok.h:95
lists evEigenvals(matrix M)
Definition: eigenval_ip.cc:118
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
BOOLEAN semicProc(leftv res, leftv u, leftv v)
Definition: ipshell.cc:4132
int siSeed
Definition: sirandom.c:29
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...
ideal TranMImprovwalk(ideal G, intvec *curr_weight, intvec *target_tmp, int nP)
Definition: walk.cc:7071
#define pMult(p, q)
Definition: polys.h:178
int rows() const
Definition: intvec.h:88
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:6122
coeffs basecoeffs() const
Definition: bigintmat.h:130
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:491
#define IDRING(a)
Definition: ipid.h:126
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:193
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:157
intvec * MivMatrixOrderdp(int nV)
Definition: walk.cc:1397
int rtyp
Definition: subexpr.h:92
#define TEST_FOR(A)
void * Data()
Definition: subexpr.cc:1097
ideal MAltwalk2(ideal Go, intvec *curr_weight, intvec *target_weight)
Definition: walk.cc:4077
poly pcvP2CV(poly p, int d0, int d1)
Definition: pcv.cc:246
Definition: tok.h:96
omBin slists_bin
Definition: lists.cc:23
BOOLEAN spaddProc(leftv result, leftv first, leftv second)
Definition: ipshell.cc:4009
intvec * MivUnit(int nV)
Definition: walk.cc:1476
ideal singclap_absFactorize(poly f, ideal &mipos, intvec **exps, int &numFactors, const ring r)
Definition: clapsing.cc:1762
#define pPower(p, q)
Definition: polys.h:175
BOOLEAN newstruct_set_proc(const char *bbname, const char *func, int args, procinfov pr)
Definition: newstruct.cc:849
size_t gmp_output_digits
Definition: mpr_complex.cc:44
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
lists gmsNF(ideal p, ideal g, matrix B, int D, int K)
Definition: gms.cc:22
ideal Mwalk(ideal Go, intvec *orig_M, intvec *target_M, ring baseRing)
Definition: walk.cc:5067
feOptIndex feGetOptIndex(const char *name)
Definition: feOpt.cc:104
void countedref_reference_load()
Initialize blackbox types 'reference' and 'shared', or both.
Definition: countedref.cc:700
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:125
ideal MwalkInitialForm(ideal G, intvec *ivw)
Definition: walk.cc:736
static Poly * h
Definition: janet.cc:978
#define IMATELEM(M, I, J)
Definition: intvec.h:77
#define NONE
Definition: tok.h:170
void feReInitResources()
Definition: feResource.cc:201
void Werror(const char *fmt,...)
Definition: reporter.cc:199
intvec * MivMatrixOrderlp(int nV)
Definition: walk.cc:1381
void * CopyD(int t)
Definition: subexpr.cc:662
int pcvMinDeg(poly p)
Definition: pcv.cc:108
void countedref_shared_load()
Definition: countedref.cc:724
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
intvec * Mivlp(int nR)
Definition: walk.cc:995
procinfo * procinfov
Definition: structs.h:63
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
intvec * MkInterRedNextWeight(intvec *iva, intvec *ivb, ideal G)
Definition: walk.cc:2248
ideal twostd(ideal I)
Compute two-sided GB:
Definition: nc.cc:22
#define omStrDup(s)
Definition: omAllocDecl.h:263
BOOLEAN jjVARIABLES_ID ( leftv  res,
leftv  u 
)

Definition at line 5879 of file ipshell.cc.

5880 {
5881  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
5882  ideal I=(ideal)u->Data();
5883  int i;
5884  int n=0;
5885  for(i=I->nrows*I->ncols-1;i>=0;i--)
5886  {
5887  int n0=pGetVariables(I->m[i],e);
5888  if (n0>n) n=n0;
5889  }
5890  jjINT_S_TO_ID(n,e,res);
5891  return FALSE;
5892 }
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:5849
#define pGetVariables(p, e)
Definition: polys.h:222
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
void * Data()
Definition: subexpr.cc:1097
#define omAlloc0(size)
Definition: omAllocDecl.h:211
BOOLEAN jjVARIABLES_P ( leftv  res,
leftv  u 
)

Definition at line 5871 of file ipshell.cc.

5872 {
5873  int *e=(int *)omAlloc0((rVar(currRing)+1)*sizeof(int));
5874  int n=pGetVariables((poly)u->Data(),e);
5875  jjINT_S_TO_ID(n,e,res);
5876  return FALSE;
5877 }
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
static void jjINT_S_TO_ID(int n, int *e, leftv res)
Definition: ipshell.cc:5849
#define pGetVariables(p, e)
Definition: polys.h:222
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void killlocals ( int  v)

Definition at line 385 of file ipshell.cc.

386 {
387  BOOLEAN changed=FALSE;
388  idhdl sh=currRingHdl;
389  ring cr=currRing;
390  if (sh!=NULL) changed=((IDLEV(sh)<v) || (IDRING(sh)->ref>0));
391  //if (changed) Print("currRing=%s(%x), lev=%d,ref=%d\n",IDID(sh),IDRING(sh),IDLEV(sh),IDRING(sh)->ref);
392 
393  killlocals_rec(&(basePack->idroot),v,currRing);
394 
396  {
397  int t=iiRETURNEXPR.Typ();
398  if ((/*iiRETURNEXPR.Typ()*/ t==RING_CMD)
399  || (/*iiRETURNEXPR.Typ()*/ t==QRING_CMD))
400  {
402  if (((ring)h->data)->idroot!=NULL)
403  killlocals0(v,&(((ring)h->data)->idroot),(ring)h->data);
404  }
405  else if (/*iiRETURNEXPR.Typ()*/ t==LIST_CMD)
406  {
407  leftv h=&iiRETURNEXPR;
408  changed |=killlocals_list(v,(lists)h->data);
409  }
410  }
411  if (changed)
412  {
414  if (currRingHdl==NULL)
415  currRing=NULL;
416  else if(cr!=currRing)
417  rChangeCurrRing(cr);
418  }
419 
420  if (myynest<=1) iiNoKeepRing=TRUE;
421  //Print("end killlocals >= %d\n",v);
422  //listall();
423 }
int iiRETURNEXPR_len
Definition: iplib.cc:528
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
sleftv iiRETURNEXPR
Definition: iplib.cc:527
#define TRUE
Definition: auxiliary.h:144
void killlocals_rec(idhdl *root, int v, ring r)
Definition: ipshell.cc:328
int Typ()
Definition: subexpr.cc:955
Definition: idrec.h:34
void * data
Definition: subexpr.h:89
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN killlocals_list(int v, lists L)
Definition: ipshell.cc:365
static BOOLEAN iiNoKeepRing
Definition: ipshell.cc:88
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1565
#define IDLEV(a)
Definition: ipid.h:120
void rChangeCurrRing(ring r)
Definition: polys.cc:14
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
Definition: tok.h:96
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
static void killlocals0(int v, idhdl *localhdl, const ring r)
Definition: ipshell.cc:293
BOOLEAN kQHWeight ( leftv  res,
leftv  v 
)

Definition at line 2904 of file ipshell.cc.

2905 {
2906  res->data=(char *)id_QHomWeight((ideal)v->Data(), currRing);
2907  if (res->data==NULL)
2908  res->data=(char *)new intvec(rVar(currRing));
2909  return FALSE;
2910 }
#define FALSE
Definition: auxiliary.h:140
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
intvec * id_QHomWeight(ideal id, const ring r)
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1097
BOOLEAN kWeight ( leftv  res,
leftv  id 
)

Definition at line 2882 of file ipshell.cc.

2883 {
2884  ideal F=(ideal)id->Data();
2885  intvec * iv = new intvec(rVar(currRing));
2886  polyset s;
2887  int sl, n, i;
2888  int *x;
2889 
2890  res->data=(char *)iv;
2891  s = F->m;
2892  sl = IDELEMS(F) - 1;
2893  n = rVar(currRing);
2894  double wNsqr = (double)2.0 / (double)n;
2896  x = (int * )omAlloc(2 * (n + 1) * sizeof(int));
2897  wCall(s, sl, x, wNsqr, currRing);
2898  for (i = n; i!=0; i--)
2899  (*iv)[i-1] = x[i + n + 1];
2900  omFreeSize((ADDRESS)x, 2 * (n + 1) * sizeof(int));
2901  return FALSE;
2902 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:28
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
poly * polyset
Definition: hutil.h:17
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:116
Variable x
Definition: cfModGcd.cc:4023
void * Data()
Definition: subexpr.cc:1097
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:82
void list_cmd ( int  typ,
const char *  what,
const char *  prefix,
BOOLEAN  iterate,
BOOLEAN  fullname = FALSE 
)

Definition at line 425 of file ipshell.cc.

426 {
427  package savePack=currPack;
428  idhdl h,start;
429  BOOLEAN all = typ<0;
430  BOOLEAN really_all=FALSE;
431 
432  if ( typ==0 )
433  {
434  if (strcmp(what,"all")==0)
435  {
436  if (currPack!=basePack)
437  list_cmd(-1,NULL,prefix,iterate,fullname); // list current package
438  really_all=TRUE;
439  h=basePack->idroot;
440  }
441  else
442  {
443  h = ggetid(what);
444  if (h!=NULL)
445  {
446  if (iterate) list1(prefix,h,TRUE,fullname);
447  if (IDTYP(h)==ALIAS_CMD) PrintS("A");
448  if ((IDTYP(h)==RING_CMD)
449  || (IDTYP(h)==QRING_CMD)
450  //|| (IDTYP(h)==PACKE_CMD)
451  )
452  {
453  h=IDRING(h)->idroot;
454  }
455  else if(IDTYP(h)==PACKAGE_CMD)
456  {
457  currPack=IDPACKAGE(h);
458  //Print("list_cmd:package\n");
459  all=TRUE;typ=PROC_CMD;fullname=TRUE;really_all=TRUE;
460  h=IDPACKAGE(h)->idroot;
461  }
462  else
463  {
464  currPack=savePack;
465  return;
466  }
467  }
468  else
469  {
470  Werror("%s is undefined",what);
471  currPack=savePack;
472  return;
473  }
474  }
475  all=TRUE;
476  }
477  else if (RingDependend(typ))
478  {
479  h = currRing->idroot;
480  }
481  else
482  h = IDROOT;
483  start=h;
484  while (h!=NULL)
485  {
486  if ((all
487  && (IDTYP(h)!=PROC_CMD)
488  &&(IDTYP(h)!=PACKAGE_CMD)
489  && (IDTYP(h)!=CRING_CMD))
490  || (typ == IDTYP(h))
491  || ((typ==RING_CMD) &&(IDTYP(h)==CRING_CMD))
492  || ((IDTYP(h)==QRING_CMD) && (typ==RING_CMD)))
493  {
494  list1(prefix,h,start==currRingHdl, fullname);
495  if (((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
496  && (really_all || (all && (h==currRingHdl)))
497  && ((IDLEV(h)==0)||(IDLEV(h)==myynest)))
498  {
499  list_cmd(0,IDID(h),"// ",FALSE);
500  }
501  if (IDTYP(h)==PACKAGE_CMD && really_all)
502  {
503  package save_p=currPack;
504  currPack=IDPACKAGE(h);
505  list_cmd(0,IDID(h),"// ",FALSE);
506  currPack=save_p;
507  }
508  }
509  h = IDNEXT(h);
510  }
511  currPack=savePack;
512 }
#define IDID(a)
Definition: ipid.h:121
#define FALSE
Definition: auxiliary.h:140
#define IDNEXT(a)
Definition: ipid.h:117
#define IDROOT
Definition: ipid.h:20
#define TRUE
Definition: auxiliary.h:144
static void list1(const char *s, idhdl h, BOOLEAN c, BOOLEAN fullname)
Definition: ipshell.cc:153
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
Definition: tok.h:56
int RingDependend(int t)
Definition: gentable.cc:23
void list_cmd(int typ, const char *what, const char *prefix, BOOLEAN iterate, BOOLEAN fullname)
Definition: ipshell.cc:425
idhdl currRingHdl
Definition: ipid.cc:64
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDLEV(a)
Definition: ipid.h:120
Definition: tok.h:38
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
#define IDRING(a)
Definition: ipid.h:126
package currPack
Definition: ipid.cc:62
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:487
BOOLEAN loNewtonP ( leftv  res,
leftv  arg1 
)

compute Newton Polytopes of input polynomials

Definition at line 4144 of file ipshell.cc.

4145 {
4146  res->data= (void*)loNewtonPolytope( (ideal)arg1->Data() );
4147  return FALSE;
4148 }
#define FALSE
Definition: auxiliary.h:140
ideal loNewtonPolytope(const ideal id)
Definition: mpr_base.cc:3192
void * data
Definition: subexpr.h:89
void * Data()
Definition: subexpr.cc:1097
BOOLEAN loSimplex ( leftv  res,
leftv  args 
)

Implementation of the Simplex Algorithm.

For args, see class simplex.

Definition at line 4150 of file ipshell.cc.

4151 {
4152  if ( !(rField_is_long_R(currRing)) )
4153  {
4154  WerrorS("Ground field not implemented!");
4155  return TRUE;
4156  }
4157 
4158  simplex * LP;
4159  matrix m;
4160 
4161  leftv v= args;
4162  if ( v->Typ() != MATRIX_CMD ) // 1: matrix
4163  return TRUE;
4164  else
4165  m= (matrix)(v->CopyD());
4166 
4167  LP = new simplex(MATROWS(m),MATCOLS(m));
4168  LP->mapFromMatrix(m);
4169 
4170  v= v->next;
4171  if ( v->Typ() != INT_CMD ) // 2: m = number of constraints
4172  return TRUE;
4173  else
4174  LP->m= (int)(long)(v->Data());
4175 
4176  v= v->next;
4177  if ( v->Typ() != INT_CMD ) // 3: n = number of variables
4178  return TRUE;
4179  else
4180  LP->n= (int)(long)(v->Data());
4181 
4182  v= v->next;
4183  if ( v->Typ() != INT_CMD ) // 4: m1 = number of <= constraints
4184  return TRUE;
4185  else
4186  LP->m1= (int)(long)(v->Data());
4187 
4188  v= v->next;
4189  if ( v->Typ() != INT_CMD ) // 5: m2 = number of >= constraints
4190  return TRUE;
4191  else
4192  LP->m2= (int)(long)(v->Data());
4193 
4194  v= v->next;
4195  if ( v->Typ() != INT_CMD ) // 6: m3 = number of == constraints
4196  return TRUE;
4197  else
4198  LP->m3= (int)(long)(v->Data());
4199 
4200 #ifdef mprDEBUG_PROT
4201  Print("m (constraints) %d\n",LP->m);
4202  Print("n (columns) %d\n",LP->n);
4203  Print("m1 (<=) %d\n",LP->m1);
4204  Print("m2 (>=) %d\n",LP->m2);
4205  Print("m3 (==) %d\n",LP->m3);
4206 #endif
4207 
4208  LP->compute();
4209 
4210  lists lres= (lists)omAlloc( sizeof(slists) );
4211  lres->Init( 6 );
4212 
4213  lres->m[0].rtyp= MATRIX_CMD; // output matrix
4214  lres->m[0].data=(void*)LP->mapToMatrix(m);
4215 
4216  lres->m[1].rtyp= INT_CMD; // found a solution?
4217  lres->m[1].data=(void*)(long)LP->icase;
4218 
4219  lres->m[2].rtyp= INTVEC_CMD;
4220  lres->m[2].data=(void*)LP->posvToIV();
4221 
4222  lres->m[3].rtyp= INTVEC_CMD;
4223  lres->m[3].data=(void*)LP->zrovToIV();
4224 
4225  lres->m[4].rtyp= INT_CMD;
4226  lres->m[4].data=(void*)(long)LP->m;
4227 
4228  lres->m[5].rtyp= INT_CMD;
4229  lres->m[5].data=(void*)(long)LP->n;
4230 
4231  res->data= (void*)lres;
4232 
4233  return FALSE;
4234 }
sleftv * m
Definition: lists.h:45
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
matrix mapToMatrix(matrix m)
void compute()
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
Linear Programming / Linear Optimization using Simplex - Algorithm.
Definition: mpr_numeric.h:194
#define TRUE
Definition: auxiliary.h:144
intvec * zrovToIV()
void WerrorS(const char *s)
Definition: feFopen.cc:23
int Typ()
Definition: subexpr.cc:955
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
intvec * posvToIV()
BOOLEAN mapFromMatrix(matrix m)
ip_smatrix * matrix
int m
Definition: cfEzgcd.cc:119
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define MATCOLS(i)
Definition: matpol.h:28
slists * lists
Definition: mpr_numeric.h:146
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:491
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define MATROWS(i)
Definition: matpol.h:27
int icase
Definition: mpr_numeric.h:201
void * CopyD(int t)
Definition: subexpr.cc:662
BOOLEAN mpJacobi ( leftv  res,
leftv  a 
)

Definition at line 2648 of file ipshell.cc.

2649 {
2650  int i,j;
2651  matrix result;
2652  ideal id=(ideal)a->Data();
2653 
2654  result =mpNew(IDELEMS(id),rVar(currRing));
2655  for (i=1; i<=IDELEMS(id); i++)
2656  {
2657  for (j=1; j<=rVar(currRing); j++)
2658  {
2659  MATELEM(result,i,j) = pDiff(id->m[i-1],j);
2660  }
2661  }
2662  res->data=(char *)result;
2663  return FALSE;
2664 }
#define FALSE
Definition: auxiliary.h:140
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
void * Data()
Definition: subexpr.cc:1097
#define pDiff(a, b)
Definition: polys.h:267
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29
BOOLEAN mpKoszul ( leftv  res,
leftv  c,
leftv  b,
leftv  id 
)

Definition at line 2670 of file ipshell.cc.

2671 {
2672  int n=(int)(long)b->Data();
2673  int d=(int)(long)c->Data();
2674  int k,l,sign,row,col;
2675  matrix result;
2676  ideal temp;
2677  BOOLEAN bo;
2678  poly p;
2679 
2680  if ((d>n) || (d<1) || (n<1))
2681  {
2682  res->data=(char *)mpNew(1,1);
2683  return FALSE;
2684  }
2685  int *choise = (int*)omAlloc(d*sizeof(int));
2686  if (id==NULL)
2687  temp=idMaxIdeal(1);
2688  else
2689  temp=(ideal)id->Data();
2690 
2691  k = binom(n,d);
2692  l = k*d;
2693  l /= n-d+1;
2694  result =mpNew(l,k);
2695  col = 1;
2696  idInitChoise(d,1,n,&bo,choise);
2697  while (!bo)
2698  {
2699  sign = 1;
2700  for (l=1;l<=d;l++)
2701  {
2702  if (choise[l-1]<=IDELEMS(temp))
2703  {
2704  p = pCopy(temp->m[choise[l-1]-1]);
2705  if (sign == -1) p = pNeg(p);
2706  sign *= -1;
2707  row = idGetNumberOfChoise(l-1,d,1,n,choise);
2708  MATELEM(result,row,col) = p;
2709  }
2710  }
2711  col++;
2712  idGetNextChoise(d,n,&bo,choise);
2713  }
2714  if (id==NULL) idDelete(&temp);
2715 
2716  res->data=(char *)result;
2717  return FALSE;
2718 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:38
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define pNeg(p)
Definition: polys.h:169
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define NULL
Definition: omList.c:10
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
void * Data()
Definition: subexpr.cc:1097
int idGetNumberOfChoise(int t, int d, int begin, int end, int *choise)
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
int binom(int n, int r)
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
int sign(const CanonicalForm &a)
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define MATELEM(mat, i, j)
Definition: matpol.h:29
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 4259 of file ipshell.cc.

4260 {
4261 
4262  poly gls;
4263  gls= (poly)(arg1->Data());
4264  int howclean= (int)(long)arg3->Data();
4265 
4266  if ( !(rField_is_R(currRing) ||
4267  rField_is_Q(currRing) ||
4270  {
4271  WerrorS("Ground field not implemented!");
4272  return TRUE;
4273  }
4274 
4277  {
4278  unsigned long int ii = (unsigned long int)arg2->Data();
4279  setGMPFloatDigits( ii, ii );
4280  }
4281 
4282  if ( gls == NULL || pIsConstant( gls ) )
4283  {
4284  WerrorS("Input polynomial is constant!");
4285  return TRUE;
4286  }
4287 
4288  int ldummy;
4289  int deg= currRing->pLDeg( gls, &ldummy, currRing );
4290  // int deg= pDeg( gls );
4291  // int len= pLength( gls );
4292  int i,vpos=0;
4293  poly piter;
4294  lists elist;
4295  lists rlist;
4296 
4297  elist= (lists)omAlloc( sizeof(slists) );
4298  elist->Init( 0 );
4299 
4300  if ( rVar(currRing) > 1 )
4301  {
4302  piter= gls;
4303  for ( i= 1; i <= rVar(currRing); i++ )
4304  if ( pGetExp( piter, i ) )
4305  {
4306  vpos= i;
4307  break;
4308  }
4309  while ( piter )
4310  {
4311  for ( i= 1; i <= rVar(currRing); i++ )
4312  if ( (vpos != i) && (pGetExp( piter, i ) != 0) )
4313  {
4314  WerrorS("The input polynomial must be univariate!");
4315  return TRUE;
4316  }
4317  pIter( piter );
4318  }
4319  }
4320 
4321  rootContainer * roots= new rootContainer();
4322  number * pcoeffs= (number *)omAlloc( (deg+1) * sizeof( number ) );
4323  piter= gls;
4324  for ( i= deg; i >= 0; i-- )
4325  {
4326  //if ( piter ) Print("deg %d, pDeg(piter) %d\n",i,pTotaldegree(piter));
4327  if ( piter && pTotaldegree(piter) == i )
4328  {
4329  pcoeffs[i]= nCopy( pGetCoeff( piter ) );
4330  //nPrint( pcoeffs[i] );PrintS(" ");
4331  pIter( piter );
4332  }
4333  else
4334  {
4335  pcoeffs[i]= nInit(0);
4336  }
4337  }
4338 
4339 #ifdef mprDEBUG_PROT
4340  for (i=deg; i >= 0; i--)
4341  {
4342  nPrint( pcoeffs[i] );PrintS(" ");
4343  }
4344  PrintLn();
4345 #endif
4346 
4347  roots->fillContainer( pcoeffs, NULL, 1, deg, rootContainer::onepoly, 1 );
4348  roots->solver( howclean );
4349 
4350  int elem= roots->getAnzRoots();
4351  char *dummy;
4352  int j;
4353 
4354  rlist= (lists)omAlloc( sizeof(slists) );
4355  rlist->Init( elem );
4356 
4358  {
4359  for ( j= 0; j < elem; j++ )
4360  {
4361  rlist->m[j].rtyp=NUMBER_CMD;
4362  rlist->m[j].data=(void *)nCopy((number)(roots->getRoot(j)));
4363  //rlist->m[j].data=(void *)(number)(roots->getRoot(j));
4364  }
4365  }
4366  else
4367  {
4368  for ( j= 0; j < elem; j++ )
4369  {
4370  dummy = complexToStr( (*roots)[j], gmp_output_digits, currRing->cf );
4371  rlist->m[j].rtyp=STRING_CMD;
4372  rlist->m[j].data=(void *)dummy;
4373  }
4374  }
4375 
4376  elist->Clean();
4377  //omFreeSize( (ADDRESS) elist, sizeof(slists) );
4378 
4379  // this is (via fillContainer) the same data as in root
4380  //for ( i= deg; i >= 0; i-- ) nDelete( &pcoeffs[i] );
4381  //omFreeSize( (ADDRESS) pcoeffs, (deg+1) * sizeof( number ) );
4382 
4383  delete roots;
4384 
4385  res->rtyp= LIST_CMD;
4386  res->data= (void*)rlist;
4387 
4388  return FALSE;
4389 }
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:65
sleftv * m
Definition: lists.h:45
void PrintLn()
Definition: reporter.cc:322
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:467
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define TRUE
Definition: auxiliary.h:144
bool solver(const int polishmode=PM_NONE)
Definition: mpr_numeric.cc:450
void WerrorS(const char *s)
Definition: feFopen.cc:23
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int j
Definition: myNF.cc:70
static long pTotaldegree(poly p)
Definition: polys.h:253
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
Definition: mpr_numeric.cc:313
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:461
gmp_complex * getRoot(const int i)
Definition: mpr_numeric.h:88
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:494
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int getAnzRoots()
Definition: mpr_numeric.h:97
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:491
int rtyp
Definition: subexpr.h:92
#define nCopy(n)
Definition: numbers.h:15
void Clean(ring r=currRing)
Definition: lists.h:25
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
char * complexToStr(gmp_complex &c, const unsigned int oprec, const coeffs src)
Definition: mpr_complex.cc:717
size_t gmp_output_digits
Definition: mpr_complex.cc:44
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:62
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
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 4236 of file ipshell.cc.

4237 {
4238  ideal gls = (ideal)(arg1->Data());
4239  int imtype= (int)(long)arg2->Data();
4240 
4241  uResultant::resMatType mtype= determineMType( imtype );
4242 
4243  // check input ideal ( = polynomial system )
4244  if ( mprIdealCheck( gls, arg1->Name(), mtype, true ) != mprOk )
4245  {
4246  return TRUE;
4247  }
4248 
4249  uResultant *resMat= new uResultant( gls, mtype, false );
4250  if (resMat!=NULL)
4251  {
4252  res->rtyp = MODUL_CMD;
4253  res->data= (void*)resMat->accessResMat()->getMatrix();
4254  if (!errorreported) delete resMat;
4255  }
4256  return errorreported;
4257 }
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
#define TRUE
Definition: auxiliary.h:144
uResultant::resMatType determineMType(int imtype)
Definition: mpr_inout.cc:135
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
void * data
Definition: subexpr.h:89
virtual ideal getMatrix()
Definition: mpr_base.h:31
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
Definition: mpr_inout.cc:94
short errorreported
Definition: feFopen.cc:22
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
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 4492 of file ipshell.cc.

4493 {
4494  leftv v= args;
4495 
4496  ideal gls;
4497  int imtype;
4498  int howclean;
4499 
4500  // get ideal
4501  if ( v->Typ() != IDEAL_CMD )
4502  return TRUE;
4503  else gls= (ideal)(v->Data());
4504  v= v->next;
4505 
4506  // get resultant matrix type to use (0,1)
4507  if ( v->Typ() != INT_CMD )
4508  return TRUE;
4509  else imtype= (int)(long)v->Data();
4510  v= v->next;
4511 
4512  if (imtype==0)
4513  {
4514  ideal test_id=idInit(1,1);
4515  int j;
4516  for(j=IDELEMS(gls)-1;j>=0;j--)
4517  {
4518  if (gls->m[j]!=NULL)
4519  {
4520  test_id->m[0]=gls->m[j];
4521  intvec *dummy_w=id_QHomWeight(test_id, currRing);
4522  if (dummy_w!=NULL)
4523  {
4524  WerrorS("Newton polytope not of expected dimension");
4525  delete dummy_w;
4526  return TRUE;
4527  }
4528  }
4529  }
4530  }
4531 
4532  // get and set precision in digits ( > 0 )
4533  if ( v->Typ() != INT_CMD )
4534  return TRUE;
4535  else if ( !(rField_is_R(currRing) || rField_is_long_R(currRing) || \
4537  {
4538  unsigned long int ii=(unsigned long int)v->Data();
4539  setGMPFloatDigits( ii, ii );
4540  }
4541  v= v->next;
4542 
4543  // get interpolation steps (0,1,2)
4544  if ( v->Typ() != INT_CMD )
4545  return TRUE;
4546  else howclean= (int)(long)v->Data();
4547 
4548  uResultant::resMatType mtype= determineMType( imtype );
4549  int i,count;
4550  lists listofroots= NULL;
4551  number smv= NULL;
4552  BOOLEAN interpolate_det= (mtype==uResultant::denseResMat)?TRUE:FALSE;
4553 
4554  //emptylist= (lists)omAlloc( sizeof(slists) );
4555  //emptylist->Init( 0 );
4556 
4557  //res->rtyp = LIST_CMD;
4558  //res->data= (void *)emptylist;
4559 
4560  // check input ideal ( = polynomial system )
4561  if ( mprIdealCheck( gls, args->Name(), mtype ) != mprOk )
4562  {
4563  return TRUE;
4564  }
4565 
4566  uResultant * ures;
4567  rootContainer ** iproots;
4568  rootContainer ** muiproots;
4569  rootArranger * arranger;
4570 
4571  // main task 1: setup of resultant matrix
4572  ures= new uResultant( gls, mtype );
4573  if ( ures->accessResMat()->initState() != resMatrixBase::ready )
4574  {
4575  WerrorS("Error occurred during matrix setup!");
4576  return TRUE;
4577  }
4578 
4579  // if dense resultant, check if minor nonsingular
4580  if ( mtype == uResultant::denseResMat )
4581  {
4582  smv= ures->accessResMat()->getSubDet();
4583 #ifdef mprDEBUG_PROT
4584  PrintS("// Determinant of submatrix: ");nPrint(smv);PrintLn();
4585 #endif
4586  if ( nIsZero(smv) )
4587  {
4588  WerrorS("Unsuitable input ideal: Minor of resultant matrix is singular!");
4589  return TRUE;
4590  }
4591  }
4592 
4593  // main task 2: Interpolate specialized resultant polynomials
4594  if ( interpolate_det )
4595  iproots= ures->interpolateDenseSP( false, smv );
4596  else
4597  iproots= ures->specializeInU( false, smv );
4598 
4599  // main task 3: Interpolate specialized resultant polynomials
4600  if ( interpolate_det )
4601  muiproots= ures->interpolateDenseSP( true, smv );
4602  else
4603  muiproots= ures->specializeInU( true, smv );
4604 
4605 #ifdef mprDEBUG_PROT
4606  int c= iproots[0]->getAnzElems();
4607  for (i=0; i < c; i++) pWrite(iproots[i]->getPoly());
4608  c= muiproots[0]->getAnzElems();
4609  for (i=0; i < c; i++) pWrite(muiproots[i]->getPoly());
4610 #endif
4611 
4612  // main task 4: Compute roots of specialized polys and match them up
4613  arranger= new rootArranger( iproots, muiproots, howclean );
4614  arranger->solve_all();
4615 
4616  // get list of roots
4617  if ( arranger->success() )
4618  {
4619  arranger->arrange();
4620  listofroots= listOfRoots(arranger, gmp_output_digits );
4621  }
4622  else
4623  {
4624  WerrorS("Solver was unable to find any roots!");
4625  return TRUE;
4626  }
4627 
4628  // free everything
4629  count= iproots[0]->getAnzElems();
4630  for (i=0; i < count; i++) delete iproots[i];
4631  omFreeSize( (ADDRESS) iproots, count * sizeof(rootContainer*) );
4632  count= muiproots[0]->getAnzElems();
4633  for (i=0; i < count; i++) delete muiproots[i];
4634  omFreeSize( (ADDRESS) muiproots, count * sizeof(rootContainer*) );
4635 
4636  delete ures;
4637  delete arranger;
4638  nDelete( &smv );
4639 
4640  res->data= (void *)listofroots;
4641 
4642  //emptylist->Clean();
4643  // omFreeSize( (ADDRESS) emptylist, sizeof(slists) );
4644 
4645  return FALSE;
4646 }
int status int void size_t count
Definition: si_signals.h:59
complex root finder for univariate polynomials based on laguers algorithm
Definition: mpr_numeric.h:65
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:322
Base class for solving 0-dim poly systems using u-resultant.
Definition: mpr_base.h:62
Definition: tok.h:85
Definition: lists.h:22
virtual IStateType initState() const
Definition: mpr_base.h:41
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:467
resMatrixBase * accessResMat()
Definition: mpr_base.h:78
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * id_QHomWeight(ideal id, const ring r)
#define TRUE
Definition: auxiliary.h:144
uResultant::resMatType determineMType(int imtype)
Definition: mpr_inout.cc:135
void * ADDRESS
Definition: auxiliary.h:161
void pWrite(poly p)
Definition: polys.h:279
void WerrorS(const char *s)
Definition: feFopen.cc:23
int getAnzElems()
Definition: mpr_numeric.h:95
rootContainer ** specializeInU(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:3060
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
Definition: mpr_base.h:98
#define nPrint(a)
only for debug, over any initalized currRing
Definition: numbers.h:46
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
bool success()
Definition: mpr_numeric.h:162
void arrange()
Definition: mpr_numeric.cc:896
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
void solve_all()
Definition: mpr_numeric.cc:871
#define IDELEMS(i)
Definition: simpleideals.h:24
mprState mprIdealCheck(const ideal theIdeal, const char *name, uResultant::resMatType mtype, BOOLEAN rmatrix=false)
Definition: mpr_inout.cc:94
rootContainer ** interpolateDenseSP(BOOLEAN matchUp=false, const number subDetVal=NULL)
Definition: mpr_base.cc:2922
#define nDelete(n)
Definition: numbers.h:16
leftv next
Definition: subexpr.h:87
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:494
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:491
void * Data()
Definition: subexpr.cc:1097
size_t gmp_output_digits
Definition: mpr_complex.cc:44
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:62
int BOOLEAN
Definition: auxiliary.h:131
lists listOfRoots(rootArranger *self, const unsigned int oprec)
Definition: ipshell.cc:4649
virtual number getSubDet()
Definition: mpr_base.h:37
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 4391 of file ipshell.cc.

4392 {
4393  int i;
4394  ideal p,w;
4395  p= (ideal)arg1->Data();
4396  w= (ideal)arg2->Data();
4397 
4398  // w[0] = f(p^0)
4399  // w[1] = f(p^1)
4400  // ...
4401  // p can be a vector of numbers (multivariate polynom)
4402  // or one number (univariate polynom)
4403  // tdg = deg(f)
4404 
4405  int n= IDELEMS( p );
4406  int m= IDELEMS( w );
4407  int tdg= (int)(long)arg3->Data();
4408 
4409  res->data= (void*)NULL;
4410 
4411  // check the input
4412  if ( tdg < 1 )
4413  {
4414  WerrorS("Last input parameter must be > 0!");
4415  return TRUE;
4416  }
4417  if ( n != rVar(currRing) )
4418  {
4419  Werror("Size of first input ideal must be equal to %d!",rVar(currRing));
4420  return TRUE;
4421  }
4422  if ( m != (int)pow((double)tdg+1,(double)n) )
4423  {
4424  Werror("Size of second input ideal must be equal to %d!",
4425  (int)pow((double)tdg+1,(double)n));
4426  return TRUE;
4427  }
4428  if ( !(rField_is_Q(currRing) /* ||
4429  rField_is_R() || rField_is_long_R() ||
4430  rField_is_long_C()*/ ) )
4431  {
4432  WerrorS("Ground field not implemented!");
4433  return TRUE;
4434  }
4435 
4436  number tmp;
4437  number *pevpoint= (number *)omAlloc( n * sizeof( number ) );
4438  for ( i= 0; i < n; i++ )
4439  {
4440  pevpoint[i]=nInit(0);
4441  if ( (p->m)[i] )
4442  {
4443  tmp = pGetCoeff( (p->m)[i] );
4444  if ( nIsZero(tmp) || nIsOne(tmp) || nIsMOne(tmp) )
4445  {
4446  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4447  WerrorS("Elements of first input ideal must not be equal to -1, 0, 1!");
4448  return TRUE;
4449  }
4450  } else tmp= NULL;
4451  if ( !nIsZero(tmp) )
4452  {
4453  if ( !pIsConstant((p->m)[i]))
4454  {
4455  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4456  WerrorS("Elements of first input ideal must be numbers!");
4457  return TRUE;
4458  }
4459  pevpoint[i]= nCopy( tmp );
4460  }
4461  }
4462 
4463  number *wresults= (number *)omAlloc( m * sizeof( number ) );
4464  for ( i= 0; i < m; i++ )
4465  {
4466  wresults[i]= nInit(0);
4467  if ( (w->m)[i] && !nIsZero(pGetCoeff((w->m)[i])) )
4468  {
4469  if ( !pIsConstant((w->m)[i]))
4470  {
4471  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4472  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4473  WerrorS("Elements of second input ideal must be numbers!");
4474  return TRUE;
4475  }
4476  wresults[i]= nCopy(pGetCoeff((w->m)[i]));
4477  }
4478  }
4479 
4480  vandermonde vm( m, n, tdg, pevpoint, FALSE );
4481  number *ncpoly= vm.interpolateDense( wresults );
4482  // do not free ncpoly[]!!
4483  poly rpoly= vm.numvec2poly( ncpoly );
4484 
4485  omFreeSize( (ADDRESS)pevpoint, n * sizeof( number ) );
4486  omFreeSize( (ADDRESS)wresults, m * sizeof( number ) );
4487 
4488  res->data= (void*)rpoly;
4489  return FALSE;
4490 }
vandermonde system solver for interpolating polynomials from their values
Definition: mpr_numeric.h:28
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define nIsMOne(n)
Definition: numbers.h:26
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define omAlloc(size)
Definition: omAllocDecl.h:210
void * data
Definition: subexpr.h:89
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int m
Definition: cfEzgcd.cc:119
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:461
#define IDELEMS(i)
Definition: simpleideals.h:24
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define nCopy(n)
Definition: numbers.h:15
void * Data()
Definition: subexpr.cc:1097
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:418
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void paPrint ( const char *  n,
package  p 
)

Definition at line 5894 of file ipshell.cc.

5895 {
5896  Print(" %s (",n);
5897  switch (p->language)
5898  {
5899  case LANG_SINGULAR: PrintS("S"); break;
5900  case LANG_C: PrintS("C"); break;
5901  case LANG_TOP: PrintS("T"); break;
5902  case LANG_NONE: PrintS("N"); break;
5903  default: PrintS("U");
5904  }
5905  if(p->libname!=NULL)
5906  Print(",%s", p->libname);
5907  PrintS(")");
5908 }
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
Definition: subexpr.h:20
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
idhdl rDefault ( const char *  s)

Definition at line 1520 of file ipshell.cc.

1521 {
1522  idhdl tmp=NULL;
1523 
1524  if (s!=NULL) tmp = enterid(s, myynest, RING_CMD, &IDROOT);
1525  if (tmp==NULL) return NULL;
1526 
1527 // if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
1529  {
1531  memset(&sLastPrinted,0,sizeof(sleftv));
1532  }
1533 
1534  ring r = IDRING(tmp);
1535 
1536  r->cf = nInitChar(n_Zp, (void*)32003); // r->cf->ch = 32003;
1537  r->N = 3;
1538  /*r->P = 0; Alloc0 in idhdl::set, ipid.cc*/
1539  /*names*/
1540  r->names = (char **) omAlloc0(3 * sizeof(char_ptr));
1541  r->names[0] = omStrDup("x");
1542  r->names[1] = omStrDup("y");
1543  r->names[2] = omStrDup("z");
1544  /*weights: entries for 3 blocks: NULL*/
1545  r->wvhdl = (int **)omAlloc0(3 * sizeof(int_ptr));
1546  /*order: dp,C,0*/
1547  r->order = (int *) omAlloc(3 * sizeof(int *));
1548  r->block0 = (int *)omAlloc0(3 * sizeof(int *));
1549  r->block1 = (int *)omAlloc0(3 * sizeof(int *));
1550  /* ringorder dp for the first block: var 1..3 */
1551  r->order[0] = ringorder_dp;
1552  r->block0[0] = 1;
1553  r->block1[0] = 3;
1554  /* ringorder C for the second block: no vars */
1555  r->order[1] = ringorder_C;
1556  /* the last block: everything is 0 */
1557  r->order[2] = 0;
1558 
1559  /* complete ring intializations */
1560  rComplete(r);
1561  rSetHdl(tmp);
1562  return currRingHdl;
1563 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
{p < 2^31}
Definition: coeffs.h:30
#define IDROOT
Definition: ipid.h:20
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
char * char_ptr
Definition: structs.h:56
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:256
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:375
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:3435
idhdl currRingHdl
Definition: ipid.cc:64
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void rSetHdl(idhdl h)
Definition: ipshell.cc:4696
int * int_ptr
Definition: structs.h:57
#define omAlloc0(size)
Definition: omAllocDecl.h:211
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
#define omStrDup(s)
Definition: omAllocDecl.h:263
idhdl rFindHdl ( ring  r,
idhdl  n 
)

Definition at line 1565 of file ipshell.cc.

1566 {
1568  if (h!=NULL) return h;
1569  if (IDROOT!=basePack->idroot) h=rSimpleFindHdl(r,basePack->idroot,n);
1570  if (h!=NULL) return h;
1572  while(p!=NULL)
1573  {
1574  if ((p->cPack!=basePack)
1575  && (p->cPack!=currPack))
1576  h=rSimpleFindHdl(r,p->cPack->idroot,n);
1577  if (h!=NULL) return h;
1578  p=p->next;
1579  }
1580  idhdl tmp=basePack->idroot;
1581  while (tmp!=NULL)
1582  {
1583  if (IDTYP(tmp)==PACKAGE_CMD)
1584  h=rSimpleFindHdl(r,IDPACKAGE(tmp)->idroot,n);
1585  if (h!=NULL) return h;
1586  tmp=IDNEXT(tmp);
1587  }
1588  return NULL;
1589 }
idhdl rSimpleFindHdl(ring r, idhdl root, idhdl n)
Definition: ipshell.cc:5778
return P p
Definition: myNF.cc:203
#define IDNEXT(a)
Definition: ipid.h:117
proclevel * procstack
Definition: ipid.cc:57
#define IDROOT
Definition: ipid.h:20
Definition: idrec.h:34
#define IDPACKAGE(a)
Definition: ipid.h:138
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
Definition: ipid.h:56
proclevel * next
Definition: ipid.h:59
#define NULL
Definition: omList.c:10
package basePack
Definition: ipid.cc:63
package currPack
Definition: ipid.cc:62
static Poly * h
Definition: janet.cc:978
package cPack
Definition: ipid.h:63
ring rInit ( sleftv pn,
sleftv rv,
sleftv ord 
)

Definition at line 5179 of file ipshell.cc.

5180 {
5181 #ifdef HAVE_RINGS
5182  //unsigned int ringtype = 0;
5183  mpz_ptr modBase = NULL;
5184  unsigned int modExponent = 1;
5185 #endif
5186  int float_len=0;
5187  int float_len2=0;
5188  ring R = NULL;
5189  //BOOLEAN ffChar=FALSE;
5190 
5191  /* ch -------------------------------------------------------*/
5192  // get ch of ground field
5193 
5194  // allocated ring
5195  R = (ring) omAlloc0Bin(sip_sring_bin);
5196 
5197  coeffs cf = NULL;
5198 
5199  assume( pn != NULL );
5200  const int P = pn->listLength();
5201 
5202  if ((pn->Typ()==CRING_CMD)&&(P==1))
5203  {
5204  cf=(coeffs)pn->CopyD();
5205  assume( cf != NULL );
5206  }
5207  else if (pn->Typ()==INT_CMD)
5208  {
5209  int ch = (int)(long)pn->Data();
5210 
5211  /* parameter? -------------------------------------------------------*/
5212  pn = pn->next;
5213 
5214  if (pn == NULL) // no params!?
5215  {
5216  if (ch!=0)
5217  {
5218  int ch2=IsPrime(ch);
5219  if ((ch<2)||(ch!=ch2))
5220  {
5221  Warn("%d is invalid as characteristic of the ground field. 32003 is used.", ch);
5222  ch=32003;
5223  }
5224  cf = nInitChar(n_Zp, (void*)(long)ch);
5225  }
5226  else
5227  cf = nInitChar(n_Q, (void*)(long)ch);
5228  }
5229  else
5230  {
5231  const int pars = pn->listLength();
5232 
5233  assume( pars > 0 );
5234 
5235  // predefined finite field: (p^k, a)
5236  if ((ch!=0) && (ch!=IsPrime(ch)) && (pars == 1))
5237  {
5238  GFInfo param;
5239 
5240  param.GFChar = ch;
5241  param.GFDegree = 1;
5242  param.GFPar_name = pn->name;
5243 
5244  cf = nInitChar(n_GF, &param);
5245  }
5246  else // (0/p, a, b, ..., z)
5247  {
5248  if ((ch!=0) && (ch!=IsPrime(ch)))
5249  {
5250  WerrorS("too many parameters");
5251  goto rInitError;
5252  }
5253 
5254  char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5255 
5256  if (rSleftvList2StringArray(pn, names))
5257  {
5258  WerrorS("parameter expected");
5259  goto rInitError;
5260  }
5261 
5262  TransExtInfo extParam;
5263 
5264  extParam.r = rDefault( ch, pars, names); // Q/Zp [ p_1, ... p_pars ]
5265  for(int i=pars-1; i>=0;i--)
5266  {
5267  omFree(names[i]);
5268  }
5269  omFree(names);
5270 
5271  cf = nInitChar(n_transExt, &extParam);
5272  }
5273  }
5274 
5275 // if (cf==NULL) goto rInitError;
5276  assume( cf != NULL );
5277  }
5278  else if ((pn->name != NULL)
5279  && ((strcmp(pn->name,"real")==0) || (strcmp(pn->name,"complex")==0)))
5280  {
5281  BOOLEAN complex_flag=(strcmp(pn->name,"complex")==0);
5282  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5283  {
5284  float_len=(int)(long)pn->next->Data();
5285  float_len2=float_len;
5286  pn=pn->next;
5287  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5288  {
5289  float_len2=(int)(long)pn->next->Data();
5290  pn=pn->next;
5291  }
5292  }
5293 
5294  if (!complex_flag)
5295  complex_flag= pn->next != NULL;
5296  if( !complex_flag && (float_len2 <= (short)SHORT_REAL_LENGTH))
5297  cf=nInitChar(n_R, NULL);
5298  else // longR or longC?
5299  {
5300  LongComplexInfo param;
5301 
5302  param.float_len = si_min (float_len, 32767);
5303  param.float_len2 = si_min (float_len2, 32767);
5304 
5305  // set the parameter name
5306  if (complex_flag)
5307  {
5308  if (param.float_len < SHORT_REAL_LENGTH)
5309  {
5312  }
5313  if (pn->next == NULL)
5314  param.par_name=(const char*)"i"; //default to i
5315  else
5316  param.par_name = (const char*)pn->next->name;
5317  }
5318 
5319  cf = nInitChar(complex_flag ? n_long_C: n_long_R, (void*)&param);
5320  }
5321  assume( cf != NULL );
5322  }
5323 #ifdef HAVE_RINGS
5324  else if ((pn->name != NULL) && (strcmp(pn->name, "integer") == 0))
5325  {
5326  // TODO: change to use coeffs_BIGINT!?
5327  modBase = (mpz_ptr) omAlloc(sizeof(mpz_t));
5328  mpz_init_set_si(modBase, 0);
5329  if (pn->next!=NULL)
5330  {
5331  if (pn->next->Typ()==INT_CMD)
5332  {
5333  mpz_set_ui(modBase, (int)(long) pn->next->Data());
5334  pn=pn->next;
5335  if ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5336  {
5337  modExponent = (long) pn->next->Data();
5338  pn=pn->next;
5339  }
5340  while ((pn->next!=NULL) && (pn->next->Typ()==INT_CMD))
5341  {
5342  mpz_mul_ui(modBase, modBase, (int)(long) pn->next->Data());
5343  pn=pn->next;
5344  }
5345  }
5346  else if (pn->next->Typ()==BIGINT_CMD)
5347  {
5348  number p=(number)pn->next->CopyD(); // FIXME: why CopyD() here if nlGMP should not overtake p!?
5349  nlGMP(p,(number)modBase,coeffs_BIGINT); // TODO? // extern void nlGMP(number &i, number n, const coeffs r); // FIXME: n_MPZ( modBase, p, coeffs_BIGINT); ?
5350  n_Delete(&p,coeffs_BIGINT);
5351  }
5352  }
5353  else
5354  cf=nInitChar(n_Z,NULL);
5355 
5356  if ((mpz_cmp_ui(modBase, 1) == 0) && (mpz_cmp_ui(modBase, 0) < 0))
5357  {
5358  Werror("Wrong ground ring specification (module is 1)");
5359  goto rInitError;
5360  }
5361  if (modExponent < 1)
5362  {
5363  Werror("Wrong ground ring specification (exponent smaller than 1");
5364  goto rInitError;
5365  }
5366  // module is 0 ---> integers ringtype = 4;
5367  // we have an exponent
5368  if (modExponent > 1 && cf == NULL)
5369  {
5370  if ((mpz_cmp_ui(modBase, 2) == 0) && (modExponent <= 8*sizeof(unsigned long)))
5371  {
5372  /* this branch should be active for modExponent = 2..32 resp. 2..64,
5373  depending on the size of a long on the respective platform */
5374  //ringtype = 1; // Use Z/2^ch
5375  cf=nInitChar(n_Z2m,(void*)(long)modExponent);
5376  mpz_clear(modBase);
5377  omFreeSize (modBase, sizeof (mpz_t));
5378  }
5379  else
5380  {
5381  if (mpz_cmp_ui(modBase,0)==0)
5382  {
5383  WerrorS("modulus must not be 0 or parameter not allowed");
5384  goto rInitError;
5385  }
5386  //ringtype = 3;
5387  ZnmInfo info;
5388  info.base= modBase;
5389  info.exp= modExponent;
5390  cf=nInitChar(n_Znm,(void*) &info); //exponent is missing
5391  }
5392  }
5393  // just a module m > 1
5394  else if (cf == NULL)
5395  {
5396  if (mpz_cmp_ui(modBase,0)==0)
5397  {
5398  WerrorS("modulus must not be 0 or parameter not allowed");
5399  goto rInitError;
5400  }
5401  //ringtype = 2;
5402  ZnmInfo info;
5403  info.base= modBase;
5404  info.exp= modExponent;
5405  cf=nInitChar(n_Zn,(void*) &info);
5406  }
5407  assume( cf != NULL );
5408  }
5409 #endif
5410  // ring NEW = OLD, (), (); where OLD is a polynomial ring...
5411  else if ((pn->Typ()==RING_CMD) && (P == 1))
5412  {
5413  TransExtInfo extParam;
5414  extParam.r = (ring)pn->Data();
5415  cf = nInitChar(n_transExt, &extParam);
5416  }
5417  else if ((pn->Typ()==QRING_CMD) && (P == 1)) // same for qrings - which should be fields!?
5418  {
5419  AlgExtInfo extParam;
5420  extParam.r = (ring)pn->Data();
5421 
5422  cf = nInitChar(n_algExt, &extParam); // Q[a]/<minideal>
5423  }
5424  else
5425  {
5426  Werror("Wrong or unknown ground field specification");
5427 #ifndef SING_NDEBUG
5428  sleftv* p = pn;
5429  while (p != NULL)
5430  {
5431  Print( "pn[%p]: type: %d [%s]: %p, name: %s", (void*)p, p->Typ(), Tok2Cmdname(p->Typ()), p->Data(), (p->name == NULL? "NULL" : p->name) );
5432  PrintLn();
5433  p = p->next;
5434  }
5435 #endif
5436  goto rInitError;
5437  }
5438 // pn=pn->next;
5439 
5440  /*every entry in the new ring is initialized to 0*/
5441 
5442  /* characteristic -----------------------------------------------*/
5443  /* input: 0 ch=0 : Q parameter=NULL ffChar=FALSE float_len
5444  * 0 1 : Q(a,...) *names FALSE
5445  * 0 -1 : R NULL FALSE 0
5446  * 0 -1 : R NULL FALSE prec. >6
5447  * 0 -1 : C *names FALSE prec. 0..?
5448  * p p : Fp NULL FALSE
5449  * p -p : Fp(a) *names FALSE
5450  * q q : GF(q=p^n) *names TRUE
5451  */
5452  if (cf==NULL)
5453  {
5454  Werror("Invalid ground field specification");
5455  goto rInitError;
5456 // const int ch=32003;
5457 // cf=nInitChar(n_Zp, (void*)(long)ch);
5458  }
5459 
5460  assume( R != NULL );
5461 
5462  R->cf = cf;
5463 
5464  /* names and number of variables-------------------------------------*/
5465  {
5466  int l=rv->listLength();
5467 
5468  if (l>MAX_SHORT)
5469  {
5470  Werror("too many ring variables(%d), max is %d",l,MAX_SHORT);
5471  goto rInitError;
5472  }
5473  R->N = l; /*rv->listLength();*/
5474  }
5475  R->names = (char **)omAlloc0(R->N * sizeof(char_ptr));
5476  if (rSleftvList2StringArray(rv, R->names))
5477  {
5478  WerrorS("name of ring variable expected");
5479  goto rInitError;
5480  }
5481 
5482  /* check names and parameters for conflicts ------------------------- */
5483  rRenameVars(R); // conflicting variables will be renamed
5484  /* ordering -------------------------------------------------------------*/
5485  if (rSleftvOrdering2Ordering(ord, R))
5486  goto rInitError;
5487 
5488  // Complete the initialization
5489  if (rComplete(R,1))
5490  goto rInitError;
5491 
5492 /*#ifdef HAVE_RINGS
5493 // currently, coefficients which are ring elements require a global ordering:
5494  if (rField_is_Ring(R) && (R->OrdSgn==-1))
5495  {
5496  WerrorS("global ordering required for these coefficients");
5497  goto rInitError;
5498  }
5499 #endif*/
5500 
5501  rTest(R);
5502 
5503  // try to enter the ring into the name list
5504  // need to clean up sleftv here, before this ring can be set to
5505  // new currRing or currRing can be killed beacuse new ring has
5506  // same name
5507  if (pn != NULL) pn->CleanUp();
5508  if (rv != NULL) rv->CleanUp();
5509  if (ord != NULL) ord->CleanUp();
5510  //if ((tmp = enterid(s, myynest, RING_CMD, &IDROOT))==NULL)
5511  // goto rInitError;
5512 
5513  //memcpy(IDRING(tmp),R,sizeof(*R));
5514  // set current ring
5515  //omFreeBin(R, ip_sring_bin);
5516  //return tmp;
5517  return R;
5518 
5519  // error case:
5520  rInitError:
5521  if ((R != NULL)&&(R->cf!=NULL)) rDelete(R);
5522  if (pn != NULL) pn->CleanUp();
5523  if (rv != NULL) rv->CleanUp();
5524  if (ord != NULL) ord->CleanUp();
5525  return NULL;
5526 }
mpz_ptr base
Definition: rmodulon.h:18
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:43
Definition: tok.h:85
ring r
Definition: algext.h:40
#define SHORT_REAL_LENGTH
Definition: numbers.h:54
const short MAX_SHORT
Definition: ipshell.cc:5166
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:45
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R)
Definition: ipshell.cc:4862
Definition: tok.h:42
return P p
Definition: myNF.cc:203
rational (GMP) numbers
Definition: coeffs.h:31
const char * GFPar_name
Definition: coeffs.h:95
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
{p < 2^31}
Definition: coeffs.h:30
int listLength()
Definition: subexpr.cc:61
void WerrorS(const char *s)
Definition: feFopen.cc:23
void nlGMP(number &i, number n, const coeffs r)
Definition: longrat.cc:1410
coeffs coeffs_BIGINT
Definition: ipid.cc:53
int Typ()
Definition: subexpr.cc:955
#define omAlloc(size)
Definition: omAllocDecl.h:210
Creation data needed for finite fields.
Definition: coeffs.h:91
idhdl rDefault(const char *s)
Definition: ipshell.cc:1520
real floating point (GMP) numbers
Definition: coeffs.h:34
short float_len2
additional char-flags, rInit
Definition: coeffs.h:101
char * char_ptr
Definition: structs.h:56
single prescision (6,6) real numbers
Definition: coeffs.h:32
Definition: tok.h:56
short float_len
additional char-flags, rInit
Definition: coeffs.h:100
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:3435
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:44
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
int GFDegree
Definition: coeffs.h:94
complex floating point (GMP) numbers
Definition: coeffs.h:41
#define rTest(r)
Definition: ring.h:781
omBin sip_sring_bin
Definition: ring.cc:54
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:42
struct for passing initialization parameters to naInitChar
Definition: transext.h:92
unsigned long exp
Definition: rmodulon.h:18
#define info
Definition: libparse.cc:1254
int i
Definition: cfEzgcd.cc:123
int IsPrime(int p)
Definition: prime.cc:61
static void rRenameVars(ring R)
Definition: ipshell.cc:2089
leftv next
Definition: subexpr.h:87
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
int GFChar
Definition: coeffs.h:93
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
{p^n < 2^16}
Definition: coeffs.h:33
struct for passing initialization parameters to naInitChar
Definition: algext.h:40
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:35
#define R
Definition: sirandom.c:26
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
void * Data()
Definition: subexpr.cc:1097
const char * par_name
parameter name
Definition: coeffs.h:102
Definition: tok.h:126
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
kBucketDestroy & P
Definition: myNF.cc:191
BOOLEAN rSleftvList2StringArray(sleftv *sl, char **p)
Definition: ipshell.cc:5135
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:327
#define Warn
Definition: emacs.cc:80
void rKill ( idhdl  h)

Definition at line 5759 of file ipshell.cc.

5760 {
5761  ring r = IDRING(h);
5762  int ref=0;
5763  if (r!=NULL)
5764  {
5765  ref=r->ref;
5766  rKill(r);
5767  }
5768  if (h==currRingHdl)
5769  {
5770  if (ref<=0) { currRing=NULL; currRingHdl=NULL;}
5771  else
5772  {
5774  }
5775  }
5776 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
void rKill(ring r)
Definition: ipshell.cc:5690
idhdl currRingHdl
Definition: ipid.cc:64
idhdl rFindHdl(ring r, idhdl n)
Definition: ipshell.cc:1565
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
void rKill ( ring  r)

Definition at line 5690 of file ipshell.cc.

5691 {
5692  if ((r->ref<=0)&&(r->order!=NULL))
5693  {
5694 #ifdef RDEBUG
5695  if (traceit &TRACE_SHOW_RINGS) Print("kill ring %lx\n",(long)r);
5696 #endif
5697  if (r->qideal!=NULL)
5698  {
5699  id_Delete(&r->qideal, r);
5700  r->qideal = NULL;
5701  }
5702  int j;
5703 #ifdef USE_IILOCALRING
5704  for (j=0;j<myynest;j++)
5705  {
5706  if (iiLocalRing[j]==r)
5707  {
5708  if (j+1==myynest) Warn("killing the basering for level %d",j);
5709  iiLocalRing[j]=NULL;
5710  }
5711  }
5712 #else /* USE_IILOCALRING */
5713 //#endif /* USE_IILOCALRING */
5714  {
5715  proclevel * nshdl = procstack;
5716  int lev=myynest-1;
5717 
5718  for(; nshdl != NULL; nshdl = nshdl->next)
5719  {
5720  if (nshdl->cRing==r)
5721  {
5722  Warn("killing the basering for level %d",lev);
5723  nshdl->cRing=NULL;
5724  nshdl->cRingHdl=NULL;
5725  }
5726  }
5727  }
5728 #endif /* USE_IILOCALRING */
5729 // any variables depending on r ?
5730  while (r->idroot!=NULL)
5731  {
5732  r->idroot->lev=myynest; // avoid warning about kill global objects
5733  killhdl2(r->idroot,&(r->idroot),r);
5734  }
5735  if (r==currRing)
5736  {
5737  // all dependend stuff is done, clean global vars:
5738  if ((currRing->ppNoether)!=NULL) pDelete(&(currRing->ppNoether));
5740  {
5742  }
5743  //if ((myynest>0) && (iiRETURNEXPR.RingDependend()))
5744  //{
5745  // WerrorS("return value depends on local ring variable (export missing ?)");
5746  // iiRETURNEXPR.CleanUp();
5747  //}
5748  currRing=NULL;
5749  currRingHdl=NULL;
5750  }
5751 
5752  /* nKillChar(r); will be called from inside of rDelete */
5753  rDelete(r);
5754  return;
5755  }
5756  r->ref--;
5757 }
#define TRACE_SHOW_RINGS
Definition: reporter.h:33
#define Print
Definition: emacs.cc:83
proclevel * procstack
Definition: ipid.cc:57
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int traceit
Definition: febase.cc:47
idhdl cRingHdl
Definition: ipid.h:60
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:400
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:375
int j
Definition: myNF.cc:70
Definition: ipid.h:56
idhdl currRingHdl
Definition: ipid.cc:64
proclevel * next
Definition: ipid.h:59
ring * iiLocalRing
Definition: iplib.cc:525
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pDelete(p_ptr)
Definition: polys.h:157
ring cRing
Definition: ipid.h:61
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define Warn
Definition: emacs.cc:80
void rSetHdl ( idhdl  h)

Definition at line 4696 of file ipshell.cc.

4697 {
4698  ring rg = NULL;
4699  if (h!=NULL)
4700  {
4701 // Print(" new ring:%s (l:%d)\n",IDID(h),IDLEV(h));
4702  rg = IDRING(h);
4703  if (rg==NULL) return; //id <>NULL, ring==NULL
4704  omCheckAddrSize((ADDRESS)h,sizeof(idrec));
4705  if (IDID(h)) // OB: ????
4706  omCheckAddr((ADDRESS)IDID(h));
4707  rTest(rg);
4708  }
4709 
4710  // clean up history
4712  {
4714  memset(&sLastPrinted,0,sizeof(sleftv));
4715  }
4716 
4717  if ((rg!=currRing)&&(currRing!=NULL))
4718  {
4720  if (DENOMINATOR_LIST!=NULL)
4721  {
4722  if (TEST_V_ALLWARN)
4723  Warn("deleting denom_list for ring change to %s",IDID(h));
4724  do
4725  {
4726  n_Delete(&(dd->n),currRing->cf);
4727  dd=dd->next;
4729  DENOMINATOR_LIST=dd;
4730  } while(DENOMINATOR_LIST!=NULL);
4731  }
4732  }
4733 
4734  // test for valid "currRing":
4735  if ((rg!=NULL) && (rg->idroot==NULL))
4736  {
4737  ring old=rg;
4738  rg=rAssure_HasComp(rg);
4739  if (old!=rg)
4740  {
4741  rKill(old);
4742  IDRING(h)=rg;
4743  }
4744  }
4745  /*------------ change the global ring -----------------------*/
4746  rChangeCurrRing(rg);
4747  currRingHdl = h;
4748 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
#define IDID(a)
Definition: ipid.h:121
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
void * ADDRESS
Definition: auxiliary.h:161
ring rAssure_HasComp(const ring r)
Definition: ring.cc:4559
Definition: idrec.h:34
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN RingDependend()
Definition: subexpr.cc:375
void rKill(ring r)
Definition: ipshell.cc:5690
#define omFree(addr)
Definition: omAllocDecl.h:261
#define rTest(r)
Definition: ring.h:781
idhdl currRingHdl
Definition: ipid.cc:64
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define NULL
Definition: omList.c:10
denominator_list next
Definition: kutil.h:67
#define IDRING(a)
Definition: ipid.h:126
sleftv sLastPrinted
Definition: subexpr.cc:55
void CleanUp(ring r=currRing)
Definition: subexpr.cc:307
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
static Poly * h
Definition: janet.cc:978
#define TEST_V_ALLWARN
Definition: options.h:135
#define Warn
Definition: emacs.cc:80
idhdl rSimpleFindHdl ( ring  r,
idhdl  root,
idhdl  n = NULL 
)

Definition at line 5778 of file ipshell.cc.

5779 {
5780  //idhdl next_best=NULL;
5781  idhdl h=root;
5782  while (h!=NULL)
5783  {
5784  if (((IDTYP(h)==RING_CMD)||(IDTYP(h)==QRING_CMD))
5785  && (h!=n)
5786  && (IDRING(h)==r)
5787  )
5788  {
5789  // if (IDLEV(h)==myynest)
5790  // return h;
5791  // if ((IDLEV(h)==0) || (next_best==NULL))
5792  // next_best=h;
5793  // else if (IDLEV(next_best)<IDLEV(h))
5794  // next_best=h;
5795  return h;
5796  }
5797  h=IDNEXT(h);
5798  }
5799  //return next_best;
5800  return NULL;
5801 }
#define IDNEXT(a)
Definition: ipid.h:117
Definition: idrec.h:34
#define IDTYP(a)
Definition: ipid.h:118
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
#define IDRING(a)
Definition: ipid.h:126
Definition: tok.h:126
static Poly * h
Definition: janet.cc:978
lists scIndIndset ( ideal  S,
BOOLEAN  all,
ideal  Q 
)

Definition at line 1012 of file ipshell.cc.

1013 {
1014  int i;
1015  indset save;
1017 
1018  hexist = hInit(S, Q, &hNexist, currRing);
1019  if (hNexist == 0)
1020  {
1021  intvec *iv=new intvec(rVar(currRing));
1022  for(i=0; i<rVar(currRing); i++) (*iv)[i]=1;
1023  res->Init(1);
1024  res->m[0].rtyp=INTVEC_CMD;
1025  res->m[0].data=(intvec*)iv;
1026  return res;
1027  }
1028  else if (hisModule!=0)
1029  {
1030  res->Init(0);
1031  return res;
1032  }
1033  save = ISet = (indset)omAlloc0Bin(indlist_bin);
1034  hMu = 0;
1035  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1036  hvar = (varset)omAlloc((rVar(currRing) + 1) * sizeof(int));
1037  hpure = (scmon)omAlloc((1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1038  hrad = hexist;
1039  hNrad = hNexist;
1040  radmem = hCreate(rVar(currRing) - 1);
1041  hCo = rVar(currRing) + 1;
1042  hNvar = rVar(currRing);
1043  hRadical(hrad, &hNrad, hNvar);
1044  hSupp(hrad, hNrad, hvar, &hNvar);
1045  if (hNvar)
1046  {
1047  hCo = hNvar;
1048  memset(hpure, 0, (rVar(currRing) + 1) * sizeof(long));
1049  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
1050  hLexR(hrad, hNrad, hvar, hNvar);
1052  }
1053  if (hCo && (hCo < rVar(currRing)))
1054  {
1056  }
1057  if (hMu!=0)
1058  {
1059  ISet = save;
1060  hMu2 = 0;
1061  if (all && (hCo+1 < rVar(currRing)))
1062  {
1065  i=hMu+hMu2;
1066  res->Init(i);
1067  if (hMu2 == 0)
1068  {
1070  }
1071  }
1072  else
1073  {
1074  res->Init(hMu);
1075  }
1076  for (i=0;i<hMu;i++)
1077  {
1078  res->m[i].data = (void *)save->set;
1079  res->m[i].rtyp = INTVEC_CMD;
1080  ISet = save;
1081  save = save->nx;
1083  }
1084  omFreeBin((ADDRESS)save, indlist_bin);
1085  if (hMu2 != 0)
1086  {
1087  save = JSet;
1088  for (i=hMu;i<hMu+hMu2;i++)
1089  {
1090  res->m[i].data = (void *)save->set;
1091  res->m[i].rtyp = INTVEC_CMD;
1092  JSet = save;
1093  save = save->nx;
1095  }
1096  omFreeBin((ADDRESS)save, indlist_bin);
1097  }
1098  }
1099  else
1100  {
1101  res->Init(0);
1103  }
1104  hKill(radmem, rVar(currRing) - 1);
1105  omFreeSize((ADDRESS)hpure, (1 + (rVar(currRing) * rVar(currRing))) * sizeof(long));
1106  omFreeSize((ADDRESS)hvar, (rVar(currRing) + 1) * sizeof(int));
1107  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1109  return res;
1110 }
int hMu2
Definition: hdegree.cc:22
sleftv * m
Definition: lists.h:45
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
scfmon hwork
Definition: hutil.cc:19
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:496
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:23
int hCo
Definition: hdegree.cc:22
Definition: lists.h:22
scmon * scfmon
Definition: hutil.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
scfmon hexist
Definition: hutil.cc:19
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:161
int hNrad
Definition: hutil.cc:22
int hNpure
Definition: hutil.cc:22
scmon hpure
Definition: hutil.cc:20
#define Q
Definition: sirandom.c:25
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:417
#define omAlloc(size)
Definition: omAllocDecl.h:210
scfmon hrad
Definition: hutil.cc:19
void * data
Definition: subexpr.h:89
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
indset ISet
Definition: hdegree.cc:279
Definition: intvec.h:16
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
varset hvar
Definition: hutil.cc:21
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:313
indlist * indset
Definition: hutil.h:35
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
omBin indlist_bin
Definition: hdegree.cc:23
indset JSet
Definition: hdegree.cc:279
int * scmon
Definition: hutil.h:21
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:571
INLINE_THIS void Init(int l=0)
Definition: lists.h:66
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
slists * lists
Definition: mpr_numeric.h:146
monf radmem
Definition: hutil.cc:24
int rtyp
Definition: subexpr.h:92
omBin slists_bin
Definition: lists.cc:23
int hisModule
Definition: hutil.cc:23
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
int hMu
Definition: hdegree.cc:22
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180
BOOLEAN semicProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4132 of file ipshell.cc.

4133 {
4134  sleftv tmp;
4135  memset(&tmp,0,sizeof(tmp));
4136  tmp.rtyp=INT_CMD;
4137  /* tmp.data = (void *)0; -- done by memset */
4138 
4139  return semicProc3(res,u,v,&tmp);
4140 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
BOOLEAN semicProc3(leftv res, leftv u, leftv v, leftv w)
Definition: ipshell.cc:4092
poly res
Definition: myNF.cc:322
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
int rtyp
Definition: subexpr.h:92
BOOLEAN semicProc3 ( leftv  ,
leftv  ,
leftv  ,
leftv   
)

Definition at line 4092 of file ipshell.cc.

4093 {
4094  semicState state;
4095  BOOLEAN qh=(((int)(long)w->Data())==1);
4096 
4097  // -----------------
4098  // check arguments
4099  // -----------------
4100 
4101  lists l1 = (lists)u->Data( );
4102  lists l2 = (lists)v->Data( );
4103 
4104  if( (state=list_is_spectrum( l1 ))!=semicOK )
4105  {
4106  WerrorS( "first argument is not a spectrum" );
4107  list_error( state );
4108  }
4109  else if( (state=list_is_spectrum( l2 ))!=semicOK )
4110  {
4111  WerrorS( "second argument is not a spectrum" );
4112  list_error( state );
4113  }
4114  else
4115  {
4116  spectrum s1= spectrumFromList( l1 );
4117  spectrum s2= spectrumFromList( l2 );
4118 
4119  res->rtyp = INT_CMD;
4120  if (qh)
4121  res->data = (void*)(long)(s1.mult_spectrumh( s2 ));
4122  else
4123  res->data = (void*)(long)(s1.mult_spectrum( s2 ));
4124  }
4125 
4126  // -----------------
4127  // check status
4128  // -----------------
4129 
4130  return (state!=semicOK);
4131 }
Definition: tok.h:85
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:2965
void list_error(semicState state)
Definition: ipshell.cc:3049
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: semic.h:63
poly res
Definition: myNF.cc:322
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3834
int mult_spectrumh(spectrum &)
Definition: semic.cc:425
semicState
Definition: ipshell.cc:3015
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
slists * lists
Definition: mpr_numeric.h:146
const CanonicalForm & w
Definition: facAbsFact.cc:55
int BOOLEAN
Definition: auxiliary.h:131
int mult_spectrum(spectrum &)
Definition: semic.cc:396
BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 580 of file misc_ip.cc.

581 {
582  const char *n;
583  do
584  {
585  if (v->Typ()==STRING_CMD)
586  {
587  n=(const char *)v->CopyD(STRING_CMD);
588  }
589  else
590  {
591  if (v->name==NULL)
592  return TRUE;
593  if (v->rtyp==0)
594  {
595  n=v->name;
596  v->name=NULL;
597  }
598  else
599  {
600  n=omStrDup(v->name);
601  }
602  }
603 
604  int i;
605 
606  if(strcmp(n,"get")==0)
607  {
608  intvec *w=new intvec(2);
609  (*w)[0]=si_opt_1;
610  (*w)[1]=si_opt_2;
611  res->rtyp=INTVEC_CMD;
612  res->data=(void *)w;
613  goto okay;
614  }
615  if(strcmp(n,"set")==0)
616  {
617  if((v->next!=NULL)
618  &&(v->next->Typ()==INTVEC_CMD))
619  {
620  v=v->next;
621  intvec *w=(intvec*)v->Data();
622  si_opt_1=(*w)[0];
623  si_opt_2=(*w)[1];
624 #if 0
627 #ifdef HAVE_RINGS
629 #endif
630  ) {
632  }
633 #endif
634  goto okay;
635  }
636  }
637  if(strcmp(n,"none")==0)
638  {
639  si_opt_1=0;
640  si_opt_2=0;
641  goto okay;
642  }
643  for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
644  {
645  if (strcmp(n,optionStruct[i].name)==0)
646  {
647  if (optionStruct[i].setval & validOpts)
648  {
650  // optOldStd disables redthrough
651  if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
653  }
654  else
655  Warn("cannot set option");
656 #if 0
659 #ifdef HAVE_RINGS
661 #endif
662  ) {
664  }
665 #endif
666  goto okay;
667  }
668  else if ((strncmp(n,"no",2)==0)
669  && (strcmp(n+2,optionStruct[i].name)==0))
670  {
671  if (optionStruct[i].setval & validOpts)
672  {
674  }
675  else
676  Warn("cannot clear option");
677  goto okay;
678  }
679  }
680  for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
681  {
682  if (strcmp(n,verboseStruct[i].name)==0)
683  {
685  #ifdef YYDEBUG
686  #if YYDEBUG
687  /*debugging the bison grammar --> grammar.cc*/
688  extern int yydebug;
689  if (BVERBOSE(V_YACC)) yydebug=1;
690  else yydebug=0;
691  #endif
692  #endif
693  goto okay;
694  }
695  else if ((strncmp(n,"no",2)==0)
696  && (strcmp(n+2,verboseStruct[i].name)==0))
697  {
699  #ifdef YYDEBUG
700  #if YYDEBUG
701  /*debugging the bison grammar --> grammar.cc*/
702  extern int yydebug;
703  if (BVERBOSE(V_YACC)) yydebug=1;
704  else yydebug=0;
705  #endif
706  #endif
707  goto okay;
708  }
709  }
710  Werror("unknown option `%s`",n);
711  okay:
712  if (currRing != NULL)
713  currRing->options = si_opt_1 & TEST_RINGDEP_OPTS;
714  omFree((ADDRESS)n);
715  v=v->next;
716  } while (v!=NULL);
717 
718  // set global variable to show memory usage
719  extern int om_sing_opt_show_mem;
720  if (BVERBOSE(V_SHOW_MEM)) om_sing_opt_show_mem = 1;
721  else om_sing_opt_show_mem = 0;
722 
723  return FALSE;
724 }
unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:140
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define OPT_OLDSTD
Definition: options.h:81
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
int Typ()
Definition: subexpr.cc:955
#define Sy_bit(x)
Definition: options.h:30
BITSET validOpts
Definition: kstd1.cc:70
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:497
void * data
Definition: subexpr.h:89
unsigned setval
Definition: iplib.cc:315
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define V_SHOW_MEM
Definition: options.h:41
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:16
unsigned resetval
Definition: iplib.cc:316
const char * name
Definition: subexpr.h:88
#define omFree(addr)
Definition: omAllocDecl.h:261
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
int i
Definition: cfEzgcd.cc:123
Definition: tok.h:88
leftv next
Definition: subexpr.h:87
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
CanonicalForm test
Definition: cfModGcd.cc:4037
char name(const Variable &v)
Definition: variable.h:95
#define V_YACC
Definition: options.h:42
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
int yydebug
Definition: grammar.cc:1862
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:92
void * Data()
Definition: subexpr.cc:1097
#define OPT_REDTHROUGH
Definition: options.h:77
#define TEST_RINGDEP_OPTS
Definition: options.h:95
unsigned si_opt_2
Definition: options.c:6
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void * CopyD(int t)
Definition: subexpr.cc:662
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263
char* showOption ( )

Definition at line 726 of file misc_ip.cc.

727 {
728  int i;
729  BITSET tmp;
730 
731  StringSetS("//options:");
732  if ((si_opt_1!=0)||(si_opt_2!=0))
733  {
734  tmp=si_opt_1;
735  if(tmp)
736  {
737  for (i=0; optionStruct[i].setval!=0; i++)
738  {
739  if (optionStruct[i].setval & tmp)
740  {
741  StringAppend(" %s",optionStruct[i].name);
742  tmp &=optionStruct[i].resetval;
743  }
744  }
745  for (i=0; i<32; i++)
746  {
747  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
748  }
749  }
750  tmp=si_opt_2;
751  if (tmp)
752  {
753  for (i=0; verboseStruct[i].setval!=0; i++)
754  {
755  if (verboseStruct[i].setval & tmp)
756  {
757  StringAppend(" %s",verboseStruct[i].name);
758  tmp &=verboseStruct[i].resetval;
759  }
760  }
761  for (i=1; i<32; i++)
762  {
763  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
764  }
765  }
766  return StringEndS();
767  }
768  StringAppendS(" none");
769  return StringEndS();
770 }
unsigned si_opt_1
Definition: options.c:5
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
unsigned setval
Definition: iplib.cc:315
unsigned resetval
Definition: iplib.cc:316
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551
void StringSetS(const char *st)
Definition: reporter.cc:128
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: variable.h:95
unsigned si_opt_2
Definition: options.c:6
void singular_example ( char *  str)

Definition at line 437 of file misc_ip.cc.

438 {
439  assume(str!=NULL);
440  char *s=str;
441  while (*s==' ') s++;
442  char *ss=s;
443  while (*ss!='\0') ss++;
444  while (*ss<=' ')
445  {
446  *ss='\0';
447  ss--;
448  }
449  idhdl h=IDROOT->get(s,myynest);
450  if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
451  {
452  char *lib=iiGetLibName(IDPROC(h));
453  if((lib!=NULL)&&(*lib!='\0'))
454  {
455  Print("// proc %s from lib %s\n",s,lib);
456  s=iiGetLibProcBuffer(IDPROC(h), 2);
457  if (s!=NULL)
458  {
459  if (strlen(s)>5)
460  {
461  iiEStart(s,IDPROC(h));
462  omFree((ADDRESS)s);
463  return;
464  }
465  else omFree((ADDRESS)s);
466  }
467  }
468  }
469  else
470  {
471  char sing_file[MAXPATHLEN];
472  FILE *fd=NULL;
473  char *res_m=feResource('m', 0);
474  if (res_m!=NULL)
475  {
476  sprintf(sing_file, "%s/%s.sing", res_m, s);
477  fd = feFopen(sing_file, "r");
478  }
479  if (fd != NULL)
480  {
481 
482  int old_echo = si_echo;
483  int length, got;
484  char* s;
485 
486  fseek(fd, 0, SEEK_END);
487  length = ftell(fd);
488  fseek(fd, 0, SEEK_SET);
489  s = (char*) omAlloc((length+20)*sizeof(char));
490  got = fread(s, sizeof(char), length, fd);
491  fclose(fd);
492  if (got != length)
493  {
494  Werror("Error while reading file %s", sing_file);
495  }
496  else
497  {
498  s[length] = '\0';
499  strcat(s, "\n;return();\n\n");
500  si_echo = 2;
501  iiEStart(s, NULL);
502  si_echo = old_echo;
503  }
504  omFree(s);
505  }
506  else
507  {
508  Werror("no example for %s", str);
509  }
510  }
511 }
int status int fd
Definition: si_signals.h:59
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define MAXPATHLEN
Definition: omRet2Info.c:22
#define Print
Definition: emacs.cc:83
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:252
#define IDROOT
Definition: ipid.h:20
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: idrec.h:34
int myynest
Definition: febase.cc:46
#define IDTYP(a)
Definition: ipid.h:118
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:46
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:665
#define IDPROC(a)
Definition: ipid.h:139
#define SEEK_END
Definition: mod2.h:121
#define NULL
Definition: omList.c:10
char * iiGetLibName(procinfov pi)
Definition: iplib.cc:101
#define SEEK_SET
Definition: mod2.h:125
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:210
static Poly * h
Definition: janet.cc:978
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int si_echo
Definition: febase.cc:41
leftv singular_system ( sleftv  h)
BOOLEAN spaddProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4009 of file ipshell.cc.

4010 {
4011  semicState state;
4012 
4013  // -----------------
4014  // check arguments
4015  // -----------------
4016 
4017  lists l1 = (lists)first->Data( );
4018  lists l2 = (lists)second->Data( );
4019 
4020  if( (state=list_is_spectrum( l1 )) != semicOK )
4021  {
4022  WerrorS( "first argument is not a spectrum:" );
4023  list_error( state );
4024  }
4025  else if( (state=list_is_spectrum( l2 )) != semicOK )
4026  {
4027  WerrorS( "second argument is not a spectrum:" );
4028  list_error( state );
4029  }
4030  else
4031  {
4032  spectrum s1= spectrumFromList ( l1 );
4033  spectrum s2= spectrumFromList ( l2 );
4034  spectrum sum( s1+s2 );
4035 
4036  result->rtyp = LIST_CMD;
4037  result->data = (char*)(getList(sum));
4038  }
4039 
4040  return (state!=semicOK);
4041 }
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:2965
void list_error(semicState state)
Definition: ipshell.cc:3049
void WerrorS(const char *s)
Definition: feFopen.cc:23
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:2977
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3834
semicState
Definition: ipshell.cc:3015
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spectrumfProc ( leftv  ,
leftv   
)

Definition at line 3765 of file ipshell.cc.

3766 {
3767  spectrumState state = spectrumOK;
3768 
3769  // -------------------
3770  // check consistency
3771  // -------------------
3772 
3773  // check for a local polynomial ring
3774 
3775  if( currRing->OrdSgn != -1 )
3776  // ?? HS: the test above is also true for k[x][[y]], k[[x]][y]
3777  // or should we use:
3778  //if( !ringIsLocal( ) )
3779  {
3780  WerrorS( "only works for local orderings" );
3781  state = spectrumWrongRing;
3782  }
3783  else if( currRing->qideal != NULL )
3784  {
3785  WerrorS( "does not work in quotient rings" );
3786  state = spectrumWrongRing;
3787  }
3788  else
3789  {
3790  lists L = (lists)NULL;
3791  int flag = 2; // symmetric optimization
3792 
3793  state = spectrumCompute( (poly)first->Data( ),&L,flag );
3794 
3795  if( state==spectrumOK )
3796  {
3797  result->rtyp = LIST_CMD;
3798  result->data = (char*)L;
3799  }
3800  else
3801  {
3802  spectrumPrintError(state);
3803  }
3804  }
3805 
3806  return (state!=spectrumOK);
3807 }
spectrumState
Definition: ipshell.cc:3131
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3683
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3391
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spectrumProc ( leftv  ,
leftv   
)

Definition at line 3714 of file ipshell.cc.

3715 {
3716  spectrumState state = spectrumOK;
3717 
3718  // -------------------
3719  // check consistency
3720  // -------------------
3721 
3722  // check for a local ring
3723 
3724  if( !ringIsLocal(currRing ) )
3725  {
3726  WerrorS( "only works for local orderings" );
3727  state = spectrumWrongRing;
3728  }
3729 
3730  // no quotient rings are allowed
3731 
3732  else if( currRing->qideal != NULL )
3733  {
3734  WerrorS( "does not work in quotient rings" );
3735  state = spectrumWrongRing;
3736  }
3737  else
3738  {
3739  lists L = (lists)NULL;
3740  int flag = 1; // weight corner optimization is safe
3741 
3742  state = spectrumCompute( (poly)first->Data( ),&L,flag );
3743 
3744  if( state==spectrumOK )
3745  {
3746  result->rtyp = LIST_CMD;
3747  result->data = (char*)L;
3748  }
3749  else
3750  {
3751  spectrumPrintError(state);
3752  }
3753  }
3754 
3755  return (state!=spectrumOK);
3756 }
spectrumState
Definition: ipshell.cc:3131
Definition: lists.h:22
void WerrorS(const char *s)
Definition: feFopen.cc:23
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void spectrumPrintError(spectrumState state)
Definition: ipshell.cc:3683
spectrumState spectrumCompute(poly h, lists *L, int fast)
Definition: ipshell.cc:3391
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
BOOLEAN ringIsLocal(const ring r)
Definition: spectrum.cc:461
polyrec * poly
Definition: hilb.h:10
return result
Definition: facAbsBiFact.cc:76
BOOLEAN spmulProc ( leftv  ,
leftv  ,
leftv   
)

Definition at line 4051 of file ipshell.cc.

4052 {
4053  semicState state;
4054 
4055  // -----------------
4056  // check arguments
4057  // -----------------
4058 
4059  lists l = (lists)first->Data( );
4060  int k = (int)(long)second->Data( );
4061 
4062  if( (state=list_is_spectrum( l ))!=semicOK )
4063  {
4064  WerrorS( "first argument is not a spectrum" );
4065  list_error( state );
4066  }
4067  else if( k < 0 )
4068  {
4069  WerrorS( "second argument should be positive" );
4070  state = semicMulNegative;
4071  }
4072  else
4073  {
4074  spectrum s= spectrumFromList( l );
4075  spectrum product( k*s );
4076 
4077  result->rtyp = LIST_CMD;
4078  result->data = (char*)getList(product);
4079  }
4080 
4081  return (state!=semicOK);
4082 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: lists.h:22
spectrum spectrumFromList(lists l)
Definition: ipshell.cc:2965
void list_error(semicState state)
Definition: ipshell.cc:3049
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
Definition: semic.h:63
lists getList(spectrum &spec)
Definition: ipshell.cc:2977
semicState list_is_spectrum(lists l)
Definition: ipshell.cc:3834
semicState
Definition: ipshell.cc:3015
slists * lists
Definition: mpr_numeric.h:146
Definition: tok.h:96
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
BOOLEAN syBetti1 ( leftv  res,
leftv  u 
)

Definition at line 2748 of file ipshell.cc.

2749 {
2750  sleftv tmp;
2751  memset(&tmp,0,sizeof(tmp));
2752  tmp.rtyp=INT_CMD;
2753  tmp.data=(void *)1;
2754  return syBetti2(res,u,&tmp);
2755 }
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
Definition: tok.h:85
void * data
Definition: subexpr.h:89
BOOLEAN syBetti2(leftv res, leftv u, leftv w)
Definition: ipshell.cc:2725
int rtyp
Definition: subexpr.h:92
BOOLEAN syBetti2 ( leftv  res,
leftv  u,
leftv  w 
)

Definition at line 2725 of file ipshell.cc.

2726 {
2727  syStrategy syzstr=(syStrategy)u->Data();
2728 
2729  BOOLEAN minim=(int)(long)w->Data();
2730  int row_shift=0;
2731  int add_row_shift=0;
2732  intvec *weights=NULL;
2733  intvec *ww=(intvec *)atGet(u,"isHomog",INTVEC_CMD);
2734  if (ww!=NULL)
2735  {
2736  weights=ivCopy(ww);
2737  add_row_shift = ww->min_in();
2738  (*weights) -= add_row_shift;
2739  }
2740 
2741  res->data=(void *)syBettiOfComputation(syzstr,minim,&row_shift,weights);
2742  //row_shift += add_row_shift;
2743  //Print("row_shift=%d, add_row_shift=%d\n",row_shift,add_row_shift);
2744  atSet(res,omStrDup("rowShift"),(void*)(long)add_row_shift,INT_CMD);
2745 
2746  return FALSE;
2747 }
void atSet(idhdl root, const char *name, void *data, int typ)
Definition: attrib.cc:156
Definition: tok.h:85
#define FALSE
Definition: auxiliary.h:140
intvec * ivCopy(const intvec *o)
Definition: intvec.h:137
int min_in()
Definition: intvec.h:110
void * data
Definition: subexpr.h:89
Definition: intvec.h:16
Definition: tok.h:88
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:135
#define NULL
Definition: omList.c:10
intvec * syBettiOfComputation(syStrategy syzstr, BOOLEAN minim=TRUE, int *row_shift=NULL, intvec *weights=NULL)
Definition: syz1.cc:1767
void * Data()
Definition: subexpr.cc:1097
int BOOLEAN
Definition: auxiliary.h:131
ssyStrategy * syStrategy
Definition: syz.h:35
#define omStrDup(s)
Definition: omAllocDecl.h:263
syStrategy syConvList ( lists  li,
BOOLEAN  toDel 
)

Definition at line 2836 of file ipshell.cc.

2837 {
2838  int typ0;
2840 
2841  resolvente fr = liFindRes(li,&(result->length),&typ0,&(result->weights));
2842  if (fr != NULL)
2843  {
2844 
2845  result->fullres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
2846  for (int i=result->length-1;i>=0;i--)
2847  {
2848  if (fr[i]!=NULL)
2849  result->fullres[i] = idCopy(fr[i]);
2850  }
2851  result->list_length=result->length;
2852  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
2853  }
2854  else
2855  {
2856  omFreeSize(result, sizeof(ssyStrategy));
2857  result = NULL;
2858  }
2859  if (toDel) li->Clean();
2860  return result;
2861 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:76
#define NULL
Definition: omList.c:10
void Clean(ring r=currRing)
Definition: lists.h:25
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:20
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35
lists syConvRes ( syStrategy  syzstr,
BOOLEAN  toDel = FALSE,
int  add_row_shift = 0 
)

Definition at line 2760 of file ipshell.cc.

2761 {
2762  resolvente fullres = syzstr->fullres;
2763  resolvente minres = syzstr->minres;
2764 
2765  const int length = syzstr->length;
2766 
2767  if ((fullres==NULL) && (minres==NULL))
2768  {
2769  if (syzstr->hilb_coeffs==NULL)
2770  { // La Scala
2771  fullres = syReorder(syzstr->res, length, syzstr);
2772  }
2773  else
2774  { // HRES
2775  minres = syReorder(syzstr->orderedRes, length, syzstr);
2776  syKillEmptyEntres(minres, length);
2777  }
2778  }
2779 
2780  resolvente tr;
2781  int typ0=IDEAL_CMD;
2782 
2783  if (minres!=NULL)
2784  tr = minres;
2785  else
2786  tr = fullres;
2787 
2788  resolvente trueres=NULL; intvec ** w=NULL;
2789 
2790  if (length>0)
2791  {
2792  trueres = (resolvente)omAlloc0((length)*sizeof(ideal));
2793  for (int i=(length)-1;i>=0;i--)
2794  {
2795  if (tr[i]!=NULL)
2796  {
2797  trueres[i] = idCopy(tr[i]);
2798  }
2799  }
2800  if ( id_RankFreeModule(trueres[0], currRing) > 0)
2801  typ0 = MODUL_CMD;
2802  if (syzstr->weights!=NULL)
2803  {
2804  w = (intvec**)omAlloc0(length*sizeof(intvec*));
2805  for (int i=length-1;i>=0;i--)
2806  {
2807  if (syzstr->weights[i]!=NULL) w[i] = ivCopy(syzstr->weights[i]);
2808  }
2809  }
2810  }
2811 
2812  lists li = liMakeResolv(trueres, length, syzstr->list_length,typ0,
2813  w, add_row_shift);
2814 
2815  if (w != NULL) omFreeSize(w, length*sizeof(intvec*));
2816 
2817  if (toDel)
2818  syKillComputation(syzstr);
2819  else
2820  {
2821  if( fullres != NULL && syzstr->fullres == NULL )
2822  syzstr->fullres = fullres;
2823 
2824  if( minres != NULL && syzstr->minres == NULL )
2825  syzstr->minres = minres;
2826  }
2827 
2828  return li;
2829 
2830 
2831 }
int length
Definition: syz.h:60
intvec ** weights
Definition: syz.h:45
resolvente syReorder(resolvente res, int length, syStrategy syzstr, BOOLEAN toCopy=TRUE, resolvente totake=NULL)
Definition: syz1.cc:1653
Definition: lists.h:22
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
intvec * ivCopy(const intvec *o)
Definition: intvec.h:137
resolvente res
Definition: syz.h:47
intvec ** hilb_coeffs
Definition: syz.h:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
resolvente orderedRes
Definition: syz.h:48
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int i
Definition: cfEzgcd.cc:123
resolvente fullres
Definition: syz.h:57
ideal idCopy(ideal A)
Definition: ideals.h:76
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
lists liMakeResolv(resolvente r, int length, int reallen, int typ0, intvec **weights, int add_row_shift)
Definition: lists.cc:216
const CanonicalForm & w
Definition: facAbsFact.cc:55
short list_length
Definition: syz.h:62
ideal * resolvente
Definition: ideals.h:20
void syKillEmptyEntres(resolvente res, int length)
Definition: syz1.cc:2209
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1497
#define omAlloc0(size)
Definition: omAllocDecl.h:211
syStrategy syForceMin ( lists  li)

Definition at line 2866 of file ipshell.cc.

2867 {
2868  int typ0;
2870 
2871  resolvente fr = liFindRes(li,&(result->length),&typ0);
2872  result->minres = (resolvente)omAlloc0((result->length+1)*sizeof(ideal));
2873  for (int i=result->length-1;i>=0;i--)
2874  {
2875  if (fr[i]!=NULL)
2876  result->minres[i] = idCopy(fr[i]);
2877  }
2878  omFreeSize((ADDRESS)fr,(result->length)*sizeof(ideal));
2879  return result;
2880 }
int length
Definition: syz.h:60
resolvente liFindRes(lists L, int *len, int *typ0, intvec ***weights)
Definition: lists.cc:313
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
int i
Definition: cfEzgcd.cc:123
ideal idCopy(ideal A)
Definition: ideals.h:76
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ideal * resolvente
Definition: ideals.h:20
#define omAlloc0(size)
Definition: omAllocDecl.h:211
return result
Definition: facAbsBiFact.cc:76
ssyStrategy * syStrategy
Definition: syz.h:35
void test_cmd ( int  i)

Definition at line 514 of file ipshell.cc.

515 {
516  int ii;
517 
518  if (i<0)
519  {
520  ii= -i;
521  if (ii < 32)
522  {
523  si_opt_1 &= ~Sy_bit(ii);
524  }
525  else if (ii < 64)
526  {
527  si_opt_2 &= ~Sy_bit(ii-32);
528  }
529  else
530  WerrorS("out of bounds\n");
531  }
532  else if (i<32)
533  {
534  ii=i;
535  if (Sy_bit(ii) & kOptions)
536  {
537  Warn("Gerhard, use the option command");
538  si_opt_1 |= Sy_bit(ii);
539  }
540  else if (Sy_bit(ii) & validOpts)
541  si_opt_1 |= Sy_bit(ii);
542  }
543  else if (i<64)
544  {
545  ii=i-32;
546  si_opt_2 |= Sy_bit(ii);
547  }
548  else
549  WerrorS("out of bounds\n");
550 }
unsigned si_opt_1
Definition: options.c:5
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define Sy_bit(x)
Definition: options.h:30
BITSET validOpts
Definition: kstd1.cc:70
int i
Definition: cfEzgcd.cc:123
BITSET kOptions
Definition: kstd1.cc:55
unsigned si_opt_2
Definition: options.c:6
#define Warn
Definition: emacs.cc:80
const char* Tok2Cmdname ( int  i)

Definition at line 128 of file gentable.cc.

129 {
130  if (tok < 0)
131  {
132  return cmds[0].name;
133  }
134  if (tok==COMMAND) return "command";
135  if (tok==ANY_TYPE) return "any_type";
136  if (tok==NONE) return "nothing";
137  //if (tok==IFBREAK) return "if_break";
138  //if (tok==VECTOR_FROM_POLYS) return "vector_from_polys";
139  //if (tok==ORDER_VECTOR) return "ordering";
140  //if (tok==REF_VAR) return "ref";
141  //if (tok==OBJECT) return "object";
142  //if (tok==PRINT_EXPR) return "print_expr";
143  if (tok==IDHDL) return "identifier";
144  if (tok==CRING_CMD) return "(c)ring";
145  // we do not blackbox objects during table generation:
146  //if (tok>MAX_TOK) return getBlackboxName(tok);
147  int i = 0;
148  while (cmds[i].tokval!=0)
149  {
150  if ((cmds[i].tokval == tok)&&(cmds[i].alias==0))
151  {
152  return cmds[i].name;
153  }
154  i++;
155  }
156  i=0;// try again for old/alias names:
157  while (cmds[i].tokval!=0)
158  {
159  if (cmds[i].tokval == tok)
160  {
161  return cmds[i].name;
162  }
163  i++;
164  }
165  #if 0
166  char *s=(char*)malloc(10);
167  sprintf(s,"(%d)",tok);
168  return s;
169  #else
170  return cmds[0].name;
171  #endif
172 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define ANY_TYPE
Definition: tok.h:34
#define IDHDL
Definition: tok.h:35
Definition: tok.h:56
void * malloc(size_t size)
Definition: omalloc.c:92
int i
Definition: cfEzgcd.cc:123
cmdnames cmds[]
Definition: table.h:839
#define NONE
Definition: tok.h:170
#define COMMAND
Definition: tok.h:33
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:
276  case QRING_CMD: PrintLn(); break;
277 
278  //case INT_CMD:
279  //case STRING_CMD:
280  //case INTVEC_CMD:
281  //case POLY_CMD:
282  //case VECTOR_CMD:
283  //case PACKAGE_CMD:
284 
285  default:
286  break;
287  }
288  v->Print();
289  if (currRing != NULL)
290  currRing->ShortOut = oldShortOut;
291 }
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
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:140
int Typ()
Definition: subexpr.cc:955
const char * Name()
Definition: subexpr.h:121
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
#define MATCOLS(i)
Definition: matpol.h:28
#define NULL
Definition: omList.c:10
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
void * Data()
Definition: subexpr.cc:1097
Definition: tok.h:96
Definition: tok.h:126
#define MATROWS(i)
Definition: matpol.h:27
int BOOLEAN
Definition: auxiliary.h:131
char* versionString ( )

Definition at line 783 of file misc_ip.cc.

784 {
785  StringSetS("");
786  StringAppend("Singular for %s version %s (%d, %d bit) %s #%s",
787  S_UNAME, VERSION, // SINGULAR_VERSION,
788  SINGULAR_VERSION, SIZEOF_VOIDP*8, singular_date, GIT_VERSION);
789  StringAppendS("\nwith\n\t");
790 
791 #if defined(mpir_version)
792  StringAppend("MPIR(%s)~GMP(%s),", mpir_version, gmp_version);
793 #elif defined(gmp_version)
794  // #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
795  // StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
796  StringAppend("GMP(%s),", gmp_version);
797 #endif
798 #ifdef HAVE_NTL
799 #include <NTL/version.h>
800  StringAppend("NTL(%s),",NTL_VERSION);
801 #endif
802 
803 #ifdef HAVE_FLINT
804  StringAppend("FLINT(%s),",version);
805 #endif
806  StringAppend("factory(%s),\n\t", factoryVersion);
807 #if defined(HAVE_DYN_RL)
809  StringAppendS("no input,");
810  else if (fe_fgets_stdin==fe_fgets)
811  StringAppendS("fgets,");
813  StringAppendS("dynamic readline,");
814  #ifdef HAVE_FEREAD
816  StringAppendS("emulated readline,");
817  #endif
818  else
819  StringAppendS("unknown fgets method,");
820 #else
821  #if defined(HAVE_READLINE) && !defined(FEREAD)
822  StringAppendS("static readline,");
823  #else
824  #ifdef HAVE_FEREAD
825  StringAppendS("emulated readline,");
826  #else
827  StringAppendS("fgets,");
828  #endif
829  #endif
830 #endif
831 #ifdef HAVE_PLURAL
832  StringAppendS("Plural,");
833 #endif
834 #ifdef HAVE_DBM
835  StringAppendS("DBM,\n\t");
836 #else
837  StringAppendS("\n\t");
838 #endif
839 #ifdef HAVE_DYNAMIC_LOADING
840  StringAppendS("dynamic modules,");
841 #endif
842  if (p_procs_dynamic) StringAppendS("dynamic p_Procs,");
843 #if YYDEBUG
844  StringAppendS("YYDEBUG=1,");
845 #endif
846 #ifdef HAVE_ASSUME
847  StringAppendS("ASSUME,");
848 #endif
849 #ifdef MDEBUG
850  StringAppend("MDEBUG=%d,",MDEBUG);
851 #endif
852 #ifdef OM_CHECK
853  StringAppend("OM_CHECK=%d,",OM_CHECK);
854 #endif
855 #ifdef OM_TRACK
856  StringAppend("OM_TRACK=%d,",OM_TRACK);
857 #endif
858 #ifdef OM_NDEBUG
859  StringAppendS("OM_NDEBUG,");
860 #endif
861 #ifdef SING_NDEBUG
862  StringAppendS("SING_NDEBUG,");
863 #endif
864 #ifdef PDEBUG
865  StringAppendS("PDEBUG,");
866 #endif
867 #ifdef KDEBUG
868  StringAppendS("KDEBUG,");
869 #endif
870 #ifdef __OPTIMIZE__
871  StringAppendS("CC:OPTIMIZE,");
872 #endif
873 #ifdef __OPTIMIZE_SIZE__
874  StringAppendS("CC:OPTIMIZE_SIZE,");
875 #endif
876 #ifdef __NO_INLINE__
877  StringAppendS("CC:NO_INLINE,");
878 #endif
879 #ifdef HAVE_EIGENVAL
880  StringAppendS("eigenvalues,");
881 #endif
882 #ifdef HAVE_GMS
883  StringAppendS("Gauss-Manin system,");
884 #endif
885 #ifdef HAVE_RATGRING
886  StringAppendS("ratGB,");
887 #endif
888  StringAppend("random=%d\n",siRandomStart);
889 
890 #define SI_SHOW_BUILTIN_MODULE(name) StringAppend(" %s", #name);
891  StringAppendS("built-in modules: {");
893  StringAppendS("}\n");
894 #undef SI_SHOW_BUILTIN_MODULE
895 
896  StringAppend("AC_CONFIGURE_ARGS = %s,\n"
897  "CC = %s,FLAGS : %s,\n"
898  "CXX = %s,FLAGS : %s,\n"
899  "DEFS : %s,CPPFLAGS : %s,\n"
900  "LDFLAGS : %s,LIBS : %s "
901 #ifdef __GNUC__
902  "(ver: " __VERSION__ ")"
903 #endif
904  "\n",AC_CONFIGURE_ARGS, CC,CFLAGS, CXX,CXXFLAGS, DEFS,CPPFLAGS, LDFLAGS,LIBS);
907  StringAppendS("\n");
908  return StringEndS();
909 }
#define OM_CHECK
Definition: omalloc_debug.c:15
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:33
void feStringAppendResources(int warn)
Definition: reporter.cc:410
const BOOLEAN p_procs_dynamic
#define SINGULAR_VERSION
Definition: mod2.h:94
char * fe_fgets(const char *pr, char *s, int size)
Definition: feread.cc:310
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
char * fe_fgets_dummy(const char *, char *, int)
Definition: feread.cc:418
int siRandomStart
Definition: cntrlc.cc:103
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0)}
char * StringEndS()
Definition: reporter.cc:151
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:352
#define MDEBUG
Definition: mod2.h:196
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
Definition: feread.cc:254
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
#define version
Definition: libparse.cc:1260
#define OM_TRACK
Definition: omalloc_debug.c:10
#define VERSION
Definition: mod2.h:21
const char * singular_date
Definition: misc_ip.cc:1163
#define SI_SHOW_BUILTIN_MODULE(name)
const char factoryVersion[]
extern const char factoryVersion[];
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition: feread.cc:270

Variable Documentation

const char* currid

Definition at line 172 of file grammar.cc.

struct sValCmd1 dArith1[]

Definition at line 19 of file table.h.

struct sValCmd2 dArith2[]

Definition at line 278 of file table.h.

struct sValCmd3 dArith3[]

Definition at line 663 of file table.h.

struct sValCmdM dArithM[]

Definition at line 770 of file table.h.

leftv iiCurrArgs

Definition at line 84 of file ipshell.cc.

idhdl iiCurrProc

Definition at line 85 of file ipshell.cc.

ring* iiLocalRing

Definition at line 525 of file iplib.cc.

int iiOp

Definition at line 239 of file iparith.cc.

sleftv iiRETURNEXPR

Definition at line 527 of file iplib.cc.

int iiRETURNEXPR_len

Definition at line 528 of file iplib.cc.

const char* lastreserved

Definition at line 86 of file ipshell.cc.

int myynest

Definition at line 46 of file febase.cc.

int printlevel

Definition at line 42 of file febase.cc.

int si_echo

Definition at line 41 of file febase.cc.

const char* singular_date

Definition at line 1163 of file misc_ip.cc.

BOOLEAN yyInRingConstruction

Definition at line 173 of file grammar.cc.