Public Member Functions | Private Attributes
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
 
oldGaussElemgauss
 
BOOLEANisPivot
 
int * perm
 
int basisSize
 
polyset basis
 
int * varpermutation
 
int groebnerBS
 
int groebnerSize
 
ideal destId
 
List< fglmDelemnlist
 

Detailed Description

Definition at line 760 of file fglmzero.cc.

Constructor & Destructor Documentation

◆ fglmDdata()

fglmDdata::fglmDdata ( int  dimension)

Definition at line 795 of file fglmzero.cc.

796 {
797  int k;
798  dimen= dimension;
799  basisSize= 0;
800  //. All arrays run from [1]..[dimen], thus omAlloc( dimen + 1 )!
801 #ifndef HAVE_EXPLICIT_CONSTR
802  gauss= new oldGaussElem[ dimen+1 ];
803 #else
804  gauss= (oldGaussElem *)omAlloc( (dimen+1)*sizeof( oldGaussElem ) );
805 #endif
806  isPivot= (BOOLEAN *)omAlloc( (dimen+1)*sizeof( BOOLEAN ) );
807  for ( k= dimen; k > 0; k-- ) isPivot[k]= FALSE;
808  perm= (int *)omAlloc( (dimen+1)*sizeof( int ) );
809  basis= (polyset)omAlloc( (dimen+1)*sizeof( poly ) );
810  varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
811  // Sort ring variables by increasing values (because of weighted orderings)
812  ideal perm_id = idMaxIdeal(1);
813  intvec *iv = idSort(perm_id,TRUE);
814  idDelete(&perm_id);
815  for(int i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
816  delete iv;
817 
818  groebnerBS= 16;
819  groebnerSize= 0;
820  destId= idInit( groebnerBS, 1 );
821 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
int groebnerBS
Definition: fglmzero.cc:772
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:169
#define omAlloc(size)
Definition: omAllocDecl.h:210
int dimen
Definition: fglmzero.cc:763
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int basisSize
Definition: fglmzero.cc:767
Definition: intvec.h:14
int * perm
Definition: fglmzero.cc:766
int groebnerSize
Definition: fglmzero.cc:773
int i
Definition: cfEzgcd.cc:123
ideal destId
Definition: fglmzero.cc:774
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
BOOLEAN dimension(leftv res, leftv args)
Definition: bbcone.cc:758
poly * polyset
Definition: hutil.h:15
oldGaussElem * gauss
Definition: fglmzero.cc:764
BOOLEAN * isPivot
Definition: fglmzero.cc:765
polyset basis
Definition: fglmzero.cc:768
int * varpermutation
Definition: fglmzero.cc:770
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85

◆ ~fglmDdata()

fglmDdata::~fglmDdata ( )

Definition at line 823 of file fglmzero.cc.

824 {
825  // STICKYPROT2("dimen= %i", dimen);
826  // STICKYPROT2("basisSize= %i", basisSize);
827  // fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" );
828  int k;
829 #ifndef HAVE_EXPLICIT_CONSTR
830  delete [] gauss;
831 #else
832  // use basisSize instead of dimen because of fglmquot!
833  for ( k= basisSize; k > 0; k-- )
834  gauss[k].~oldGaussElem();
835  omFreeSize( (ADDRESS)gauss, (dimen+1)*sizeof( oldGaussElem ) );
836 #endif
837  omFreeSize( (ADDRESS)isPivot, (dimen+1)*sizeof( BOOLEAN ) );
838  omFreeSize( (ADDRESS)perm, (dimen+1)*sizeof( int ) );
839  // use basisSize instead of dimen because of fglmquot!
840  //. Remember: There is no poly in basis[0], thus k > 0
841  for ( k= basisSize; k > 0; k-- )
842  pLmDelete( basis[k]);
843  omFreeSize( (ADDRESS)basis, (dimen+1)*sizeof( poly ) );
844  omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
845 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void * ADDRESS
Definition: auxiliary.h:115
int k
Definition: cfEzgcd.cc:93
int dimen
Definition: fglmzero.cc:763
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int basisSize
Definition: fglmzero.cc:767
int * perm
Definition: fglmzero.cc:766
oldGaussElem * gauss
Definition: fglmzero.cc:764
BOOLEAN * isPivot
Definition: fglmzero.cc:765
polyset basis
Definition: fglmzero.cc:768
int * varpermutation
Definition: fglmzero.cc:770
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85

Member Function Documentation

◆ buildIdeal()

ideal fglmDdata::buildIdeal ( )
inline

Definition at line 788 of file fglmzero.cc.

789  {
790  idSkipZeroes( destId );
791  return destId;
792  }
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal destId
Definition: fglmzero.cc:774

◆ candidatesLeft()

BOOLEAN fglmDdata::candidatesLeft ( ) const
inline

Definition at line 782 of file fglmzero.cc.

782 { return ( nlist.isEmpty() ? FALSE : TRUE ); }
int isEmpty() const
Definition: ftmpl_list.cc:267
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
List< fglmDelem > nlist
Definition: fglmzero.cc:776

◆ gaussreduce()

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

Definition at line 981 of file fglmzero.cc.

982 {
983  int k;
984  number fac1, fac2;
985  number temp;
986  fglmASSERT( pdenom == NULL, "pdenom in gaussreduce should be NULL" );
987  pdenom= nInit( 1 );
988  number vdenom = v.clearDenom();
989  if ( ! nIsZero( vdenom ) && ! nIsOne( vdenom ) ) {
990  p.setelem( p.size(), vdenom );
991  }
992  else {
993  nDelete( &vdenom );
994  }
995  number gcd = v.gcd();
996  if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) ) {
997  v /= gcd;
998  number temp= nMult( pdenom, gcd );
999  nDelete( &pdenom );
1000  pdenom= temp;
1001  }
1002  nDelete( & gcd );
1003 
1004  for ( k= 1; k <= basisSize; k++ ) {
1005 
1006  if ( ! v.elemIsZero( perm[k] ) ) {
1007  fac1= gauss[k].fac;
1008  fac2= nCopy( v.getconstelem( perm[k] ) );
1009  v.nihilate( fac1, fac2, gauss[k].v );
1010  fac1= nMult( fac1, gauss[k].pdenom );
1011  temp= nMult( fac2, pdenom );
1012  nDelete( &fac2 );
1013  fac2= temp;
1014  p.nihilate( fac1, fac2, gauss[k].p );
1015  temp= nMult( pdenom, gauss[k].pdenom );
1016  nDelete( &pdenom );
1017  pdenom= temp;
1018 
1019  nDelete( & fac1 );
1020  nDelete( & fac2 );
1021  number gcd = v.gcd();
1022  if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
1023  {
1024  v /= gcd;
1025  number temp= nMult( pdenom, gcd );
1026  nDelete( &pdenom );
1027  pdenom= temp;
1028  }
1029  nDelete( & gcd );
1030  gcd= p.gcd();
1031  temp= n_SubringGcd( pdenom, gcd, currRing->cf );
1032  nDelete( &gcd );
1033  gcd= temp;
1034  if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
1035  {
1036  p /= gcd;
1037  temp= nDiv( pdenom, gcd );
1038  nDelete( & pdenom );
1039  pdenom= temp;
1040  nNormalize( pdenom );
1041  }
1042  nDelete( & gcd );
1043  }
1044  }
1045 }
#define nNormalize(n)
Definition: numbers.h:30
int size() const
Definition: fglmvec.cc:208
number getconstelem(int i) const
Definition: fglmvec.cc:447
number gcd() const
Definition: fglmvec.cc:459
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int basisSize
Definition: fglmzero.cc:767
int elemIsZero(int i)
Definition: fglmvec.cc:301
void nihilate(const number fac1, const number fac2, const fglmVector v)
Definition: fglmvec.cc:219
int * perm
Definition: fglmzero.cc:766
number clearDenom()
Definition: fglmvec.cc:503
#define nMult(n1, n2)
Definition: numbers.h:17
number fac
Definition: fglmzero.cc:729
#define fglmASSERT(ignore1, ignore2)
Definition: fglmzero.cc:54
#define nDelete(n)
Definition: numbers.h:16
#define nDiv(a, b)
Definition: numbers.h:32
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
oldGaussElem * gauss
Definition: fglmzero.cc:764
void setelem(int i, number &n)
Definition: fglmvec.cc:452
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define nCopy(n)
Definition: numbers.h:15
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:692
#define nInit(i)
Definition: numbers.h:24

◆ getBasisSize()

int fglmDdata::getBasisSize ( ) const
inline

Definition at line 781 of file fglmzero.cc.

781 { return basisSize; }
int basisSize
Definition: fglmzero.cc:767

◆ newBasisElem()

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

Definition at line 856 of file fglmzero.cc.

857 {
858 // inserts m as a new basis monom. m is NOT copied but directly inserted.
859 // returns m=NULL to indicate, that now basis is oweing m.
860  basisSize++;
861  basis[basisSize]= m;
862  m= NULL;
863  int k= 1;
864  while ( nIsZero(v.getconstelem(k)) || isPivot[k] ) {
865  k++;
866  }
867  fglmASSERT( k <= dimen, "Error(1) in fglmDdata::pivot-search");
868  number pivot= v.getconstelem( k );
869  int pivotcol = k;
870  k++;
871  while ( k <= dimen ) {
872  if ( ! nIsZero( v.getconstelem(k) ) && ! isPivot[k] ) {
873  if ( nGreater( v.getconstelem( k ), pivot ) ) {
874  pivot= v.getconstelem( k );
875  pivotcol= k;
876  }
877  }
878  k++;
879  }
880  fglmASSERT( ! nIsZero( pivot ), "Error(2) fglmDdata::Pivotelement ist Null" );
881  isPivot[ pivotcol ]= TRUE;
882  perm[basisSize]= pivotcol;
883 
884  pivot= nCopy( v.getconstelem( pivotcol ) );
885 #ifndef HAVE_EXPLICIT_CONSTR
886  gauss[basisSize].insertElem( v, p, denom, pivot );
887 #else
888  gauss[basisSize].oldGaussElem( v, p, denom, pivot );
889 #endif
890 }
number getconstelem(int i) const
Definition: fglmvec.cc:447
#define TRUE
Definition: auxiliary.h:98
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].
int k
Definition: cfEzgcd.cc:93
int dimen
Definition: fglmzero.cc:763
int basisSize
Definition: fglmzero.cc:767
int * perm
Definition: fglmzero.cc:766
oldGaussElem(const fglmVector newv, const fglmVector newp, number &newpdenom, number &newfac)
Definition: fglmzero.cc:734
int m
Definition: cfEzgcd.cc:119
#define fglmASSERT(ignore1, ignore2)
Definition: fglmzero.cc:54
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
oldGaussElem * gauss
Definition: fglmzero.cc:764
BOOLEAN * isPivot
Definition: fglmzero.cc:765
polyset basis
Definition: fglmzero.cc:768
#define nCopy(n)
Definition: numbers.h:15
#define nGreater(a, b)
Definition: numbers.h:28

