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 "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 []
 
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 1372 of file misc_ip.cc.

1372{ 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 327 of file misc_ip.cc.

328{
329 unsigned int division_limit;
330
331 if (mpz_sgn (t) == 0)
332 return;
333
334 /* Set the trial division limit according the size of t. */
336 if (division_limit > 1000)
337 division_limit = 1000 * 1000;
338 else
340
342 {
343 if (mpz_cmp_ui (t, 1) != 0)
344 {
345 if (mpz_probab_prime_p (t, 10))
346 {
348 multiplicities[index++] = 1;
349 mpz_set_ui(t,1);
350 }
351 else
353 }
354 }
355}
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:109
static void factor_using_pollard_rho(mpz_t n, unsigned long a, lists primes, int *multiplicities, int &index)
Definition misc_ip.cc:204
void setListEntry(lists L, int index, mpz_t n)
Definition misc_ip.cc:74
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 109 of file misc_ip.cc.

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

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

205{
206 mpz_t x, x1, y, P;
207 mpz_t t1, t2;
209 unsigned long long k, l, i;
210
211 mpz_init (t1);
212 mpz_init (t2);
214 mpz_init_set_ui (y, 2);
215 mpz_init_set_ui (x, 2);
216 mpz_init_set_ui (x1, 2);
217 mpz_init_set_ui (P, 1);
218 k = 1;
219 l = 1;
220
221 while (mpz_cmp_ui (n, 1) != 0)
222 {
223 loop
224 {
225 do
226 {
227 mpz_mul (t1, x, x);
228 mpz_mod (x, t1, n);
229 mpz_add_ui (x, x, a);
230 mpz_sub (t1, x1, x);
231 mpz_mul (t2, P, t1);
232 mpz_mod (P, t2, n);
233
234 if (k % 32 == 1)
235 {
236 mpz_gcd (t1, P, n);
237 if (mpz_cmp_ui (t1, 1) != 0)
238 goto factor_found;
239 mpz_set (y, x);
240 }
241 }
242 while (--k != 0);
243
244 mpz_gcd (t1, P, n);
245 if (mpz_cmp_ui (t1, 1) != 0)
246 goto factor_found;
247
248 mpz_set (x1, x);
249 k = l;
250 l = 2 * l;
251 for (i = 0; i < k; i++)
252 {
253 mpz_mul (t1, x, x);
254 mpz_mod (x, t1, n);
255 mpz_add_ui (x, x, a);
256 }
257 mpz_set (y, x);
258 }
259
261 do
262 {
263 mpz_mul (t1, y, y);
264 mpz_mod (y, t1, n);
265 mpz_add_ui (y, y, a);
266 mpz_sub (t1, x1, y);
267 mpz_gcd (t1, t1, n);
268 }
269 while (mpz_cmp_ui (t1, 1) == 0);
270
271 mpz_divexact (n, n, t1); /* divide by t1, before t1 is overwritten */
272
273 if (!mpz_probab_prime_p (t1, 10))
274 {
275 do
276 {
279 a = a_limb;
280 }
281 while (a == 0);
282
284 }
285 else
286 {
287 if (mpz_cmp(t1,last_f)==0)
288 {
290 }
291 else
292 {
293 mpz_set(last_f,t1);
295 multiplicities[index++] = 1;
296 }
297 }
298 mpz_mod (x, x, n);
299 mpz_mod (x1, x1, n);
300 mpz_mod (y, y, n);
301 if (mpz_probab_prime_p (n, 10))
302 {
303 if (mpz_cmp(n,last_f)==0)
304 {
306 }
307 else
308 {
309 mpz_set(last_f,n);
311 multiplicities[index++] = 1;
312 }
313 mpz_set_ui(n,1);
314 break;
315 }
316 }
317
318 mpz_clear (P);
319 mpz_clear (t2);
320 mpz_clear (t1);
321 mpz_clear (x1);
322 mpz_clear (x);
323 mpz_clear (y);
325}
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 1284 of file misc_ip.cc.

1285{
1286 package save=currPack;
1289 if (n_FlintQ!=n_unknown)
1290 {
1291 iiAddCproc("kernel","flintQp",FALSE,ii_FlintQ_init);
1293 }
1294#if __FLINT_RELEASE >= 20503
1295 iiAddCproc("kernel","flintQ",FALSE,ii_FlintQrat_init);
1297#endif
1299 if (n_FlintZn!=n_unknown)
1300 {
1301 iiAddCproc("kernel","flintZn",FALSE,ii_FlintZn_init);
1303 }
1304 currPack=save;
1305 return MAX_TOK;
1306}
#define FALSE
Definition auxiliary.h:96
@ n_unknown
Definition coeffs.h:28
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition flintcf_Q.cc:635
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition flintcf_Q.cc:607
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
coeffs flintZnInitCfByName(char *s, n_coeffType n)
VAR package basePack
Definition ipid.cc:58
VAR package currPack
Definition ipid.cc:57
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition iplib.cc:1072
static BOOLEAN ii_FlintQ_init(leftv res, leftv a)
Definition misc_ip.cc:1239
STATIC_VAR n_coeffType n_FlintQ
Definition misc_ip.cc:1223
static BOOLEAN ii_FlintZn_init(leftv res, leftv a)
Definition misc_ip.cc:1225
STATIC_VAR n_coeffType n_FlintZn
Definition misc_ip.cc:1222
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition numbers.cc:624
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition numbers.cc:583
@ MAX_TOK
Definition tok.h:220

◆ ii_FlintQ_init()

static BOOLEAN ii_FlintQ_init ( leftv  res,
leftv  a 
)
static

Definition at line 1239 of file misc_ip.cc.

1240{
1241 const short t[]={1,STRING_CMD};
1242 if (iiCheckTypes(a,t,1))
1243 {
1244 char* p;
1245 p=(char*)a->Data();
1246 res->rtyp=CRING_CMD;
1247 res->data=(void*)nInitChar(n_FlintQ,(void*)p);
1248 return FALSE;
1249 }
1250 return TRUE;
1251}
#define TRUE
Definition auxiliary.h:100
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:406
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:6567
@ 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 1225 of file misc_ip.cc.

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

◆ iiCrossProd()

static BOOLEAN iiCrossProd ( leftv  res,
leftv  args 
)
static

Definition at line 1338 of file misc_ip.cc.

1339{
1340 leftv h=args;
1341 coeffs *c=NULL;
1342 coeffs cf=NULL;
1343 int i=0;
1344 if (h==NULL) goto crossprod_error;
1345 while (h!=NULL)
1346 {
1347 if (h->Typ()!=CRING_CMD) goto crossprod_error;
1348 i++;
1349 h=h->next;
1350 }
1351 c=(coeffs*)omAlloc0((i+1)*sizeof(coeffs));
1352 h=args;
1353 i=0;
1354 while (h!=NULL)
1355 {
1356 c[i]=(coeffs)h->CopyD();
1357 i++;
1358 h=h->next;
1359 }
1361 res->data=cf;
1362 res->rtyp=CRING_CMD;
1363 return FALSE;
1364
1366 WerrorS("expected `crossprod(coeffs, ...)`");
1367 return TRUE;
1368}
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 1309 of file misc_ip.cc.

1310{
1311 short float_len=3;
1312 short float_len2=SHORT_REAL_LENGTH;
1313 coeffs cf=NULL;
1314 if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1315 {
1316 float_len=(int)(long)pnn->Data();
1317 float_len2=float_len;
1318 pnn=pnn->next;
1319 if ((pnn!=NULL) && (pnn->Typ()==INT_CMD))
1320 {
1321 float_len2=(int)(long)pnn->Data();
1322 pnn=pnn->next;
1323 }
1324 }
1325 if (float_len2 <= (short)SHORT_REAL_LENGTH)
1326 cf=nInitChar(n_R, NULL);
1327 else // longR or longC?
1328 {
1330 param.float_len = si_min (float_len, 32767);
1331 param.float_len2 = si_min (float_len2, 32767);
1332 cf = nInitChar(n_long_R, (void*)&param);
1333 }
1334 res->rtyp=CRING_CMD;
1335 res->data=cf;
1336 return cf==NULL;
1337}
static int si_min(const int a, const int b)
Definition auxiliary.h:125
@ 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 1100 of file misc_ip.cc.

1101{
1102 if (!m2_end_called)
1103 {
1108 if (File_Log!=NULL)
1109 {
1111 File_Log=NULL;
1112 if (File_Log_written==FALSE) // remove empty logs
1113 {
1114 int pid=getpid();
1115 char buf[20];
1116 snprintf(buf,20,"/tmp/sing_log.%d",pid);
1117 remove(buf);
1118 }
1119 }
1121#ifdef HAVE_SIMPLEIPC
1122 for (int j = SIPC_MAX_SEMAPHORES-1; j >= 0; j--)
1123 {
1124 if (semaphore[j] != NULL)
1125 {
1126 while (sem_acquired[j] > 0)
1127 {
1128#if PORTABLE_SEMAPHORES
1129 sem_post(semaphore[j]->sig);
1130#else
1132#endif
1133 sem_acquired[j]--;
1134 }
1135 }
1136 }
1137#endif // HAVE_SIMPLEIPC
1138 monitor(NULL,0);
1139#ifdef PAGE_TEST
1140 mmEndStat();
1141#endif
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 }
1178 {
1179 if (i<=0)
1180 {
1181 //extern long all_farey;
1182 //extern long farey_cnt;
1183 //if (all_farey!=0L) printf("farey:%ld, cnt=%ld\n",all_farey,farey_cnt);
1184 if (TEST_V_QUIET)
1185 {
1186 if (i==0)
1187 printf("Auf Wiedersehen.\n");
1188 else
1189 printf("\n$Bye.\n");
1190 }
1191 //#ifdef sun
1192 // #ifndef __svr4__
1193 // _cleanup();
1194 // _exit(0);
1195 // #endif
1196 //#endif
1197 i=0;
1198 }
1199 else
1200 {
1201 printf("\nhalt %d\n",i);
1202 }
1203 }
1204 exit(i);
1205 }
1206}
int BOOLEAN
Definition auxiliary.h:87
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:416
#define IDTYP(a)
Definition ipid.h:119
volatile BOOLEAN m2_end_called
Definition misc_ip.cc:1098
#define TEST_V_QUIET
Definition options.h:133
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 1211 of file misc_ip.cc.

