My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
misc_ip.cc File Reference

This file provides miscellaneous functionality. More...

#include "kernel/mod2.h"
#include "kernel/oswrapper/vspace.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/flintcf_Q.h"
#include "coeffs/flintcf_Qrat.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 "misc/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 <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

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.
 
void singular_example (char *str)
 
BOOLEAN setOption (leftv res, leftv v)
 
charshowOption ()
 
charversionString ()
 
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)
 
int flint_mod_init (SModulFunctions *psModulFunctions)
 
static BOOLEAN iiFloat (leftv res, leftv pnn)
 
static BOOLEAN iiCrossProd (leftv res, leftv args)
 
static void callWerrorS (const char *s)
 
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 []
 
const charsingular_date = __DATE__ " " __TIME__
 
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

◆ callWerrorS()

static void callWerrorS ( const char s)
static

Definition at line 1363 of file misc_ip.cc.

1363{ WerrorS(s); }
const CanonicalForm int s
Definition facAbsFact.cc:51
void WerrorS(const char *s)
Definition feFopen.cc:24

◆ factor_gmp()

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

Definition at line 328 of file misc_ip.cc.

329{
330 unsigned int division_limit;
331
332 if (mpz_sgn (t) == 0)
333 return;
334
335 /* Set the trial division limit according the size of t. */
337 if (division_limit > 1000)
338 division_limit = 1000 * 1000;
339 else
341
343 {
344 if (mpz_cmp_ui (t, 1) != 0)
345 {
346 if (mpz_probab_prime_p (t, 10))
347 {
349 multiplicities[index++] = 1;
350 mpz_set_ui(t,1);
351 }
352 else
354 }
355 }
356}
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
STATIC_VAR unsigned short primes[]
primes, primes_len: used to step through possible extensions
static int factor_using_division(mpz_t t, unsigned int limit, lists primes, int *multiplicities, int &index, unsigned long bound)
Definition misc_ip.cc:110
static void factor_using_pollard_rho(mpz_t n, unsigned long a, lists primes, int *multiplicities, int &index)
Definition misc_ip.cc:205
void setListEntry(lists L, int index, mpz_t n)
Definition misc_ip.cc:75
static int index(p_Length length, p_Ord ord)

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

111{
112 mpz_t q, r;
113 unsigned long int f;
114 int ai;
115 unsigned *addv = add;
116 unsigned int failures;
117 int bound_not_reached=1;
118
119 mpz_init (q);
120 mpz_init (r);
121
122 f = mpz_scan1 (t, 0);
123 mpz_div_2exp (t, t, f);
124 if (f>0)
125 {
128 }
129
130 f=0;
131 loop
132 {
133 mpz_tdiv_qr_ui (q, r, t, 3);
134 if (mpz_sgn1 (r) != 0)
135 break;
136 mpz_set (t, q);
137 f++;
138 }
139 if (f>0)
140 {
143 }
144 f=0;
145 loop
146 {
147 mpz_tdiv_qr_ui (q, r, t, 5);
148 if (mpz_sgn1 (r) != 0)
149 break;
150 mpz_set (t, q);
151 f++;
152 }
153 if (f>0)
154 {
157 }
158
159 failures = 0;
160 f = 7;
161 ai = 0;
162 unsigned long last_f=0;
163 while (mpz_cmp_ui (t, 1) != 0)
164 {
165 mpz_tdiv_qr_ui (q, r, t, f);
166 if (mpz_sgn1 (r) != 0)
167 {
168 f += addv[ai];
169 if (mpz_cmp_ui (t, f) < 0)
170 break;
171 ai = (ai + 1) & 7;
172 failures++;
173 if (failures > limit)
174 break;
175 if ((bound!=0) && (f>bound))
176 {
178 break;
179 }
180 }
181 else
182 {
183 mpz_swap (t, q);
184 if (f!=last_f)
185 {
188 index++;
189 }
190 else
191 {
193 }
194 last_f=f;
195 failures = 0;
196 }
197 }
198
199 mpz_clear (q);
200 mpz_clear (r);
201 //printf("bound=%d,f=%d,failures=%d, reached=%d\n",bound,f,failures,bound_not_reached);
202 return bound_not_reached;
203}
FILE * f
Definition checklibs.c:9
void setListEntry_ui(lists L, int index, unsigned long ui)
Definition misc_ip.cc:92
STATIC_VAR unsigned add[]
Definition misc_ip.cc:108
#define mpz_sgn1(A)
Definition si_gmp.h:18
#define loop
Definition structs.h:71

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

206{
207 mpz_t x, x1, y, P;
208 mpz_t t1, t2;
210 unsigned long long k, l, i;
211
212 mpz_init (t1);
213 mpz_init (t2);
215 mpz_init_set_ui (y, 2);
216 mpz_init_set_ui (x, 2);
217 mpz_init_set_ui (x1, 2);
218 mpz_init_set_ui (P, 1);
219 k = 1;
220 l = 1;
221
222 while (mpz_cmp_ui (n, 1) != 0)
223 {
224 loop
225 {
226 do
227 {
228 mpz_mul (t1, x, x);
229 mpz_mod (x, t1, n);
230 mpz_add_ui (x, x, a);
231 mpz_sub (t1, x1, x);
232 mpz_mul (t2, P, t1);
233 mpz_mod (P, t2, n);
234
235 if (k % 32 == 1)
236 {
237 mpz_gcd (t1, P, n);
238 if (mpz_cmp_ui (t1, 1) != 0)
239 goto factor_found;
240 mpz_set (y, x);
241 }
242 }
243 while (--k != 0);
244
245 mpz_gcd (t1, P, n);
246 if (mpz_cmp_ui (t1, 1) != 0)
247 goto factor_found;
248
249 mpz_set (x1, x);
250 k = l;
251 l = 2 * l;
252 for (i = 0; i < k; i++)
253 {
254 mpz_mul (t1, x, x);
255 mpz_mod (x, t1, n);
256 mpz_add_ui (x, x, a);
257 }
258 mpz_set (y, x);
259 }
260
262 do
263 {
264 mpz_mul (t1, y, y);
265 mpz_mod (y, t1, n);
266 mpz_add_ui (y, y, a);
267 mpz_sub (t1, x1, y);
268 mpz_gcd (t1, t1, n);
269 }
270 while (mpz_cmp_ui (t1, 1) == 0);
271
272 mpz_divexact (n, n, t1); /* divide by t1, before t1 is overwritten */
273
274 if (!mpz_probab_prime_p (t1, 10))
275 {
276 do
277 {
280 a = a_limb;
281 }
282 while (a == 0);
283
285 }
286 else
287 {
288 if (mpz_cmp(t1,last_f)==0)
289 {
291 }
292 else
293 {
296 multiplicities[index++] = 1;
297 }
298 }
299 mpz_mod (x, x, n);
300 mpz_mod (x1, x1, n);
301 mpz_mod (y, y, n);
302 if (mpz_probab_prime_p (n, 10))
303 {
304 if (mpz_cmp(n,last_f)==0)
305 {
307 }
308 else
309 {
310 mpz_set(last_f,n);
312 multiplicities[index++] = 1;
313 }
314 mpz_set_ui(n,1);
315 break;
316 }
317 }
318
319 mpz_clear (P);
320 mpz_clear (t2);
321 mpz_clear (t1);
322 mpz_clear (x1);
323 mpz_clear (x);
324 mpz_clear (y);
326}
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
Variable x
Definition cfModGcd.cc:4090
const CanonicalForm int const CFList const Variable & y
Definition facAbsFact.cc:53

