My Project  debian-1:4.1.2-p1+ds-2
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_VAR unsigned add [] = {4, 2, 4, 2, 4, 6, 2, 6}
 
const struct soptionStruct optionStruct []
 
const struct soptionStruct verboseStruct []
 
volatile BOOLEAN m2_end_called = FALSE
 
STATIC_VAR n_coeffType n_FlintZn =n_unknown
 
STATIC_VAR 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 14 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 337 of file misc_ip.cc.

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

◆ 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 119 of file misc_ip.cc.

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

◆ 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 214 of file misc_ip.cc.

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

◆ ii_FlintQ_init()

static BOOLEAN ii_FlintQ_init ( leftv  res,
leftv  a 
)
static

Definition at line 1238 of file misc_ip.cc.

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

◆ ii_FlintZn_init()

static BOOLEAN ii_FlintZn_init ( leftv  res,
leftv  a 
)
static

Definition at line 1224 of file misc_ip.cc.

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

◆ iiCrossProd()

static BOOLEAN iiCrossProd ( leftv  res,
leftv  args 
)
static

Definition at line 1282 of file misc_ip.cc.

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

◆ iiFloat()

static BOOLEAN iiFloat ( leftv  res,
leftv  pnn 
)
static

Definition at line 1253 of file misc_ip.cc.

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

◆ m2_end()

void m2_end ( int  i)

Definition at line 1096 of file misc_ip.cc.

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

◆ mpz2number()

static FORCE_INLINE number mpz2number ( mpz_t  m)
static

Definition at line 81 of file misc_ip.cc.

81 { return mpz2number(m, coeffs_BIGINT); }

◆ number2mpz()

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

Definition at line 80 of file misc_ip.cc.

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

◆ omSingOutOfMemoryFunc()

void omSingOutOfMemoryFunc ( )

Definition at line 1194 of file misc_ip.cc.

1195  {
1196  fprintf(stderr, "\nSingular error: no more memory\n");
1197  omPrintStats(stderr);
1198  m2_end(14);
1199  /* should never get here */
1200  exit(1);
1201  }

◆ 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
Parameters
[in]nthe bigint > 0 to be factorised
[in]pBoundbound on the prime factors seeked

Definition at line 367 of file misc_ip.cc.

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

◆ setListEntry()

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

Definition at line 84 of file misc_ip.cc.

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

◆ setListEntry_ui()

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

Definition at line 101 of file misc_ip.cc.

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

◆ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 581 of file misc_ip.cc.

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

◆ showOption()

char* showOption ( )

Definition at line 723 of file misc_ip.cc.

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

◆ siInit()

void siInit ( char *  name)

Definition at line 1316 of file misc_ip.cc.

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

◆ singular_example()

void singular_example ( char *  str)

Definition at line 444 of file misc_ip.cc.

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

◆ singular_fstat()

int singular_fstat ( int  fd,
struct stat *  buf 
)

Definition at line 1081 of file misc_ip.cc.

1082 {
1083  return si_fstat(fd,buf);
1084 }

◆ versionString()

char* versionString ( )

Definition at line 784 of file misc_ip.cc.

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

Variable Documentation

◆ add

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

Definition at line 117 of file misc_ip.cc.

◆ m2_end_called

volatile BOOLEAN m2_end_called = FALSE

Definition at line 1094 of file misc_ip.cc.

◆ n_FlintQ

Definition at line 1223 of file misc_ip.cc.

◆ n_FlintZn