◆ newGroebnerPoly()

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

Definition at line 938 of file fglmzero.cc.

943 {
944  //. Baue das Polynom von oben nach unten:
945  fglmASSERT( p.size() == basisSize+1, "GP::newGroebnerPoly: p has wrong size" );
946  int k;
947  poly result = m;
948  poly temp = result;
949  m= NULL;
950  if ( nGetChar() > 0 ) {
951  number lead = nCopy( p.getconstelem( basisSize+1 ) );
952  p /= lead;
953  nDelete( & lead );
954  }
955  if ( nGetChar() == 0 ) {
956  number gcd= p.gcd();
957  fglmASSERT( ! nIsZero( gcd ), "FATAL: gcd and thus p is zero" );
958  if ( ! nIsOne( gcd ) )
959  p /= gcd;
960  nDelete( & gcd );
961  }
962  pSetCoeff( result, nCopy( p.getconstelem( basisSize+1 ) ) );
963  for ( k= basisSize; k > 0; k-- ) {
964  if ( ! nIsZero( p.getconstelem( k ) ) ) {
965  temp->next= pCopy( basis[k] );
966  pIter( temp );
967  pSetCoeff( temp, nCopy( p.getconstelem( k ) ) );
968  }
969  }
970  pSetm( result );
971  if ( ! nGreaterZero( pGetCoeff( result ) ) ) result= pNeg( result );
972  if ( groebnerSize == IDELEMS( destId ) ) {
975  }
976  (destId->m)[groebnerSize]= result;
977  groebnerSize++;
978 }
#define pSetm(p)
Definition: polys.h:253
int groebnerBS
Definition: fglmzero.cc:772
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:181
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pIter(p)
Definition: monomials.h:44
int basisSize
Definition: fglmzero.cc:767
#define nGreaterZero(n)
Definition: numbers.h:27
int groebnerSize
Definition: fglmzero.cc:773
int m
Definition: cfEzgcd.cc:119
#define nGetChar()
Definition: numbers.h:23
#define IDELEMS(i)
Definition: simpleideals.h:24
#define fglmASSERT(ignore1, ignore2)
Definition: fglmzero.cc:54
#define nDelete(n)
Definition: numbers.h:16
ideal destId
Definition: fglmzero.cc:774
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
polyset basis
Definition: fglmzero.cc:768
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define nCopy(n)
Definition: numbers.h:15
polyrec * poly
Definition: hilb.h:10
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ nextCandidate()

