43 #if GOOGLE_PROFILE_ENABLED 44 #include <google/profiler.h> 45 #endif // #if GOOGLE_PROFILE_ENABLED 67 static BOOLEAN id_IsModule(ideal
id, ring
r)
71 if( id->rank != 1 )
return TRUE;
77 for (
int j=0;
j<
l;
j++)
101 const char *usage =
"'ClearContent' needs a (non-zero!) poly or vector argument...";
147 const char *usage =
"'ClearDenominators' needs a (non-zero!) poly or vector argument...";
195 int n = (int)(
long)(h->
Data());
198 Warn(
"Negative (%d) optional integer argument", n);
215 #if GOOGLE_PROFILE_ENABLED 218 const char*
name = (
char*)(h->
Data());
222 WerrorS(
"ProfilerStart requires a string [name] argument");
224 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLE!=1)...");
226 #endif // #if GOOGLE_PROFILE_ENABLED 233 #if GOOGLE_PROFILE_ENABLED 236 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLED!=1)...");
238 #endif // #if GOOGLE_PROFILE_ENABLED 253 Print (
"intvec: {rows: %d, cols: %d, length: %d, Values: \n", v->
rows(), v->
cols(), v->
length());
255 for (
int i = 0;
i < v->
rows();
i++)
258 for (
int j = 0;
j < v->
cols();
j++)
275 WarnS(
"DetailedPrint needs an argument...");
281 number n = (number)h->
Data();
297 const ring
r = (
const ring)h->
Data();
317 const ideal
id = (
const ideal)h->
Data(); h = h->
Next();
333 Print(
"RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr));
PrintLn();
340 const int iLength = syzstr->
length;
348 #define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \ 349 if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \ 356 #undef PRINT_pINTVECTOR 359 Print(
"ring '%10s': NULL",
"syRing");
362 Print(
"ring '%10s': currRing",
"syRing");
364 if (r !=
NULL && r != save)
366 Print(
"ring '%10s': ",
"syRing");
376 Print(
"SRes 'resPairs': %p", reinterpret_cast<const void*>(rP));
PrintLn();
379 for (
int iLevel = 0; (iLevel < iLength) && (rP[iLevel] !=
NULL) && ((*syzstr->
Tl)[iLevel] >= 0); iLevel++)
382 const int iTl = (*syzstr->
Tl)[iLevel];
383 for (
int j = 0; (
j < iTl) && ((rP[iLevel][
j].
lcm!=
NULL) || (rP[iLevel][
j].syz!=
NULL));
j++)
385 if (rP[iLevel][
j].isNotMinimal==
NULL)
388 Print(
"minimal-resPairs-Size[1+%d]: %d", iLevel, n);
PrintLn();
393 #define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \ 394 if ((s)->v != NULL) \ 395 for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \ 398 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, IDELEMS(((s)->v)[iLevel]), ((s)->v)[iLevel]->nrows, ((s)->v)[iLevel]->rank, -1L ); \ 411 #undef PRINT_RESOLUTION 413 #define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); 431 PrintS(
"resolution 'fullres': (NULL) => resolution not computed yet");
435 Print(
"resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->
fullres));
445 PrintS(
"resolution 'minres': (NULL) => resolution not minimized yet");
449 Print(
"resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->
minres));
491 WarnS(
"Tail needs a poly/vector/ideal/module argument...");
519 WarnS(
"Tail needs a single poly/vector/ideal/module argument...");
540 WarnS(
"ComputeLeadingSyzygyTerms needs an argument...");
548 const ideal
id = (
const ideal)h->
Data();
554 PrintS(
"ComputeLeadingSyzygyTerms::Input: \n");
568 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument...");
592 WarnS(
"Sort_c_ds needs an argument...");
603 const ideal
id = (
const ideal)h->
Data();
609 PrintS(
"Sort_c_ds::Input: \n");
624 PrintS(
"Sort_c_ds::Output: \n");
632 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument (must be a variable!)...");
652 WarnS(
"Compute2LeadingSyzygyTerms needs an argument...");
662 const ideal
id = (
const ideal)h->
Data();
668 PrintS(
"Compute2LeadingSyzygyTerms::Input: \n");
680 WarnS(
"Compute2LeadingSyzygyTerms needs a single ideal/module argument...");
697 const char* usage =
"`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected";
733 const ideal L = (ideal) h->
Data(); h = h->
Next();
741 LS = (ideal)h->
Data();
746 if(
LIKELY( OPT__TAILREDSYZ) )
754 PrintS(
"FindReducer(product, syzterm, L, T, #)::Input: \n");
775 PrintS(
"FindReducer::Output: \n");
794 const char* usage =
"`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
836 const ideal
T = (ideal) h->
Data();
845 LS = (ideal)h->
Data();
850 if(
LIKELY( OPT__TAILREDSYZ) )
858 PrintS(
"SchreyerSyzygyNF(syz_lead, syz_2, L, T, #)::Input: \n");
877 (syz_2!=
NULL)?
p_Copy(syz_2, r): syz_2, L, T, LS, attributes);
881 PrintS(
"SchreyerSyzygyNF::Output: ");
903 const char* usage =
"`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected";
957 const ideal
T = (ideal) h->
Data();
966 LS = (ideal)h->
Data();
971 if(
LIKELY( OPT__TAILREDSYZ) )
979 PrintS(
"ReduceTerm(m, t, syzterm, L, T, #)::Input: \n");
1000 const int c =
p_GetComp(syztermCheck, r) - 1;
1003 const poly p = L->m[c];
1020 res->
data =
ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, attributes);
1025 PrintS(
"ReduceTerm::Output: ");
1048 const char* usage =
"`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
1078 const ideal L = (ideal) h->
Data();
1089 const ideal
T = (ideal) h->
Data();
1099 LS = (ideal)h->
Data();
1104 if(
LIKELY( OPT__TAILREDSYZ) )
1112 PrintS(
"TraverseTail(m, t, L, T, #)::Input: \n");
1135 PrintS(
"TraverseTail::Output: ");
1149 const char* usage =
"`ComputeResolution(<ideal/module>, <same as before>, <same as before>[,int])` expected";
1161 const int type = h->
Typ();
1162 ideal
M = (ideal)(h->
CopyD());
1176 ideal L = (ideal)(h->
CopyD());
1186 ideal
T = (ideal)(h->
CopyD());
1196 length = (long)(h->
Data());
1203 length = 1 +
rVar(r);
1207 PrintS(
"ComputeResolution(M, length)::Input: \n");
1208 Print(
"starting length: %ld\n", length);
1220 _res->
length = length + 1;
1228 while( (!
idIs0(L)) && (index < length))
1237 Print(
"ComputeResolution()::Separated Syzygy[%d]: \n", index);
1251 for(
int i = size-1;
i >= 0;
i-- )
1259 Print(
"ComputeResolution()::Restored Syzygy[%d]: \n", index);
1275 Print(
"ComputeResolution::Output (index: %d): ", index);
1301 const char* usage =
"`ComputeSyzygy(<ideal/module>, <ideal/module>)` expected";
1312 const ideal L = (ideal) h->
Data();
1323 const ideal
T = (ideal) h->
Data();
1331 PrintS(
"ComputeSyzygy(L, T)::Input: \n");
1350 PrintS(
"ComputeSyzygy::Output: \nLL: \n");
1376 WerrorS(
"`leadmonom(<poly/vector>)` expected");
1396 const unsigned long iComp =
p_GetComp(p, r);
1409 WerrorS(
"`leadcomp(<poly/vector>)` expected");
1429 const int iExpSize = r->ExpL_Size;
1436 for(
int i = iExpSize-1;
i >= 0;
i--)
1443 res->
data =
reinterpret_cast<void *
>(
l);
1447 WerrorS(
"`leadrawexp(<poly/vector>)` expected");
1476 const int s = (int)((
long)(h->
Data()));
1478 if( s != -1 && s != 1 )
1480 WerrorS(
"`MakeInducedSchreyerOrdering(<int>)` called with wrong integer argument (must be +-1)!");
1487 assume( sign == 1 || sign == -1 );
1504 WerrorS(
"`SetSyzComp(<int>)` called on incompatible ring (not created by 'MakeSyzCompOrdering'!)");
1513 const int iSyzComp = (int)reinterpret_cast<long>(h->
Data());
1532 p = (int)((
long)(h->
Data())); h=h->
next;
1540 WerrorS(
"`GetInducedData([int])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1545 const int iLimit = r->typ[pos].data.is.limit;
1546 const ideal F = r->typ[pos].data.is.F;
1554 l->
m[0].
data =
reinterpret_cast<void *
>(iLimit);
1559 if( id_IsModule(FF, r) )
1570 l->
m[1].
data =
reinterpret_cast<void *
>(FF);
1573 res->
data =
reinterpret_cast<void *
>(
l);
1585 BOOLEAN rGetAMPos(const ring r, const int p, int &typ_pos, int &wvhdl_pos, const BOOLEAN bSearchWvhdl = FALSE)
1588 Print("rGetAMPos(p: %d...)\nF:", p);
1598 int j = p; // Which IS record to use...
1599 for( int pos = 0; pos < r->OrdSize; pos++ )
1600 if( r->typ[pos].ord_typ == ro_am)
1607 const int nblocks = rBlocks(r) - 1;
1608 const int* w = r->typ[pos].data.am.weights; // ?
1610 for( pos = 0; pos <= nblocks; pos ++ )
1611 if (r->order[pos] == ringorder_am)
1612 if( r->wvhdl[pos] == w )
1620 assume(wvhdl_pos >= 0);
1622 assume(typ_pos >= 0);
1630 // static BOOLEAN GetAMData(leftv res, leftv h)
1634 // const ring r = currRing;
1636 // int p = 0; // which IS-block? p^th!
1638 // if ((h!=NULL) && (h->Typ()==INT_CMD))
1639 // p = (int)((long)(h->Data())); h=h->next;
1645 // if( !rGetAMPos(r, p, d, w, TRUE) )
1647 // Werror("`GetAMData([int])`: no %d^th _am block-ordering!", p);
1651 // assume( r->typ[d].ord_typ == ro_am );
1652 // assume( r->order[w] == ringorder_am );
1655 // const short start = r->typ[d].data.am.start; // bounds of ordering (in E)
1656 // const short end = r->typ[d].data.am.end;
1657 // const short len_gen = r->typ[d].data.am.len_gen; // i>len_gen: weight(gen(i)):=0
1658 // const int *weights = r->typ[d].data.am.weights; // pointers into wvhdl field of length (end-start+1) + len_gen
1659 // // contents w_1,... w_n, len, mod_w_1, .. mod_w_len, 0
1661 // assume( weights == r->wvhdl[w] );
1664 // lists l=(lists)omAllocBin(slists_bin);
1667 // const short V = end-start+1;
1668 // intvec* ww_vars = new intvec(V);
1669 // intvec* ww_gens = new intvec(len_gen);
1671 // for (int i = 0; i < V; i++ )
1672 // (*ww_vars)[i] = weights[i];
1674 // assume( weights[V] == len_gen );
1676 // for (int i = 0; i < len_gen; i++ )
1677 // (*ww_gens)[i] = weights[i - V - 1];
1680 // l->m[0].rtyp = INTVEC_CMD;
1681 // l->m[0].data = reinterpret_cast<void *>(ww_vars);
1683 // l->m[1].rtyp = INTVEC_CMD;
1684 // l->m[1].data = reinterpret_cast<void *>(ww_gens);
1701 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` expected");
1705 const ideal F = (ideal)h->
Data(); ;
1712 rank = (int)((
long)(h->
Data())); h=h->
next;
1721 p = (int)((
long)(h->
Data())); h=h->
next;
1729 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1747 PrintS(
"ISUpdateComponents:.... \n");
1751 ideal F = (ideal)h->
Data(); ;
1761 const int MIN = (int)((
long)(h->
Data()));
1769 WerrorS(
"`ISUpdateComponents(<module>, intvec, int)` expected");
1781 WerrorS(
"`reduce_syz(<poly/vector>!, <ideal/module>, <int>, [int])` expected");
1791 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>!, <int>, [int])` expected");
1796 const ideal
M =
reinterpret_cast<ideal
>(h->
Data()); h=h->
next;
1801 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>, <int>!, [int])` expected");
1805 const int iSyzComp = (int)((
long)(h->
Data())); h=h->
next;
1807 int iLazyReduce = 0;
1810 iLazyReduce = (
int)((long)(h->
Data()));
1812 res->
data = (
void *)kNFLength(M,
currRing->qideal, v, iSyzComp, iLazyReduce);
1830 WerrorS(
"`idPrepare(<module>)` expected");
1834 const ideal I =
reinterpret_cast<ideal
>(h->
Data());
1844 iComp = (int)((
long)(h->
Data()));
1848 if( (!isSyz) && (-1 == posIS) )
1850 WerrorS(
"`idPrepare(<...>)` called on incompatible ring (not created by 'MakeSyzCompOrdering' or 'MakeInducedSchreyerOrdering'!)");
1905 res->
data =
reinterpret_cast<void *
>(J);
1914 WerrorS(
"`p_Content(<poly-var>)` expected");
1940 WerrorS(
"`m2_end([<int>])` expected");
1943 ret = (int)(
long)(h->
Data());
1957 WerrorS(
"`NumberStatsInit([<int>])` expected");
1961 unsigned long v = 0;
1964 v = (
unsigned long)(h->
Data());
1978 WerrorS(
"`NumberStatsPrint([<string>])` expected");
1982 const char* msg =
NULL;
1985 msg = (
const char*)(h->
Data());
1998 #define ADD(C,D,E) \ 1999 psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""), (char*)C, D, E);
Computation attribute storage.
USING_NAMESPACE(SINGULARXXNAME ::DEBUG) USING_NAMESPACE(SINGULARXXNAME
#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
static void NoReturn(leftv &res)
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)
copy an ideal
void nextSyzygyLayer() const
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
static short rVar(const ring r)
#define rVar(r) (r->N)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
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.
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
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)
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 - ...
#define LIKELY(expression)
static BOOLEAN _ComputeResolution(leftv res, leftv h)
NF which uses pLength instead of pSize!
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.
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.
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
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)
return the maximal component number found in any polynomial in s
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.
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
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
BEGIN_NAMESPACE_SINGULARXX const ring const ring const int nTerms
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)
char name(const Variable &v)
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)
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
INLINE_THIS void Init(int l=0)
#define rRing_has_Comp(r)
static void p_Delete(poly *p, const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
const Variable & v
< [in] a sqrfree bivariate poly
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
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 <c,ds> & reversing... change the input inplace!!!
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.
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
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)