My Project
Loading...
Searching...
No Matches
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 758 of file fglmzero.cc.

Constructor & Destructor Documentation

◆ fglmDdata()

fglmDdata::fglmDdata ( int  dimension)

Definition at line 793 of file fglmzero.cc.

794{
795 int k;
797 basisSize= 0;
798 //. All arrays run from [1]..[dimen], thus omAlloc( dimen + 1 )!
799#ifndef HAVE_EXPLICIT_CONSTR
800 gauss= new oldGaussElem[ dimen+1 ];
801#else
802 gauss= (oldGaussElem *)omAlloc( (dimen+1)*sizeof( oldGaussElem ) );
803#endif
804 isPivot= (BOOLEAN *)omAlloc( (dimen+1)*sizeof( BOOLEAN ) );
805 for ( k= dimen; k > 0; k-- ) isPivot[k]= FALSE;
806 perm= (int *)omAlloc( (dimen+1)*sizeof( int ) );
807 basis= (polyset)omAlloc( (dimen+1)*sizeof( poly ) );
808 varpermutation = (int*)omAlloc( ((currRing->N)+1)*sizeof(int) );
809 // Sort ring variables by increasing values (because of weighted orderings)
810 ideal perm_id = idMaxIdeal(1);
811 intvec *iv = idSort(perm_id,TRUE);
812 idDelete(&perm_id);
813 for(int i = (currRing->N); i > 0; i--) varpermutation[(currRing->N)+1-i] = (*iv)[i-1];
814 delete iv;
815
816 groebnerBS= 16;
817 groebnerSize= 0;
818 destId= idInit( groebnerBS, 1 );
819}
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
BOOLEAN dimension(leftv res, leftv args)
Definition: bbcone.cc:757
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
BOOLEAN * isPivot
Definition: fglmzero.cc:763
int dimen
Definition: fglmzero.cc:761
int * varpermutation
Definition: fglmzero.cc:768
oldGaussElem * gauss
Definition: fglmzero.cc:762
int groebnerSize
Definition: fglmzero.cc:771
int basisSize
Definition: fglmzero.cc:765
polyset basis
Definition: fglmzero.cc:766
int groebnerBS
Definition: fglmzero.cc:770
ideal destId
Definition: fglmzero.cc:772
int * perm
Definition: fglmzero.cc:764
Definition: intvec.h:23
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:184
#define omAlloc(size)
Definition: omAllocDecl.h:210
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
poly * polyset
Definition: polys.h:259
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.

822{
823 // STICKYPROT2("dimen= %i", dimen);
824 // STICKYPROT2("basisSize= %i", basisSize);
825 // fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" );
826 int k;
827#ifndef HAVE_EXPLICIT_CONSTR
828 delete [] gauss;
829#else
830 // use basisSize instead of dimen because of fglmquot!
831 for ( k= basisSize; k > 0; k-- )
832 gauss[k].~oldGaussElem();
833 omFreeSize( (ADDRESS)gauss, (dimen+1)*sizeof( oldGaussElem ) );
834#endif
835 omFreeSize( (ADDRESS)isPivot, (dimen+1)*sizeof( BOOLEAN ) );
836 omFreeSize( (ADDRESS)perm, (dimen+1)*sizeof( int ) );
837 // use basisSize instead of dimen because of fglmquot!
838 //. Remember: There is no poly in basis[0], thus k > 0
839 for ( k= basisSize; k > 0; k-- )
840 pLmDelete( basis[k]);
841 omFreeSize( (ADDRESS)basis, (dimen+1)*sizeof( poly ) );
842 omFreeSize( (ADDRESS)varpermutation, ((currRing->N)+1)*sizeof(int) );
843}
void * ADDRESS
Definition: auxiliary.h:119
#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

Member Function Documentation

◆ buildIdeal()

ideal fglmDdata::buildIdeal ( )
inline

Definition at line 786 of file fglmzero.cc.

787 {
789 return destId;
790 }
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size

◆ candidatesLeft()

BOOLEAN fglmDdata::candidatesLeft ( ) const
inline

Definition at line 780 of file fglmzero.cc.

780{ return ( nlist.isEmpty() ? FALSE : TRUE ); }
int isEmpty() const
Definition: ftmpl_list.cc:267
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.

