Macros | Typedefs | Enumerations | Functions
ideals.h File Reference
#include <polys/monomials/ring.h>
#include <polys/monomials/p_polys.h>
#include <polys/simpleideals.h>
#include <kernel/structs.h>

Go to the source code of this file.

Macros

#define idDelete(H)   id_Delete((H),currRing)
 delete an ideal More...
 
#define idMaxIdeal(D)   id_MaxIdeal(D,currRing)
 initialise the maximal ideal (at 0) More...
 
#define idPosConstant(I)   id_PosConstant(I,currRing)
 index of generator with leading term in ground ring (if any); otherwise -1 More...
 
#define idIsConstant(I)   id_IsConstant(I,currRing)
 
#define idSimpleAdd(A, B)   id_SimpleAdd(A,B,currRing)
 
#define idPrint(id)   id_Print(id, currRing, currRing)
 
#define idTest(id)   id_Test(id, currRing)
 

Typedefs

typedef ideal * resolvente
 

Enumerations

enum  GbVariant {
  GbDefault =0, GbStd, GbSlimgb, GbSba,
  GbGroebner, GbModstd, GbFfmod, GbNfmod,
  GbSingmatic
}
 

Functions

static ideal idCopyFirstK (const ideal ide, const int k)
 
void idKeepFirstK (ideal ide, const int k)
 keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.) More...
 
void idDelEquals (ideal id)
 
ideal id_Copy (ideal h1, const ring r)
 copy an ideal More...
 
ideal idCopy (ideal A)
 
ideal idAdd (ideal h1, ideal h2)
 h1 + h2 More...
 
BOOLEAN idInsertPoly (ideal h1, poly h2)
 insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted More...
 
BOOLEAN idInsertPolyOnPos (ideal I, poly p, int pos)
 insert p into I on position pos More...
 
BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk)
 
static ideal idMult (ideal h1, ideal h2)
 hh := h1 * h2 More...
 
BOOLEAN idIs0 (ideal h)
 returns true if h is the zero ideal More...
 
static BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
 
static BOOLEAN idHomModule (ideal m, ideal Q, intvec **w)
 
BOOLEAN idTestHomModule (ideal m, ideal Q, intvec *w)
 
ideal idMinBase (ideal h1)
 
void idInitChoise (int r, int beg, int end, BOOLEAN *endch, int *choise)
 
void idGetNextChoise (int r, int end, BOOLEAN *endch, int *choise)
 
int idGetNumberOfChoise (int t, int d, int begin, int end, int *choise)
 
int binom (int n, int r)
 
ideal idFreeModule (int i)
 
ideal idSect (ideal h1, ideal h2)
 
ideal idMultSect (resolvente arg, int length)
 
ideal idSyzygies (ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp=TRUE, BOOLEAN setRegularity=FALSE, int *deg=NULL, GbVariant a=GbDefault)
 
ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL, GbVariant a=GbDefault)
 
ideal idLift (ideal mod, ideal sumod, ideal *rest=NULL, BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE, BOOLEAN divide=FALSE, matrix *unit=NULL, GbVariant a=GbDefault)
 
void idLiftW (ideal P, ideal Q, int n, matrix &T, ideal &R, short *w=NULL)
 
intvecidMWLift (ideal mod, intvec *weights)
 
ideal idQuot (ideal h1, ideal h2, BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE)
 
ideal idElimination (ideal h1, poly delVar, intvec *hilb=NULL)
 
ideal idMinors (matrix a, int ar, ideal R=NULL)
 compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL) More...
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
 
ideal idHead (ideal h)
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
static ideal idVec2Ideal (poly vec)
 
ideal idSeries (int n, ideal M, matrix U=NULL, intvec *w=NULL)
 
static BOOLEAN idIsZeroDim (ideal i)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply=TRUE)
 
static intvecidSort (ideal id, BOOLEAN nolex=TRUE)
 
ideal idModulo (ideal h1, ideal h2, tHomog h=testHomog, intvec **w=NULL)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
ideal idXXX (ideal h1, int k)
 
poly id_GCD (poly f, poly g, const ring r)
 
ideal id_Farey (ideal x, number N, const ring r)
 
ideal id_TensorModuleMult (const int m, const ideal M, const ring rRing)
 
GbVariant syGetAlgorithm (char *n, const ring r, const ideal M)
 

Macro Definition Documentation

◆ idDelete

#define idDelete (   H)    id_Delete((H),currRing)

delete an ideal

Definition at line 29 of file ideals.h.

◆ idIsConstant

#define idIsConstant (   I)    id_IsConstant(I,currRing)

Definition at line 40 of file ideals.h.

◆ idMaxIdeal

#define idMaxIdeal (   D)    id_MaxIdeal(D,currRing)

initialise the maximal ideal (at 0)

Definition at line 33 of file ideals.h.

◆ idPosConstant

#define idPosConstant (   I)    id_PosConstant(I,currRing)

index of generator with leading term in ground ring (if any); otherwise -1

Definition at line 37 of file ideals.h.

◆ idPrint

#define idPrint (   id)    id_Print(id, currRing, currRing)

Definition at line 46 of file ideals.h.

◆ idSimpleAdd

#define idSimpleAdd (   A,
  B 
)    id_SimpleAdd(A,B,currRing)

Definition at line 42 of file ideals.h.

◆ idTest

#define idTest (   id)    id_Test(id, currRing)

Definition at line 47 of file ideals.h.

Typedef Documentation

◆ resolvente

typedef ideal* resolvente

Definition at line 18 of file ideals.h.

Enumeration Type Documentation

◆ GbVariant

enum GbVariant
Enumerator
GbDefault 
GbStd 
GbSlimgb 
GbSba 
GbGroebner 
GbModstd 
GbFfmod 
GbNfmod 
GbSingmatic 

Definition at line 121 of file ideals.h.

122 {
123  GbDefault=0,
124  // internal variants:
125  GbStd,
126  GbSlimgb,
127  GbSba,
128  // and the library functions:
129  GbGroebner,
130  GbModstd,
131  GbFfmod,
132  GbNfmod,
134 };
Definition: ideals.h:127
Definition: ideals.h:125

Function Documentation

◆ binom()

int binom ( int  n,
int  r 
)

Definition at line 911 of file simpleideals.cc.

912 {
913  int i,result;
914 
915  if (r==0) return 1;
916  if (n-r<r) return binom(n,n-r);
917  result = n-r+1;
918  for (i=2;i<=r;i++)
919  {
920  result *= n-r+i;
921  if (result<0)
922  {
923  WarnS("overflow in binomials");
924  return 0;
925  }
926  result /= i;
927  }
928  return result;
929 }
#define WarnS
Definition: emacs.cc:81
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
int binom(int n, int r)
return result
Definition: facAbsBiFact.cc:76

◆ id_Copy()

ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 402 of file simpleideals.cc.

403 {
404  id_Test(h1, r);
405 
406  ideal h2 = idInit(IDELEMS(h1), h1->rank);
407  for (int i=IDELEMS(h1)-1; i>=0; i--)
408  h2->m[i] = p_Copy(h1->m[i],r);
409  return h2;
410 }
#define id_Test(A, lR)
Definition: simpleideals.h:80
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38

◆ id_Farey()

ideal id_Farey ( ideal  x,
number  N,
const ring  r 
)

Definition at line 2510 of file ideals.cc.

2511 {
2512  int cnt=IDELEMS(x)*x->nrows;
2513  ideal result=idInit(cnt,x->rank);
2514  result->nrows=x->nrows; // for lifting matrices
2515  result->ncols=x->ncols; // for lifting matrices
2516 
2517  int i;
2518  for(i=cnt-1;i>=0;i--)
2519  {
2520  result->m[i]=p_Farey(x->m[i],N,r);
2521  }
2522  return result;
2523 }
const ring r
Definition: syzextra.cc:208
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:61
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
Variable x
Definition: cfModGcd.cc:4023
return result
Definition: facAbsBiFact.cc:76

◆ id_GCD()

poly id_GCD ( poly  f,
poly  g,
const ring  r 
)

Definition at line 2407 of file ideals.cc.

2408 {
2409  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2410  intvec *w = NULL;
2411 
2412  ring save_r = currRing;
2413  rChangeCurrRing(r);
2414  ideal S=idSyzygies(I,testHomog,&w);
2415  rChangeCurrRing(save_r);
2416 
2417  if (w!=NULL) delete w;
2418  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2419  id_Delete(&S, r);
2420  poly gcd_p=singclap_pdivide(f,gg, r);
2421  p_Delete(&gg, r);
2422 
2423  return gcd_p;
2424 }
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3440
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
g
Definition: cfModGcd.cc:4031
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:534
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
FILE * f
Definition: checklibs.c:9
void rChangeCurrRing(ring r)
Definition: polys.cc:12
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:562
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
polyrec * poly
Definition: hilb.h:10

◆ id_TensorModuleMult()

ideal id_TensorModuleMult ( const int  m,
const ideal  M,
const ring  rRing 
)

Definition at line 1661 of file simpleideals.cc.

1662 {
1663 // #ifdef DEBU
1664 // WarnS("tensorModuleMult!!!!");
1665 
1666  assume(m > 0);
1667  assume(M != NULL);
1668 
1669  const int n = rRing->N;
1670 
1671  assume(M->rank <= m * n);
1672 
1673  const int k = IDELEMS(M);
1674 
1675  ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
1676 
1677  for( int i = 0; i < k; i++ ) // for every w \in M
1678  {
1679  poly pTempSum = NULL;
1680 
1681  poly w = M->m[i];
1682 
1683  while(w != NULL) // for each term of w...
1684  {
1685  poly h = p_Head(w, rRing);
1686 
1687  const int gen = p_GetComp(h, rRing); // 1 ...
1688 
1689  assume(gen > 0);
1690  assume(gen <= n*m);
1691 
1692  // TODO: write a formula with %, / instead of while!
1693  /*
1694  int c = gen;
1695  int v = 1;
1696  while(c > m)
1697  {
1698  c -= m;
1699  v++;
1700  }
1701  */
1702 
1703  int cc = gen % m;
1704  if( cc == 0) cc = m;
1705  int vv = 1 + (gen - cc) / m;
1706 
1707 // assume( cc == c );
1708 // assume( vv == v );
1709 
1710  // 1<= c <= m
1711  assume( cc > 0 );
1712  assume( cc <= m );
1713 
1714  assume( vv > 0 );
1715  assume( vv <= n );
1716 
1717  assume( (cc + (vv-1)*m) == gen );
1718 
1719  p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
1720  p_SetComp(h, cc, rRing);
1721 
1722  p_Setm(h, rRing); // addjust degree after the previous steps!
1723 
1724  pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
1725 
1726  pIter(w);
1727  }
1728 
1729  idTemp->m[i] = pTempSum;
1730  }
1731 
1732  // simplify idTemp???
1733 
1734  ideal idResult = id_Transp(idTemp, rRing);
1735 
1736  id_Delete(&idTemp, rRing);
1737 
1738  return(idResult);
1739 }
ideal id_Transp(ideal a, const ring rRing)
transpose a module
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:586
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
#define M
Definition: sirandom.c:24
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
#define assume(x)
Definition: mod2.h:394
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ idAdd()

