Skip to content

Commit

Permalink
FIX: replaced pVariables by currRing->N...
Browse files Browse the repository at this point in the history
ADD: added 'void rChangeCurrRing(ring r);' to polys/polys.h
CHG: started changing gr_kstd2.cc and syz*.cc
  • Loading branch information
Oleksandr Motsak authored and mohamed-barakat committed Nov 9, 2011
1 parent 6ed8c42 commit 1f637e0
Show file tree
Hide file tree
Showing 28 changed files with 296 additions and 271 deletions.
2 changes: 1 addition & 1 deletion kernel/fast_mult.cc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ static void p_MonMultMB(poly p, poly q,ring r)
x = n_Mult(y,pGetCoeff(q),r);
n_Delete(&y,r);
p_SetCoeff0(p,x,r);
//for (i=pVariables; i!=0; i--)
//for (i=(currRing->N); i!=0; i--)
//{
// pAddExp(p,i, pGetExp(q,i));
//}
Expand Down
2 changes: 1 addition & 1 deletion kernel/fglmcomb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ fglmReductionStep( poly * pptr, ideal source, int * w )
int i, diff;

poly m = pOne();
for ( i= pVariables; i > 0; i-- )
for ( i= (currRing->N); i > 0; i-- )
{
diff= pGetExp( *pptr, i ) - pGetExp( p2, i );
pSetExp( m, i, diff );
Expand Down
2 changes: 1 addition & 1 deletion kernel/fglmhom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ hfglmNextdegree( intvec * source, ideal current, int & deg )
void
generateMonoms( poly m, int var, int deg, homogData * dat )
{
if ( var == pVariables ) {
if ( var == (currRing->N) ) {
BOOLEAN inSource = FALSE;
BOOLEAN inDest = FALSE;
poly mon = pCopy( m );
Expand Down
38 changes: 19 additions & 19 deletions kernel/fglmzero.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class borderElem

fglmSelem::fglmSelem( poly p, int var ) : monom( p ), numVars( 0 )
{
for ( int k = pVariables; k > 0; k-- )
for ( int k = (currRing->N); k > 0; k-- )
if ( pGetExp( monom, k ) > 0 )
numVars++;
divisors= (int *)omAlloc( (numVars+1)*sizeof( int ) );
Expand Down Expand Up @@ -366,12 +366,12 @@ fglmSdata::fglmSdata( const ideal thisIdeal )
// werden, jenachdem wie das Ideal aussieht.
theIdeal= thisIdeal;
idelems= IDELEMS( theIdeal );
varpermutation = (int*)omAlloc( (pVariables+1)*sizeof(int) );
varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
// Sort ring variables by increasing values (because of weighted orderings)
ideal perm = idMaxIdeal(1);
intvec *iv = idSort(perm,TRUE);
idDelete(&perm);
for(int i = pVariables; i > 0; i--) varpermutation[pVariables+1-i] = (*iv)[i-1];
for(int i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
delete iv;

basisBS= 100;
Expand All @@ -393,7 +393,7 @@ fglmSdata::fglmSdata( const ideal thisIdeal )

fglmSdata::~fglmSdata()
{
omFreeSize( (ADDRESS)varpermutation, (pVariables+1)*sizeof(int) );
omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
for ( int k = basisSize; k > 0; k-- )
pLmDelete( basis + k ); //. rem: basis runs from basis[1]..basis[basisSize]
omFreeSize( (ADDRESS)basis, basisMax*sizeof( poly ) );
Expand Down Expand Up @@ -473,7 +473,7 @@ fglmSdata::updateCandidates()
fglmASSERT( basisSize > 0 && basisSize < basisMax, "Error(1) in fglmSdata::updateCandidates - wrong bassSize" );
poly m = basis[basisSize];
poly newmonom = NULL;
int k = pVariables;
int k = (currRing->N);
BOOLEAN done = FALSE;
int state = 0;
while ( k >= 1 )
Expand Down Expand Up @@ -584,7 +584,7 @@ fglmSdata::getBorderDiv( const poly m, int & var ) const
while ( num > 0 ) {
poly temp = border[num].monom;
if ( pDivisibleBy( temp, m ) ) {
var = pVariables;
var = (currRing->N);
while ( var > 0 ) {
if ( (pGetExp( m, var ) - pGetExp( temp, var )) == 1 )
return border[num].nf;
Expand Down Expand Up @@ -691,7 +691,7 @@ fglmDelem::fglmDelem( poly & m, fglmVector mv, int v ) : v( mv ), insertions( 0
{
monom= m;
m= NULL;
for ( int k = pVariables; k > 0; k-- )
for ( int k = (currRing->N); k > 0; k-- )
if ( pGetExp( monom, k ) > 0 )
insertions++;
// Wir gehen davon aus, dass ein fglmDelem direkt bei der Erzeugung
Expand Down Expand Up @@ -796,12 +796,12 @@ fglmDdata::fglmDdata( int dimension )
for ( k= dimen; k > 0; k-- ) isPivot[k]= FALSE;
perm= (int *)omAlloc( (dimen+1)*sizeof( int ) );
basis= (polyset)omAlloc( (dimen+1)*sizeof( poly ) );
varpermutation = (int*)omAlloc( (pVariables+1)*sizeof(int) );
varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
// Sort ring variables by increasing values (because of weighted orderings)
ideal perm_id = idMaxIdeal(1);
intvec *iv = idSort(perm_id,TRUE);
idDelete(&perm_id);
for(int i = pVariables; i > 0; i--) varpermutation[pVariables+1-i] = (*iv)[i-1];
for(int i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
delete iv;

groebnerBS= 16;
Expand Down Expand Up @@ -830,7 +830,7 @@ fglmDdata::~fglmDdata()
for ( k= basisSize; k > 0; k-- )
pLmDelete( basis[k]);
omFreeSize( (ADDRESS)basis, (dimen+1)*sizeof( poly ) );
omFreeSize( (ADDRESS)varpermutation, (pVariables+1)*sizeof(int) );
omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
}

fglmDelem
Expand Down Expand Up @@ -883,7 +883,7 @@ fglmDdata::updateCandidates( poly m, const fglmVector v )
{
ListIterator<fglmDelem> list = nlist;
poly newmonom = NULL;
int k = pVariables;
int k = (currRing->N);
BOOLEAN done = FALSE;
int state = 0;
while ( k >= 1 )
Expand Down Expand Up @@ -1108,18 +1108,18 @@ FindUnivariatePolys( const idealFunctionals & l )
{
fglmVector v;
fglmVector p;
ideal destIdeal = idInit( pVariables, 1 );
ideal destIdeal = idInit( (currRing->N), 1 );

int i;
BOOLEAN isZero;
int *varpermutation = (int*)omAlloc( (pVariables+1)*sizeof(int) );
int *varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
ideal perm = idMaxIdeal(1);
intvec *iv = idSort(perm,TRUE);
idDelete(&perm);
for(i = pVariables; i > 0; i--) varpermutation[pVariables+1-i] = (*iv)[i-1];
for(i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
delete iv;

for (i= 1; i <= pVariables; i++ )
for (i= 1; i <= (currRing->N); i++ )
{
// main loop
STICKYPROT2( "(%i)", i /*varpermutation[i]*/);
Expand Down Expand Up @@ -1168,7 +1168,7 @@ FindUnivariatePolys( const idealFunctionals & l )
}
}
STICKYPROT( "\n" );
omFreeSize( (ADDRESS)varpermutation, (pVariables+1)*sizeof(int) );
omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
return destIdeal;
}

Expand All @@ -1184,7 +1184,7 @@ fglmzero( ring sourceRing, ideal & sourceIdeal, idhdl destRingHdl, ideal & destI
rChangeCurrRing( sourceRing );
currRingHdl=NULL;
}
idealFunctionals L( 100, pVariables );
idealFunctionals L( 100, (currRing->N) );
fglmok = CalculateFunctionals( sourceIdeal, L );
if ( deleteIdeal == TRUE )
idDelete( & sourceIdeal );
Expand All @@ -1205,7 +1205,7 @@ fglmquot( ideal sourceIdeal, poly quot, ideal & destIdeal)
BOOLEAN fglmok;
fglmVector v;

idealFunctionals L( 100, pVariables );
idealFunctionals L( 100, (currRing->N) );
// STICKYPROT("calculating normal form\n");
// poly p = kNF( sourceIdeal, currRing->qideal, quot );
// STICKYPROT("calculating functionals\n");
Expand All @@ -1222,7 +1222,7 @@ FindUnivariateWrapper( ideal source, ideal & destIdeal )
{
BOOLEAN fglmok;

idealFunctionals L( 100, pVariables );
idealFunctionals L( 100, (currRing->N) );
fglmok = CalculateFunctionals( source, L );
if ( fglmok == TRUE ) {
destIdeal= FindUnivariatePolys( L );
Expand Down
26 changes: 13 additions & 13 deletions kernel/gfan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ static bool areEqual2(facet* f, facet *g)
bool res = TRUE;
const int64vec *fIntP = f->getRef2InteriorPoint();
const int64vec *gIntP = g->getRef2InteriorPoint();
for(int ii=0;ii<pVariables;ii++)
for(int ii=0;ii<(currRing->N);ii++)
{
if( (*fIntP)[ii] != (*gIntP)[ii] )
{
Expand Down Expand Up @@ -1558,7 +1558,7 @@ void gcone::getExtremalRays(const gcone &gc)
}
n--;
}while(exchanged==TRUE && n>=0);
}*///if pVariables>2
}*///if (currRing->N)>2
// delete fNormal;
fAct = fAct->next;
}//end of facet checking
Expand Down Expand Up @@ -2384,7 +2384,7 @@ static int64vec* ivNeg(/*const*/int64vec *iv)
static int dotProduct(const int64vec &iva, const int64vec &ivb)
{
int res=0;
for (int i=0;i<pVariables;i++)
for (int i=0;i<(currRing->N);i++)
{
// #ifndef NDEBUG
// (const_cast<int64vec*>(&iva))->show(1,0); (const_cast<int64vec*>(&ivb))->show(1,0);
Expand Down Expand Up @@ -2782,7 +2782,7 @@ ring gcone::rCopyAndAddWeight2(const ring &r,const int64vec *ivw, const int64vec
static bool ivAreEqual(const int64vec &a, const int64vec &b)
{
bool res=TRUE;
for(int ii=0;ii<pVariables;ii++)
for(int ii=0;ii<(currRing->N);ii++)
{
if(a[ii]!=b[ii])
{
Expand Down Expand Up @@ -4238,9 +4238,9 @@ intvec *gcRays2Intmat(gcone *gc)
for(int ii=0;ii<gc->numRays;ii++)
{
int64vec *ivTmp=iv64Copy(gc->gcRays[ii]);
for(int jj=0;jj<pVariables;jj++)
for(int jj=0;jj<(currRing->N);jj++)
(*res)[offset+jj]=(int)(*ivTmp)[jj];
offset += pVariables;
offset += (currRing->N);
delete ivTmp;
}
return res;
Expand Down Expand Up @@ -4357,11 +4357,11 @@ gfan::ZFan* grfan(ideal inputIdeal, int h, bool singleCone=FALSE)
#endif
{
lists lResList; //this is the object we return
gfan::ZFan *zResFan = new gfan::ZFan(pVariables);
gfan::ZFan *zResFan = new gfan::ZFan((currRing->N));

if(rHasGlobalOrdering(currRing))
{
// int numvar = pVariables;
// int numvar = (currRing->N);
gfanHeuristic = h;

enum searchMethod {
Expand All @@ -4381,8 +4381,8 @@ gfan::ZFan* grfan(ideal inputIdeal, int h, bool singleCone=FALSE)
gcone *gcRoot = new gcone(currRing,inputIdeal);
gcone *gcAct;
gcAct = gcRoot;
gcone::numVars=pVariables;
//gcAct->numVars=pVariables;//NOTE is now static
gcone::numVars=(currRing->N);
//gcAct->numVars=(currRing->N);//NOTE is now static
gcAct->getGB(inputIdeal);
/*Check whether input is homogeneous
if TRUE each facet intersects the positive orthant, so we don't need the
Expand All @@ -4395,8 +4395,8 @@ gfan::ZFan* grfan(ideal inputIdeal, int h, bool singleCone=FALSE)
}
else
{
gcone::ivZeroVector = new int64vec(pVariables);
for(int ii=0;ii<pVariables;ii++)
gcone::ivZeroVector = new int64vec((currRing->N));
for(int ii=0;ii<(currRing->N);ii++)
(*gcone::ivZeroVector)[ii]=0;
}

Expand Down Expand Up @@ -4449,7 +4449,7 @@ gfan::ZFan* grfan(ideal inputIdeal, int h, bool singleCone=FALSE)
// facet *fPtr=gcPtr->facetPtr=new facet();
// for(int jj=0;jj<5;jj++)
// {
// int64vec *iv=new int64vec(pVariables);
// int64vec *iv=new int64vec((currRing->N));
// fPtr->setFacetNormal(iv);
// delete(iv);
// fPtr->next=new facet();
Expand Down
30 changes: 17 additions & 13 deletions kernel/gr_kstd2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,34 @@
/*
* ABSTRACT - Kernel: noncomm. alg. of Buchberger
*/
#define PLURAL_INTERNAL_DECLARATIONS

#include <kernel/mod2.h>
#include "mod2.h"

#ifdef HAVE_PLURAL

#define PLURAL_INTERNAL_DECLARATIONS

#include <omalloc/omalloc.h>
#include <misc/options.h>
#include <misc/intvec.h>

#include <polys/weight.h>
#include <polys/polys.h>
#include <kernel/ideals.h>

#include <polys/nc/nc.h>
#include <polys/nc/sca.h>


#include <kernel/febase.h>
#include <misc/options.h>
#include <kernel/kutil.h>
#include <kernel/ideals.h>
#include <kernel/kstd1.h>
#include <kernel/khstd.h>
#include <kernel/kutil.h>
//#include "spolys.h"
//#include "cntrlc.h"
#include <polys/weight.h>
#include <misc/intvec.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include <kernel/ratgring.h>

#include <kernel/kutil.h>

#if 0
/*3
* reduction of p2 with p1
Expand Down Expand Up @@ -1025,13 +1029,13 @@ void nc_gr_initBba(ideal F, kStrategy strat)
// }
// else
{
ecartWeights=(short *)omAlloc((pVariables+1)*sizeof(short));
ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
/*uses automatic computation of the ecartWeights to set them*/
kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
}
pFDeg=totaldegreeWecart;
pLDeg=maxdegreeWecart;
for(i=1; i<=pVariables; i++)
for(i=1; i<=(currRing->N); i++)
Print(" %d",ecartWeights[i]);
PrintLn();
mflush();
Expand Down Expand Up @@ -1282,7 +1286,7 @@ ideal gnc_gr_bba(const ideal F, const ideal Q, const intvec *, const intvec *, k
pLDeg=pLDegOld;
if (ecartWeights)
{
omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
ecartWeights=NULL;
}
}
Expand Down
Loading

0 comments on commit 1f637e0

Please sign in to comment.