My Project  UNKNOWN_GIT_VERSION
Macros | Functions | Variables
misc_ip.cc File Reference
#include "kernel/mod2.h"
#include "misc/sirandom.h"
#include "omalloc/omalloc.h"
#include "misc/mylimits.h"
#include "reporter/si_signals.h"
#include "factory/factory.h"
#include "coeffs/si_gmp.h"
#include "coeffs/coeffs.h"
#include "coeffs/OPAE.h"
#include "coeffs/OPAEQ.h"
#include "coeffs/OPAEp.h"
#include "coeffs/flintcf_Q.h"
#include "coeffs/flintcf_Zn.h"
#include "coeffs/rmodulon.h"
#include "polys/ext_fields/algext.h"
#include "polys/ext_fields/transext.h"
#include "polys/nc/gb_hack.h"
#include "Singular/links/simpleipc.h"
#include "misc_ip.h"
#include "ipid.h"
#include "feOpt.h"
#include "links/silink.h"
#include "mod_lib.h"
#include "Singular/distrib.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "polys/monomials/ring.h"
#include "polys/templates/p_Procs.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/oswrapper/timer.h"
#include "resources/feResource.h"
#include "kernel/oswrapper/feread.h"
#include "subexpr.h"
#include "cntrlc.h"
#include "ipshell.h"
#include "fehelp.h"
#include <NTL/version.h>
#include <NTL/tools.h>
#include <flint/flint.h>

Go to the source code of this file.

Macros

#define PLURAL_INTERNAL_DECLARATIONS   1
 
#define SI_SHOW_BUILTIN_MODULE(name)   StringAppend(" %s", #name);
 

Functions

static FORCE_INLINE void number2mpz (number n, mpz_t m)
 
static FORCE_INLINE number mpz2number (mpz_t m)
 
void setListEntry (lists L, int index, mpz_t n)
 
void setListEntry_ui (lists L, int index, unsigned long ui)
 
static int factor_using_division (mpz_t t, unsigned int limit, lists primes, int *multiplicities, int &index, unsigned long bound)
 
static void factor_using_pollard_rho (mpz_t n, unsigned long a, lists primes, int *multiplicities, int &index)
 
static void factor_gmp (mpz_t t, lists primes, int *multiplicities, int &index, unsigned long bound)
 
lists primeFactorisation (const number n, const int pBound)
 Factorises a given bigint number n into its prime factors less than or equal to a given bound, with corresponding multiplicities. More...
 
void singular_example (char *str)
 
BOOLEAN setOption (leftv res, leftv v)
 
char * showOption ()
 
char * versionString ()
 
int singular_fstat (int fd, struct stat *buf)
 
void m2_end (int i)
 
void omSingOutOfMemoryFunc ()
 
static BOOLEAN ii_FlintZn_init (leftv res, leftv a)
 
static BOOLEAN ii_FlintQ_init (leftv res, leftv a)
 
static BOOLEAN iiFloat (leftv res, leftv pnn)
 
static BOOLEAN iiCrossProd (leftv res, leftv args)
 
void siInit (char *name)
 

Variables

static unsigned add [] = {4, 2, 4, 2, 4, 6, 2, 6}
 
const struct soptionStruct optionStruct []
 
const struct soptionStruct verboseStruct []
 
const char * singular_date =__DATE__ " " __TIME__
 
volatile BOOLEAN m2_end_called = FALSE
 
static n_coeffType n_FlintZn =n_unknown
 
static n_coeffType n_FlintQ =n_unknown
 

Detailed Description

This file provides miscellaneous functionality.

For more general information, see the documentation in misc_ip.h.

Definition in file misc_ip.cc.

Macro Definition Documentation

◆ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS   1

Definition at line 15 of file misc_ip.cc.

◆ SI_SHOW_BUILTIN_MODULE

#define SI_SHOW_BUILTIN_MODULE (   name)    StringAppend(" %s", #name);

Function Documentation

◆ factor_gmp()

static void factor_gmp ( mpz_t  t,
lists  primes,
int *  multiplicities,
int &  index,
unsigned long  bound 
)
static

Definition at line 342 of file misc_ip.cc.

343 {
344  unsigned int division_limit;
345 
346  if (mpz_sgn (t) == 0)
347  return;
348 
349  /* Set the trial division limit according the size of t. */
350  division_limit = mpz_sizeinbase (t, 2);
351  if (division_limit > 1000)
352  division_limit = 1000 * 1000;
353  else
354  division_limit = division_limit * division_limit;
355 
356  if (factor_using_division (t, division_limit,primes,multiplicities,index,bound))
357  {
358  if (mpz_cmp_ui (t, 1) != 0)
359  {
360  if (mpz_probab_prime_p (t, 10))
361  {
363  multiplicities[index++] = 1;
364  mpz_set_ui(t,1);
365  }
366  else
367  factor_using_pollard_rho (t, 1L, primes,multiplicities,index);
368  }
369  }
370 }

◆ factor_using_division()

static int factor_using_division ( mpz_t  t,
unsigned int  limit,
lists  primes,
int *  multiplicities,
int &  index,
unsigned long  bound 
)
static

Definition at line 124 of file misc_ip.cc.

