My Project
Loading...
Searching...
No Matches
Functions | Variables
walkMain.cc File Reference
#include "kernel/mod2.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "misc/int64vec.h"
#include "polys/prCopy.h"
#include "polys/matpol.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/groebner_walk/walkMain.h"
#include "kernel/groebner_walk/walkSupport.h"
#include "kernel/GBEngine/kstd1.h"
#include <string.h>

Go to the source code of this file.

Functions

WalkState firstWalkStep64 (ideal &G, int64vec *currw64, ring destRing)
 
WalkState walkStep64 (ideal &G, int64vec *currw64)
 
WalkState walk64 (ideal I, int64vec *currw64, ring destRing, int64vec *destVec64, ideal &destIdeal, BOOLEAN sourceIsSB)
 
WalkState firstFractalWalkStep64 (ideal &G, int64vec *&currw64, intvec *currMat, ring destRing, BOOLEAN unperturbedStartVectorStrategy)
 
WalkState unperturbedFirstStep64 (ideal &G, int64vec *currw64, ring destRing)
 
WalkState fractalRec64 (ideal &G, int64vec *currw64, intvec *destMat, int level, int step)
 
WalkState fractalWalk64 (ideal sourceIdeal, ring destRing, ideal &destIdeal, BOOLEAN sourceIsSB, BOOLEAN unperturbedStartVectorStrategy)
 

Variables

VAR int overflow_error
 

Function Documentation

◆ firstFractalWalkStep64()

WalkState firstFractalWalkStep64 ( ideal G,
int64vec *&  currw64,
intvec currMat,
ring  destRing,
BOOLEAN  unperturbedStartVectorStrategy 
)

Definition at line 311 of file walkMain.cc.

313 {
314
315 //This strategy Uses the ordinary walk for the first step
318 //here G is updated since its address is given as argument
319 }
320
321 //This strategy makes sure that the start vector lies inside the start cone
322 //thus no step is needed within the start cone.
323 else{
325 {
328 //currw64=getiv64(getTaun64(G,currMat,iv64Size(currw64)));
329 }
335 }
336
337 return(WalkOk);
338}
long int64
Definition auxiliary.h:68
STATIC_VAR TreeM * G
Definition janet.cc:31
void rChangeCurrRing(ring r)
Definition polys.cc:15
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition ring.cc:3465
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1567
WalkState unperturbedFirstStep64(ideal &G, int64vec *currw64, ring destRing)
Definition walkMain.cc:358
@ WalkOk
Definition walkMain.h:30
void getTaun64(ideal G, intvec *targm, int pertdeg, int64vec **v64, int64 &i64)
BOOLEAN currwOnBorder64(ideal G, int64vec *currw64)
int iv64Size(int64vec *v)
Definition walkSupport.h:37

◆ firstWalkStep64()

WalkState firstWalkStep64 ( ideal G,
int64vec currw64,
ring  destRing 
)

Definition at line 69 of file walkMain.cc.

69 {
70 WalkState state=WalkOk;
71 /* OLDRING **************************************************** */
73
75 {
78 /* NEWRING **************************************************** */
82
84
85
86 //HIER GEANDERT
87 matrix L=mpNew(1,1);
88 idLiftStd(newGw,&L);
89
90// //turn off bucket representation of polynomials and on redSB
91// optionState=test;
92// //test|=Sy_bit(OPT_NOT_BUCKETS);
93// test|=Sy_bit(OPT_REDSB);
94
95// ideal newStdGw=idStd(newGw);
96
97// //turn on bucket representation of polynomials and off redSB
98// test=optionState;
99
100// matrix L=matIdLift(newGw,newStdGw);
101// idDelete(&newStdGw);
102
103 idDelete(&newGw);
104
106
108
109 matrix resMat=mp_Mult(nextGmat,L,rnew);
111 idDelete((ideal *)&L);
112
113 nextG=(ideal)resMat;
114
120 }
121 else
122 {
128 }
129
130 G=nextG;
131 return(state);
132}
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition ideals.cc:976
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define idTest(id)
Definition ideals.h:47
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
matrix mp_Mult(matrix a, matrix b, const ring R)
Definition matpol.cc:206
ip_smatrix * matrix
Definition matpol.h:43
VAR unsigned si_opt_1
Definition options.c:5
#define SI_SAVE_OPT(A, B)
Definition options.h:20
#define OPT_REDSB
Definition options.h:77
#define Sy_bit(x)
Definition options.h:31
#define SI_RESTORE_OPT(A, B)
Definition options.h:23
#define BITSET
Definition structs.h:16
WalkState
Definition walkMain.h:7
ideal init64(ideal G, int64vec *currw64)
ideal idInterRed(ideal G)

◆ fractalRec64()

WalkState fractalRec64 ( ideal G,
int64vec currw64,
intvec destMat,
int  level,
int  step 
)

Definition at line 434 of file walkMain.cc.

