Macros | Functions | Variables
myNF.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/intvec.h>
#include <misc/options.h>
#include <polys/monomials/p_polys.h>
#include <polys/kbuckets.h>
#include <kernel/structs.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/syz.h>
#include <kernel/GBEngine/kutil.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/polys.h>
#include "myNF.h"
#include <polys/nc/sca.h>
#include <polys/nc/nc.h>
#include <kernel/GBEngine/nc.h>

Go to the source code of this file.

Macros

#define PLURAL_INTERNAL_DECLARATIONS   1
 

Functions

 BEGIN_NAMESPACE () static poly redNFLength(poly h
 reduction procedure for the normal form, which uses pLength instead of pSize! More...
 
 if (0 > strat->sl)
 
LObject P (h)
 
P SetShortExpVector ()
 
 kBucketInit (P.bucket, P.p, pLength(P.p))
 
 kbTest (P.bucket)
 
 if (TEST_OPT_DEBUG)
 
 if (j >=0)
 
 pNormalize (P.p)
 
poly kNF2Length (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX BEGIN_NAMESPACE (NF) poly kNFLength(ideal F
 
 if (rIsSCA(currRing))
 
 if ((idIs0(F))&&(Q==NULL))
 
 if (rHasLocalOrMixedOrdering(currRing)==-1) res
 
 delete (strat)
 
 if (pp !=p) p_Delete(&pp
 

Variables

int & max_ind =strat->sl
 
int int nonorm
 
int int kStrategy strat
 
int j
 
P bucket = kBucketCreate(currRing)
 
BOOLEAN is_ring = rField_is_Ring(currRing)
 
 loop
 
 else
 
kBucketDestroyP
 
return P p
 
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal Q
 
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp = syzComp
 
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
 
poly pp = p
 
strat ak = si_max(id_RankFreeModule(F, currRing),pMaxComp(p))
 
poly res =kNF2Length(F,Q,pp,strat,lazyReduce)
 
 currRing
 Widely used global variable which specifies the current polynomial ring for Singular interpreter and legacy implementatins. : one should avoid using it in newer designs, for example due to possible problems in parallelization with threads. More...
 

Macro Definition Documentation

§ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS   1

Definition at line 55 of file myNF.cc.

Function Documentation

§ BEGIN_NAMESPACE() [1/2]

BEGIN_NAMESPACE ( )

reduction procedure for the normal form, which uses pLength instead of pSize!

§ BEGIN_NAMESPACE() [2/2]

END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX BEGIN_NAMESPACE ( NF  )

§ delete()

delete ( strat  )

§ if() [1/7]

if ( ,
strat->  sl 
)

Definition at line 73 of file myNF.cc.

74  {
75  return h;
76  }
static Poly * h
Definition: janet.cc:978

§ if() [2/7]

if ( TEST_OPT_DEBUG  )

Definition at line 86 of file myNF.cc.

87  {
88  PrintS("redNF: starting S: ");
89  for( j = 0; j <= max_ind; j++ )
90  {
91  Print("S[%d] (of size: %d): ", j, pLength(strat->S[j]));
92  wrp(strat->S[j]);
93  }
94  };
#define Print
Definition: emacs.cc:83
int & max_ind
Definition: myNF.cc:67
int j
Definition: myNF.cc:70
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
polyset S
Definition: kutil.h:300
int int kStrategy strat
Definition: myNF.cc:68
void wrp(poly p)
Definition: polys.h:293

§ if() [3/7]

if ( j >=  0)

Definition at line 100 of file myNF.cc.

101  {
102 #ifdef HAVE_RINGS
103  if (!is_ring)
104  {
105 #endif
106  int sl=pLength(strat->S[j]);
107  int jj=j;
108  loop
109  {
110  int sll;
112  if (jj<0) break;
113  sll=pLength(strat->S[jj]);
114  if (sll<sl)
115  {
116 #ifdef KDEBUG
117  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
118 #endif
119  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
120  j=jj;
121  sl=sll;
122  }
123  }
124  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
125  {
126  pNorm(strat->S[j]);
127  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
128  }
129 #ifdef HAVE_RINGS
130  }
131 #endif
132  nNormalize(pGetCoeff(P.p));
133 #ifdef KDEBUG
134  if (TEST_OPT_DEBUG)
135  {
136  PrintS("red:");
137  wrp(h);
138  PrintS(" with ");
139  wrp(strat->S[j]);
140  }
141 #endif
142 #ifdef HAVE_PLURAL
143  if (rIsPluralRing(currRing))
144  {
145  number coef;
146  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
147  nDelete(&coef);
148  }
149  else
150 #endif
151  {
152  number coef;
153  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
154  nDelete(&coef);
155  }
156  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
157  if (h==NULL)
158  {
159  kBucketDestroy(&P.bucket);
160 
161 #ifdef KDEBUG
162  if (TEST_OPT_DEBUG)
163  {
164  PrintS("redNF: starting S: ");
165  for( j = 0; j <= max_ind; j++ )
166  {
167  Print("S[%d] (of size: %d): ", j, pLength(strat->S[j]));
168  wrp(strat->S[j]);
169  }
170  };
171 #endif
172 
173  return NULL;
174  }
175  kbTest(P.bucket);
176  P.p=h;
177  P.t_p=NULL;
178  P.SetShortExpVector();
179 #ifdef KDEBUG
180  if (TEST_OPT_DEBUG)
181  {
182  PrintS("\nto:");
183  wrp(h);
184  PrintLn();
185  }
186 #endif
187  }
kbTest(P.bucket)
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:259
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define nNormalize(n)
Definition: numbers.h:30
loop
Definition: myNF.cc:98
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1053
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:480
int & max_ind
Definition: myNF.cc:67
poly kNoether
Definition: kutil.h:324
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
BOOLEAN is_ring
Definition: myNF.cc:83
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
int j
Definition: myNF.cc:70
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
int int kStrategy strat
Definition: myNF.cc:68
#define NULL
Definition: omList.c:10
currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: myNF.cc:332
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
void wrp(poly p)
Definition: polys.h:293
kBucketDestroy & P
Definition: myNF.cc:191
static Poly * h
Definition: janet.cc:978
int int nonorm
Definition: myNF.cc:67

§ if() [4/7]

if ( rIsSCA(currRing )

Definition at line 299 of file myNF.cc.

300  {
301  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
302  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
303  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
304 
305  if(Q == currRing->qideal)
307  }
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1478
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal Q
Definition: myNF.cc:291
poly pp
Definition: myNF.cc:296
static short scaFirstAltVar(ring r)
Definition: sca.h:18
currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: myNF.cc:332
static short scaLastAltVar(ring r)
Definition: sca.h:25

§ if() [5/7]

if ( (idIs0(F))&&(Q==NULL )

Definition at line 310 of file myNF.cc.

311  {
312 #ifdef HAVE_PLURAL
313  if(p != pp)
314  return pp;
315 #endif
316  return pCopy(p); /*F+Q=0*/
317  }
return P p
Definition: myNF.cc:203
poly pp
Definition: myNF.cc:296
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ if() [6/7]

§ if() [7/7]

if ( pp = p)

§ kbTest()

kbTest ( P.  bucket)

§ kBucketInit()

kBucketInit ( P.  bucket,
P.  p,
pLength(P.p  
)

§ kNF2Length()

poly kNF2Length ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 212 of file myNF.cc.

213 {
214  assume(q!=NULL);
215  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
216 
217 // lazy_reduce flags: can be combined by |
218 //#define KSTD_NF_LAZY 1
219  // do only a reduction of the leading term
220 //#define KSTD_NF_NONORM 4
221  // only global: avoid normalization, return a multiply of NF
222  poly p;
223  // int i;
224 
225  //if ((idIs0(F))&&(Q==NULL))
226  // return pCopy(q); /*F=0*/
227  //strat->ak = id_RankFreeModule(F, RING!);
228  /*- creating temp data structures------------------- -*/
229  BITSET save1;
230  SI_SAVE_OPT1(save1);
232  initBuchMoraCrit(strat);
233  strat->initEcart = initEcartBBA;
234  strat->enterS = enterSBba;
235 #ifndef NO_BUCKETS
237 #endif
238  /*- set S -*/
239  strat->sl = -1;
240  /*- init local data struct.---------------------------------------- -*/
241  /*Shdl=*/initS(F,Q,strat);
242  /*- compute------------------------------------------------------- -*/
243  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
244  //{
245  // for (i=strat->sl;i>=0;i--)
246  // pNorm(strat->S[i]);
247  //}
248  kTest(strat);
249  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
250 
251  if (BVERBOSE(23)) kDebugPrint(strat);
252 
253  int max_ind;
254  p = redNFLength(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
255  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
256  {
257  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
258 #ifdef HAVE_RINGS
260  {
261  p = redtailBba_Z(p,max_ind,strat);
262  }
263  else
264 #endif
265  {
267  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
268  }
269  }
270  /*- release temp data------------------------------- -*/
271  omfree(strat->sevS);
272  omfree(strat->ecartS);
273  omfree(strat->T);
274  omfree(strat->sevT);
275  omfree(strat->R);
276  omfree(strat->S_2_R);
277  omfree(strat->L);
278  omfree(strat->B);
279  omfree(strat->fromQ);
280  idDelete(&strat->Shdl);
281  SI_RESTORE_OPT1(save1);
282  if (TEST_OPT_PROT) PrintLn();
283  return p;
284 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:310
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1104
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:654
unsigned long * sevT
Definition: kutil.h:319
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define BITSET
Definition: structs.h:18
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define Sy_bit(x)
Definition: options.h:30
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal Q
Definition: myNF.cc:291
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:57
void(* initEcart)(TObject *L)
Definition: kutil.h:274
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8044
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define OPT_REDTAIL
Definition: options.h:86
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define omfree(addr)
Definition: omAllocDecl.h:237
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9779
void PrintS(const char *s)
Definition: reporter.cc:284
TObject ** R
Definition: kutil.h:336
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:21
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: myNF.cc:332
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11808
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9240
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ P()

LObject P ( h  )

§ pNormalize()

pNormalize ( P.  p)

§ SetShortExpVector()

P SetShortExpVector ( )

Variable Documentation

§ ak

Definition at line 321 of file myNF.cc.

§ bucket

Definition at line 79 of file myNF.cc.

§ currRing

currRing

Widely used global variable which specifies the current polynomial ring for Singular interpreter and legacy implementatins. : one should avoid using it in newer designs, for example due to possible problems in parallelization with threads.

Definition at line 332 of file myNF.cc.

§ else

else
Initial value:
{
P.p=kBucketClear(P.bucket)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:495
kBucketDestroy & P
Definition: myNF.cc:191

Definition at line 189 of file myNF.cc.

§ is_ring

Definition at line 83 of file myNF.cc.

§ j

int j

Definition at line 70 of file myNF.cc.

§ lazyReduce

END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Initial value:
{
if (p==NULL)
return NULL
return P p
Definition: myNF.cc:203
#define NULL
Definition: omList.c:10

Definition at line 292 of file myNF.cc.

§ loop

loop
Initial value:
{
int & max_ind
Definition: myNF.cc:67
int j
Definition: myNF.cc:70
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition: kstd2.cc:197
int int kStrategy strat
Definition: myNF.cc:68
kBucketDestroy & P
Definition: myNF.cc:191

Definition at line 98 of file myNF.cc.

§ max_ind

max_ind =strat->sl

Definition at line 67 of file myNF.cc.

§ nonorm

int int nonorm

Definition at line 67 of file myNF.cc.

§ P

Definition at line 191 of file myNF.cc.

§ p

Definition at line 203 of file myNF.cc.

§ pp

poly pp = p

Definition at line 296 of file myNF.cc.

§ Q

Definition at line 291 of file myNF.cc.

§ res

Definition at line 322 of file myNF.cc.

§ strat

kStrategy strat
Initial value:
{
if (h==NULL) return NULL
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978

Definition at line 68 of file myNF.cc.

§ syzComp

strat syzComp = syzComp

Definition at line 291 of file myNF.cc.