ideal idAdd ( ideal  h1,
ideal  h2 
)
inline

h1 + h2

Definition at line 68 of file ideals.h.

69 {
70  return id_Add(h1, h2, currRing);
71 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2

◆ idCoeffOfKBase()

matrix idCoeffOfKBase ( ideal  arg,
ideal  kbase,
poly  how 
)

Definition at line 2283 of file ideals.cc.

2284 {
2285  matrix result;
2286  ideal tempKbase;
2287  poly p,q;
2288  intvec * convert;
2289  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2290 #if 0
2291  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2292  if (idIs0(arg))
2293  return mpNew(i,1);
2294  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2295  result = mpNew(i,j);
2296 #else
2297  result = mpNew(i, j);
2298  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2299 #endif
2300 
2301  tempKbase = idCreateSpecialKbase(kbase,&convert);
2302  for (k=0;k<j;k++)
2303  {
2304  p = arg->m[k];
2305  while (p!=NULL)
2306  {
2307  q = idDecompose(p,how,tempKbase,&pos);
2308  if (pos>=0)
2309  {
2310  MATELEM(result,(*convert)[pos],k+1) =
2311  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2312  }
2313  else
2314  p_Delete(&q,currRing);
2315  pIter(p);
2316  }
2317  }
2318  idDelete(&tempKbase);
2319  return result;
2320 }
#define pAdd(p, q)
Definition: polys.h:186
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2251
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2197
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29

◆ idCopy()

ideal idCopy ( ideal  A)
inline

Definition at line 60 of file ideals.h.

61 {
62  return id_Copy(A, currRing);
63 }
ideal id_Copy(ideal h1, const ring r)
copy an ideal
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define A
Definition: sirandom.c:23

◆ idCopyFirstK()

static ideal idCopyFirstK ( const ideal  ide,
const int  k 
)
inlinestatic

Definition at line 20 of file ideals.h.

21 {
22  return id_CopyFirstK(ide, k, currRing);
23 }
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
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
copies the first k (>= 1) entries of the given ideal/module and returns these as a new ideal/module (...

◆ idDelEquals()

void idDelEquals ( ideal  id)

Definition at line 2618 of file ideals.cc.

2619 {
2620  int idsize = IDELEMS(id);
2621  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
2622  for (int i = 0; i < idsize; i++)
2623  {
2624  id_sort[i].p = id->m[i];
2625  id_sort[i].index = i;
2626  }
2627  idSort_qsort(id_sort, idsize);
2628  int index, index_i, index_j;
2629  int i = 0;
2630  for (int j = 1; j < idsize; j++)
2631  {
2632  if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
2633  {
2634  index_i = id_sort[i].index;
2635  index_j = id_sort[j].index;
2636  if (index_j > index_i)
2637  {
2638  index = index_j;
2639  }
2640  else
2641  {
2642  index = index_i;
2643  i = j;
2644  }
2645  pDelete(&id->m[index]);
2646  }
2647  else
2648  {
2649  i = j;
2650  }
2651  }
2652  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
2653 }
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
#define pEqualPolys(p1, p2)
Definition: polys.h:383
int index
Definition: ideals.cc:2601
int j
Definition: myNF.cc:70
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2609
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
poly p
Definition: ideals.cc:2600
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ idDiff()

matrix idDiff ( matrix  i,
int  k 
)

Definition at line 1953 of file ideals.cc.

1954 {
1955  int e=MATCOLS(i)*MATROWS(i);
1957  r->rank=i->rank;
1958  int j;
1959  for(j=0; j<e; j++)
1960  {
1961  r->m[j]=pDiff(i->m[j],k);
1962  }
1963  return r;
1964 }
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
#define MATCOLS(i)
Definition: matpol.h:28
#define pDiff(a, b)
Definition: polys.h:278
#define MATROWS(i)
Definition: matpol.h:27

◆ idDiffOp()

matrix idDiffOp ( ideal  I,
ideal  J,
BOOLEAN  multiply = TRUE 
)

Definition at line 1966 of file ideals.cc.

1967 {
1968  matrix r=mpNew(IDELEMS(I),IDELEMS(J));
1969  int i,j;
1970  for(i=0; i<IDELEMS(I); i++)
1971  {
1972  for(j=0; j<IDELEMS(J); j++)
1973  {
1974  MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
1975  }
1976  }
1977  return r;
1978 }
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
#define pDiffOp(a, b, m)
Definition: polys.h:279
#define MATELEM(mat, i, j)
Definition: matpol.h:29

◆ idElimination()

ideal idElimination ( ideal  h1,
poly  delVar,
intvec hilb = NULL 
)

Definition at line 1402 of file ideals.cc.

1403 {
1404  int i,j=0,k,l;
1405  ideal h,hh, h3;
1406  rRingOrder_t *ord;
1407  int *block0,*block1;
1408  int ordersize=2;
1409  int **wv;
1410  tHomog hom;
1411  intvec * w;
1412  ring tmpR;
1413  ring origR = currRing;
1414 
1415  if (delVar==NULL)
1416  {
1417  return idCopy(h1);
1418  }
1419  if ((currRing->qideal!=NULL) && rIsPluralRing(origR))
1420  {
1421  WerrorS("cannot eliminate in a qring");
1422  return NULL;
1423  }
1424  if (idIs0(h1)) return idInit(1,h1->rank);
1425 #ifdef HAVE_PLURAL
1426  if (rIsPluralRing(origR))
1427  /* in the NC case, we have to check the admissibility of */
1428  /* the subalgebra to be intersected with */
1429  {
1430  if ((ncRingType(origR) != nc_skew) && (ncRingType(origR) != nc_exterior)) /* in (quasi)-commutative algebras every subalgebra is admissible */
1431  {
1432  if (nc_CheckSubalgebra(delVar,origR))
1433  {
1434  WerrorS("no elimination is possible: subalgebra is not admissible");
1435  return NULL;
1436  }
1437  }
1438  }
1439 #endif
1440  hom=(tHomog)idHomModule(h1,NULL,&w); //sets w to weight vector or NULL
1441  h3=idInit(16,h1->rank);
1442  for (k=0;; k++)
1443  {
1444  if (origR->order[k]!=0) ordersize++;
1445  else break;
1446  }
1447 #if 0
1448  if (rIsPluralRing(origR)) // we have too keep the odering: it may be needed
1449  // for G-algebra
1450  {
1451  for (k=0;k<ordersize-1; k++)
1452  {
1453  block0[k+1] = origR->block0[k];
1454  block1[k+1] = origR->block1[k];
1455  ord[k+1] = origR->order[k];
1456  if (origR->wvhdl[k]!=NULL) wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1457  }
1458  }
1459  else
1460  {
1461  block0[1] = 1;
1462  block1[1] = (currRing->N);
1463  if (origR->OrdSgn==1) ord[1] = ringorder_wp;
1464  else ord[1] = ringorder_ws;
1465  wv[1]=(int*)omAlloc0((currRing->N)*sizeof(int));
1466  double wNsqr = (double)2.0 / (double)(currRing->N);
1468  int *x= (int * )omAlloc(2 * ((currRing->N) + 1) * sizeof(int));
1469  int sl=IDELEMS(h1) - 1;
1470  wCall(h1->m, sl, x, wNsqr);
1471  for (sl = (currRing->N); sl!=0; sl--)
1472  wv[1][sl-1] = x[sl + (currRing->N) + 1];
1473  omFreeSize((ADDRESS)x, 2 * ((currRing->N) + 1) * sizeof(int));
1474 
1475  ord[2]=ringorder_C;
1476  ord[3]=0;
1477  }
1478 #else
1479 #endif
1480  if ((hom==TRUE) && (origR->OrdSgn==1) && (!rIsPluralRing(origR)))
1481  {
1482  #if 1
1483  // we change to an ordering:
1484  // aa(1,1,1,...,0,0,0),wp(...),C
1485  // this seems to be better than version 2 below,
1486  // according to Tst/../elimiate_[3568].tat (- 17 %)
1487  ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
1488  block0=(int*)omAlloc0(4*sizeof(int));
1489  block1=(int*)omAlloc0(4*sizeof(int));
1490  wv=(int**) omAlloc0(4*sizeof(int**));
1491  block0[0] = block0[1] = 1;
1492  block1[0] = block1[1] = rVar(origR);
1493  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1494  // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1495  // ignore it
1496  ord[0] = ringorder_aa;
1497  for (j=0;j<rVar(origR);j++)
1498  if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1499  BOOLEAN wp=FALSE;
1500  for (j=0;j<rVar(origR);j++)
1501  if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; }
1502  if (wp)
1503  {
1504  wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1505  for (j=0;j<rVar(origR);j++)
1506  wv[1][j]=p_Weight(j+1,origR);
1507  ord[1] = ringorder_wp;
1508  }
1509  else
1510  ord[1] = ringorder_dp;
1511  #else
1512  // we change to an ordering:
1513  // a(w1,...wn),wp(1,...0.....),C
1514  ord=(int*)omAlloc0(4*sizeof(int));
1515  block0=(int*)omAlloc0(4*sizeof(int));
1516  block1=(int*)omAlloc0(4*sizeof(int));
1517  wv=(int**) omAlloc0(4*sizeof(int**));
1518  block0[0] = block0[1] = 1;
1519  block1[0] = block1[1] = rVar(origR);
1520  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1521  wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1522  ord[0] = ringorder_a;
1523  for (j=0;j<rVar(origR);j++)
1524  wv[0][j]=pWeight(j+1,origR);
1525  ord[1] = ringorder_wp;
1526  for (j=0;j<rVar(origR);j++)
1527  if (pGetExp(delVar,j+1)!=0) wv[1][j]=1;
1528  #endif
1529  ord[2] = ringorder_C;
1530  ord[3] = (rRingOrder_t)0;
1531  }
1532  else
1533  {
1534  // we change to an ordering:
1535  // aa(....),orig_ordering
1536  ord=(rRingOrder_t*)omAlloc0(ordersize*sizeof(rRingOrder_t));
1537  block0=(int*)omAlloc0(ordersize*sizeof(int));
1538  block1=(int*)omAlloc0(ordersize*sizeof(int));
1539  wv=(int**) omAlloc0(ordersize*sizeof(int**));
1540  for (k=0;k<ordersize-1; k++)
1541  {
1542  block0[k+1] = origR->block0[k];
1543  block1[k+1] = origR->block1[k];
1544  ord[k+1] = origR->order[k];
1545  if (origR->wvhdl[k]!=NULL) wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1546  }
1547  block0[0] = 1;
1548  block1[0] = rVar(origR);
1549  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1550  for (j=0;j<rVar(origR);j++)
1551  if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1552  // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1553  // ignore it
1554  ord[0] = ringorder_aa;
1555  }
1556  // fill in tmp ring to get back the data later on
1557  tmpR = rCopy0(origR,FALSE,FALSE); // qring==NULL
1558  //rUnComplete(tmpR);
1559  tmpR->p_Procs=NULL;
1560  tmpR->order = ord;
1561  tmpR->block0 = block0;
1562  tmpR->block1 = block1;
1563  tmpR->wvhdl = wv;
1564  rComplete(tmpR, 1);
1565 
1566 #ifdef HAVE_PLURAL
1567  /* update nc structure on tmpR */
1568  if (rIsPluralRing(origR))
1569  {
1570  if ( nc_rComplete(origR, tmpR, false) ) // no quotient ideal!
1571  {
1572  WerrorS("no elimination is possible: ordering condition is violated");
1573  // cleanup
1574  rDelete(tmpR);
1575  if (w!=NULL)
1576  delete w;
1577  return NULL;
1578  }
1579  }
1580 #endif
1581  // change into the new ring
1582  //pChangeRing((currRing->N),currRing->OrdSgn,ord,block0,block1,wv);
1583  rChangeCurrRing(tmpR);
1584 
1585  //h = idInit(IDELEMS(h1),h1->rank);
1586  // fetch data from the old ring
1587  //for (k=0;k<IDELEMS(h1);k++) h->m[k] = prCopyR( h1->m[k], origR);
1588  h=idrCopyR(h1,origR,currRing);
1589  if (origR->qideal!=NULL)
1590  {
1591  WarnS("eliminate in q-ring: experimental");
1592  ideal q=idrCopyR(origR->qideal,origR,currRing);
1593  ideal s=idSimpleAdd(h,q);
1594  idDelete(&h);
1595  idDelete(&q);
1596  h=s;
1597  }
1598  // compute kStd
1599 #if 1
1600  //rWrite(tmpR);PrintLn();
1601  //BITSET save1;
1602  //SI_SAVE_OPT1(save1);
1603  //si_opt_1 |=1;
1604  //Print("h: %d gen, rk=%d\n",IDELEMS(h),h->rank);
1605  //extern char * showOption();
1606  //Print("%s\n",showOption());
1607  hh = kStd(h,NULL,hom,&w,hilb);
1608  //SI_RESTORE_OPT1(save1);
1609  idDelete(&h);
1610 #else
1611  extern ideal kGroebner(ideal F, ideal Q);
1612  hh=kGroebner(h,NULL);
1613 #endif
1614  // go back to the original ring
1615  rChangeCurrRing(origR);
1616  i = IDELEMS(hh)-1;
1617  while ((i >= 0) && (hh->m[i] == NULL)) i--;
1618  j = -1;
1619  // fetch data from temp ring
1620  for (k=0; k<=i; k++)
1621  {
1622  l=(currRing->N);
1623  while ((l>0) && (p_GetExp( hh->m[k],l,tmpR)*pGetExp(delVar,l)==0)) l--;
1624  if (l==0)
1625  {
1626  j++;
1627  if (j >= IDELEMS(h3))
1628  {
1629  pEnlargeSet(&(h3->m),IDELEMS(h3),16);
1630  IDELEMS(h3) += 16;
1631  }
1632  h3->m[j] = prMoveR( hh->m[k], tmpR,origR);
1633  hh->m[k] = NULL;
1634  }
1635  }
1636  id_Delete(&hh, tmpR);
1637  idSkipZeroes(h3);
1638  rDelete(tmpR);
1639  if (w!=NULL)
1640  delete w;
1641  return h3;
1642 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:99
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omMemDup(s)
Definition: omAllocDecl.h:264
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5533
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define idSimpleAdd(A, B)
Definition: ideals.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
void * ADDRESS
Definition: auxiliary.h:115
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
int p_Weight(int i, const ring r)
Definition: p_polys.cc:706
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
Definition: intvec.h:14
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3365
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:28
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1325
rRingOrder_t
order stuff
Definition: ring.h:75
int i
Definition: cfEzgcd.cc:123
Definition: nc.h:24
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rChangeCurrRing(ring r)
Definition: polys.cc:12
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
Definition: nc.h:29
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:116
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
Variable x
Definition: cfModGcd.cc:4023
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r)
Definition: old.gring.cc:2579
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal kGroebner(ideal F, ideal Q)
Definition: ipshell.cc:6147
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:78
#define pWeight(i)
Definition: polys.h:262

◆ idFreeModule()

ideal idFreeModule ( int  i)
inline

Definition at line 111 of file ideals.h.

112 {
113  return id_FreeModule (i, currRing);
114 }
ideal id_FreeModule(int i, const ring r)
the free module of rank i
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ idGetNextChoise()

void idGetNextChoise ( int  r,
int  end,
BOOLEAN endch,
int *  choise 
)

Definition at line 853 of file simpleideals.cc.

854 {
855  int i = r-1,j;
856  while ((i >= 0) && (choise[i] == end))
857  {
858  i--;
859  end--;
860  }
861  if (i == -1)
862  *endch = TRUE;
863  else
864  {
865  choise[i]++;
866  for (j=i+1; j<r; j++)
867  {
868  choise[j] = choise[i]+j-i;
869  }
870  *endch = FALSE;
871  }
872 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123

◆ idGetNumberOfChoise()

int idGetNumberOfChoise ( int  t,
int  d,
int  begin,
int  end,
int *  choise 
)

Definition at line 879 of file simpleideals.cc.

880 {
881  int * localchoise,i,result=0;
882  BOOLEAN b=FALSE;
883 
884  if (d<=1) return 1;
885  localchoise=(int*)omAlloc((d-1)*sizeof(int));
886  idInitChoise(d-1,begin,end,&b,localchoise);
887  while (!b)
888  {
889  result++;
890  i = 0;
891  while ((i<t) && (localchoise[i]==choise[i])) i++;
892  if (i>=t)
893  {
894  i = t+1;
895  while ((i<d) && (localchoise[i-1]==choise[i])) i++;
896  if (i>=d)
897  {
898  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
899  return result;
900  }
901  }
902  idGetNextChoise(d-1,end,&b,localchoise);
903  }
904  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
905  return 0;
906 }
#define FALSE
Definition: auxiliary.h:94
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
#define omAlloc(size)
Definition: omAllocDecl.h:210
int i
Definition: cfEzgcd.cc:123
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76

◆ idHead()

ideal idHead ( ideal  h)

◆ idHomIdeal()

static BOOLEAN idHomIdeal ( ideal  id,
ideal  Q = NULL 
)
inlinestatic

Definition at line 91 of file ideals.h.

92 {
93  return id_HomIdeal(id, Q, currRing);
94 }
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ idHomModule()

static BOOLEAN idHomModule ( ideal  m,
ideal  Q,
intvec **  w 
)
inlinestatic

Definition at line 96 of file ideals.h.

97 {
98  return id_HomModule(m, Q, w, currRing);
99 }
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int m
Definition: cfEzgcd.cc:119
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ idInitChoise()

void idInitChoise ( int  r,
int  beg,
int  end,
BOOLEAN endch,
int *  choise 
)

Definition at line 831 of file simpleideals.cc.

832 {
833  /*returns the first choise of r numbers between beg and end*/
834  int i;
835  for (i=0; i<r; i++)
836  {
837  choise[i] = 0;
838  }
839  if (r <= end-beg+1)
840  for (i=0; i<r; i++)
841  {
842  choise[i] = beg+i;
843  }
844  if (r > end-beg+1)
845  *endch = TRUE;
846  else
847  *endch = FALSE;
848 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123

◆ idInsertPoly()

BOOLEAN idInsertPoly ( ideal  h1,
poly  h2 
)

insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted

Definition at line 638 of file simpleideals.cc.

639 {
640  if (h2==NULL) return FALSE;
641  assume (h1 != NULL);
642 
643  int j = IDELEMS(h1) - 1;
644 
645  while ((j >= 0) && (h1->m[j] == NULL)) j--;
646  j++;
647  if (j==IDELEMS(h1))
648  {
649  pEnlargeSet(&(h1->m),IDELEMS(h1),16);
650  IDELEMS(h1)+=16;
651  }
652  h1->m[j]=h2;
653  return TRUE;
654 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602

◆ idInsertPolyOnPos()

BOOLEAN idInsertPolyOnPos ( ideal  I,
poly  p,
int  pos 
)

insert p into I on position pos

Definition at line 657 of file simpleideals.cc.

658 {
659  if (p==NULL) return FALSE;
660  assume (I != NULL);
661 
662  int j = IDELEMS(I) - 1;
663 
664  while ((j >= 0) && (I->m[j] == NULL)) j--;
665  j++;
666  if (j==IDELEMS(I))
667  {
668  pEnlargeSet(&(I->m),IDELEMS(I),IDELEMS(I)+1);
669  IDELEMS(I)+=1;
670  }
671  for(j = IDELEMS(I)-1;j>pos;j--)
672  I->m[j] = I->m[j-1];
673  I->m[pos]=p;
674  return TRUE;
675 }
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602

◆ idInsertPolyWithTests()

BOOLEAN idInsertPolyWithTests ( ideal  h1,
const int  validEntries,
const poly  h2,
const bool  zeroOk,
const bool  duplicateOk 
)
inline

Definition at line 75 of file ideals.h.

76 {
77  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);
78 }
BOOLEAN id_InsertPolyWithTests(ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring r)
insert h2 into h1 depending on the two boolean parameters:
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ idIs0()

BOOLEAN idIs0 ( ideal  h)

returns true if h is the zero ideal

Definition at line 766 of file simpleideals.cc.

767 {
768  assume (h != NULL); // will fail :(
769 // if (h == NULL) return TRUE;
770 
771  for( int i = IDELEMS(h)-1; i >= 0; i-- )
772  if(h->m[i] != NULL)
773  return FALSE;
774 
775  return TRUE;
776 
777 }
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978

◆ idIsSubModule()

BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 1863 of file ideals.cc.

1864 {
1865  int i;
1866  poly p;
1867 
1868  if (idIs0(id1)) return TRUE;
1869  for (i=0;i<IDELEMS(id1);i++)
1870  {
1871  if (id1->m[i] != NULL)
1872  {
1873  p = kNF(id2,currRing->qideal,id1->m[i]);
1874  if (p != NULL)
1875  {
1876  p_Delete(&p,currRing);
1877  return FALSE;
1878  }
1879  }
1880  }
1881  return TRUE;
1882 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ idIsZeroDim()

static BOOLEAN idIsZeroDim ( ideal  i)
inlinestatic

Definition at line 177 of file ideals.h.

178 {
179  return id_IsZeroDim(i, currRing);
180 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
BOOLEAN id_IsZeroDim(ideal I, const ring r)

◆ idKeepFirstK()

void idKeepFirstK ( ideal  ide,
const int  k 
)

keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)

Definition at line 2586 of file ideals.cc.

2587 {
2588  for (int i = IDELEMS(id)-1; i >= k; i--)
2589  {
2590  if (id->m[i] != NULL) pDelete(&id->m[i]);
2591  }
2592  int kk=k;
2593  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2594  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2595  IDELEMS(id) = kk;
2596 }
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
#define pDelete(p_ptr)
Definition: polys.h:169

◆ idLift()

ideal idLift ( ideal  mod,
ideal  sumod,
ideal *  rest = NULL,
BOOLEAN  goodShape = FALSE,
BOOLEAN  isSB = TRUE,
BOOLEAN  divide = FALSE,
matrix unit = NULL,
GbVariant  a = GbDefault 
)

Definition at line 938 of file ideals.cc.

940 {
941  int lsmod =id_RankFreeModule(submod,currRing), j, k;
942  int comps_to_add=0;
943  poly p;
944 
945  if (idIs0(submod))
946  {
947  if (unit!=NULL)
948  {
949  *unit=mpNew(1,1);
950  MATELEM(*unit,1,1)=pOne();
951  }
952  if (rest!=NULL)
953  {
954  *rest=idInit(1,mod->rank);
955  }
956  return idInit(1,mod->rank);
957  }
958  if (idIs0(mod)) /* and not idIs0(submod) */
959  {
960  WerrorS("2nd module does not lie in the first");
961  return NULL;
962  }
963  if (unit!=NULL)
964  {
965  comps_to_add = IDELEMS(submod);
966  while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
967  comps_to_add--;
968  }
970  if ((k!=0) && (lsmod==0)) lsmod=1;
971  k=si_max(k,(int)mod->rank);
972  if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
973 
974  ring orig_ring=currRing;
975  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
976  rSetSyzComp(k,syz_ring);
977  rChangeCurrRing(syz_ring);
978 
979  ideal s_mod, s_temp;
980  if (orig_ring != syz_ring)
981  {
982  s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
983  s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
984  }
985  else
986  {
987  s_mod = mod;
988  s_temp = idCopy(submod);
989  }
990  ideal s_h3;
991  if (isSB)
992  {
993  s_h3 = idCopy(s_mod);
994  idPrepareStd(s_h3, k+comps_to_add);
995  }
996  else
997  {
998  s_h3 = idPrepare(s_mod,(tHomog)FALSE,k+comps_to_add,NULL,alg);
999  }
1000  if (!goodShape)
1001  {
1002  for (j=0;j<IDELEMS(s_h3);j++)
1003  {
1004  if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
1005  p_Delete(&(s_h3->m[j]),currRing);
1006  }
1007  }
1008  idSkipZeroes(s_h3);
1009  if (lsmod==0)
1010  {
1011  id_Shift(s_temp,1,currRing);
1012  }
1013  if (unit!=NULL)
1014  {
1015  for(j = 0;j<comps_to_add;j++)
1016  {
1017  p = s_temp->m[j];
1018  if (p!=NULL)
1019  {
1020  while (pNext(p)!=NULL) pIter(p);
1021  pNext(p) = pOne();
1022  pIter(p);
1023  pSetComp(p,1+j+k);
1024  pSetmComp(p);
1025  p = pNeg(p);
1026  }
1027  }
1028  s_temp->rank += (k+comps_to_add);
1029  }
1030  ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1031  s_result->rank = s_h3->rank;
1032  ideal s_rest = idInit(IDELEMS(s_result),k);
1033  idDelete(&s_h3);
1034  idDelete(&s_temp);
1035 
1036  for (j=0;j<IDELEMS(s_result);j++)
1037  {
1038  if (s_result->m[j]!=NULL)
1039  {
1040  if (pGetComp(s_result->m[j])<=k)
1041  {
1042  if (!divide)
1043  {
1044  if (isSB)
1045  {
1046  WarnS("first module not a standardbasis\n"
1047  "// ** or second not a proper submodule");
1048  }
1049  else
1050  WerrorS("2nd module does not lie in the first");
1051  idDelete(&s_result);
1052  idDelete(&s_rest);
1053  s_result=idInit(IDELEMS(submod),submod->rank);
1054  break;
1055  }
1056  else
1057  {
1058  p = s_rest->m[j] = s_result->m[j];
1059  while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1060  s_result->m[j] = pNext(p);
1061  pNext(p) = NULL;
1062  }
1063  }
1064  p_Shift(&(s_result->m[j]),-k,currRing);
1065  pNeg(s_result->m[j]);
1066  }
1067  }
1068  if ((lsmod==0) && (s_rest!=NULL))
1069  {
1070  for (j=IDELEMS(s_rest);j>0;j--)
1071  {
1072  if (s_rest->m[j-1]!=NULL)
1073  {
1074  p_Shift(&(s_rest->m[j-1]),-1,currRing);
1075  s_rest->m[j-1] = s_rest->m[j-1];
1076  }
1077  }
1078  }
1079  if(syz_ring!=orig_ring)
1080  {
1081  idDelete(&s_mod);
1082  rChangeCurrRing(orig_ring);
1083  s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1084  s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1085  rDelete(syz_ring);
1086  }
1087  if (rest!=NULL)
1088  *rest = s_rest;
1089  else
1090  idDelete(&s_rest);
1091 //idPrint(s_result);
1092  if (unit!=NULL)
1093  {
1094  *unit=mpNew(comps_to_add,comps_to_add);
1095  int i;
1096  for(i=0;i<IDELEMS(s_result);i++)
1097  {
1098  poly p=s_result->m[i];
1099  poly q=NULL;
1100  while(p!=NULL)
1101  {
1102  if(pGetComp(p)<=comps_to_add)
1103  {
1104  pSetComp(p,0);
1105  if (q!=NULL)
1106  {
1107  pNext(q)=pNext(p);
1108  }
1109  else
1110  {
1111  pIter(s_result->m[i]);
1112  }
1113  pNext(p)=NULL;
1114  MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1115  if(q!=NULL) p=pNext(q);
1116  else p=s_result->m[i];
1117  }
1118  else
1119  {
1120  q=p;
1121  pIter(p);
1122  }
1123  }
1124  p_Shift(&s_result->m[i],-comps_to_add,currRing);
1125  }
1126  }
1127  return s_result;
1128 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition: ideals.cc:460
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:904
#define pAdd(p, q)
Definition: polys.h:186
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:181
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
#define pMinComp(p)
Definition: polys.h:282
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void id_Shift(ideal M, int s, const ring r)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define MATELEM(mat, i, j)
Definition: matpol.h:29

◆ idLiftStd()

ideal idLiftStd ( ideal  h1,
matrix m,
tHomog  h = testHomog,
ideal *  syz = NULL,
GbVariant  a = GbDefault 
)

Definition at line 750 of file ideals.cc.

751 {
752  int i, j, t, inputIsIdeal=id_RankFreeModule(h1,currRing);
753  long k;
754  poly p=NULL, q;
755  intvec *w=NULL;
756 
757  idDelete((ideal*)ma);
758  BOOLEAN lift3=FALSE;
759  if (syz!=NULL) { lift3=TRUE; idDelete(syz); }
760  if (idIs0(h1))
761  {
762  *ma=mpNew(1,0);
763  if (lift3)
764  {
765  *syz=idFreeModule(IDELEMS(h1));
766  }
767  return idInit(1,h1->rank);
768  }
769 
770  BITSET save2;
771  SI_SAVE_OPT2(save2);
772 
774 
775  if ((k==1) && (!lift3)) si_opt_2 |=Sy_bit(V_IDLIFT);
776 
777  ring orig_ring = currRing;
778  ring syz_ring = rAssure_SyzOrder(orig_ring,TRUE);
779  rSetSyzComp(k,syz_ring);
780  rChangeCurrRing(syz_ring);
781 
782  ideal s_h1=h1;
783 
784  if (orig_ring != syz_ring)
785  s_h1 = idrCopyR_NoSort(h1,orig_ring,syz_ring);
786  else
787  s_h1 = h1;
788 
789  ideal s_h3=idPrepare(s_h1,hi,k,&w,alg); // main (syz) GB computation
790 
791  ideal s_h2 = idInit(IDELEMS(s_h3), s_h3->rank);
792 
793  if (lift3) (*syz)=idInit(IDELEMS(s_h3),IDELEMS(h1));
794 
795  if (w!=NULL) delete w;
796  i = 0;
797 
798  // now sort the result, SB : leave in s_h3
799  // T: put in s_h2
800  // syz: put in *syz
801  for (j=0; j<IDELEMS(s_h3); j++)
802  {
803  if (s_h3->m[j] != NULL)
804  {
805  //if (p_MinComp(s_h3->m[j],syz_ring) <= k)
806  if (pGetComp(s_h3->m[j]) <= k) // syz_ring == currRing
807  {
808  i++;
809  q = s_h3->m[j];
810  while (pNext(q) != NULL)
811  {
812  if (pGetComp(pNext(q)) > k)
813  {
814  s_h2->m[j] = pNext(q);
815  pNext(q) = NULL;
816  }
817  else
818  {
819  pIter(q);
820  }
821  }
822  if (!inputIsIdeal) p_Shift(&(s_h3->m[j]), -1,currRing);
823  }
824  else
825  {
826  // we a syzygy here:
827  if (lift3)
828  {
829  p_Shift(&s_h3->m[j], -k,currRing);
830  (*syz)->m[j]=s_h3->m[j];
831  s_h3->m[j]=NULL;
832  }
833  else
834  p_Delete(&(s_h3->m[j]),currRing);
835  }
836  }
837  }
838  idSkipZeroes(s_h3);
839  //extern char * iiStringMatrix(matrix im, int dim,char ch);
840  //PrintS("SB: ----------------------------------------\n");
841  //PrintS(iiStringMatrix((matrix)s_h3,k,'\n'));
842  //PrintLn();
843  //PrintS("T: ----------------------------------------\n");
844  //PrintS(iiStringMatrix((matrix)s_h2,h1->rank,'\n'));
845  //PrintLn();
846 
847  if (lift3) idSkipZeroes(*syz);
848 
849  j = IDELEMS(s_h1);
850 
851 
852  if (syz_ring!=orig_ring)
853  {
854  idDelete(&s_h1);
855  rChangeCurrRing(orig_ring);
856  }
857 
858  *ma = mpNew(j,i);
859 
860  i = 1;
861  for (j=0; j<IDELEMS(s_h2); j++)
862  {
863  if (s_h2->m[j] != NULL)
864  {
865  q = prMoveR( s_h2->m[j], syz_ring,orig_ring);
866  s_h2->m[j] = NULL;
867 
868  if (q!=NULL)
869  {
870  q=pReverse(q);
871  while (q != NULL)
872  {
873  p = q;
874  pIter(q);
875  pNext(p) = NULL;
876  t=pGetComp(p);
877  pSetComp(p,0);
878  pSetmComp(p);
879  MATELEM(*ma,t-k,i) = pAdd(MATELEM(*ma,t-k,i),p);
880  }
881  }
882  i++;
883  }
884  }
885  idDelete(&s_h2);
886 
887  for (i=0; i<IDELEMS(s_h3); i++)
888  {
889  s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], syz_ring,orig_ring);
890  }
891  if (lift3)
892  {
893  for (i=0; i<IDELEMS(*syz); i++)
894  {
895  (*syz)->m[i] = prMoveR_NoSort((*syz)->m[i], syz_ring,orig_ring);
896  }
897  }
898 
899  if (syz_ring!=orig_ring) rDelete(syz_ring);
900  SI_RESTORE_OPT2(save2);
901  return s_h3;
902 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition: ideals.cc:460
#define pAdd(p, q)
Definition: polys.h:186
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
int k
Definition: cfEzgcd.cc:93
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
ideal idFreeModule(int i)
Definition: ideals.h:111
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static poly pReverse(poly p)
Definition: p_polys.h:330
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define SI_RESTORE_OPT2(A)
Definition: options.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
poly prMoveR_NoSort(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:102
polyrec * poly
Definition: hilb.h:10
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
#define V_IDLIFT
Definition: options.h:60
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define SI_SAVE_OPT2(A)
Definition: options.h:21

◆ idLiftW()

void idLiftW ( ideal  P,
ideal  Q,
int  n,
matrix T,
ideal &  R,
short *  w = NULL 
)

Definition at line 1134 of file ideals.cc.

1135 {
1136  long N=0;
1137  int i;
1138  for(i=IDELEMS(Q)-1;i>=0;i--)
1139  if(w==NULL)
1140  N=si_max(N,p_Deg(Q->m[i],currRing));
1141  else
1142  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1143  N+=n;
1144 
1145  T=mpNew(IDELEMS(Q),IDELEMS(P));
1146  R=idInit(IDELEMS(P),P->rank);
1147 
1148  for(i=IDELEMS(P)-1;i>=0;i--)
1149  {
1150  poly p;
1151  if(w==NULL)
1152  p=ppJet(P->m[i],N);
1153  else
1154  p=ppJetW(P->m[i],N,w);
1155 
1156  int j=IDELEMS(Q)-1;
1157  while(p!=NULL)
1158  {
1159  if(pDivisibleBy(Q->m[j],p))
1160  {
1161  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1162  if(w==NULL)
1163  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1164  else
1165  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1166  pNormalize(p);
1167  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1168  p_Delete(&p0,currRing);
1169  else
1170  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1171  j=IDELEMS(Q)-1;
1172  }
1173  else
1174  {
1175  if(j==0)
1176  {
1177  poly p0=p;
1178  pIter(p);
1179  pNext(p0)=NULL;
1180  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1181  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1182  p_Delete(&p0,currRing);
1183  else
1184  R->m[i]=pAdd(R->m[i],p0);
1185  j=IDELEMS(Q)-1;
1186  }
1187  else
1188  j--;
1189  }
1190  }
1191  }
1192 }
#define pAdd(p, q)
Definition: polys.h:186
#define ppJet(p, m)
Definition: polys.h:349
return P p
Definition: myNF.cc:203
#define ppMult_mm(p, m)
Definition: polys.h:184
#define Q
Definition: sirandom.c:25
#define pJetW(p, m, iv)
Definition: polys.h:352
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:691
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
#define pSub(a, b)
Definition: polys.h:269
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
pNormalize(P.p)
const ring R
Definition: DebugPrint.cc:36
#define pJet(p, m)
Definition: polys.h:350
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
poly p_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1549
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
kBucketDestroy & P
Definition: myNF.cc:191
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
#define ppJetW(p, m, iv)
Definition: polys.h:351
#define MATELEM(mat, i, j)
Definition: matpol.h:29

◆ idMinBase()

ideal idMinBase ( ideal  h1)

Definition at line 48 of file ideals.cc.

49 {
50  ideal h2, h3,h4,e;
51  int j,k;
52  int i,l,ll;
53  intvec * wth;
54  BOOLEAN homog;
56  {
57  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
58  e=idCopy(h1);
59  return e;
60  }
61  homog = idHomModule(h1,currRing->qideal,&wth);
63  {
64  if(!homog)
65  {
66  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
67  e=idCopy(h1);
68  return e;
69  }
70  else
71  {
72  ideal re=kMin_std(h1,currRing->qideal,(tHomog)homog,&wth,h2,NULL,0,3);
73  idDelete(&re);
74  return h2;
75  }
76  }
77  e=idInit(1,h1->rank);
78  if (idIs0(h1))
79  {
80  return e;
81  }
82  pEnlargeSet(&(e->m),IDELEMS(e),15);
83  IDELEMS(e) = 16;
84  h2 = kStd(h1,currRing->qideal,isNotHomog,NULL);
85  h3 = idMaxIdeal(1);
86  h4=idMult(h2,h3);
87  idDelete(&h3);
88  h3=kStd(h4,currRing->qideal,isNotHomog,NULL);
89  k = IDELEMS(h3);
90  while ((k > 0) && (h3->m[k-1] == NULL)) k--;
91  j = -1;
92  l = IDELEMS(h2);
93  while ((l > 0) && (h2->m[l-1] == NULL)) l--;
94  for (i=l-1; i>=0; i--)
95  {
96  if (h2->m[i] != NULL)
97  {
98  ll = 0;
99  while ((ll < k) && ((h3->m[ll] == NULL)
100  || !pDivisibleBy(h3->m[ll],h2->m[i])))
101  ll++;
102  if (ll >= k)
103  {
104  j++;
105  if (j > IDELEMS(e)-1)
106  {
107  pEnlargeSet(&(e->m),IDELEMS(e),16);
108  IDELEMS(e) += 16;
109  }
110  e->m[j] = pCopy(h2->m[i]);
111  }
112  }
113  }
114  idDelete(&h2);
115  idDelete(&h3);
116  idDelete(&h4);
117  if (currRing->qideal!=NULL)
118  {
119  h3=idInit(1,e->rank);
120  h2=kNF(h3,currRing->qideal,e);
121  idDelete(&h3);
122  idDelete(&e);
123  e=h2;
124  }
125  idSkipZeroes(e);
126  return e;
127 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:33
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2822
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition: ideals.h:84
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ idMinEmbedding()

ideal idMinEmbedding ( ideal  arg,
BOOLEAN  inPlace = FALSE,
intvec **  w = NULL 
)

Definition at line 2349 of file ideals.cc.

2350 {
2351  if (idIs0(arg)) return idInit(1,arg->rank);
2352  int i,next_gen,next_comp;
2353  ideal res=arg;
2354  if (!inPlace) res = idCopy(arg);
2355  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2356  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2357  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2358 
2359  int del=0;
2360  loop
2361  {
2362  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2363  if (next_gen<0) break;
2364  del++;
2365  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2366  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2367  if ((w !=NULL)&&(*w!=NULL))
2368  {
2369  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2370  }
2371  }
2372 
2373  idDeleteComps(res,red_comp,del);
2374  idSkipZeroes(res);
2375  omFree(red_comp);
2376 
2377  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2378  {
2379  int nl=si_max((*w)->length()-del,1);
2380  intvec *wtmp=new intvec(nl);
2381  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2382  delete *w;
2383  *w=wtmp;
2384  }
2385  return res;
2386 }
loop
Definition: myNF.cc:98
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define omFree(addr)
Definition: omAllocDecl.h:261
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2322
const CanonicalForm & w
Definition: facAbsFact.cc:55
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ idMinors()

ideal idMinors ( matrix  a,
int  ar,
ideal  R = NULL 
)

compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL)

Definition at line 1794 of file ideals.cc.

1795 {
1796 
1797  const ring origR=currRing;
1798  id_Test((ideal)a, origR);
1799 
1800  const int r = a->nrows;
1801  const int c = a->ncols;
1802 
1803  if((ar<=0) || (ar>r) || (ar>c))
1804  {
1805  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
1806  return NULL;
1807  }
1808 
1809  ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
1810  long bound = sm_ExpBound(h,c,r,ar,origR);
1811  id_Delete(&h, origR);
1812 
1813  ring tmpR = sm_RingChange(origR,bound);
1814 
1815  matrix b = mpNew(r,c);
1816 
1817  for (int i=r*c-1;i>=0;i--)
1818  if (a->m[i] != NULL)
1819  b->m[i] = prCopyR(a->m[i],origR,tmpR);
1820 
1821  id_Test( (ideal)b, tmpR);
1822 
1823  if (R!=NULL)
1824  {
1825  R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
1826  //if (ar>1) // otherwise done in mpMinorToResult
1827  //{
1828  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
1829  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
1830  // idDelete((ideal*)&b); b=bb;
1831  //}
1832  id_Test( R, tmpR);
1833  }
1834 
1835 
1836  ideal result = idInit(32,1);
1837 
1838  int elems = 0;
1839 
1840  if(ar>1)
1841  mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
1842  else
1843  mp_MinorToResult(result,elems,b,r,c,R,tmpR);
1844 
1845  id_Test( (ideal)b, tmpR);
1846 
1847  id_Delete((ideal *)&b, tmpR);
1848 
1849  if (R!=NULL) id_Delete(&R,tmpR);
1850 
1852  rChangeCurrRing(origR);
1853  result = idrMoveR(result,tmpR,origR);
1854  sm_KillModifiedRing(tmpR);
1855  idTest(result);
1856  return result;
1857 }
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc:259
const poly a
Definition: syzextra.cc:212
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define id_Test(A, lR)
Definition: simpleideals.h:80
void mp_RecMin(int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
produces recursively the ideal of all arxar-minors of a
Definition: matpol.cc:1512
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
entries of a are minors and go to result (only if not in R)
Definition: matpol.cc:1416
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition: sparsmat.cc:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
const ring R
Definition: DebugPrint.cc:36
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:12
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void sm_KillModifiedRing(ring r)
Definition: sparsmat.cc:290
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:71
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
ideal id_Matrix2Module(matrix mat, const ring R)
void Werror(const char *fmt,...)
Definition: reporter.cc:189
return result
Definition: facAbsBiFact.cc:76
#define idTest(id)
Definition: ideals.h:47

◆ idModulo()

ideal idModulo ( ideal  h1,
ideal  h2,
tHomog  h = testHomog,
intvec **  w = NULL 
)

Definition at line 2038 of file ideals.cc.

2039 {
2040  intvec *wtmp=NULL;
2041 
2042  int i,k,rk,flength=0,slength,length;
2043  poly p,q;
2044 
2045  if (idIs0(h2))
2046  return idFreeModule(si_max(1,h2->ncols));
2047  if (!idIs0(h1))
2048  flength = id_RankFreeModule(h1,currRing);
2049  slength = id_RankFreeModule(h2,currRing);
2050  length = si_max(flength,slength);
2051  if (length==0)
2052  {
2053  length = 1;
2054  }
2055  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2056  if ((w!=NULL)&&((*w)!=NULL))
2057  {
2058  //Print("input weights:");(*w)->show(1);PrintLn();
2059  int d;
2060  int k;
2061  wtmp=new intvec(length+IDELEMS(h2));
2062  for (i=0;i<length;i++)
2063  ((*wtmp)[i])=(**w)[i];
2064  for (i=0;i<IDELEMS(h2);i++)
2065  {
2066  poly p=h2->m[i];
2067  if (p!=NULL)
2068  {
2069  d = p_Deg(p,currRing);
2070  k= pGetComp(p);
2071  if (slength>0) k--;
2072  d +=((**w)[k]);
2073  ((*wtmp)[i+length]) = d;
2074  }
2075  }
2076  //Print("weights:");wtmp->show(1);PrintLn();
2077  }
2078  for (i=0;i<IDELEMS(h2);i++)
2079  {
2080  temp->m[i] = pCopy(h2->m[i]);
2081  q = pOne();
2082  pSetComp(q,i+1+length);
2083  pSetmComp(q);
2084  if(temp->m[i]!=NULL)
2085  {
2086  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2087  p = temp->m[i];
2088  while (pNext(p)!=NULL) pIter(p);
2089  pNext(p) = q; // will be sorted later correctly
2090  }
2091  else
2092  temp->m[i]=q;
2093  }
2094  rk = k = IDELEMS(h2);
2095  if (!idIs0(h1))
2096  {
2097  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2098  IDELEMS(temp) += IDELEMS(h1);
2099  for (i=0;i<IDELEMS(h1);i++)
2100  {
2101  if (h1->m[i]!=NULL)
2102  {
2103  temp->m[k] = pCopy(h1->m[i]);
2104  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2105  k++;
2106  }
2107  }
2108  }
2109 
2110  ring orig_ring=currRing;
2111  ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE);
2112  rSetSyzComp(length,syz_ring);
2113  rChangeCurrRing(syz_ring);
2114  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2115  // therefore we disable OPT_RETURN_SB for modulo:
2116  // (see tr. #701)
2117  //if (TEST_OPT_RETURN_SB)
2118  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2119  //else
2120  // rSetSyzComp(length, syz_ring);
2121  ideal s_temp;
2122 
2123  if (syz_ring != orig_ring)
2124  {
2125  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2126  }
2127  else
2128  {
2129  s_temp = temp;
2130  }
2131 
2132  idTest(s_temp);
2133  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2134 
2135  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2136  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2137  {
2138  delete *w;
2139  *w=new intvec(IDELEMS(h2));
2140  for (i=0;i<IDELEMS(h2);i++)
2141  ((**w)[i])=(*wtmp)[i+length];
2142  }
2143  if (wtmp!=NULL) delete wtmp;
2144 
2145  for (i=0;i<IDELEMS(s_temp1);i++)
2146  {
2147  if ((s_temp1->m[i]!=NULL)
2148  && (((int)pGetComp(s_temp1->m[i]))<=length))
2149  {
2150  p_Delete(&(s_temp1->m[i]),currRing);
2151  }
2152  else
2153  {
2154  p_Shift(&(s_temp1->m[i]),-length,currRing);
2155  }
2156  }
2157  s_temp1->rank = rk;
2158  idSkipZeroes(s_temp1);
2159 
2160  if (syz_ring!=orig_ring)
2161  {
2162  rChangeCurrRing(orig_ring);
2163  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2164  rDelete(syz_ring);
2165  // Hmm ... here seems to be a memory leak
2166  // However, simply deleting it causes memory trouble
2167  // idDelete(&s_temp);
2168  }
2169  else
2170  {
2171  idDelete(&temp);
2172  }
2173  idTest(s_temp1);
2174  return s_temp1;
2175 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal idFreeModule(int i)
Definition: ideals.h:111
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3602
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define idTest(id)
Definition: ideals.h:47

◆ idMult()

static ideal idMult ( ideal  h1,
ideal  h2 
)
inlinestatic

hh := h1 * h2

Definition at line 84 of file ideals.h.

85 {
86  return id_Mult(h1, h2, currRing);
87 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...

◆ idMultSect()

ideal idMultSect ( resolvente  arg,
int  length 
)

Definition at line 344 of file ideals.cc.

345 {
346  int i,j=0,k=0,syzComp,l,maxrk=-1,realrki;
347  ideal bigmat,tempstd,result;
348  poly p;
349  int isIdeal=0;
350  intvec * w=NULL;
351 
352  /* find 0-ideals and max rank -----------------------------------*/
353  for (i=0;i<length;i++)
354  {
355  if (!idIs0(arg[i]))
356  {
357  realrki=id_RankFreeModule(arg[i],currRing);
358  k++;
359  j += IDELEMS(arg[i]);
360  if (realrki>maxrk) maxrk = realrki;
361  }
362  else
363  {
364  if (arg[i]!=NULL)
365  {
366  return idInit(1,arg[i]->rank);
367  }
368  }
369  }
370  if (maxrk == 0)
371  {
372  isIdeal = 1;
373  maxrk = 1;
374  }
375  /* init -----------------------------------------------------------*/
376  j += maxrk;
377  syzComp = k*maxrk;
378 
379  ring orig_ring=currRing;
380  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
381  rSetSyzComp(syzComp,syz_ring);
382  rChangeCurrRing(syz_ring);
383 
384  bigmat = idInit(j,(k+1)*maxrk);
385  /* create unit matrices ------------------------------------------*/
386  for (i=0;i<maxrk;i++)
387  {
388  for (j=0;j<=k;j++)
389  {
390  p = pOne();
391  pSetComp(p,i+1+j*maxrk);
392  pSetmComp(p);
393  bigmat->m[i] = pAdd(bigmat->m[i],p);
394  }
395  }
396  /* enter given ideals ------------------------------------------*/
397  i = maxrk;
398  k = 0;
399  for (j=0;j<length;j++)
400  {
401  if (arg[j]!=NULL)
402  {
403  for (l=0;l<IDELEMS(arg[j]);l++)
404  {
405  if (arg[j]->m[l]!=NULL)
406  {
407  if (syz_ring==orig_ring)
408  bigmat->m[i] = pCopy(arg[j]->m[l]);
409  else
410  bigmat->m[i] = prCopyR(arg[j]->m[l], orig_ring,currRing);
411  p_Shift(&(bigmat->m[i]),k*maxrk+isIdeal,currRing);
412  i++;
413  }
414  }
415  k++;
416  }
417  }
418  /* std computation --------------------------------------------*/
419  tempstd = kStd(bigmat,currRing->qideal,testHomog,&w,NULL,syzComp);
420  if (w!=NULL) delete w;
421  idDelete(&bigmat);
422 
423  if(syz_ring!=orig_ring)
424  rChangeCurrRing(orig_ring);
425 
426  /* interprete result ----------------------------------------*/
427  result = idInit(IDELEMS(tempstd),maxrk);
428  k = 0;
429  for (j=0;j<IDELEMS(tempstd);j++)
430  {
431  if ((tempstd->m[j]!=NULL) && (p_GetComp(tempstd->m[j],syz_ring)>syzComp))
432  {
433  if (syz_ring==orig_ring)
434  p = pCopy(tempstd->m[j]);
435  else
436  p = prCopyR(tempstd->m[j], syz_ring,currRing);
437  p_Shift(&p,-syzComp-isIdeal,currRing);
438  result->m[k] = p;
439  k++;
440  }
441  }
442  /* clean up ----------------------------------------------------*/
443  if(syz_ring!=orig_ring)
444  rChangeCurrRing(syz_ring);
445  idDelete(&tempstd);
446  if(syz_ring!=orig_ring)
447  {
448  rChangeCurrRing(orig_ring);
449  rDelete(syz_ring);
450  }
452  return result;
453 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
#define pAdd(p, q)
Definition: polys.h:186
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
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
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
#define pSetComp(p, v)
Definition: polys.h:38
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ idMWLift()

intvec* idMWLift ( ideal  mod,
intvec weights 
)

Definition at line 2180 of file ideals.cc.

2181 {
2182  if (idIs0(mod)) return new intvec(2);
2183  int i=IDELEMS(mod);
2184  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2185  intvec *result = new intvec(i+1);
2186  while (i>0)
2187  {
2188  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2189  }
2190  return result;
2191 }
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76

◆ idQuot()

ideal idQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb = FALSE,
BOOLEAN  resultIsIdeal = FALSE 
)

Definition at line 1308 of file ideals.cc.

1309 {
1310  // first check for special case h1:(0)
1311  if (idIs0(h2))
1312  {
1313  ideal res;
1314  if (resultIsIdeal)
1315  {
1316  res = idInit(1,1);
1317  res->m[0] = pOne();
1318  }
1319  else
1320  res = idFreeModule(h1->rank);
1321  return res;
1322  }
1323  BITSET old_test1;
1324  SI_SAVE_OPT1(old_test1);
1325  int i, kmax;
1326  BOOLEAN addOnlyOne=TRUE;
1327  tHomog hom=isNotHomog;
1328  intvec * weights1;
1329 
1330  ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1331 
1332  hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1333 
1334  ring orig_ring=currRing;
1335  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
1336  rSetSyzComp(kmax-1,syz_ring);
1337  rChangeCurrRing(syz_ring);
1338  if (orig_ring!=syz_ring)
1339  // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1340  s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1341  idTest(s_h4);
1342  #if 0
1343  void ipPrint_MA0(matrix m, const char *name);
1344  matrix m=idModule2Matrix(idCopy(s_h4));
1345  PrintS("start:\n");
1346  ipPrint_MA0(m,"Q");
1347  idDelete((ideal *)&m);
1348  PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1349  #endif
1350  ideal s_h3;
1351  if (addOnlyOne)
1352  {
1353  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1354  }
1355  else
1356  {
1357  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1358  }
1359  SI_RESTORE_OPT1(old_test1);
1360  #if 0
1361  // only together with the above debug stuff
1362  idSkipZeroes(s_h3);
1363  m=idModule2Matrix(idCopy(s_h3));
1364  Print("result, kmax=%d:\n",kmax);
1365  ipPrint_MA0(m,"S");
1366  idDelete((ideal *)&m);
1367  #endif
1368  idTest(s_h3);
1369  if (weights1!=NULL) delete weights1;
1370  idDelete(&s_h4);
1371 
1372  for (i=0;i<IDELEMS(s_h3);i++)
1373  {
1374  if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1375  {
1376  if (resultIsIdeal)
1377  p_Shift(&s_h3->m[i],-kmax,currRing);
1378  else
1379  p_Shift(&s_h3->m[i],-kmax+1,currRing);
1380  }
1381  else
1382  p_Delete(&s_h3->m[i],currRing);
1383  }
1384  if (resultIsIdeal)
1385  s_h3->rank = 1;
1386  else
1387  s_h3->rank = h1->rank;
1388  if(syz_ring!=orig_ring)
1389  {
1390  rChangeCurrRing(orig_ring);
1391  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1392  rDelete(syz_ring);
1393  }
1394  idSkipZeroes(s_h3);
1395  idTest(s_h3);
1396  return s_h3;
1397 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
static void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:60
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define BITSET
Definition: structs.h:18
#define pGetComp(p)
Component.
Definition: polys.h:37
poly res
Definition: myNF.cc:322
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition: ideals.cc:1199
Definition: intvec.h:14
tHomog
Definition: structs.h:37
ideal idFreeModule(int i)
Definition: ideals.h:111
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
char name(const Variable &v)
Definition: factory.h:178
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
void wrp(poly p)
Definition: polys.h:292
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:47

◆ idSect()

ideal idSect ( ideal  h1,
ideal  h2 
)

Definition at line 204 of file ideals.cc.

205 {
206  int i,j,k,length;
207  int flength = id_RankFreeModule(h1,currRing);
208  int slength = id_RankFreeModule(h2,currRing);
209  int rank=si_max(h1->rank,h2->rank);
210  if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
211 
212  ideal first,second,temp,temp1,result;
213  poly p,q;
214 
215  if (IDELEMS(h1)<IDELEMS(h2))
216  {
217  first = h1;
218  second = h2;
219  }
220  else
221  {
222  first = h2;
223  second = h1;
224  int t=flength; flength=slength; slength=t;
225  }
226  length = si_max(flength,slength);
227  if (length==0)
228  {
229  if ((currRing->qideal==NULL)
230  && (currRing->OrdSgn==1)
231  && (!rIsPluralRing(currRing))
233  return idSectWithElim(first,second);
234  else length = 1;
235  }
236  if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
237  j = IDELEMS(first);
238 
239  ring orig_ring=currRing;
240  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
241  rSetSyzComp(length,syz_ring);
242  rChangeCurrRing(syz_ring);
243 
244  while ((j>0) && (first->m[j-1]==NULL)) j--;
245  temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
246  k = 0;
247  for (i=0;i<j;i++)
248  {
249  if (first->m[i]!=NULL)
250  {
251  if (syz_ring==orig_ring)
252  temp->m[k] = pCopy(first->m[i]);
253  else
254  temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
255  q = pOne();
256  pSetComp(q,i+1+length);
257  pSetmComp(q);
258  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
259  p = temp->m[k];
260  while (pNext(p)!=NULL) pIter(p);
261  pNext(p) = q;
262  k++;
263  }
264  }
265  for (i=0;i<IDELEMS(second);i++)
266  {
267  if (second->m[i]!=NULL)
268  {
269  if (syz_ring==orig_ring)
270  temp->m[k] = pCopy(second->m[i]);
271  else
272  temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
273  if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
274  k++;
275  }
276  }
277  intvec *w=NULL;
278  temp1 = kStd(temp,currRing->qideal,testHomog,&w,NULL,length);
279  if (w!=NULL) delete w;
280  idDelete(&temp);
281  if(syz_ring!=orig_ring)
282  rChangeCurrRing(orig_ring);
283 
284  result = idInit(IDELEMS(temp1),rank);
285  j = 0;
286  for (i=0;i<IDELEMS(temp1);i++)
287  {
288  if ((temp1->m[i]!=NULL)
289  && (p_GetComp(temp1->m[i],syz_ring)>length))
290  {
291  if(syz_ring==orig_ring)
292  {
293  p = temp1->m[i];
294  }
295  else
296  {
297  p = prMoveR(temp1->m[i], syz_ring,orig_ring);
298  }
299  temp1->m[i]=NULL;
300  while (p!=NULL)
301  {
302  q = pNext(p);
303  pNext(p) = NULL;
304  k = pGetComp(p)-1-length;
305  pSetComp(p,0);
306  pSetmComp(p);
307  /* Warning! multiply only from the left! it's very important for Plural */
308  result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
309  p = q;
310  }
311  j++;
312  }
313  }
314  if(syz_ring!=orig_ring)
315  {
316  rChangeCurrRing(syz_ring);
317  idDelete(&temp1);
318  rChangeCurrRing(orig_ring);
319  rDelete(syz_ring);
320  }
321  else
322  {
323  idDelete(&temp1);
324  }
325 
327  if (TEST_OPT_RETURN_SB)
328  {
329  w=NULL;
330  temp1=kStd(result,currRing->qideal,testHomog,&w);
331  if (w!=NULL) delete w;
332  idDelete(&result);
333  idSkipZeroes(temp1);
334  return temp1;
335  }
336  else //temp1=kInterRed(result,currRing->qideal);
337  return result;
338 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
#define pAdd(p, q)
Definition: polys.h:186
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define TRUE
Definition: auxiliary.h:98
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4358
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int k
Definition: cfEzgcd.cc:93
#define TEST_V_INTERSECT_ELIM
Definition: options.h:136
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ideal idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:134
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pMult(p, q)
Definition: polys.h:190
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
#define TEST_V_INTERSECT_SYZ
Definition: options.h:137
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ idSeries()

ideal idSeries ( int  n,
ideal  M,
matrix  U = NULL,
intvec w = NULL 
)

Definition at line 1936 of file ideals.cc.

1937 {
1938  for(int i=IDELEMS(M)-1;i>=0;i--)
1939  {
1940  if(U==NULL)
1941  M->m[i]=pSeries(n,M->m[i],NULL,w);
1942  else
1943  {
1944  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
1945  MATELEM(U,i+1,i+1)=NULL;
1946  }
1947  }
1948  if(U!=NULL)
1949  idDelete((ideal*)&U);
1950  return M;
1951 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define M
Definition: sirandom.c:24
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define pSeries(n, p, u, w)
Definition: polys.h:354
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define MATELEM(mat, i, j)
Definition: matpol.h:29

◆ idSort()

static intvec* idSort ( ideal  id,
BOOLEAN  nolex = TRUE 
)
inlinestatic

Definition at line 185 of file ideals.h.

186 {
187  return id_Sort(id, nolex, currRing);
188 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
intvec * id_Sort(const ideal id, const BOOLEAN nolex, const ring r)
sorts the ideal w.r.t. the actual ringordering uses lex-ordering when nolex = FALSE ...

◆ idSyzygies()

ideal idSyzygies ( ideal  h1,
tHomog  h,
intvec **  w,
BOOLEAN  setSyzComp = TRUE,
BOOLEAN  setRegularity = FALSE,
int *  deg = NULL,
GbVariant  a = GbDefault 
)

Definition at line 562 of file ideals.cc.

564 {
565  ideal s_h1;
566  int j, k, length=0,reg;
567  BOOLEAN isMonomial=TRUE;
568  int ii, idElemens_h1;
569 
570  assume(h1 != NULL);
571 
572  idElemens_h1=IDELEMS(h1);
573 #ifdef PDEBUG
574  for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
575 #endif
576  if (idIs0(h1))
577  {
578  ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
579  return result;
580  }
581  int slength=(int)id_RankFreeModule(h1,currRing);
582  k=si_max(1,slength /*id_RankFreeModule(h1)*/);
583 
584  assume(currRing != NULL);
585  ring orig_ring=currRing;
586  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
587  if (setSyzComp) rSetSyzComp(k,syz_ring);
588  rChangeCurrRing(syz_ring);
589 
590  if (orig_ring != syz_ring)
591  {
592  s_h1=idrCopyR_NoSort(h1,orig_ring,syz_ring);
593  }
594  else
595  {
596  s_h1 = h1;
597  }
598 
599  idTest(s_h1);
600 
601  ideal s_h3=idPrepare(s_h1,h,k,w,alg); // main (syz) GB computation
602 
603  if (s_h3==NULL)
604  {
605  return idFreeModule( idElemens_h1 /*IDELEMS(h1)*/);
606  }
607 
608  if (orig_ring != syz_ring)
609  {
610  idDelete(&s_h1);
611  for (j=0; j<IDELEMS(s_h3); j++)
612  {
613  if (s_h3->m[j] != NULL)
614  {
615  if (p_MinComp(s_h3->m[j],syz_ring) > k)
616  p_Shift(&s_h3->m[j], -k,syz_ring);
617  else
618  p_Delete(&s_h3->m[j],syz_ring);
619  }
620  }
621  idSkipZeroes(s_h3);
622  s_h3->rank -= k;
623  rChangeCurrRing(orig_ring);
624  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
625  rDelete(syz_ring);
626  #ifdef HAVE_PLURAL
627  if (rIsPluralRing(orig_ring))
628  {
629  id_DelMultiples(s_h3,orig_ring);
630  idSkipZeroes(s_h3);
631  }
632  #endif
633  idTest(s_h3);
634  return s_h3;
635  }
636 
637  ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
638 
639  for (j=IDELEMS(s_h3)-1; j>=0; j--)
640  {
641  if (s_h3->m[j] != NULL)
642  {
643  if (p_MinComp(s_h3->m[j],syz_ring) <= k)
644  {
645  e->m[j] = s_h3->m[j];
646  isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
647  p_Delete(&pNext(s_h3->m[j]),syz_ring);
648  s_h3->m[j] = NULL;
649  }
650  }
651  }
652 
653  idSkipZeroes(s_h3);
654  idSkipZeroes(e);
655 
656  if ((deg != NULL)
657  && (!isMonomial)
659  && (setRegularity)
660  && (h==isHomog)
661  && (!rIsPluralRing(currRing))
662  && (!rField_is_Ring(currRing))
663  )
664  {
665  ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
666  if (dp_C_ring != syz_ring)
667  {
668  rChangeCurrRing(dp_C_ring);
669  e = idrMoveR_NoSort(e, syz_ring, dp_C_ring);
670  }
671  resolvente res = sySchreyerResolvente(e,-1,&length,TRUE, TRUE);
672  intvec * dummy = syBetti(res,length,&reg, *w);
673  *deg = reg+2;
674  delete dummy;
675  for (j=0;j<length;j++)
676  {
677  if (res[j]!=NULL) idDelete(&(res[j]));
678  }
679  omFreeSize((ADDRESS)res,length*sizeof(ideal));
680  idDelete(&e);
681  if (dp_C_ring != syz_ring)
682  {
683  rChangeCurrRing(syz_ring);
684  rDelete(dp_C_ring);
685  }
686  }
687  else
688  {
689  idDelete(&e);
690  }
691  idTest(s_h3);
692  if (currRing->qideal != NULL)
693  {
694  ideal ts_h3=kStd(s_h3,currRing->qideal,h,w);
695  idDelete(&s_h3);
696  s_h3 = ts_h3;
697  }
698  return s_h3;
699 }
#define TEST_OPT_NOTREGULARITY
Definition: options.h:114
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition: ideals.cc:460
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define pTest(p)
Definition: polys.h:398
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
void * ADDRESS
Definition: auxiliary.h:115
int k
Definition: cfEzgcd.cc:93
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i ...
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
ideal idFreeModule(int i)
Definition: ideals.h:111
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4363
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4883
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:308
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:861
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4561
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
ideal * resolvente
Definition: ideals.h:18
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
return result
Definition: facAbsBiFact.cc:76
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:47

◆ idTestHomModule()

BOOLEAN idTestHomModule ( ideal  m,
ideal  Q,
intvec w 
)

Definition at line 1884 of file ideals.cc.

1885 {
1886  if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
1887  if (idIs0(m)) return TRUE;
1888 
1889  int cmax=-1;
1890  int i;
1891  poly p=NULL;
1892  int length=IDELEMS(m);
1893  polyset P=m->m;
1894  for (i=length-1;i>=0;i--)
1895  {
1896  p=P[i];
1897  if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
1898  }
1899  if (w != NULL)
1900  if (w->length()+1 < cmax)
1901  {
1902  // Print("length: %d - %d \n", w->length(),cmax);
1903  return FALSE;
1904  }
1905 
1906  if(w!=NULL)
1908 
1909  for (i=length-1;i>=0;i--)
1910  {
1911  p=P[i];
1912  if (p!=NULL)
1913  {
1914  int d=currRing->pFDeg(p,currRing);
1915  loop
1916  {
1917  pIter(p);
1918  if (p==NULL) break;
1919  if (d!=currRing->pFDeg(p,currRing))
1920  {
1921  //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
1922  if(w!=NULL)
1924  return FALSE;
1925  }
1926  }
1927  }
1928  }
1929 
1930  if(w!=NULL)
1932 
1933  return TRUE;
1934 }
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3579
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
#define pMaxComp(p)
Definition: polys.h:281
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define Q
Definition: sirandom.c:25
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
const CanonicalForm & w
Definition: facAbsFact.cc:55
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ idVec2Ideal()

static ideal idVec2Ideal ( poly  vec)
inlinestatic

Definition at line 170 of file ideals.h.

171 {
172  return id_Vec2Ideal(vec, currRing);
173 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
ideal id_Vec2Ideal(poly vec, const ring R)

◆ idXXX()

ideal idXXX ( ideal  h1,
int  k 
)

Definition at line 703 of file ideals.cc.

704 {
705  ideal s_h1;
706  intvec *w=NULL;
707 
708  assume(currRing != NULL);
709  ring orig_ring=currRing;
710  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
711  rSetSyzComp(k,syz_ring);
712  rChangeCurrRing(syz_ring);
713 
714  if (orig_ring != syz_ring)
715  {
716  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
717  }
718  else
719  {
720  s_h1 = h1;
721  }
722 
723  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
724 
725  if (s_h3==NULL)
726  {
727  return idFreeModule(IDELEMS(h1));
728  }
729 
730  if (orig_ring != syz_ring)
731  {
732  idDelete(&s_h1);
733  idSkipZeroes(s_h3);
734  rChangeCurrRing(orig_ring);
735  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
736  rDelete(syz_ring);
737  idTest(s_h3);
738  return s_h3;
739  }
740 
741  idSkipZeroes(s_h3);
742  idTest(s_h3);
743  return s_h3;
744 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
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
Definition: intvec.h:14
ideal idFreeModule(int i)
Definition: ideals.h:111
#define assume(x)
Definition: mod2.h:394
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4363
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:47

◆ syGetAlgorithm()

GbVariant syGetAlgorithm ( char *  n,
const ring  r,
const ideal  M 
)

Definition at line 2655 of file ideals.cc.

2656 {
2657  GbVariant alg=GbDefault;
2658  if (strcmp(n,"slimgb")==0) alg=GbSlimgb;
2659  else if (strcmp(n,"std")==0) alg=GbStd;
2660  else if (strcmp(n,"sba")==0) alg=GbSba;
2661  else if (strcmp(n,"singmatic")==0) alg=GbSingmatic;
2662  else if (strcmp(n,"groebner")==0) alg=GbGroebner;
2663  else if (strcmp(n,"modstd")==0) alg=GbModstd;
2664  else if (strcmp(n,"ffmod")==0) alg=GbFfmod;
2665  else if (strcmp(n,"nfmod")==0) alg=GbNfmod;
2666  else Warn(">>%s<< is an unknown algorithm",n);
2667 
2668  if (alg==GbSlimgb) // test conditions for slimgb
2669  {
2670  if(rHasGlobalOrdering(r)
2671  &&(!rIsPluralRing(r))
2672  &&(r->qideal==NULL)
2673  &&(!rField_is_Ring(r))
2674  && rHasTDeg(r))
2675  {
2676  return GbSlimgb;
2677  }
2678  }
2679  else if (alg==GbSba) // cond. for sba
2680  {
2681  if(rField_is_Domain(r)
2682  &&(!rIsPluralRing(r))
2683  &&(rHasGlobalOrdering(r)))
2684  {
2685  return GbSba;
2686  }
2687  }
2688  else if (alg==GbGroebner) // cond. for groebner
2689  {
2690  return GbGroebner;
2691  }
2692 // else if(alg==GbModstd) // cond for modstd: requires ideal, not module
2693 // {
2694 // if(ggetid("modStd")==NULL)
2695 // {
2696 // WarnS(">>modStd<< not found");
2697 // }
2698 // else if(rField_is_Q(r)
2699 // &&(!rIsPluralRing(r))
2700 // &&(rHasGlobalOrdering(r)))
2701 // {
2702 // return GbModstd;
2703 // }
2704 // }
2705 
2706  return GbStd; // no conditions for std
2707 }
GbVariant
Definition: ideals.h:121
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
const ring r
Definition: syzextra.cc:208
BOOLEAN rHasTDeg(ring r)
Definition: ring.cc:4444
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
Definition: ideals.h:127
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
Definition: ideals.h:125
#define Warn
Definition: emacs.cc:80