Loading...
Searching...
No Matches
walkProc.h File Reference
`#include "kernel/groebner_walk/walkMain.h"`

Go to the source code of this file.

## Functions

ideal | walkProc (leftv first, leftv second)
ideal | fractalWalkProc (leftv first, leftv second)
WalkState | walkConsistency (ring sring, ring dring, int *vperm)
WalkState | fractalWalkConsistency (ring sring, ring dring, int *vperm)

## Function Documentation

## fractalWalkConsistency()

WalkState fractalWalkConsistency | ( | ring | sring,
|  | ring | dring,
|  | int * | vperm )

Definition at line 220 of file walkProc.cc.

{
int k;
WalkState state= WalkOk;
if ( rChar(sring) != rChar(dring) )
{
WerrorS( "rings must have same characteristic" );
state= WalkIncompatibleRings;
}
if ( (rHasLocalOrMixedOrdering(sring))
|| (rHasLocalOrMixedOrdering(dring)) )
{
WerrorS( "only works for global orderings" );
state= WalkIncompatibleRings;
}
if ( rVar(sring) != rVar(dring) )
{
WerrorS( "rings must have same number of variables" );
state= WalkIncompatibleRings;
}
if ( rPar(sring) != rPar(dring) )
{
WerrorS( "rings must have same number of parameters" );
state= WalkIncompatibleRings;
}
if ( state != WalkOk ) return state;
// now the rings have the same number of variables resp. parameters.
// check if the names of the variables resp. parameters do agree:
int nvar = sring->N;
int npar = rPar(sring);
int * pperm;
char **snames;
char **dnames;
if ( npar > 0 )
{
snames=sring->cf->extRing->names;
dnames=dring->cf->extRing->names;
pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) );
}
else
{
pperm= NULL;
snames=NULL;
dnames=NULL;
}
maFindPerm( sring->names, nvar, snames, npar,
dring->names, nvar, dnames, npar, vperm, pperm,
dring->cf->type);
for ( k= nvar; (k > 0) && (state == WalkOk); k-- )
if ( vperm[k] <= 0 )
{
WerrorS( "variable names do not agree" );
state= WalkIncompatibleRings;
}
for ( k= npar; (k > 0) && (state == WalkOk); k-- )
if ( pperm[k-1] >= 0 )
{
WerrorS( "parameter names do not agree" );
state= WalkIncompatibleRings;
}
//check if order of variables resp. parameters does agree
//remove this to if you want to allow permutations of variables
for ( k= nvar; (k > 0) && (state == WalkOk); k-- )
if ( vperm[k] != (k) )
{
WerrorS( "orders of variables do not agree" );
state= WalkIncompatibleRings;
}
//remove this to if you want to allow permutations of parameters
for ( k= npar; (k > 0) && (state == WalkOk); k-- )
if ( pperm[k-1] != (-k) )
{
WerrorS( "orders of parameters do not agree" );
state= WalkIncompatibleRings;
}
if (pperm != NULL)
omFreeSize( (ADDRESS)pperm, (npar+1)*sizeof( int ) );
if ( state != WalkOk ) return state;
// check if any of the rings are qrings or not
if ( (sring->qideal != NULL) || (dring->qideal != NULL) )
{
WerrorS( "rings are not allowed to be qrings");
return WalkIncompatibleRings;
}
int i=0;
while(dring->order[i]!=0){
if( !(dring->order[i]==ringorder_lp) &&
!(dring->order[i]==ringorder_dp) &&
!(dring->order[i]==ringorder_Dp) &&
!(dring->order[i]==ringorder_wp) &&
!(dring->order[i]==ringorder_Wp) &&
!(dring->order[i]==ringorder_C) &&
!(dring->order[0]==ringorder_M)
)
{
state=WalkIncompatibleDestRing;
}
i++;
}
i=0;
while(sring->order[i]!=0)
{
if( !(sring->order[i]==ringorder_lp) &&
!(sring->order[i]==ringorder_dp) &&
!(sring->order[i]==ringorder_Dp) &&
!(sring->order[i]==ringorder_wp) &&
!(sring->order[i]==ringorder_Wp) &&
!(sring->order[i]==ringorder_C) &&
!(dring->order[0]==ringorder_M)
)
{
state=WalkIncompatibleSourceRing;
}
i++;
}
return state;
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
maFindPerm
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition maps.cc:155
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
NULL
#define NULL
Definition omList.c:12
rChar
int rChar(ring r)
Definition ring.cc:719
rHasLocalOrMixedOrdering
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
rPar
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:605
ringorder_lp
@ ringorder_lp
Definition ring.h:78
ringorder_C
@ ringorder_C
Definition ring.h:74
ringorder_Dp
@ ringorder_Dp
Definition ring.h:81
ringorder_dp
@ ringorder_dp
Definition ring.h:79
ringorder_Wp
@ ringorder_Wp
Definition ring.h:83
ringorder_wp
@ ringorder_wp
Definition ring.h:82
ringorder_M
@ ringorder_M
Definition ring.h:75
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
WalkState
WalkState
Definition walkMain.h:7
WalkIncompatibleDestRing
@ WalkIncompatibleDestRing
Definition walkMain.h:28
WalkIncompatibleRings
@ WalkIncompatibleRings
Definition walkMain.h:9
WalkOk
@ WalkOk
Definition walkMain.h:30
WalkIncompatibleSourceRing
@ WalkIncompatibleSourceRing
Definition walkMain.h:29

