My Project
Loading...
Searching...
No Matches
Functions
libsingular.h File Reference
#include "singularconfig.h"
#include "factory/globaldefs.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 "polys/shiftop.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 *  name)

Definition at line 1370 of file misc_ip.cc.

1371{
1372// memory initialization: -----------------------------------------------
1373 om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
1374#ifndef OM_NDEBUG
1375#ifndef __OPTIMIZE__
1376 om_Opts.ErrorHook = dErrorBreak;
1377#else
1378 om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
1379#endif
1380#else
1381 om_Opts.Keep = 0; /* OM_NDEBUG */
1382#endif
1383 omInitInfo();
1384// factory
1385#ifndef HAVE_NTL
1386 extern void initPT();
1387 initPT();
1388#endif
1389// options ---------------------------------------------------------------
1390 si_opt_1=0;
1391// interpreter tables etc.: -----------------------------------------------
1392 memset(&sLastPrinted,0,sizeof(sleftv));
1394
1395 extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
1396
1397 basePack=(package)omAlloc0(sizeof(*basePack));
1399 idhdl h;
1400 h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
1402 IDPACKAGE(h)->language = LANG_TOP;
1403 currPackHdl=h;
1404 basePackHdl=h;
1405
1406 coeffs_BIGINT = nInitChar(n_Q,(void*)1);
1407
1408#if 1
1409 // def HAVE_POLYEXTENSIONS
1410 if(TRUE)
1411 {
1412 n_coeffType type;
1413 #ifdef SINGULAR_4_2
1415 assume(type == n_polyExt);
1416 #endif
1417
1418 type = nRegister(n_algExt, naInitChar);
1419 assume(type == n_algExt);
1420
1422 assume(type == n_transExt);
1423
1424 (void)type;
1425 }
1426#endif
1427
1428// random generator: -----------------------------------------------
1429 int t=initTimer();
1430 if (t==0) t=1;
1431 initRTimer();
1432 siSeed=t;
1433 factoryseed(t);
1434 siRandomStart=t;
1435 feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
1436
1437// ressource table: ----------------------------------------------------
1438 // Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
1439 // hack such that all shared' libs in the bindir are loaded correctly
1441
1442// singular links: --------------------------------------------------
1444 myynest=0;
1445// how many processes ? -----------------------------------------------------
1446 int cpus=2;
1447 int cpu_n;
1448 #ifdef _SC_NPROCESSORS_ONLN
1449 if ((cpu_n=sysconf(_SC_NPROCESSORS_ONLN))>cpus) cpus=cpu_n;
1450 #elif defined(_SC_NPROCESSORS_CONF)
1451 if ((cpu_n=sysconf(_SC_NPROCESSORS_CONF))>cpus) cpus=cpu_n;
1452 #endif
1453 feSetOptValue(FE_OPT_CPUS, cpus);
1454// how many threads ? -----------------------------------------------------
1455 feSetOptValue(FE_OPT_THREADS, cpus);
1456
1457// default coeffs
1458 {
1459 idhdl h;
1460 h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1461 IDDATA(h)=(char*)nInitChar(n_Q,NULL);
1462 h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1463 IDDATA(h)=(char*)nInitChar(n_Z,NULL);
1465 iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
1466 iiAddCproc("kernel","Float",FALSE,iiFloat);
1467 //h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1468 //IDDATA(h)=(char*)nInitChar(n_R,NULL);
1469 //h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
1470 //IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
1471 }
1472// setting routines for PLURAL QRINGS:
1473// allowing to use libpolys without libSingular(kStd)
1474#ifdef HAVE_PLURAL
1475 nc_NF=k_NF;
1481#endif
1482// loading standard.lib -----------------------------------------------
1483 if (! feOptValue(FE_OPT_NO_STDLIB))
1484 {
1485 BITSET save1,save2;
1486 SI_SAVE_OPT(save1,save2);
1487 si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
1488 iiLibCmd("standard.lib", TRUE,TRUE,TRUE);
1489 SI_RESTORE_OPT(save1,save2);
1490 }
1491 // interpreter error handling
1492 #ifndef __CYGWIN__
1493 factoryError=callWerrorS; // to honour later changes of variable WerrorS
1494 #endif
1495 errorreported = 0;
1496}
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: algext.cc:1388
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition: algext.cc:1642
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
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
Definition: idrec.h:35
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int rtyp
Definition: subexpr.h:91
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
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:413
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)
Definition: feResource.cc:163
VAR int myynest
Definition: febase.cc:41
void * value
Definition: fegetopt.h:93
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:9738
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:279
VAR package basePack
Definition: ipid.cc:58
VAR package currPack
Definition: ipid.cc:57
VAR idhdl currPackHdl
Definition: ipid.cc:55
VAR idhdl basePackHdl
Definition: ipid.cc:56
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
#define IDDATA(a)
Definition: ipid.h:126
#define IDROOT
Definition: ipid.h:19
#define IDPACKAGE(a)
Definition: ipid.h:139
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition: iplib.cc:1063
BOOLEAN iiLibCmd(const char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition: iplib.cc:884
STATIC_VAR Poly * h
Definition: janet.cc:971
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:3396
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition: misc_ip.cc:1335
void omSingOutOfMemoryFunc()
Definition: misc_ip.cc:1208
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition: misc_ip.cc:1306
static void callWerrorS(const char *s)
Definition: misc_ip.cc:1369
void dErrorBreak(void)
#define assume(x)
Definition: mod2.h:389
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition: numbers.cc:636
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition: numbers.cc:595
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define NULL
Definition: omList.c:12
omOpts_t om_Opts
Definition: omOpts.c:13
VAR unsigned si_opt_2
Definition: options.c:6
VAR unsigned si_opt_1
Definition: options.c:5
#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:35
VAR int siSeed
Definition: sirandom.c:30
ip_package * package
Definition: structs.h:43
#define BITSET
Definition: structs.h:16
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
@ LANG_TOP
Definition: subexpr.h:22
int name
New type name for int.
Definition: templateForC.h:21
int initTimer()
Definition: timer.cc:67
void initRTimer()
Definition: timer.cc:156
@ CRING_CMD
Definition: tok.h:56
@ PACKAGE_CMD
Definition: tok.h:149
#define NONE
Definition: tok.h:221
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2636
#define omInitInfo()
Definition: xalloc.h:228