Loading...
Searching...
No Matches
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.

{
//This strategy Uses the ordinary walk for the first step
if(unperturbedStartVectorStrategy){
return(unperturbedFirstStep64(G,currw64,destRing));
//here G is updated since its address is given as argument
}
//This strategy makes sure that the start vector lies inside the start cone
//thus no step is needed within the start cone.
else{
if(currwOnBorder64(G,currw64))
{
int64 dummy64;
getTaun64(G,currMat,iv64Size(currw64),&currw64,dummy64);
//currw64=getiv64(getTaun64(G,currMat,iv64Size(currw64)));
}
ring oldRing=currRing;
ring newRing=rCopy0AndAddA(destRing,currw64);
rComplete(newRing);
rChangeCurrRing(newRing);
G=idrMoveR(G,oldRing,newRing);
}
return(WalkOk);
}
int64
long int64
Definition auxiliary.h:68
G
STATIC_VAR TreeM * G
Definition janet.cc:31
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
idrMoveR
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
rComplete
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:3527
rCopy0AndAddA
ring rCopy0AndAddA(const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1570
unperturbedFirstStep64
WalkState unperturbedFirstStep64(ideal &G, int64vec *currw64, ring destRing)
Definition walkMain.cc:358
WalkOk
@ WalkOk
Definition walkMain.h:30
getTaun64
void getTaun64(ideal G, intvec *targm, int pertdeg, int64vec **v64, int64 &i64)
Definition walkSupport.cc:209
currwOnBorder64
BOOLEAN currwOnBorder64(ideal G, int64vec *currw64)
Definition walkSupport.cc:350
iv64Size
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.

{
WalkState state=WalkOk;
/* OLDRING **************************************************** */
ideal nextG;
if (currwOnBorder64(G,currw64))
{
ideal Gw=init64(G,currw64);
ring oldRing=currRing;
/* NEWRING **************************************************** */
ring rnew=rCopy0AndAddA(destRing,currw64);
rComplete(rnew);
rChangeCurrRing(rnew);
ideal newGw=idrMoveR(Gw, oldRing, rnew);
//HIER GEANDERT
matrix L=mpNew(1,1);
idLiftStd(newGw,&L);
// //turn off bucket representation of polynomials and on redSB
// optionState=test;
// //test|=Sy_bit(OPT_NOT_BUCKETS);
// test|=Sy_bit(OPT_REDSB);
// ideal newStdGw=idStd(newGw);
// //turn on bucket representation of polynomials and off redSB
// test=optionState;
// matrix L=matIdLift(newGw,newStdGw);
// idDelete(&newStdGw);
idDelete(&newGw);
nextG=idrMoveR(G,oldRing, rnew); idTest(nextG);
matrix nextGmat=(matrix)nextG;
matrix resMat=mp_Mult(nextGmat,L,rnew);
idDelete((ideal *)&nextGmat);
idDelete((ideal *)&L);
nextG=(ideal)resMat;
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDSB);
nextG = idInterRed(nextG);
SI_RESTORE_OPT1(save1);
}
else
{
ring oldRing=currRing;
ring rnew=rCopy0AndAddA(destRing,currw64);
rComplete(rnew);
rChangeCurrRing(rnew);
nextG=idrMoveR(G,oldRing, rnew);
}
G=nextG;
return(state);
}
BITSET
#define BITSET
Definition auxiliary.h:85
idLiftStd
ideal idLiftStd(ideal h1, matrix *T, tHomog hi, ideal *S, GbVariant alg, ideal h11)
Definition ideals.cc:982
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
idTest
#define idTest(id)
Definition ideals.h:47
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition matpol.cc:37
mp_Mult
matrix mp_Mult(matrix a, matrix b, const ring R)
Definition matpol.cc:206
matrix
ip_smatrix * matrix
Definition matpol.h:43
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
SI_SAVE_OPT1
#define SI_SAVE_OPT1(A)
Definition options.h:21
SI_RESTORE_OPT1
#define SI_RESTORE_OPT1(A)
Definition options.h:24
OPT_REDSB
#define OPT_REDSB
Definition options.h:77
Sy_bit
#define Sy_bit(x)
Definition options.h:31
WalkState
WalkState
Definition walkMain.h:7
init64
ideal init64(ideal G, int64vec *currw64)
Definition walkSupport.cc:299
idInterRed
ideal idInterRed(ideal G)
Definition walkSupport.cc:958

## fractalRec64()

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

Definition at line 434 of file walkMain.cc.