## fractalWalkProc()

ideal fractalWalkProc | ( | leftv | first,
|  | leftv | second )

Definition at line 161 of file walk_ip.cc.

{
//unperturbedStartVectorStrategy SHOULD BE SET BY THE USER THROUGH
//A THIRD ARGUMENT. TRUE MEANS THAT THE UNPERTURBED START
//VECTOR STRATEGY IS USED AND FALSE THAT THE START VECTOR IS
//MAXIMALLY PERTURBED
BOOLEAN unperturbedStartVectorStrategy=TRUE;
WalkState state = WalkOk;
BITSET save1,save2;
SI_SAVE_OPT(save1,save2);
si_opt_1 &= (~Sy_bit(OPT_REDSB)); //make sure option noredSB is set
ring destRing = currRing;
ideal destIdeal = NULL;
idhdl sourceRingHdl = (idhdl)first->data;
rSetHdl( sourceRingHdl );
ring sourceRing = currRing;
int * vperm = (int *)omAlloc0( (currRing->N+1)*sizeof( int ) );
state= fractalWalkConsistency( sourceRing, destRing, vperm );
omFreeSize( (ADDRESS)vperm, (currRing->N+1)*sizeof(int) );
ideal sourceIdeal;
BOOLEAN sourcIdealIsSB=FALSE;
if ( state == WalkOk ) {
idhdl ih = currRing->idroot->get( second->Name(), myynest );
if ( (ih != NULL) && (IDTYP(ih)==IDEAL_CMD) ) {
sourceIdeal = IDIDEAL( ih );
if(hasFlag((leftv)ih,FLAG_STD)){
sourcIdealIsSB=TRUE;
}
}
else {
state=WalkNoIdeal;
}
}
if ( state == WalkOk ) {
// Now the settings are compatible with Walk
state=fractalWalk64(sourceIdeal,destRing,destIdeal,
sourcIdealIsSB,
unperturbedStartVectorStrategy);
}
SI_RESTORE_OPT(save1,save2);//making sure options are as before functiocall
if ( state == WalkOk )
{
ring almostDestRing=currRing;
rChangeCurrRing(destRing);
destIdeal=idrMoveR(destIdeal, almostDestRing, destRing);
}
switch (state) {
case WalkOk:
destIdeal=sortRedSB(destIdeal);
return(destIdeal);
break;
case WalkIncompatibleRings:
Werror( "ring %s and current ring are incompatible\n",
first->Name() );
rChangeCurrRing(destRing);
destIdeal= NULL;
return destIdeal;
break;
case WalkIncompatibleDestRing:
Werror( "Order of basering not allowed,\n must be a combination of lp,dp,Dp,wp,Wp and C or just M.\n");
rChangeCurrRing(destRing);
destIdeal= NULL;
return destIdeal;
break;
case WalkIncompatibleSourceRing:
Werror( "Order of %s not allowed,\n must be a combination of lp,dp,Dp,wp,Wp and C or just M.\n",
first->Name());
rChangeCurrRing(destRing);
destIdeal= NULL;
return destIdeal;
break;
case WalkNoIdeal:
Werror( "Can't find ideal %s in ring %s.\n",
second->Name(), first->Name() );
rChangeCurrRing(destRing);
destIdeal= NULL;
return destIdeal;
break;
case WalkOverFlowError:
Werror( "Overflow occurred in ring %s.\n", first->Name() );
rChangeCurrRing(destRing);
destIdeal= NULL;
return destIdeal;
break;
default:
rChangeCurrRing(destRing);
destIdeal= idInit(1,1);
return destIdeal;
}
return NULL;
}
BITSET
#define BITSET
Definition auxiliary.h:85
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
sleftv::Name
const char * Name()
Definition subexpr.h:120
sleftv::data
void * data
Definition subexpr.h:88
myynest
VAR int myynest
Definition febase.cc:41
IDEAL_CMD
@ IDEAL_CMD
Definition grammar.cc:285
hasFlag
#define hasFlag(A, F)
Definition ipid.h:112
IDIDEAL
#define IDIDEAL(a)
Definition ipid.h:133
IDTYP
#define IDTYP(a)
Definition ipid.h:119
FLAG_STD
#define FLAG_STD
Definition ipid.h:106
rSetHdl
void rSetHdl(idhdl h)
Definition ipshell.cc:5129
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
SI_SAVE_OPT
#define SI_SAVE_OPT(A, B)
Definition options.h:20
OPT_REDSB
#define OPT_REDSB
Definition options.h:77
Sy_bit
#define Sy_bit(x)
Definition options.h:31
SI_RESTORE_OPT
#define SI_RESTORE_OPT(A, B)
Definition options.h:23
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
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
idhdl
idrec * idhdl
Definition ring.h:22
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
leftv
sleftv * leftv
Definition structs.h:53
fractalWalk64
WalkState fractalWalk64(ideal sourceIdeal, ring destRing, ideal &destIdeal, BOOLEAN sourceIsSB, BOOLEAN unperturbedStartVectorStrategy)
Definition walkMain.cc:614
WalkOverFlowError
@ WalkOverFlowError
Definition walkMain.h:11
WalkNoIdeal
@ WalkNoIdeal
Definition walkMain.h:8
fractalWalkConsistency
WalkState fractalWalkConsistency(ring sring, ring dring, int *vperm)
Definition walkProc.cc:220
sortRedSB
ideal sortRedSB(ideal G)
Definition walkSupport.cc:1146