◆ flint_mod_init()

int flint_mod_init ( SModulFunctions psModulFunctions)

Definition at line 1275 of file misc_ip.cc.

1276{
1277 package save=currPack;
1280 if (n_FlintQ!=n_unknown)
1281 {
1282 iiAddCproc("kernel","flintQp",FALSE,ii_FlintQ_init);
1284 }
1285#if __FLINT_RELEASE >= 20503
1286 iiAddCproc("kernel","flintQ",FALSE,ii_FlintQrat_init);
1288#endif
1290 if (n_FlintZn!=n_unknown)
1291 {
1292 iiAddCproc("kernel","flintZn",FALSE,ii_FlintZn_init);
1294 }
1295 currPack=save;
1296 return MAX_TOK;
1297}
#define FALSE
Definition auxiliary.h:97
@ n_unknown
Definition coeffs.h:28
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition flintcf_Q.cc:636
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition flintcf_Q.cc:608
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
coeffs flintZnInitCfByName(char *s, n_coeffType n)
VAR package basePack
Definition ipid.cc:56
VAR package currPack
Definition ipid.cc:55
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition iplib.cc:1073
static BOOLEAN ii_FlintQ_init(leftv res, leftv a)
Definition misc_ip.cc:1230
STATIC_VAR n_coeffType n_FlintQ
Definition misc_ip.cc:1214
static BOOLEAN ii_FlintZn_init(leftv res, leftv a)
Definition misc_ip.cc:1216
STATIC_VAR n_coeffType n_FlintZn
Definition misc_ip.cc:1213
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition numbers.cc:631
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition numbers.cc:590
@ MAX_TOK
Definition tok.h:220

◆ ii_FlintQ_init()

static BOOLEAN ii_FlintQ_init ( leftv  res,
leftv  a 
)
static

Definition at line 1230 of file misc_ip.cc.

1231{
1232 const short t[]={1,STRING_CMD};
1233 if (iiCheckTypes(a,t,1))
1234 {
1235 char* p;
1236 p=(char*)a->Data();
1237 res->rtyp=CRING_CMD;
1238 res->data=(void*)nInitChar(n_FlintQ,(void*)p);
1239 return FALSE;
1240 }
1241 return TRUE;
1242}
#define TRUE
Definition auxiliary.h:101
int p
Definition cfModGcd.cc:4086
void * Data()
Definition subexpr.cc:1192
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
CanonicalForm res
Definition facAbsFact.cc:60
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
Definition ipshell.cc:6576
@ CRING_CMD
Definition tok.h:56
@ STRING_CMD
Definition tok.h:187

◆ ii_FlintZn_init()

static BOOLEAN ii_FlintZn_init ( leftv  res,
leftv  a 
)
static

Definition at line 1216 of file misc_ip.cc.

1217{
1218 const short t[]={2,INT_CMD,STRING_CMD};
1219 if (iiCheckTypes(a,t,1))
1220 {
1222 p.ch=(int)(long)a->Data();
1223 p.name=(char*)a->next->Data();
1224 res->rtyp=CRING_CMD;
1225 res->data=(void*)nInitChar(n_FlintZn,(void*)&p);
1226 return FALSE;
1227 }
1228 return TRUE;
1229}
leftv next
Definition subexpr.h:86
@ INT_CMD
Definition tok.h:96

◆ iiCrossProd()

static BOOLEAN iiCrossProd ( leftv  res,
leftv  args 
)
static

Definition at line 1329 of file misc_ip.cc.

1330{
1331 leftv h=args;
1332 coeffs *c=NULL;
1333 coeffs cf=NULL;
1334 int i=0;
1335 if (h==NULL) goto crossprod_error;
1336 while (h!=NULL)
1337 {
1338 if (h->Typ()!=CRING_CMD) goto crossprod_error;
1339 i++;
1340 h=h->next;
1341 }
1342 c=(coeffs*)omAlloc0((i+1)*sizeof(coeffs));
1343 h=args;
1344 i=0;
1345 while (h!=NULL)
1346 {
1347 c[i]=(coeffs)h->CopyD();
1348 i++;
1349 h=h->next;
1350 }
1352 res->data=cf;
1353 res->rtyp=CRING_CMD;
1354 return FALSE;
1355
1357 WerrorS("expected `crossprod(coeffs, ...)`");
1358 return TRUE;
1359}
CanonicalForm cf
Definition cfModGcd.cc:4091
Class used for (list of) interpreter objects.
Definition subexpr.h:83
@ n_nTupel
n-tupel of cf: ZZ/p1,... ZZ/pn, R, long_R
Definition coeffs.h:42
STATIC_VAR Poly * h
Definition janet.cc:971
The main handler for Singular numbers which are suitable for Singular polynomials.
#define omAlloc0(size)
#define NULL
Definition omList.c:12

◆ iiFloat()

static BOOLEAN iiFloat ( leftv  res,
leftv  pnn 
)
static

Definition at line 1300 of file misc_ip.cc.

1301{
1302 short float_len=3;
1303 short float_len2=SHORT_REAL_LENGTH;
1304 coeffs cf=NULL;
1305 if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1306 {
1307 float_len=(int)(long)pnn->Data();
1308 float_len2=float_len;
1309 pnn=pnn->next;
1310 if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1311 {
1312 float_len2=(int)(long)pnn->Data();
1313 pnn=pnn->next;
1314 }
1315 }
1316 if (float_len2 <= (short)SHORT_REAL_LENGTH)
1317 cf=nInitChar(n_R, NULL);
1318 else // longR or longC?
1319 {
1321 param.float_len = si_min (float_len, 32767);
1322 param.float_len2 = si_min (float_len2, 32767);
1323 cf = nInitChar(n_long_R, (void*)&param);
1324 }
1325 res->rtyp=CRING_CMD;
1326 res->data=cf;
1327 return cf==NULL;
1328}
static int si_min(const int a, const int b)
Definition auxiliary.h:126
@ n_R
single prescision (6,6) real numbers
Definition coeffs.h:31
@ n_long_R
real floating point (GMP) numbers
Definition coeffs.h:33
#define SHORT_REAL_LENGTH
Definition numbers.h:57

◆ m2_end()

void m2_end ( int  i)

Definition at line 1104 of file misc_ip.cc.