Definition at line 1222 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 521 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 551 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:141
SEEK_END
#define SEEK_END
Definition: mod2.h:108
FALSE
#define FALSE
Definition: auxiliary.h:96
sca_gr_bba
EXTERN_VAR BBA_Proc sca_gr_bba
Definition: gb_hack.h:10
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:101
feInitResources
void feInitResources(const char *argv0)
Definition: feResource.cc:167
n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
sleftv::Data
void * Data()
Definition: subexpr.cc:1175
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:56
number2mpz
static FORCE_INLINE void number2mpz(number n, mpz_t m)
Definition: misc_ip.cc:80
iiGetLibName
static char * iiGetLibName(const procinfov pi)
find the library of an proc
Definition: ipshell.h:65
OPT_REDSB
#define OPT_REDSB
Definition: options.h:73
OPT_INFREDTAIL
#define OPT_INFREDTAIL
Definition: options.h:91
SEEK_SET
#define SEEK_SET
Definition: mod2.h:112
MDEBUG
#define MDEBUG
Definition: mod2.h:176
StringAppendS
void StringAppendS(const char *st)
Definition: reporter.cc:106
V_LENGTH
#define V_LENGTH
Definition: options.h:61
FACTORYVERSION
#define FACTORYVERSION
Definition: factoryconf.h:53
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:46
omFree
#define omFree(addr)
Definition: omAllocDecl.h:259
omInitInfo
#define omInitInfo()
Definition: xalloc.h:266
k
int k
Definition: cfEzgcd.cc:92
CRING_CMD
Definition: tok.h:55
iiEStart
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition: iplib.cc:699
LongComplexInfo
Definition: coeffs.h:98
V_COEFSTRAT
#define V_COEFSTRAT
Definition: options.h:59
x
Variable x
Definition: cfModGcd.cc:4023
SI_FOREACH_BUILTIN
SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT0) }
dErrorBreak
void dErrorBreak()
Definition: dError.cc:137
iiInitArithmetic
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition: iparith.cc:9222
y
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
nRegisterCfByName
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition: numbers.cc:579
VERSION
#define VERSION
Definition: mod2.h:17
LANG_TOP
Definition: subexpr.h:22
V_DEF_RES
#define V_DEF_RES
Definition: options.h:48
SHORT_REAL_LENGTH
#define SHORT_REAL_LENGTH
Definition: numbers.h:56
version
#define version
Definition: libparse.cc:1261
BIGINT_CMD
Definition: tok.h:37
LIST_CMD
Definition: tok.h:117
semaphore
VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:24
singular_in_batchmode
VAR BOOLEAN singular_in_batchmode
Definition: cntrlc.cc:65
naInitChar
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: algext.cc:1397
ADDRESS
void * ADDRESS
Definition: auxiliary.h:135
V_FINDMONOM
#define V_FINDMONOM
Definition: options.h:58
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:264
mpz_sgn1
#define mpz_sgn1(A)
Definition: si_gmp.h:13
si_opt_1
VAR unsigned si_opt_1
Definition: options.c:5
STRING_CMD
Definition: tok.h:183
h
STATIC_VAR Poly * h
Definition: janet.cc:971
OPT_OLDSTD
#define OPT_OLDSTD
Definition: options.h:83
sca_mora
EXTERN_VAR BBA_Proc sca_mora
Definition: gb_hack.h:10
BITSET
#define BITSET
Definition: structs.h:19
NONE
#define NONE
Definition: tok.h:219
m2_end_called
volatile BOOLEAN m2_end_called
Definition: misc_ip.cc:1094
cf
CanonicalForm cf
Definition: cfModGcd.cc:4024
IDDATA
#define IDDATA(a)
Definition: ipid.h:120
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
MAKE_DISTRIBUTION
#define MAKE_DISTRIBUTION
Definition: distrib.h:1
optionStruct
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:521
setListEntry
void setListEntry(lists L, int index, mpz_t n)
Definition: misc_ip.cc:84
gnc_gr_mora
EXTERN_VAR BBA_Proc gnc_gr_mora
Definition: gb_hack.h:10
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:261
feSetOptValue
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:150
n_nTupel
n-tupel of cf: ZZ/p1,...
Definition: coeffs.h:42
OPT_MULTBOUND
#define OPT_MULTBOUND
Definition: options.h:86
OPT_NO_SYZ_MINIM
#define OPT_NO_SYZ_MINIM
Definition: options.h:80
V_LOAD_LIB
#define V_LOAD_LIB
Definition: options.h:45
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:349
omAllocBin
#define omAllocBin(bin)
Definition: omAllocDecl.h:203
n_Q
rational (GMP) numbers
Definition: coeffs.h:30
feStringAppendBrowsers
void feStringAppendBrowsers(int warn)
Definition: fehelp.cc:336
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:463
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:150
loop
#define loop
Definition: structs.h:79
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:81
siRandomStart
VAR int siRandomStart
Definition: cntrlc.cc:96
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
File_Profiling
VAR FILE * File_Profiling
Definition: fevoices.cc:31
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:119
currPack
VAR package currPack
Definition: ipid.cc:56
feStringAppendResources
void feStringAppendResources(int warn)
Definition: reporter.cc:397
n_long_R
real floating point (GMP) numbers
Definition: coeffs.h:33
flintQ_InitChar
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Q.cc:561
factoryseed
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
basePackHdl
VAR idhdl basePackHdl
Definition: ipid.cc:55
n_coeffType
n_coeffType
Definition: coeffs.h:26
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:46
iiCrossProd
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition: misc_ip.cc:1282
nRegister
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition: numbers.cc:538
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
initTimer
int initTimer()
Definition: timer.cc:66
V_SHOW_USE
#define V_SHOW_USE
Definition: options.h:50
V_SHOW_MEM
#define V_SHOW_MEM
Definition: options.h:41
iiFloat
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition: misc_ip.cc:1253
currPackHdl
VAR idhdl currPackHdl
Definition: ipid.cc:54
n_polyExt
used to represent polys as coeffcients
Definition: coeffs.h:34
TRUE
#define TRUE
Definition: auxiliary.h:100
V_INTERSECT_ELIM
#define V_INTERSECT_ELIM
Definition: options.h:65
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition: options.h:107
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:214
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
Definition: tok.h:95
m2_end
void m2_end(int i)
Definition: misc_ip.cc:1096
OPT_NOT_BUCKETS
#define OPT_NOT_BUCKETS
Definition: options.h:74
omPrintStats
#define omPrintStats(F)
Definition: xalloc.h:269
Sy_bit
#define Sy_bit(x)
Definition: options.h:30
buf
int status int void * buf
Definition: si_signals.h:58
factor_gmp
static void factor_gmp(mpz_t t, lists primes, int *multiplicities, int &index, unsigned long bound)
Definition: misc_ip.cc:337
monitor
void monitor(void *F, int mode)
Definition: febase.cc:66
n_FlintZn
STATIC_VAR n_coeffType n_FlintZn
Definition: misc_ip.cc:1222
omSingOutOfMemoryFunc
void omSingOutOfMemoryFunc()
Definition: misc_ip.cc:1194
V_QRING
#define V_QRING
Definition: options.h:40
setListEntry_ui
void setListEntry_ui(lists L, int index, unsigned long ui)
Definition: misc_ip.cc:101
SI_SHOW_BUILTIN_MODULE
#define SI_SHOW_BUILTIN_MODULE(name)
soptionStruct::resetval
unsigned resetval
Definition: ipid.h:148
PROC_CMD
Definition: grammar.cc:280
siSeed
VAR int siSeed
Definition: sirandom.c:30
flintZn_struct
Definition: flintcf_Zn.h:15
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:3034
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:478
IDROOT
#define IDROOT
Definition: ipid.h:17
ii_FlintZn_init
static BOOLEAN ii_FlintZn_init(leftv res, leftv a)
Definition: misc_ip.cc:1224
V_CONTENTSB
#define V_CONTENTSB
Definition: options.h:54
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition: options.h:22
coeffs
OPT_REDTAIL
#define OPT_REDTAIL
Definition: options.h:88
V_UPTORADICAL
#define V_UPTORADICAL
Definition: options.h:57
IDPROC
#define IDPROC(a)
Definition: ipid.h:134
intvec
Definition: intvec.h:18
n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:43
sleftv::data
void * data
Definition: subexpr.h:87
n_FlintQ
STATIC_VAR n_coeffType n_FlintQ
Definition: misc_ip.cc:1223
soptionStruct::setval
unsigned setval
Definition: ipid.h:147
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
yydebug
VAR int yydebug
Definition: grammar.cc:1805
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:537
validOpts
VAR BITSET validOpts
Definition: kstd1.cc:56
killhdl
void killhdl(idhdl h, package proot)
Definition: ipid.cc:383
flintZn_InitChar
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Zn.cc:487
SINGULAR_VERSION
#define SINGULAR_VERSION
Definition: mod2.h:85
LongComplexInfo::float_len
short float_len
additional char-flags, rInit
Definition: coeffs.h:100
IDTYP
#define IDTYP(a)
Definition: ipid.h:113
slists::m
sleftv * m
Definition: lists.h:45
V_READING
#define V_READING
Definition: options.h:44
flintQInitCfByName
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Q.cc:533
OPT_NOT_SUGAR
#define OPT_NOT_SUGAR
Definition: options.h:75
OPT_DEBUG
#define OPT_DEBUG
Definition: options.h:78
V_ALLWARN
#define V_ALLWARN
Definition: options.h:64
OPT_INTSTRATEGY
#define OPT_INTSTRATEGY
Definition: options.h:89
n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
V_LOAD_PROC
#define V_LOAD_PROC
Definition: options.h:47
ntInitChar
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2511
OPT_STAIRCASEBOUND
#define OPT_STAIRCASEBOUND
Definition: options.h:85
n_R
single prescision (6,6) real numbers
Definition: coeffs.h:31
slists
Definition: lists.h:22
fe_fgets_stdin_drl
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition: feread.cc:270
INTVEC_CMD
Definition: tok.h:100
V_PROMPT
#define V_PROMPT
Definition: options.h:52
idrec
Definition: idrec.h:33
feResource
static char * feResource(feResourceConfig config, int warn)
Definition: feResource.cc:254
V_NSB
#define V_NSB
Definition: options.h:53
OPT_WEIGHTM
#define OPT_WEIGHTM
Definition: options.h:94
IDPACKAGE
#define IDPACKAGE(a)
Definition: ipid.h:133
StringSetS
void StringSetS(const char *st)
Definition: reporter.cc:127
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
OM_TRACK
#define OM_TRACK
Definition: omalloc_debug.c:9
BVERBOSE
#define BVERBOSE(a)
Definition: options.h:33
Print
#define Print
Definition: emacs.cc:79
OPT_SUGARCRIT
#define OPT_SUGARCRIT
Definition: options.h:77
mpz_size1
#define mpz_size1(A)
Definition: si_gmp.h:12
slists_bin
VAR omBin slists_bin
Definition: lists.cc:22
om_Opts
omOpts_t om_Opts
Definition: omOpts.c:12
si_echo
VAR int si_echo
Definition: febase.cc:34
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
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
Definition: tok.h:148
primes
STATIC_VAR unsigned short primes[]
primes, primes_len: used to step through possible extensions
Definition: gengftables-conway.cc:59
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:493
myynest
VAR int myynest
Definition: febase.cc:40
name
char name(const Variable &v)
Definition: factory.h:180
om_sing_opt_show_mem
int om_sing_opt_show_mem
V_INTERSECT_SYZ
#define V_INTERSECT_SYZ
Definition: options.h:66
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
V_YACC
#define V_YACC
Definition: options.h:42
rField_has_simple_inverse
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:542
sleftv::Typ
int Typ()
Definition: subexpr.cc:1032
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:1289
V_ASSIGN_NONE
#define V_ASSIGN_NONE
Definition: options.h:67
basePack
VAR package basePack
Definition: ipid.cc:57
WarnS
#define WarnS
Definition: emacs.cc:77
Variable::name
char name() const
Definition: variable.cc:122
sleftv::rtyp
int rtyp
Definition: subexpr.h:90
assume
#define assume(x)
Definition: mod2.h:384
OPT_REDTHROUGH
#define OPT_REDTHROUGH
Definition: options.h:79
NULL
#define NULL
Definition: omList.c:11
lists
slists * lists
Definition: mpr_numeric.h:145
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:49
nc_NF
EXTERN_VAR NF_Proc nc_NF
Definition: gb_hack.h:9
MAXPATHLEN
#define MAXPATHLEN
Definition: omRet2Info.c:21
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:1238
l
int l
Definition: cfEzgcd.cc:93
sem_acquired
VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition: semaphore.c:25
OM_CHECK
#define OM_CHECK
Definition: omalloc_debug.c:14
errorreported
VAR short errorreported
Definition: feFopen.cc:23
feOptSpec
EXTERN_VAR struct fe_option feOptSpec[]
Definition: feOpt.h:16
OPT_DEGBOUND
#define OPT_DEGBOUND
Definition: options.h:87
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:1030
StringAppend
#define StringAppend
Definition: emacs.cc:78
V_CANCELUNIT
#define V_CANCELUNIT
Definition: options.h:55
initRTimer
void initRTimer()
Definition: timer.cc:155
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
slists::Init
INLINE_THIS void Init(int l=0)
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition: options.h:19
p
int p
Definition: cfModGcd.cc:4019
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
add
STATIC_VAR unsigned add[]
Definition: misc_ip.cc:117
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:6550
feOptValue
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:39
sca_bba
EXTERN_VAR BBA_Proc sca_bba
Definition: gb_hack.h:10
fd
int status int fd
Definition: si_signals.h:58
TEST_RINGDEP_OPTS
#define TEST_RINGDEP_OPTS
Definition: options.h:97
OPT_FASTHC
#define OPT_FASTHC
Definition: options.h:82
V_REDEFINE
#define V_REDEFINE
Definition: options.h:43
iiLibCmd
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:826
V_IMAP
#define V_IMAP
Definition: options.h:51
V_MODPSOLVSB
#define V_MODPSOLVSB
Definition: options.h:56
sLastPrinted
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:45
n_unknown
Definition: coeffs.h:28
OPT_RETURN_SB
#define OPT_RETURN_SB
Definition: options.h:81
fe_reset_input_mode
void fe_reset_input_mode()
Definition: fereadl.c:824
mpz2number
static FORCE_INLINE number mpz2number(mpz_t m)
Definition: misc_ip.cc:81
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:585
n2pInitChar
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition: algext.cc:1680
LINK_CMD
Definition: tok.h:116
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
OPT_INTERRUPT
#define OPT_INTERRUPT
Definition: options.h:76
TEST_V_QUIET
#define TEST_V_QUIET
Definition: options.h:129
package
ip_package * package
Definition: structs.h:47
si_opt_2
VAR unsigned si_opt_2
Definition: options.c:6
gnc_gr_bba
EXTERN_VAR BBA_Proc gnc_gr_bba
Definition: gb_hack.h:10
sleftv::next
leftv next
Definition: subexpr.h:85
flintZnInitCfByName
coeffs flintZnInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Zn.cc:433
EXTERN_VAR
#define EXTERN_VAR
Definition: globaldefs.h:6
OPT_NOTREGULARITY
#define OPT_NOTREGULARITY
Definition: options.h:93
n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:35
OPT_PROT
#define OPT_PROT
Definition: options.h:72
verboseStruct
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:551