Macros | Functions
mod_main.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/intvec.h>
#include <misc/options.h>
#include <coeffs/coeffs.h>
#include <polys/PolyEnumerator.h>
#include <polys/monomials/p_polys.h>
#include <polys/monomials/ring.h>
#include <polys/simpleideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/polys.h>
#include <kernel/GBEngine/syz.h>
#include <Singular/tok.h>
#include <Singular/ipid.h>
#include <Singular/lists.h>
#include <Singular/attrib.h>
#include <Singular/ipshell.h>
#include "singularxx_defs.h"
#include "DebugPrint.h"
#include "myNF.h"
#include "syzextra.h"
#include <Singular/mod_lib.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Macros

#define PRINT_pINTVECTOR(s, v)
 
#define PRINT_RESOLUTION(s, v)
 
#define PRINT_POINTER(s, v)   Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();
 
#define ADD(C, D, E)   psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""), (char*)C, D, E);
 

Functions

 USING_NAMESPACE (SINGULARXXNAME ::DEBUG) USING_NAMESPACE(SINGULARXXNAME
 
static void NoReturn (leftv &res)
 
static BOOLEAN _ClearContent (leftv res, leftv h)
 wrapper around n_ClearContent More...
 
static BOOLEAN _ClearDenominators (leftv res, leftv h)
 wrapper around n_ClearDenominators More...
 
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 More...
 
static BOOLEAN noop (leftv __res, leftv)
 
static BOOLEAN _ProfilerStart (leftv __res, leftv h)
 
static BOOLEAN _ProfilerStop (leftv __res, leftv)
 
static number jjLONG2N (long d)
 
static void view (const intvec *v)
 
static BOOLEAN DetailedPrint (leftv __res, leftv h)
 
static BOOLEAN Tail (leftv res, leftv h)
 wrapper around p_Tail and id_Tail More...
 
static BOOLEAN _ComputeLeadingSyzygyTerms (leftv res, leftv h)
 
static BOOLEAN _Sort_c_ds (leftv res, leftv h)
 sorting wrt <c,ds> & reversing... change the input inplace!!! More...
 
static BOOLEAN _Compute2LeadingSyzygyTerms (leftv res, leftv h)
 
static BOOLEAN _FindReducer (leftv res, leftv h)
 proc SSFindReducer(def product, def syzterm, def L, def T, list #) More...
 
static BOOLEAN _SchreyerSyzygyNF (leftv res, leftv h)
 
static BOOLEAN _ReduceTerm (leftv res, leftv h)
 proc SSReduceTerm(poly m, def t, def syzterm, def L, def T, list #) More...
 
static BOOLEAN _TraverseTail (leftv res, leftv h)
 
static BOOLEAN _ComputeResolution (leftv res, leftv h)
 
static BOOLEAN _ComputeSyzygy (leftv res, leftv h)
 module (LL, TT) = SSComputeSyzygy(L, T); Compute Syz(L ++ T) = N = LL ++ TT More...
 
static BOOLEAN _leadmonom (leftv res, leftv h)
 Get leading term without a module component. More...
 
static BOOLEAN leadcomp (leftv res, leftv h)
 Get leading component. More...
 
static BOOLEAN leadrawexp (leftv res, leftv h)
 Get raw leading exponent vector. More...
 
static BOOLEAN MakeSyzCompOrdering (leftv res, leftv)
 Endowe the current ring with additional (leading) Syz-component ordering. More...
 
static BOOLEAN MakeInducedSchreyerOrdering (leftv res, leftv h)
 Same for Induced Schreyer ordering (ordering on components is defined by sign!) More...
 
static BOOLEAN SetSyzComp (leftv res, leftv h)
 Returns old SyzCompLimit, can set new limit. More...
 
static BOOLEAN GetInducedData (leftv res, leftv h)
 ? More...
 
static BOOLEAN SetInducedReferrence (leftv res, leftv h)
 Returns old SyzCompLimit, can set new limit. More...
 
static BOOLEAN ISUpdateComponents (leftv res, leftv h)
 
static BOOLEAN reduce_syz (leftv res, leftv h)
 NF using length. More...
 
static BOOLEAN idPrepare (leftv res, leftv h)
 Get raw syzygies (idPrepare) More...
 
static BOOLEAN _p_Content (leftv res, leftv h)
 Get raw syzygies (idPrepare) More...
 
static BOOLEAN _m2_end (leftv res, leftv h)
 
static BOOLEAN _NumberStatsInit (leftv res, leftv h)
 
static BOOLEAN _NumberStatsPrint (leftv res, leftv h)
 
END_NAMESPACE int SI_MOD_INIT() syzextra (SModulFunctions *psModulFunctions)
 

Macro Definition Documentation

◆ ADD

#define ADD (   C,
  D,
  E 
)    psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""), (char*)C, D, E);

◆ PRINT_pINTVECTOR

#define PRINT_pINTVECTOR (   s,
  v 
)
Value:
Print("intvec '%10s'(%p)", #v, reinterpret_cast<const void*>((s)->v)); \
if( (s)->v != NULL ){ PrintS(": "); view((s)->v); }; \
PrintLn();
const CanonicalForm int s
Definition: facAbsFact.cc:55
static void view(const intvec *v)
Definition: mod_main.cc:247
#define Print
Definition: emacs.cc:83
void PrintS(const char *s)
Definition: reporter.cc:284
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10

◆ PRINT_POINTER

#define PRINT_POINTER (   s,
  v 
)    Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();

◆ PRINT_RESOLUTION