{
if (TEST_OPT_PROT)
{ PrintS("fractal walk, weights");currw64->show();PrintLn(); }
WalkState state=WalkOk;
BITSET save1,save2;
SI_SAVE_OPT(save1,save2);
//1
int64vec* w=(currw64);
int64vec* old_w=(currw64);
int64vec* sigma=(currw64);
//lists taunpair64=getTaun64(G,destMat,level);
//int64vec* w2=getiv64(taunpair64);
//int64 inveps64=getint64(taunpair64);
int64vec* w2;
int64 inveps64;
getTaun64(G,destMat,level,&w2,inveps64);
//2
while(1){
//int64vec* tvec64=nextt64(G,w,w2);
int64 tvec0,tvec1;
nextt64(G,w,w2,tvec0,tvec1);
if(overflow_error){
return WalkOverFlowError;
}
//tvec[1]>tvec[2] iff t>1 or t ist undefined i.e.is (2,0)
//if ((*tvec64)[0]>(*tvec64)[1])
if (tvec0>tvec1)
{
if(invEpsOk64(G,destMat,level,inveps64)) {
return(state);
}
else
{
//taunpair64=getTaun64(G,destMat,level);
//w2=getiv64(taunpair64);
//inveps64=getint64(taunpair64);
delete w2;
getTaun64(G,destMat,level,&w2,inveps64);
//tvec64=nextt64(G,w,w2);
nextt64(G,w,w2,tvec0,tvec1);
if(overflow_error){
return WalkOverFlowError;
}
//if((*tvec64)[0]>(*tvec64)[1])
if(tvec0>tvec1)
{
return(state);
}
}
}
//i.e. t=1 and we have reached the target vector
//if( ((*tvec64)[0]==(*tvec64)[1]) && (level!=iv64Size(w)) )
if( (tvec0==tvec1) && (level!=iv64Size(w)) )
{
state=fractalRec64(G,old_w,destMat,level+1,step);
return(state);
}
else
{
w=nextw64(w,w2,tvec0,tvec1);
//3
ideal Gw=init64(G,w); //finding initial ideal for new w
ring oldRing=currRing;
ideal GwCp=idCopy(Gw);
ideal GCp=idCopy(G);
ideal newGw;
ideal newStdGw;
ideal newG;
//4
if ( level==iv64Size(w) || noPolysWithMoreThanTwoTerms(Gw) ){
//5
/*NEWRING**********************************************************/
//this assumes order has A-vector as first vector
ring newring=rCopy0(currRing);
rComplete(newring);
rSetWeightVec(newring,w->iv64GetVec());
rChangeCurrRing(newring);
//rSetWeightVec(newring,w->iv64GetVec());
//rComplete(newring,1);
newGw=idrMoveR(GwCp,oldRing,newring);
si_opt_1|=Sy_bit(OPT_REDSB);
newStdGw=idStd(newGw); //computes new reduced GB of Gw
SI_RESTORE_OPT(save1,save2);
}
else
{
//7
/*THE RING FROM THE RECURSION STEP BELOW***************************/
//Here we can choose whether to call fractalrec with old_w,
//which is the last w from the top level, or with sigma,
//the original start vector. The impact on the algorithm is not obvious.
state=fractalRec64(Gw,sigma,destMat,level+1,step);
//The resulting GB is Gw since its address is given as argument.
ideal recG=Gw;
ring temp=currRing;
/*NEWRING**********************************************************/
//this assumes order has A-vector as first vector
ring newring=rCopy0(currRing);
rComplete(newring);
rChangeCurrRing(newring);
rSetWeightVec(currRing,w->iv64GetVec());
rComplete(newring,1);
newGw=idrMoveR(GwCp,oldRing,newring);
newStdGw=idrMoveR(recG,temp,newring);
}
//8
//lifting comes either after level=nvars(ring), after Gw has
//no poly with more than two terms or after
//fractalRec64(Gw,level+1) has returned
//si_opt_1|=Sy_bit(OPT_NOT_BUCKETS);
matrix L=matIdLift(newGw,newStdGw);
SI_RESTORE_OPT(save1,save2);
newG=idrMoveR(GCp,oldRing,currRing);
matrix MG=(matrix)newG;
matrix resMat=mp_Mult(MG,L,currRing);
idDelete((ideal *)&MG);
idDelete((ideal *)&L);
G=(ideal)resMat;
//9
si_opt_1|=Sy_bit(OPT_REDSB);
G=idInterRed(G);
SI_RESTORE_OPT(save1,save2);
old_w=iv64Copy(w);
if(level==1) step=step+1;
}
}
}
level
int level(const CanonicalForm &f)
Definition canonicalform.h:331
int64vec
Definition int64vec.h:24
int64vec::show
void show(int mat=0, int spaces=0)
Definition int64vec.cc:104
w
const CanonicalForm & w
Definition facAbsFact.cc:51
idCopy
ideal idCopy(ideal A)
Definition ideals.h:60
iv64Copy
int64vec * iv64Copy(int64vec *o)
Definition int64vec.h:84
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition options.h:20
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition options.h:23
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
rSetWeightVec
void rSetWeightVec(ring r, int64 *wv)
Definition ring.cc:5376
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1427
overflow_error
VAR int overflow_error
Definition walkMain.cc:37
fractalRec64
WalkState fractalRec64(ideal &G, int64vec *currw64, intvec *destMat, int level, int step)
Definition walkMain.cc:434
WalkOverFlowError
@ WalkOverFlowError
Definition walkMain.h:11
nextt64
void nextt64(ideal G, int64vec *currw64, int64vec *targw64, int64 &tvec0, int64 &tvec1)
Definition walkSupport.cc:560
matIdLift
matrix matIdLift(ideal Gomega, ideal M)
Definition walkSupport.cc:978
invEpsOk64
int invEpsOk64(ideal I, intvec *targm, int pertdeg, int64 inveps64)
Definition walkSupport.cc:141
nextw64
int64vec * nextw64(int64vec *currw, int64vec *targw, int64 nexttvec0, int64 nexttvec1)
Definition walkSupport.cc:604
noPolysWithMoreThanTwoTerms
BOOLEAN noPolysWithMoreThanTwoTerms(ideal Gw)
Definition walkSupport.cc:380
idStd
ideal idStd(ideal G)
Definition walkSupport.cc:938

