43 #if GOOGLE_PROFILE_ENABLED
44 #include <google/profiler.h>
45 #endif // #if GOOGLE_PROFILE_ENABLED
70 static inline
void NoReturn(
leftv&
res)
81 const char *usage =
"'ClearContent' needs a (non-zero!) poly or vector argument...";
127 const char *usage =
"'ClearDenominators' needs a (non-zero!) poly or vector argument...";
178 Warn(
"Negative (%d) optional integer argument", n);
195 #if GOOGLE_PROFILE_ENABLED
198 const char*
name = (
char*)(h->
Data());
202 WerrorS(
"ProfilerStart requires a string [name] argument");
204 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLE!=1)...");
206 #endif // #if GOOGLE_PROFILE_ENABLED
213 #if GOOGLE_PROFILE_ENABLED
216 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLED!=1)...");
218 #endif // #if GOOGLE_PROFILE_ENABLED
233 Print (
"intvec: {rows: %d, cols: %d, length: %d, Values: \n", v->
rows(), v->
cols(), v->
length());
235 for (
int i = 0;
i < v->
rows();
i++)
238 for (
int j = 0;
j < v->
cols();
j++)
255 WarnS(
"DetailedPrint needs an argument...");
261 number
n = (number)h->
Data();
277 const ring
r = (
const ring)h->
Data();
313 Print(
"RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr));
PrintLn();
320 const int iLength = syzstr->
length;
328 #define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \
329 if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \
336 #undef PRINT_pINTVECTOR
339 Print(
"ring '%10s': NULL",
"syRing");
342 Print(
"ring '%10s': currRing",
"syRing");
344 if (r !=
NULL && r != save)
346 Print(
"ring '%10s': ",
"syRing");
356 Print(
"SRes 'resPairs': %p", reinterpret_cast<const void*>(rP));
PrintLn();
359 for (
int iLevel = 0; (iLevel < iLength) && (rP[iLevel] !=
NULL) && ((*syzstr->
Tl)[iLevel] >= 0); iLevel++)
362 const int iTl = (*syzstr->
Tl)[iLevel];
363 for (
int j = 0; (
j < iTl) && ((rP[iLevel][
j].
lcm!=
NULL) || (rP[iLevel][
j].syz!=
NULL));
j++)
365 if (rP[iLevel][
j].isNotMinimal==
NULL)
368 Print(
"minimal-resPairs-Size[1+%d]: %d", iLevel, n);
PrintLn();
373 #define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \
374 if ((s)->v != NULL) \
375 for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \
378 Print("id '%10s'[%d]: (%p) ncols = %d / size: %d; nrows = %d, rank = %ld / rk: %ld", #v, iLevel, reinterpret_cast<const void*>(((s)->v)[iLevel]), ((s)->v)[iLevel]->ncols, idSize(((s)->v)[iLevel]), ((s)->v)[iLevel]->nrows, ((s)->v)[iLevel]->rank, -1L ); \
391 #undef PRINT_RESOLUTION
393 #define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();
411 PrintS(
"resolution 'fullres': (NULL) => resolution not computed yet");
415 Print(
"resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->
fullres));
425 PrintS(
"resolution 'minres': (NULL) => resolution not minimized yet");
429 Print(
"resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->
minres));
471 WarnS(
"Tail needs a poly/vector/ideal/module argument...");
499 WarnS(
"Tail needs a single poly/vector/ideal/module argument...");
520 WarnS(
"ComputeLeadingSyzygyTerms needs an argument...");
534 PrintS(
"ComputeLeadingSyzygyTerms::Input: \n");
548 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument...");
572 WarnS(
"Sort_c_ds needs an argument...");
589 PrintS(
"Sort_c_ds::Input: \n");
604 PrintS(
"Sort_c_ds::Output: \n");
612 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument (must be a variable!)...");
632 WarnS(
"Compute2LeadingSyzygyTerms needs an argument...");
648 PrintS(
"Compute2LeadingSyzygyTerms::Input: \n");
660 WarnS(
"Compute2LeadingSyzygyTerms needs a single ideal/module argument...");
677 const char* usage =
"`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected";
726 if(
LIKELY( OPT__TAILREDSYZ) )
734 PrintS(
"FindReducer(product, syzterm, L, T, #)::Input: \n");
755 PrintS(
"FindReducer::Output: \n");
774 const char* usage =
"`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
830 if(
LIKELY( OPT__TAILREDSYZ) )
838 PrintS(
"SchreyerSyzygyNF(syz_lead, syz_2, L, T, #)::Input: \n");
857 (syz_2!=
NULL)?
p_Copy(syz_2, r): syz_2, L, T, LS, attributes);
861 PrintS(
"SchreyerSyzygyNF::Output: ");
883 const char* usage =
"`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected";
951 if(
LIKELY( OPT__TAILREDSYZ) )
959 PrintS(
"ReduceTerm(m, t, syzterm, L, T, #)::Input: \n");
980 const int c =
p_GetComp(syztermCheck, r) - 1;
983 const poly p = L->m[c];
1000 res->
data =
ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, attributes);
1005 PrintS(
"ReduceTerm::Output: ");
1028 const char* usage =
"`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
1084 if(
LIKELY( OPT__TAILREDSYZ) )
1092 PrintS(
"TraverseTail(m, t, L, T, #)::Input: \n");
1115 PrintS(
"TraverseTail::Output: ");
1129 const char* usage =
"`ComputeResolution(<ideal/module>, <same as before>, <same as before>[,int])` expected";
1141 const int type = h->
Typ();
1176 length = (long)(h->
Data());
1183 length = 1 +
rVar(r);
1187 PrintS(
"ComputeResolution(M, length)::Input: \n");
1188 Print(
"starting length: %ld\n", length);
1200 _res->
length = length + 1;
1208 while( (!
idIs0(L)) && (index < length))
1217 Print(
"ComputeResolution()::Separated Syzygy[%d]: \n", index);
1231 for(
int i = size-1;
i >= 0;
i-- )
1239 Print(
"ComputeResolution()::Restored Syzygy[%d]: \n", index);
1255 Print(
"ComputeResolution::Output (index: %d): ", index);
1281 const char* usage =
"`ComputeSyzygy(<ideal/module>, <ideal/module>)` expected";
1311 PrintS(
"ComputeSyzygy(L, T)::Input: \n");
1330 PrintS(
"ComputeSyzygy::Output: \nLL: \n");
1356 WerrorS(
"`leadmonom(<poly/vector>)` expected");
1376 const unsigned long iComp =
p_GetComp(p, r);
1389 WerrorS(
"`leadcomp(<poly/vector>)` expected");
1409 const int iExpSize = r->ExpL_Size;
1416 for(
int i = iExpSize-1;
i >= 0;
i--)
1423 res->
data =
reinterpret_cast<void *
>(
l);
1427 WerrorS(
"`leadrawexp(<poly/vector>)` expected");
1456 const int s = (
int)((
long)(h->
Data()));
1458 if( s != -1 && s != 1 )
1460 WerrorS(
"`MakeInducedSchreyerOrdering(<int>)` called with wrong integer argument (must be +-1)!");
1467 assume( sign == 1 || sign == -1 );
1484 WerrorS(
"`SetSyzComp(<int>)` called on incompatible ring (not created by 'MakeSyzCompOrdering'!)");
1493 const int iSyzComp = (
int)reinterpret_cast<long>(h->
Data());
1520 WerrorS(
"`GetInducedData([int])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1525 const int iLimit = r->typ[pos].data.is.limit;
1526 const ideal F = r->typ[pos].data.is.F;
1535 l->
m[0].
data =
reinterpret_cast<void *
>(iLimit);
1551 l->
m[1].
data =
reinterpret_cast<void *
>(FF);
1554 res->
data =
reinterpret_cast<void *
>(
l);
1566 BOOLEAN rGetAMPos(const ring r, const int p, int &typ_pos, int &wvhdl_pos, const BOOLEAN bSearchWvhdl = FALSE)
1569 Print("rGetAMPos(p: %d...)\nF:", p);
1579 int j = p; // Which IS record to use...
1580 for( int pos = 0; pos < r->OrdSize; pos++ )
1581 if( r->typ[pos].ord_typ == ro_am)
1588 const int nblocks = rBlocks(r) - 1;
1589 const int* w = r->typ[pos].data.am.weights; // ?
1591 for( pos = 0; pos <= nblocks; pos ++ )
1592 if (r->order[pos] == ringorder_am)
1593 if( r->wvhdl[pos] == w )
1601 assume(wvhdl_pos >= 0);
1603 assume(typ_pos >= 0);
1611 // static BOOLEAN GetAMData(leftv res, leftv h)
1615 // const ring r = currRing;
1617 // int p = 0; // which IS-block? p^th!
1619 // if ((h!=NULL) && (h->Typ()==INT_CMD))
1620 // p = (int)((long)(h->Data())); h=h->next;
1626 // if( !rGetAMPos(r, p, d, w, TRUE) )
1628 // Werror("`GetAMData([int])`: no %d^th _am block-ordering!", p);
1632 // assume( r->typ[d].ord_typ == ro_am );
1633 // assume( r->order[w] == ringorder_am );
1636 // const short start = r->typ[d].data.am.start; // bounds of ordering (in E)
1637 // const short end = r->typ[d].data.am.end;
1638 // const short len_gen = r->typ[d].data.am.len_gen; // i>len_gen: weight(gen(i)):=0
1639 // const int *weights = r->typ[d].data.am.weights; // pointers into wvhdl field of length (end-start+1) + len_gen
1640 // // contents w_1,... w_n, len, mod_w_1, .. mod_w_len, 0
1642 // assume( weights == r->wvhdl[w] );
1645 // lists l=(lists)omAllocBin(slists_bin);
1648 // const short V = end-start+1;
1649 // intvec* ww_vars = new intvec(V);
1650 // intvec* ww_gens = new intvec(len_gen);
1652 // for (int i = 0; i < V; i++ )
1653 // (*ww_vars)[i] = weights[i];
1655 // assume( weights[V] == len_gen );
1657 // for (int i = 0; i < len_gen; i++ )
1658 // (*ww_gens)[i] = weights[i - V - 1];
1661 // l->m[0].rtyp = INTVEC_CMD;
1662 // l->m[0].data = reinterpret_cast<void *>(ww_vars);
1664 // l->m[1].rtyp = INTVEC_CMD;
1665 // l->m[1].data = reinterpret_cast<void *>(ww_gens);
1682 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` expected");
1710 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1728 PrintS(
"ISUpdateComponents:.... \n");
1750 WerrorS(
"`ISUpdateComponents(<module>, intvec, int)` expected");
1762 WerrorS(
"`reduce_syz(<poly/vector>!, <ideal/module>, <int>, [int])` expected");
1772 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>!, <int>, [int])` expected");
1782 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>, <int>!, [int])` expected");
1786 const int iSyzComp = (
int)((
long)(h->
Data())); h=h->
next;
1788 int iLazyReduce = 0;
1791 iLazyReduce = (
int)((long)(h->
Data()));
1793 res->
data = (
void *)kNFLength(M,
currRing->qideal, v, iSyzComp, iLazyReduce);
1811 WerrorS(
"`idPrepare(<module>)` expected");
1825 iComp = (
int)((
long)(h->
Data()));
1828 if( (!isSyz) && (-1 == posIS) )
1830 WerrorS(
"`idPrepare(<...>)` called on incompatible ring (not created by 'MakeSyzCompOrdering' or 'MakeInducedSchreyerOrdering'!)");
1885 res->
data =
reinterpret_cast<void *
>(J);
1894 WerrorS(
"`p_Content(<poly-var>)` expected");
1920 WerrorS(
"`m2_end([<int>])` expected");
1937 WerrorS(
"`NumberStatsInit([<int>])` expected");
1941 unsigned long v = 0;
1944 v = (
unsigned long)(h->
Data());
1958 WerrorS(
"`NumberStatsPrint([<string>])` expected");
1962 const char* msg =
NULL;
1965 msg = (
const char*)(h->
Data());
1978 #define ADD(C,D,E) \
1979 psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""), (char*)C, D, E);
Computation attribute storage.
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
#define PRINT_pINTVECTOR(s, v)
const CanonicalForm int s
static void view(const intvec *v)
void atSet(idhdl root, const char *name, void *data, int typ)
Class used for (list of) interpreter objects.
static BOOLEAN idPrepare(leftv res, leftv h)
Get raw syzygies (idPrepare)
static number jjLONG2N(long d)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
static void number_stats_Print(const char *const msg=NULL)
print out all counters
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
const int OPT__HYBRIDNF
Use the usual NF's S-poly reduction while dropping lower order terms 2 means - smart selection! ...
static BOOLEAN noop(leftv __res, leftv)
Compatiblity layer for legacy polynomial operations (over currRing)
ideal id_Copy(ideal h1, const ring r)
static BOOLEAN rIsSyzIndexRing(const ring r)
Detailed print for debugging.
static int rGetCurrSyzLimit(const ring r)
static BOOLEAN _ClearContent(leftv res, leftv h)
wrapper around n_ClearContent
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
static BOOLEAN Tail(leftv res, leftv h)
wrapper around p_Tail and id_Tail
intvec * ivCopy(const intvec *o)
static BOOLEAN SetSyzComp(leftv res, leftv h)
Returns old SyzCompLimit, can set new limit.
static BOOLEAN MakeSyzCompOrdering(leftv res, leftv)
Endowe the current ring with additional (leading) Syz-component ordering.
static int getOptionalInteger(const leftv &h, const int _n)
try to get an optional (simple) integer argument out of h or return the default value ...
END_NAMESPACE int SI_MOD_INIT() syzextra(SModulFunctions *psModulFunctions)
static BOOLEAN DetailedPrint(leftv __res, leftv h)
static BOOLEAN leadrawexp(leftv res, leftv h)
Get raw leading exponent vector.
void WerrorS(const char *s)
#define UNLIKELY(expression)
#define LIKELY(expression)
static BOOLEAN _ComputeResolution(leftv res, leftv h)
NF which uses pLength instead of pSize!
BOOLEAN idIsModule(ideal m, const ring r)
const int OPT__DEBUG
output all the intermediate states
static BOOLEAN GetInducedData(leftv res, leftv h)
?
static BOOLEAN _ProfilerStop(leftv __res, leftv)
static BOOLEAN leadcomp(leftv res, leftv h)
Get leading component.
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sign)
static poly p_Copy(poly p, const ring r)
returns a copy of p
const int OPT__TAILREDSYZ
Reduce syzygy tails wrt the leading syzygy terms.
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
void nextSyzygyLayer() const
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
static BOOLEAN _SchreyerSyzygyNF(leftv res, leftv h)
#define PRINT_RESOLUTION(s, v)
static BOOLEAN _p_Content(leftv res, leftv h)
Get raw syzygies (idPrepare)
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
Coefficient rings, fields and other domains suitable for Singular polynomials.
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
Concrete implementation of enumerators over polynomials.
static BOOLEAN _TraverseTail(leftv res, leftv h)
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
USING_NAMESPACE(SINGULARXXNAME::DEBUG) USING_NAMESPACE(SINGULARXXNAME
The main handler for Singular numbers which are suitable for Singular polynomials.
static BOOLEAN SetInducedReferrence(leftv res, leftv h)
Returns old SyzCompLimit, can set new limit.
void StringSetS(const char *st)
static BOOLEAN MakeInducedSchreyerOrdering(leftv res, leftv h)
Same for Induced Schreyer ordering (ordering on components is defined by sign!)
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
#define BEGIN_NAMESPACE_NONAME
BEGIN_NAMESPACE_SINGULARXX const ring const ring const int nTerms
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static BOOLEAN _ProfilerStart(leftv __res, leftv h)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
static BOOLEAN _NumberStatsInit(leftv res, leftv h)
BOOLEAN assumeStdFlag(leftv h)
void PrintS(const char *s)
void rWrite(ring r, BOOLEAN details)
void p_Content(poly ph, const ring r)
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static int index(p_Length length, p_Ord ord)
void rSetSyzComp(int k, const ring r)
INLINE_THIS void Init(int l=0)
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
const Variable & v
< [in] a sqrfree bivariate poly
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
char name(const Variable &v)
static BOOLEAN _ComputeLeadingSyzygyTerms(leftv res, leftv h)
static void number_stats_Init(const unsigned long defaultvalue=0)
set all counters to zero
static BOOLEAN _FindReducer(leftv res, leftv h)
proc SSFindReducer(def product, def syzterm, def L, def T, list #)
static BOOLEAN reduce_syz(leftv res, leftv h)
NF using length.
static BOOLEAN _Compute2LeadingSyzygyTerms(leftv res, leftv h)
static BOOLEAN _NumberStatsPrint(leftv res, leftv h)
static BOOLEAN _ClearDenominators(leftv res, leftv h)
wrapper around n_ClearDenominators
static BOOLEAN _ReduceTerm(leftv res, leftv h)
proc SSReduceTerm(poly m, def t, def syzterm, def L, def T, list #)
BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p)
Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r...
const ring m_rBaseRing
global base ring
static BOOLEAN _ComputeSyzygy(leftv res, leftv h)
module (LL, TT) = SSComputeSyzygy(L, T); Compute Syz(L ++ T) = N = LL ++ TT
static BOOLEAN _Sort_c_ds(leftv res, leftv h)
sorting wrt & reversing... change the input inplace!!!
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - ...
static BOOLEAN _m2_end(leftv res, leftv h)
static poly p_Add_q(poly p, poly q, const ring r)
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
static BOOLEAN _leadmonom(leftv res, leftv h)
Get leading term without a module component.
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
#define PRINT_POINTER(s, v)
static BOOLEAN ISUpdateComponents(leftv res, leftv h)