43 #if GOOGLE_PROFILE_ENABLED 44 #include <google/profiler.h> 45 #endif // #if GOOGLE_PROFILE_ENABLED 72 static
BOOLEAN id_IsModule(ideal
id, ring
r)
76 if( id->rank != 1 )
return TRUE;
82 for (
int j=0;
j<
l;
j++)
106 const char *usage =
"'ClearContent' needs a (non-zero!) poly or vector argument...";
152 const char *usage =
"'ClearDenominators' needs a (non-zero!) poly or vector argument...";
200 int n = (int)(
long)(h->
Data());
203 Warn(
"Negative (%d) optional integer argument", n);
220 #if GOOGLE_PROFILE_ENABLED 223 const char*
name = (
char*)(h->
Data());
227 WerrorS(
"ProfilerStart requires a string [name] argument");
229 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLE!=1)...");
231 #endif // #if GOOGLE_PROFILE_ENABLED 238 #if GOOGLE_PROFILE_ENABLED 241 WarnS(
"Sorry no google profiler support (GOOGLE_PROFILE_ENABLED!=1)...");
243 #endif // #if GOOGLE_PROFILE_ENABLED 258 Print (
"intvec: {rows: %d, cols: %d, length: %d, Values: \n", v->
rows(), v->
cols(), v->
length());
260 for (
int i = 0;
i < v->
rows();
i++)
263 for (
int j = 0;
j < v->
cols();
j++)
280 WarnS(
"DetailedPrint needs an argument...");
286 number n = (number)h->
Data();
302 const ring
r = (
const ring)h->
Data();
322 const ideal
id = (
const ideal)h->
Data(); h = h->
Next();
338 Print(
"RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr));
PrintLn();
345 const int iLength = syzstr->
length;
353 #define PRINT_pINTVECTOR(s, v) Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \ 354 if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \ 361 #undef PRINT_pINTVECTOR 364 Print(
"ring '%10s': NULL",
"syRing");
367 Print(
"ring '%10s': currRing",
"syRing");
369 if (r !=
NULL && r != save)
371 Print(
"ring '%10s': ",
"syRing");
381 Print(
"SRes 'resPairs': %p", reinterpret_cast<const void*>(rP));
PrintLn();
384 for (
int iLevel = 0; (iLevel < iLength) && (rP[iLevel] !=
NULL) && ((*syzstr->
Tl)[iLevel] >= 0); iLevel++)
387 const int iTl = (*syzstr->
Tl)[iLevel];
388 for (
int j = 0; (
j < iTl) && ((rP[iLevel][
j].
lcm!=
NULL) || (rP[iLevel][
j].syz!=
NULL));
j++)
390 if (rP[iLevel][
j].isNotMinimal==
NULL)
393 Print(
"minimal-resPairs-Size[1+%d]: %d", iLevel, n);
PrintLn();
398 #define PRINT_RESOLUTION(s, v) Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \ 399 if ((s)->v != NULL) \ 400 for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \ 403 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 ); \ 416 #undef PRINT_RESOLUTION 418 #define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); 436 PrintS(
"resolution 'fullres': (NULL) => resolution not computed yet");
440 Print(
"resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->
fullres));
450 PrintS(
"resolution 'minres': (NULL) => resolution not minimized yet");
454 Print(
"resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->
minres));
496 WarnS(
"Tail needs a poly/vector/ideal/module argument...");
524 WarnS(
"Tail needs a single poly/vector/ideal/module argument...");
545 WarnS(
"ComputeLeadingSyzygyTerms needs an argument...");
553 const ideal
id = (
const ideal)h->
Data();
559 PrintS(
"ComputeLeadingSyzygyTerms::Input: \n");
573 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument...");
597 WarnS(
"Sort_c_ds needs an argument...");
608 const ideal
id = (
const ideal)h->
Data();
614 PrintS(
"Sort_c_ds::Input: \n");
629 PrintS(
"Sort_c_ds::Output: \n");
637 WarnS(
"ComputeLeadingSyzygyTerms needs a single ideal/module argument (must be a variable!)...");
657 WarnS(
"Compute2LeadingSyzygyTerms needs an argument...");
667 const ideal
id = (
const ideal)h->
Data();
673 PrintS(
"Compute2LeadingSyzygyTerms::Input: \n");
685 WarnS(
"Compute2LeadingSyzygyTerms needs a single ideal/module argument...");
702 const char* usage =
"`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected";
738 const ideal L = (ideal) h->
Data(); h = h->
Next();
746 LS = (ideal)h->
Data();
751 if(
LIKELY( OPT__TAILREDSYZ) )
759 PrintS(
"FindReducer(product, syzterm, L, T, #)::Input: \n");
780 PrintS(
"FindReducer::Output: \n");
799 const char* usage =
"`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
841 const ideal
T = (ideal) h->
Data();
850 LS = (ideal)h->
Data();
855 if(
LIKELY( OPT__TAILREDSYZ) )
863 PrintS(
"SchreyerSyzygyNF(syz_lead, syz_2, L, T, #)::Input: \n");
882 (syz_2!=
NULL)?
p_Copy(syz_2, r): syz_2, L, T, LS, attributes);
886 PrintS(
"SchreyerSyzygyNF::Output: ");
908 const char* usage =
"`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected";
962 const ideal
T = (ideal) h->
Data();
971 LS = (ideal)h->
Data();
976 if(
LIKELY( OPT__TAILREDSYZ) )
984 PrintS(
"ReduceTerm(m, t, syzterm, L, T, #)::Input: \n");
1005 const int c =
p_GetComp(syztermCheck, r) - 1;
1008 const poly p = L->m[c];
1025 res->
data =
ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, attributes);
1030 PrintS(
"ReduceTerm::Output: ");
1053 const char* usage =
"`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
1083 const ideal L = (ideal) h->
Data();
1094 const ideal
T = (ideal) h->
Data();
1104 LS = (ideal)h->
Data();
1109 if(
LIKELY( OPT__TAILREDSYZ) )
1117 PrintS(
"TraverseTail(m, t, L, T, #)::Input: \n");
1140 PrintS(
"TraverseTail::Output: ");
1154 const char* usage =
"`ComputeResolution(<ideal/module>, <same as before>, <same as before>[,int])` expected";
1166 const int type = h->
Typ();
1167 ideal
M = (ideal)(h->
CopyD());
1181 ideal L = (ideal)(h->
CopyD());
1191 ideal
T = (ideal)(h->
CopyD());
1201 length = (long)(h->
Data());
1208 length = 1 +
rVar(r);
1212 PrintS(
"ComputeResolution(M, length)::Input: \n");
1213 Print(
"starting length: %ld\n", length);
1225 _res->
length = length + 1;
1233 while( (!
idIs0(L)) && (index < length))
1242 Print(
"ComputeResolution()::Separated Syzygy[%d]: \n", index);
1256 for(
int i = size-1;
i >= 0;
i-- )
1264 Print(
"ComputeResolution()::Restored Syzygy[%d]: \n", index);
1280 Print(
"ComputeResolution::Output (index: %d): ", index);
1306 const char* usage =
"`ComputeSyzygy(<ideal/module>, <ideal/module>)` expected";
1317 const ideal L = (ideal) h->
Data();
1328 const ideal
T = (ideal) h->
Data();
1336 PrintS(
"ComputeSyzygy(L, T)::Input: \n");
1355 PrintS(
"ComputeSyzygy::Output: \nLL: \n");
1381 WerrorS(
"`leadmonom(<poly/vector>)` expected");
1401 const unsigned long iComp =
p_GetComp(p, r);
1414 WerrorS(
"`leadcomp(<poly/vector>)` expected");
1434 const int iExpSize = r->ExpL_Size;
1441 for(
int i = iExpSize-1;
i >= 0;
i--)
1448 res->
data =
reinterpret_cast<void *
>(
l);
1452 WerrorS(
"`leadrawexp(<poly/vector>)` expected");
1481 const int s = (int)((
long)(h->
Data()));
1483 if( s != -1 && s != 1 )
1485 WerrorS(
"`MakeInducedSchreyerOrdering(<int>)` called with wrong integer argument (must be +-1)!");
1492 assume( sign == 1 || sign == -1 );
1509 WerrorS(
"`SetSyzComp(<int>)` called on incompatible ring (not created by 'MakeSyzCompOrdering'!)");
1518 const int iSyzComp = (int)reinterpret_cast<long>(h->
Data());
1537 p = (int)((
long)(h->
Data())); h=h->
next;
1545 WerrorS(
"`GetInducedData([int])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1550 const int iLimit = r->typ[pos].data.is.limit;
1551 const ideal F = r->typ[pos].data.is.F;
1559 l->
m[0].
data =
reinterpret_cast<void *
>(iLimit);
1564 if( id_IsModule(FF, r) )
1575 l->
m[1].
data =
reinterpret_cast<void *
>(FF);
1578 res->
data =
reinterpret_cast<void *
>(
l);
1590 BOOLEAN rGetAMPos(const ring r, const int p, int &typ_pos, int &wvhdl_pos, const BOOLEAN bSearchWvhdl = FALSE)
1593 Print("rGetAMPos(p: %d...)\nF:", p);
1603 int j = p; // Which IS record to use...
1604 for( int pos = 0; pos < r->OrdSize; pos++ )
1605 if( r->typ[pos].ord_typ == ro_am)
1612 const int nblocks = rBlocks(r) - 1;
1613 const int* w = r->typ[pos].data.am.weights; // ?
1615 for( pos = 0; pos <= nblocks; pos ++ )
1616 if (r->order[pos] == ringorder_am)
1617 if( r->wvhdl[pos] == w )
1625 assume(wvhdl_pos >= 0);
1627 assume(typ_pos >= 0);
1635 // static BOOLEAN GetAMData(leftv res, leftv h)
1639 // const ring r = currRing;
1641 // int p = 0; // which IS-block? p^th!
1643 // if ((h!=NULL) && (h->Typ()==INT_CMD))
1644 // p = (int)((long)(h->Data())); h=h->next;
1650 // if( !rGetAMPos(r, p, d, w, TRUE) )
1652 // Werror("`GetAMData([int])`: no %d^th _am block-ordering!", p);
1656 // assume( r->typ[d].ord_typ == ro_am );
1657 // assume( r->order[w] == ringorder_am );
1660 // const short start = r->typ[d].data.am.start; // bounds of ordering (in E)
1661 // const short end = r->typ[d].data.am.end;
1662 // const short len_gen = r->typ[d].data.am.len_gen; // i>len_gen: weight(gen(i)):=0
1663 // const int *weights = r->typ[d].data.am.weights; // pointers into wvhdl field of length (end-start+1) + len_gen
1664 // // contents w_1,... w_n, len, mod_w_1, .. mod_w_len, 0
1666 // assume( weights == r->wvhdl[w] );
1669 // lists l=(lists)omAllocBin(slists_bin);
1672 // const short V = end-start+1;
1673 // intvec* ww_vars = new intvec(V);
1674 // intvec* ww_gens = new intvec(len_gen);
1676 // for (int i = 0; i < V; i++ )
1677 // (*ww_vars)[i] = weights[i];
1679 // assume( weights[V] == len_gen );
1681 // for (int i = 0; i < len_gen; i++ )
1682 // (*ww_gens)[i] = weights[i - V - 1];
1685 // l->m[0].rtyp = INTVEC_CMD;
1686 // l->m[0].data = reinterpret_cast<void *>(ww_vars);
1688 // l->m[1].rtyp = INTVEC_CMD;
1689 // l->m[1].data = reinterpret_cast<void *>(ww_gens);
1706 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` expected");
1710 const ideal F = (ideal)h->
Data(); ;
1717 rank = (int)((
long)(h->
Data())); h=h->
next;
1726 p = (int)((
long)(h->
Data())); h=h->
next;
1734 WerrorS(
"`SetInducedReferrence(<ideal/module>, [int[, int]])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1752 PrintS(
"ISUpdateComponents:.... \n");
1756 ideal F = (ideal)h->
Data(); ;
1766 const int MIN = (int)((
long)(h->
Data()));
1774 WerrorS(
"`ISUpdateComponents(<module>, intvec, int)` expected");
1786 WerrorS(
"`reduce_syz(<poly/vector>!, <ideal/module>, <int>, [int])` expected");
1796 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>!, <int>, [int])` expected");
1801 const ideal
M =
reinterpret_cast<ideal
>(h->
Data()); h=h->
next;
1806 WerrorS(
"`reduce_syz(<poly/vector>, <ideal/module>, <int>!, [int])` expected");
1810 const int iSyzComp = (int)((
long)(h->
Data())); h=h->
next;
1812 int iLazyReduce = 0;
1815 iLazyReduce = (
int)((long)(h->
Data()));
1817 res->
data = (
void *)kNFLength(M,
currRing->qideal, v, iSyzComp, iLazyReduce);
1835 WerrorS(
"`idPrepare(<module>)` expected");
1839 const ideal I =
reinterpret_cast<ideal
>(h->
Data());
1849 iComp = (int)((
long)(h->
Data()));
1853 if( (!isSyz) && (-1 == posIS) )
1855 WerrorS(
"`idPrepare(<...>)` called on incompatible ring (not created by 'MakeSyzCompOrdering' or 'MakeInducedSchreyerOrdering'!)");
1910 res->
data =
reinterpret_cast<void *
>(J);
1919 WerrorS(
"`p_Content(<poly-var>)` expected");
1945 WerrorS(
"`m2_end([<int>])` expected");
1948 ret = (int)(
long)(h->
Data());
1962 WerrorS(
"`NumberStatsInit([<int>])` expected");
1966 unsigned long v = 0;
1969 v = (
unsigned long)(h->
Data());
1983 WerrorS(
"`NumberStatsPrint([<string>])` expected");
1987 const char* msg =
NULL;
1990 msg = (
const char*)(h->
Data());
2003 #define ADD(C,D,E) \ 2004 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)
#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.
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)
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)
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!!!
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.
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)