436{
437
438if (TEST_OPT_PROT)
439{ PrintS("fractal walk, weights");currw64->show();PrintLn(); }
440WalkState state=WalkOk;
443
444//1
448
449//lists taunpair64=getTaun64(G,destMat,level);
450//int64vec* w2=getiv64(taunpair64);
451//int64 inveps64=getint64(taunpair64);
452int64vec* w2;
455
456//2
457while(1){
458
459 //int64vec* tvec64=nextt64(G,w,w2);
462
463 if(overflow_error){
464 return WalkOverFlowError;
465 }
466
467 //tvec[1]>tvec[2] iff t>1 or t ist undefined i.e.is (2,0)
468 //if ((*tvec64)[0]>(*tvec64)[1])
469 if (tvec0>tvec1)
470 {
472 return(state);
473 }
474 else
475 {
476 //taunpair64=getTaun64(G,destMat,level);
477 //w2=getiv64(taunpair64);
478 //inveps64=getint64(taunpair64);
479 delete w2;
481
482 //tvec64=nextt64(G,w,w2);
484
485 if(overflow_error){
486 return WalkOverFlowError;
487 }
488
489 //if((*tvec64)[0]>(*tvec64)[1])
490 if(tvec0>tvec1)
491 {
492 return(state);
493 }
494 }
495 }
496
497 //i.e. t=1 and we have reached the target vector
498 //if( ((*tvec64)[0]==(*tvec64)[1]) && (level!=iv64Size(w)) )
499 if( (tvec0==tvec1) && (level!=iv64Size(w)) )
500 {
502 return(state);
503 }
504 else
505 {
507
508//3
509 ideal Gw=init64(G,w); //finding initial ideal for new w
510
512
514 ideal GCp=idCopy(G);
515
516 ideal newGw;
518 ideal newG;
519
520//4
522
523//5
524/*NEWRING**********************************************************/
525
526 //this assumes order has A-vector as first vector
529 rSetWeightVec(newring,w->iv64GetVec());
531 //rSetWeightVec(newring,w->iv64GetVec());
532 //rComplete(newring,1);
533
535
537 newStdGw=idStd(newGw); //computes new reduced GB of Gw
539 }
540 else
541 {
542//7
543/*THE RING FROM THE RECURSION STEP BELOW***************************/
544 //Here we can choose whether to call fractalrec with old_w,
545 //which is the last w from the top level, or with sigma,
546 //the original start vector. The impact on the algorithm is not obvious.
547
549
550 //The resulting GB is Gw since its address is given as argument.
551 ideal recG=Gw;
553
554/*NEWRING**********************************************************/
555
556 //this assumes order has A-vector as first vector
560 rSetWeightVec(currRing,w->iv64GetVec());
562
564
566 }
567
568//8
569 //lifting comes either after level=nvars(ring), after Gw has
570 //no poly with more than two terms or after
571 //fractalRec64(Gw,level+1) has returned
572
573 //si_opt_1|=Sy_bit(OPT_NOT_BUCKETS);
576
579
580 matrix resMat=mp_Mult(MG,L,currRing);
581 idDelete((ideal *)&MG);
582 idDelete((ideal *)&L);
583 G=(ideal)resMat;
584
585//9
586
588 G=idInterRed(G);
590
592 if(level==1) step=step+1;
593
594 }
595
596}
597}
int level(const CanonicalForm &f)
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal idCopy(ideal A)
Definition ideals.h:60
int64vec * iv64Copy(int64vec *o)
Definition int64vec.h:84
#define TEST_OPT_PROT
Definition options.h:105
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310
void rSetWeightVec(ring r, int64 *wv)
Definition ring.cc:5315
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1424
VAR int overflow_error
Definition walkMain.cc:37
WalkState fractalRec64(ideal &G, int64vec *currw64, intvec *destMat, int level, int step)
Definition walkMain.cc:434
@ WalkOverFlowError
Definition walkMain.h:11
void nextt64(ideal G, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
matrix matIdLift(ideal Gomega, ideal M)
int invEpsOk64(ideal I, intvec *targm, int pertdeg, int64 inveps64)
int64vec * nextw64(int64vec *currw, int64vec *targw, int64 nexttvec0, int64 nexttvec1)
BOOLEAN noPolysWithMoreThanTwoTerms(ideal Gw)
ideal idStd(ideal G)

◆ fractalWalk64()

WalkState fractalWalk64 ( ideal  sourceIdeal,
ring  destRing,
ideal destIdeal,
BOOLEAN  sourceIsSB,
BOOLEAN  unperturbedStartVectorStrategy 
)

Definition at line 614 of file walkMain.cc.

617{
618
619 overflow_error=FALSE; //global
620 WalkState state=WalkOk;
623
625 ideal G;
626
627 if(!sourceIsSB)
628 {
630 }
631
632 else
633 {
635 }
636
637 SI_RESTORE_OPT(save1,save2); //switches REDSB off
638
639 //matrices for the orders of the rings
642
643 int64vec* currw64=getNthRow64(currMat,1); //start vector
644
647 delete currMat;
648
649 state=fractalRec64(G,currw64,destMat,1,1);
650 if(state==WalkOk)
651 destIdeal=G;
652
654 state=WalkOverFlowError;
655
656 delete currw64;
657 delete destMat;
658 return state;
659}
#define FALSE
Definition auxiliary.h:96
#define OPT_REDTAIL
Definition options.h:92
WalkState firstFractalWalkStep64(ideal &G, int64vec *&currw64, intvec *currMat, ring destRing, BOOLEAN unperturbedStartVectorStrategy)
Definition walkMain.cc:311
int64vec * rGetGlobalOrderMatrix(ring r)
intvec * int64VecToIntVec(int64vec *source)
int64vec * getNthRow64(intvec *v, int n)

◆ unperturbedFirstStep64()

WalkState unperturbedFirstStep64 ( ideal G,
int64vec currw64,
ring  destRing 
)

Definition at line 358 of file walkMain.cc.

359{
360 WalkState state=WalkOk;
361 /* OLDRING **************************************************** */
362 ideal nextG;
365
367 {
370 /* NEWRING **************************************************** */
374
376
377 //turn off bucket representation of polynomials and on redSB
378 //si_opt_1|=Sy_bit(OPT_NOT_BUCKETS);
380
382
383 //turn on bucket representation of polynomials and off redSB
385
388 idDelete(&newGw);
389
391
393
394 matrix resMat=mp_Mult(nextGmat,L,rnew);
396 idDelete((ideal *)&L);
397
398 nextG=(ideal)resMat;
399
403 }
404 else
405 {
411 }
412
413 G=nextG;
414 return(state);
415}

◆ walk64()

WalkState walk64 ( ideal  I,
int64vec currw64,
ring  destRing,
int64vec destVec64,
ideal destIdeal,
BOOLEAN  sourceIsSB 
)

Definition at line 222 of file walkMain.cc.

224{
225 //some initializations
226 WalkState state=WalkOk;
229
232 int step=0;
233 ideal G=I;
234
236 if(!sourceIsSB)
237 {
238 ideal GG=idStd(G);
239 idDelete(&G); G=GG;
240 }
241 else
242 G=idInterRed(G);
244
245 ideal nextG;
247 nextG=G;
248
250 {
251 state=WalkOverFlowError;
252 return(state);
253 }
254
256 //int64vec* nexttvec64=nextt64(nextG,currw64,destVec64);
258
259 //while(0<t<=1) ( t=((*nexttvec64)[0])/((*nexttvec64)[1]) )
260 //while( (*nexttvec64)[0]<=(*nexttvec64)[1] ) {
261 while (nexttvec0<=nexttvec1 )
262 {
263 step=step+1;
264
265 //int64vec *tt=nextw64(currw64,destVec64,nexttvec64);
267 delete currw64; currw64=tt; tt=NULL;
268
269 if (TEST_OPT_PROT)
270 {
271 PrintS("walk step:"); currw64->show(); PrintLn();
272 }
273
274 state=walkStep64(nextG,currw64);
275 //uppdates nextG if all is OK
276
278 return(WalkOverFlowError);
279
280 //delete nexttvec64;
281 //nexttvec64=nextt64(nextG,currw64,destVec64);
283
284 }
285
287 return(state);
288}
const CanonicalForm & GG
Definition cfModGcd.cc:4084
#define NULL
Definition omList.c:12
WalkState firstWalkStep64(ideal &G, int64vec *currw64, ring destRing)
Definition walkMain.cc:69
WalkState walkStep64(ideal &G, int64vec *currw64)
Definition walkMain.cc:148
ideal sortRedSB(ideal G)

◆ walkStep64()

WalkState walkStep64 ( ideal G,
int64vec currw64 
)

Definition at line 148 of file walkMain.cc.

149{
150 WalkState state=WalkOk;
151
152/* OLDRING ****************************************************** */
154
156
157/* NEWRING ****************************************************** */
159
161
162 //HIER GEANDERT
163 matrix L=mpNew(1,1);
165
166//what it looked like before idStd and idLift were replaced
167//by idLiftStd
168// optionState=test;
169// test|=Sy_bit(OPT_REDSB);
170// test|=Sy_bit(OPT_NOT_BUCKETS);
171
172// //PrintS(" new initial forms:\n");
173// for (int ii=0; ii <IDELEMS(newGw); ii++) pCleardenom(newGw->m[ii]);
174// //idShow(newGw);
175// ideal newStdGw=idStd(newGw);
176// PrintS(" std for initial forms done\n");
177
178// test=optionState;
179
180// matrix L=matIdLift(newGw,newStdGw);
181
182// idDelete(&newStdGw);
183
184 idDelete(&newGw);
185 //PrintS(" lift for initial forms done\n");
186
189
191
194 idDelete((ideal *)&L);
195 //PrintS(" lift done\n");
196
197 nextG=(ideal)resMat;
198
204
205 G=nextG;
206 return(state);
207}
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
void rCopyAndChangeA(int64vec *w)

Variable Documentation

◆ overflow_error

VAR int overflow_error

Definition at line 37 of file walkMain.cc.