1105{
1106 if (!m2_end_called)
1107 {
1112 if (File_Log!=NULL)
1113 {
1115 File_Log=NULL;
1116 if (File_Log_written==FALSE) // remove empty logs
1117 {
1118 int pid=getpid();
1119 char buf[20];
1120 snprintf(buf,20,"/tmp/sing_log.%d",pid);
1121 remove(buf);
1122 }
1123 }
1125#ifdef HAVE_SIMPLEIPC
1126 for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1127 {
1128 if (semaphore[j] != NULL)
1129 {
1130 while (sem_acquired[j] > 0)
1131 {
1132#if PORTABLE_SEMAPHORES
1133 sem_post(semaphore[j]->sig);
1134#else
1136#endif
1137 sem_acquired[j]--;
1138 }
1139 }
1140 }
1141#endif // HAVE_SIMPLEIPC
1142 monitor(NULL,0);
1144 {
1146 while(hh!=NULL)
1147 {
1148 //Print("close %s\n",hh->l->name);
1149 slPrepClose(hh->l);
1150 hh=(link_list)hh->next;
1151 }
1153
1154 idhdl h = currPack->idroot;
1155 while(h != NULL)
1156 {
1157 if(IDTYP(h) == LINK_CMD)
1158 {
1159 idhdl hh=h->next;
1160 //Print("kill %s\n",IDID(h));
1161 killhdl(h, currPack);
1162 h = hh;
1163 }
1164 else
1165 {
1166 h = h->next;
1167 }
1168 }
1170 while(hh!=NULL)
1171 {
1172 //Print("close %s\n",hh->l->name);
1173 slClose(hh->l);
1175 }
1176 }
1177#ifdef PAGE_TEST
1178 mmEndStat();
1179#endif
1182 {
1183 if (TEST_V_QUIET)
1184 {
1185 if ((i==0)||(i==1))
1186 printf("Auf Wiedersehen.\n");
1187 }
1188 if (i>1)
1189 {
1190 printf("\nhalt %d\n",i);
1191 }
1192 }
1193 if (i>1) exit(i);
1194 else if (i==1) exit(0);
1195 else if (i<0) _exit(0);
1196 }
1197}
int BOOLEAN
Definition auxiliary.h:88
Definition idrec.h:35
VAR BOOLEAN singular_in_batchmode
Definition cntrlc.cc:62
int j
Definition facHensel.cc:110
void monitor(void *F, int mode)
Definition febase.cc:68
void fe_reset_input_mode()
Definition fereadl.c:831
VAR FILE * File_Profiling
Definition fevoices.cc:32
VAR BOOLEAN File_Log_written
Definition fevoices.cc:34
VAR FILE * File_Log
Definition fevoices.cc:33
#define EXTERN_VAR
Definition globaldefs.h:6
void killhdl(idhdl h, package proot)
Definition ipid.cc:414
#define IDTYP(a)
Definition ipid.h:119
volatile BOOLEAN m2_end_called
Definition misc_ip.cc:1097
#define TEST_V_QUIET
Definition options.h:135
VAR sipc_sem_t * semaphore[SIPC_MAX_SEMAPHORES]
Definition semaphore.c:24
VAR int sem_acquired[SIPC_MAX_SEMAPHORES]
Definition semaphore.c:25
int status int void * buf
Definition si_signals.h:69
#define SIPC_MAX_SEMAPHORES
Definition simpleipc.h:10
@ LINK_CMD
Definition tok.h:117

◆ omSingOutOfMemoryFunc()

void omSingOutOfMemoryFunc ( )

Definition at line 1202 of file misc_ip.cc.

1203 {
1204 fprintf(stderr, "\nSingular error: no more memory\n");
1206 m2_end(14);
1207 /* should never get here */
1208 exit(1);
1209 }
void m2_end(int i)
Definition misc_ip.cc:1104
#define omPrintStats(F)
Definition xalloc.h:231

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

359{
360 int i;
361 int index=0;
363 lists primes = (lists)omAllocBin(slists_bin); primes->Init(1000);
364 int* multiplicities = (int*)omAlloc0(1000*sizeof(int));
365 int positive=1;
366
367 if (!n_IsZero(n, coeffs_BIGINT))
368 {
370 {
371 positive=-1;
372 mpz_neg(nn,nn);
373 }
375 }
376
378 primesL->Init(index);
379 for (i = 0; i < index; i++)
380 {
381 primesL->m[i].rtyp = primes->m[i].rtyp;
382 primesL->m[i].data = primes->m[i].data;
383 primes->m[i].rtyp=0;
384 primes->m[i].data=NULL;
385 }
386 primes->Clean(NULL);
387
389 multiplicitiesL->Init(index);
390 for (i = 0; i < index; i++)
391 {
392 multiplicitiesL->m[i].rtyp = INT_CMD;
393 multiplicitiesL->m[i].data = (void*)(long)multiplicities[i];
394 }
396
398 L->Init(3);
399 if (positive==-1) mpz_neg(nn,nn);
400 L->m[0].rtyp = LIST_CMD; L->m[0].data = (void*)primesL;
401 L->m[1].rtyp = LIST_CMD; L->m[1].data = (void*)multiplicitiesL;
402 setListEntry(L, 2, nn);
403
404 mpz_clear(nn);
405
406 return L;
407}
int rtyp
Definition subexpr.h:91
void * data
Definition subexpr.h:88
Definition lists.h:24
sleftv * m
Definition lists.h:46
INLINE_THIS void Init(int l=0)
static FORCE_INLINE void number2mpz(number n, coeffs c, mpz_t m)
Definition coeffs.h:990
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
Definition coeffs.h:500
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
VAR omBin slists_bin
Definition lists.cc:23
static void factor_gmp(mpz_t t, lists primes, int *multiplicities, int &index, unsigned long bound)
Definition misc_ip.cc:328
slists * lists
#define omAllocBin(bin)
#define omFree(addr)
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
@ LIST_CMD
Definition tok.h:118

◆ setListEntry()

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

Definition at line 75 of file misc_ip.cc.

76{ /* assumes n > 0 */
77 /* try to fit nn into an int: */
78 if (mpz_size1(n)<=1)
79 {
80 int ui=(int)mpz_get_si(n);
81 if ((((ui<<3)>>3)==ui)
82 && (mpz_cmp_si(n,(long)ui)==0))
83 {
84 L->m[index].rtyp = INT_CMD; L->m[index].data = (void*)(long)ui;
85 return;
86 }
87 }
89 L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
90}
static FORCE_INLINE number mpz2number(mpz_t m, coeffs c)
Definition coeffs.h:991
#define mpz_size1(A)
Definition si_gmp.h:17
@ BIGINT_CMD
Definition tok.h:38

◆ setListEntry_ui()

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

Definition at line 92 of file misc_ip.cc.

93{ /* assumes n > 0 */
94 /* try to fit nn into an int: */
95 int i=(int)ui;
96 if ((((unsigned long)i)==ui) && (((i<<3)>>3)==i))
97 {
98 L->m[index].rtyp = INT_CMD; L->m[index].data = (void*)(long)i;
99 }
100 else
101 {
103 L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
104 }
105}
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541

◆ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 570 of file misc_ip.cc.