125 {
126  mpz_t q, r;
127  unsigned long int f;
128  int ai;
129  unsigned *addv = add;
130  unsigned int failures;
131  int bound_not_reached=1;
132 
133  mpz_init (q);
134  mpz_init (r);
135 
136  f = mpz_scan1 (t, 0);
137  mpz_div_2exp (t, t, f);
138  if (f>0)
139  {
141  multiplicities[index++] = f;
142  }
143 
144  f=0;
145  loop
146  {
147  mpz_tdiv_qr_ui (q, r, t, 3);
148  if (mpz_sgn1 (r) != 0)
149  break;
150  mpz_set (t, q);
151  f++;
152  }
153  if (f>0)
154  {
156  multiplicities[index++] = f;
157  }
158  f=0;
159  loop
160  {
161  mpz_tdiv_qr_ui (q, r, t, 5);
162  if (mpz_sgn1 (r) != 0)
163  break;
164  mpz_set (t, q);
165  f++;
166  }
167  if (f>0)
168  {
170  multiplicities[index++] = f;
171  }
172 
173  failures = 0;
174  f = 7;
175  ai = 0;
176  unsigned long last_f=0;
177  while (mpz_cmp_ui (t, 1) != 0)
178  {
179  mpz_tdiv_qr_ui (q, r, t, f);
180  if (mpz_sgn1 (r) != 0)
181  {
182  f += addv[ai];
183  if (mpz_cmp_ui (t, f) < 0)
184  break;
185  ai = (ai + 1) & 7;
186  failures++;
187  if (failures > limit)
188  break;
189  if ((bound!=0) && (f>bound))
190  {
191  bound_not_reached=0;
192  break;
193  }
194  }
195  else
196  {
197  mpz_swap (t, q);
198  if (f!=last_f)
199  {
201  multiplicities[index]++;
202  index++;
203  }
204  else
205  {
206  multiplicities[index-1]++;
207  }
208  last_f=f;
209  failures = 0;
210  }
211  }
212 
213  mpz_clear (q);
214  mpz_clear (r);
215  //printf("bound=%d,f=%d,failures=%d, reached=%d\n",bound,f,failures,bound_not_reached);
216  return bound_not_reached;
217 }

◆ factor_using_pollard_rho()

static void factor_using_pollard_rho ( mpz_t  n,
unsigned long  a,
lists  primes,
int *  multiplicities,
int &  index 
)
static

Definition at line 219 of file misc_ip.cc.

220 {
221  mpz_t x, x1, y, P;
222  mpz_t t1, t2;
223  mpz_t last_f;
224  unsigned long long k, l, i;
225 
226  mpz_init (t1);
227  mpz_init (t2);
228  mpz_init_set_ui (last_f, 0);
229  mpz_init_set_ui (y, 2);
230  mpz_init_set_ui (x, 2);
231  mpz_init_set_ui (x1, 2);
232  mpz_init_set_ui (P, 1);
233  k = 1;
234  l = 1;
235 
236  while (mpz_cmp_ui (n, 1) != 0)
237  {
238  loop
239  {
240  do
241  {
242  mpz_mul (t1, x, x);
243  mpz_mod (x, t1, n);
244  mpz_add_ui (x, x, a);
245  mpz_sub (t1, x1, x);
246  mpz_mul (t2, P, t1);
247  mpz_mod (P, t2, n);
248 
249  if (k % 32 == 1)
250  {
251  mpz_gcd (t1, P, n);
252  if (mpz_cmp_ui (t1, 1) != 0)
253  goto factor_found;
254  mpz_set (y, x);
255  }
256  }
257  while (--k != 0);
258 
259  mpz_gcd (t1, P, n);
260  if (mpz_cmp_ui (t1, 1) != 0)
261  goto factor_found;
262 
263  mpz_set (x1, x);
264  k = l;
265  l = 2 * l;
266  for (i = 0; i < k; i++)
267  {
268  mpz_mul (t1, x, x);
269  mpz_mod (x, t1, n);
270  mpz_add_ui (x, x, a);
271  }
272  mpz_set (y, x);
273  }
274 
275  factor_found:
276  do
277  {
278  mpz_mul (t1, y, y);
279  mpz_mod (y, t1, n);
280  mpz_add_ui (y, y, a);
281  mpz_sub (t1, x1, y);
282  mpz_gcd (t1, t1, n);
283  }
284  while (mpz_cmp_ui (t1, 1) == 0);
285 
286  mpz_divexact (n, n, t1); /* divide by t1, before t1 is overwritten */
287 
288  if (!mpz_probab_prime_p (t1, 10))
289  {
290  do
291  {
292  mp_limb_t a_limb;
293  mpn_random (&a_limb, (mp_size_t) 1);
294  a = a_limb;
295  }
296  while (a == 0);
297 
298  factor_using_pollard_rho (t1, a, primes,multiplicities,index);
299  }
300  else
301  {
302  if (mpz_cmp(t1,last_f)==0)
303  {
304  multiplicities[index-1]++;
305  }
306  else
307  {
308  mpz_set(last_f,t1);
309  setListEntry(primes, index, t1);
310  multiplicities[index++] = 1;
311  }
312  }
313  mpz_mod (x, x, n);
314  mpz_mod (x1, x1, n);
315  mpz_mod (y, y, n);
316  if (mpz_probab_prime_p (n, 10))
317  {
318  if (mpz_cmp(n,last_f)==0)
319  {
320  multiplicities[index-1]++;
321  }
322  else
323  {
324  mpz_set(last_f,n);
326  multiplicities[index++] = 1;
327  }
328  mpz_set_ui(n,1);
329  break;
330  }
331  }
332 
333  mpz_clear (P);
334  mpz_clear (t2);
335  mpz_clear (t1);
336  mpz_clear (x1);
337  mpz_clear (x);
338  mpz_clear (y);
339  mpz_clear (last_f);
340 }

◆ ii_FlintQ_init()

static BOOLEAN ii_FlintQ_init ( leftv  res,
leftv  a 
)
static

Definition at line 1243 of file misc_ip.cc.

1244 {
1245  const short t[]={1,STRING_CMD};
1246  if (iiCheckTypes(a,t,1))
1247  {
1248  char* p;
1249  p=(char*)a->Data();
1250  res->rtyp=CRING_CMD;
1251  res->data=(void*)nInitChar(n_FlintQ,(void*)p);
1252  return FALSE;
1253  }
1254  return TRUE;
1255 }

◆ ii_FlintZn_init()

static BOOLEAN ii_FlintZn_init ( leftv  res,
leftv  a 
)
static

Definition at line 1229 of file misc_ip.cc.

1230 {
1231  const short t[]={2,INT_CMD,STRING_CMD};
1232  if (iiCheckTypes(a,t,1))
1233  {
1234  flintZn_struct p;
1235  p.ch=(int)(long)a->Data();
1236  p.name=(char*)a->next->Data();
1237  res->rtyp=CRING_CMD;
1238  res->data=(void*)nInitChar(n_FlintZn,(void*)&p);
1239  return FALSE;
1240  }
1241  return TRUE;
1242 }

