My Project  UNKNOWN_GIT_VERSION
Functions
libsingular.h File Reference
#include "singularconfig.h"
#include "kernel/mod2.h"
#include "kernel/structs.h"
#include "kernel/polys.h"
#include "coeffs/numbers.h"
#include "kernel/oswrapper/feread.h"
#include "polys/monomials/ring.h"
#include "omalloc/omalloc.h"
#include "polys/clapsing.h"
#include "polys/monomials/maps.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/tgb.h"
#include "kernel/maps/gen_maps.h"
#include "kernel/preimage.h"
#include "polys/sparsmat.h"
#include "Singular/mod_lib.h"
#include "Singular/subexpr.h"
#include "Singular/tok.h"
#include "Singular/grammar.h"
#include "Singular/ipid.h"
#include "Singular/ipshell.h"
#include "Singular/attrib.h"
#include "Singular/blackbox.h"
#include "misc/options.h"

Go to the source code of this file.

Functions

void siInit (char *)
 

Function Documentation

◆ siInit()

void siInit ( char *  )

Definition at line 1321 of file misc_ip.cc.

1322 {
1323 // memory initialization: -----------------------------------------------
1324  om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
1325 #ifndef OM_NDEBUG
1326 #ifndef __OPTIMIZE__
1327  om_Opts.ErrorHook = dErrorBreak;
1328 #else
1329  om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
1330 #endif
1331 #else
1332  om_Opts.Keep = 0; /* OM_NDEBUG */
1333 #endif
1334  omInitInfo();
1335 
1336 // options ---------------------------------------------------------------
1337  si_opt_1=0;
1338 // interpreter tables etc.: -----------------------------------------------
1339  memset(&sLastPrinted,0,sizeof(sleftv));
1341 
1342  extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
1343 
1344  basePack=(package)omAlloc0(sizeof(*basePack));
1346  idhdl h;
1347  h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
1348  IDPACKAGE(h)=basePack;
1349  IDPACKAGE(h)->language = LANG_TOP;
1350  currPackHdl=h;
1351  basePackHdl=h;
1352 
1353  coeffs_BIGINT = nInitChar(n_Q,(void*)1);
1354 
1355 #if 1
1356  // def HAVE_POLYEXTENSIONS
1357  if(TRUE)
1358  {
1359  n_coeffType type;
1360  #ifdef SINGULAR_4_2
1361  type = nRegister(n_polyExt, n2pInitChar);
1362  assume(type == n_polyExt);
1363  #endif
1364 
1365  type = nRegister(n_algExt, naInitChar);
1366  assume(type == n_algExt);
1367 
1368  type = nRegister(n_transExt, ntInitChar);
1369  assume(type == n_transExt);
1370 
1371  (void)type;
1372  }
1373 #endif
1374 
1375 // random generator: -----------------------------------------------
1376  int t=initTimer();
1377  if (t==0) t=1;
1378  initRTimer();
1379  siSeed=t;
1380  factoryseed(t);
1381  siRandomStart=t;
1382  feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
1383 
1384 // ressource table: ----------------------------------------------------
1385  // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
1386  // hack such that all shared' libs in the bindir are loaded correctly
1388 
1389 // singular links: --------------------------------------------------
1390  slStandardInit();
1391  myynest=0;
1392 // how many processes ? -----------------------------------------------------
1393  int cpus=2;
1394  int cpu_n;
1395  #ifdef _SC_NPROCESSORS_ONLN
1396  if ((cpu_n=sysconf(_SC_NPROCESSORS_ONLN))>cpus) cpus=cpu_n;
1397  #elif defined(_SC_NPROCESSORS_CONF)
1398  if ((cpu_n=sysconf(_SC_NPROCESSORS_CONF))>cpus) cpus=cpu_n;
1399  #endif
1400  feSetOptValue(FE_OPT_CPUS, cpus);
1401 // how many threads ? -----------------------------------------------------
1402  feSetOptValue(FE_OPT_THREADS, cpus);
1403 
1404 // default coeffs
1405  {
1406  idhdl h;
1407  h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1408  IDDATA(h)=(char*)nInitChar(n_Q,NULL);
1409  h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1410  IDDATA(h)=(char*)nInitChar(n_Z,NULL);
1411  nRegisterCfByName(nrnInitCfByName,n_Zn); // and n_Znm
1412  iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
1413  iiAddCproc("kernel","Float",FALSE,iiFloat);
1414  //h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1415  //IDDATA(h)=(char*)nInitChar(n_R,NULL);
1416  //h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1417  //IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
1418  n_coeffType t;
1419 #ifdef SINGULAR_4_2
1420  t=nRegister(n_unknown,n_AEInitChar);
1421  if (t!=n_unknown)
1422  {
1423  h=enterid("AE",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1424  IDDATA(h)=(char*)nInitChar(t,NULL);
1425  }
1426  t=nRegister(n_unknown,n_QAEInitChar);
1427  if (t!=n_unknown)
1428  {
1429  h=enterid("QAE",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1430  IDDATA(h)=(char*)nInitChar(t,NULL);
1431  }
1432  n_pAE=nRegister(n_unknown,n_pAEInitChar);
1433  if (n_pAE!=n_unknown)
1434  {
1435  iiAddCproc("kernel","pAE",FALSE,ii_pAE_init);
1436  }
1437 #endif
1438  #ifdef HAVE_FLINT
1440  if (n_FlintQ!=n_unknown)
1441  {
1442  iiAddCproc("kernel","flintQ",FALSE,ii_FlintQ_init);
1444  }
1446  if (n_FlintZn!=n_unknown)
1447  {
1448  iiAddCproc("kernel","flintZn",FALSE,ii_FlintZn_init);
1450  }
1451  #endif
1452  }
1453 // setting routines for PLURAL QRINGS:
1454 // allowing to use libpolys without libSingular(kStd)
1455 #ifdef HAVE_PLURAL
1456  nc_NF=k_NF;
1462 #endif
1463 // loading standard.lib -----------------------------------------------
1464  if (! feOptValue(FE_OPT_NO_STDLIB))
1465  {
1466  BITSET save1,save2;
1467  SI_SAVE_OPT(save1,save2);
1468  si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
1469  iiLibCmd(omStrDup("standard.lib"), TRUE,TRUE,TRUE);
1470  SI_RESTORE_OPT(save1,save2);
1471  }
1472  errorreported = 0;
1473 }
FALSE
#define FALSE
Definition: auxiliary.h:94
feInitResources
void feInitResources(const char *argv0)
Definition: feResource.cc:170
n_Zn
@ n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:45
nrnInitCfByName
coeffs nrnInitCfByName(char *s, n_coeffType n)
Definition: rmodulon.cc:58
errorreported
short errorreported
Definition: feFopen.cc:23
CRING_CMD
@ CRING_CMD
Definition: tok.h:56
dErrorBreak
void dErrorBreak()
Definition: dError.cc:141
iiInitArithmetic
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition: iparith.cc:9075
nRegisterCfByName
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition: numbers.cc:580
LANG_TOP
@ LANG_TOP
Definition: subexpr.h:22
n_FlintQ
static n_coeffType n_FlintQ
Definition: misc_ip.cc:1228
naInitChar
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: algext.cc:1399
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:267
BITSET
#define BITSET
Definition: structs.h:18
NONE
#define NONE
Definition: tok.h:219
IDDATA
#define IDDATA(a)
Definition: ipid.h:121
omStrDup
#define omStrDup(s)
Definition: omAllocDecl.h:263
basePackHdl
idhdl basePackHdl
Definition: ipid.cc:58
gnc_gr_bba
BBA_Proc gnc_gr_bba
Definition: old.gring.cc:67
feSetOptValue
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition: feOpt.cc:150
V_LOAD_LIB
#define V_LOAD_LIB
Definition: options.h:47
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:350
n_Q
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:31
currPack
package currPack
Definition: ipid.cc:59
siRandomStart
int siRandomStart
Definition: cntrlc.cc:98
gnc_gr_mora
BBA_Proc gnc_gr_mora
Definition: gb_hack.h:10
sleftv
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
omInitInfo
void omInitInfo()
Definition: omStats.c:17
flintQ_InitChar
BOOLEAN flintQ_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Q.cc:563
factoryseed
void factoryseed(int s)
random seed initializer
Definition: cf_random.cc:176
n_coeffType
n_coeffType
Definition: coeffs.h:28
iiAddCproc
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1005
iiCrossProd
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition: misc_ip.cc:1287
nRegister
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition: numbers.cc:539
k_sca_gr_bba
ideal k_sca_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified Plural's Buchberger's algorithmus.
Definition: sca.cc:95
n_FlintZn
static n_coeffType n_FlintZn
Definition: misc_ip.cc:1227
initTimer
int initTimer()
Definition: timer.cc:69
iiFloat
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition: misc_ip.cc:1258
n_polyExt
@ n_polyExt
used to represent polys as coeffcients
Definition: coeffs.h:35
TRUE
#define TRUE
Definition: auxiliary.h:98
Sy_bit
#define Sy_bit(x)
Definition: options.h:32
omSingOutOfMemoryFunc
void omSingOutOfMemoryFunc()
Definition: misc_ip.cc:1199
k_NF
poly k_NF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
NOTE: this is just a wrapper which sets currRing for the actual kNF call.
Definition: kstd1.cc:3015
k_sca_bba
ideal k_sca_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Buchberger's algorithm.
Definition: sca.cc:368
IDROOT
#define IDROOT
Definition: ipid.h:18
h
static Poly * h
Definition: janet.cc:972
ii_FlintZn_init
static BOOLEAN ii_FlintZn_init(leftv res, leftv a)
Definition: misc_ip.cc:1229
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition: options.h:24
n_Z
@ n_Z
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
flintZn_InitChar
BOOLEAN flintZn_InitChar(coeffs cf, void *infoStruct)
Definition: flintcf_Zn.cc:488
myynest
int myynest
Definition: febase.cc:41
flintQInitCfByName
coeffs flintQInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Q.cc:535
n_transExt
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
ntInitChar
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2516
feOptSpec
struct fe_option feOptSpec[]
coeffs_BIGINT
coeffs coeffs_BIGINT
Definition: ipid.cc:52
idrec
Definition: idrec.h:35
sca_bba
BBA_Proc sca_bba
Definition: gb_hack.h:10
IDPACKAGE
#define IDPACKAGE(a)
Definition: ipid.h:134
sca_gr_bba
BBA_Proc sca_gr_bba
Definition: gb_hack.h:10
nc_NF
NF_Proc nc_NF
Definition: old.gring.cc:66
om_Opts
omOpts_t om_Opts
Definition: omOpts.c:11
k_sca_mora
ideal k_sca_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Modified modern Sinuglar Mora's algorithm.
Definition: sca.cc:885
PACKAGE_CMD
@ PACKAGE_CMD
Definition: tok.h:149
name
char name(const Variable &v)
Definition: factory.h:180
k_gnc_gr_mora
ideal k_gnc_gr_mora(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1291
sleftv::rtyp
int rtyp
Definition: subexpr.h:91
basePack
package basePack
Definition: ipid.cc:60
assume
#define assume(x)
Definition: mod2.h:390
sLastPrinted
sleftv sLastPrinted
Definition: subexpr.cc:52
NULL
#define NULL
Definition: omList.c:10
siSeed
int siSeed
Definition: sirandom.c:29
fe_option::value
void * value
Definition: fegetopt.h:93
ii_FlintQ_init
static BOOLEAN ii_FlintQ_init(leftv res, leftv a)
Definition: misc_ip.cc:1243
currPackHdl
idhdl currPackHdl
Definition: ipid.cc:57
k_gnc_gr_bba
ideal k_gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat, const ring _currRing)
Definition: gr_kstd2.cc:1032
initRTimer
void initRTimer()
Definition: timer.cc:158
sca_mora
BBA_Proc sca_mora
Definition: gb_hack.h:10
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition: options.h:21
feOptValue
static void * feOptValue(feOptIndex opt)
Definition: feOpt.h:40
iiLibCmd
BOOLEAN iiLibCmd(char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:826
n_unknown
@ n_unknown
Definition: coeffs.h:29
n2pInitChar
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition: algext.cc:1683
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:211
package
ip_package * package
Definition: structs.h:46
flintZnInitCfByName
coeffs flintZnInitCfByName(char *s, n_coeffType n)
Definition: flintcf_Zn.cc:434
si_opt_2
unsigned si_opt_2
Definition: options.c:6
n_algExt
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:36
si_opt_1
unsigned si_opt_1
Definition: options.c:5