1212 {
1213 fprintf(stderr, "\nSingular error: no more memory\n");
1215 m2_end(14);
1216 /* should never get here */
1217 exit(1);
1218 }
void m2_end(int i)
Definition misc_ip.cc:1100
#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 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 357 of file misc_ip.cc.

358{
359 int i;
360 int index=0;
362 lists primes = (lists)omAllocBin(slists_bin); primes->Init(1000);
363 int* multiplicities = (int*)omAlloc0(1000*sizeof(int));
364 int positive=1;
365
366 if (!n_IsZero(n, coeffs_BIGINT))
367 {
369 {
370 positive=-1;
371 mpz_neg(nn,nn);
372 }
374 }
375
377 primesL->Init(index);
378 for (i = 0; i < index; i++)
379 {
380 primesL->m[i].rtyp = primes->m[i].rtyp;
381 primesL->m[i].data = primes->m[i].data;
382 primes->m[i].rtyp=0;
383 primes->m[i].data=NULL;
384 }
385 primes->Clean(NULL);
386
388 multiplicitiesL->Init(index);
389 for (i = 0; i < index; i++)
390 {
391 multiplicitiesL->m[i].rtyp = INT_CMD;
392 multiplicitiesL->m[i].data = (void*)(long)multiplicities[i];
393 }
395
397 L->Init(3);
398 if (positive==-1) mpz_neg(nn,nn);
399 L->m[0].rtyp = LIST_CMD; L->m[0].data = (void*)primesL;
400 L->m[1].rtyp = LIST_CMD; L->m[1].data = (void*)multiplicitiesL;
401 setListEntry(L, 2, nn);
402
403 mpz_clear(nn);
404
405 return L;
406}
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:980
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:498
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50
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:327
slists * lists
#define omAllocBin(bin)
#define omFree(addr)
@ LIST_CMD
Definition tok.h:118

