29#include "factory/factory.h"
49#define STICKYPROT(msg) if (BTEST1(OPT_PROT)) Print(msg)
51#define STICKYPROT2(msg,arg) if (BTEST1(OPT_PROT)) Print(msg,arg)
52#define fglmASSERT(ignore1,ignore2)
90 void map( ring source );
125 for ( row= colp->
size-1, elemp= colp->
elems; row >= 0; row--, elemp++ )
157 for ( var= 0; var <
_nfunc; var ++ ) {
158 for ( col= 0, colp=
func[var]; col <
_size; col++, colp++ ) {
160 for ( row= colp->
size-1, elemp= colp->
elems; row >= 0;
165 elemp->
elem= newelem;
169 temp[ perm[var+1]-1 ]=
func[var];
192 fglmASSERT( 0 < divisors[0] && divisors[0] <=
_nfunc,
"wrong number of divisors" );
198 for (
k= divisors[0];
k > 0;
k-- ) {
213 fglmASSERT( 0 < divisors[0] && divisors[0] <=
_nfunc,
"wrong number of divisors" );
219 if ( numElems > 0 ) {
221 for (
k= 1,
l= 1, elemp= elems;
k <= numElems;
k++, elemp++ ) {
230 for (
k= divisors[0];
k > 0;
k-- ) {
233 colp->
size= numElems;
248 int vsize =
v.size();
251 for (
k= 1, colp=
func[var-1];
k <= vsize;
k++, colp++ ) {
254 for (
l= colp->
size-1, elemp= colp->
elems;
l >= 0;
l--, elemp++ ) {
256 number newelem=
nAdd(
result.getconstelem( elemp->
row ), temp );
275 for (
k= 1, colp=
func[var-1];
k <=
_size;
k++, colp++ ) {
278 for (
l= colp->
size-1, elemp= colp->
elems;
l >= 0;
l--, elemp++ ) {
280 number newelem=
nAdd(
result.getconstelem( elemp->
row ), temp );
307#ifndef HAVE_EXPLICIT_CONSTR
394#ifndef HAVE_EXPLICIT_CONSTR
409#ifndef HAVE_EXPLICIT_CONSTR
445#ifndef HAVE_EXPLICIT_CONSTR
458#ifndef HAVE_EXPLICIT_CONSTR
484 poly newmonom =
NULL;
494 while ( list.
hasItem() && (!done) )
548 while (
m !=
NULL ) {
551 fglmASSERT(
num > 0,
"Error(1) in fglmSdata::getVectorRep" );
641 l.insertCols( candidate.
divisors, basis );
648 fglmASSERT( var > 0,
"this should never happen" );
656 l.endofConstruction();
677 return ( data.
state() );
690 return ( data.
state() );
729#ifndef HAVE_EXPLICIT_CONSTR
738#ifndef HAVE_EXPLICIT_CONSTR
739 void insertElem(
const fglmVector newv,
const fglmVector newp, number & newpdenom, number & newfac )
799#ifndef HAVE_EXPLICIT_CONSTR
827#ifndef HAVE_EXPLICIT_CONSTR
866 number
pivot=
v.getconstelem(
k );
883#ifndef HAVE_EXPLICIT_CONSTR
894 poly newmonom =
NULL;
904 while ( list.
hasItem() && (!done) )
906 if ( (state=
pCmp( list.
getItem().monom, newmonom )) < 0 )
962 if ( !
nIsZero(
p.getconstelem(
k ) ) ) {
984 fglmASSERT( pdenom ==
NULL,
"pdenom in gaussreduce should be NULL" );
986 number vdenom =
v.clearDenom();
988 p.setelem(
p.size(), vdenom );
993 number
gcd =
v.gcd();
1004 if ( !
v.elemIsZero(
perm[
k] ) ) {
1007 v.nihilate( fac1, fac2,
gauss[
k].
v );
1009 temp=
nMult( fac2, pdenom );
1012 p.nihilate( fac1, fac2,
gauss[
k].
p );
1019 number
gcd =
v.gcd();
1059 if ( iv.isZero() ) {
1070 number nOne =
nInit( 1 );
1086 number pdenom =
NULL;
1146 number
gcd=
p.gcd();
1155 for (
k=
p.size();
k > 0;
k-- )
1157 number n =
nCopy(
p.getconstelem(
k ) );
1182 v=
l.multiply(
v,
i );
1204 if ( deleteIdeal ==
TRUE )
1207 if ( fglmok ==
TRUE )
1209 L.
map( sourceRing );
1212 if ( (switchBack) && (
currRing != initialRing) )
1218fglmquot( ideal sourceIdeal, poly quot, ideal & destIdeal)
1228 if ( fglmok ==
TRUE ) {
1242 if ( fglmok ==
TRUE ) {
BOOLEAN dimension(leftv res, leftv args)
borderElem(poly p, fglmVector n)
fglmDelem nextCandidate()
void newGroebnerPoly(fglmVector &v, poly &p)
BOOLEAN candidatesLeft() const
void updateCandidates(poly m, const fglmVector v)
void gaussreduce(fglmVector &v, fglmVector &p, number &denom)
void newBasisElem(poly &m, fglmVector v, fglmVector p, number &denom)
BOOLEAN isBasisOrEdge() const
fglmDelem(poly &m, fglmVector mv, int v)
The new basis.
BOOLEAN candidatesLeft() const
fglmSdata(const ideal thisIdeal)
void newBorderElem(poly &m, fglmVector v)
poly getSpanPoly(int number) const
int newBasisElem(poly &p)
fglmVector getVectorRep(const poly m)
fglmSelem nextCandidate()
fglmVector getBorderDiv(const poly m, int &var) const
int getEdgeNumber(const poly m) const
fglmSelem(poly p, int var)
BOOLEAN isBasisOrEdge() const
int numNonZeroElems() const
number getconstelem(int i) const
void setelem(int i, number &n)
BOOLEAN reduce(fglmVector v)
fglmVector getDependence()
idealFunctionals(int blockSize, int numFuncs)
void insertCols(int *divisors, int to)
fglmVector multiply(const fglmVector v, int var) const
fglmVector addCols(const int var, int basisSize, const fglmVector v) const
matHeader * grow(int var)
oldGaussElem(const fglmVector newv, const fglmVector newp, number &newpdenom, number &newfac)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
static FORCE_INLINE number n_SubringGcd(number a, number b, const coeffs r)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
const Variable & v
< [in] a sqrfree bivariate poly
bool isZero(const CFArray &A)
checks if entries of A are zero
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static ideal FindUnivariatePolys(const idealFunctionals &l)
#define fglmASSERT(ignore1, ignore2)
#define STICKYPROT2(msg, arg)
BOOLEAN fglmzero(ring sourceRing, ideal &sourceIdeal, ring destRing, ideal &destIdeal, BOOLEAN switchBack, BOOLEAN deleteIdeal)
static BOOLEAN CalculateFunctionals(const ideal &theIdeal, idealFunctionals &l)
BOOLEAN fglmquot(ideal sourceIdeal, poly quot, ideal &destIdeal)
static ideal GroebnerViaFunctionals(const idealFunctionals &l, fglmVector iv=fglmVector())
BOOLEAN FindUnivariateWrapper(ideal source, ideal &destIdeal)
void internalCalculateFunctionals(const ideal, idealFunctionals &l, fglmSdata &data)
#define idDelete(H)
delete an ideal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
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].
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)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define omFreeSize(addr, size)
#define omReallocSize(addr, o_size, size)
void pEnlargeSet(poly **p, int l, int increment)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing)
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pGetExp(p, i)
Exponent.
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
#define pCopy(p)
return a copy of the poly
static short rVar(const ring r)
#define rVar(r) (r->N)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size