Loading...
Searching...
No Matches
fglmDdata Class Reference

## Public Member Functions

| fglmDdata (int dimension)
| ~fglmDdata ()
int | getBasisSize () const
BOOLEAN | candidatesLeft () const
fglmDelem | nextCandidate ()
void | newBasisElem (poly &m, fglmVector v, fglmVector p, number &denom)
void | updateCandidates (poly m, const fglmVector v)
void | newGroebnerPoly (fglmVector &v, poly &p)
void | gaussreduce (fglmVector &v, fglmVector &p, number &denom)
ideal | buildIdeal ()

## Private Attributes

int | dimen
oldGaussElem * | gauss
BOOLEAN * | isPivot
int * | perm
int | basisSize
polyset | basis
int * | varpermutation
int | groebnerBS
int | groebnerSize
ideal | destId
List< fglmDelem > | nlist

## Detailed Description

Definition at line 758 of file fglmzero.cc.

## Constructor & Destructor Documentation

## fglmDdata()

fglmDdata::fglmDdata | ( | int | dimension | ) |

Definition at line 793 of file fglmzero.cc.

{
int k;
dimen= dimension;
basisSize= 0;
//. All arrays run from [1]..[dimen], thus omAlloc( dimen + 1 )!
#ifndef HAVE_EXPLICIT_CONSTR
gauss= new oldGaussElem[ dimen+1 ];
#else
gauss= (oldGaussElem *)omAlloc( (dimen+1)*sizeof( oldGaussElem ) );
#endif
isPivot= (BOOLEAN *)omAlloc( (dimen+1)*sizeof( BOOLEAN ) );
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( ((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 = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
delete iv;
groebnerBS= 16;
groebnerSize= 0;
destId= idInit( groebnerBS, 1 );
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
dimension
BOOLEAN dimension(leftv res, leftv args)
Definition bbcone.cc:757
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
fglmDdata::isPivot
BOOLEAN * isPivot
Definition fglmzero.cc:763
fglmDdata::dimen
int dimen
Definition fglmzero.cc:761
fglmDdata::varpermutation
int * varpermutation
Definition fglmzero.cc:768
fglmDdata::gauss
oldGaussElem * gauss
Definition fglmzero.cc:762
fglmDdata::groebnerSize
int groebnerSize
Definition fglmzero.cc:771
fglmDdata::basisSize
int basisSize
Definition fglmzero.cc:765
fglmDdata::basis
polyset basis
Definition fglmzero.cc:766
fglmDdata::groebnerBS
int groebnerBS
Definition fglmzero.cc:770
fglmDdata::destId
ideal destId
Definition fglmzero.cc:772
fglmDdata::perm
int * perm
Definition fglmzero.cc:764
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
idMaxIdeal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition ideals.h:33
idSort
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
polyset
poly * polyset
Definition polys.h:260
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35

## ~fglmDdata()

fglmDdata::~fglmDdata | ( |  | ) |

Definition at line 821 of file fglmzero.cc.

{
// STICKYPROT2("dimen= %i", dimen);
// STICKYPROT2("basisSize= %i", basisSize);
// fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" );
int k;
#ifndef HAVE_EXPLICIT_CONSTR
delete [] gauss;
#else
// use basisSize instead of dimen because of fglmquot!
for ( k= basisSize; k > 0; k-- )
gauss[k].~oldGaussElem();
omFreeSize( (ADDRESS)gauss, (dimen+1)*sizeof( oldGaussElem ) );
#endif
omFreeSize( (ADDRESS)isPivot, (dimen+1)*sizeof( BOOLEAN ) );
omFreeSize( (ADDRESS)perm, (dimen+1)*sizeof( int ) );
// use basisSize instead of dimen because of fglmquot!
//. Remember: There is no poly in basis[0], thus k > 0
for ( k= basisSize; k > 0; k-- )
pLmDelete( basis[k]);
omFreeSize( (ADDRESS)basis, (dimen+1)*sizeof( poly ) );
omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77

## Member Function Documentation

## buildIdeal()

ideal fglmDdata::buildIdeal | ( |  | ) |

inline

Definition at line 786 of file fglmzero.cc.

{
idSkipZeroes( destId );
return destId;
}
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201

## candidatesLeft()

BOOLEAN fglmDdata::candidatesLeft | ( |  | ) | const

inline

Definition at line 780 of file fglmzero.cc.

{ return ( nlist.isEmpty() ? FALSE : TRUE ); }
fglmDdata::nlist
List< fglmDelem > nlist
Definition fglmzero.cc:774

## gaussreduce()

void fglmDdata::gaussreduce | ( | fglmVector & | v,
|  | fglmVector & | p,
|  | number & | denom )

Definition at line 979 of file fglmzero.cc.

{
int k;
number fac1, fac2;
number temp;
fglmASSERT( pdenom == NULL, "pdenom in gaussreduce should be NULL" );
pdenom= nInit( 1 );
number vdenom = v.clearDenom();
if ( ! nIsZero( vdenom ) && ! nIsOne( vdenom ) ) {
p.setelem( p.size(), vdenom );
}
else {
nDelete( &vdenom );
}
number gcd = v.gcd();
if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) ) {
v /= gcd;
number temp= nMult( pdenom, gcd );
nDelete( &pdenom );
pdenom= temp;
}
nDelete( & gcd );
for ( k= 1; k <= basisSize; k++ ) {
if ( ! v.elemIsZero( perm[k] ) ) {
fac1= gauss[k].fac;
fac2= nCopy( v.getconstelem( perm[k] ) );
v.nihilate( fac1, fac2, gauss[k].v );
fac1= nMult( fac1, gauss[k].pdenom );
temp= nMult( fac2, pdenom );
nDelete( &fac2 );
fac2= temp;
p.nihilate( fac1, fac2, gauss[k].p );
temp= nMult( pdenom, gauss[k].pdenom );
nDelete( &pdenom );
pdenom= temp;
nDelete( & fac1 );
nDelete( & fac2 );
number gcd = v.gcd();
if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
{
v /= gcd;
number temp= nMult( pdenom, gcd );
nDelete( &pdenom );
pdenom= temp;
}
nDelete( & gcd );
gcd= p.gcd();
temp= n_SubringGcd( pdenom, gcd, currRing->cf );
nDelete( &gcd );
gcd= temp;
if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
{
p /= gcd;
temp= nDiv( pdenom, gcd );
nDelete( & pdenom );
pdenom= temp;
nNormalize( pdenom );
}
nDelete( & gcd );
}
}
}
p
int p
Definition cfModGcd.cc:4086
n_SubringGcd
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition coeffs.h:669
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
fglmASSERT
#define fglmASSERT(ignore1, ignore2)
Definition fglmzero.cc:52
nDiv
#define nDiv(a, b)
Definition numbers.h:32
nDelete
#define nDelete(n)
Definition numbers.h:16
nIsZero
#define nIsZero(n)
Definition numbers.h:19
nCopy
#define nCopy(n)
Definition numbers.h:15
nIsOne
#define nIsOne(n)
Definition numbers.h:25
nNormalize
#define nNormalize(n)
Definition numbers.h:30
nInit
#define nInit(i)
Definition numbers.h:24
nMult
#define nMult(n1, n2)
Definition numbers.h:17
NULL
#define NULL
Definition omList.c:12
gcd
int gcd(int a, int b)
Definition walkSupport.cc:836

## getBasisSize()

int fglmDdata::getBasisSize | ( |  | ) | const

inline

Definition at line 779 of file fglmzero.cc.

{ return basisSize; }

## newBasisElem()

void fglmDdata::newBasisElem | ( | poly & | m,
|  | fglmVector | v,
|  | fglmVector | p,
|  | number & | denom )

Definition at line 854 of file fglmzero.cc.

{
// inserts m as a new basis monom. m is NOT copied but directly inserted.
// returns m=NULL to indicate, that now basis is oweing m.
basisSize++;
basis[basisSize]= m;
m= NULL;
int k= 1;
while ( nIsZero(v.getconstelem(k)) || isPivot[k] ) {
k++;
}
fglmASSERT( k <= dimen, "Error(1) in fglmDdata::pivot-search");
number pivot= v.getconstelem( k );
int pivotcol = k;
k++;
while ( k <= dimen ) {
if ( ! nIsZero( v.getconstelem(k) ) && ! isPivot[k] ) {
if ( nGreater( v.getconstelem( k ), pivot ) ) {
pivot= v.getconstelem( k );
pivotcol= k;
}
}
k++;
}
fglmASSERT( ! nIsZero( pivot ), "Error(2) fglmDdata::Pivotelement ist Null" );
isPivot[ pivotcol ]= TRUE;
perm[basisSize]= pivotcol;
pivot= nCopy( v.getconstelem( pivotcol ) );
#ifndef HAVE_EXPLICIT_CONSTR
gauss[basisSize].insertElem( v, p, denom, pivot );
#else
gauss[basisSize].oldGaussElem( v, p, denom, pivot );
#endif
}
m
int m
Definition cfEzgcd.cc:128
pivot
bool pivot(const matrix aMat, const int r1, const int r2, const int c1, const int c2, int *bestR, int *bestC, const ring R)
This code computes a score for each non-zero matrix entry in aMat[r1..r2, c1..c2].
Definition linearAlgebra.cc:68
nGreater
#define nGreater(a, b)
Definition numbers.h:28

## newGroebnerPoly()

void fglmDdata::newGroebnerPoly | ( | fglmVector & | v,
|  | poly & | p )

Definition at line 936 of file fglmzero.cc.

{
//. Baue das Polynom von oben nach unten:
fglmASSERT( p.size() == basisSize+1, "GP::newGroebnerPoly: p has wrong size" );
int k;
poly result = m;
poly temp = result;
m= NULL;
if ( nGetChar() > 0 ) {
number lead = nCopy( p.getconstelem( basisSize+1 ) );
p /= lead;
nDelete( & lead );
}
if ( nGetChar() == 0 ) {
number gcd= p.gcd();
fglmASSERT( ! nIsZero( gcd ), "FATAL: gcd and thus p is zero" );
if ( ! nIsOne( gcd ) )
p /= gcd;
nDelete( & gcd );
}
pSetCoeff( result, nCopy( p.getconstelem( basisSize+1 ) ) );
for ( k= basisSize; k > 0; k-- ) {
if ( ! nIsZero( p.getconstelem( k ) ) ) {
temp->next= pCopy( basis[k] );
pIter( temp );
pSetCoeff( temp, nCopy( p.getconstelem( k ) ) );
}
}
pSetm( result );
if ( ! nGreaterZero( pGetCoeff( result ) ) ) result= pNeg( result );
if ( groebnerSize == IDELEMS( destId ) ) {
pEnlargeSet( & destId->m, IDELEMS( destId ), groebnerBS );
IDELEMS( destId )+= groebnerBS;
}
(destId->m)[groebnerSize]= result;
groebnerSize++;
}
result
return result
Definition facAbsBiFact.cc:76
pIter
#define pIter(p)
Definition monomials.h:37
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
nGetChar
#define nGetChar()
Definition numbers.h:23
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821
pSetm
#define pSetm(p)
Definition polys.h:272
pNeg
#define pNeg(p)
Definition polys.h:199
pSetCoeff
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition polys.h:32
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23

## nextCandidate()

fglmDelem fglmDdata::nextCandidate | ( |  | ) |

Definition at line 846 of file fglmzero.cc.

{
fglmDelem result = nlist.getFirst();
nlist.removeFirst();
return result;
}

## updateCandidates()

void fglmDdata::updateCandidates | ( | poly | m,
|  | const fglmVector | v )

Definition at line 891 of file fglmzero.cc.

{
ListIterator<fglmDelem> list = nlist;
poly newmonom = NULL;
int k = (currRing->N);
BOOLEAN done = FALSE;
int state = 0;
while ( k >= 1 )
{
newmonom = pCopy( m );
pIncrExp( newmonom, varpermutation[k] );
pSetm( newmonom );
done= FALSE;
while ( list.hasItem() && (!done) )
{
if ( (state= pCmp( list.getItem().monom, newmonom )) < 0 )
list++;
else done= TRUE;
}
if ( !done )
{
nlist.append( fglmDelem( newmonom, v, k ) );
break;
}
if ( state == 0 )
{
list.getItem().newDivisor();
pLmDelete( & newmonom );
}
else
{
list.insert( fglmDelem( newmonom, v, k ) );
}
k--;
}
while ( --k >= 1 )
{
newmonom= pCopy( m );
pIncrExp( newmonom, varpermutation[k] );
pSetm( newmonom );
nlist.append( fglmDelem( newmonom, v, k ) );
}
}
ListIterator::hasItem
int hasItem()
Definition ftmpl_list.cc:439
ListIterator::getItem
T & getItem() const
Definition ftmpl_list.cc:431
ListIterator::insert
void insert(const T &)
Definition ftmpl_list.cc:492
pCmp
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
Definition polys.h:116
pIncrExp
#define pIncrExp(p, i)
Definition polys.h:44

## Field Documentation

## basis

polyset fglmDdata::basis

private

Definition at line 766 of file fglmzero.cc.

## basisSize

int fglmDdata::basisSize

private

Definition at line 765 of file fglmzero.cc.

## destId

ideal fglmDdata::destId

private

Definition at line 772 of file fglmzero.cc.

## dimen

int fglmDdata::dimen

private

Definition at line 761 of file fglmzero.cc.

## gauss

oldGaussElem* fglmDdata::gauss

private

Definition at line 762 of file fglmzero.cc.

## groebnerBS

int fglmDdata::groebnerBS

private

Definition at line 770 of file fglmzero.cc.

## groebnerSize

int fglmDdata::groebnerSize

private

Definition at line 771 of file fglmzero.cc.

## isPivot

BOOLEAN* fglmDdata::isPivot

private

Definition at line 763 of file fglmzero.cc.

## nlist

List<fglmDelem> fglmDdata::nlist

private

Definition at line 774 of file fglmzero.cc.

## perm

int* fglmDdata::perm

private

Definition at line 764 of file fglmzero.cc.

## varpermutation

int* fglmDdata::varpermutation

private

Definition at line 768 of file fglmzero.cc.

The documentation for this class was generated from the following file:

- kernel/fglm/fglmzero.cc