◆ iiCrossProd()

static BOOLEAN iiCrossProd ( leftv  res,
leftv  args 
)
static

Definition at line 1287 of file misc_ip.cc.

1288 {
1289  leftv h=args;
1290  coeffs *c=NULL;
1291  coeffs cf=NULL;
1292  int i=0;
1293  if (h==NULL) goto crossprod_error;
1294  while (h!=NULL)
1295  {
1296  if (h->Typ()!=CRING_CMD) goto crossprod_error;
1297  i++;
1298  h=h->next;
1299  }
1300  c=(coeffs*)omAlloc0((i+1)*sizeof(coeffs));
1301  h=args;
1302  i=0;
1303  while (h!=NULL)
1304  {
1305  c[i]=(coeffs)h->CopyD();
1306  i++;
1307  h=h->next;
1308  }
1309  cf=nInitChar(n_nTupel,c);
1310  res->data=cf;
1311  res->rtyp=CRING_CMD;
1312  return FALSE;
1313 
1314  crossprod_error:
1315  WerrorS("expected `crossprod(coeffs, ...)`");
1316  return TRUE;
1317 }

◆ iiFloat()

static BOOLEAN iiFloat ( leftv  res,
leftv  pnn 
)
static

Definition at line 1258 of file misc_ip.cc.

1259 {
1260  short float_len=3;
1261  short float_len2=SHORT_REAL_LENGTH;
1262  coeffs cf=NULL;
1263  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1264  {
1265  float_len=(int)(long)pnn->Data();
1266  float_len2=float_len;
1267  pnn=pnn->next;
1268  if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1269  {
1270  float_len2=(int)(long)pnn->Data();
1271  pnn=pnn->next;
1272  }
1273  }
1274  if (float_len2 <= (short)SHORT_REAL_LENGTH)
1275  cf=nInitChar(n_R, NULL);
1276  else // longR or longC?
1277  {
1278  LongComplexInfo param;
1279  param.float_len = si_min (float_len, 32767);
1280  param.float_len2 = si_min (float_len2, 32767);
1281  cf = nInitChar(n_long_R, (void*)&param);
1282  }
1283  res->rtyp=CRING_CMD;
1284  res->data=cf;
1285  return cf==NULL;
1286 }

◆ m2_end()

void m2_end ( int  i)

Definition at line 1101 of file misc_ip.cc.

1102 {
1103  if (!m2_end_called)
1104  {
1105  extern FILE* File_Profiling;
1107  m2_end_called = TRUE;
1108 #ifdef HAVE_SIMPLEIPC
1109  for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1110  {
1111  if (semaphore[j] != NULL)
1112  {
1113  while (sem_acquired[j] > 0)
1114  {
1115 #if PORTABLE_SEMAPHORES
1116  sem_post(semaphore[j]->sig);
1117 #else
1118  sem_post(semaphore[j]);
1119 #endif
1120  sem_acquired[j]--;
1121  }
1122  }
1123  }
1124 #endif // HAVE_SIMPLEIPC
1126  monitor(NULL,0);
1127 #ifdef PAGE_TEST
1128  mmEndStat();
1129 #endif
1132  {
1134  while(hh!=NULL)
1135  {
1136  //Print("close %s\n",hh->l->name);
1137  slPrepClose(hh->l);
1138  hh=(link_list)hh->next;
1139  }
1141 
1142  idhdl h = currPack->idroot;
1143  while(h != NULL)
1144  {
1145  if(IDTYP(h) == LINK_CMD)
1146  {
1147  idhdl hh=h->next;
1148  //Print("kill %s\n",IDID(h));
1149  killhdl(h, currPack);
1150  h = hh;
1151  }
1152  else
1153  {
1154  h = h->next;
1155  }
1156  }
1157  hh=ssiToBeClosed;
1158  while(hh!=NULL)
1159  {
1160  //Print("close %s\n",hh->l->name);
1161  slClose(hh->l);
1162  hh=ssiToBeClosed;
1163  }
1164  }
1165  if (!singular_in_batchmode)
1166  {
1167  if (i<=0)
1168  {
1169  //extern long all_farey;
1170  //extern long farey_cnt;
1171  //if (all_farey!=0L) printf("farey:%ld, cnt=%ld\n",all_farey,farey_cnt);
1172  if (TEST_V_QUIET)
1173  {
1174  if (i==0)
1175  printf("Auf Wiedersehen.\n");
1176  else
1177  printf("\n$Bye.\n");
1178  }
1179  //#ifdef sun
1180  // #ifndef __svr4__
1181  // _cleanup();
1182  // _exit(0);
1183  // #endif
1184  //#endif
1185  i=0;
1186  }
1187  else
1188  {
1189  printf("\nhalt %d\n",i);
1190  }
1191  }
1192  exit(i);
1193  }
1194 }

◆ mpz2number()

static FORCE_INLINE number mpz2number ( mpz_t  m)
static

Definition at line 86 of file misc_ip.cc.

86 { return mpz2number(m, coeffs_BIGINT); }

◆ number2mpz()

static FORCE_INLINE void number2mpz ( number  n,
mpz_t  m 
)
static

Definition at line 85 of file misc_ip.cc.

85 { number2mpz(n, coeffs_BIGINT, m); }

◆ omSingOutOfMemoryFunc()

void omSingOutOfMemoryFunc ( )

Definition at line 1199 of file misc_ip.cc.

1200  {
1201  fprintf(stderr, "\nSingular error: no more memory\n");
1202  omPrintStats(stderr);
1203  m2_end(14);
1204  /* should never get here */
1205  exit(1);
1206  }

◆ primeFactorisation()

lists primeFactorisation ( const number  n,
const int  pBound 
)

Factorises a given bigint number n into its prime factors less than or equal to a given bound, with corresponding multiplicities.

