Loading...
Searching...
No Matches
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 1364 of file misc_ip.cc.

{
// memory initialization: -----------------------------------------------
om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;
#ifndef OM_NDEBUG
#ifndef __OPTIMIZE__
#ifndef MAKE_DISTRUBTION
om_Opts.ErrorHook = dErrorBreak;
#endif
#else
om_Opts.Keep = 0; /* !OM_NDEBUG, __OPTIMIZE__*/
#endif
#else
om_Opts.Keep = 0; /* OM_NDEBUG */
#endif
omInitInfo();
// factory
#ifndef HAVE_NTL
extern void initPT();
initPT();
#endif
{ // set cpus (in siInit), if SINGULAR_CPUS is set, set within the limits
char *env_cpu=getenv("SINGULAR_CPUS");
if (env_cpu!=NULL)
{
int cpu_n,cpus;
#ifdef _SC_NPROCESSORS_ONLN
if ((cpu_n=sysconf(_SC_NPROCESSORS_ONLN))>cpus) cpus=cpu_n;
#elif defined(_SC_NPROCESSORS_CONF)
if ((cpu_n=sysconf(_SC_NPROCESSORS_CONF))>cpus) cpus=cpu_n;
#endif
#ifdef HAVE_SIMPLEIPC
if (cpus>SIPC_MAX_SEMAPHORES) cpus=SIPC_MAX_SEMAPHORES;
#endif
int t=atoi(env_cpu);
if ((t>=0)&&(t<cpus)) cpus=t;
feSetOptValue(FE_OPT_CPUS, cpus);
// how many threads ? -----------------------------------------------------
feSetOptValue(FE_OPT_THREADS, cpus);
}
}
// options ---------------------------------------------------------------
si_opt_1=0;
// interpreter tables etc.: -----------------------------------------------
memset(&sLastPrinted,0,sizeof(sleftv));
sLastPrinted.rtyp=NONE;
extern int iiInitArithmetic(); iiInitArithmetic(); // iparith.cc
basePack=(package)omAlloc0(sizeof(*basePack));
currPack=basePack;
idhdl h;
h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, FALSE);
IDPACKAGE(h)=basePack;
IDPACKAGE(h)->language = LANG_TOP;
currPackHdl=h;
basePackHdl=h;
coeffs_BIGINT = nInitChar(n_Q,(void*)1);
#if 1
// def HAVE_POLYEXTENSIONS
if(TRUE)
{
n_coeffType type;
#ifdef SINGULAR_4_2
type = nRegister(n_polyExt, n2pInitChar);
assume(type == n_polyExt);
#endif
type = nRegister(n_algExt, naInitChar);
assume(type == n_algExt);
type = nRegister(n_transExt, ntInitChar);
assume(type == n_transExt);
(void)type;
}
#endif
// random generator: -----------------------------------------------
{
int t=startTimer();
if (t==0) t=1;
initRTimer();
siSeed=t;
factoryseed(t);
siRandomStart=t;
feOptSpec[FE_OPT_RANDOM].value = (void*) ((long)siRandomStart);
}
// ressource table: ----------------------------------------------------
// Don't worry: ifdef OM_NDEBUG, then all these calls are undef'ed
// hack such that all shared' libs in the bindir are loaded correctly
feInitResources(name);
// singular links: --------------------------------------------------
slStandardInit();
myynest=0;
// default coeffs
{
idhdl h;
h=enterid("QQ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
IDDATA(h)=(char*)nInitChar(n_Q,NULL);
h=enterid("ZZ",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
IDDATA(h)=(char*)nInitChar(n_Z,NULL);
nRegisterCfByName(nrnInitCfByName,n_Zn); // and n_Znm
iiAddCproc("kernel","crossprod",FALSE,iiCrossProd);
iiAddCproc("kernel","Float",FALSE,iiFloat);
//h=enterid("RR",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
//IDDATA(h)=(char*)nInitChar(n_R,NULL);
//h=enterid("CC",0/*level*/, CRING_CMD,&(basePack->idroot),FALSE /*init*/,FALSE /*search*/);
//IDDATA(h)=(char*)nInitChar(n_long_C,NULL);
}
// setting routines for PLURAL QRINGS:
// allowing to use libpolys without libSingular(kStd)
#ifdef HAVE_PLURAL
nc_NF=k_NF;
gnc_gr_bba=k_gnc_gr_bba;
gnc_gr_mora=k_gnc_gr_mora;
sca_bba=k_sca_bba;
sca_mora=k_sca_mora;
sca_gr_bba=k_sca_gr_bba;
#endif
// loading standard.lib -----------------------------------------------
if (! feOptValue(FE_OPT_NO_STDLIB))
{
BITSET save1,save2;
SI_SAVE_OPT(save1,save2);
si_opt_2 &= ~Sy_bit(V_LOAD_LIB);
iiLibCmd("standard.lib", TRUE,TRUE,TRUE);
SI_RESTORE_OPT(save1,save2);
}
// interpreter error handling
#ifndef __CYGWIN__
factoryError=callWerrorS; // to honour later changes of variable WerrorS
#endif
errorreported = 0;
}
naInitChar
BOOLEAN naInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition algext.cc:1433
n2pInitChar
BOOLEAN n2pInitChar(coeffs cf, void *infoStruct)
Definition algext.cc:1687
slStandardInit
void slStandardInit()
Definition asciiLink.cc:633
BITSET
#define BITSET
Definition auxiliary.h:85
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
initPT
void initPT()
factoryseed
void factoryseed(int s)
random seed initializer
Definition cf_random.cc:186
factoryError
VAR void(* factoryError)(const char *s)
Definition cf_util.cc:80
sleftv
Class used for (list of) interpreter objects.
Definition subexpr.h:83
siRandomStart
VAR int siRandomStart
Definition cntrlc.cc:99
n_coeffType
n_coeffType
Definition coeffs.h:27
n_polyExt
@ n_polyExt
used to represent polys as coefficients
Definition coeffs.h:34
n_Q
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
n_algExt
@ 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
@ n_Zn
only used if HAVE_RINGS is defined
Definition coeffs.h:44
n_transExt
@ 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
@ n_Z
only used if HAVE_RINGS is defined
Definition coeffs.h:43
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
name
char name(const Variable &v)
Definition factory.h:189
errorreported
VAR short errorreported
Definition feFopen.cc:23
feSetOptValue
const char * feSetOptValue(feOptIndex opt, char *optarg)
Definition feOpt.cc:154
feOptValue
static void * feOptValue(feOptIndex opt)
Definition feOpt.h:40
feOptSpec
EXTERN_VAR struct fe_option feOptSpec[]
Definition feOpt.h:17
feInitResources
void feInitResources(const char *argv0)
Definition feResource.cc:160
myynest
VAR int myynest
Definition febase.cc:41
getenv
char * getenv()
gnc_gr_bba
EXTERN_VAR BBA_Proc gnc_gr_bba
Definition gb_hack.h:10
gnc_gr_mora
EXTERN_VAR BBA_Proc gnc_gr_mora
Definition gb_hack.h:10
sca_gr_bba
EXTERN_VAR BBA_Proc sca_gr_bba
Definition gb_hack.h:10
nc_NF
EXTERN_VAR NF_Proc nc_NF
Definition gb_hack.h:9
sca_mora
EXTERN_VAR BBA_Proc sca_mora
Definition gb_hack.h:10
sca_bba
EXTERN_VAR BBA_Proc sca_bba
Definition gb_hack.h:10
k_gnc_gr_bba
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
k_gnc_gr_mora
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
iiInitArithmetic
int iiInitArithmetic()
initialisation of arithmetic structured data
Definition iparith.cc:9988
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:279
basePack
VAR package basePack
Definition ipid.cc:56
currPack
VAR package currPack
Definition ipid.cc:55
currPackHdl
VAR idhdl currPackHdl
Definition ipid.cc:53
basePackHdl
VAR idhdl basePackHdl
Definition ipid.cc:54
IDDATA
#define IDDATA(a)
Definition ipid.h:126
IDROOT
#define IDROOT
Definition ipid.h:19
IDPACKAGE
#define IDPACKAGE(a)
Definition ipid.h:139
iiAddCproc
int iiAddCproc(const char *libname, const char *procname, BOOLEAN pstatic, BOOLEAN(*func)(leftv res, leftv v))
Definition iplib.cc:1073
iiLibCmd
BOOLEAN iiLibCmd(const char *newlib, BOOLEAN autoexport, BOOLEAN tellerror, BOOLEAN force)
Definition iplib.cc:894
h
STATIC_VAR Poly * h
Definition janet.cc:971
k_sca_bba
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
k_sca_gr_bba
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
k_sca_mora
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:878
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:3443
iiCrossProd
static BOOLEAN iiCrossProd(leftv res, leftv args)
Definition misc_ip.cc:1329
omSingOutOfMemoryFunc
void omSingOutOfMemoryFunc()
Definition misc_ip.cc:1202
iiFloat
static BOOLEAN iiFloat(leftv res, leftv pnn)
Definition misc_ip.cc:1300
callWerrorS
static void callWerrorS(const char *s)
Definition misc_ip.cc:1363
dErrorBreak
void dErrorBreak(void)
Definition dError.cc:140
assume
#define assume(x)
Definition mod2.h:389
nRegisterCfByName
void nRegisterCfByName(cfInitCfByNameProc p, n_coeffType n)
Definition numbers.cc:631
nRegister
n_coeffType nRegister(n_coeffType n, cfInitCharProc p)
Definition numbers.cc:590
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
om_Opts
omOpts_t om_Opts
Definition omOpts.c:13
si_opt_2
VAR unsigned si_opt_2
Definition options.c:6
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition options.h:20
Sy_bit
#define Sy_bit(x)
Definition options.h:31
V_LOAD_LIB
#define V_LOAD_LIB
Definition options.h:47
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition options.h:23
coeffs_BIGINT
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
idhdl
idrec * idhdl
Definition ring.h:22
nrnInitCfByName
coeffs nrnInitCfByName(char *s, n_coeffType)
Definition rmodulon.cc:33
SIPC_MAX_SEMAPHORES
#define SIPC_MAX_SEMAPHORES
Definition simpleipc.h:10
siSeed
VAR int siSeed
Definition sirandom.c:30
package
ip_package * package
Definition structs.h:39
sLastPrinted
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
LANG_TOP
@ LANG_TOP
Definition subexpr.h:22
startTimer
int startTimer()
Definition timer.cc:66
initRTimer
void initRTimer()
Definition timer.cc:136
CRING_CMD
@ CRING_CMD
Definition tok.h:56
PACKAGE_CMD
@ PACKAGE_CMD
Definition tok.h:150
NONE
#define NONE
Definition tok.h:223
ntInitChar
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition transext.cc:2636
omInitInfo
#define omInitInfo()
Definition xalloc.h:228