29 #include <factory/factory.h>
51 #define STICKYPROT(msg) if (BTEST1(OPT_PROT)) Print(msg)
52 #define PROT2(msg,arg)
53 #define STICKYPROT2(msg,arg) if (BTEST1(OPT_PROT)) Print(msg,arg)
54 #define fglmASSERT(ignore1,ignore2)
92 void map( ring source );
113 for ( k=
_nfunc-1; k >= 0; k-- )
124 for ( k=
_nfunc-1; k >= 0; k-- ) {
125 for ( l=
_size-1, colp=
func[k]; l >= 0; l--, colp++ ) {
127 for ( row= colp->
size-1, elemp= colp->
elems; row >= 0; row--, elemp++ )
159 for ( var= 0; var <
_nfunc; var ++ ) {
160 for ( col= 0, colp=
func[var]; col <
_size; col++, colp++ ) {
162 for ( row= colp->
size-1, elemp= colp->
elems; row >= 0;
167 elemp->
elem= newelem;
171 temp[ perm[var+1]-1 ]=
func[var];
183 for ( k=
_nfunc; k > 0; k-- )
194 fglmASSERT( 0 < divisors[0] && divisors[0] <=
_nfunc,
"wrong number of divisors" );
200 for ( k= divisors[0]; k > 0; k-- ) {
215 fglmASSERT( 0 < divisors[0] && divisors[0] <=
_nfunc,
"wrong number of divisors" );
221 if ( numElems > 0 ) {
223 for ( k= 1, l= 1, elemp= elems; k <= numElems; k++, elemp++ ) {
232 for ( k= divisors[0]; k > 0; k-- ) {
235 colp->
size= numElems;
250 int vsize = v.
size();
253 for ( k= 1, colp=
func[var-1]; k <= vsize; k++, colp++ ) {
256 for ( l= colp->
size-1, elemp= colp->
elems; l >= 0; l--, elemp++ ) {
277 for ( k= 1, colp=
func[var-1]; k <=
_size; k++, colp++ ) {
280 for ( l= colp->
size-1, elemp= colp->
elems; l >= 0; l--, elemp++ ) {
282 number newelem=
nAdd( result.getconstelem( elemp->
row ), temp );
285 result.setelem( elemp->
row, newelem );
309 #ifndef HAVE_EXPLICIT_CONSTR
396 #ifndef HAVE_EXPLICIT_CONSTR
411 #ifndef HAVE_EXPLICIT_CONSTR
447 #ifndef HAVE_EXPLICIT_CONSTR
460 #ifndef HAVE_EXPLICIT_CONSTR
492 newmonom =
pCopy( m );
496 while ( list.
hasItem() && (!done) )
520 newmonom=
pCopy( m );
550 while ( m !=
NULL ) {
553 fglmASSERT( num > 0,
"Error(1) in fglmSdata::getVectorRep" );
650 fglmASSERT( var > 0,
"this should never happen" );
679 return ( data.
state() );
692 return ( data.
state() );
731 #ifndef HAVE_EXPLICIT_CONSTR
740 #ifndef HAVE_EXPLICIT_CONSTR
741 void insertElem(
const fglmVector newv,
const fglmVector newp, number & newpdenom, number & newfac )
801 #ifndef HAVE_EXPLICIT_CONSTR
829 #ifndef HAVE_EXPLICIT_CONSTR
871 while ( k <=
dimen ) {
885 #ifndef HAVE_EXPLICIT_CONSTR
902 newmonom =
pCopy( m );
906 while ( list.
hasItem() && (!done) )
930 newmonom=
pCopy( m );
986 fglmASSERT( pdenom ==
NULL,
"pdenom in gaussreduce should be NULL" );
998 number temp=
nMult( pdenom, gcd );
1011 temp=
nMult( fac2, pdenom );
1021 number gcd = v.gcd();
1025 number temp=
nMult( pdenom, gcd );
1037 temp=
nDiv( pdenom, gcd );
1061 if ( iv.isZero() ) {
1071 data.updateCandidates( one, initv );
1072 number nOne =
nInit( 1 );
1073 data.newBasisElem( one, initv,
fglmVector( 1, 1 ), nOne );
1075 while ( data.candidatesLeft() ==
TRUE ) {
1076 fglmDelem candidate = data.nextCandidate();
1087 fglmVector p( data.getBasisSize()+1, data.getBasisSize()+1 );
1088 number pdenom =
NULL;
1089 data.gaussreduce( v,
p, pdenom );
1094 data.newGroebnerPoly(
p, candidate.
monom );
1104 data.updateCandidates( candidate.
monom, originalV );
1105 data.newBasisElem( candidate.
monom, v,
p, pdenom );
1115 return ( data.buildIdeal() );
1132 for(i = (
currRing->N); i > 0; i--) varpermutation[(
currRing->N)+1-i] = (*iv)[i-1];
1135 for (i= 1; i <= (
currRing->N); i++ )
1144 if ( (isZero= gauss.reduce( v )))
1147 p= gauss.getDependence();
1157 for ( k= p.
size(); k > 0; k-- ) {
1160 if ( temp ==
NULL ) {
1174 (destIdeal->m)[i-1]= result;
1201 if ( deleteIdeal ==
TRUE )
1204 if ( fglmok ==
TRUE )
1206 L.
map( sourceRing );
1209 if ( (switchBack) && (
currRing != initialRing) )
1225 if ( fglmok ==
TRUE ) {
1239 if ( fglmok ==
TRUE ) {
fglmDelem(poly &m, fglmVector mv, int v)
The new basis.
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
fglmDelem nextCandidate()
void internalCalculateFunctionals(const ideal, idealFunctionals &l, fglmSdata &data)
Compatiblity layer for legacy polynomial operations (over currRing)
BOOLEAN candidatesLeft() const
#define omFreeSize(addr, size)
void gaussreduce(fglmVector &v, fglmVector &p, number &denom)
void newBasisElem(poly &m, fglmVector v, fglmVector p, number &denom)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
fglmSelem nextCandidate()
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
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].
static ideal GroebnerViaFunctionals(const idealFunctionals &l, fglmVector iv=fglmVector())
number getconstelem(int i) const
#define STICKYPROT2(msg, arg)
void insertCols(int *divisors, int to)
fglmSdata(const ideal thisIdeal)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
#define omReallocSize(addr, o_size, size)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetExp(p, i)
Exponent.
static ideal FindUnivariatePolys(const idealFunctionals &l)
fglmVector addCols(const int var, int basisSize, const fglmVector v) const
int numNonZeroElems() const
idealFunctionals(int blockSize, int numFuncs)
void updateCandidates(poly m, const fglmVector v)
int newBasisElem(poly &p)
void nihilate(const number fac1, const number fac2, const fglmVector v)
BOOLEAN isBasisOrEdge() const
fglmSelem(poly p, int var)
oldGaussElem(const fglmVector newv, const fglmVector newp, number &newpdenom, number &newfac)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
fglmVector multiply(const fglmVector v, int var) const
matHeader * grow(int var)
static BOOLEAN CalculateFunctionals(const ideal &theIdeal, idealFunctionals &l)
borderElem(poly p, fglmVector n)
void newGroebnerPoly(fglmVector &v, poly &p)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define fglmASSERT(ignore1, ignore2)
void rChangeCurrRing(ring r)
void newBorderElem(poly &m, fglmVector v)
ideal idInit(int idsize, int rank)
initialise an ideal / module
const Variable & v
< [in] a sqrfree bivariate poly
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
BOOLEAN dimension(leftv res, leftv args)
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
void pEnlargeSet(poly **p, int l, int increment)
int getEdgeNumber(const poly m) const
poly getSpanPoly(int number) const
void setelem(int i, number &n)
void pNorm(poly p, const ring R=currRing)
BOOLEAN fglmzero(ring sourceRing, ideal &sourceIdeal, ring destRing, ideal &destIdeal, BOOLEAN switchBack, BOOLEAN deleteIdeal)
fglmVector getVectorRep(const poly m)
bool isZero(const CFArray &A)
checks if entries of A are zero
BOOLEAN isBasisOrEdge() const
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
BOOLEAN candidatesLeft() const
fglmVector getBorderDiv(const poly m, int &var) const
BOOLEAN FindUnivariateWrapper(ideal source, ideal &destIdeal)
BOOLEAN fglmquot(ideal sourceIdeal, poly quot, ideal &destIdeal)
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
void idDelete(ideal *h)
delete an ideal
#define pCopy(p)
return a copy of the poly