The method finds all prime factors with multiplicities. If a positive bound is given, then only the prime factors <= pBound are being found. In this case, there may remain an unfactored portion m of n. Also, when n is negative, m will contain the sign. If n is zero, m will be zero. The method returns a list L filled with three entries: L[1] a list; L[1][i] contains the i-th prime factor of |n| as int or bigint (sorted in ascending order), L[2] a list; L[2][i] contains the multiplicity of L[1, i] in |n| as int L[3] contains the remainder m as int or bigint, depending on the size,

We thus have: n = L[1][1]^L[2][1] * ... * L[1][k]^L[2][k] * L[3], where k is the number of mutually distinct prime factors (<= a provided non- zero bound). Note that for n = 0, L[1] and L[2] will be emtpy lists and L[3] will be zero.

Returns
the factorisation data in a SINGULAR-internal list

Definition at line 372 of file misc_ip.cc.

373 {
374  int i;
375  int index=0;
376  mpz_t nn; number2mpz(n, nn);
377  lists primes = (lists)omAllocBin(slists_bin); primes->Init(1000);
378  int* multiplicities = (int*)omAlloc0(1000*sizeof(int));
379  int positive=1;
380 
381  if (!n_IsZero(n, coeffs_BIGINT))
382  {
383  if (!n_GreaterZero(n, coeffs_BIGINT))
384  {
385  positive=-1;
386  mpz_neg(nn,nn);
387  }
388  factor_gmp(nn,primes,multiplicities,index,pBound);
389  }
390 
391  lists primesL = (lists)omAllocBin(slists_bin);
392  primesL->Init(index);
393  for (i = 0; i < index; i++)
394  {
395  primesL->m[i].rtyp = primes->m[i].rtyp;
396  primesL->m[i].data = primes->m[i].data;
397  primes->m[i].rtyp=0;
398  primes->m[i].data=NULL;
399  }
400  primes->Clean(NULL);
401 
402  lists multiplicitiesL = (lists)omAllocBin(slists_bin);
403  multiplicitiesL->Init(index);
404  for (i = 0; i < index; i++)
405  {
406  multiplicitiesL->m[i].rtyp = INT_CMD;
407  multiplicitiesL->m[i].data = (void*)(long)multiplicities[i];
408  }
409  omFree(multiplicities);
410 
412  L->Init(3);
413  if (positive==-1) mpz_neg(nn,nn);
414  L->m[0].rtyp = LIST_CMD; L->m[0].data = (void*)primesL;
415  L->m[1].rtyp = LIST_CMD; L->m[1].data = (void*)multiplicitiesL;
416  setListEntry(L, 2, nn);
417 
418  mpz_clear(nn);
419 
420  return L;
421 }

◆ setListEntry()

void setListEntry ( lists  L,
int  index,
mpz_t  n 
)

Definition at line 89 of file misc_ip.cc.

90 { /* assumes n > 0 */
91  /* try to fit nn into an int: */
92  if (mpz_size1(n)<=1)
93  {
94  int ui=(int)mpz_get_si(n);
95  if ((((ui<<3)>>3)==ui)
96  && (mpz_cmp_si(n,(long)ui)==0))
97  {
98  L->m[index].rtyp = INT_CMD; L->m[index].data = (void*)(long)ui;
99  return;
100  }
101  }
102  number nn = mpz2number(n);
103  L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
104 }

◆ setListEntry_ui()

void setListEntry_ui ( lists  L,
int  index,
unsigned long  ui 
)

Definition at line 106 of file misc_ip.cc.

107 { /* assumes n > 0 */
108  /* try to fit nn into an int: */
109  int i=(int)ui;
110  if ((((unsigned long)i)==ui) && (((i<<3)>>3)==i))
111  {
112  L->m[index].rtyp = INT_CMD; L->m[index].data = (void*)(long)i;
113  }
114  else
115  {
116  number nn = n_Init(ui, coeffs_BIGINT);
117  L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
118  }
119 }

◆ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 586 of file misc_ip.cc.

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

◆ showOption()

char* showOption ( )

Definition at line 728 of file misc_ip.cc.

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

◆ siInit()

void siInit ( char *  name)

Definition at line 1321 of file misc_ip.cc.