#define PRINT_RESOLUTION (   s,
  v 
)
Value:
Print("resolution '%12s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn(); \
if ((s)->v != NULL) \
for (int iLevel = 0; (iLevel < iLength) && ( ((s)->v)[iLevel] != NULL ); iLevel++) \
{ \
/* const ring rrr = (iLevel > 0) ? save : save; */ \
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/*id_RankFreeModule(((s)->v)[iLevel], rrr)*/ ); \
PrintLn(); \
} \
PrintLn();
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int nrows
Definition: cf_linsys.cc:32
#define IDELEMS(i)
Definition: simpleideals.h:24
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int int ncols
Definition: cf_linsys.cc:32

Function Documentation

◆ _ClearContent()

static BOOLEAN _ClearContent ( leftv  res,
leftv  h 
)
static

wrapper around n_ClearContent

Definition at line 97 of file mod_main.cc.

98 {
99  NoReturn(res);
100 
101  const char *usage = "'ClearContent' needs a (non-zero!) poly or vector argument...";
102 
103  if( h == NULL )
104  {
105  WarnS(usage);
106  return TRUE;
107  }
108 
109  assume( h != NULL );
110 
111  if( !( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD) )
112  {
113  WarnS(usage);
114  return TRUE;
115  }
116 
117  assume (h->Next() == NULL);
118 
119  poly ph = reinterpret_cast<poly>(h->Data());
120 
121  if( ph == NULL )
122  {
123  WarnS(usage);
124  return TRUE;
125  }
126 
127  const ring r = currRing;
128  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
129 
130  number n;
131 
132  // experimentall (recursive enumerator treatment) of alg. ext
133  CPolyCoeffsEnumerator itr(ph);
134  n_ClearContent(itr, n, C);
135 
136  res->data = n;
137  res->rtyp = NUMBER_CMD;
138 
139  return FALSE;
140 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
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 ...
Definition: coeffs.h:945
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10

◆ _ClearDenominators()

static BOOLEAN _ClearDenominators ( leftv  res,
leftv  h 
)
static

wrapper around n_ClearDenominators

Definition at line 143 of file mod_main.cc.

144 {
145  NoReturn(res);
146 
147  const char *usage = "'ClearDenominators' needs a (non-zero!) poly or vector argument...";
148 
149  if( h == NULL )
150  {
151  WarnS(usage);
152  return TRUE;
153  }
154 
155  assume( h != NULL );
156 
157  if( !( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD) )
158  {
159  WarnS(usage);
160  return TRUE;
161  }
162 
163  assume (h->Next() == NULL);
164 
165  poly ph = reinterpret_cast<poly>(h->Data());
166 
167  if( ph == NULL )
168  {
169  WarnS(usage);
170  return TRUE;
171  }
172 
173  const ring r = currRing;
174  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
175 
176  number n;
177 
178  // experimentall (recursive enumerator treatment) of alg. ext.
179  CPolyCoeffsEnumerator itr(ph);
180  n_ClearDenominators(itr, n, C);
181 
182  res->data = n;
183  res->rtyp = NUMBER_CMD;
184 
185  return FALSE;
186 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
#define assume(x)
Definition: mod2.h:394
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10
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...
Definition: coeffs.h:952

◆ _Compute2LeadingSyzygyTerms()

static BOOLEAN _Compute2LeadingSyzygyTerms ( leftv  res,
leftv  h 
)
static

Definition at line 637 of file mod_main.cc.

638 {
640 
641  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
642 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
643  const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
644 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
645 // const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
646 
647  const ring r = attributes.m_rBaseRing;
648  NoReturn(res);
649 
650  if( h == NULL )
651  {
652  WarnS("Compute2LeadingSyzygyTerms needs an argument...");
653  return TRUE;
654  }
655 
656  assume( h != NULL );
657 
658  assume( OPT__LEAD2SYZ ); // ???
659 
660  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
661  {
662  const ideal id = (const ideal)h->Data();
663 
664  assume(id != NULL);
665 
666  if( UNLIKELY( OPT__DEBUG ) )
667  {
668  PrintS("Compute2LeadingSyzygyTerms::Input: \n");
669  dPrint(id, r, r, 0);
670  }
671 
672  h = h->Next(); assume (h == NULL);
673 
674  res->data = Compute2LeadingSyzygyTerms(id, attributes);
675  res->rtyp = MODUL_CMD;
676 
677  return FALSE;
678  }
679 
680  WarnS("Compute2LeadingSyzygyTerms needs a single ideal/module argument...");
681  return TRUE;
682 }
Computation attribute storage.
Definition: syzextra.h:190
static ideal Compute2LeadingSyzygyTerms(const ideal &L, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:592
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ _ComputeLeadingSyzygyTerms()

static BOOLEAN _ComputeLeadingSyzygyTerms ( leftv  res,
leftv  h 
)
static

Definition at line 525 of file mod_main.cc.

526 {
528 
529  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
530 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
531  const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
532 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
533 // const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
534 
535  const ring r = attributes.m_rBaseRing;
536  NoReturn(res);
537 
538  if( h == NULL )
539  {
540  WarnS("ComputeLeadingSyzygyTerms needs an argument...");
541  return TRUE;
542  }
543 
544  assume( h != NULL );
545 
546  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
547  {
548  const ideal id = (const ideal)h->Data();
549 
550  assume(id != NULL);
551 
552  if( UNLIKELY( OPT__DEBUG ) )
553  {
554  PrintS("ComputeLeadingSyzygyTerms::Input: \n");
555  dPrint(id, r, r, 0);
556  }
557 
558  assume( !OPT__LEAD2SYZ );
559 
560  h = h->Next(); assume (h == NULL);
561 
562  const ideal newid = ComputeLeadingSyzygyTerms(id, attributes);
563 
564  res->data = newid; res->rtyp = MODUL_CMD;
565  return FALSE;
566  }
567 
568  WarnS("ComputeLeadingSyzygyTerms needs a single ideal/module argument...");
569  return TRUE;
570 }
Computation attribute storage.
Definition: syzextra.h:190
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85
static ideal ComputeLeadingSyzygyTerms(const ideal &L, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:583

◆ _ComputeResolution()

static BOOLEAN _ComputeResolution ( leftv  res,
leftv  h 
)
static

Definition at line 1143 of file mod_main.cc.

1144 {
1145  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
1146 
1147  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
1148 
1149  const char* usage = "`ComputeResolution(<ideal/module>, <same as before>, <same as before>[,int])` expected";
1150  const ring r = attributes.m_rBaseRing;
1151 
1152  NoReturn(res);
1153 
1154  // input
1155  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
1156  {
1157  WerrorS(usage);
1158  return TRUE;
1159  }
1160 
1161  const int type = h->Typ();
1162  ideal M = (ideal)(h->CopyD()); // copy for resolution...!???
1163  int size = IDELEMS(M);
1164 
1165  assume( size >= 0 );
1166 
1167  h = h->Next();
1168 
1169  // lead
1170  if ((h==NULL) || (h->Typ()!=type) || (h->Data() == NULL))
1171  {
1172  WerrorS(usage);
1173  return TRUE;
1174  }
1175 
1176  ideal L = (ideal)(h->CopyD()); // no copy!
1177  assume( IDELEMS(L) == size );
1178 
1179  h = h->Next();
1180  if ((h==NULL) || (h->Typ()!=type) || (h->Data() == NULL))
1181  {
1182  WerrorS(usage);
1183  return TRUE;
1184  }
1185 
1186  ideal T = (ideal)(h->CopyD()); // no copy!
1187  assume( IDELEMS(T) == size );
1188 
1189  h = h->Next();
1190 
1191  // length..?
1192  long length = 0;
1193 
1194  if ((h!=NULL) && (h->Typ()==INT_CMD))
1195  {
1196  length = (long)(h->Data());
1197  h = h->Next();
1198  }
1199 
1200  assume( h == NULL );
1201 
1202  if( length <= 0 )
1203  length = 1 + rVar(r);
1204 
1205  if( UNLIKELY( OPT__DEBUG ) )
1206  {
1207  PrintS("ComputeResolution(M, length)::Input: \n");
1208  Print( "starting length: %ld\n", length);
1209  PrintS("M: \n"); dPrint(M, r, r, 0);
1210  PrintS("L=LEAD(M): \n"); dPrint(L, r, r, 0);
1211  PrintS("T=TAIL(M): \n"); dPrint(T, r, r, 0);
1212  }
1213 
1214 
1215  syStrategy _res=(syStrategy)omAlloc0(sizeof(ssyStrategy));
1216 
1217 // class ssyStrategy; typedef ssyStrategy * syStrategy;
1218 // typedef ideal * resolvente;
1219 
1220  _res->length = length + 1; // index + 1;
1221  _res->fullres = (resolvente)omAlloc0((_res->length+1)*sizeof(ideal));
1222  int index = 0;
1223  _res->fullres[index++] = M;
1224 
1225 // if (UNLIKELY(attributes.OPT__TREEOUTPUT))
1226 // Print("{ \"RESOLUTION: HYBRIDNF:%d, TAILREDSYZ: %d, LEAD2SYZ: %d, IGNORETAILS: %d\": [\n", attributes.OPT__HYBRIDNF, attributes.OPT__TAILREDSYZ, attributes.OPT__LEAD2SYZ, attributes.OPT__IGNORETAILS);
1227 
1228  while( (!idIs0(L)) && (index < length))
1229  {
1230  attributes.nextSyzygyLayer();
1231  ideal LL, TT;
1232 
1233  ComputeSyzygy(L, T, LL, TT, attributes);
1234 
1235  if( UNLIKELY( OPT__DEBUG ) )
1236  {
1237  Print("ComputeResolution()::Separated Syzygy[%d]: \n", index);
1238 // PrintS("LL: \n"); dPrint(LL, r, r, 0);
1239 // PrintS("TT: \n"); dPrint(TT, r, r, 0);
1240  }
1241  size = IDELEMS(LL);
1242 
1243  assume( size == IDELEMS(TT) );
1244 
1245  id_Delete(&L, r); id_Delete(&T, r);
1246 
1247  L = LL; T = TT;
1248 
1249  // id_Add(T, L, r);
1250  M = idInit(size, 0);
1251  for( int i = size-1; i >= 0; i-- )
1252  {
1253  M->m[i] = p_Add_q(p_Copy(T->m[i], r), p_Copy(L->m[i], r), r); // TODO: :(((
1254  }
1255  M->rank = id_RankFreeModule(M, r);
1256 
1257  if( UNLIKELY( OPT__DEBUG ) )
1258  {
1259  Print("ComputeResolution()::Restored Syzygy[%d]: \n", index);
1260  PrintS("M = LL + TT: \n"); dPrint(M, r, r, 0);
1261  }
1262 
1263  _res->fullres[index++] = M; // ???
1264  }
1265 // if ( UNLIKELY(attributes.OPT__TREEOUTPUT) )
1266 // PrintS("] }\n");
1267 
1268  id_Delete(&L, r); id_Delete(&T, r);
1269 
1270  res->data = _res;
1271  res->rtyp = RESOLUTION_CMD;
1272 
1273  if( UNLIKELY(OPT__DEBUG) )
1274  {
1275  Print("ComputeResolution::Output (index: %d): ", index);
1276 // class sleftv; typedef sleftv * leftv;
1277  sleftv _h;
1278  DetailedPrint(&_h, res);
1279  }
1280 
1281 // omFreeSize(_res, sizeof(ssyStrategy));
1282 
1283  return FALSE;
1284 
1285 }
int length
Definition: syz.h:60
Computation attribute storage.
Definition: syzextra.h:190
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
#define Print
Definition: emacs.cc:83
Definition: tok.h:95
static void ComputeSyzygy(const ideal L, const ideal T, ideal &LL, ideal &TT, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:576
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
static BOOLEAN DetailedPrint(leftv __res, leftv h)
Definition: mod_main.cc:269
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
int Typ()
Definition: subexpr.cc:995
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void * data
Definition: subexpr.h:88
#define M
Definition: sirandom.c:24
const ring r
Definition: syzextra.cc:208
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
resolvente fullres
Definition: syz.h:57
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
ideal * resolvente
Definition: ideals.h:18
static jList * T
Definition: janet.cc:37
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void * CopyD(int t)
Definition: subexpr.cc:707
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ssyStrategy * syStrategy
Definition: syz.h:35

◆ _ComputeSyzygy()

static BOOLEAN _ComputeSyzygy ( leftv  res,
leftv  h 
)
static

module (LL, TT) = SSComputeSyzygy(L, T); Compute Syz(L ++ T) = N = LL ++ TT

Definition at line 1291 of file mod_main.cc.

1292 {
1293  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
1294 
1295  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
1296 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
1297 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
1298 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
1299 // const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
1300 
1301  const char* usage = "`ComputeSyzygy(<ideal/module>, <ideal/module>)` expected";
1302  const ring r = attributes.m_rBaseRing;
1303 
1304  NoReturn(res);
1305 
1306  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
1307  {
1308  WerrorS(usage);
1309  return TRUE;
1310  }
1311 
1312  const ideal L = (ideal) h->Data();
1313 
1314  assume( IDELEMS(L) > 0 );
1315 
1316  h = h->Next();
1317  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
1318  {
1319  WerrorS(usage);
1320  return TRUE;
1321  }
1322 
1323  const ideal T = (ideal) h->Data();
1324  assume( IDELEMS(L) == IDELEMS(T) );
1325 
1326 
1327  h = h->Next(); assume( h == NULL );
1328 
1329  if( UNLIKELY( OPT__DEBUG ) )
1330  {
1331  PrintS("ComputeSyzygy(L, T)::Input: \n");
1332 // PrintS("L: "); dPrint(L, r, r, 0);
1333 // PrintS("T: "); dPrint(T, r, r, 0);
1334  }
1335 
1336  ideal LL, TT;
1337 
1338  ComputeSyzygy(L, T, LL, TT, attributes);
1339 
1340  lists l = (lists)omAllocBin(slists_bin); l->Init(2);
1341 
1342  l->m[0].rtyp = MODUL_CMD; l->m[0].data = reinterpret_cast<void *>(LL);
1343 
1344  l->m[1].rtyp = MODUL_CMD; l->m[1].data = reinterpret_cast<void *>(TT);
1345 
1346  res->data = l; res->rtyp = LIST_CMD;
1347 
1348  if( UNLIKELY( OPT__DEBUG ) )
1349  {
1350  PrintS("ComputeSyzygy::Output: \nLL: \n");
1351  dPrint(LL, r, r, 0);
1352  PrintS("\nTT: \n");
1353  dPrint(TT, r, r, 0);
1354  }
1355 
1356  return FALSE;
1357 
1358 }
Computation attribute storage.
Definition: syzextra.h:190
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
static void ComputeSyzygy(const ideal L, const ideal T, ideal &LL, ideal &TT, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:576
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
static jList * T
Definition: janet.cc:37
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85
int l
Definition: cfEzgcd.cc:94

◆ _FindReducer()

static BOOLEAN _FindReducer ( leftv  res,
leftv  h 
)
static

proc SSFindReducer(def product, def syzterm, def L, def T, list #)

Definition at line 687 of file mod_main.cc.

688 {
690 
691  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
692 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
693 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
694 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
695  const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
696 
697  const char* usage = "`FindReducer(<poly/vector>, <vector/0>, <ideal/module>[,<module>])` expected";
698  const ring r = attributes.m_rBaseRing;
699 
700  NoReturn(res);
701 
702 
703  if ((h==NULL) || (h->Typ()!=VECTOR_CMD && h->Typ() !=POLY_CMD) || (h->Data() == NULL))
704  {
705  WerrorS(usage);
706  return TRUE;
707  }
708 
709  const poly product = (poly) h->Data(); assume (product != NULL);
710 
711 
712  h = h->Next();
713  if ((h==NULL) || !((h->Typ()==VECTOR_CMD) || (h->Data() == NULL)) )
714  {
715  WerrorS(usage);
716  return TRUE;
717  }
718 
719  poly syzterm = NULL;
720 
721  if(h->Typ()==VECTOR_CMD)
722  syzterm = (poly) h->Data();
723 
724 
725 
726  h = h->Next();
727  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
728  {
729  WerrorS(usage);
730  return TRUE;
731  }
732 
733  const ideal L = (ideal) h->Data(); h = h->Next();
734 
735  assume( IDELEMS(L) > 0 );
736 
737  ideal LS = NULL;
738 
739  if ((h != NULL) && (h->Typ() ==MODUL_CMD) && (h->Data() != NULL))
740  {
741  LS = (ideal)h->Data();
742  h = h->Next();
743  }
744 
745 #ifndef SING_NDEBUG
746  if( LIKELY( OPT__TAILREDSYZ) )
747  assume (LS != NULL);
748 #endif
749 
750  assume( h == NULL );
751 
752  if( UNLIKELY(OPT__DEBUG) )
753  {
754  PrintS("FindReducer(product, syzterm, L, T, #)::Input: \n");
755 
756  PrintS("product: "); dPrint(product, r, r, 0);
757  PrintS("syzterm: "); dPrint(syzterm, r, r, 0);
758 // PrintS("L: "); dPrint(L, r, r, 0);
759 // PrintS("T: "); dPrint(T, r, r, 0);
760 
761  if( LS == NULL )
762 // PrintS("LS: NULL\n");
763  ;
764  else
765  {
766 // PrintS("LS: "); dPrint(LS, r, r, 0);
767  }
768  }
769 
770  res->rtyp = VECTOR_CMD;
771  res->data = FindReducer(product, syzterm, L, LS, attributes);
772 
773  if( UNLIKELY( OPT__DEBUG ) )
774  {
775  PrintS("FindReducer::Output: \n");
776  dPrint((poly)res->data, r, r, 0);
777  }
778 
779  return FALSE;
780 
781 }
Computation attribute storage.
Definition: syzextra.h:190
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define LIKELY(expression)
Definition: tgb_internal.h:837
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
static poly FindReducer(poly product, poly syzterm, ideal L, ideal LS, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:601
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ _leadmonom()

static BOOLEAN _leadmonom ( leftv  res,
leftv  h 
)
static

Get leading term without a module component.

Definition at line 1361 of file mod_main.cc.

1362 {
1363  NoReturn(res);
1364 
1365  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))
1366  {
1367  const ring r = currRing;
1368  const poly p = (poly)(h->Data());
1369 
1370  res->data = reinterpret_cast<void *>( leadmonom(p, r) );
1371  res->rtyp = POLY_CMD;
1372 
1373  return FALSE;
1374  }
1375 
1376  WerrorS("`leadmonom(<poly/vector>)` expected");
1377  return TRUE;
1378 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
poly leadmonom(const poly p, const ring r, const bool bSetZeroComp)
return a new term: leading coeff * leading monomial of p with 0 leading component! ...
Definition: syzextra.cc:473
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10

◆ _m2_end()

static BOOLEAN _m2_end ( leftv  res,
leftv  h 
)
static

Definition at line 1934 of file mod_main.cc.

1935 {
1936  int ret = 0;
1937 
1938  if ( (h!=NULL) && (h->Typ()!=INT_CMD) )
1939  {
1940  WerrorS("`m2_end([<int>])` expected");
1941  return TRUE;
1942  }
1943  ret = (int)(long)(h->Data());
1944 
1945  m2_end( ret );
1946 
1947  NoReturn(res);
1948  return FALSE;
1949 }
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
void m2_end(int i)
Definition: misc_ip.cc:1074
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137

◆ _NumberStatsInit()

static BOOLEAN _NumberStatsInit ( leftv  res,
leftv  h 
)
static

Definition at line 1953 of file mod_main.cc.

1954 {
1955  if ( (h!=NULL) && (h->Typ()!=INT_CMD) )
1956  {
1957  WerrorS("`NumberStatsInit([<int>])` expected");
1958  return TRUE;
1959  }
1960 
1961  unsigned long v = 0;
1962 
1963  if( h != NULL )
1964  v = (unsigned long)(h->Data());
1965 
1966  number_stats_Init(v);
1967 
1968  NoReturn(res);
1969  return FALSE;
1970 }
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static void number_stats_Init(const unsigned long defaultvalue=0)
set all counters to zero
Definition: numstats.h:124
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137

◆ _NumberStatsPrint()

static BOOLEAN _NumberStatsPrint ( leftv  res,
leftv  h 
)
static

Definition at line 1974 of file mod_main.cc.

1975 {
1976  if ( (h!=NULL) && (h->Typ()!=STRING_CMD) )
1977  {
1978  WerrorS("`NumberStatsPrint([<string>])` expected");
1979  return TRUE;
1980  }
1981 
1982  const char* msg = NULL;
1983 
1984  if( h != NULL )
1985  msg = (const char*)(h->Data());
1986 
1987  number_stats_Print(msg);
1988 
1989  NoReturn(res);
1990  return FALSE;
1991 }
static void number_stats_Print(const char *const msg=NULL)
print out all counters
Definition: numstats.h:136
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137

◆ _p_Content()

static BOOLEAN _p_Content ( leftv  res,
leftv  h 
)
static

Get raw syzygies (idPrepare)

Definition at line 1910 of file mod_main.cc.

1911 {
1912  if ( !( (h!=NULL) && (h->Typ()==POLY_CMD) && (h->Data() != NULL) ) )
1913  {
1914  WerrorS("`p_Content(<poly-var>)` expected");
1915  return TRUE;
1916  }
1917 
1918 
1919  const poly p = reinterpret_cast<poly>(h->Data());
1920 
1921 
1922  pTest(p); pWrite(p); PrintLn();
1923 
1924 
1925  p_Content( p, currRing);
1926 
1927  pTest(p);
1928  pWrite(p); PrintLn();
1929 
1930  NoReturn(res);
1931  return FALSE;
1932 }
void PrintLn()
Definition: reporter.cc:310
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define pTest(p)
Definition: polys.h:397
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2255
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10

◆ _ProfilerStart()

static BOOLEAN _ProfilerStart ( leftv  __res,
leftv  h 
)
static

Definition at line 212 of file mod_main.cc.

213 {
214  NoReturn(__res);
215 #if GOOGLE_PROFILE_ENABLED
216  if( h!= NULL && h->Typ() == STRING_CMD )
217  {
218  const char* name = (char*)(h->Data());
219  assume( name != NULL );
220  ProfilerStart(name);
221  } else
222  WerrorS("ProfilerStart requires a string [name] argument");
223 #else
224  WarnS("Sorry no google profiler support (GOOGLE_PROFILE_ENABLE!=1)...");
225 // return TRUE; // ?
226 #endif // #if GOOGLE_PROFILE_ENABLED
227  return FALSE;
228  (void)h;
229 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
#define assume(x)
Definition: mod2.h:394
char name(const Variable &v)
Definition: factory.h:178
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137

◆ _ProfilerStop()

static BOOLEAN _ProfilerStop ( leftv  __res,
leftv   
)
static

Definition at line 230 of file mod_main.cc.

231 {
232  NoReturn(__res);
233 #if GOOGLE_PROFILE_ENABLED
234  ProfilerStop();
235 #else
236  WarnS("Sorry no google profiler support (GOOGLE_PROFILE_ENABLED!=1)...");
237 // return TRUE; // ?
238 #endif // #if GOOGLE_PROFILE_ENABLED
239  return FALSE;
240 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define WarnS
Definition: emacs.cc:81

◆ _ReduceTerm()

static BOOLEAN _ReduceTerm ( leftv  res,
leftv  h 
)
static

proc SSReduceTerm(poly m, def t, def syzterm, def L, def T, list #)

Definition at line 893 of file mod_main.cc.

894 {
896 
897  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
898 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
899 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
900 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
901  const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
902 
903  const char* usage = "`ReduceTerm(<poly>, <poly/vector>, <vector/0>, <ideal/module>, <ideal/module>[,<module>])` expected";
904  const ring r = attributes.m_rBaseRing;
905 
906  NoReturn(res);
907 
908  if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL))
909  {
910  WerrorS(usage);
911  return TRUE;
912  }
913 
914  const poly multiplier = (poly) h->Data(); assume (multiplier != NULL);
915 
916 
917  h = h->Next();
918  if ((h==NULL) || (h->Typ()!=VECTOR_CMD && h->Typ() !=POLY_CMD) || (h->Data() == NULL))
919  {
920  WerrorS(usage);
921  return TRUE;
922  }
923 
924  const poly term4reduction = (poly) h->Data(); assume( term4reduction != NULL );
925 
926 
927  poly syztermCheck = NULL;
928 
929  h = h->Next();
930  if ((h==NULL) || !((h->Typ()==VECTOR_CMD) || (h->Data() == NULL)) )
931  {
932  WerrorS(usage);
933  return TRUE;
934  }
935 
936  if(h->Typ()==VECTOR_CMD)
937  syztermCheck = (poly) h->Data();
938 
939 
940  h = h->Next();
941  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
942  {
943  WerrorS(usage);
944  return TRUE;
945  }
946 
947  const ideal L = (ideal) h->Data(); assume( IDELEMS(L) > 0 );
948 
949 
950  h = h->Next();
951  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
952  {
953  WerrorS(usage);
954  return TRUE;
955  }
956 
957  const ideal T = (ideal) h->Data();
958 
959  assume( IDELEMS(L) == IDELEMS(T) );
960 
961  ideal LS = NULL;
962 
963  h = h->Next();
964  if ((h != NULL) && (h->Typ() ==MODUL_CMD) && (h->Data() != NULL))
965  {
966  LS = (ideal)h->Data();
967  h = h->Next();
968  }
969 
970 #ifndef SING_NDEBUG
971  if( LIKELY( OPT__TAILREDSYZ) )
972  assume (LS != NULL);
973 #endif
974 
975  assume( h == NULL );
976 
977  if( UNLIKELY( OPT__DEBUG ) )
978  {
979  PrintS("ReduceTerm(m, t, syzterm, L, T, #)::Input: \n");
980 
981  PrintS("m: "); dPrint(multiplier, r, r, 0);
982  PrintS("t: "); dPrint(term4reduction, r, r, 0);
983  PrintS("syzterm: "); dPrint(syztermCheck, r, r, 0);
984 
985 // PrintS("L: "); dPrint(L, r, r, 0);
986 // PrintS("T: "); dPrint(T, r, r, 0);
987 
988  if( LS == NULL )
989 // PrintS("LS: NULL\n")
990  ;
991  else
992  {
993 // PrintS("LS: "); dPrint(LS, r, r, 0);
994  }
995  }
996 
997 
998  if ( UNLIKELY( OPT__DEBUG && syztermCheck != NULL) )
999  {
1000  const int c = p_GetComp(syztermCheck, r) - 1;
1001  assume( c >= 0 && c < IDELEMS(L) );
1002 
1003  const poly p = L->m[c];
1004  assume( p != NULL ); assume( pNext(p) == NULL );
1005 
1006  assume( p_EqualPolys(term4reduction, p, r) ); // assume? TODO
1007 
1008 
1009  poly m = leadmonom(syztermCheck, r);
1010  assume( m != NULL ); assume( pNext(m) == NULL );
1011 
1012  assume( p_EqualPolys(multiplier, m, r) ); // assume? TODO
1013 
1014  p_Delete(&m, r);
1015 
1016 // NOTE: leadmonomial(syzterm) == m && L[leadcomp(syzterm)] == t
1017  }
1018 
1019  res->rtyp = VECTOR_CMD;
1020  res->data = ReduceTerm(multiplier, term4reduction, syztermCheck, L, T, LS, attributes);
1021 
1022 
1023  if( UNLIKELY( OPT__DEBUG ) )
1024  {
1025  PrintS("ReduceTerm::Output: ");
1026 
1027  dPrint((poly)res->data, r, r, 0);
1028  }
1029 
1030 
1031  return FALSE;
1032 }
Computation attribute storage.
Definition: syzextra.h:190
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
poly leadmonom(const poly p, const ring r, const bool bSetZeroComp)
return a new term: leading coeff * leading monomial of p with 0 leading component! ...
Definition: syzextra.cc:473
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define LIKELY(expression)
Definition: tgb_internal.h:837
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
static poly ReduceTerm(poly multiplier, poly term4reduction, poly syztermCheck, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:615
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
int m
Definition: cfEzgcd.cc:119
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4367
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
#define pNext(p)
Definition: monomials.h:43
void * Data()
Definition: subexpr.cc:1137
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ _SchreyerSyzygyNF()

static BOOLEAN _SchreyerSyzygyNF ( leftv  res,
leftv  h 
)
static

Definition at line 784 of file mod_main.cc.

785 {
787 
788  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
789 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
790 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
791  const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
792  const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
793 
794  const char* usage = "`SchreyerSyzygyNF(<vector>, <vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
795  const ring r = attributes.m_rBaseRing;
796 
797  NoReturn(res);
798 
799  assume( OPT__HYBRIDNF ); // ???
800 
801  if ((h==NULL) || (h->Typ() != VECTOR_CMD) || (h->Data() == NULL))
802  {
803  WerrorS(usage);
804  return TRUE;
805  }
806 
807  const poly syz_lead = (poly) h->Data(); assume (syz_lead != NULL);
808 
809 
810  h = h->Next();
811  if ((h==NULL) || (h->Typ() != VECTOR_CMD) || (h->Data() == NULL))
812  {
813  WerrorS(usage);
814  return TRUE;
815  }
816 
817  const poly syz_2 = (poly) h->Data(); assume (syz_2 != NULL);
818 
819  h = h->Next();
820  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
821  {
822  WerrorS(usage);
823  return TRUE;
824  }
825 
826  const ideal L = (ideal) h->Data(); assume( IDELEMS(L) > 0 );
827 
828 
829  h = h->Next();
830  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
831  {
832  WerrorS(usage);
833  return TRUE;
834  }
835 
836  const ideal T = (ideal) h->Data();
837 
838  assume( IDELEMS(L) == IDELEMS(T) );
839 
840  ideal LS = NULL;
841 
842  h = h->Next();
843  if ((h != NULL) && (h->Typ() ==MODUL_CMD) && (h->Data() != NULL))
844  {
845  LS = (ideal)h->Data();
846  h = h->Next();
847  }
848 
849 #ifndef SING_NDEBUG
850  if( LIKELY( OPT__TAILREDSYZ) )
851  assume (LS != NULL);
852 #endif
853 
854  assume( h == NULL );
855 
856  if( UNLIKELY( OPT__DEBUG ) )
857  {
858  PrintS("SchreyerSyzygyNF(syz_lead, syz_2, L, T, #)::Input: \n");
859 
860  PrintS("syz_lead: "); dPrint(syz_lead, r, r, 0);
861  PrintS("syz_2: "); dPrint(syz_2, r, r, 0);
862 
863 // PrintS("L: "); dPrint(L, r, r, 0);
864 // PrintS("T: "); dPrint(T, r, r, 0);
865 
866  if( LS == NULL )
867 // PrintS("LS: NULL\n")
868  ;
869  else
870  {
871 // PrintS("LS: "); dPrint(LS, r, r, 0);
872  }
873  }
874 
875  res->rtyp = VECTOR_CMD;
876  res->data = SchreyerSyzygyNF(syz_lead,
877  (syz_2!=NULL)? p_Copy(syz_2, r): syz_2, L, T, LS, attributes);
878 
879  if( UNLIKELY( OPT__DEBUG ) )
880  {
881  PrintS("SchreyerSyzygyNF::Output: ");
882 
883  dPrint((poly)res->data, r, r, 0);
884  }
885 
886 
887  return FALSE;
888 }
Computation attribute storage.
Definition: syzextra.h:190
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
static poly SchreyerSyzygyNF(poly syz_lead, poly syz_2, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:623
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define LIKELY(expression)
Definition: tgb_internal.h:837
int Typ()
Definition: subexpr.cc:995
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ _Sort_c_ds()

static BOOLEAN _Sort_c_ds ( leftv  res,
leftv  h 
)
static

sorting wrt <c,ds> & reversing... change the input inplace!!!

Definition at line 575 of file mod_main.cc.

576 {
578 
579  const BOOLEAN OPT__DEBUG = FALSE; // attributes.OPT__DEBUG;
580 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
581 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
582 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
583 // const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
584 
585  NoReturn(res);
586 
587  const ring r = attributes.m_rBaseRing;
588  NoReturn(res);
589 
590  if( h == NULL )
591  {
592  WarnS("Sort_c_ds needs an argument...");
593  return TRUE;
594  }
595 
596  assume( h != NULL );
597 
598  if( (h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
599  && (h->rtyp == IDHDL) // must be a variable!
600  && (h->e == NULL) // not a list element
601  )
602  {
603  const ideal id = (const ideal)h->Data();
604 
605  assume(id != NULL);
606 
607  if( UNLIKELY( OPT__DEBUG ) )
608  {
609  PrintS("Sort_c_ds::Input: \n");
610  dPrint(id, r, r, 0);
611  }
612 
613  assume (h->Next() == NULL);
614 
615  id_Test(id, r);
616 
617  Sort_c_ds(id, r); // NOT A COPY! inplace sorting!!!
618 
619 // res->data = id;
620 // res->rtyp = h->Typ();
621 
622  if( UNLIKELY( OPT__DEBUG ) )
623  {
624  PrintS("Sort_c_ds::Output: \n");
625  dPrint(id, r, r, 0);
626  }
627 
628  // NOTE: nothing is to be returned!!!
629  return FALSE;
630  }
631 
632  WarnS("ComputeLeadingSyzygyTerms needs a single ideal/module argument (must be a variable!)...");
633  return TRUE;
634 }
Computation attribute storage.
Definition: syzextra.h:190
void Sort_c_ds(const ideal id, const ring r)
inplace sorting of the module (ideal) id wrt <_(c,ds)
Definition: syzextra.cc:527
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
Subexpr e
Definition: subexpr.h:105
#define FALSE
Definition: auxiliary.h:94
#define id_Test(A, lR)
Definition: simpleideals.h:80
#define TRUE
Definition: auxiliary.h:98
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
#define IDHDL
Definition: tok.h:31
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ _TraverseTail()

static BOOLEAN _TraverseTail ( leftv  res,
leftv  h 
)
static

Definition at line 1038 of file mod_main.cc.

1039 {
1040  const SchreyerSyzygyComputationFlags attributes(currRingHdl);
1041 
1042  const BOOLEAN OPT__DEBUG = attributes.OPT__DEBUG;
1043 // const BOOLEAN OPT__SYZCHECK = attributes.OPT__SYZCHECK;
1044 // const BOOLEAN OPT__LEAD2SYZ = attributes.OPT__LEAD2SYZ;
1045 // const BOOLEAN OPT__HYBRIDNF = attributes.OPT__HYBRIDNF;
1046  const BOOLEAN OPT__TAILREDSYZ = attributes.OPT__TAILREDSYZ;
1047 
1048  const char* usage = "`TraverseTail(<poly>, <poly/vector>, <ideal/module>, <ideal/module>[,<module>])` expected";
1049  const ring r = attributes.m_rBaseRing;
1050 
1051  NoReturn(res);
1052 
1053  if ((h==NULL) || (h->Typ() !=POLY_CMD) || (h->Data() == NULL))
1054  {
1055  WerrorS(usage);
1056  return TRUE;
1057  }
1058 
1059  const poly multiplier = (poly) h->Data(); assume (multiplier != NULL);
1060 
1061  h = h->Next();
1062  if ((h==NULL) || (h->Typ()!=VECTOR_CMD && h->Typ() !=POLY_CMD))
1063  {
1064  WerrorS(usage);
1065  return TRUE;
1066  }
1067 
1068  const poly tail = (poly) h->Data();
1069 
1070  h = h->Next();
1071 
1072  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
1073  {
1074  WerrorS(usage);
1075  return TRUE;
1076  }
1077 
1078  const ideal L = (ideal) h->Data();
1079 
1080  assume( IDELEMS(L) > 0 );
1081 
1082  h = h->Next();
1083  if ((h==NULL) || (h->Typ()!=IDEAL_CMD && h->Typ() !=MODUL_CMD) || (h->Data() == NULL))
1084  {
1085  WerrorS(usage);
1086  return TRUE;
1087  }
1088 
1089  const ideal T = (ideal) h->Data();
1090 
1091  assume( IDELEMS(L) == IDELEMS(T) );
1092 
1093  h = h->Next();
1094 
1095  ideal LS = NULL;
1096 
1097  if ((h != NULL) && (h->Typ() ==MODUL_CMD) && (h->Data() != NULL))
1098  {
1099  LS = (ideal)h->Data();
1100  h = h->Next();
1101  }
1102 
1103 #ifndef SING_NDEBUG
1104  if( LIKELY( OPT__TAILREDSYZ) )
1105  assume (LS != NULL);
1106 #endif
1107 
1108  assume( h == NULL );
1109 
1110  if( UNLIKELY( OPT__DEBUG ) )
1111  {
1112  PrintS("TraverseTail(m, t, L, T, #)::Input: \n");
1113 
1114  PrintS("m: "); dPrint(multiplier, r, r, 0);
1115  PrintS("t: "); dPrint(tail, r, r, 0);
1116 
1117 // PrintS("L: "); dPrint(L, r, r, 0);
1118 // PrintS("T: "); dPrint(T, r, r, 0);
1119 
1120  if( LS == NULL )
1121 // PrintS("LS: NULL\n")
1122  ;
1123  else
1124  {
1125 // PrintS("LS: "); dPrint(LS, r, r, 0);
1126  }
1127  }
1128 
1129  res->rtyp = VECTOR_CMD;
1130  res->data = TraverseTail(multiplier, tail, L, T, LS, attributes);
1131 
1132 
1133  if( UNLIKELY( OPT__DEBUG ) )
1134  {
1135  PrintS("TraverseTail::Output: ");
1136  dPrint((poly)res->data, r, r, 0);
1137  }
1138 
1139  return FALSE;
1140 }
Computation attribute storage.
Definition: syzextra.h:190
static poly TraverseTail(poly multiplier, poly tail, ideal L, ideal T, ideal LS, const SchreyerSyzygyComputationFlags A)
Definition: syzextra.h:608
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define UNLIKELY(expression)
Definition: tgb_internal.h:838
#define LIKELY(expression)
Definition: tgb_internal.h:837
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
idhdl currRingHdl
Definition: ipid.cc:65
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
int BOOLEAN
Definition: auxiliary.h:85

◆ DetailedPrint()

static BOOLEAN DetailedPrint ( leftv  __res,
leftv  h 
)
static

Definition at line 269 of file mod_main.cc.

270 {
271  NoReturn(__res);
272 
273  if( h == NULL )
274  {
275  WarnS("DetailedPrint needs an argument...");
276  return TRUE;
277  }
278 
279  if( h->Typ() == NUMBER_CMD)
280  {
281  number n = (number)h->Data();
282 
283  const ring r = currRing;
284 
285  n_Test(n, r->cf);
286 
287  StringSetS("");
288  n_Write(n, r->cf);
289  PrintS(StringEndS());
290  PrintLn();
291 
292  return FALSE;
293  }
294 
295  if( h->Typ() == RING_CMD)
296  {
297  const ring r = (const ring)h->Data();
298  rWrite(r, TRUE);
299  PrintLn();
300 #ifdef RDEBUG
301  //rDebugPrint(r);
302 #endif
303  return FALSE;
304  }
305 
306  if( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD)
307  {
308  const poly p = (const poly)h->Data(); h = h->Next();
309 
311 
312  return FALSE;
313  }
314 
315  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
316  {
317  const ideal id = (const ideal)h->Data(); h = h->Next();
318 
320 
321  return FALSE;
322  }
323 
324  if( h->Typ() == RESOLUTION_CMD )
325  {
326  const syStrategy syzstr = reinterpret_cast<const syStrategy>(h->Data());
327 
328  h = h->Next();
329 
330  int nTerms = getOptionalInteger(h, 1);
331 
332 
333  Print("RESOLUTION_CMD(%p): ", reinterpret_cast<const void*>(syzstr)); PrintLn();
334 
335  const ring save = currRing;
336  const ring r = syzstr->syRing;
337 // const ring rr = (r != NULL) ? r: save;
338 
339 
340  const int iLength = syzstr->length;
341 
342  Print("int 'length': %d", iLength); PrintLn();
343  Print("int 'regularity': %d", syzstr->regularity); PrintLn();
344  Print("short 'list_length': %hd", syzstr->list_length); PrintLn();
345  Print("short 'references': %hd", syzstr->references); PrintLn();
346 
347 
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); }; \
350 PrintLn();
351 
352  PRINT_pINTVECTOR(syzstr, resolution);
353  PRINT_pINTVECTOR(syzstr, betti);
354  PRINT_pINTVECTOR(syzstr, Tl);
355  PRINT_pINTVECTOR(syzstr, cw);
356 #undef PRINT_pINTVECTOR
357 
358  if (r == NULL)
359  Print("ring '%10s': NULL", "syRing");
360  else
361  if (r == currRing)
362  Print("ring '%10s': currRing", "syRing");
363  else
364  if (r != NULL && r != save)
365  {
366  Print("ring '%10s': ", "syRing");
367  rWrite(r);
368 #ifdef RDEBUG
369  // rDebugPrint(r);
370 #endif
371  // rChangeCurrRing(r);
372  }
373  PrintLn();
374 
375  const SRes rP = syzstr->resPairs;
376  Print("SRes 'resPairs': %p", reinterpret_cast<const void*>(rP)); PrintLn();
377 
378  if (rP != NULL)
379  for (int iLevel = 0; (iLevel < iLength) && (rP[iLevel] != NULL) && ((*syzstr->Tl)[iLevel] >= 0); iLevel++)
380  {
381  int n = 0;
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++)
384  {
385  if (rP[iLevel][j].isNotMinimal==NULL)
386  n++;
387  }
388  Print("minimal-resPairs-Size[1+%d]: %d", iLevel, n); PrintLn();
389  }
390 
391 
392  // const ring rrr = (iLevel > 0) ? rr : save; ?
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++) \
396  { \
397  /* const ring rrr = (iLevel > 0) ? save : save; */ \
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/*id_RankFreeModule(((s)->v)[iLevel], rrr)*/ ); \
399  PrintLn(); \
400  } \
401  PrintLn();
402 
403  // resolvente:
404  PRINT_RESOLUTION(syzstr, minres);
405  PRINT_RESOLUTION(syzstr, fullres);
406 
407 // assume (id_RankFreeModule (syzstr->res[1], rr) == syzstr->res[1]->rank);
408 
409  PRINT_RESOLUTION(syzstr, res);
410  PRINT_RESOLUTION(syzstr, orderedRes);
411 #undef PRINT_RESOLUTION
412 
413 #define PRINT_POINTER(s, v) Print("pointer '%17s': %p", #v, reinterpret_cast<const void*>((s)->v)); PrintLn();
414  // 2d arrays:
415  PRINT_POINTER(syzstr, truecomponents);
416  PRINT_POINTER(syzstr, ShiftedComponents);
417  PRINT_POINTER(syzstr, backcomponents);
418  PRINT_POINTER(syzstr, Howmuch);
419  PRINT_POINTER(syzstr, Firstelem);
420  PRINT_POINTER(syzstr, elemLength);
421  PRINT_POINTER(syzstr, sev);
422 
423  // arrays of intvects:
424  PRINT_POINTER(syzstr, weights);
425  PRINT_POINTER(syzstr, hilb_coeffs);
426 #undef PRINT_POINTER
427 
428 
429  if (syzstr->fullres==NULL)
430  {
431  PrintS("resolution 'fullres': (NULL) => resolution not computed yet");
432  PrintLn();
433  } else
434  {
435  Print("resolution 'fullres': (%p) => resolution seems to be computed already", reinterpret_cast<const void*>(syzstr->fullres));
436  PrintLn();
437  dPrint(*syzstr->fullres, save, save, nTerms);
438  }
439 
440 
441 
442 
443  if (syzstr->minres==NULL)
444  {
445  PrintS("resolution 'minres': (NULL) => resolution not minimized yet");
446  PrintLn();
447  } else
448  {
449  Print("resolution 'minres': (%p) => resolution seems to be minimized already", reinterpret_cast<const void*>(syzstr->minres));
450  PrintLn();
451  dPrint(*syzstr->minres, save, save, nTerms);
452  }
453 
454 
455 
456 
457  /*
458  int ** truecomponents;
459  long** ShiftedComponents;
460  int ** backcomponents;
461  int ** Howmuch;
462  int ** Firstelem;
463  int ** elemLength;
464  unsigned long ** sev;
465 
466  intvec ** weights;
467  intvec ** hilb_coeffs;
468 
469  SRes resPairs; //polynomial data for internal use only
470 
471  resolvente fullres;
472  resolvente minres;
473  resolvente res; //polynomial data for internal use only
474  resolvente orderedRes; //polynomial data for internal use only
475 */
476 
477  // if( currRing != save ) rChangeCurrRing(save);
478  }
479 
480 
481  return FALSE;
482 }
int length
Definition: syz.h:60
#define PRINT_pINTVECTOR(s, v)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
short references
Definition: syz.h:63
#define TRUE
Definition: auxiliary.h:98
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 ...
Definition: mod_main.cc:191
char * StringEndS()
Definition: reporter.cc:151
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
int regularity
Definition: syz.h:61
intvec * Tl
Definition: syz.h:50
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define PRINT_RESOLUTION(s, v)
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
int j
Definition: myNF.cc:70
void StringSetS(const char *st)
Definition: reporter.cc:128
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:595
BEGIN_NAMESPACE_SINGULARXX const ring const ring const int nTerms
Definition: DebugPrint.h:30
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:742
void PrintS(const char *s)
Definition: reporter.cc:284
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
resolvente fullres
Definition: syz.h:57
resolvente minres
Definition: syz.h:58
#define NULL
Definition: omList.c:10
ring syRing
Definition: syz.h:56
SRes resPairs
Definition: syz.h:49
void * Data()
Definition: subexpr.cc:1137
SSet * SRes
Definition: syz.h:33
short list_length
Definition: syz.h:62
polyrec * poly
Definition: hilb.h:10
void dPrint(const ideal id, const ring lmRing=currRing, const ring tailRing=currRing, const int nTerms=0)
prints an ideal, optionally with details
#define PRINT_POINTER(s, v)

◆ GetInducedData()

static BOOLEAN GetInducedData ( leftv  res,
leftv  h 
)
static

?

Definition at line 1522 of file mod_main.cc.

1523 {
1524  NoReturn(res);
1525 
1526  const ring r = currRing;
1527 
1528  int p = 0; // which IS-block? p^th!
1529 
1530  if ((h!=NULL) && (h->Typ()==INT_CMD))
1531  {
1532  p = (int)((long)(h->Data())); h=h->next;
1533  assume(p >= 0);
1534  }
1535 
1536  const int pos = rGetISPos(p, r);
1537 
1538  if( /*(*/ -1 == pos /*)*/ )
1539  {
1540  WerrorS("`GetInducedData([int])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1541  return TRUE;
1542  }
1543 
1544 
1545  const int iLimit = r->typ[pos].data.is.limit;
1546  const ideal F = r->typ[pos].data.is.F;
1547 
1548  ideal FF = id_Copy(F, r);
1549 
1551  l->Init(2);
1552 
1553  l->m[0].rtyp = INT_CMD;
1554  l->m[0].data = reinterpret_cast<void *>(iLimit);
1555 
1556 
1557  // l->m[1].rtyp = MODUL_CMD;
1558 
1559  if( id_IsModule(FF, r) ) // ???
1560  {
1561  l->m[1].rtyp = MODUL_CMD;
1562 
1563  // Print("before: %d\n", FF->nrows);
1564  // FF->nrows = id_RankFreeModule(FF, r); // ???
1565  // Print("after: %d\n", FF->nrows);
1566  }
1567  else
1568  l->m[1].rtyp = IDEAL_CMD;
1569 
1570  l->m[1].data = reinterpret_cast<void *>(FF);
1571 
1572  res->rtyp = LIST_CMD; // list of int/module
1573  res->data = reinterpret_cast<void *>(l);
1574 
1575  return FALSE;
1576 
1577 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
ideal id_Copy(ideal h1, const ring r)
copy an ideal
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
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 - ...
Definition: ring.cc:4903
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
leftv next
Definition: subexpr.h:86
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
int l
Definition: cfEzgcd.cc:94

◆ getOptionalInteger()

static int getOptionalInteger ( const leftv h,
const int  _n 
)
static

try to get an optional (simple) integer argument out of h or return the default value

Definition at line 191 of file mod_main.cc.

192 {
193  if( h!= NULL && h->Typ() == INT_CMD )
194  {
195  int n = (int)(long)(h->Data());
196 
197  if( n < 0 )
198  Warn("Negative (%d) optional integer argument", n);
199 
200  return (n);
201  }
202 
203  return (_n);
204 }
Definition: tok.h:95
int Typ()
Definition: subexpr.cc:995
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137
#define Warn
Definition: emacs.cc:80

◆ idPrepare()

static BOOLEAN idPrepare ( leftv  res,
leftv  h 
)
static

Get raw syzygies (idPrepare)

Definition at line 1818 of file mod_main.cc.

1819 {
1820  // extern int rGetISPos(const int p, const ring r);
1821 
1822  const ring r = currRing;
1823 
1824  const bool isSyz = rIsSyzIndexRing(r);
1825  const int posIS = rGetISPos(0, r);
1826 
1827 
1828  if ( !( (h!=NULL) && (h->Typ()==MODUL_CMD) && (h->Data() != NULL) ) )
1829  {
1830  WerrorS("`idPrepare(<module>)` expected");
1831  return TRUE;
1832  }
1833 
1834  const ideal I = reinterpret_cast<ideal>(h->Data());
1835 
1836  assume( I != NULL );
1837  idTest(I);
1838 
1839  int iComp = -1;
1840 
1841  h=h->next;
1842  if ( (h!=NULL) && (h->Typ()==INT_CMD) )
1843  {
1844  iComp = (int)((long)(h->Data()));
1845  }
1846  else
1847  {
1848  if( (!isSyz) && (-1 == posIS) )
1849  {
1850  WerrorS("`idPrepare(<...>)` called on incompatible ring (not created by 'MakeSyzCompOrdering' or 'MakeInducedSchreyerOrdering'!)");
1851  return TRUE;
1852  }
1853 
1854  if( isSyz )
1855  iComp = rGetCurrSyzLimit(r);
1856  else
1857  iComp = id_RankFreeModule(r->typ[posIS].data.is.F, r); // ;
1858  }
1859 
1860  assume(iComp >= 0);
1861 
1862 
1863  intvec* w = reinterpret_cast<intvec *>(atGet(h, "isHomog", INTVEC_CMD));
1864  tHomog hom = testHomog;
1865 
1866  // int add_row_shift = 0;
1867  //
1868  if (w!=NULL)
1869  {
1870  w = ivCopy(w);
1871  // add_row_shift = ww->min_in();
1872  //
1873  // (*ww) -= add_row_shift;
1874  //
1875  // if (idTestHomModule(I, currRing->qideal, ww))
1876  // {
1877  hom = isHomog;
1878  // w = ww;
1879  // }
1880  // else
1881  // {
1882  // //WarnS("wrong weights");
1883  // delete ww;
1884  // w = NULL;
1885  // hom=testHomog;
1886  // }
1887  }
1888 
1889 
1890  // computes syzygies of h1,
1891  // works always in a ring with ringorder_s
1892  // NOTE: rSetSyzComp(syzcomp) should better be called beforehand
1893  // ideal idPrepare (ideal h1, tHomog hom, int syzcomp, intvec **w);
1894 
1895  ideal J = // idPrepare( I, hom, iComp, &w);
1896  kStd(I, currRing->qideal, hom, &w, NULL, iComp);
1897 
1898  idTest(J);
1899 
1900  if (w!=NULL)
1901  atSet(res, omStrDup("isHomog"), w, INTVEC_CMD);
1902  // if (w!=NULL) delete w;
1903 
1904  res->rtyp = MODUL_CMD;
1905  res->data = reinterpret_cast<void *>(J);
1906  return FALSE;
1907 }
Definition: tok.h:95
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
intvec * ivCopy(const intvec *o)
Definition: intvec.h:126
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
void WerrorS(const char *s)
Definition: feFopen.cc:24
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 - ...
Definition: ring.cc:4903
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
#define assume(x)
Definition: mod2.h:394
void atSet(idhdl root, char *name, void *data, int typ)
Definition: attrib.cc:158
leftv next
Definition: subexpr.h:86
void * atGet(idhdl root, const char *name, int t, void *defaultReturnValue)
Definition: attrib.cc:137
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
#define idTest(id)
Definition: ideals.h:47
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ ISUpdateComponents()

static BOOLEAN ISUpdateComponents ( leftv  res,
leftv  h 
)
static

Definition at line 1743 of file mod_main.cc.

1744 {
1745  NoReturn(res);
1746 
1747  PrintS("ISUpdateComponents:.... \n");
1748 
1749  if ((h!=NULL) && (h->Typ()==MODUL_CMD))
1750  {
1751  ideal F = (ideal)h->Data(); ; // No copy!
1752  h=h->next;
1753 
1754  if ((h!=NULL) && (h->Typ()==INTVEC_CMD))
1755  {
1756  const intvec* const V = (const intvec* const) h->Data();
1757  h=h->next;
1758 
1759  if ((h!=NULL) && (h->Typ()==INT_CMD))
1760  {
1761  const int MIN = (int)((long)(h->Data()));
1762 
1763  pISUpdateComponents(F, V, MIN, currRing);
1764  return FALSE;
1765  }
1766  }
1767  }
1768 
1769  WerrorS("`ISUpdateComponents(<module>, intvec, int)` expected");
1770  return TRUE;
1771 }
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define MIN(a, b)
Definition: omDebug.c:102
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
void PrintS(const char *s)
Definition: reporter.cc:284
leftv next
Definition: subexpr.h:86
void pISUpdateComponents(ideal F, const intvec *const V, const int MIN, const ring r)
Definition: ring.cc:4254
#define NULL
Definition: omList.c:10
void * Data()
Definition: subexpr.cc:1137

◆ jjLONG2N()

static number jjLONG2N ( long  d)
inlinestatic

Definition at line 242 of file mod_main.cc.

243 {
244  return n_Init(d, coeffs_BIGINT);
245 }
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:542
coeffs coeffs_BIGINT
Definition: ipid.cc:54

◆ leadcomp()

static BOOLEAN leadcomp ( leftv  res,
leftv  h 
)
static

Get leading component.

Definition at line 1381 of file mod_main.cc.

1382 {
1383  NoReturn(res);
1384 
1385  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD))
1386  {
1387  const ring r = currRing;
1388 
1389  const poly p = (poly)(h->Data());
1390 
1391  if (p != NULL )
1392  {
1393  assume( p != NULL );
1394  p_LmTest(p, r);
1395 
1396  const unsigned long iComp = p_GetComp(p, r);
1397 
1398  // assume( iComp > 0 ); // p is a vector
1399 
1400  res->data = reinterpret_cast<void *>(jjLONG2N(iComp));
1401  } else
1402  res->data = reinterpret_cast<void *>(jjLONG2N(0));
1403 
1404 
1405  res->rtyp = BIGINT_CMD;
1406  return FALSE;
1407  }
1408 
1409  WerrorS("`leadcomp(<poly/vector>)` expected");
1410  return TRUE;
1411 }
static number jjLONG2N(long d)
Definition: mod_main.cc:242
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
#define p_LmTest(p, r)
Definition: p_polys.h:161
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10

◆ leadrawexp()

static BOOLEAN leadrawexp ( leftv  res,
leftv  h 
)
static

Get raw leading exponent vector.

Definition at line 1417 of file mod_main.cc.

1418 {
1419  NoReturn(res);
1420 
1421  if ((h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) && (h->Data() != NULL))
1422  {
1423  const ring r = currRing;
1424  const poly p = (poly)(h->Data());
1425 
1426  assume( p != NULL );
1427  p_LmTest(p, r);
1428 
1429  const int iExpSize = r->ExpL_Size;
1430 
1431 // intvec *iv = new intvec(iExpSize);
1432 
1434  l->Init(iExpSize);
1435 
1436  for(int i = iExpSize-1; i >= 0; i--)
1437  {
1438  l->m[i].rtyp = BIGINT_CMD;
1439  l->m[i].data = reinterpret_cast<void *>(jjLONG2N(p->exp[i])); // longs...
1440  }
1441 
1442  res->rtyp = LIST_CMD; // list of bigints
1443  res->data = reinterpret_cast<void *>(l);
1444  return FALSE;
1445  }
1446 
1447  WerrorS("`leadrawexp(<poly/vector>)` expected");
1448  return TRUE;
1449 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
sleftv * m
Definition: lists.h:45
static number jjLONG2N(long d)
Definition: mod_main.cc:242
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
Definition: lists.h:22
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:38
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
#define p_LmTest(p, r)
Definition: p_polys.h:161
INLINE_THIS void Init(int l=0)
#define NULL
Definition: omList.c:10
slists * lists
Definition: mpr_numeric.h:146
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
Definition: tok.h:117
omBin slists_bin
Definition: lists.cc:23
polyrec * poly
Definition: hilb.h:10
int l
Definition: cfEzgcd.cc:94

◆ MakeInducedSchreyerOrdering()

static BOOLEAN MakeInducedSchreyerOrdering ( leftv  res,
leftv  h 
)
static

Same for Induced Schreyer ordering (ordering on components is defined by sign!)

Definition at line 1468 of file mod_main.cc.

1469 {
1470 
1471  NoReturn(res);
1472 
1473  int sign = 1;
1474  if ((h!=NULL) && (h->Typ()==INT_CMD))
1475  {
1476  const int s = (int)((long)(h->Data()));
1477 
1478  if( s != -1 && s != 1 )
1479  {
1480  WerrorS("`MakeInducedSchreyerOrdering(<int>)` called with wrong integer argument (must be +-1)!");
1481  return TRUE;
1482  }
1483 
1484  sign = s;
1485  }
1486 
1487  assume( sign == 1 || sign == -1 );
1488  res->data = reinterpret_cast<void *>(rAssure_InducedSchreyerOrdering(currRing, TRUE, sign));
1489  res->rtyp = RING_CMD; // return new ring!
1490  // QRING_CMD?
1491  return FALSE;
1492 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
ring rAssure_InducedSchreyerOrdering(const ring r, BOOLEAN complete, int sgn)
Definition: ring.cc:4767
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
static int sign(int x)
Definition: ring.cc:3342

◆ MakeSyzCompOrdering()

static BOOLEAN MakeSyzCompOrdering ( leftv  res,
leftv   
)
static

Endowe the current ring with additional (leading) Syz-component ordering.

Definition at line 1453 of file mod_main.cc.

1454 {
1455 
1456  NoReturn(res);
1457 
1458  // res->data = rCurrRingAssure_SyzComp(); // changes current ring! :(
1459  res->data = reinterpret_cast<void *>(rAssure_SyzComp(currRing, TRUE));
1460  res->rtyp = RING_CMD; // return new ring!
1461  // QRING_CMD?
1462 
1463  return FALSE;
1464 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4363
int rtyp
Definition: subexpr.h:91

◆ noop()

static BOOLEAN noop ( leftv  __res,
leftv   
)
static

Definition at line 206 of file mod_main.cc.

207 {
208  NoReturn(__res);
209  return FALSE;
210 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94

◆ NoReturn()

static void NoReturn ( leftv res)
inlinestatic

Definition at line 90 of file mod_main.cc.

91 {
92  res->rtyp = NONE;
93  res->data = NULL;
94 }
void * data
Definition: subexpr.h:88
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
#define NONE
Definition: tok.h:216

◆ reduce_syz()

static BOOLEAN reduce_syz ( leftv  res,
leftv  h 
)
static

NF using length.

Definition at line 1775 of file mod_main.cc.

1776 {
1777  // const ring r = currRing;
1778 
1779  if ( !( (h!=NULL) && (h->Typ()==VECTOR_CMD || h->Typ()==POLY_CMD) ) )
1780  {
1781  WerrorS("`reduce_syz(<poly/vector>!, <ideal/module>, <int>, [int])` expected");
1782  return TRUE;
1783  }
1784 
1785  res->rtyp = h->Typ();
1786  const poly v = reinterpret_cast<poly>(h->Data());
1787  h=h->next;
1788 
1789  if ( !( (h!=NULL) && (h->Typ()==MODUL_CMD || h->Typ()==IDEAL_CMD ) ) )
1790  {
1791  WerrorS("`reduce_syz(<poly/vector>, <ideal/module>!, <int>, [int])` expected");
1792  return TRUE;
1793  }
1794 
1795  assumeStdFlag(h);
1796  const ideal M = reinterpret_cast<ideal>(h->Data()); h=h->next;
1797 
1798 
1799  if ( !( (h!=NULL) && (h->Typ()== INT_CMD) ) )
1800  {
1801  WerrorS("`reduce_syz(<poly/vector>, <ideal/module>, <int>!, [int])` expected");
1802  return TRUE;
1803  }
1804 
1805  const int iSyzComp = (int)((long)(h->Data())); h=h->next;
1806 
1807  int iLazyReduce = 0;
1808 
1809  if ( ( (h!=NULL) && (h->Typ()== INT_CMD) ) )
1810  iLazyReduce = (int)((long)(h->Data()));
1811 
1812  res->data = (void *)kNFLength(M, currRing->qideal, v, iSyzComp, iLazyReduce); // NOTE: currRing :(
1813  return FALSE;
1814 }
Definition: tok.h:95
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1474
leftv next
Definition: subexpr.h:86
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
polyrec * poly
Definition: hilb.h:10

◆ SetInducedReferrence()

static BOOLEAN SetInducedReferrence ( leftv  res,
leftv  h 
)
static

Returns old SyzCompLimit, can set new limit.

Definition at line 1693 of file mod_main.cc.

1694 {
1695  NoReturn(res);
1696 
1697  const ring r = currRing;
1698 
1699  if( !( (h!=NULL) && ( (h->Typ()==IDEAL_CMD) || (h->Typ()==MODUL_CMD))) )
1700  {
1701  WerrorS("`SetInducedReferrence(<ideal/module>, [int[, int]])` expected");
1702  return TRUE;
1703  }
1704 
1705  const ideal F = (ideal)h->Data(); ; // No copy!
1706  h=h->next;
1707 
1708  int rank = 0;
1709 
1710  if ((h!=NULL) && (h->Typ()==INT_CMD))
1711  {
1712  rank = (int)((long)(h->Data())); h=h->next;
1713  assume(rank >= 0);
1714  } else
1715  rank = id_RankFreeModule(F, r); // Starting syz-comp (1st: i+1)
1716 
1717  int p = 0; // which IS-block? p^th!
1718 
1719  if ((h!=NULL) && (h->Typ()==INT_CMD))
1720  {
1721  p = (int)((long)(h->Data())); h=h->next;
1722  assume(p >= 0);
1723  }
1724 
1725  const int posIS = rGetISPos(p, r);
1726 
1727  if( /*(*/ -1 == posIS /*)*/ )
1728  {
1729  WerrorS("`SetInducedReferrence(<ideal/module>, [int[, int]])` called on incompatible ring (not created by 'MakeInducedSchreyerOrdering'!)");
1730  return TRUE;
1731  }
1732 
1733 
1734 
1735  // F & componentWeights belong to that ordering block of currRing now:
1736  rSetISReference(r, F, rank, p); // F will be copied!
1737  return FALSE;
1738 }
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
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 - ...
Definition: ring.cc:4903
int Typ()
Definition: subexpr.cc:995
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define assume(x)
Definition: mod2.h:394
leftv next
Definition: subexpr.h:86
#define NULL
Definition: omList.c:10
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...
Definition: ring.cc:4935
void * Data()
Definition: subexpr.cc:1137

◆ SetSyzComp()

static BOOLEAN SetSyzComp ( leftv  res,
leftv  h 
)
static

Returns old SyzCompLimit, can set new limit.

Definition at line 1496 of file mod_main.cc.

1497 {
1498  NoReturn(res);
1499 
1500  const ring r = currRing;
1501 
1502  if( !rIsSyzIndexRing(r) )
1503  {
1504  WerrorS("`SetSyzComp(<int>)` called on incompatible ring (not created by 'MakeSyzCompOrdering'!)");
1505  return TRUE;
1506  }
1507 
1508  res->rtyp = INT_CMD;
1509  res->data = reinterpret_cast<void *>(rGetCurrSyzLimit(r)); // return old syz limit
1510 
1511  if ((h!=NULL) && (h->Typ()==INT_CMD))
1512  {
1513  const int iSyzComp = (int)reinterpret_cast<long>(h->Data());
1514  assume( iSyzComp > 0 );
1515  rSetSyzComp(iSyzComp, currRing);
1516  }
1517 
1518  return FALSE;
1519 }
Definition: tok.h:95
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
#define TRUE
Definition: auxiliary.h:98
void WerrorS(const char *s)
Definition: feFopen.cc:24
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:394
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137

◆ syzextra()

END_NAMESPACE int SI_MOD_INIT() syzextra ( SModulFunctions psModulFunctions)

Definition at line 1995 of file mod_main.cc.

1996 {
1997 
1998 #define ADD(C,D,E) \
1999  psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""), (char*)C, D, E);
2000 
2001 
2002 // #define ADD(A,B,C,D,E) ADD0(iiAddCproc, "", C, D, E)
2003 
2004 //#define ADD0(A,B,C,D,E) A(B, (char*)C, D, E)
2005 // #define ADD(A,B,C,D,E) ADD0(A->iiAddCproc, B, C, D, E)
2006  ADD("ClearContent", FALSE, _ClearContent);
2007  ADD("ClearDenominators", FALSE, _ClearDenominators);
2008 
2009  ADD("m2_end", FALSE, _m2_end);
2010 
2011  ADD("DetailedPrint", FALSE, DetailedPrint);
2012  ADD("leadmonomial", FALSE, _leadmonom);
2013  ADD("leadcomp", FALSE, leadcomp);
2014  ADD("leadrawexp", FALSE, leadrawexp);
2015 
2016  ADD("ISUpdateComponents", FALSE, ISUpdateComponents);
2017  ADD("SetInducedReferrence", FALSE, SetInducedReferrence);
2018  ADD("GetInducedData", FALSE, GetInducedData);
2019  ADD("SetSyzComp", FALSE, SetSyzComp);
2020  ADD("MakeInducedSchreyerOrdering", FALSE, MakeInducedSchreyerOrdering);
2021  ADD("MakeSyzCompOrdering", FALSE, MakeSyzCompOrdering);
2022 
2023  ADD("ProfilerStart", FALSE, _ProfilerStart);
2024  ADD("ProfilerStop", FALSE, _ProfilerStop );
2025 
2026  ADD("noop", FALSE, noop);
2027  ADD("idPrepare", FALSE, idPrepare);
2028  ADD("reduce_syz", FALSE, reduce_syz);
2029 
2030  ADD("p_Content", FALSE, _p_Content);
2031 
2032  ADD("Tail", FALSE, Tail);
2033 
2034  ADD("ComputeLeadingSyzygyTerms", FALSE, _ComputeLeadingSyzygyTerms);
2035  ADD("Compute2LeadingSyzygyTerms", FALSE, _Compute2LeadingSyzygyTerms);
2036 
2037  ADD("Sort_c_ds", FALSE, _Sort_c_ds);
2038  ADD("FindReducer", FALSE, _FindReducer);
2039 
2040 
2041  ADD("ReduceTerm", FALSE, _ReduceTerm);
2042  ADD("TraverseTail", FALSE, _TraverseTail);
2043 
2044 
2045  ADD("SchreyerSyzygyNF", FALSE, _SchreyerSyzygyNF);
2046  ADD("ComputeSyzygy", FALSE, _ComputeSyzygy);
2047 
2048  ADD("ComputeResolution", FALSE, _ComputeResolution);
2049 // ADD("GetAMData", FALSE, GetAMData);
2050 
2051  ADD("NumberStatsInit", FALSE, _NumberStatsInit);
2052  ADD("NumberStatsPrint", FALSE, _NumberStatsPrint);
2053 
2054  // ADD("", FALSE, );
2055 
2056 #undef ADD
2057  return MAX_TOK;
2058 }
static BOOLEAN idPrepare(leftv res, leftv h)
Get raw syzygies (idPrepare)
Definition: mod_main.cc:1818
static BOOLEAN noop(leftv __res, leftv)
Definition: mod_main.cc:206
#define FALSE
Definition: auxiliary.h:94
Definition: tok.h:213
static BOOLEAN _ClearContent(leftv res, leftv h)
wrapper around n_ClearContent
Definition: mod_main.cc:97
static BOOLEAN Tail(leftv res, leftv h)
wrapper around p_Tail and id_Tail
Definition: mod_main.cc:485
static BOOLEAN SetSyzComp(leftv res, leftv h)
Returns old SyzCompLimit, can set new limit.
Definition: mod_main.cc:1496
static BOOLEAN MakeSyzCompOrdering(leftv res, leftv)
Endowe the current ring with additional (leading) Syz-component ordering.
Definition: mod_main.cc:1453
static BOOLEAN DetailedPrint(leftv __res, leftv h)
Definition: mod_main.cc:269
static BOOLEAN leadrawexp(leftv res, leftv h)
Get raw leading exponent vector.
Definition: mod_main.cc:1417
static BOOLEAN _ComputeResolution(leftv res, leftv h)
Definition: mod_main.cc:1143
static BOOLEAN GetInducedData(leftv res, leftv h)
?
Definition: mod_main.cc:1522
static BOOLEAN _ProfilerStop(leftv __res, leftv)
Definition: mod_main.cc:230
static BOOLEAN leadcomp(leftv res, leftv h)
Get leading component.
Definition: mod_main.cc:1381
#define ADD(C, D, E)
static BOOLEAN _SchreyerSyzygyNF(leftv res, leftv h)
Definition: mod_main.cc:784
static BOOLEAN _p_Content(leftv res, leftv h)
Get raw syzygies (idPrepare)
Definition: mod_main.cc:1910
static BOOLEAN _TraverseTail(leftv res, leftv h)
Definition: mod_main.cc:1038
static BOOLEAN SetInducedReferrence(leftv res, leftv h)
Returns old SyzCompLimit, can set new limit.
Definition: mod_main.cc:1693
static BOOLEAN MakeInducedSchreyerOrdering(leftv res, leftv h)
Same for Induced Schreyer ordering (ordering on components is defined by sign!)
Definition: mod_main.cc:1468
static BOOLEAN _ProfilerStart(leftv __res, leftv h)
Definition: mod_main.cc:212
static BOOLEAN _NumberStatsInit(leftv res, leftv h)
Definition: mod_main.cc:1953
static BOOLEAN _ComputeLeadingSyzygyTerms(leftv res, leftv h)
Definition: mod_main.cc:525
static BOOLEAN _FindReducer(leftv res, leftv h)
proc SSFindReducer(def product, def syzterm, def L, def T, list #)
Definition: mod_main.cc:687
static BOOLEAN reduce_syz(leftv res, leftv h)
NF using length.
Definition: mod_main.cc:1775
static BOOLEAN _Compute2LeadingSyzygyTerms(leftv res, leftv h)
Definition: mod_main.cc:637
static BOOLEAN _NumberStatsPrint(leftv res, leftv h)
Definition: mod_main.cc:1974
static BOOLEAN _ClearDenominators(leftv res, leftv h)
wrapper around n_ClearDenominators
Definition: mod_main.cc:143
static BOOLEAN _ReduceTerm(leftv res, leftv h)
proc SSReduceTerm(poly m, def t, def syzterm, def L, def T, list #)
Definition: mod_main.cc:893
static BOOLEAN _ComputeSyzygy(leftv res, leftv h)
module (LL, TT) = SSComputeSyzygy(L, T); Compute Syz(L ++ T) = N = LL ++ TT
Definition: mod_main.cc:1291
static BOOLEAN _Sort_c_ds(leftv res, leftv h)
sorting wrt <c,ds> & reversing... change the input inplace!!!
Definition: mod_main.cc:575
static BOOLEAN _m2_end(leftv res, leftv h)
Definition: mod_main.cc:1934
static BOOLEAN _leadmonom(leftv res, leftv h)
Get leading term without a module component.
Definition: mod_main.cc:1361
static BOOLEAN ISUpdateComponents(leftv res, leftv h)
Definition: mod_main.cc:1743

◆ Tail()

static BOOLEAN Tail ( leftv  res,
leftv  h 
)
static

wrapper around p_Tail and id_Tail

Definition at line 485 of file mod_main.cc.

486 {
487  NoReturn(res);
488 
489  if( h == NULL )
490  {
491  WarnS("Tail needs a poly/vector/ideal/module argument...");
492  return TRUE;
493  }
494 
495  assume( h != NULL );
496 
497  const ring r = currRing;
498 
499  if( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD)
500  {
501  res->data = p_Tail( (const poly)h->Data(), r );
502  res->rtyp = h->Typ();
503 
504  h = h->Next(); assume (h == NULL);
505 
506  return FALSE;
507  }
508 
509  if( h->Typ() == IDEAL_CMD || h->Typ() == MODUL_CMD)
510  {
511  res->data = id_Tail( (const ideal)h->Data(), r );
512  res->rtyp = h->Typ();
513 
514  h = h->Next(); assume (h == NULL);
515 
516  return FALSE;
517  }
518 
519  WarnS("Tail needs a single poly/vector/ideal/module argument...");
520  return TRUE;
521 }
static void NoReturn(leftv &res)
Definition: mod_main.cc:90
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
poly p_Tail(const poly p, const ring r)
return the tail of a given polynomial or vector returns NULL if input is NULL, otherwise the result i...
Definition: syzextra.cc:501
#define WarnS
Definition: emacs.cc:81
int Typ()
Definition: subexpr.cc:995
void * data
Definition: subexpr.h:88
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
leftv Next()
Definition: subexpr.h:136
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:91
void * Data()
Definition: subexpr.cc:1137
ideal id_Tail(const ideal id, const ring r)
return the tail of a given ideal or module returns NULL if input is NULL, otherwise the result is a n...
Definition: syzextra.cc:510
polyrec * poly
Definition: hilb.h:10

◆ USING_NAMESPACE()

USING_NAMESPACE ( SINGULARXXNAME ::DEBUG  )

Definition at line 57 of file mod_main.cc.

68 {
69  id_Test(id, r);
70 
71  if( id->rank != 1 ) return TRUE;
72 
73  if (rRing_has_Comp(r))
74  {
75  const int l = IDELEMS(id);
76 
77  for (int j=0; j<l; j++)
78  if (id->m[j] != NULL && p_GetComp(id->m[j], r) > 0)
79  return TRUE;
80 
81  return FALSE; // rank: 1, only zero or no entries? can be an ideal OR module... BUT in the use-case should better be an ideal!
82  }
83 
84  return FALSE;
85 }
#define FALSE
Definition: auxiliary.h:94
#define id_Test(A, lR)
Definition: simpleideals.h:80
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define IDELEMS(i)
Definition: simpleideals.h:24
#define rRing_has_Comp(r)
Definition: monomials.h:274
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94

◆ view()

static void view ( const intvec v)
inlinestatic

Definition at line 247 of file mod_main.cc.

248 {
249 #ifndef SING_NDEBUG
250  v->view();
251 #else
252  // This code duplication is only due to Hannes's #ifndef SING_NDEBUG!
253  Print ("intvec: {rows: %d, cols: %d, length: %d, Values: \n", v->rows(), v->cols(), v->length());
254 
255  for (int i = 0; i < v->rows(); i++)
256  {
257  Print ("Row[%3d]:", i);
258  for (int j = 0; j < v->cols(); j++)
259  Print (" %5d", (*v)[j + i * (v->cols())] );
260  PrintLn ();
261  }
262  PrintS ("}\n");
263 #endif
264 
265 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
void view() const
Definition: intvec.cc:135
int rows() const
Definition: intvec.h:88
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int length() const
Definition: intvec.h:86
int cols() const
Definition: intvec.h:87