571{
572 const char *n;
573 do
574 {
575 if (v->Typ()==STRING_CMD)
576 {
577 n=(const char *)v->CopyD(STRING_CMD);
578 }
579 else
580 {
581 if (v->name==NULL)
582 return TRUE;
583 if (v->rtyp==0)
584 {
585 n=v->name;
586 v->name=NULL;
587 }
588 else
589 {
590 n=omStrDup(v->name);
591 }
592 }
593
594 int i;
595
596 if(strcmp(n,"get")==0)
597 {
598 intvec *w=new intvec(2);
599 (*w)[0]=si_opt_1;
600 (*w)[1]=si_opt_2;
601 res->rtyp=INTVEC_CMD;
602 res->data=(void *)w;
603 goto okay;
604 }
605 if(strcmp(n,"set")==0)
606 {
607 if((v->next!=NULL)
608 &&(v->next->Typ()==INTVEC_CMD))
609 {
610 v=v->next;
611 intvec *w=(intvec*)v->Data();
612 si_opt_1=(*w)[0];
613 si_opt_2=(*w)[1];
614#if 0
618 ) {
619 si_opt_1 &=~Sy_bit(OPT_INTSTRATEGY);
620 }
621#endif
622 goto okay;
623 }
624 }
625 if(strcmp(n,"none")==0)
626 {
627 si_opt_1=0;
628 si_opt_2=0;
629 goto okay;
630 }
631 for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
632 {
633 if (strcmp(n,optionStruct[i].name)==0)
634 {
635 if (optionStruct[i].setval & validOpts)
636 {
637 si_opt_1 |= optionStruct[i].setval;
638 // optOldStd disables redthrough
639 if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
641 }
642 else
643 WarnS("cannot set option");
644#if 0
648 ) {
649 test &=~Sy_bit(OPT_INTSTRATEGY);
650 }
651#endif
652 goto okay;
653 }
654 else if ((strncmp(n,"no",2)==0)
655 && (strcmp(n+2,optionStruct[i].name)==0))
656 {
657 if (optionStruct[i].setval & validOpts)
658 {
659 si_opt_1 &= optionStruct[i].resetval;
660 }
661 else
662 WarnS("cannot clear option");
663 goto okay;
664 }
665 }
666 for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
667 {
668 if (strcmp(n,verboseStruct[i].name)==0)
669 {
670 si_opt_2 |= verboseStruct[i].setval;
671 #ifdef YYDEBUG
672 #if YYDEBUG
673 /*debugging the bison grammar --> grammar.cc*/
675 if (BVERBOSE(V_YACC)) yydebug=1;
676 else yydebug=0;
677 #endif
678 #endif
679 goto okay;
680 }
681 else if ((strncmp(n,"no",2)==0)
682 && (strcmp(n+2,verboseStruct[i].name)==0))
683 {
684 si_opt_2 &= verboseStruct[i].resetval;
685 #ifdef YYDEBUG
686 #if YYDEBUG
687 /*debugging the bison grammar --> grammar.cc*/
689 if (BVERBOSE(V_YACC)) yydebug=1;
690 else yydebug=0;
691 #endif
692 #endif
693 goto okay;
694 }
695 }
696 Werror("unknown option `%s`",n);
697 okay:
698 if (currRing != NULL)
701 v=v->next;
702 } while (v!=NULL);
703
704 // set global variable to show memory usage
706 else om_sing_opt_show_mem = 0;
707
708 return FALSE;
709}
CanonicalForm test
Definition cfModGcd.cc:4104
char name() const
Definition variable.cc:122
Variable next() const
Definition factory.h:146
#define WarnS
Definition emacs.cc:78
const CanonicalForm & w
Definition facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
char name(const Variable &v)
Definition factory.h:189
int yydebug
Definition grammar.cc:1843
VAR BITSET validOpts
Definition kstd1.cc:60
const struct soptionStruct verboseStruct[]
Definition misc_ip.cc:539
const struct soptionStruct optionStruct[]
Definition misc_ip.cc:508
#define omStrDup(s)
#define omFreeBinAddr(addr)
int om_sing_opt_show_mem
VAR unsigned si_opt_2
Definition options.c:6
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_INTSTRATEGY
Definition options.h:93
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
#define BVERBOSE(a)
Definition options.h:35
#define V_SHOW_MEM
Definition options.h:43
#define V_YACC
Definition options.h:44
#define OPT_REDTHROUGH
Definition options.h:83
#define Sy_bit(x)
Definition options.h:31
#define TEST_RINGDEP_OPTS
Definition options.h:101
#define OPT_OLDSTD
Definition options.h:87
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:554
#define rField_is_Ring(R)
Definition ring.h:491
@ INTVEC_CMD
Definition tok.h:101

◆ showOption()

char * showOption ( )

Definition at line 711 of file misc_ip.cc.

712{
713 int i;
714 BITSET tmp;
715
716 StringSetS("//options:");
717 if ((si_opt_1!=0)||(si_opt_2!=0))
718 {
720 if(tmp)
721 {
722 for (i=0; optionStruct[i].setval!=0; i++)
723 {
724 if (optionStruct[i].setval & tmp)
725 {
727 tmp &=optionStruct[i].resetval;
728 }
729 }
730 for (i=0; i<32; i++)
731 {
732 if (tmp & Sy_bit(i)) StringAppend(" %d",i);
733 }
734 }
736 if (tmp)
737 {
738 for (i=0; verboseStruct[i].setval!=0; i++)
739 {
740 if (verboseStruct[i].setval & tmp)
741 {
743 tmp &=verboseStruct[i].resetval;
744 }
745 }
746 for (i=1; i<32; i++)
747 {
748 if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
749 }
750 }
751 return StringEndS();
752 }
753 StringAppendS(" none");
754 return StringEndS();
755}
#define BITSET
Definition auxiliary.h:85
#define StringAppend
Definition emacs.cc:79
void StringSetS(const char *st)
Definition reporter.cc:128
void StringAppendS(const char *st)
Definition reporter.cc:107
char * StringEndS()
Definition reporter.cc:151

◆ siInit()

void siInit ( char name)

Definition at line 1364 of file misc_ip.cc.