## fractalWalk64()

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

Definition at line 614 of file walkMain.cc.

{
overflow_error=FALSE; //global
WalkState state=WalkOk;
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|= (Sy_bit(OPT_REDTAIL)|Sy_bit(OPT_REDSB));
ideal G;
if(!sourceIsSB)
{
G=idStd(sourceIdeal);
}
else
{
G=idInterRed(idCopy(sourceIdeal));
}
SI_RESTORE_OPT1(save1); //switches REDSB off
//matrices for the orders of the rings
intvec *destMat=int64VecToIntVec(rGetGlobalOrderMatrix(destRing));
intvec *currMat=int64VecToIntVec(rGetGlobalOrderMatrix(currRing));
int64vec* currw64=getNthRow64(currMat,1); //start vector
state=firstFractalWalkStep64(G,currw64,currMat,destRing,
unperturbedStartVectorStrategy);
delete currMat;
state=fractalRec64(G,currw64,destMat,1,1);
if(state==WalkOk)
destIdeal=G;
if(overflow_error)
state=WalkOverFlowError;
delete currw64;
delete destMat;
return state;
}
FALSE
#define FALSE
Definition auxiliary.h:97
intvec
Definition intvec.h:24
OPT_REDTAIL
#define OPT_REDTAIL
Definition options.h:92
firstFractalWalkStep64
WalkState firstFractalWalkStep64(ideal &G, int64vec *&currw64, intvec *currMat, ring destRing, BOOLEAN unperturbedStartVectorStrategy)
Definition walkMain.cc:311
rGetGlobalOrderMatrix
int64vec * rGetGlobalOrderMatrix(ring r)
Definition walkSupport.cc:1019
int64VecToIntVec
intvec * int64VecToIntVec(int64vec *source)
Definition walkSupport.cc:1181
getNthRow64
int64vec * getNthRow64(intvec *v, int n)
Definition walkSupport.cc:181

## unperturbedFirstStep64()

WalkState unperturbedFirstStep64 | ( | ideal & | G,
|  | int64vec * | currw64,
|  | ring | destRing )

Definition at line 358 of file walkMain.cc.

{
WalkState state=WalkOk;
/* OLDRING **************************************************** */
ideal nextG;
BITSET save1;
SI_SAVE_OPT1(save1);
if (currwOnBorder64(G,currw64))
{
ideal Gw=init64(G,currw64);
ring oldRing=currRing;
/* NEWRING **************************************************** */
ring rnew=rCopy0AndAddA(destRing,currw64);
rComplete(rnew);
rChangeCurrRing(rnew);
ideal newGw=idrMoveR(Gw, oldRing,rnew);
//turn off bucket representation of polynomials and on redSB
//si_opt_1|=Sy_bit(OPT_NOT_BUCKETS);
si_opt_1|=Sy_bit(OPT_REDSB);
ideal newStdGw=idStd(newGw);
//turn on bucket representation of polynomials and off redSB
SI_RESTORE_OPT1(save1);
matrix L=matIdLift(newGw,newStdGw);
idDelete(&newStdGw);
idDelete(&newGw);
nextG=idrMoveR(G,oldRing,rnew); idTest(nextG);
matrix nextGmat=(matrix)nextG;
matrix resMat=mp_Mult(nextGmat,L,rnew);
idDelete((ideal *)&nextGmat);
idDelete((ideal *)&L);
nextG=(ideal)resMat;
si_opt_1|=Sy_bit(OPT_REDSB);
nextG = idInterRed(nextG);
SI_RESTORE_OPT1(save1);
}
else
{
ring oldRing=currRing;
ring rnew=rCopy0AndAddA(destRing,currw64);
rComplete(rnew);
rChangeCurrRing(rnew);
nextG=idrMoveR(G,oldRing,rnew);
}
G=nextG;
return(state);
}