◆ setListEntry()

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

Definition at line 74 of file misc_ip.cc.

75{ /* assumes n > 0 */
76 /* try to fit nn into an int: */
77 if (mpz_size1(n)<=1)
78 {
79 int ui=(int)mpz_get_si(n);
80 if ((((ui<<3)>>3)==ui)
81 && (mpz_cmp_si(n,(long)ui)==0))
82 {
83 L->m[index].rtyp = INT_CMD; L->m[index].data = (void*)(long)ui;
84 return;
85 }
86 }
88 L->m[index].rtyp = BIGINT_CMD; L->m[index].data = (void*)nn;
89}
static FORCE_INLINE number mpz2number(mpz_t m, coeffs c)
Definition coeffs.h:981
#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 91 of file misc_ip.cc.

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

◆ setOption()

BOOLEAN setOption ( leftv  res,
leftv  v 
)

Definition at line 568 of file misc_ip.cc.

569{
570 const char *n;
571 do
572 {
573 if (v->Typ()==STRING_CMD)
574 {
575 n=(const char *)v->CopyD(STRING_CMD);
576 }
577 else
578 {
579 if (v->name==NULL)
580 return TRUE;
581 if (v->rtyp==0)
582 {
583 n=v->name;
584 v->name=NULL;
585 }
586 else
587 {
588 n=omStrDup(v->name);
589 }
590 }
591
592 int i;
593
594 if(strcmp(n,"get")==0)
595 {
596 intvec *w=new intvec(2);
597 (*w)[0]=si_opt_1;
598 (*w)[1]=si_opt_2;
599 res->rtyp=INTVEC_CMD;
600 res->data=(void *)w;
601 goto okay;
602 }
603 if(strcmp(n,"set")==0)
604 {
605 if((v->next!=NULL)
606 &&(v->next->Typ()==INTVEC_CMD))
607 {
608 v=v->next;
609 intvec *w=(intvec*)v->Data();
610 si_opt_1=(*w)[0];
611 si_opt_2=(*w)[1];
612#if 0
616 ) {
617 si_opt_1 &=~Sy_bit(OPT_INTSTRATEGY);
618 }
619#endif
620 goto okay;
621 }
622 }
623 if(strcmp(n,"none")==0)
624 {
625 si_opt_1=0;
626 si_opt_2=0;
627 goto okay;
628 }
629 for (i=0; (i==0) || (optionStruct[i-1].setval!=0); i++)
630 {
631 if (strcmp(n,optionStruct[i].name)==0)
632 {
633 if (optionStruct[i].setval & validOpts)
634 {
635 si_opt_1 |= optionStruct[i].setval;
636 // optOldStd disables redthrough
637 if (optionStruct[i].setval == Sy_bit(OPT_OLDSTD))
639 }
640 else
641 WarnS("cannot set option");
642#if 0
646 ) {
647 test &=~Sy_bit(OPT_INTSTRATEGY);
648 }
649#endif
650 goto okay;
651 }
652 else if ((strncmp(n,"no",2)==0)
653 && (strcmp(n+2,optionStruct[i].name)==0))
654 {
655 if (optionStruct[i].setval & validOpts)
656 {
657 si_opt_1 &= optionStruct[i].resetval;
658 }
659 else
660 WarnS("cannot clear option");
661 goto okay;
662 }
663 }
664 for (i=0; (i==0) || (verboseStruct[i-1].setval!=0); i++)
665 {
666 if (strcmp(n,verboseStruct[i].name)==0)
667 {
668 si_opt_2 |= verboseStruct[i].setval;
669 #ifdef YYDEBUG
670 #if YYDEBUG
671 /*debugging the bison grammar --> grammar.cc*/
673 if (BVERBOSE(V_YACC)) yydebug=1;
674 else yydebug=0;
675 #endif
676 #endif
677 goto okay;
678 }
679 else if ((strncmp(n,"no",2)==0)
680 && (strcmp(n+2,verboseStruct[i].name)==0))
681 {
682 si_opt_2 &= verboseStruct[i].resetval;
683 #ifdef YYDEBUG
684 #if YYDEBUG
685 /*debugging the bison grammar --> grammar.cc*/
687 if (BVERBOSE(V_YACC)) yydebug=1;
688 else yydebug=0;
689 #endif
690 #endif
691 goto okay;
692 }
693 }
694 Werror("unknown option `%s`",n);
695 okay:
696 if (currRing != NULL)
699 v=v->next;
700 } while (v!=NULL);
701
702 // set global variable to show memory usage
704 else om_sing_opt_show_mem = 0;
705
706 return FALSE;
707}
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:538
const struct soptionStruct optionStruct[]
Definition misc_ip.cc:507
#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:92
#define TEST_OPT_INTSTRATEGY
Definition options.h:110
#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:82
#define Sy_bit(x)
Definition options.h:31
#define TEST_RINGDEP_OPTS
Definition options.h:100
#define OPT_OLDSTD
Definition options.h:86
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:553
#define rField_is_Ring(R)
Definition ring.h:490
@ INTVEC_CMD
Definition tok.h:101