980{
981 int k;
982 number fac1, fac2;
983 number temp;
984 fglmASSERT( pdenom == NULL, "pdenom in gaussreduce should be NULL" );
985 pdenom= nInit( 1 );
986 number vdenom = v.clearDenom();
987 if ( ! nIsZero( vdenom ) && ! nIsOne( vdenom ) ) {
988 p.setelem( p.size(), vdenom );
989 }
990 else {
991 nDelete( &vdenom );
992 }
993 number gcd = v.gcd();
994 if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) ) {
995 v /= gcd;
996 number temp= nMult( pdenom, gcd );
997 nDelete( &pdenom );
998 pdenom= temp;
999 }
1000 nDelete( & gcd );
1001
1002 for ( k= 1; k <= basisSize; k++ ) {
1003
1004 if ( ! v.elemIsZero( perm[k] ) ) {
1005 fac1= gauss[k].fac;
1006 fac2= nCopy( v.getconstelem( perm[k] ) );
1007 v.nihilate( fac1, fac2, gauss[k].v );
1008 fac1= nMult( fac1, gauss[k].pdenom );
1009 temp= nMult( fac2, pdenom );
1010 nDelete( &fac2 );
1011 fac2= temp;
1012 p.nihilate( fac1, fac2, gauss[k].p );
1013 temp= nMult( pdenom, gauss[k].pdenom );
1014 nDelete( &pdenom );
1015 pdenom= temp;
1016
1017 nDelete( & fac1 );
1018 nDelete( & fac2 );
1019 number gcd = v.gcd();
1020 if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
1021 {
1022 v /= gcd;
1023 number temp= nMult( pdenom, gcd );
1024 nDelete( &pdenom );
1025 pdenom= temp;
1026 }
1027 nDelete( & gcd );
1028 gcd= p.gcd();
1029 temp= n_SubringGcd( pdenom, gcd, currRing->cf );
1030 nDelete( &gcd );
1031 gcd= temp;
1032 if ( ! nIsZero( gcd ) && ! nIsOne( gcd ) )
1033 {
1034 p /= gcd;
1035 temp= nDiv( pdenom, gcd );
1036 nDelete( & pdenom );
1037 pdenom= temp;
1038 nNormalize( pdenom );
1039 }
1040 nDelete( & gcd );
1041 }
1042 }
1043}
int p
Definition: cfModGcd.cc:4078
number fac
Definition: fglmzero.cc:727
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
Definition: coeffs.h:663
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
#define fglmASSERT(ignore1, ignore2)
Definition: fglmzero.cc:52
#define nDiv(a, b)
Definition: numbers.h:32
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define nCopy(n)
Definition: numbers.h:15
#define nIsOne(n)
Definition: numbers.h:25
#define nNormalize(n)
Definition: numbers.h:30
#define nInit(i)
Definition: numbers.h:24
#define nMult(n1, n2)
Definition: numbers.h:17
#define NULL
Definition: omList.c:12
int gcd(int a, int b)
Definition: walkSupport.cc:836

◆ getBasisSize()

int fglmDdata::getBasisSize ( ) const
inline

Definition at line 779 of file fglmzero.cc.

779{ return basisSize; }

◆ newBasisElem()

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

Definition at line 854 of file fglmzero.cc.

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

◆ newGroebnerPoly()

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

Definition at line 936 of file fglmzero.cc.

941{
942 //. Baue das Polynom von oben nach unten:
943 fglmASSERT( p.size() == basisSize+1, "GP::newGroebnerPoly: p has wrong size" );
944 int k;
945 poly result = m;
946 poly temp = result;
947 m= NULL;
948 if ( nGetChar() > 0 ) {
949 number lead = nCopy( p.getconstelem( basisSize+1 ) );
950 p /= lead;
951 nDelete( & lead );
952 }
953 if ( nGetChar() == 0 ) {
954 number gcd= p.gcd();
955 fglmASSERT( ! nIsZero( gcd ), "FATAL: gcd and thus p is zero" );
956 if ( ! nIsOne( gcd ) )
957 p /= gcd;
958 nDelete( & gcd );
959 }
960 pSetCoeff( result, nCopy( p.getconstelem( basisSize+1 ) ) );
961 for ( k= basisSize; k > 0; k-- ) {
962 if ( ! nIsZero( p.getconstelem( k ) ) ) {
963 temp->next= pCopy( basis[k] );
964 pIter( temp );
965 pSetCoeff( temp, nCopy( p.getconstelem( k ) ) );
966 }
967 }
968 pSetm( result );
969 if ( ! nGreaterZero( pGetCoeff( result ) ) ) result= pNeg( result );
970 if ( groebnerSize == IDELEMS( destId ) ) {
973 }
975 groebnerSize++;
976}
return result
Definition: facAbsBiFact.cc:75
#define pIter(p)
Definition: monomials.h:37
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
#define nGetChar()
Definition: numbers.h:23
#define nGreaterZero(n)
Definition: numbers.h:27
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3696
#define pSetm(p)
Definition: polys.h:271
#define pNeg(p)
Definition: polys.h:198
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ nextCandidate()

fglmDelem fglmDdata::nextCandidate ( )

Definition at line 846 of file fglmzero.cc.

847{
850 return result;
851}
T getFirst() const
Definition: ftmpl_list.cc:279
void removeFirst()
Definition: ftmpl_list.cc:287
Definition: fglm.h:47

◆ updateCandidates()

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

Definition at line 891 of file fglmzero.cc.

892{
894 poly newmonom = NULL;
895 int k = (currRing->N);
896 BOOLEAN done = FALSE;
897 int state = 0;
898 while ( k >= 1 )
899 {
900 newmonom = pCopy( m );
901 pIncrExp( newmonom, varpermutation[k] );
902 pSetm( newmonom );
903 done= FALSE;
904 while ( list.hasItem() && (!done) )
905 {
906 if ( (state= pCmp( list.getItem().monom, newmonom )) < 0 )
907 list++;
908 else done= TRUE;
909 }
910 if ( !done )
911 {
912 nlist.append( fglmDelem( newmonom, v, k ) );
913 break;
914 }
915 if ( state == 0 )
916 {
917 list.getItem().newDivisor();
918 pLmDelete( & newmonom );
919 }
920 else
921 {
922 list.insert( fglmDelem( newmonom, v, k ) );
923 }
924 k--;
925 }
926 while ( --k >= 1 )
927 {
928 newmonom= pCopy( m );
929 pIncrExp( newmonom, varpermutation[k] );
930 pSetm( newmonom );
931 nlist.append( fglmDelem( newmonom, v, k ) );
932 }
933}
T & getItem() const
Definition: ftmpl_list.cc:431
void insert(const T &)
Definition: ftmpl_list.cc:492
void append(const T &)
Definition: ftmpl_list.cc:256
#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 pIncrExp(p, i)
Definition: polys.h:43

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: