Loading...
Searching...
No Matches
fglmzero.cc File Reference
`#include "kernel/mod2.h"`
`#include "factory/factory.h"`
`#include "factory/templates/ftmpl_list.h"`
`#include "factory/templates/ftmpl_list.cc"`
`#include "misc/options.h"`
`#include "misc/intvec.h"`
`#include "polys/monomials/maps.h"`
`#include "polys/monomials/ring.h"`
`#include "kernel/polys.h"`
`#include "kernel/ideals.h"`
`#include "kernel/GBEngine/kstd1.h"`
`#include "fglm.h"`
`#include "fglmvec.h"`
`#include "fglmgauss.h"`

Go to the source code of this file.

## Data Structures

struct | matElem
| The idealFunctionals. More...
struct | matHeader
class | idealFunctionals
class | borderElem
| The old basis. More...
class | fglmSdata
class | oldGaussElem
class | fglmDdata

## Macros

#define | PROT(msg)
#define | STICKYPROT(msg)
#define | PROT2(msg, arg)
#define | STICKYPROT2(msg, arg)
#define | fglmASSERT(ignore1, ignore2)

## Functions

void | internalCalculateFunctionals (const ideal, idealFunctionals &l, fglmSdata &data)
static BOOLEAN | CalculateFunctionals (const ideal &theIdeal, idealFunctionals &l)
static BOOLEAN | CalculateFunctionals (const ideal &theIdeal, idealFunctionals &l, poly &p, fglmVector &v)
static ideal | GroebnerViaFunctionals (const idealFunctionals &l, fglmVector iv=fglmVector())
static ideal | FindUnivariatePolys (const idealFunctionals &l)
BOOLEAN | fglmzero (ring sourceRing, ideal &sourceIdeal, ring destRing, ideal &destIdeal, BOOLEAN switchBack, BOOLEAN deleteIdeal)
BOOLEAN | fglmquot (ideal sourceIdeal, poly quot, ideal &destIdeal)
BOOLEAN | FindUnivariateWrapper (ideal source, ideal &destIdeal)

## Data Structure Documentation

## matElem

struct matElem

The idealFunctionals.

Definition at line 61 of file fglmzero.cc.

Data Fields
number | elem |
int | row |

## matHeader

struct matHeader

Definition at line 67 of file fglmzero.cc.

Data Fields
matElem * | elems |
BOOLEAN | owner |
int | size |

## Macro Definition Documentation

## fglmASSERT

#define fglmASSERT | ( |  | ignore1,
|  |  | ignore2 )

Definition at line 52 of file fglmzero.cc.

## PROT

#define PROT | ( |  | msg | ) |

Definition at line 48 of file fglmzero.cc.

## PROT2

#define PROT2 | ( |  | msg,
|  |  | arg )

Definition at line 50 of file fglmzero.cc.

## STICKYPROT

#define STICKYPROT | ( |  | msg | ) |

Value:
if (BTEST1(OPT_PROT)) Print(msg)
Print
#define Print
Definition emacs.cc:80
OPT_PROT
#define OPT_PROT
Definition options.h:76
BTEST1
#define BTEST1(a)
Definition options.h:34

Definition at line 49 of file fglmzero.cc.

## STICKYPROT2

#define STICKYPROT2 | ( |  | msg,
|  |  | arg )

Value:
if (BTEST1(OPT_PROT)) Print(msg,arg)

Definition at line 51 of file fglmzero.cc.

## Function Documentation

## CalculateFunctionals() [1/2]

BOOLEAN CalculateFunctionals | ( | const ideal & | theIdeal,
|  | idealFunctionals & | l )

static

Definition at line 673 of file fglmzero.cc.

{
fglmSdata data( theIdeal );
internalCalculateFunctionals( theIdeal, l, data );
return ( data.state() );
}
l
int l
Definition cfEzgcd.cc:100
fglmSdata
Definition fglmzero.cc:337
internalCalculateFunctionals
void internalCalculateFunctionals(const ideal, idealFunctionals &l, fglmSdata &data)
Definition fglmzero.cc:609

## CalculateFunctionals() [2/2]

BOOLEAN CalculateFunctionals | ( | const ideal & | theIdeal,
|  | idealFunctionals & | l,
|  | poly & | p,
|  | fglmVector & | v )

static

Definition at line 681 of file fglmzero.cc.

{
fglmSdata data( theIdeal );
internalCalculateFunctionals( theIdeal, l, data );
// STICKYPROT("Calculating vector rep\n");
v = data.getVectorRep( p );
// if ( v.isZero() )
// STICKYPROT("vectorrep is 0\n");
return ( data.state() );
}
p
int p
Definition cfModGcd.cc:4086
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39

## fglmquot()

BOOLEAN fglmquot | ( | ideal | sourceIdeal,
|  | poly | quot,
|  | ideal & | destIdeal )

Definition at line 1218 of file fglmzero.cc.

{
BOOLEAN fglmok;
fglmVector v;
idealFunctionals L( 100, (currRing->N) );
// STICKYPROT("calculating normal form\n");
// poly p = kNF( sourceIdeal, currRing->qideal, quot );
// STICKYPROT("calculating functionals\n");
fglmok = CalculateFunctionals( sourceIdeal, L, quot, v );
if ( fglmok == TRUE ) {
// STICKYPROT("calculating groebner basis\n");
destIdeal= GroebnerViaFunctionals( L, v );
}
return fglmok;
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
TRUE
#define TRUE
Definition auxiliary.h:101
fglmVector
Definition fglmvec.h:19
idealFunctionals
Definition fglmzero.cc:75
CalculateFunctionals
static BOOLEAN CalculateFunctionals(const ideal &theIdeal, idealFunctionals &l)
Definition fglmzero.cc:673
GroebnerViaFunctionals
static ideal GroebnerViaFunctionals(const idealFunctionals &l, fglmVector iv=fglmVector())
Definition fglmzero.cc:1046
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13

## fglmzero()

BOOLEAN fglmzero | ( | ring | sourceRing,
|  | ideal & | sourceIdeal,
|  | ring | destRing,
|  | ideal & | destIdeal,
|  | BOOLEAN | switchBack,
|  | BOOLEAN | deleteIdeal )

Definition at line 1193 of file fglmzero.cc.

{
ring initialRing = currRing;
BOOLEAN fglmok;
if ( currRing != sourceRing )
{
rChangeCurrRing( sourceRing );
}
idealFunctionals L( 100, rVar(currRing) );
fglmok = CalculateFunctionals( sourceIdeal, L );
if ( deleteIdeal == TRUE )
idDelete( & sourceIdeal );
rChangeCurrRing( destRing );
if ( fglmok == TRUE )
{
L.map( sourceRing );
destIdeal= GroebnerViaFunctionals( L );
}
if ( (switchBack) && (currRing != initialRing) )
rChangeCurrRing( initialRing );
return fglmok;
}
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598

## FindUnivariatePolys()

ideal FindUnivariatePolys | ( | const idealFunctionals & | l | ) |

static

Definition at line 1118 of file fglmzero.cc.

{
fglmVector v;
fglmVector p;
ideal destIdeal = idInit( (currRing->N), 1 );
int i;
BOOLEAN isZero;
int *varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
ideal perm = idMaxIdeal(1);
intvec *iv = idSort(perm,TRUE);
idDelete(&perm);
for(i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
delete iv;
for (i= 1; i <= (currRing->N); i++ )
{
// main loop
STICKYPROT2( "(%i)", i /*varpermutation[i]*/);
gaussReducer gauss( l.dimen() );
isZero= FALSE;
v= fglmVector( l.dimen(), 1 );
while ( !isZero )
{
if ( (isZero= gauss.reduce( v )))
{
STICKYPROT( "+" );
p= gauss.getDependence();
number gcd= p.gcd();
if ( ! nIsOne( gcd ) )
{
p /= gcd;
}
nDelete( & gcd );
int k;
poly temp = NULL;
poly result=NULL;
for ( k= p.size(); k > 0; k-- )
{
number n = p.getconstelem( k );
if ( ! nIsZero( n ) )
{
if ( temp == NULL )
{
result= p_Init(currRing);
temp= result;
}
else
{
temp->next= p_Init(currRing);
pIter( temp );
}
pSetCoeff0( temp, nCopy(n) );
pSetExp( temp, i /*varpermutation[i]*/, k-1 );
pSetm( temp );
}
}
if ( ! nGreaterZero( pGetCoeff( result ) ) ) result= pNeg( result );
(destIdeal->m)[i-1]= result;
}
else
{
STICKYPROT( "." );
gauss.store();
v= l.multiply( v, i /*varpermutation[i]*/ );
}
}
}
STICKYPROT( "\n" );
omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
return destIdeal;
}
FALSE
#define FALSE
Definition auxiliary.h:97
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
i
int i
Definition cfEzgcd.cc:132
k
int k
Definition cfEzgcd.cc:99
gaussReducer
Definition fglmgauss.h:19
intvec
Definition intvec.h:24
result
return result
Definition facAbsBiFact.cc:76
isZero
bool isZero(const CFArray &A)
checks if entries of A are zero
Definition facSparseHensel.h:468
STICKYPROT2
#define STICKYPROT2(msg, arg)
Definition fglmzero.cc:51
STICKYPROT
#define STICKYPROT(msg)
Definition fglmzero.cc:49
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
pIter
#define pIter(p)
Definition monomials.h:37
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
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
nDelete
#define nDelete(n)
Definition numbers.h:16
nIsZero
#define nIsZero(n)
Definition numbers.h:19
nCopy
#define nCopy(n)
Definition numbers.h:15
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27
nIsOne
#define nIsOne(n)
Definition numbers.h:25
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
NULL
#define NULL
Definition omList.c:12
p_Init
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341
pSetm
#define pSetm(p)
Definition polys.h:272
pNeg
#define pNeg(p)
Definition polys.h:199
pSetExp
#define pSetExp(p, i, v)
Definition polys.h:43
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
gcd
int gcd(int a, int b)
Definition walkSupport.cc:836

## FindUnivariateWrapper()

BOOLEAN FindUnivariateWrapper | ( | ideal | source,
|  | ideal & | destIdeal )

Definition at line 1236 of file fglmzero.cc.

{
BOOLEAN fglmok;
idealFunctionals L( 100, (currRing->N) );
fglmok = CalculateFunctionals( source, L );
if ( fglmok == TRUE ) {
destIdeal= FindUnivariatePolys( L );
return TRUE;
}
else
return FALSE;
}
FindUnivariatePolys
static ideal FindUnivariatePolys(const idealFunctionals &l)
Definition fglmzero.cc:1118

## GroebnerViaFunctionals()

ideal GroebnerViaFunctionals | ( | const idealFunctionals & | l,
|  | fglmVector | iv = fglmVector() )

static

Definition at line 1046 of file fglmzero.cc.

{
fglmDdata data( l.dimen() );
// insert pOne() and update workinglist according to iv:
fglmVector initv;
if ( iv.isZero() ) {
// STICKYPROT("initv is zero\n");
initv = fglmVector( l.dimen(), 1 );
}
else {
// STICKYPROT("initv is not zero\n");
initv = iv;
}
poly one = pOne();
data.updateCandidates( one, initv );
number nOne = nInit( 1 );
data.newBasisElem( one, initv, fglmVector( 1, 1 ), nOne );
STICKYPROT( "." );
while ( data.candidatesLeft() == TRUE ) {
fglmDelem candidate = data.nextCandidate();
if ( candidate.isBasisOrEdge() == TRUE ) {
// Now we have the chance to find a new groebner polynomial
// v is the vector-representation of candidate.monom
// some elements of v are zeroed in data.gaussreduce(). Which
// ones and how this was done is stored in p.
// originalV contains the unchanged v, which is later inserted
// into the working list (via data.updateCandidates().
fglmVector v = l.multiply( candidate.v, candidate.var );
fglmVector originalV = v;
fglmVector p( data.getBasisSize()+1, data.getBasisSize()+1 );
number pdenom = NULL;
data.gaussreduce( v, p, pdenom );
if ( v.isZero() ) {
// Now v is linear dependent to the already found basis elements.
// This means that v (resp. candidate.monom) is the leading
// monomial of the next groebner-basis polynomial.
data.newGroebnerPoly( p, candidate.monom );
nDelete( & pdenom );
STICKYPROT( "+" );
}
else {
// no linear dependence could be found, so v ( rsp. monom )
// is a basis monomial. We store the zeroed version ( i.e. v
// and not originalV ) as well as p, the denomiator and all
// the other stuff.
// erst updateCandidates, dann newBasisELem!!!
data.updateCandidates( candidate.monom, originalV );
data.newBasisElem( candidate.monom, v, p, pdenom );
STICKYPROT( "." );
}
}
else {
STICKYPROT( "-" );
candidate.cleanup();
}
} //. while data.candidatesLeft()
STICKYPROT( "\n" );
return ( data.buildIdeal() );
}
fglmDdata
Definition fglmzero.cc:759
fglmDelem
Definition fglm.h:47
fglmDelem::v
fglmVector v
Definition fglm.h:50
fglmDelem::monom
poly monom
Definition fglm.h:49
fglmDelem::var
int var
Definition fglm.h:52
fglmDelem::cleanup
void cleanup()
Definition fglmzero.cc:713
fglmDelem::isBasisOrEdge
BOOLEAN isBasisOrEdge() const
Definition fglm.h:56
fglmVector::isZero
int isZero()
Definition fglmvec.cc:295
nInit
#define nInit(i)
Definition numbers.h:24
pOne
#define pOne()
Definition polys.h:316

## internalCalculateFunctionals()

void internalCalculateFunctionals | ( | const ideal | ,
|  | idealFunctionals & | l,
|  | fglmSdata & | data )

Definition at line 609 of file fglmzero.cc.

{
// insert pOne() into basis and update the workingList:
poly one = pOne();
data.newBasisElem( one );
data.updateCandidates();
STICKYPROT(".");
while ( data.candidatesLeft() == TRUE ) {
fglmSelem candidate = data.nextCandidate();
if ( candidate.isBasisOrEdge() == TRUE ) {
int edge = data.getEdgeNumber( candidate.monom );
if ( edge != 0 )
{
// now candidate is an edge, i.e. we know its normalform:
// NF(p) = - ( tail(p)/LC(p) )
poly nf = data.getSpanPoly( edge );
pNorm( nf );
pLmDelete(&nf); //. deletes the leadingmonomial
nf= pNeg( nf );
fglmVector nfv = data.getVectorRep( nf );
l.insertCols( candidate.divisors, nfv );
data.newBorderElem( candidate.monom, nfv );
pDelete( &nf );
STICKYPROT( "+" );
}
else
{
int basis= data.newBasisElem( candidate.monom );
data.updateCandidates();
l.insertCols( candidate.divisors, basis );
STICKYPROT( "." );
}
}
else {
int var = 0;
fglmVector temp = data.getBorderDiv( candidate.monom, var );
fglmASSERT( var > 0, "this should never happen" );
fglmVector nfv = l.addCols( var, data.getBasisSize(), temp );
data.newBorderElem( candidate.monom, nfv );
l.insertCols( candidate.divisors, nfv );
STICKYPROT( "-" );
}
candidate.cleanup();
} //. while ( data.candidatesLeft() == TRUE )
l.endofConstruction();
STICKYPROT2( "\nvdim= %i\n", data.getBasisSize() );
return;
}
fglmSdata::candidatesLeft
BOOLEAN candidatesLeft() const
Definition fglmzero.cc:363
fglmSdata::newBorderElem
void newBorderElem(poly &m, fglmVector v)
Definition fglmzero.cc:441
fglmSdata::getSpanPoly
poly getSpanPoly(int number) const
Definition fglmzero.cc:367
fglmSdata::newBasisElem
int newBasisElem(poly &p)
Definition fglmzero.cc:424
fglmSdata::getVectorRep
fglmVector getVectorRep(const poly m)
Definition fglmzero.cc:543
fglmSdata::nextCandidate
fglmSelem nextCandidate()
Definition fglmzero.cc:467
fglmSdata::getBorderDiv
fglmVector getBorderDiv(const poly m, int &var) const
Definition fglmzero.cc:578
fglmSdata::getBasisSize
int getBasisSize() const
Definition fglmzero.cc:360
fglmSdata::getEdgeNumber
int getEdgeNumber(const poly m) const
Definition fglmzero.cc:529
fglmSdata::updateCandidates
void updateCandidates()
Definition fglmzero.cc:479
fglmSelem
Definition fglm.h:28
fglmSelem::monom
poly monom
Definition fglm.h:31
fglmSelem::cleanup
void cleanup()
Definition fglmzero.cc:330
fglmSelem::divisors
int * divisors
Definition fglm.h:30
fglmSelem::isBasisOrEdge
BOOLEAN isBasisOrEdge() const
Definition fglm.h:36
fglmASSERT
#define fglmASSERT(ignore1, ignore2)
Definition fglmzero.cc:52
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pNorm
void pNorm(poly p)
Definition polys.h:363
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
nf
Definition gnumpfl.cc:25