◆ showOption()

char * showOption ( )

Definition at line 709 of file misc_ip.cc.

710{
711 int i;
712 BITSET tmp;
713
714 StringSetS("//options:");
715 if ((si_opt_1!=0)||(si_opt_2!=0))
716 {
718 if(tmp)
719 {
720 for (i=0; optionStruct[i].setval!=0; i++)
721 {
722 if (optionStruct[i].setval & tmp)
723 {
725 tmp &=optionStruct[i].resetval;
726 }
727 }
728 for (i=0; i<32; i++)
729 {
730 if (tmp & Sy_bit(i)) StringAppend(" %d",i);
731 }
732 }
734 if (tmp)
735 {
736 for (i=0; verboseStruct[i].setval!=0; i++)
737 {
738 if (verboseStruct[i].setval & tmp)
739 {
741 tmp &=verboseStruct[i].resetval;
742 }
743 }
744 for (i=1; i<32; i++)
745 {
746 if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
747 }
748 }
749 return StringEndS();
750 }
751 StringAppendS(" none");
752 return StringEndS();
753}
#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
#define BITSET
Definition structs.h:16

◆ siInit()

void siInit ( char name)

Definition at line 1373 of file misc_ip.cc.

1374{
1375// memory initialization: -----------------------------------------------
1376 om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
1377#ifndef OM_NDEBUG
1378#ifndef __OPTIMIZE__
1379 om_Opts.ErrorHook = dErrorBreak;
1380#else
1381 om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
1382#endif
1383#else
1384 om_Opts.Keep = 0; /* OM_NDEBUG */
1385#endif
1386 omInitInfo();
1387// factory
1388#ifndef HAVE_NTL
1389 extern void initPT();
1390 initPT();
1391#endif
1392// options ---------------------------------------------------------------
1393 si_opt_1=0;
1394// interpreter tables etc.: -----------------------------------------------
1395 memset(&sLastPrinted,0,sizeof(sleftv));
1397
1398 extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
1399
1400 basePack=(package)omAlloc0(sizeof(*basePack));
1402 idhdl h;
1403 h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
1405 IDPACKAGE(h)->language = LANG_TOP;
1406 currPackHdl=h;
1407 basePackHdl=h;
1408
1409 coeffs_BIGINT = nInitChar(n_Q,(void*)1);
1410
1411#if 1
1412 // def HAVE_POLYEXTENSIONS
1413 if(TRUE)
1414 {
1415 n_coeffType type;
1416 #ifdef SINGULAR_4_2
1418 assume(type == n_polyExt);
1419 #endif
1420
1421 type = nRegister(n_algExt, naInitChar);
1422 assume(type == n_algExt);
1423
1425 assume(type == n_transExt);
1426
1427 (void)type;
1428 }
1429#endif
1430
1431// random generator: -----------------------------------------------
1432 int t=initTimer();
1433 if (t==0) t=1;
1434 initRTimer();
1435 siSeed=t;
1436 factoryseed(t);
1437 siRandomStart=t;
1438 feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
1439
1440// ressource table: ----------------------------------------------------
1441 // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
1442 // hack such that all shared' libs in the bindir are loaded correctly
1444
1445// singular links: --------------------------------------------------
1447 myynest=0;
1448// how many processes ? -----------------------------------------------------
1449 int cpus=2;
1450 int cpu_n;
1451 #ifdef _SC_NPROCESSORS_ONLN
1453 #elif defined(_SC_NPROCESSORS_CONF)
1455 #endif
1457// how many threads ? -----------------------------------------------------
1459
1460// default coeffs
1461 {
1462 idhdl h;
1463 h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1464 IDDATA(h)=(char*)nInitChar(n_Q,NULL);
1465 h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1466 IDDATA(h)=(char*)nInitChar(n_Z,NULL);
1468 iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
1469 iiAddCproc("kernel","Float",FALSE,iiFloat);
1470 //h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1471 //IDDATA(h)=(char*)nInitChar(n_R,NULL);
1472 //h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1473 //IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
1474 }
1475// setting routines for PLURAL QRINGS:
1476// allowing to use libpolys without libSingular(kStd)
1477#ifdef HAVE_PLURAL
1478 nc_NF=k_NF;
1484#endif
1485// loading standard.lib -----------------------------------------------
1487 {
1490 si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
1491 iiLibCmd("standard.lib", TRUE,TRUE,TRUE);
1493 }
1494 // interpreter error handling
1495 #ifndef __CYGWIN__
1496 factoryError=callWerrorS; // to honour later changes of variable WerrorS
1497 #endif
1498 errorreported = 0;
1499}
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition algext.cc:1388
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition algext.cc:1642
void initPT()
void factoryseed(int s)
random seed initializer
Definition cf_random.cc:189
VAR void(* factoryError)(const char *s)
Definition cf_util.cc:80
VAR int siRandomStart
Definition cntrlc.cc:93
n_coeffType
Definition coeffs.h:27
@ n_polyExt
used to represent polys as coeffcients
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
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_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition gr_kstd2.cc:1283
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
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition iparith.cc:9978
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:281
VAR idhdl currPackHdl
Definition ipid.cc:55
VAR idhdl basePackHdl
Definition ipid.cc:56
#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:893
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
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
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
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:3438
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition misc_ip.cc:1338
void omSingOutOfMemoryFunc()
Definition misc_ip.cc:1211
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition misc_ip.cc:1309
static void callWerrorS(const char *s)
Definition misc_ip.cc:1372
void dErrorBreak(void)
#define assume(x)
Definition mod2.h:387
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:43
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
@ LANG_TOP
Definition subexpr.h:22
int initTimer()
Definition timer.cc:67
void initRTimer()
Definition timer.cc:156
@ 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 430 of file misc_ip.cc.