fglmDelem fglmDdata::nextCandidate ( )

Definition at line 848 of file fglmzero.cc.

849 {
851  nlist.removeFirst();
852  return result;
853 }
Definition: fglm.h:46
void removeFirst()
Definition: ftmpl_list.cc:287
T getFirst() const
Definition: ftmpl_list.cc:279
List< fglmDelem > nlist
Definition: fglmzero.cc:776
return result
Definition: facAbsBiFact.cc:76

◆ updateCandidates()

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

Definition at line 893 of file fglmzero.cc.

894 {
896  poly newmonom = NULL;
897  int k = (currRing->N);
898  BOOLEAN done = FALSE;
899  int state = 0;
900  while ( k >= 1 )
901  {
902  newmonom = pCopy( m );
903  pIncrExp( newmonom, varpermutation[k] );
904  pSetm( newmonom );
905  done= FALSE;
906  while ( list.hasItem() && (!done) )
907  {
908  if ( (state= pCmp( list.getItem().monom, newmonom )) < 0 )
909  list++;
910  else done= TRUE;
911  }
912  if ( !done )
913  {
914  nlist.append( fglmDelem( newmonom, v, k ) );
915  break;
916  }
917  if ( state == 0 )
918  {
919  list.getItem().newDivisor();
920  pLmDelete( & newmonom );
921  }
922  else
923  {
924  list.insert( fglmDelem( newmonom, v, k ) );
925  }
926  k--;
927  }
928  while ( --k >= 1 )
929  {
930  newmonom= pCopy( m );
931  pIncrExp( newmonom, varpermutation[k] );
932  pSetm( newmonom );
933  nlist.append( fglmDelem( newmonom, v, k ) );
934  }
935 }
#define pSetm(p)
Definition: polys.h:253
poly monom
Definition: fglm.h:49
#define FALSE
Definition: auxiliary.h:94
void newDivisor()
Definition: fglm.h:57
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
Definition: fglm.h:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pIncrExp(p, i)
Definition: polys.h:43
T & getItem() const
Definition: ftmpl_list.cc:431
int m
Definition: cfEzgcd.cc:119
void insert(const T &)
Definition: ftmpl_list.cc:492
#define NULL
Definition: omList.c:10
int * varpermutation
Definition: fglmzero.cc:770
List< fglmDelem > nlist
Definition: fglmzero.cc:776
void append(const T &)
Definition: ftmpl_list.cc:256
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

Field Documentation

◆ basis

polyset fglmDdata::basis
private

Definition at line 768 of file fglmzero.cc.

◆ basisSize

int fglmDdata::basisSize
private

Definition at line 767 of file fglmzero.cc.

◆ destId

ideal fglmDdata::destId
private

Definition at line 774 of file fglmzero.cc.

◆ dimen

int fglmDdata::dimen
private

Definition at line 763 of file fglmzero.cc.

◆ gauss

oldGaussElem* fglmDdata::gauss
private

Definition at line 764 of file fglmzero.cc.

◆ groebnerBS

int fglmDdata::groebnerBS
private

Definition at line 772 of file fglmzero.cc.

◆ groebnerSize

int fglmDdata::groebnerSize
private

Definition at line 773 of file fglmzero.cc.

◆ isPivot

BOOLEAN* fglmDdata::isPivot
private

Definition at line 765 of file fglmzero.cc.

◆ nlist

List<fglmDelem> fglmDdata::nlist
private

Definition at line 776 of file fglmzero.cc.

◆ perm

int* fglmDdata::perm
private

Definition at line 766 of file fglmzero.cc.

◆ varpermutation

int* fglmDdata::varpermutation
private

Definition at line 770 of file fglmzero.cc.


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