1322 {
1323 // memory initialization: -----------------------------------------------
1324  om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
1325 #ifndef OM_NDEBUG
1326 #ifndef __OPTIMIZE__
1327  om_Opts.ErrorHook = dErrorBreak;
1328 #else
1329  om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
1330 #endif
1331 #else
1332  om_Opts.Keep = 0; /* OM_NDEBUG */
1333 #endif
1334  omInitInfo();
1335 
1336 // options ---------------------------------------------------------------
1337  si_opt_1=0;
1338 // interpreter tables etc.: -----------------------------------------------
1339  memset(&sLastPrinted,0,sizeof(sleftv));
1341 
1342  extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
1343 
1344  basePack=(package)omAlloc0(sizeof(*basePack));
1346  idhdl h;
1347  h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
1348  IDPACKAGE(h)=basePack;
1349  IDPACKAGE(h)->language = LANG_TOP;
1350  currPackHdl=h;
1351  basePackHdl=h;
1352 
1353  coeffs_BIGINT = nInitChar(n_Q,(void*)1);
1354 
1355 #if 1
1356  // def HAVE_POLYEXTENSIONS
1357  if(TRUE)
1358  {
1359  n_coeffType type;
1360  #ifdef SINGULAR_4_2
1361  type = nRegister(n_polyExt, n2pInitChar);
1362  assume(type == n_polyExt);
1363  #endif
1364 
1365  type = nRegister(n_algExt, naInitChar);
1366  assume(type == n_algExt);
1367 
1368  type = nRegister(n_transExt, ntInitChar);
1369  assume(type == n_transExt);
1370 
1371  (void)type;
1372  }
1373 #endif
1374 
1375 // random generator: -----------------------------------------------
1376  int t=initTimer();
1377  if (t==0) t=1;
1378  initRTimer();
1379  siSeed=t;
1380  factoryseed(t);
1381  siRandomStart=t;
1382  feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
1383 
1384 // ressource table: ----------------------------------------------------
1385  // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
1386  // hack such that all shared' libs in the bindir are loaded correctly
1388 
1389 // singular links: --------------------------------------------------
1390  slStandardInit();
1391  myynest=0;
1392 // how many processes ? -----------------------------------------------------
1393  int cpus=2;
1394  int cpu_n;
1395  #ifdef _SC_NPROCESSORS_ONLN
1396  if ((cpu_n=sysconf(_SC_NPROCESSORS_ONLN))>cpus) cpus=cpu_n;
1397  #elif defined(_SC_NPROCESSORS_CONF)
1398  if ((cpu_n=sysconf(_SC_NPROCESSORS_CONF))>cpus) cpus=cpu_n;
1399  #endif
1400  feSetOptValue(FE_OPT_CPUS, cpus);
1401 // how many threads ? -----------------------------------------------------
1402  feSetOptValue(FE_OPT_THREADS, cpus);
1403 
1404 // default coeffs
1405  {
1406  idhdl h;
1407  h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1408  IDDATA(h)=(char*)nInitChar(n_Q,NULL);
1409  h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1410  IDDATA(h)=(char*)nInitChar(n_Z,NULL);
1411  nRegisterCfByName(nrnInitCfByName,n_Zn); // and n_Znm
1412  iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
1413  iiAddCproc("kernel","Float",FALSE,iiFloat);
1414  //h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1415  //IDDATA(h)=(char*)nInitChar(n_R,NULL);
1416  //h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1417  //IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
1418  n_coeffType t;
1419 #ifdef SINGULAR_4_2
1420  t=nRegister(n_unknown,n_AEInitChar);
1421  if (t!=n_unknown)
1422  {
1423  h=enterid("AE",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1424  IDDATA(h)=(char*)nInitChar(t,NULL);
1425  }
1426  t=nRegister(n_unknown,n_QAEInitChar);
1427  if (t!=n_unknown)
1428  {
1429  h=enterid("QAE",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1430  IDDATA(h)=(char*)nInitChar(t,NULL);
1431  }
1432  n_pAE=nRegister(n_unknown,n_pAEInitChar);
1433  if (n_pAE!=n_unknown)
1434  {
1435  iiAddCproc("kernel","pAE",FALSE,ii_pAE_init);
1436  }
1437 #endif
1438  #ifdef HAVE_FLINT
1440  if (n_FlintQ!=n_unknown)
1441  {
1442  iiAddCproc("kernel","flintQ",FALSE,ii_FlintQ_init);
1444  }
1446  if (n_FlintZn!=n_unknown)
1447  {
1448  iiAddCproc("kernel","flintZn",FALSE,ii_FlintZn_init);
1450  }
1451  #endif
1452  }
1453 // setting routines for PLURAL QRINGS:
1454 // allowing to use libpolys without libSingular(kStd)
1455 #ifdef HAVE_PLURAL
1456  nc_NF=k_NF;
1462 #endif
1463 // loading standard.lib -----------------------------------------------
1464  if (! feOptValue(FE_OPT_NO_STDLIB))
1465  {
1466  BITSET save1,save2;
1467  SI_SAVE_OPT(save1,save2);
1468  si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
1469  iiLibCmd(omStrDup("standard.lib"), TRUE,TRUE,TRUE);
1470  SI_RESTORE_OPT(save1,save2);
1471  }
1472  errorreported = 0;
1473 }

◆ singular_example()

void singular_example ( char *  str)

Definition at line 449 of file misc_ip.cc.

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

◆ singular_fstat()

int singular_fstat ( int  fd,
struct stat *  buf 
)

Definition at line 1086 of file misc_ip.cc.

1087 {
1088  return si_fstat(fd,buf);
1089 }

◆ versionString()

char* versionString ( )

Definition at line 789 of file misc_ip.cc.

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

Variable Documentation

◆ add

unsigned add[] = {4, 2, 4, 2, 4, 6, 2, 6}
static

Definition at line 122 of file misc_ip.cc.

◆ m2_end_called

volatile BOOLEAN m2_end_called = FALSE

Definition at line 1099 of file misc_ip.cc.

◆ n_FlintQ

n_coeffType n_FlintQ =n_unknown
static

Definition at line 1228 of file misc_ip.cc.

◆ n_FlintZn

n_coeffType n_FlintZn =n_unknown
static

Definition at line 1227 of file misc_ip.cc.

◆ optionStruct

const struct soptionStruct optionStruct[]
Initial value:
=
{
{"prot", Sy_bit(OPT_PROT), ~Sy_bit(OPT_PROT) },
{"redSB", Sy_bit(OPT_REDSB), ~Sy_bit(OPT_REDSB) },
{"teach", Sy_bit(OPT_DEBUG), ~Sy_bit(OPT_DEBUG) },
{"fastHC", Sy_bit(OPT_FASTHC), ~Sy_bit(OPT_FASTHC) },
{"degBound", Sy_bit(OPT_DEGBOUND), ~Sy_bit(OPT_DEGBOUND) },
{"redTail", Sy_bit(OPT_REDTAIL), ~Sy_bit(OPT_REDTAIL) },
{"weightM", Sy_bit(OPT_WEIGHTM), ~Sy_bit(OPT_WEIGHTM) },
{"ne", 0, 0 }
}

Definition at line 449 of file misc_ip.cc.

◆ singular_date

const char* singular_date =__DATE__ " " __TIME__

Definition at line 786 of file misc_ip.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]
Initial value:
=
{
{"yacc", Sy_bit(V_YACC), ~Sy_bit(V_YACC) },
{"redefine", Sy_bit(V_REDEFINE), ~Sy_bit(V_REDEFINE) },
{"reading", Sy_bit(V_READING), ~Sy_bit(V_READING) },
{"loadLib", Sy_bit(V_LOAD_LIB), ~Sy_bit(V_LOAD_LIB) },
{"debugLib", Sy_bit(V_DEBUG_LIB), ~Sy_bit(V_DEBUG_LIB) },
{"loadProc", Sy_bit(V_LOAD_PROC), ~Sy_bit(V_LOAD_PROC) },
{"defRes", Sy_bit(V_DEF_RES), ~Sy_bit(V_DEF_RES) },
{"Imap", Sy_bit(V_IMAP), ~Sy_bit(V_IMAP) },
{"prompt", Sy_bit(V_PROMPT), ~Sy_bit(V_PROMPT) },
{"length", Sy_bit(V_LENGTH), ~Sy_bit(V_LENGTH) },
{"notWarnSB",Sy_bit(V_NSB), ~Sy_bit(V_NSB) },
{"contentSB",Sy_bit(V_CONTENTSB), ~Sy_bit(V_CONTENTSB) },
{"findMonomials",Sy_bit(V_FINDMONOM),~Sy_bit(V_FINDMONOM)},
{"coefStrat",Sy_bit(V_COEFSTRAT), ~Sy_bit(V_COEFSTRAT)},
{"qringNF", Sy_bit(V_QRING), ~Sy_bit(V_QRING)},
{"ne", 0, 0 }
}

Definition at line 449 of file misc_ip.cc.

test
CanonicalForm test
Definition: cfModGcd.cc:4037
si_min
static int si_min(const int a, const int b)
Definition: auxiliary.h:139
SEEK_END
#define SEEK_END
Definition: mod2.h:112
FALSE
#define FALSE
Definition: auxiliary.h:94
fe_fgets_dummy
char * fe_fgets_dummy(const char *, char *, int)
Definition: feread.cc:451
LongComplexInfo::float_len2
short float_len2
additional char-flags, rInit
Definition: coeffs.h:102
feInitResources
void feInitResources(const char *argv0)
Definition: feResource.cc:170
n_Zn
@ n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:45
sleftv::Data
void * Data()
Definition: subexpr.cc:1182
p_procs_dynamic
const BOOLEAN p_procs_dynamic
Definition: p_Procs_Dynamic.cc:30
nrnInitCfByName
coeffs nrnInitCfByName(char *s, n_coeffType n)
Definition: rmodulon.cc:58
number2mpz
static FORCE_INLINE void number2mpz(number n, mpz_t m)
Definition: misc_ip.cc:85
iiGetLibName
static char * iiGetLibName(const procinfov pi)
find the library of an proc
Definition: ipshell.h:66
si_echo
int si_echo
Definition: febase.cc:35
OPT_REDSB
#define OPT_REDSB
Definition: options.h:75
OPT_INFREDTAIL
#define OPT_INFREDTAIL
Definition: options.h:93
SEEK_SET
#define SEEK_SET
Definition: mod2.h:116
MDEBUG
#define MDEBUG
Definition: mod2.h:181
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:107
V_LENGTH
#define V_LENGTH
Definition: options.h:63
FACTORYVERSION
#define FACTORYVERSION
Definition: factoryconf.h:52
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
feFopen
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition: feFopen.cc:47
omFree
#define omFree(addr)
Definition: omAllocDecl.h:261
errorreported
short errorreported
Definition: feFopen.cc:23
k
int k
Definition: cfEzgcd.cc:92
CRING_CMD
@ CRING_CMD
Definition: tok.h:56
iiEStart
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:699
LongComplexInfo
Definition: coeffs.h:100
semaphore
sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:24
V_COEFSTRAT
#define V_COEFSTRAT
Definition: options.h:61
x
Variable x
Definition: cfModGcd.cc:4023
SI_FOREACH_BUILTIN
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0) }
dErrorBreak
void dErrorBreak()
Definition: dError.cc:141
iiInitArithmetic
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition: iparith.cc:9075
y
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
nRegisterCfByName
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition: numbers.cc:580
VERSION
#define VERSION
Definition: mod2.h:18
LANG_TOP
@ LANG_TOP
Definition: subexpr.h:24
V_DEF_RES
#define V_DEF_RES
Definition: options.h:50
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:58
n_FlintQ
static n_coeffType n_FlintQ
Definition: misc_ip.cc:1228
BIGINT_CMD
@ BIGINT_CMD
Definition: tok.h:38
LIST_CMD
@ LIST_CMD
Definition: tok.h:118
naInitChar
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: algext.cc:1399
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
V_FINDMONOM
#define V_FINDMONOM
Definition: options.h:60
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:267
mpz_sgn1
#define mpz_sgn1(A)
Definition: si_gmp.h:13
STRING_CMD
@ STRING_CMD
Definition: tok.h:183
OPT_OLDSTD
#define OPT_OLDSTD
Definition: options.h:85
BITSET
#define BITSET
Definition: structs.h:18
NONE
#define NONE
Definition: tok.h:219
m2_end_called
volatile BOOLEAN m2_end_called
Definition: misc_ip.cc:1099
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
IDDATA
#define IDDATA(a)
Definition: ipid.h:121
primes
static unsigned short primes[]
primes, primes_len: used to step through possible extensions
Definition: gengftables-conway.cc:59
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
optionStruct
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:526
setListEntry
void setListEntry(lists L, int index, mpz_t n)
Definition: misc_ip.cc:89
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
basePackHdl
idhdl basePackHdl
Definition: ipid.cc:58
gnc_gr_bba
BBA_Proc gnc_gr_bba
Definition: old.gring.cc:67
feSetOptValue
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:150
n_nTupel
@ n_nTupel
n-tupel of cf: ZZ/p1,...
Definition: coeffs.h:43
OPT_MULTBOUND
#define OPT_MULTBOUND
Definition: options.h:88
OPT_NO_SYZ_MINIM
#define OPT_NO_SYZ_MINIM
Definition: options.h:82
V_LOAD_LIB
#define V_LOAD_LIB
Definition: options.h:47
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:350
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
n_Q
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:31
feStringAppendBrowsers
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:344
currPack
package currPack
Definition: ipid.cc:59
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:464
File_Profiling
FILE * File_Profiling
Definition: fevoices.cc:33
Variable::next
Variable next() const
Definition: factory.h:137
fe_fgets_stdin
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition: feread.cc:34
StringEndS
char * StringEndS()
Definition: reporter.cc:151
siRandomStart
int siRandomStart
Definition: cntrlc.cc:98
loop
#define loop
Definition: structs.h:78
gnc_gr_mora
BBA_Proc gnc_gr_mora
Definition: gb_hack.h:10
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
omInitInfo
void omInitInfo()
Definition: omStats.c:17
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
slists_bin
omBin slists_bin
Definition: lists.cc:23
factor_using_division
static int factor_using_division(mpz_t t, unsigned int limit, lists primes, int *multiplicities, int &index, unsigned long bound)
Definition: misc_ip.cc:124
feStringAppendResources
void feStringAppendResources(int warn)
Definition: reporter.cc:398
n_long_R
@ n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:34
flintQ_InitChar
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Q.cc:563
factoryseed
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
singular_in_batchmode
BOOLEAN singular_in_batchmode
Definition: cntrlc.cc:67
n_coeffType
n_coeffType
Definition: coeffs.h:28
fe_fgets
char * fe_fgets(const char *pr, char *s, int size)
Definition: feread.cc:310
iiAddCproc
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1005
V_DEBUG_LIB
#define V_DEBUG_LIB
Definition: options.h:48
iiCrossProd
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition: misc_ip.cc:1287
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
nRegister
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition: numbers.cc:539
k_sca_gr_bba
ideal k_sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified Plural's Buchberger's algorithmus.
Definition: sca.cc:95
n_FlintZn
static n_coeffType n_FlintZn
Definition: misc_ip.cc:1227
initTimer
int initTimer()
Definition: timer.cc:69
V_SHOW_USE
#define V_SHOW_USE
Definition: options.h:52
V_SHOW_MEM
#define V_SHOW_MEM
Definition: options.h:43
iiFloat
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition: misc_ip.cc:1258
n_polyExt
@ n_polyExt
used to represent polys as coeffcients
Definition: coeffs.h:35
TRUE
#define TRUE
Definition: auxiliary.h:98
V_INTERSECT_ELIM
#define V_INTERSECT_ELIM
Definition: options.h:67
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
i
int i
Definition: cfEzgcd.cc:125
factor_using_pollard_rho
static void factor_using_pollard_rho(mpz_t n, unsigned long a, lists primes, int *multiplicities, int &index)
Definition: misc_ip.cc:219
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
@ INT_CMD
Definition: tok.h:96
m2_end
void m2_end(int i)
Definition: misc_ip.cc:1101
add
static unsigned add[]
Definition: misc_ip.cc:122
OPT_NOT_BUCKETS
#define OPT_NOT_BUCKETS
Definition: options.h:76
Sy_bit
#define Sy_bit(x)
Definition: options.h:32
buf
int status int void * buf
Definition: si_signals.h:59
factor_gmp
static void factor_gmp(mpz_t t, lists primes, int *multiplicities, int &index, unsigned long bound)
Definition: misc_ip.cc:342
monitor
void monitor(void *F, int mode)
Definition: febase.cc:67
omSingOutOfMemoryFunc
void omSingOutOfMemoryFunc()
Definition: misc_ip.cc:1199
V_QRING
#define V_QRING
Definition: options.h:42
setListEntry_ui
void setListEntry_ui(lists L, int index, unsigned long ui)
Definition: misc_ip.cc:106
SI_SHOW_BUILTIN_MODULE
#define SI_SHOW_BUILTIN_MODULE(name)
soptionStruct::resetval
unsigned resetval
Definition: ipid.h:149
PROC_CMD
@ PROC_CMD
Definition: grammar.cc:280
flintZn_struct
Definition: flintcf_Zn.h:17
k_NF
poly k_NF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
NOTE: this is just a wrapper which sets currRing for the actual kNF call.
Definition: kstd1.cc:3015
k_sca_bba
ideal k_sca_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Buchberger's algorithm.
Definition: sca.cc:368
iiGetLibProcBuffer
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition: iplib.cc:192
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
omPrintStats
void omPrintStats(FILE *fd)
Definition: omStats.c:115
IDROOT
#define IDROOT
Definition: ipid.h:18
h
static Poly * h
Definition: janet.cc:972
ii_FlintZn_init
static BOOLEAN ii_FlintZn_init(leftv res, leftv a)
Definition: misc_ip.cc:1229
V_CONTENTSB
#define V_CONTENTSB
Definition: options.h:56
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition: options.h:24
coeffs
OPT_REDTAIL
#define OPT_REDTAIL
Definition: options.h:90
V_UPTORADICAL
#define V_UPTORADICAL
Definition: options.h:59
IDPROC
#define IDPROC(a)
Definition: ipid.h:135
intvec
Definition: intvec.h:21
n_Z
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
sleftv::data
void * data
Definition: subexpr.h:88
soptionStruct::setval
unsigned setval
Definition: ipid.h:148
singular_date
const char * singular_date
Definition: misc_ip.cc:786
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:210
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
killhdl
void killhdl(idhdl h, package proot)
Definition: ipid.cc:386
flintZn_InitChar
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Zn.cc:488
SINGULAR_VERSION
#define SINGULAR_VERSION
Definition: mod2.h:88
LongComplexInfo::float_len
short float_len
additional char-flags, rInit
Definition: coeffs.h:101
myynest
int myynest
Definition: febase.cc:41
IDTYP
#define IDTYP(a)
Definition: ipid.h:114
slists::m
sleftv * m
Definition: lists.h:45
V_READING
#define V_READING
Definition: options.h:46
flintQInitCfByName
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Q.cc:535
OPT_NOT_SUGAR
#define OPT_NOT_SUGAR
Definition: options.h:77
OPT_DEBUG
#define OPT_DEBUG
Definition: options.h:80
V_ALLWARN
#define V_ALLWARN
Definition: options.h:66
OPT_INTSTRATEGY
#define OPT_INTSTRATEGY
Definition: options.h:91
n_transExt
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
V_LOAD_PROC
#define V_LOAD_PROC
Definition: options.h:49
ntInitChar
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2516
OPT_STAIRCASEBOUND
#define OPT_STAIRCASEBOUND
Definition: options.h:87
n_R
@ n_R
single prescision (6,6) real numbers
Definition: coeffs.h:32
slists
Definition: lists.h:23
feOptSpec
struct fe_option feOptSpec[]
fe_fgets_stdin_drl
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition: feread.cc:270
INTVEC_CMD
@ INTVEC_CMD
Definition: tok.h:101
V_PROMPT
#define V_PROMPT
Definition: options.h:54
coeffs_BIGINT
coeffs coeffs_BIGINT
Definition: ipid.cc:52
idrec
Definition: idrec.h:35
feResource
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:258
V_NSB
#define V_NSB
Definition: options.h:55
sca_bba
BBA_Proc sca_bba
Definition: gb_hack.h:10
OPT_WEIGHTM
#define OPT_WEIGHTM
Definition: options.h:96
IDPACKAGE
#define IDPACKAGE(a)
Definition: ipid.h:134
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:128
sca_gr_bba
BBA_Proc sca_gr_bba
Definition: gb_hack.h:10
nc_NF
NF_Proc nc_NF
Definition: old.gring.cc:66
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
OM_TRACK
#define OM_TRACK
Definition: omalloc_debug.c:10
BVERBOSE
#define BVERBOSE(a)
Definition: options.h:35
Print
#define Print
Definition: emacs.cc:80
OPT_SUGARCRIT
#define OPT_SUGARCRIT
Definition: options.h:79
mpz_size1
#define mpz_size1(A)
Definition: si_gmp.h:12
om_Opts
omOpts_t om_Opts
Definition: omOpts.c:11
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:189
fe_fgets_stdin_emu
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
Definition: feread.cc:254
k_sca_mora
ideal k_sca_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Mora's algorithm.
Definition: sca.cc:885
PACKAGE_CMD
@ PACKAGE_CMD
Definition: tok.h:149
SIPC_MAX_SEMAPHORES
#define SIPC_MAX_SEMAPHORES
Definition: simpleipc.h:10
n_GreaterZero
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition: coeffs.h:494
name
char name(const Variable &v)
Definition: factory.h:180
V_INTERSECT_SYZ
#define V_INTERSECT_SYZ
Definition: options.h:68
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
V_YACC
#define V_YACC
Definition: options.h:44
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
sleftv::Typ
int Typ()
Definition: subexpr.cc:1039
m
int m
Definition: cfEzgcd.cc:121
k_gnc_gr_mora
ideal k_gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1291
V_ASSIGN_NONE
#define V_ASSIGN_NONE
Definition: options.h:69
WarnS
#define WarnS
Definition: emacs.cc:78
Variable::name
char name() const
Definition: variable.cc:122
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
basePack
package basePack
Definition: ipid.cc:60
assume
#define assume(x)
Definition: mod2.h:390
OPT_REDTHROUGH
#define OPT_REDTHROUGH
Definition: options.h:81
sLastPrinted
sleftv sLastPrinted
Definition: subexpr.cc:52
NULL
#define NULL
Definition: omList.c:10
lists
slists * lists
Definition: mpr_numeric.h:146
siSeed
int siSeed
Definition: sirandom.c:29
MAXPATHLEN
#define MAXPATHLEN
Definition: omRet2Info.c:22
fe_option::value
void * value
Definition: fegetopt.h:93
ii_FlintQ_init
static BOOLEAN ii_FlintQ_init(leftv res, leftv a)
Definition: misc_ip.cc:1243
currPackHdl
idhdl currPackHdl
Definition: ipid.cc:57
l
int l
Definition: cfEzgcd.cc:93
OM_CHECK
#define OM_CHECK
Definition: omalloc_debug.c:15
OPT_DEGBOUND
#define OPT_DEGBOUND
Definition: options.h:89
validOpts
BITSET validOpts
Definition: kstd1.cc:59
k_gnc_gr_bba
ideal k_gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1032
StringAppend
#define StringAppend
Definition: emacs.cc:79
V_CANCELUNIT
#define V_CANCELUNIT
Definition: options.h:57
initRTimer
void initRTimer()
Definition: timer.cc:158
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
sca_mora
BBA_Proc sca_mora
Definition: gb_hack.h:10
slists::Init
INLINE_THIS void Init(int l=0)
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition: options.h:21
p
int p
Definition: cfModGcd.cc:4019
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
iiCheckTypes
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition: ipshell.cc:6546
feOptValue
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
fd
int status int fd
Definition: si_signals.h:59
TEST_RINGDEP_OPTS
#define TEST_RINGDEP_OPTS
Definition: options.h:99
OPT_FASTHC
#define OPT_FASTHC
Definition: options.h:84
V_REDEFINE
#define V_REDEFINE
Definition: options.h:45
iiLibCmd
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:826
V_IMAP
#define V_IMAP
Definition: options.h:53
V_MODPSOLVSB
#define V_MODPSOLVSB
Definition: options.h:58
n_unknown
@ n_unknown
Definition: coeffs.h:29
OPT_RETURN_SB
#define OPT_RETURN_SB
Definition: options.h:83
fe_reset_input_mode
void fe_reset_input_mode()
Definition: fereadl.c:825
mpz2number
static FORCE_INLINE number mpz2number(mpz_t m)
Definition: misc_ip.cc:86
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
n2pInitChar
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition: algext.cc:1683
LINK_CMD
@ LINK_CMD
Definition: tok.h:117
yydebug
int yydebug
Definition: grammar.cc:1805
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
OPT_INTERRUPT
#define OPT_INTERRUPT
Definition: options.h:78
TEST_V_QUIET
#define TEST_V_QUIET
Definition: options.h:131
package
ip_package * package
Definition: structs.h:46
sem_acquired
int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:25
sleftv::next
leftv next
Definition: subexpr.h:86
flintZnInitCfByName
coeffs flintZnInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Zn.cc:434
si_opt_2
unsigned si_opt_2
Definition: options.c:6
OPT_NOTREGULARITY
#define OPT_NOTREGULARITY
Definition: options.h:95
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
OPT_PROT
#define OPT_PROT
Definition: options.h:74
verboseStruct
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:556
si_opt_1
unsigned si_opt_1
Definition: options.c:5