431{
432 assume(str!=NULL);
433 char *s=str;
434 while (*s==' ') s++;
435 char *ss=s;
436 while (*ss!='\0') ss++;
437 while (*ss<=' ')
438 {
439 *ss='\0';
440 ss--;
441 }
442 idhdl h=IDROOT->get_level(s,0);
443 if ((h!=NULL) && (IDTYP(h)==PROC_CMD))
444 {
445 char *lib=iiGetLibName(IDPROC(h));
446 if((lib!=NULL)&&(*lib!='\0'))
447 {
448 Print("// proc %s from lib %s\n",s,lib);
450 if (s!=NULL)
451 {
452 if (strlen(s)>5)
453 {
454 iiEStart(s,IDPROC(h));
455 omFree((ADDRESS)s);
456 return;
457 }
458 else omFree((ADDRESS)s);
459 }
460 }
461 }
462 else
463 {
464 char sing_file[MAXPATHLEN];
465 FILE *fd=NULL;
466 char *res_m=feResource('m', 0);
467 if (res_m!=NULL)
468 {
469 snprintf(sing_file,MAXPATHLEN, "%s/%s.sing", res_m, s);
470 fd = feFopen(sing_file, "r");
471 }
472 if (fd != NULL)
473 {
474
475 int old_echo = si_echo;
476 int length, got;
477 char* s;
478
479 fseek(fd, 0, SEEK_END);
480 length = ftell(fd);
481 fseek(fd, 0, SEEK_SET);
482 s = (char*) omAlloc((length+20)*sizeof(char));
483 got = fread(s, sizeof(char), length, fd);
484 fclose(fd);
485 if (got != length)
486 {
487 Werror("Error while reading file %s", sing_file);
488 }
489 else
490 {
491 s[length] = '\0';
492 strcat(s, "\n;return();\n\n");
493 si_echo = 2;
494 iiEStart(s, NULL);
496 }
497 omFree(s);
498 }
499 else
500 {
501 Werror("no example for %s", str);
502 }
503 }
504}
#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:762
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:113
#define SEEK_END
Definition mod2.h:109
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 1085 of file misc_ip.cc.

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