## walk64()

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

Definition at line 222 of file walkMain.cc.

{
//some initializations
WalkState state=WalkOk;
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDTAIL);
overflow_error=FALSE;
int step=0;
ideal G=I;
si_opt_1|=Sy_bit(OPT_REDSB);
if(!sourceIsSB)
{
ideal GG=idStd(G);
idDelete(&G); G=GG;
}
else
G=idInterRed(G);
SI_RESTORE_OPT1(save1);
ideal nextG;
state=firstWalkStep64(G,currw64,destRing);
nextG=G;
if(overflow_error)
{
state=WalkOverFlowError;
return(state);
}
int64 nexttvec0,nexttvec1;
//int64vec* nexttvec64=nextt64(nextG,currw64,destVec64);
nextt64(nextG,currw64,destVec64,nexttvec0,nexttvec1);
//while(0<t<=1) ( t=((*nexttvec64)[0])/((*nexttvec64)[1]) )
//while( (*nexttvec64)[0]<=(*nexttvec64)[1] ) {
while (nexttvec0<=nexttvec1 )
{
step=step+1;
//int64vec *tt=nextw64(currw64,destVec64,nexttvec64);
int64vec *tt=nextw64(currw64,destVec64,nexttvec0,nexttvec1);
delete currw64; currw64=tt; tt=NULL;
if (TEST_OPT_PROT)
{
PrintS("walk step:"); currw64->show(); PrintLn();
}
state=walkStep64(nextG,currw64);
//uppdates nextG if all is OK
if(overflow_error)
return(WalkOverFlowError);
//delete nexttvec64;
//nexttvec64=nextt64(nextG,currw64,destVec64);
nextt64(nextG,currw64,destVec64,nexttvec0,nexttvec1);
}
destIdeal=sortRedSB(nextG);
return(state);
}
GG
const CanonicalForm & GG
Definition cfModGcd.cc:4084
NULL
#define NULL
Definition omList.c:12
firstWalkStep64
WalkState firstWalkStep64(ideal &G, int64vec *currw64, ring destRing)
Definition walkMain.cc:69
walkStep64
WalkState walkStep64(ideal &G, int64vec *currw64)
Definition walkMain.cc:148
sortRedSB
ideal sortRedSB(ideal G)
Definition walkSupport.cc:1146

## walkStep64()

WalkState walkStep64 | ( | ideal & | G,
|  | int64vec * | currw64 )

Definition at line 148 of file walkMain.cc.

{
WalkState state=WalkOk;
/* OLDRING ****************************************************** */
ideal Gw=init64(G,currw64);
ring oldRing=currRing;
/* NEWRING ****************************************************** */
rCopyAndChangeA(currw64);
ideal newGw=idrMoveR(Gw, oldRing,currRing);
//HIER GEANDERT
matrix L=mpNew(1,1);
ideal newStdGw=idLiftStd(newGw,&L);
//what it looked like before idStd and idLift were replaced
//by idLiftStd
// optionState=test;
// test|=Sy_bit(OPT_REDSB);
// test|=Sy_bit(OPT_NOT_BUCKETS);
// //PrintS(" new initial forms:\n");
// for (int ii=0; ii <IDELEMS(newGw); ii++) pCleardenom(newGw->m[ii]);
// //idShow(newGw);
// ideal newStdGw=idStd(newGw);
// PrintS(" std for initial forms done\n");
// test=optionState;
// matrix L=matIdLift(newGw,newStdGw);
// idDelete(&newStdGw);
idDelete(&newGw);
//PrintS(" lift for initial forms done\n");
ideal nextG=idrMoveR(G,oldRing,currRing);
rDelete(oldRing);
matrix nextGmat=(matrix)nextG;
matrix resMat=mp_Mult(nextGmat,L,currRing);
idDelete((ideal *)&nextGmat);
idDelete((ideal *)&L);
//PrintS(" lift done\n");
nextG=(ideal)resMat;
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDSB);
nextG = idInterRed(nextG);
SI_RESTORE_OPT1(save1);
G=nextG;
return(state);
}
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
rCopyAndChangeA
void rCopyAndChangeA(int64vec *w)
Definition walkSupport.cc:1000

## Variable Documentation

## overflow_error

VAR int overflow_error

Definition at line 37 of file walkMain.cc.