## walkConsistency()

WalkState walkConsistency | ( | ring | sring,
|  | ring | dring,
|  | int * | vperm )

Definition at line 53 of file walkProc.cc.

{
int k;
WalkState state= WalkOk;
if ( sring->cf != dring->cf )
{
WerrorS( "rings must have same characteristic" );
state= WalkIncompatibleRings;
}
else if ( (rHasLocalOrMixedOrdering(sring))
|| (rHasLocalOrMixedOrdering(dring)) )
{
WerrorS( "only works for global orderings" );
state= WalkIncompatibleRings;
}
else if ( sring->N != dring->N )
{
WerrorS( "rings must have same number of variables" );
state= WalkIncompatibleRings;
}
else if ( rPar(sring) != rPar(dring) )
{
WerrorS( "rings must have same number of parameters" );
state= WalkIncompatibleRings;
}
if ( state != WalkOk ) return state;
// now the rings have the same number of variables resp. parameters.
// check if the names of the variables resp. parameters do agree:
int nvar = rVar(sring);
int npar = rPar(sring);
int * pperm;
char **snames;
char **dnames;
if ( npar > 0 )
{
snames=sring->cf->extRing->names;
dnames=dring->cf->extRing->names;
pperm= (int *)omAlloc0( (npar+1)*sizeof( int ) );
}
else
{
snames=NULL;
dnames=NULL;
pperm= NULL;
}
maFindPerm( sring->names, nvar, snames, npar,
dring->names, nvar, dnames, npar, vperm, pperm,
dring->cf->type);
for ( k= nvar; (k > 0) && (state == WalkOk); k-- )
if ( vperm[k] <= 0 )
{
WerrorS( "variable names do not agree" );
state= WalkIncompatibleRings;
}
for ( k= npar-1; (k >= 0) && (state == WalkOk); k-- )
if ( pperm[k] >= 0 )
{
WerrorS( "parameter names do not agree" );
state= WalkIncompatibleRings;
}
//remove this to if you want to allow permutations of variables
for ( k= nvar; (k > 0) && (state == WalkOk); k-- )
if ( vperm[k] != (k) )
{
WerrorS( "orders of variables do not agree" );
state= WalkIncompatibleRings;
}
//remove this to if you want to allow permutations of parameters
for ( k= npar; (k > 0) && (state == WalkOk); k-- )
{
if ( pperm[k-1] != (-k) )
{
WerrorS( "orders of parameters do not agree" );
state= WalkIncompatibleRings;
}
}
if (pperm != NULL)
omFreeSize( (ADDRESS)pperm, (npar+1)*sizeof( int ) );
if ( state != WalkOk ) return state;
// check if any of the rings are qrings or not
if ( (sring->qideal != NULL) || (dring->qideal != NULL) )
{
WerrorS( "rings are not allowed to be qrings");
return WalkIncompatibleRings;
}
int i=0;
while(dring->order[i]!=0)
{
if(
!(dring->order[i]==ringorder_a) &&
!(dring->order[i]==ringorder_a64) &&
!(dring->order[i]==ringorder_lp) &&
!(dring->order[i]==ringorder_dp) &&
!(dring->order[i]==ringorder_Dp) &&
!(dring->order[i]==ringorder_wp) &&
!(dring->order[i]==ringorder_Wp) &&
!(dring->order[i]==ringorder_C) &&
!(dring->order[i]==ringorder_M)
)
{
state=WalkIncompatibleDestRing;
}
i++;
}
i=0;
while(sring->order[i]!=0)
{
if(
!(sring->order[i]==ringorder_a) &&
!(sring->order[i]==ringorder_a64) &&
!(sring->order[i]==ringorder_lp) &&
!(sring->order[i]==ringorder_dp) &&
!(sring->order[i]==ringorder_Dp) &&
!(sring->order[i]==ringorder_wp) &&
!(sring->order[i]==ringorder_Wp) &&
!(sring->order[i]==ringorder_C) &&
!(sring->order[i]==ringorder_M)
)
{
state=WalkIncompatibleSourceRing;
}
i++;
}
return state;
}
ringorder_a
@ ringorder_a
Definition ring.h:71
ringorder_a64
@ ringorder_a64
for int64 weights
Definition ring.h:72