1365{
1366// memory initialization: -----------------------------------------------
1367 om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
1368#ifndef OM_NDEBUG
1369#ifndef __OPTIMIZE__
1370 #ifndef MAKE_DISTRUBTION
1371 om_Opts.ErrorHook = dErrorBreak;
1372 #endif
1373#else
1374 om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
1375#endif
1376#else
1377 om_Opts.Keep = 0; /* OM_NDEBUG */
1378#endif
1379 omInitInfo();
1380// factory
1381#ifndef HAVE_NTL
1382 extern void initPT();
1383 initPT();
1384#endif
1385 { // set cpus (in siInit), if SINGULAR_CPUS is set, set within the limits
1386 char *env_cpu=getenv("SINGULAR_CPUS");
1387 if (env_cpu!=NULL)
1388 {
1389 int cpu_n,cpus;
1390 #ifdef _SC_NPROCESSORS_ONLN
1392 #elif defined(_SC_NPROCESSORS_CONF)
1394 #endif
1395 #ifdef HAVE_SIMPLEIPC
1397 #endif
1398
1399 int t=atoi(env_cpu);
1400 if ((t>=0)&&(t<cpus)) cpus=t;
1402 // how many threads ? -----------------------------------------------------
1404 }
1405 }
1406// options ---------------------------------------------------------------
1407 si_opt_1=0;
1408// interpreter tables etc.: -----------------------------------------------
1409 memset(&sLastPrinted,0,sizeof(sleftv));
1411
1412 extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
1413
1414 basePack=(package)omAlloc0(sizeof(*basePack));
1416 idhdl h;
1417 h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
1419 IDPACKAGE(h)->language = LANG_TOP;
1420 currPackHdl=h;
1421 basePackHdl=h;
1422
1423 coeffs_BIGINT = nInitChar(n_Q,(void*)1);
1424
1425#if 1
1426 // def HAVE_POLYEXTENSIONS
1427 if(TRUE)
1428 {
1429 n_coeffType type;
1430 #ifdef SINGULAR_4_2
1432 assume(type == n_polyExt);
1433 #endif
1434
1435 type = nRegister(n_algExt, naInitChar);
1436 assume(type == n_algExt);
1437
1439 assume(type == n_transExt);
1440
1441 (void)type;
1442 }
1443#endif
1444
1445// random generator: -----------------------------------------------
1446 {
1447 int t=startTimer();
1448 if (t==0) t=1;
1449 initRTimer();
1450 siSeed=t;
1451 factoryseed(t);
1452 siRandomStart=t;
1453 feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
1454 }
1455
1456// ressource table: ----------------------------------------------------
1457 // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
1458 // hack such that all shared' libs in the bindir are loaded correctly
1460
1461// singular links: --------------------------------------------------
1463 myynest=0;
1464
1465// default coeffs
1466 {
1467 idhdl h;
1468 h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1469 IDDATA(h)=(char*)nInitChar(n_Q,NULL);
1470 h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1471 IDDATA(h)=(char*)nInitChar(n_Z,NULL);
1473 iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
1474 iiAddCproc("kernel","Float",FALSE,iiFloat);
1475 //h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1476 //IDDATA(h)=(char*)nInitChar(n_R,NULL);
1477 //h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1478 //IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
1479 }
1480// setting routines for PLURAL QRINGS:
1481// allowing to use libpolys without libSingular(kStd)
1482#ifdef HAVE_PLURAL
1483 nc_NF=k_NF;
1489#endif
1490// loading standard.lib -----------------------------------------------
1492 {
1495 si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
1496 iiLibCmd("standard.lib", TRUE,TRUE,TRUE);
1498 }
1499 // interpreter error handling
1500 #ifndef __CYGWIN__
1501 factoryError=callWerrorS; // to honour later changes of variable WerrorS
1502 #endif
1503 errorreported = 0;
1504}
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition algext.cc:1386
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition algext.cc:1640
void initPT()
void factoryseed(int s)
random seed initializer
Definition cf_random.cc:186
VAR void(* factoryError)(const char *s)
Definition cf_util.cc:80
VAR int siRandomStart
Definition cntrlc.cc:99
n_coeffType
Definition coeffs.h:27
@ n_polyExt
used to represent polys as coefficients
Definition coeffs.h:34
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
@ n_Zn
only used if HAVE_RINGS is defined
Definition coeffs.h:44
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
@ n_Z
only used if HAVE_RINGS is defined
Definition coeffs.h:43
VAR short errorreported
Definition feFopen.cc:23
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition feOpt.cc:154
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
EXTERN_VAR struct fe_option feOptSpec[]
Definition feOpt.h:17
void feInitResources(const char *argv0)
VAR int myynest
Definition febase.cc:41
char * getenv()
EXTERN_VAR BBA_Proc gnc_gr_bba
Definition gb_hack.h:10
EXTERN_VAR BBA_Proc gnc_gr_mora
Definition gb_hack.h:10
EXTERN_VAR BBA_Proc sca_gr_bba
Definition gb_hack.h:10
EXTERN_VAR NF_Proc nc_NF
Definition gb_hack.h:9
EXTERN_VAR BBA_Proc sca_mora
Definition gb_hack.h:10
EXTERN_VAR BBA_Proc sca_bba
Definition gb_hack.h:10
ideal k_gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const bigintmat *, kStrategy strat, const ring _currRing)
Definition gr_kstd2.cc:1030
ideal k_gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const bigintmat *, kStrategy strat, const ring _currRing)
Definition gr_kstd2.cc:1283
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition iparith.cc:9965
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:279
VAR idhdl currPackHdl
Definition ipid.cc:53
VAR idhdl basePackHdl
Definition ipid.cc:54
#define IDDATA(a)
Definition ipid.h:126
#define IDROOT
Definition ipid.h:19
#define IDPACKAGE(a)
Definition ipid.h:139
BOOLEAN iiLibCmd(const char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition iplib.cc:894
ideal k_sca_bba(const ideal F, const ideal Q, const intvec *, const bigintmat *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Buchberger's algorithm.
Definition sca.cc:368
ideal k_sca_gr_bba(const ideal F, const ideal Q, const intvec *, const bigintmat *, kStrategy strat, const ring _currRing)
Modified Plural's Buchberger's algorithmus.
Definition sca.cc:95
ideal k_sca_mora(const ideal F, const ideal Q, const intvec *, const bigintmat *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Mora's algorithm.
Definition sca.cc:885
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:3447
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition misc_ip.cc:1329
void omSingOutOfMemoryFunc()
Definition misc_ip.cc:1202
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition misc_ip.cc:1300
static void callWerrorS(const char *s)
Definition misc_ip.cc:1363
void dErrorBreak(void)
Definition dError.cc:140
#define assume(x)
Definition mod2.h:389
omOpts_t om_Opts
Definition omOpts.c:13
#define SI_SAVE_OPT(A, B)
Definition options.h:20
#define V_LOAD_LIB
Definition options.h:47
#define SI_RESTORE_OPT(A, B)
Definition options.h:23
coeffs nrnInitCfByName(char *s, n_coeffType)
Definition rmodulon.cc:33
VAR int siSeed
Definition sirandom.c:30
ip_package * package
Definition structs.h:39
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
@ LANG_TOP
Definition subexpr.h:22
int startTimer()
Definition timer.cc:66
void initRTimer()
Definition timer.cc:136
@ PACKAGE_CMD
Definition tok.h:150
#define NONE
Definition tok.h:223
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition transext.cc:2636
#define omInitInfo()
Definition xalloc.h:228

◆ singular_example()

void singular_example ( char str)

Definition at line 431 of file misc_ip.cc.

432{
433 assume(str!=NULL);
434 char *s=str;
435 while (*s==' ') s++;
436 char *ss=s;
437 while (*ss!='\0') ss++;
438 while (*ss<=' ')
439 {
440 *ss='\0';
441 ss--;
442 }
443 idhdl h=IDROOT->get_level(s,0);
444 if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
445 {
446 char *lib=iiGetLibName(IDPROC(h));
447 if((lib!=NULL)&&(*lib!='\0'))
448 {
449 Print("// proc %s from lib %s\n",s,lib);
451 if (s!=NULL)
452 {
453 if (strlen(s)>5)
454 {
455 iiEStart(s,IDPROC(h));
456 omFree((ADDRESS)s);
457 return;
458 }
459 else omFree((ADDRESS)s);
460 }
461 }
462 }
463 else
464 {
465 char sing_file[MAXPATHLEN];
466 FILE *fd=NULL;
467 char *res_m=feResource('m', 0);
468 if (res_m!=NULL)
469 {
470 snprintf(sing_file,MAXPATHLEN, "%s/%s.sing", res_m, s);
471 fd = feFopen(sing_file, "r");
472 }
473 if (fd != NULL)
474 {
475
476 int old_echo = si_echo;
477 int length, got;
478 char* s;
479
480 fseek(fd, 0, SEEK_END);
481 length = ftell(fd);
482 fseek(fd, 0, SEEK_SET);
483 s = (char*) omAlloc((length+20)*sizeof(char));
484 got = fread(s, sizeof(char), length, fd);
485 fclose(fd);
486 if (got != length)
487 {
488 Werror("Error while reading file %s", sing_file);
489 }
490 else
491 {
492 s[length] = '\0';
493 strcat(s, "\n;return();\n\n");
494 si_echo = 2;
495 iiEStart(s, NULL);
497 }
498 omFree(s);
499 }
500 else
501 {
502 Werror("no example for %s", str);
503 }
504 }
505}
#define Print
Definition emacs.cc:80
FILE * feFopen(const char *path, const char *mode, char *where, short useWerror, short path_only)
Definition feFopen.cc:47
static char * feResource(feResourceConfig config, int warn)
VAR int si_echo
Definition febase.cc:35
@ PROC_CMD
Definition grammar.cc:281
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
#define IDPROC(a)
Definition ipid.h:140
BOOLEAN iiEStart(char *example, procinfo *pi)
Definition iplib.cc:763
char * iiGetLibProcBuffer(procinfo *pi, int part)
Definition iplib.cc:197
static char * iiGetLibName(const procinfov pi)
find the library of an proc
Definition ipshell.h:66
#define SEEK_SET
Definition mod2.h:115
#define SEEK_END
Definition mod2.h:111
char * str(leftv arg)
Definition shared.cc:699
#define omAlloc(size)
#define MAXPATHLEN
Definition omRet2Info.c:22
int status int fd
Definition si_signals.h:69

◆ singular_fstat()

int singular_fstat ( int  fd,
struct stat buf 
)

Definition at line 1084 of file misc_ip.cc.

1085{
1086 return si_fstat(fd,buf);
1087}

◆ versionString()

char * versionString ( )

Definition at line 769 of file misc_ip.cc.

770{
771 StringSetS("");
772 StringAppend("Singular for %s version %s (%d, %d bit) %s",
773 S_UNAME, VERSION, // SINGULAR_VERSION,
774 SINGULAR_VERSION, sizeof(void*)*8,
777#else
779#endif
780 StringAppendS("\nwith\n\t");
781
782#if defined(mpir_version)
783 StringAppend("MPIR(%s)~GMP(%s),", mpir_version, gmp_version);
784#elif defined(gmp_version)
785 // #if defined (__GNU_MP_VERSION) && defined (__GNU_MP_VERSION_MINOR)
786 // StringAppend("GMP(%d.%d),",__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR);
787 StringAppend("GMP(%s),", gmp_version);
788#endif
789#ifdef HAVE_NTL
790 StringAppend("NTL(%s),",NTL_VERSION);
791#endif
792
793#ifdef HAVE_FLINT
794 StringAppend("FLINT(%s),",FLINT_VERSION);
795#endif
796// StringAppendS("factory(" FACTORYVERSION "),");
797 StringAppendS("\n\t");
798#ifndef HAVE_OMALLOC
799 StringAppendS("xalloc,");
800#else
801 StringAppendS("omalloc,");
802#endif
803#if defined(HAVE_DYN_RL)
805 StringAppendS("no input,");
806 else if (fe_fgets_stdin==fe_fgets)
807 StringAppendS("fgets,");
809 StringAppend("dynamic readline%d),",RL_VERSION_MAJOR);
810 #ifdef HAVE_FEREAD
812 StringAppendS("emulated readline,");
813 #endif
814 else
815 StringAppendS("unknown fgets method,");
816#else
817 #if defined(HAVE_READLINE) && !defined(FEREAD)
818 StringAppend("static readline(%d),",RL_VERSION_MAJOR);
819 #else
820 #ifdef HAVE_FEREAD
821 StringAppendS("emulated readline,");
822 #else
823 StringAppendS("fgets,");
824 #endif
825 #endif
826#endif
827#ifdef HAVE_PLURAL
828 StringAppendS("Plural,");
829#endif
830#ifdef HAVE_VSPACE
831 #if defined(__GNUC__) && (__GNUC__<9) &&!defined(__clang__)
832 StringAppendS("vspace(1),");
833 #else
834 StringAppendS("vspace(2),");
835 #endif
836#endif
837#ifdef HAVE_DBM
838 StringAppendS("DBM,\n\t");
839#else
840 StringAppendS("\n\t");
841#endif
842#ifdef HAVE_DYNAMIC_LOADING
843 StringAppendS("dynamic modules,");
844#endif
845#ifdef HAVE_DYNANIC_PPROCS
846 StringAppendS("dynamic p_Procs,");
847#endif
848#if YYDEBUG
849 StringAppendS("YYDEBUG=1,");
850#endif
851#ifdef MDEBUG
852 StringAppend("MDEBUG=%d,",MDEBUG);
853#endif
854#ifdef OM_CHECK
855 StringAppend("OM_CHECK=%d,",OM_CHECK);
856#endif
857#ifdef OM_TRACK
858 StringAppend("OM_TRACK=%d,",OM_TRACK);
859#endif
860#ifdef OM_NDEBUG
861 StringAppendS("OM_NDEBUG,");
862#endif
863#ifdef SING_NDEBUG
864 StringAppendS("SING_NDEBUG,");
865#endif
866#ifdef PDEBUG
867 StringAppendS("PDEBUG,");
868#endif
869#ifdef KDEBUG
870 StringAppendS("KDEBUG,");
871#endif
872#ifdef HAVE_SDB
873 StringAppendS("sdb,");
874#endif
875 StringAppendS("\n\t");
876#ifdef __OPTIMIZE__
877 StringAppendS("CC:OPTIMIZE,");
878#endif
879#ifdef __OPTIMIZE_SIZE__
880 StringAppendS("CC:OPTIMIZE_SIZE,");
881#endif
882#ifdef __NO_INLINE__
883 StringAppendS("CC:NO_INLINE,");
884#endif
885#ifdef HAVE_NTL
886 #ifdef NTL_AVOID_BRANCHING
887 #undef HAVE_GENERIC_ADD
888 #endif
889#endif
890#ifdef HAVE_GENERIC_ADD
891 StringAppendS("GenericAdd,");
892#else
893 StringAppendS("AvoidBranching,");
894#endif
895#ifdef HAVE_GENERIC_MULT
896 StringAppendS("GenericMult,");
897#else
898 StringAppendS("TableMult,");
899#endif
900#ifdef HAVE_INVTABLE
901 StringAppendS("invTable,");
902#else
903 StringAppendS("no invTable,");
904#endif
905 StringAppendS("\n\t");
906#ifdef HAVE_EIGENVAL
907 StringAppendS("eigenvalues,");
908#endif
909#ifdef HAVE_GMS
910 StringAppendS("Gauss-Manin system,");
911#endif
912#ifdef HAVE_RATGRING
913 StringAppendS("ratGB,");
914#endif
915 StringAppend("random=%d\n",siRandomStart);
916
917#define SI_SHOW_BUILTIN_MODULE(name) StringAppend(" %s", #name);
918 StringAppendS("built-in modules: {");
920 StringAppendS("}\n");
921#undef SI_SHOW_BUILTIN_MODULE
922
923 StringAppend("AC_CONFIGURE_ARGS = %s,\n"
924 "CC = %s,FLAGS : %s,\n"
925 "CXX = %s,FLAGS : %s,\n"
926 "DEFS : %s,CPPFLAGS : %s,\n"
927 "LDFLAGS : %s,LIBS : %s "
929 "(ver: " __VERSION__ ")"
930#endif
933 LIBS " " PTHREAD_LIBS);
936 StringAppendS("\n");
937 return StringEndS();
938}
#define VERSION
void feStringAppendBrowsers(int warn)
Definition fehelp.cc:341
char * fe_fgets_dummy(const char *, char *, int)
Definition feread.cc:455
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
Definition feread.cc:32
char * fe_fgets(const char *pr, char *s, int size)
Definition feread.cc:309
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
Definition feread.cc:269
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
Definition feread.cc:253
#define SI_SHOW_BUILTIN_MODULE(name)
const char * singular_date
Definition misc_ip.cc:766
#define SINGULAR_VERSION
Definition mod2.h:87
#define MDEBUG
Definition mod2.h:180
#define SI_FOREACH_BUILTIN(add)
Data for type_of_LIB to determine built-in modules, use add(name) to add built-in library to macro.
Definition mod_lib.h:17
#define OM_TRACK
#define OM_CHECK
void feStringAppendResources(int warn)
Definition reporter.cc:402

Variable Documentation

◆ add

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

Definition at line 108 of file misc_ip.cc.

108{4, 2, 4, 2, 4, 6, 2, 6};

◆ m2_end_called

volatile BOOLEAN m2_end_called = FALSE

Definition at line 1097 of file misc_ip.cc.

◆ n_FlintQ

Definition at line 1214 of file misc_ip.cc.

◆ n_FlintZn

Definition at line 1213 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) },
{"notBuckets", Sy_bit(OPT_NOT_BUCKETS), ~Sy_bit(OPT_NOT_BUCKETS) },
{"notSugar", Sy_bit(OPT_NOT_SUGAR), ~Sy_bit(OPT_NOT_SUGAR) },
{"interrupt", Sy_bit(OPT_INTERRUPT), ~Sy_bit(OPT_INTERRUPT) },
{"sugarCrit", Sy_bit(OPT_SUGARCRIT), ~Sy_bit(OPT_SUGARCRIT) },
{"teach", Sy_bit(OPT_DEBUG), ~Sy_bit(OPT_DEBUG) },
{"notSyzMinim", Sy_bit(OPT_NO_SYZ_MINIM), ~Sy_bit(OPT_NO_SYZ_MINIM) },
{"returnSB", Sy_bit(OPT_RETURN_SB), ~Sy_bit(OPT_RETURN_SB) },
{"fastHC", Sy_bit(OPT_FASTHC), ~Sy_bit(OPT_FASTHC) },
{"staircaseBound",Sy_bit(OPT_STAIRCASEBOUND),~Sy_bit(OPT_STAIRCASEBOUND) },
{"multBound", Sy_bit(OPT_MULTBOUND), ~Sy_bit(OPT_MULTBOUND) },
{"degBound", Sy_bit(OPT_DEGBOUND), ~Sy_bit(OPT_DEGBOUND) },
{"redTailSyz", Sy_bit(OPT_REDTAIL_SYZ), ~Sy_bit(OPT_REDTAIL_SYZ) },
{"redTail", Sy_bit(OPT_REDTAIL), ~Sy_bit(OPT_REDTAIL) },
{"redThrough", Sy_bit(OPT_REDTHROUGH), ~Sy_bit(OPT_REDTHROUGH) },
{"lazy", Sy_bit(OPT_OLDSTD), ~Sy_bit(OPT_OLDSTD) },
{"intStrategy", Sy_bit(OPT_INTSTRATEGY), ~Sy_bit(OPT_INTSTRATEGY) },
{"infRedTail", Sy_bit(OPT_INFREDTAIL), ~Sy_bit(OPT_INFREDTAIL) },
{"notRegularity",Sy_bit(OPT_NOTREGULARITY), ~Sy_bit(OPT_NOTREGULARITY) },
{"weightM", Sy_bit(OPT_WEIGHTM), ~Sy_bit(OPT_WEIGHTM) },
{"ne", 0, 0 }
}
#define OPT_SUGARCRIT
Definition options.h:81
#define OPT_PROT
Definition options.h:76
#define OPT_INFREDTAIL
Definition options.h:95
#define OPT_WEIGHTM
Definition options.h:98
#define OPT_REDTAIL_SYZ
Definition options.h:88
#define OPT_REDTAIL
Definition options.h:92
#define OPT_RETURN_SB
Definition options.h:85
#define OPT_NOT_SUGAR
Definition options.h:79
#define OPT_REDSB
Definition options.h:77
#define OPT_NOTREGULARITY
Definition options.h:97
#define OPT_DEBUG
Definition options.h:82
#define OPT_MULTBOUND
Definition options.h:90
#define OPT_STAIRCASEBOUND
Definition options.h:89
#define OPT_INTERRUPT
Definition options.h:80
#define OPT_DEGBOUND
Definition options.h:91
#define OPT_NOT_BUCKETS
Definition options.h:78
#define OPT_FASTHC
Definition options.h:86
#define OPT_NO_SYZ_MINIM
Definition options.h:84

Definition at line 508 of file misc_ip.cc.

509{
510 {"prot", Sy_bit(OPT_PROT), ~Sy_bit(OPT_PROT) },
511 {"redSB", Sy_bit(OPT_REDSB), ~Sy_bit(OPT_REDSB) },
512 {"notBuckets", Sy_bit(OPT_NOT_BUCKETS), ~Sy_bit(OPT_NOT_BUCKETS) },
513 {"notSugar", Sy_bit(OPT_NOT_SUGAR), ~Sy_bit(OPT_NOT_SUGAR) },
514 {"interrupt", Sy_bit(OPT_INTERRUPT), ~Sy_bit(OPT_INTERRUPT) },
515 {"sugarCrit", Sy_bit(OPT_SUGARCRIT), ~Sy_bit(OPT_SUGARCRIT) },
516 {"teach", Sy_bit(OPT_DEBUG), ~Sy_bit(OPT_DEBUG) },
517 {"notSyzMinim", Sy_bit(OPT_NO_SYZ_MINIM), ~Sy_bit(OPT_NO_SYZ_MINIM) },
518 /* 9 return SB in syz, quotient, intersect, modulo */
519 {"returnSB", Sy_bit(OPT_RETURN_SB), ~Sy_bit(OPT_RETURN_SB) },
520 {"fastHC", Sy_bit(OPT_FASTHC), ~Sy_bit(OPT_FASTHC) },
521 /* 11-19 sort in L/T */
522 {"staircaseBound",Sy_bit(OPT_STAIRCASEBOUND),~Sy_bit(OPT_STAIRCASEBOUND) },
523 {"multBound", Sy_bit(OPT_MULTBOUND), ~Sy_bit(OPT_MULTBOUND) },
524 {"degBound", Sy_bit(OPT_DEGBOUND), ~Sy_bit(OPT_DEGBOUND) },
525 {"redTailSyz", Sy_bit(OPT_REDTAIL_SYZ), ~Sy_bit(OPT_REDTAIL_SYZ) },
526 /* 25 no redTail(p)/redTail(s) */
527 {"redTail", Sy_bit(OPT_REDTAIL), ~Sy_bit(OPT_REDTAIL) },
528 {"redThrough", Sy_bit(OPT_REDTHROUGH), ~Sy_bit(OPT_REDTHROUGH) },
529 {"lazy", Sy_bit(OPT_OLDSTD), ~Sy_bit(OPT_OLDSTD) },
530 {"intStrategy", Sy_bit(OPT_INTSTRATEGY), ~Sy_bit(OPT_INTSTRATEGY) },
531 {"infRedTail", Sy_bit(OPT_INFREDTAIL), ~Sy_bit(OPT_INFREDTAIL) },
532 /* 30: use not regularity for syz */
533 {"notRegularity",Sy_bit(OPT_NOTREGULARITY), ~Sy_bit(OPT_NOTREGULARITY) },
534 {"weightM", Sy_bit(OPT_WEIGHTM), ~Sy_bit(OPT_WEIGHTM) },
535/*special for "none" and also end marker for showOption:*/
536 {"ne", 0, 0 }
537};

◆ singular_date

const char* singular_date = __DATE__ " " __TIME__

Definition at line 766 of file misc_ip.cc.

◆ verboseStruct

const struct soptionStruct verboseStruct[]
Initial value:
=
{
{"assign_none",Sy_bit(V_ASSIGN_NONE),~Sy_bit(V_ASSIGN_NONE)},
{"mem", Sy_bit(V_SHOW_MEM), ~Sy_bit(V_SHOW_MEM) },
{"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) },
{"usage", Sy_bit(V_SHOW_USE), ~Sy_bit(V_SHOW_USE) },
{"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) },
{"cancelunit",Sy_bit(V_CANCELUNIT),~Sy_bit(V_CANCELUNIT)},
{"modpsolve",Sy_bit(V_MODPSOLVSB),~Sy_bit(V_MODPSOLVSB)},
{"geometricSB",Sy_bit(V_UPTORADICAL),~Sy_bit(V_UPTORADICAL)},
{"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)},
{"warn", Sy_bit(V_ALLWARN), ~Sy_bit(V_ALLWARN)},
{"intersectSyz",Sy_bit(V_INTERSECT_SYZ), ~Sy_bit(V_INTERSECT_SYZ)},
{"intersectElim",Sy_bit(V_INTERSECT_ELIM), ~Sy_bit(V_INTERSECT_ELIM)},
{"pure_gb",Sy_bit(V_PURE_GB), ~Sy_bit(V_PURE_GB)},
{"ne", 0, 0 }
}
#define V_QRING
Definition options.h:42
#define V_DEF_RES
Definition options.h:50
#define V_INTERSECT_SYZ
Definition options.h:69
#define V_ALLWARN
Definition options.h:67
#define V_READING
Definition options.h:46
#define V_COEFSTRAT
Definition options.h:61
#define V_ASSIGN_NONE
Definition options.h:70
#define V_CONTENTSB
Definition options.h:56
#define V_DEBUG_LIB
Definition options.h:48
#define V_MODPSOLVSB
Definition options.h:58
#define V_LOAD_PROC
Definition options.h:49
#define V_UPTORADICAL
Definition options.h:59
#define V_FINDMONOM
Definition options.h:60
#define V_CANCELUNIT
Definition options.h:57
#define V_REDEFINE
Definition options.h:45
#define V_INTERSECT_ELIM
Definition options.h:68
#define V_PURE_GB
Definition options.h:71
#define V_NSB
Definition options.h:55
#define V_LENGTH
Definition options.h:64
#define V_IMAP
Definition options.h:53
#define V_PROMPT
Definition options.h:54
#define V_SHOW_USE
Definition options.h:52

Definition at line 539 of file misc_ip.cc.

540{
541 {"assign_none",Sy_bit(V_ASSIGN_NONE),~Sy_bit(V_ASSIGN_NONE)},
542 {"mem", Sy_bit(V_SHOW_MEM), ~Sy_bit(V_SHOW_MEM) },
543 {"yacc", Sy_bit(V_YACC), ~Sy_bit(V_YACC) },
544 {"redefine", Sy_bit(V_REDEFINE), ~Sy_bit(V_REDEFINE) },
545 {"reading", Sy_bit(V_READING), ~Sy_bit(V_READING) },
546 {"loadLib", Sy_bit(V_LOAD_LIB), ~Sy_bit(V_LOAD_LIB) },
547 {"debugLib", Sy_bit(V_DEBUG_LIB), ~Sy_bit(V_DEBUG_LIB) },
548 {"loadProc", Sy_bit(V_LOAD_PROC), ~Sy_bit(V_LOAD_PROC) },
549 {"defRes", Sy_bit(V_DEF_RES), ~Sy_bit(V_DEF_RES) },
550 {"usage", Sy_bit(V_SHOW_USE), ~Sy_bit(V_SHOW_USE) },
551 {"Imap", Sy_bit(V_IMAP), ~Sy_bit(V_IMAP) },
552 {"prompt", Sy_bit(V_PROMPT), ~Sy_bit(V_PROMPT) },
553 {"length", Sy_bit(V_LENGTH), ~Sy_bit(V_LENGTH) },
554 {"notWarnSB",Sy_bit(V_NSB), ~Sy_bit(V_NSB) },
555 {"contentSB",Sy_bit(V_CONTENTSB), ~Sy_bit(V_CONTENTSB) },
556 {"cancelunit",Sy_bit(V_CANCELUNIT),~Sy_bit(V_CANCELUNIT)},
557 {"modpsolve",Sy_bit(V_MODPSOLVSB),~Sy_bit(V_MODPSOLVSB)},
558 {"geometricSB",Sy_bit(V_UPTORADICAL),~Sy_bit(V_UPTORADICAL)},
559 {"findMonomials",Sy_bit(V_FINDMONOM),~Sy_bit(V_FINDMONOM)},
560 {"coefStrat",Sy_bit(V_COEFSTRAT), ~Sy_bit(V_COEFSTRAT)},
561 {"qringNF", Sy_bit(V_QRING), ~Sy_bit(V_QRING)},
562 {"warn", Sy_bit(V_ALLWARN), ~Sy_bit(V_ALLWARN)},
563 {"intersectSyz",Sy_bit(V_INTERSECT_SYZ), ~Sy_bit(V_INTERSECT_SYZ)},
564 {"intersectElim",Sy_bit(V_INTERSECT_ELIM), ~Sy_bit(V_INTERSECT_ELIM)},
565 {"pure_gb",Sy_bit(V_PURE_GB), ~Sy_bit(V_PURE_GB)},
566/*special for "none" and also end marker for showOption:*/
567 {"ne", 0, 0 }
568};