◆ versionString()

char * versionString ( )

Definition at line 770 of file misc_ip.cc.

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

Variable Documentation

◆ add

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

Definition at line 107 of file misc_ip.cc.

107{4, 2, 4, 2, 4, 6, 2, 6};

◆ m2_end_called

volatile BOOLEAN m2_end_called = FALSE

Definition at line 1098 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) },
{"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:80
#define OPT_PROT
Definition options.h:75
#define OPT_INFREDTAIL
Definition options.h:94
#define OPT_WEIGHTM
Definition options.h:97
#define OPT_REDTAIL_SYZ
Definition options.h:87
#define OPT_REDTAIL
Definition options.h:91
#define OPT_RETURN_SB
Definition options.h:84
#define OPT_NOT_SUGAR
Definition options.h:78
#define OPT_REDSB
Definition options.h:76
#define OPT_NOTREGULARITY
Definition options.h:96
#define OPT_DEBUG
Definition options.h:81
#define OPT_MULTBOUND
Definition options.h:89
#define OPT_STAIRCASEBOUND
Definition options.h:88
#define OPT_INTERRUPT
Definition options.h:79
#define OPT_DEGBOUND
Definition options.h:90
#define OPT_NOT_BUCKETS
Definition options.h:77
#define OPT_FASTHC
Definition options.h:85
#define OPT_NO_SYZ_MINIM
Definition options.h:83

Definition at line 507 of file misc_ip.cc.

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

◆ 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)},
{"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_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 538 of file misc_ip.cc.

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