## walkProc()

ideal walkProc | ( | leftv | first,
|  | leftv | second )

Definition at line 55 of file walk_ip.cc.

{
WalkState state = WalkOk;
BITSET save1,save2;
SI_SAVE_OPT(save1,save2);
si_opt_1 &= (~Sy_bit(OPT_REDSB)); //make sure option noredSB is set
ring destRing = currRing;
ideal destIdeal = NULL;
idhdl sourceRingHdl = (idhdl)first->data;
ring sourceRing = IDRING(sourceRingHdl);
rChangeCurrRing( sourceRing );
if(state==WalkOk)
{
int * vperm = (int *)omAlloc0( (currRing->N+1)*sizeof( int ) );
state= walkConsistency( sourceRing, destRing, vperm );
omFreeSize( (ADDRESS)vperm, (currRing->N+1)*sizeof(int) );
}
int64vec* currw64=rGetGlobalOrderWeightVec(sourceRing);
int64vec* destVec64=rGetGlobalOrderWeightVec(destRing);
ideal sourceIdeal;
BOOLEAN sourcIdealIsSB=FALSE;
if ( state == WalkOk )
{
idhdl ih = currRing->idroot->get( second->Name(), myynest );
if ( (ih != NULL) && (IDTYP(ih)==IDEAL_CMD) )
{
sourceIdeal = idCopy(IDIDEAL( ih ));
if(hasFlag((leftv)ih,FLAG_STD)){
sourcIdealIsSB=TRUE;
}
}
else
{
state=WalkNoIdeal;
}
}
if ( state == WalkOk )
{
// Now the settings are compatible with Walk
state=walk64(sourceIdeal,currw64,destRing,destVec64,
destIdeal,sourcIdealIsSB);
}
SI_RESTORE_OPT(save1,save2);//making sure options are as before function call
ring almostDestRing=currRing;
rChangeCurrRing(destRing);
switch (state) {
case WalkOk:
destIdeal=idrMoveR(destIdeal,currRing,almostDestRing);
break;
case WalkIncompatibleRings:
Werror("ring %s and current ring are incompatible\n",
first->Name() );
destIdeal= NULL;
break;
case WalkIncompatibleDestRing:
WerrorS( "Order of basering not allowed,\n must be a combination of a,A,lp,dp,Dp,wp,Wp,M and C.\n");
destIdeal= NULL;
break;
case WalkIncompatibleSourceRing:
Werror( "Order of %s not allowed,\n must be a combination of a,A,lp,dp,Dp,wp,Wp,M and C.\n",first->Name());
rChangeCurrRing(destRing);
destIdeal= NULL;
break;
case WalkNoIdeal:
Werror( "Can't find ideal %s in ring %s.\n",
second->Name(), first->Name() );
destIdeal= NULL;
break;
case WalkOverFlowError:
WerrorS( "Overflow occurred.\n");
destIdeal= NULL;
break;
default:
destIdeal= NULL;
}
return destIdeal;
}
int64vec
Definition int64vec.h:24
idCopy
ideal idCopy(ideal A)
Definition ideals.h:60
IDRING
#define IDRING(a)
Definition ipid.h:127
walk64
WalkState walk64(ideal I, int64vec *currw64, ring destRing, int64vec *destVec64, ideal &destIdeal, BOOLEAN sourceIsSB)
Definition walkMain.cc:222
walkConsistency
WalkState walkConsistency(ring sring, ring dring, int *vperm)
Definition walkProc.cc:53
rGetGlobalOrderWeightVec
int64vec * rGetGlobalOrderWeightVec(ring r)
Definition walkSupport.cc:1094