My Project  UNKNOWN_GIT_VERSION
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,
  GbStdSat, 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, GbVariant a=GbDefault)
 
ideal idMultSect (resolvente arg, int length, GbVariant a=GbDefault)
 
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, GbVariant a=GbDefault)
 
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)
 
ideal id_Satstd (const ideal I, ideal J, const ring r)
 
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 28 of file ideals.h.

◆ idIsConstant

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

Definition at line 39 of file ideals.h.

◆ idMaxIdeal

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

initialise the maximal ideal (at 0)

Definition at line 32 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 36 of file ideals.h.

◆ idPrint

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

Definition at line 45 of file ideals.h.

◆ idSimpleAdd

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

Definition at line 41 of file ideals.h.

◆ idTest

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

Definition at line 46 of file ideals.h.

Typedef Documentation

◆ resolvente

typedef ideal* resolvente

Definition at line 17 of file ideals.h.

Enumeration Type Documentation

◆ GbVariant

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

Definition at line 117 of file ideals.h.

119 {
120  GbDefault=0,
121  // internal variants:
122  GbStd,
123  GbSlimgb,
124  GbSba,
125  // and the library functions:
126  GbGroebner,
127  GbModstd,
128  GbFfmod,
129  GbNfmod,
130  GbStdSat,

Function Documentation

◆ binom()

int binom ( int  n,
int  r 
)

Definition at line 912 of file simpleideals.cc.

914 {
915  int i,result;
916 
917  if (r==0) return 1;
918  if (n-r<r) return binom(n,n-r);
919  result = n-r+1;
920  for (i=2;i<=r;i++)
921  {
922  result *= n-r+i;
923  if (result<0)
924  {
925  WarnS("overflow in binomials");
926  return 0;
927  }
928  result /= i;
929  }
930  return result;

◆ id_Copy()

ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 403 of file simpleideals.cc.

405 {
406  id_Test(h1, r);
407 
408  ideal h2 = idInit(IDELEMS(h1), h1->rank);
409  for (int i=IDELEMS(h1)-1; i>=0; i--)
410  h2->m[i] = p_Copy(h1->m[i],r);
411  return h2;

◆ id_Farey()

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

Definition at line 2726 of file ideals.cc.

2727 {
2728  int cnt=IDELEMS(x)*x->nrows;
2729  ideal result=idInit(cnt,x->rank);
2730  result->nrows=x->nrows; // for lifting matrices
2731  result->ncols=x->ncols; // for lifting matrices
2732 
2733  int i;
2734  for(i=cnt-1;i>=0;i--)
2735  {
2736  result->m[i]=p_Farey(x->m[i],N,r);
2737  }
2738  return result;
2739 }

◆ id_GCD()

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

Definition at line 2623 of file ideals.cc.

2624 {
2625  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2626  intvec *w = NULL;
2627 
2628  ring save_r = currRing;
2629  rChangeCurrRing(r);
2630  ideal S=idSyzygies(I,testHomog,&w);
2631  rChangeCurrRing(save_r);
2632 
2633  if (w!=NULL) delete w;
2634  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2635  id_Delete(&S, r);
2636  poly gcd_p=singclap_pdivide(f,gg, r);
2637  p_Delete(&gg, r);
2638 
2639  return gcd_p;
2640 }

◆ id_Satstd()

ideal id_Satstd ( const ideal  I,
ideal  J,
const ring  r 
)

Definition at line 2984 of file ideals.cc.

2985 {
2986  ring save=currRing;
2987  if (currRing!=r) rChangeCurrRing(r);
2988  idSkipZeroes(J);
2989  id_satstdSaturatingVariables=(int*)omAlloc0((1+rVar(currRing))*sizeof(int));
2990  int k=IDELEMS(J);
2991  if (k>1)
2992  {
2993  for (int i=0; i<k; i++)
2994  {
2995  poly x = J->m[i];
2996  int li = p_Var(x,r);
2997  if (li>0)
2999  else
3000  {
3001  if (currRing!=save) rChangeCurrRing(save);
3002  WerrorS("ideal generators must be variables");
3003  return NULL;
3004  }
3005  }
3006  }
3007  else
3008  {
3009  poly x = J->m[0];
3010  for (int i=1; i<=r->N; i++)
3011  {
3012  int li = p_GetExp(x,i,r);
3013  if (li==1)
3015  else if (li>1)
3016  {
3017  if (currRing!=save) rChangeCurrRing(save);
3018  Werror("exponent(x(%d)^%d) must be 0 or 1",i,li);
3019  return NULL;
3020  }
3021  }
3022  }
3023  ideal res=kStd(I,r->qideal,testHomog,NULL,NULL,0,0,NULL,id_sat_vars_sp);
3026  if (currRing!=save) rChangeCurrRing(save);
3027  return res;
3028 }

◆ id_TensorModuleMult()

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

Definition at line 1716 of file simpleideals.cc.

1718 {
1719 // #ifdef DEBU
1720 // WarnS("tensorModuleMult!!!!");
1721 
1722  assume(m > 0);
1723  assume(M != NULL);
1724 
1725  const int n = rRing->N;
1726 
1727  assume(M->rank <= m * n);
1728 
1729  const int k = IDELEMS(M);
1730 
1731  ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
1732 
1733  for( int i = 0; i < k; i++ ) // for every w \in M
1734  {
1735  poly pTempSum = NULL;
1736 
1737  poly w = M->m[i];
1738 
1739  while(w != NULL) // for each term of w...
1740  {
1741  poly h = p_Head(w, rRing);
1742 
1743  const int gen = __p_GetComp(h, rRing); // 1 ...
1744 
1745  assume(gen > 0);
1746  assume(gen <= n*m);
1747 
1748  // TODO: write a formula with %, / instead of while!
1749  /*
1750  int c = gen;
1751  int v = 1;
1752  while(c > m)
1753  {
1754  c -= m;
1755  v++;
1756  }
1757  */
1758 
1759  int cc = gen % m;
1760  if( cc == 0) cc = m;
1761  int vv = 1 + (gen - cc) / m;
1762 
1763 // assume( cc == c );
1764 // assume( vv == v );
1765 
1766  // 1<= c <= m
1767  assume( cc > 0 );
1768  assume( cc <= m );
1769 
1770  assume( vv > 0 );
1771  assume( vv <= n );
1772 
1773  assume( (cc + (vv-1)*m) == gen );
1774 
1775  p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
1776  p_SetComp(h, cc, rRing);
1777 
1778  p_Setm(h, rRing); // addjust degree after the previous steps!
1779 
1780  pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
1781 
1782  pIter(w);
1783  }
1784 
1785  idTemp->m[i] = pTempSum;
1786  }
1787 
1788  // simplify idTemp???
1789 
1790  ideal idResult = id_Transp(idTemp, rRing);
1791 
1792  id_Delete(&idTemp, rRing);
1793 
1794  return(idResult);

◆ idAdd()

ideal idAdd ( ideal  h1,
ideal  h2 
)
inline

h1 + h2

Definition at line 67 of file ideals.h.

69 {
70  return id_Add(h1, h2, currRing);

◆ idCoeffOfKBase()

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

Definition at line 2499 of file ideals.cc.

2500 {
2501  matrix result;
2502  ideal tempKbase;
2503  poly p,q;
2504  intvec * convert;
2505  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2506 #if 0
2507  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2508  if (idIs0(arg))
2509  return mpNew(i,1);
2510  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2511  result = mpNew(i,j);
2512 #else
2513  result = mpNew(i, j);
2514  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2515 #endif
2516 
2517  tempKbase = idCreateSpecialKbase(kbase,&convert);
2518  for (k=0;k<j;k++)
2519  {
2520  p = arg->m[k];
2521  while (p!=NULL)
2522  {
2523  q = idDecompose(p,how,tempKbase,&pos);
2524  if (pos>=0)
2525  {
2526  MATELEM(result,(*convert)[pos],k+1) =
2527  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2528  }
2529  else
2530  p_Delete(&q,currRing);
2531  pIter(p);
2532  }
2533  }
2534  idDelete(&tempKbase);
2535  return result;
2536 }

◆ idCopy()

ideal idCopy ( ideal  A)
inline

Definition at line 59 of file ideals.h.

61 {
62  return id_Copy(A, currRing);

◆ idCopyFirstK()

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

Definition at line 19 of file ideals.h.

21 {
22  return id_CopyFirstK(ide, k, currRing);

◆ idDelEquals()

void idDelEquals ( ideal  id)

Definition at line 2834 of file ideals.cc.

2835 {
2836  int idsize = IDELEMS(id);
2837  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
2838  for (int i = 0; i < idsize; i++)
2839  {
2840  id_sort[i].p = id->m[i];
2841  id_sort[i].index = i;
2842  }
2843  idSort_qsort(id_sort, idsize);
2844  int index, index_i, index_j;
2845  int i = 0;
2846  for (int j = 1; j < idsize; j++)
2847  {
2848  if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
2849  {
2850  index_i = id_sort[i].index;
2851  index_j = id_sort[j].index;
2852  if (index_j > index_i)
2853  {
2854  index = index_j;
2855  }
2856  else
2857  {
2858  index = index_i;
2859  i = j;
2860  }
2861  pDelete(&id->m[index]);
2862  }
2863  else
2864  {
2865  i = j;
2866  }
2867  }
2868  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
2869 }

◆ idDiff()

matrix idDiff ( matrix  i,
int  k 
)

Definition at line 2169 of file ideals.cc.

2170 {
2171  int e=MATCOLS(i)*MATROWS(i);
2172  matrix r=mpNew(MATROWS(i),MATCOLS(i));
2173  r->rank=i->rank;
2174  int j;
2175  for(j=0; j<e; j++)
2176  {
2177  r->m[j]=pDiff(i->m[j],k);
2178  }
2179  return r;
2180 }

◆ idDiffOp()

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

Definition at line 2182 of file ideals.cc.

2183 {
2184  matrix r=mpNew(IDELEMS(I),IDELEMS(J));
2185  int i,j;
2186  for(i=0; i<IDELEMS(I); i++)
2187  {
2188  for(j=0; j<IDELEMS(J); j++)
2189  {
2190  MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
2191  }
2192  }
2193  return r;
2194 }

◆ idElimination()

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

Definition at line 1574 of file ideals.cc.

1575 {
1576  int i,j=0,k,l;
1577  ideal h,hh, h3;
1578  rRingOrder_t *ord;
1579  int *block0,*block1;
1580  int ordersize=2;
1581  int **wv;
1582  tHomog hom;
1583  intvec * w;
1584  ring tmpR;
1585  ring origR = currRing;
1586 
1587  if (delVar==NULL)
1588  {
1589  return idCopy(h1);
1590  }
1591  if ((currRing->qideal!=NULL) && rIsPluralRing(origR))
1592  {
1593  WerrorS("cannot eliminate in a qring");
1594  return NULL;
1595  }
1596  if (idIs0(h1)) return idInit(1,h1->rank);
1597 #ifdef HAVE_PLURAL
1598  if (rIsPluralRing(origR))
1599  /* in the NC case, we have to check the admissibility of */
1600  /* the subalgebra to be intersected with */
1601  {
1602  if ((ncRingType(origR) != nc_skew) && (ncRingType(origR) != nc_exterior)) /* in (quasi)-commutative algebras every subalgebra is admissible */
1603  {
1604  if (nc_CheckSubalgebra(delVar,origR))
1605  {
1606  WerrorS("no elimination is possible: subalgebra is not admissible");
1607  return NULL;
1608  }
1609  }
1610  }
1611 #endif
1612  hom=(tHomog)idHomModule(h1,NULL,&w); //sets w to weight vector or NULL
1613  h3=idInit(16,h1->rank);
1614  for (k=0;; k++)
1615  {
1616  if (origR->order[k]!=0) ordersize++;
1617  else break;
1618  }
1619 #if 0
1620  if (rIsPluralRing(origR)) // we have too keep the odering: it may be needed
1621  // for G-algebra
1622  {
1623  for (k=0;k<ordersize-1; k++)
1624  {
1625  block0[k+1] = origR->block0[k];
1626  block1[k+1] = origR->block1[k];
1627  ord[k+1] = origR->order[k];
1628  if (origR->wvhdl[k]!=NULL) wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1629  }
1630  }
1631  else
1632  {
1633  block0[1] = 1;
1634  block1[1] = (currRing->N);
1635  if (origR->OrdSgn==1) ord[1] = ringorder_wp;
1636  else ord[1] = ringorder_ws;
1637  wv[1]=(int*)omAlloc0((currRing->N)*sizeof(int));
1638  double wNsqr = (double)2.0 / (double)(currRing->N);
1640  int *x= (int * )omAlloc(2 * ((currRing->N) + 1) * sizeof(int));
1641  int sl=IDELEMS(h1) - 1;
1642  wCall(h1->m, sl, x, wNsqr);
1643  for (sl = (currRing->N); sl!=0; sl--)
1644  wv[1][sl-1] = x[sl + (currRing->N) + 1];
1645  omFreeSize((ADDRESS)x, 2 * ((currRing->N) + 1) * sizeof(int));
1646 
1647  ord[2]=ringorder_C;
1648  ord[3]=0;
1649  }
1650 #else
1651 #endif
1652  if ((hom==TRUE) && (origR->OrdSgn==1) && (!rIsPluralRing(origR)))
1653  {
1654  #if 1
1655  // we change to an ordering:
1656  // aa(1,1,1,...,0,0,0),wp(...),C
1657  // this seems to be better than version 2 below,
1658  // according to Tst/../elimiate_[3568].tat (- 17 %)
1659  ord=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
1660  block0=(int*)omAlloc0(4*sizeof(int));
1661  block1=(int*)omAlloc0(4*sizeof(int));
1662  wv=(int**) omAlloc0(4*sizeof(int**));
1663  block0[0] = block0[1] = 1;
1664  block1[0] = block1[1] = rVar(origR);
1665  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1666  // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1667  // ignore it
1668  ord[0] = ringorder_aa;
1669  for (j=0;j<rVar(origR);j++)
1670  if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1671  BOOLEAN wp=FALSE;
1672  for (j=0;j<rVar(origR);j++)
1673  if (p_Weight(j+1,origR)!=1) { wp=TRUE;break; }
1674  if (wp)
1675  {
1676  wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1677  for (j=0;j<rVar(origR);j++)
1678  wv[1][j]=p_Weight(j+1,origR);
1679  ord[1] = ringorder_wp;
1680  }
1681  else
1682  ord[1] = ringorder_dp;
1683  #else
1684  // we change to an ordering:
1685  // a(w1,...wn),wp(1,...0.....),C
1686  ord=(int*)omAlloc0(4*sizeof(int));
1687  block0=(int*)omAlloc0(4*sizeof(int));
1688  block1=(int*)omAlloc0(4*sizeof(int));
1689  wv=(int**) omAlloc0(4*sizeof(int**));
1690  block0[0] = block0[1] = 1;
1691  block1[0] = block1[1] = rVar(origR);
1692  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1693  wv[1]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1694  ord[0] = ringorder_a;
1695  for (j=0;j<rVar(origR);j++)
1696  wv[0][j]=pWeight(j+1,origR);
1697  ord[1] = ringorder_wp;
1698  for (j=0;j<rVar(origR);j++)
1699  if (pGetExp(delVar,j+1)!=0) wv[1][j]=1;
1700  #endif
1701  ord[2] = ringorder_C;
1702  ord[3] = (rRingOrder_t)0;
1703  }
1704  else
1705  {
1706  // we change to an ordering:
1707  // aa(....),orig_ordering
1708  ord=(rRingOrder_t*)omAlloc0(ordersize*sizeof(rRingOrder_t));
1709  block0=(int*)omAlloc0(ordersize*sizeof(int));
1710  block1=(int*)omAlloc0(ordersize*sizeof(int));
1711  wv=(int**) omAlloc0(ordersize*sizeof(int**));
1712  for (k=0;k<ordersize-1; k++)
1713  {
1714  block0[k+1] = origR->block0[k];
1715  block1[k+1] = origR->block1[k];
1716  ord[k+1] = origR->order[k];
1717  if (origR->wvhdl[k]!=NULL) wv[k+1] = (int*) omMemDup(origR->wvhdl[k]);
1718  }
1719  block0[0] = 1;
1720  block1[0] = rVar(origR);
1721  wv[0]=(int*)omAlloc0((rVar(origR) + 1)*sizeof(int));
1722  for (j=0;j<rVar(origR);j++)
1723  if (pGetExp(delVar,j+1)!=0) wv[0][j]=1;
1724  // use this special ordering: like ringorder_a, except that pFDeg, pWeights
1725  // ignore it
1726  ord[0] = ringorder_aa;
1727  }
1728  // fill in tmp ring to get back the data later on
1729  tmpR = rCopy0(origR,FALSE,FALSE); // qring==NULL
1730  //rUnComplete(tmpR);
1731  tmpR->p_Procs=NULL;
1732  tmpR->order = ord;
1733  tmpR->block0 = block0;
1734  tmpR->block1 = block1;
1735  tmpR->wvhdl = wv;
1736  rComplete(tmpR, 1);
1737 
1738 #ifdef HAVE_PLURAL
1739  /* update nc structure on tmpR */
1740  if (rIsPluralRing(origR))
1741  {
1742  if ( nc_rComplete(origR, tmpR, false) ) // no quotient ideal!
1743  {
1744  WerrorS("no elimination is possible: ordering condition is violated");
1745  // cleanup
1746  rDelete(tmpR);
1747  if (w!=NULL)
1748  delete w;
1749  return NULL;
1750  }
1751  }
1752 #endif
1753  // change into the new ring
1754  //pChangeRing((currRing->N),currRing->OrdSgn,ord,block0,block1,wv);
1755  rChangeCurrRing(tmpR);
1756 
1757  //h = idInit(IDELEMS(h1),h1->rank);
1758  // fetch data from the old ring
1759  //for (k=0;k<IDELEMS(h1);k++) h->m[k] = prCopyR( h1->m[k], origR);
1760  h=idrCopyR(h1,origR,currRing);
1761  if (origR->qideal!=NULL)
1762  {
1763  WarnS("eliminate in q-ring: experimental");
1764  ideal q=idrCopyR(origR->qideal,origR,currRing);
1765  ideal s=idSimpleAdd(h,q);
1766  idDelete(&h);
1767  idDelete(&q);
1768  h=s;
1769  }
1770  // compute kStd
1771 #if 1
1772  //rWrite(tmpR);PrintLn();
1773  //BITSET save1;
1774  //SI_SAVE_OPT1(save1);
1775  //si_opt_1 |=1;
1776  //Print("h: %d gen, rk=%d\n",IDELEMS(h),h->rank);
1777  //extern char * showOption();
1778  //Print("%s\n",showOption());
1779  if (alg==GbDefault) alg=GbStd;
1780  if (alg==GbStd)
1781  {
1782  if (TEST_OPT_PROT) { PrintS("std:"); mflush(); }
1783  hh = kStd(h,NULL,hom,&w,hilb);
1784  }
1785  else if (alg==GbSlimgb)
1786  {
1787  if (TEST_OPT_PROT) { PrintS("slimgb:"); mflush(); }
1788  hh = t_rep_gb(currRing, h, 0);
1789  }
1790  else if (alg==GbGroebner)
1791  {
1792  if (TEST_OPT_PROT) { PrintS("groebner:"); mflush(); }
1793  BOOLEAN err;
1794  hh=(ideal)iiCallLibProc1("groebner",idCopy(h),MODUL_CMD,err);
1795  if (err)
1796  {
1797  Werror("error %d in >>groebner<<",err);
1798  hh=idInit(1,1);
1799  }
1800  }
1801  else if (alg==GbModstd)
1802  {
1803  if (TEST_OPT_PROT) { PrintS("modstd:"); mflush(); }
1804  BOOLEAN err;
1805  void *args[]={idCopy(h),(void*)1,NULL};
1806  int arg_t[]={IDEAL_CMD,INT_CMD,0};
1807  hh=(ideal)iiCallLibProcM("modStd",args,arg_t,err);
1808  if (err)
1809  {
1810  Werror("error %d in >>modStd<<",err);
1811  hh=idInit(1,1);
1812  }
1813  }
1814  else if (alg==GbSba)
1815  {
1816  if (TEST_OPT_PROT) { PrintS("sba:"); mflush(); }
1817  hh = kSba(h,currRing->qideal,hom,&w,1,0,NULL);
1818  }
1819  else
1820  {
1821  hh=idInit(1,1);
1822  Werror("wrong algorithm %d for SB",(int)alg);
1823  }
1824  //SI_RESTORE_OPT1(save1);
1825  idDelete(&h);
1826 #else
1827  extern ideal kGroebner(ideal F, ideal Q);
1828  hh=kGroebner(h,NULL);
1829 #endif
1830  // go back to the original ring
1831  rChangeCurrRing(origR);
1832  i = IDELEMS(hh)-1;
1833  while ((i >= 0) && (hh->m[i] == NULL)) i--;
1834  j = -1;
1835  // fetch data from temp ring
1836  for (k=0; k<=i; k++)
1837  {
1838  l=(currRing->N);
1839  while ((l>0) && (p_GetExp( hh->m[k],l,tmpR)*pGetExp(delVar,l)==0)) l--;
1840  if (l==0)
1841  {
1842  j++;
1843  if (j >= IDELEMS(h3))
1844  {
1845  pEnlargeSet(&(h3->m),IDELEMS(h3),16);
1846  IDELEMS(h3) += 16;
1847  }
1848  h3->m[j] = prMoveR( hh->m[k], tmpR,origR);
1849  hh->m[k] = NULL;
1850  }
1851  }
1852  id_Delete(&hh, tmpR);
1853  idSkipZeroes(h3);
1854  rDelete(tmpR);
1855  if (w!=NULL)
1856  delete w;
1857  return h3;
1858 }

◆ idFreeModule()

ideal idFreeModule ( int  i)
inline

Definition at line 110 of file ideals.h.

112 {
113  return id_FreeModule (i, currRing);

◆ idGetNextChoise()

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

Definition at line 854 of file simpleideals.cc.

856 {
857  int i = r-1,j;
858  while ((i >= 0) && (choise[i] == end))
859  {
860  i--;
861  end--;
862  }
863  if (i == -1)
864  *endch = TRUE;
865  else
866  {
867  choise[i]++;
868  for (j=i+1; j<r; j++)
869  {
870  choise[j] = choise[i]+j-i;
871  }
872  *endch = FALSE;
873  }

◆ idGetNumberOfChoise()

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

Definition at line 880 of file simpleideals.cc.

882 {
883  int * localchoise,i,result=0;
884  BOOLEAN b=FALSE;
885 
886  if (d<=1) return 1;
887  localchoise=(int*)omAlloc((d-1)*sizeof(int));
888  idInitChoise(d-1,begin,end,&b,localchoise);
889  while (!b)
890  {
891  result++;
892  i = 0;
893  while ((i<t) && (localchoise[i]==choise[i])) i++;
894  if (i>=t)
895  {
896  i = t+1;
897  while ((i<d) && (localchoise[i-1]==choise[i])) i++;
898  if (i>=d)
899  {
900  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
901  return result;
902  }
903  }
904  idGetNextChoise(d-1,end,&b,localchoise);
905  }
906  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
907  return 0;

◆ idHead()

ideal idHead ( ideal  h)

◆ idHomIdeal()

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

Definition at line 90 of file ideals.h.

92 {
93  return id_HomIdeal(id, Q, currRing);

◆ idHomModule()

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

Definition at line 95 of file ideals.h.

97 {
98  return id_HomModule(m, Q, w, currRing);

◆ idInitChoise()

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

Definition at line 832 of file simpleideals.cc.

834 {
835  /*returns the first choise of r numbers between beg and end*/
836  int i;
837  for (i=0; i<r; i++)
838  {
839  choise[i] = 0;
840  }
841  if (r <= end-beg+1)
842  for (i=0; i<r; i++)
843  {
844  choise[i] = beg+i;
845  }
846  if (r > end-beg+1)
847  *endch = TRUE;
848  else
849  *endch = FALSE;

◆ 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 639 of file simpleideals.cc.

641 {
642  if (h2==NULL) return FALSE;
643  assume (h1 != NULL);
644 
645  int j = IDELEMS(h1) - 1;
646 
647  while ((j >= 0) && (h1->m[j] == NULL)) j--;
648  j++;
649  if (j==IDELEMS(h1))
650  {
651  pEnlargeSet(&(h1->m),IDELEMS(h1),16);
652  IDELEMS(h1)+=16;
653  }
654  h1->m[j]=h2;
655  return TRUE;

◆ idInsertPolyOnPos()

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

insert p into I on position pos

Definition at line 658 of file simpleideals.cc.

660 {
661  if (p==NULL) return FALSE;
662  assume (I != NULL);
663 
664  int j = IDELEMS(I) - 1;
665 
666  while ((j >= 0) && (I->m[j] == NULL)) j--;
667  j++;
668  if (j==IDELEMS(I))
669  {
670  pEnlargeSet(&(I->m),IDELEMS(I),IDELEMS(I)+1);
671  IDELEMS(I)+=1;
672  }
673  for(j = IDELEMS(I)-1;j>pos;j--)
674  I->m[j] = I->m[j-1];
675  I->m[pos]=p;
676  return TRUE;

◆ idInsertPolyWithTests()

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

Definition at line 74 of file ideals.h.

76 {
77  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);

◆ idIs0()

BOOLEAN idIs0 ( ideal  h)

returns true if h is the zero ideal

Definition at line 767 of file simpleideals.cc.

769 {
770  assume (h != NULL); // will fail :(
771 // if (h == NULL) return TRUE;
772 
773  for( int i = IDELEMS(h)-1; i >= 0; i-- )
774  if(h->m[i] != NULL)
775  return FALSE;
776 
777  return TRUE;
778 

◆ idIsSubModule()

BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 2079 of file ideals.cc.

2080 {
2081  int i;
2082  poly p;
2083 
2084  if (idIs0(id1)) return TRUE;
2085  for (i=0;i<IDELEMS(id1);i++)
2086  {
2087  if (id1->m[i] != NULL)
2088  {
2089  p = kNF(id2,currRing->qideal,id1->m[i]);
2090  if (p != NULL)
2091  {
2092  p_Delete(&p,currRing);
2093  return FALSE;
2094  }
2095  }
2096  }
2097  return TRUE;
2098 }

◆ idIsZeroDim()

static BOOLEAN idIsZeroDim ( ideal  i)
inlinestatic

Definition at line 177 of file ideals.h.

179 {
180  return id_IsZeroDim(i, currRing);

◆ 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 2802 of file ideals.cc.

2803 {
2804  for (int i = IDELEMS(id)-1; i >= k; i--)
2805  {
2806  if (id->m[i] != NULL) pDelete(&id->m[i]);
2807  }
2808  int kk=k;
2809  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2810  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2811  IDELEMS(id) = kk;
2812 }

◆ 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 1113 of file ideals.cc.

1115 {
1116  int lsmod =id_RankFreeModule(submod,currRing), j, k;
1117  int comps_to_add=0;
1118  poly p;
1119 
1120  if (idIs0(submod))
1121  {
1122  if (unit!=NULL)
1123  {
1124  *unit=mpNew(1,1);
1125  MATELEM(*unit,1,1)=pOne();
1126  }
1127  if (rest!=NULL)
1128  {
1129  *rest=idInit(1,mod->rank);
1130  }
1131  return idInit(1,mod->rank);
1132  }
1133  if (idIs0(mod)) /* and not idIs0(submod) */
1134  {
1135  WerrorS("2nd module does not lie in the first");
1136  return NULL;
1137  }
1138  if (unit!=NULL)
1139  {
1140  comps_to_add = IDELEMS(submod);
1141  while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
1142  comps_to_add--;
1143  }
1145  if ((k!=0) && (lsmod==0)) lsmod=1;
1146  k=si_max(k,(int)mod->rank);
1147  if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
1148 
1149  ring orig_ring=currRing;
1150  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
1151  rSetSyzComp(k,syz_ring);
1152  rChangeCurrRing(syz_ring);
1153 
1154  ideal s_mod, s_temp;
1155  if (orig_ring != syz_ring)
1156  {
1157  s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
1158  s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
1159  }
1160  else
1161  {
1162  s_mod = mod;
1163  s_temp = idCopy(submod);
1164  }
1165  ideal s_h3;
1166  if (isSB)
1167  {
1168  s_h3 = idCopy(s_mod);
1169  idPrepareStd(s_h3, k+comps_to_add);
1170  }
1171  else
1172  {
1173  s_h3 = idPrepare(s_mod,(tHomog)FALSE,k+comps_to_add,NULL,alg);
1174  }
1175  if (!goodShape)
1176  {
1177  for (j=0;j<IDELEMS(s_h3);j++)
1178  {
1179  if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
1180  p_Delete(&(s_h3->m[j]),currRing);
1181  }
1182  }
1183  idSkipZeroes(s_h3);
1184  if (lsmod==0)
1185  {
1186  id_Shift(s_temp,1,currRing);
1187  }
1188  if (unit!=NULL)
1189  {
1190  for(j = 0;j<comps_to_add;j++)
1191  {
1192  p = s_temp->m[j];
1193  if (p!=NULL)
1194  {
1195  while (pNext(p)!=NULL) pIter(p);
1196  pNext(p) = pOne();
1197  pIter(p);
1198  pSetComp(p,1+j+k);
1199  pSetmComp(p);
1200  p = pNeg(p);
1201  }
1202  }
1203  s_temp->rank += (k+comps_to_add);
1204  }
1205  ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1206  s_result->rank = s_h3->rank;
1207  ideal s_rest = idInit(IDELEMS(s_result),k);
1208  idDelete(&s_h3);
1209  idDelete(&s_temp);
1210 
1211  for (j=0;j<IDELEMS(s_result);j++)
1212  {
1213  if (s_result->m[j]!=NULL)
1214  {
1215  if (pGetComp(s_result->m[j])<=k)
1216  {
1217  if (!divide)
1218  {
1219  if (isSB)
1220  {
1221  WarnS("first module not a standardbasis\n"
1222  "// ** or second not a proper submodule");
1223  }
1224  else
1225  WerrorS("2nd module does not lie in the first");
1226  idDelete(&s_result);
1227  idDelete(&s_rest);
1228  s_result=idInit(IDELEMS(submod),submod->rank);
1229  break;
1230  }
1231  else
1232  {
1233  p = s_rest->m[j] = s_result->m[j];
1234  while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1235  s_result->m[j] = pNext(p);
1236  pNext(p) = NULL;
1237  }
1238  }
1239  p_Shift(&(s_result->m[j]),-k,currRing);
1240  pNeg(s_result->m[j]);
1241  }
1242  }
1243  if ((lsmod==0) && (s_rest!=NULL))
1244  {
1245  for (j=IDELEMS(s_rest);j>0;j--)
1246  {
1247  if (s_rest->m[j-1]!=NULL)
1248  {
1249  p_Shift(&(s_rest->m[j-1]),-1,currRing);
1250  s_rest->m[j-1] = s_rest->m[j-1];
1251  }
1252  }
1253  }
1254  if(syz_ring!=orig_ring)
1255  {
1256  idDelete(&s_mod);
1257  rChangeCurrRing(orig_ring);
1258  s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1259  s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1260  rDelete(syz_ring);
1261  }
1262  if (rest!=NULL)
1263  *rest = s_rest;
1264  else
1265  idDelete(&s_rest);
1266 //idPrint(s_result);
1267  if (unit!=NULL)
1268  {
1269  *unit=mpNew(comps_to_add,comps_to_add);
1270  int i;
1271  for(i=0;i<IDELEMS(s_result);i++)
1272  {
1273  poly p=s_result->m[i];
1274  poly q=NULL;
1275  while(p!=NULL)
1276  {
1277  if(pGetComp(p)<=comps_to_add)
1278  {
1279  pSetComp(p,0);
1280  if (q!=NULL)
1281  {
1282  pNext(q)=pNext(p);
1283  }
1284  else
1285  {
1286  pIter(s_result->m[i]);
1287  }
1288  pNext(p)=NULL;
1289  MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1290  if(q!=NULL) p=pNext(q);
1291  else p=s_result->m[i];
1292  }
1293  else
1294  {
1295  q=p;
1296  pIter(p);
1297  }
1298  }
1299  p_Shift(&s_result->m[i],-comps_to_add,currRing);
1300  }
1301  }
1302  return s_result;
1303 }

◆ idLiftStd()

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

Definition at line 925 of file ideals.cc.

926 {
927  int i, j, t, inputIsIdeal=id_RankFreeModule(h1,currRing);
928  long k;
929  poly p=NULL, q;
930  intvec *w=NULL;
931 
932  idDelete((ideal*)ma);
933  BOOLEAN lift3=FALSE;
934  if (syz!=NULL) { lift3=TRUE; idDelete(syz); }
935  if (idIs0(h1))
936  {
937  *ma=mpNew(1,0);
938  if (lift3)
939  {
940  *syz=idFreeModule(IDELEMS(h1));
941  }
942  return idInit(1,h1->rank);
943  }
944 
945  BITSET save2;
946  SI_SAVE_OPT2(save2);
947 
949 
950  if ((k==1) && (!lift3)) si_opt_2 |=Sy_bit(V_IDLIFT);
951 
952  ring orig_ring = currRing;
953  ring syz_ring = rAssure_SyzOrder(orig_ring,TRUE);
954  rSetSyzComp(k,syz_ring);
955  rChangeCurrRing(syz_ring);
956 
957  ideal s_h1=h1;
958 
959  if (orig_ring != syz_ring)
960  s_h1 = idrCopyR_NoSort(h1,orig_ring,syz_ring);
961  else
962  s_h1 = h1;
963 
964  ideal s_h3=idPrepare(s_h1,hi,k,&w,alg); // main (syz) GB computation
965 
966  ideal s_h2 = idInit(IDELEMS(s_h3), s_h3->rank);
967 
968  if (lift3) (*syz)=idInit(IDELEMS(s_h3),IDELEMS(h1));
969 
970  if (w!=NULL) delete w;
971  i = 0;
972 
973  // now sort the result, SB : leave in s_h3
974  // T: put in s_h2
975  // syz: put in *syz
976  for (j=0; j<IDELEMS(s_h3); j++)
977  {
978  if (s_h3->m[j] != NULL)
979  {
980  //if (p_MinComp(s_h3->m[j],syz_ring) <= k)
981  if (pGetComp(s_h3->m[j]) <= k) // syz_ring == currRing
982  {
983  i++;
984  q = s_h3->m[j];
985  while (pNext(q) != NULL)
986  {
987  if (pGetComp(pNext(q)) > k)
988  {
989  s_h2->m[j] = pNext(q);
990  pNext(q) = NULL;
991  }
992  else
993  {
994  pIter(q);
995  }
996  }
997  if (!inputIsIdeal) p_Shift(&(s_h3->m[j]), -1,currRing);
998  }
999  else
1000  {
1001  // we a syzygy here:
1002  if (lift3)
1003  {
1004  p_Shift(&s_h3->m[j], -k,currRing);
1005  (*syz)->m[j]=s_h3->m[j];
1006  s_h3->m[j]=NULL;
1007  }
1008  else
1009  p_Delete(&(s_h3->m[j]),currRing);
1010  }
1011  }
1012  }
1013  idSkipZeroes(s_h3);
1014  //extern char * iiStringMatrix(matrix im, int dim,char ch);
1015  //PrintS("SB: ----------------------------------------\n");
1016  //PrintS(iiStringMatrix((matrix)s_h3,k,'\n'));
1017  //PrintLn();
1018  //PrintS("T: ----------------------------------------\n");
1019  //PrintS(iiStringMatrix((matrix)s_h2,h1->rank,'\n'));
1020  //PrintLn();
1021 
1022  if (lift3) idSkipZeroes(*syz);
1023 
1024  j = IDELEMS(s_h1);
1025 
1026 
1027  if (syz_ring!=orig_ring)
1028  {
1029  idDelete(&s_h1);
1030  rChangeCurrRing(orig_ring);
1031  }
1032 
1033  *ma = mpNew(j,i);
1034 
1035  i = 1;
1036  for (j=0; j<IDELEMS(s_h2); j++)
1037  {
1038  if (s_h2->m[j] != NULL)
1039  {
1040  q = prMoveR( s_h2->m[j], syz_ring,orig_ring);
1041  s_h2->m[j] = NULL;
1042 
1043  if (q!=NULL)
1044  {
1045  q=pReverse(q);
1046  while (q != NULL)
1047  {
1048  p = q;
1049  pIter(q);
1050  pNext(p) = NULL;
1051  t=pGetComp(p);
1052  pSetComp(p,0);
1053  pSetmComp(p);
1054  MATELEM(*ma,t-k,i) = pAdd(MATELEM(*ma,t-k,i),p);
1055  }
1056  }
1057  i++;
1058  }
1059  }
1060  idDelete(&s_h2);
1061 
1062  for (i=0; i<IDELEMS(s_h3); i++)
1063  {
1064  s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], syz_ring,orig_ring);
1065  }
1066  if (lift3)
1067  {
1068  for (i=0; i<IDELEMS(*syz); i++)
1069  {
1070  (*syz)->m[i] = prMoveR_NoSort((*syz)->m[i], syz_ring,orig_ring);
1071  }
1072  }
1073 
1074  if (syz_ring!=orig_ring) rDelete(syz_ring);
1075  SI_RESTORE_OPT2(save2);
1076  return s_h3;
1077 }

◆ idLiftW()

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

Definition at line 1309 of file ideals.cc.

1310 {
1311  long N=0;
1312  int i;
1313  for(i=IDELEMS(Q)-1;i>=0;i--)
1314  if(w==NULL)
1315  N=si_max(N,p_Deg(Q->m[i],currRing));
1316  else
1317  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1318  N+=n;
1319 
1320  T=mpNew(IDELEMS(Q),IDELEMS(P));
1321  R=idInit(IDELEMS(P),P->rank);
1322 
1323  for(i=IDELEMS(P)-1;i>=0;i--)
1324  {
1325  poly p;
1326  if(w==NULL)
1327  p=ppJet(P->m[i],N);
1328  else
1329  p=ppJetW(P->m[i],N,w);
1330 
1331  int j=IDELEMS(Q)-1;
1332  while(p!=NULL)
1333  {
1334  if(pDivisibleBy(Q->m[j],p))
1335  {
1336  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1337  if(w==NULL)
1338  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1339  else
1340  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1341  pNormalize(p);
1342  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1343  p_Delete(&p0,currRing);
1344  else
1345  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1346  j=IDELEMS(Q)-1;
1347  }
1348  else
1349  {
1350  if(j==0)
1351  {
1352  poly p0=p;
1353  pIter(p);
1354  pNext(p0)=NULL;
1355  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1356  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1357  p_Delete(&p0,currRing);
1358  else
1359  R->m[i]=pAdd(R->m[i],p0);
1360  j=IDELEMS(Q)-1;
1361  }
1362  else
1363  j--;
1364  }
1365  }
1366  }
1367 }

◆ idMinBase()

ideal idMinBase ( ideal  h1)

Definition at line 49 of file ideals.cc.

50 {
51  ideal h2, h3,h4,e;
52  int j,k;
53  int i,l,ll;
54  intvec * wth;
55  BOOLEAN homog;
57  {
58  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
59  e=idCopy(h1);
60  return e;
61  }
62  homog = idHomModule(h1,currRing->qideal,&wth);
64  {
65  if(!homog)
66  {
67  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
68  e=idCopy(h1);
69  return e;
70  }
71  else
72  {
73  ideal re=kMin_std(h1,currRing->qideal,(tHomog)homog,&wth,h2,NULL,0,3);
74  idDelete(&re);
75  return h2;
76  }
77  }
78  e=idInit(1,h1->rank);
79  if (idIs0(h1))
80  {
81  return e;
82  }
83  pEnlargeSet(&(e->m),IDELEMS(e),15);
84  IDELEMS(e) = 16;
85  h2 = kStd(h1,currRing->qideal,isNotHomog,NULL);
86  h3 = idMaxIdeal(1);
87  h4=idMult(h2,h3);
88  idDelete(&h3);
89  h3=kStd(h4,currRing->qideal,isNotHomog,NULL);
90  k = IDELEMS(h3);
91  while ((k > 0) && (h3->m[k-1] == NULL)) k--;
92  j = -1;
93  l = IDELEMS(h2);
94  while ((l > 0) && (h2->m[l-1] == NULL)) l--;
95  for (i=l-1; i>=0; i--)
96  {
97  if (h2->m[i] != NULL)
98  {
99  ll = 0;
100  while ((ll < k) && ((h3->m[ll] == NULL)
101  || !pDivisibleBy(h3->m[ll],h2->m[i])))
102  ll++;
103  if (ll >= k)
104  {
105  j++;
106  if (j > IDELEMS(e)-1)
107  {
108  pEnlargeSet(&(e->m),IDELEMS(e),16);
109  IDELEMS(e) += 16;
110  }
111  e->m[j] = pCopy(h2->m[i]);
112  }
113  }
114  }
115  idDelete(&h2);
116  idDelete(&h3);
117  idDelete(&h4);
118  if (currRing->qideal!=NULL)
119  {
120  h3=idInit(1,e->rank);
121  h2=kNF(h3,currRing->qideal,e);
122  idDelete(&h3);
123  idDelete(&e);
124  e=h2;
125  }
126  idSkipZeroes(e);
127  return e;
128 }

◆ idMinEmbedding()

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

Definition at line 2565 of file ideals.cc.

2566 {
2567  if (idIs0(arg)) return idInit(1,arg->rank);
2568  int i,next_gen,next_comp;
2569  ideal res=arg;
2570  if (!inPlace) res = idCopy(arg);
2571  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2572  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2573  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2574 
2575  int del=0;
2576  loop
2577  {
2578  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2579  if (next_gen<0) break;
2580  del++;
2581  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2582  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2583  if ((w !=NULL)&&(*w!=NULL))
2584  {
2585  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2586  }
2587  }
2588 
2589  idDeleteComps(res,red_comp,del);
2590  idSkipZeroes(res);
2591  omFree(red_comp);
2592 
2593  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2594  {
2595  int nl=si_max((*w)->length()-del,1);
2596  intvec *wtmp=new intvec(nl);
2597  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2598  delete *w;
2599  *w=wtmp;
2600  }
2601  return res;
2602 }

◆ 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 2010 of file ideals.cc.

2011 {
2012 
2013  const ring origR=currRing;
2014  id_Test((ideal)a, origR);
2015 
2016  const int r = a->nrows;
2017  const int c = a->ncols;
2018 
2019  if((ar<=0) || (ar>r) || (ar>c))
2020  {
2021  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
2022  return NULL;
2023  }
2024 
2025  ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
2026  long bound = sm_ExpBound(h,c,r,ar,origR);
2027  id_Delete(&h, origR);
2028 
2029  ring tmpR = sm_RingChange(origR,bound);
2030 
2031  matrix b = mpNew(r,c);
2032 
2033  for (int i=r*c-1;i>=0;i--)
2034  if (a->m[i] != NULL)
2035  b->m[i] = prCopyR(a->m[i],origR,tmpR);
2036 
2037  id_Test( (ideal)b, tmpR);
2038 
2039  if (R!=NULL)
2040  {
2041  R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
2042  //if (ar>1) // otherwise done in mpMinorToResult
2043  //{
2044  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
2045  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
2046  // idDelete((ideal*)&b); b=bb;
2047  //}
2048  id_Test( R, tmpR);
2049  }
2050 
2051 
2052  ideal result = idInit(32,1);
2053 
2054  int elems = 0;
2055 
2056  if(ar>1)
2057  mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
2058  else
2059  mp_MinorToResult(result,elems,b,r,c,R,tmpR);
2060 
2061  id_Test( (ideal)b, tmpR);
2062 
2063  id_Delete((ideal *)&b, tmpR);
2064 
2065  if (R!=NULL) id_Delete(&R,tmpR);
2066 
2068  rChangeCurrRing(origR);
2069  result = idrMoveR(result,tmpR,origR);
2070  sm_KillModifiedRing(tmpR);
2071  idTest(result);
2072  return result;
2073 }

◆ idModulo()

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

Definition at line 2254 of file ideals.cc.

2255 {
2256  intvec *wtmp=NULL;
2257 
2258  int i,k,rk,flength=0,slength,length;
2259  poly p,q;
2260 
2261  if (idIs0(h2))
2262  return idFreeModule(si_max(1,h2->ncols));
2263  if (!idIs0(h1))
2264  flength = id_RankFreeModule(h1,currRing);
2265  slength = id_RankFreeModule(h2,currRing);
2266  length = si_max(flength,slength);
2267  if (length==0)
2268  {
2269  length = 1;
2270  }
2271  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2272  if ((w!=NULL)&&((*w)!=NULL))
2273  {
2274  //Print("input weights:");(*w)->show(1);PrintLn();
2275  int d;
2276  int k;
2277  wtmp=new intvec(length+IDELEMS(h2));
2278  for (i=0;i<length;i++)
2279  ((*wtmp)[i])=(**w)[i];
2280  for (i=0;i<IDELEMS(h2);i++)
2281  {
2282  poly p=h2->m[i];
2283  if (p!=NULL)
2284  {
2285  d = p_Deg(p,currRing);
2286  k= pGetComp(p);
2287  if (slength>0) k--;
2288  d +=((**w)[k]);
2289  ((*wtmp)[i+length]) = d;
2290  }
2291  }
2292  //Print("weights:");wtmp->show(1);PrintLn();
2293  }
2294  for (i=0;i<IDELEMS(h2);i++)
2295  {
2296  temp->m[i] = pCopy(h2->m[i]);
2297  q = pOne();
2298  pSetComp(q,i+1+length);
2299  pSetmComp(q);
2300  if(temp->m[i]!=NULL)
2301  {
2302  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2303  p = temp->m[i];
2304  while (pNext(p)!=NULL) pIter(p);
2305  pNext(p) = q; // will be sorted later correctly
2306  }
2307  else
2308  temp->m[i]=q;
2309  }
2310  rk = k = IDELEMS(h2);
2311  if (!idIs0(h1))
2312  {
2313  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2314  IDELEMS(temp) += IDELEMS(h1);
2315  for (i=0;i<IDELEMS(h1);i++)
2316  {
2317  if (h1->m[i]!=NULL)
2318  {
2319  temp->m[k] = pCopy(h1->m[i]);
2320  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2321  k++;
2322  }
2323  }
2324  }
2325 
2326  ring orig_ring=currRing;
2327  ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE);
2328  rSetSyzComp(length,syz_ring);
2329  rChangeCurrRing(syz_ring);
2330  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2331  // therefore we disable OPT_RETURN_SB for modulo:
2332  // (see tr. #701)
2333  //if (TEST_OPT_RETURN_SB)
2334  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2335  //else
2336  // rSetSyzComp(length, syz_ring);
2337  ideal s_temp;
2338 
2339  if (syz_ring != orig_ring)
2340  {
2341  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2342  }
2343  else
2344  {
2345  s_temp = temp;
2346  }
2347 
2348  idTest(s_temp);
2349  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2350 
2351  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2352  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2353  {
2354  delete *w;
2355  *w=new intvec(IDELEMS(h2));
2356  for (i=0;i<IDELEMS(h2);i++)
2357  ((**w)[i])=(*wtmp)[i+length];
2358  }
2359  if (wtmp!=NULL) delete wtmp;
2360 
2361  for (i=0;i<IDELEMS(s_temp1);i++)
2362  {
2363  if ((s_temp1->m[i]!=NULL)
2364  && (((int)pGetComp(s_temp1->m[i]))<=length))
2365  {
2366  p_Delete(&(s_temp1->m[i]),currRing);
2367  }
2368  else
2369  {
2370  p_Shift(&(s_temp1->m[i]),-length,currRing);
2371  }
2372  }
2373  s_temp1->rank = rk;
2374  idSkipZeroes(s_temp1);
2375 
2376  if (syz_ring!=orig_ring)
2377  {
2378  rChangeCurrRing(orig_ring);
2379  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2380  rDelete(syz_ring);
2381  // Hmm ... here seems to be a memory leak
2382  // However, simply deleting it causes memory trouble
2383  // idDelete(&s_temp);
2384  }
2385  else
2386  {
2387  idDelete(&temp);
2388  }
2389  idTest(s_temp1);
2390  return s_temp1;
2391 }

◆ idMult()

static ideal idMult ( ideal  h1,
ideal  h2 
)
inlinestatic

hh := h1 * h2

Definition at line 83 of file ideals.h.

85 {
86  return id_Mult(h1, h2, currRing);

◆ idMultSect()

ideal idMultSect ( resolvente  arg,
int  length,
GbVariant  a = GbDefault 
)

Definition at line 421 of file ideals.cc.

422 {
423  int i,j=0,k=0,l,maxrk=-1,realrki;
424  unsigned syzComp;
425  ideal bigmat,tempstd,result;
426  poly p;
427  int isIdeal=0;
428  intvec * w=NULL;
429 
430  /* find 0-ideals and max rank -----------------------------------*/
431  for (i=0;i<length;i++)
432  {
433  if (!idIs0(arg[i]))
434  {
435  realrki=id_RankFreeModule(arg[i],currRing);
436  k++;
437  j += IDELEMS(arg[i]);
438  if (realrki>maxrk) maxrk = realrki;
439  }
440  else
441  {
442  if (arg[i]!=NULL)
443  {
444  return idInit(1,arg[i]->rank);
445  }
446  }
447  }
448  if (maxrk == 0)
449  {
450  isIdeal = 1;
451  maxrk = 1;
452  }
453  /* init -----------------------------------------------------------*/
454  j += maxrk;
455  syzComp = k*maxrk;
456 
457  ring orig_ring=currRing;
458  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
459  rSetSyzComp(syzComp,syz_ring);
460  rChangeCurrRing(syz_ring);
461 
462  bigmat = idInit(j,(k+1)*maxrk);
463  /* create unit matrices ------------------------------------------*/
464  for (i=0;i<maxrk;i++)
465  {
466  for (j=0;j<=k;j++)
467  {
468  p = pOne();
469  pSetComp(p,i+1+j*maxrk);
470  pSetmComp(p);
471  bigmat->m[i] = pAdd(bigmat->m[i],p);
472  }
473  }
474  /* enter given ideals ------------------------------------------*/
475  i = maxrk;
476  k = 0;
477  for (j=0;j<length;j++)
478  {
479  if (arg[j]!=NULL)
480  {
481  for (l=0;l<IDELEMS(arg[j]);l++)
482  {
483  if (arg[j]->m[l]!=NULL)
484  {
485  if (syz_ring==orig_ring)
486  bigmat->m[i] = pCopy(arg[j]->m[l]);
487  else
488  bigmat->m[i] = prCopyR(arg[j]->m[l], orig_ring,currRing);
489  p_Shift(&(bigmat->m[i]),k*maxrk+isIdeal,currRing);
490  i++;
491  }
492  }
493  k++;
494  }
495  }
496  /* std computation --------------------------------------------*/
497  if (alg==GbDefault) alg=GbStd;
498  if (alg==GbStd)
499  {
500  if (TEST_OPT_PROT) { PrintS("std:"); mflush(); }
501  tempstd = kStd(bigmat,currRing->qideal,testHomog,&w,NULL,syzComp);
502  if (w!=NULL) delete w;
503  idDelete(&bigmat);
504  }
505  else if (alg==GbSlimgb)
506  {
507  if (TEST_OPT_PROT) { PrintS("slimgb:"); mflush(); }
508  tempstd = t_rep_gb(currRing, bigmat, syzComp);
509  idDelete(&bigmat);
510  }
511  else if (alg==GbGroebner)
512  {
513  if (TEST_OPT_PROT) { PrintS("groebner:"); mflush(); }
514  BOOLEAN err;
515  tempstd=(ideal)iiCallLibProc1("groebner",bigmat,MODUL_CMD,err);
516  if (err)
517  {
518  Werror("error %d in >>groebner<<",err);
519  tempstd=idInit(1,1);
520  }
521  }
522 // else if (alg==GbModstd): requires ideal, not module
523 // {
524 // if (TEST_OPT_PROT) { PrintS("modstd:"); mflush(); }
525 // BOOLEAN err;
526 // tempstd=(ideal)iiCallLibProc1("modStd",bigmat,MODUL_CMD,err);
527 // if (err)
528 // {
529 // Werror("error %d in >>modStd<<",err);
530 // tempstd=idInit(1,1);
531 // }
532 // }
533  //else if (alg==GbSba): requires order C,...
534  //{
535  // if (TEST_OPT_PROT) { PrintS("sba:"); mflush(); }
536  // tempstd = kSba(bigmat,currRing->qideal,hom,w,1,0,NULL,syzComp);
537  // idDelete(&bigmat);
538  //}
539  else
540  {
541  tempstd=idInit(1,1);
542  Werror("wrong algorithm %d for SB",(int)alg);
543  }
544 
545  if(syz_ring!=orig_ring)
546  rChangeCurrRing(orig_ring);
547 
548  /* interprete result ----------------------------------------*/
549  result = idInit(IDELEMS(tempstd),maxrk);
550  k = 0;
551  for (j=0;j<IDELEMS(tempstd);j++)
552  {
553  if ((tempstd->m[j]!=NULL) && (__p_GetComp(tempstd->m[j],syz_ring)>syzComp))
554  {
555  if (syz_ring==orig_ring)
556  p = pCopy(tempstd->m[j]);
557  else
558  p = prCopyR(tempstd->m[j], syz_ring,currRing);
559  p_Shift(&p,-syzComp-isIdeal,currRing);
560  result->m[k] = p;
561  k++;
562  }
563  }
564  /* clean up ----------------------------------------------------*/
565  if(syz_ring!=orig_ring)
566  rChangeCurrRing(syz_ring);
567  idDelete(&tempstd);
568  if(syz_ring!=orig_ring)
569  {
570  rChangeCurrRing(orig_ring);
571  rDelete(syz_ring);
572  }
574  return result;
575 }

◆ idMWLift()

intvec* idMWLift ( ideal  mod,
intvec weights 
)

Definition at line 2396 of file ideals.cc.

2397 {
2398  if (idIs0(mod)) return new intvec(2);
2399  int i=IDELEMS(mod);
2400  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2401  intvec *result = new intvec(i+1);
2402  while (i>0)
2403  {
2404  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2405  }
2406  return result;
2407 }

◆ idQuot()

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

Definition at line 1479 of file ideals.cc.

1480 {
1481  // first check for special case h1:(0)
1482  if (idIs0(h2))
1483  {
1484  ideal res;
1485  if (resultIsIdeal)
1486  {
1487  res = idInit(1,1);
1488  res->m[0] = pOne();
1489  }
1490  else
1491  res = idFreeModule(h1->rank);
1492  return res;
1493  }
1494  int i, kmax;
1495  BOOLEAN addOnlyOne=TRUE;
1496  tHomog hom=isNotHomog;
1497  intvec * weights1;
1498 
1499  ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1500 
1501  hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1502 
1503  ring orig_ring=currRing;
1504  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
1505  rSetSyzComp(kmax-1,syz_ring);
1506  rChangeCurrRing(syz_ring);
1507  if (orig_ring!=syz_ring)
1508  // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1509  s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1510  idTest(s_h4);
1511  #if 0
1512  void ipPrint_MA0(matrix m, const char *name);
1513  matrix m=idModule2Matrix(idCopy(s_h4));
1514  PrintS("start:\n");
1515  ipPrint_MA0(m,"Q");
1516  idDelete((ideal *)&m);
1517  PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1518  #endif
1519  ideal s_h3;
1520  if (addOnlyOne)
1521  {
1522  BITSET old_test1;
1523  SI_SAVE_OPT1(old_test1);
1525  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1526  SI_RESTORE_OPT1(old_test1);
1527  }
1528  else
1529  {
1530  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1531  }
1532  #if 0
1533  // only together with the above debug stuff
1534  idSkipZeroes(s_h3);
1535  m=idModule2Matrix(idCopy(s_h3));
1536  Print("result, kmax=%d:\n",kmax);
1537  ipPrint_MA0(m,"S");
1538  idDelete((ideal *)&m);
1539  #endif
1540  idTest(s_h3);
1541  if (weights1!=NULL) delete weights1;
1542  idDelete(&s_h4);
1543 
1544  for (i=0;i<IDELEMS(s_h3);i++)
1545  {
1546  if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1547  {
1548  if (resultIsIdeal)
1549  p_Shift(&s_h3->m[i],-kmax,currRing);
1550  else
1551  p_Shift(&s_h3->m[i],-kmax+1,currRing);
1552  }
1553  else
1554  p_Delete(&s_h3->m[i],currRing);
1555  }
1556  if (resultIsIdeal)
1557  s_h3->rank = 1;
1558  else
1559  s_h3->rank = h1->rank;
1560  if(syz_ring!=orig_ring)
1561  {
1562  rChangeCurrRing(orig_ring);
1563  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1564  rDelete(syz_ring);
1565  }
1566  idSkipZeroes(s_h3);
1567  idTest(s_h3);
1568  return s_h3;
1569 }

◆ idSect()

ideal idSect ( ideal  h1,
ideal  h2,
GbVariant  a = GbDefault 
)

Definition at line 201 of file ideals.cc.

202 {
203  int i,j,k;
204  unsigned length;
205  int flength = id_RankFreeModule(h1,currRing);
206  int slength = id_RankFreeModule(h2,currRing);
207  int rank=si_max(h1->rank,h2->rank);
208  if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
209 
210  ideal first,second,temp,temp1,result;
211  poly p,q;
212 
213  if (IDELEMS(h1)<IDELEMS(h2))
214  {
215  first = h1;
216  second = h2;
217  }
218  else
219  {
220  first = h2;
221  second = h1;
222  int t=flength; flength=slength; slength=t;
223  }
224  length = si_max(flength,slength);
225  if (length==0)
226  {
227  if ((currRing->qideal==NULL)
228  && (currRing->OrdSgn==1)
229  && (!rIsPluralRing(currRing))
231  return idSectWithElim(first,second);
232  else length = 1;
233  }
234  if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
235  j = IDELEMS(first);
236 
237  ring orig_ring=currRing;
238  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE);
239  rSetSyzComp(length,syz_ring);
240  rChangeCurrRing(syz_ring);
241 
242  while ((j>0) && (first->m[j-1]==NULL)) j--;
243  temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
244  k = 0;
245  for (i=0;i<j;i++)
246  {
247  if (first->m[i]!=NULL)
248  {
249  if (syz_ring==orig_ring)
250  temp->m[k] = pCopy(first->m[i]);
251  else
252  temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
253  q = pOne();
254  pSetComp(q,i+1+length);
255  pSetmComp(q);
256  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
257  p = temp->m[k];
258  while (pNext(p)!=NULL) pIter(p);
259  pNext(p) = q;
260  k++;
261  }
262  }
263  for (i=0;i<IDELEMS(second);i++)
264  {
265  if (second->m[i]!=NULL)
266  {
267  if (syz_ring==orig_ring)
268  temp->m[k] = pCopy(second->m[i]);
269  else
270  temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
271  if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
272  k++;
273  }
274  }
275  intvec *w=NULL;
276  if (alg==GbDefault) alg=GbStd;
277  if (alg==GbStd)
278  {
279  if (TEST_OPT_PROT) { PrintS("std:"); mflush(); }
280  temp1 = kStd(temp,currRing->qideal,testHomog,&w,NULL,length);
281  if (w!=NULL) delete w;
282  idDelete(&temp);
283  }
284  else if (alg==GbSlimgb)
285  {
286  if (TEST_OPT_PROT) { PrintS("slimgb:"); mflush(); }
287  temp1 = t_rep_gb(currRing, temp, temp->rank);
288  idDelete(&temp);
289  }
290  else if (alg==GbGroebner)
291  {
292  if (TEST_OPT_PROT) { PrintS("groebner:"); mflush(); }
293  BOOLEAN err;
294  temp1=(ideal)iiCallLibProc1("groebner",temp,MODUL_CMD,err);
295  if (err)
296  {
297  Werror("error %d in >>groebner<<",err);
298  temp1=idInit(1,1);
299  }
300  }
301  else if (alg==GbModstd)
302  {
303  if (TEST_OPT_PROT) { PrintS("modStd:"); mflush(); }
304  BOOLEAN err;
305  void *args[]={temp,(void*)1,NULL};
306  int arg_t[]={MODUL_CMD,INT_CMD,0};
307  temp1=(ideal)iiCallLibProcM("modStd",args,arg_t,err);
308  if (err)
309  {
310  Werror("error %d in >>modStd<<",err);
311  temp1=idInit(1,1);
312  }
313  }
314  else if (alg==GbStdSat)
315  {
316  if (TEST_OPT_PROT) { PrintS("std:sat:"); mflush(); }
317  BOOLEAN err;
318  // search for 2nd block of vars
319  int i=0;
320  int block=-1;
321  loop
322  {
323  if ((currRing->order[i]!=ringorder_c)
324  && (currRing->order[i]!=ringorder_C)
325  && (currRing->order[i]!=ringorder_s))
326  {
327  if (currRing->order[i]==0) { err=TRUE;break;}
328  block++;
329  if (block==1) { block=i; break;}
330  }
331  i++;
332  }
333  if (block>0)
334  {
335  if (TEST_OPT_PROT)
336  {
337  Print("sat(%d..%d)\n",currRing->block0[block],currRing->block1[block]);
338  mflush();
339  }
340  ideal v=idInit(currRing->block1[block]-currRing->block0[block]+1,1);
341  for(i=currRing->block0[block];i<=currRing->block1[block];i++)
342  {
343  v->m[i-currRing->block0[block]]=pOne();
344  pSetExp(v->m[i-currRing->block0[block]],i,1);
345  pSetm(v->m[i-currRing->block0[block]]);
346  }
347  void *args[]={temp,v,NULL};
348  int arg_t[]={MODUL_CMD,IDEAL_CMD,0};
349  temp1=(ideal)iiCallLibProcM("satstd",args,arg_t,err);
350  }
351  if (err)
352  {
353  Werror("error %d in >>satstd<<",err);
354  temp1=idInit(1,1);
355  }
356  }
357 
358  if(syz_ring!=orig_ring)
359  rChangeCurrRing(orig_ring);
360 
361  result = idInit(IDELEMS(temp1),rank);
362  j = 0;
363  for (i=0;i<IDELEMS(temp1);i++)
364  {
365  if ((temp1->m[i]!=NULL)
366  && (__p_GetComp(temp1->m[i],syz_ring)>length))
367  {
368  if(syz_ring==orig_ring)
369  {
370  p = temp1->m[i];
371  }
372  else
373  {
374  p = prMoveR(temp1->m[i], syz_ring,orig_ring);
375  }
376  temp1->m[i]=NULL;
377  while (p!=NULL)
378  {
379  q = pNext(p);
380  pNext(p) = NULL;
381  k = pGetComp(p)-1-length;
382  pSetComp(p,0);
383  pSetmComp(p);
384  /* Warning! multiply only from the left! it's very important for Plural */
385  result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
386  p = q;
387  }
388  j++;
389  }
390  }
391  if(syz_ring!=orig_ring)
392  {
393  rChangeCurrRing(syz_ring);
394  idDelete(&temp1);
395  rChangeCurrRing(orig_ring);
396  rDelete(syz_ring);
397  }
398  else
399  {
400  idDelete(&temp1);
401  }
402 
404  if (TEST_OPT_RETURN_SB)
405  {
406  w=NULL;
407  temp1=kStd(result,currRing->qideal,testHomog,&w);
408  if (w!=NULL) delete w;
409  idDelete(&result);
410  idSkipZeroes(temp1);
411  return temp1;
412  }
413  else //temp1=kInterRed(result,currRing->qideal);
414  return result;
415 }

◆ idSeries()

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

Definition at line 2152 of file ideals.cc.

2153 {
2154  for(int i=IDELEMS(M)-1;i>=0;i--)
2155  {
2156  if(U==NULL)
2157  M->m[i]=pSeries(n,M->m[i],NULL,w);
2158  else
2159  {
2160  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
2161  MATELEM(U,i+1,i+1)=NULL;
2162  }
2163  }
2164  if(U!=NULL)
2165  idDelete((ideal*)&U);
2166  return M;
2167 }

◆ idSort()

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

Definition at line 185 of file ideals.h.

187 {
188  return id_Sort(id, nolex, currRing);

◆ idSyzygies()

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

Definition at line 730 of file ideals.cc.

732 {
733  ideal s_h1;
734  int j, k, length=0,reg;
735  BOOLEAN isMonomial=TRUE;
736  int ii, idElemens_h1;
737 
738  assume(h1 != NULL);
739 
740  idElemens_h1=IDELEMS(h1);
741 #ifdef PDEBUG
742  for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
743 #endif
744  if (idIs0(h1))
745  {
746  ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
747  return result;
748  }
749  int slength=(int)id_RankFreeModule(h1,currRing);
750  k=si_max(1,slength /*id_RankFreeModule(h1)*/);
751 
752  assume(currRing != NULL);
753  ring orig_ring=currRing;
754  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
755  if (setSyzComp) rSetSyzComp(k,syz_ring);
756 
757  if (orig_ring != syz_ring)
758  {
759  rChangeCurrRing(syz_ring);
760  s_h1=idrCopyR_NoSort(h1,orig_ring,syz_ring);
761  }
762  else
763  {
764  s_h1 = h1;
765  }
766 
767  idTest(s_h1);
768 
769  ideal s_h3=idPrepare(s_h1,h,k,w,alg); // main (syz) GB computation
770 
771  if (s_h3==NULL)
772  {
773  if (orig_ring != syz_ring)
774  {
775  rChangeCurrRing(orig_ring);
776  rDelete(syz_ring);
777  }
778  return idFreeModule( idElemens_h1 /*IDELEMS(h1)*/);
779  }
780 
781  if (orig_ring != syz_ring)
782  {
783  idDelete(&s_h1);
784  for (j=0; j<IDELEMS(s_h3); j++)
785  {
786  if (s_h3->m[j] != NULL)
787  {
788  if (p_MinComp(s_h3->m[j],syz_ring) > k)
789  p_Shift(&s_h3->m[j], -k,syz_ring);
790  else
791  p_Delete(&s_h3->m[j],syz_ring);
792  }
793  }
794  idSkipZeroes(s_h3);
795  s_h3->rank -= k;
796  rChangeCurrRing(orig_ring);
797  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
798  rDelete(syz_ring);
799  #ifdef HAVE_PLURAL
800  if (rIsPluralRing(orig_ring))
801  {
802  id_DelMultiples(s_h3,orig_ring);
803  idSkipZeroes(s_h3);
804  }
805  #endif
806  idTest(s_h3);
807  return s_h3;
808  }
809 
810  ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
811 
812  for (j=IDELEMS(s_h3)-1; j>=0; j--)
813  {
814  if (s_h3->m[j] != NULL)
815  {
816  if (p_MinComp(s_h3->m[j],syz_ring) <= k)
817  {
818  e->m[j] = s_h3->m[j];
819  isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
820  p_Delete(&pNext(s_h3->m[j]),syz_ring);
821  s_h3->m[j] = NULL;
822  }
823  }
824  }
825 
826  idSkipZeroes(s_h3);
827  idSkipZeroes(e);
828 
829  if ((deg != NULL)
830  && (!isMonomial)
832  && (setRegularity)
833  && (h==isHomog)
834  && (!rIsPluralRing(currRing))
835  && (!rField_is_Ring(currRing))
836  )
837  {
838  assume(orig_ring==syz_ring);
839  ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
840  if (dp_C_ring != syz_ring)
841  {
842  rChangeCurrRing(dp_C_ring);
843  e = idrMoveR_NoSort(e, syz_ring, dp_C_ring);
844  }
846  intvec * dummy = syBetti(res,length,&reg, *w);
847  *deg = reg+2;
848  delete dummy;
849  for (j=0;j<length;j++)
850  {
851  if (res[j]!=NULL) idDelete(&(res[j]));
852  }
853  omFreeSize((ADDRESS)res,length*sizeof(ideal));
854  idDelete(&e);
855  if (dp_C_ring != orig_ring)
856  {
857  rChangeCurrRing(orig_ring);
858  rDelete(dp_C_ring);
859  }
860  }
861  else
862  {
863  idDelete(&e);
864  }
865  assume(orig_ring==currRing);
866  idTest(s_h3);
867  if (currRing->qideal != NULL)
868  {
869  ideal ts_h3=kStd(s_h3,currRing->qideal,h,w);
870  idDelete(&s_h3);
871  s_h3 = ts_h3;
872  }
873  return s_h3;
874 }

◆ idTestHomModule()

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

Definition at line 2100 of file ideals.cc.

2101 {
2102  if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
2103  if (idIs0(m)) return TRUE;
2104 
2105  int cmax=-1;
2106  int i;
2107  poly p=NULL;
2108  int length=IDELEMS(m);
2109  polyset P=m->m;
2110  for (i=length-1;i>=0;i--)
2111  {
2112  p=P[i];
2113  if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
2114  }
2115  if (w != NULL)
2116  if (w->length()+1 < cmax)
2117  {
2118  // Print("length: %d - %d \n", w->length(),cmax);
2119  return FALSE;
2120  }
2121 
2122  if(w!=NULL)
2124 
2125  for (i=length-1;i>=0;i--)
2126  {
2127  p=P[i];
2128  if (p!=NULL)
2129  {
2130  int d=currRing->pFDeg(p,currRing);
2131  loop
2132  {
2133  pIter(p);
2134  if (p==NULL) break;
2135  if (d!=currRing->pFDeg(p,currRing))
2136  {
2137  //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
2138  if(w!=NULL)
2140  return FALSE;
2141  }
2142  }
2143  }
2144  }
2145 
2146  if(w!=NULL)
2148 
2149  return TRUE;
2150 }

◆ idVec2Ideal()

static ideal idVec2Ideal ( poly  vec)
inlinestatic

Definition at line 170 of file ideals.h.

172 {
173  return id_Vec2Ideal(vec, currRing);

◆ idXXX()

ideal idXXX ( ideal  h1,
int  k 
)

Definition at line 878 of file ideals.cc.

879 {
880  ideal s_h1;
881  intvec *w=NULL;
882 
883  assume(currRing != NULL);
884  ring orig_ring=currRing;
885  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE);
886  rSetSyzComp(k,syz_ring);
887  rChangeCurrRing(syz_ring);
888 
889  if (orig_ring != syz_ring)
890  {
891  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
892  }
893  else
894  {
895  s_h1 = h1;
896  }
897 
898  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
899 
900  if (s_h3==NULL)
901  {
902  return idFreeModule(IDELEMS(h1));
903  }
904 
905  if (orig_ring != syz_ring)
906  {
907  idDelete(&s_h1);
908  idSkipZeroes(s_h3);
909  rChangeCurrRing(orig_ring);
910  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
911  rDelete(syz_ring);
912  idTest(s_h3);
913  return s_h3;
914  }
915 
916  idSkipZeroes(s_h3);
917  idTest(s_h3);
918  return s_h3;
919 }

◆ syGetAlgorithm()

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

Definition at line 3030 of file ideals.cc.

3031 {
3032  GbVariant alg=GbDefault;
3033  if (strcmp(n,"slimgb")==0) alg=GbSlimgb;
3034  else if (strcmp(n,"std")==0) alg=GbStd;
3035  else if (strcmp(n,"sba")==0) alg=GbSba;
3036  else if (strcmp(n,"singmatic")==0) alg=GbSingmatic;
3037  else if (strcmp(n,"groebner")==0) alg=GbGroebner;
3038  else if (strcmp(n,"modstd")==0) alg=GbModstd;
3039  else if (strcmp(n,"ffmod")==0) alg=GbFfmod;
3040  else if (strcmp(n,"nfmod")==0) alg=GbNfmod;
3041  else if (strcmp(n,"std:sat")==0) alg=GbStdSat;
3042  else Warn(">>%s<< is an unknown algorithm",n);
3043 
3044  if (alg==GbSlimgb) // test conditions for slimgb
3045  {
3046  if(rHasGlobalOrdering(r)
3047  &&(!rIsPluralRing(r))
3048  &&(r->qideal==NULL)
3049  &&(!rField_is_Ring(r)))
3050  {
3051  return GbSlimgb;
3052  }
3053  if (TEST_OPT_PROT)
3054  WarnS("requires: coef:field, commutative, global ordering, not qring");
3055  }
3056  else if (alg==GbSba) // cond. for sba
3057  {
3058  if(rField_is_Domain(r)
3059  &&(!rIsPluralRing(r))
3060  &&(rHasGlobalOrdering(r)))
3061  {
3062  return GbSba;
3063  }
3064  if (TEST_OPT_PROT)
3065  WarnS("requires: coef:domain, commutative, global ordering");
3066  }
3067  else if (alg==GbGroebner) // cond. for groebner
3068  {
3069  return GbGroebner;
3070  }
3071  else if(alg==GbModstd) // cond for modstd: Q or Q(a)
3072  {
3073  if(ggetid("modStd")==NULL)
3074  {
3075  WarnS(">>modStd<< not found");
3076  }
3077  else if(rField_is_Q(r)
3078  &&(!rIsPluralRing(r))
3079  &&(rHasGlobalOrdering(r)))
3080  {
3081  return GbModstd;
3082  }
3083  if (TEST_OPT_PROT)
3084  WarnS("requires: coef:QQ, commutative, global ordering");
3085  }
3086  else if(alg==GbStdSat) // cond for std:sat: 2 blocks of variables
3087  {
3088  if(ggetid("satstd")==NULL)
3089  {
3090  WarnS(">>satstd<< not found");
3091  }
3092  else
3093  {
3094  return GbStdSat;
3095  }
3096  }
3097 
3098  return GbStd; // no conditions for std
3099 }
id_FreeModule
ideal id_FreeModule(int i, const ring r)
the free module of rank i
Definition: simpleideals.cc:934
rHasGlobalOrdering
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
pDivisibleBy
#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:132
FALSE
#define FALSE
Definition: auxiliary.h:94
id_HomModule
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
Definition: simpleideals.cc:1330
idCopy
ideal idCopy(ideal A)
Definition: ideals.h:59
wFunctionalBuch
double wFunctionalBuch(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight0.c:77
p_DegW
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:681
ip_smatrix
Definition: matpol.h:13
kGroebner
ideal kGroebner(ideal F, ideal Q)
Definition: ipshell.cc:6225
rAssure_SyzComp
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4366
pGetComp
#define pGetComp(p)
Component.
Definition: polys.h:36
TEST_OPT_NOTREGULARITY
#define TEST_OPT_NOTREGULARITY
Definition: options.h:117
p_GetExp
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:458
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
pMinComp
#define pMinComp(p)
Definition: polys.h:282
omFree
#define omFree(addr)
Definition: omAllocDecl.h:259
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:101
id_Matrix2Module
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
Definition: simpleideals.cc:1166
k
int k
Definition: cfEzgcd.cc:92
idDelete
#define idDelete(H)
delete an ideal
Definition: ideals.h:28
idrCopyR_NoSort
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
x
Variable x
Definition: cfModGcd.cc:4023
ppMult_mm
#define ppMult_mm(p, m)
Definition: polys.h:188
MATELEM
#define MATELEM(mat, i, j)
Definition: matpol.h:28
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:477
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition: polys.cc:15
result
return result
Definition: facAbsBiFact.cc:76
kMin_std
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2672
polyset
poly * polyset
Definition: polys.h:243
idHomIdeal
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:90
pGetExp
#define pGetExp(p, i)
Exponent.
Definition: polys.h:40
idrMoveR_NoSort
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3644
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
MODUL_CMD
Definition: grammar.cc:287
ringorder_ws
Definition: ring.h:86
p_Var
int p_Var(poly m, const ring r)
Definition: p_polys.cc:4550
p_Head
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:811
GbStd
Definition: ideals.h:121
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
BITSET
#define BITSET
Definition: structs.h:17
isNotHomog
Definition: structs.h:38
nc_exterior
Definition: nc.h:21
ppJetW
#define ppJetW(p, m, iv)
Definition: polys.h:351
id_InsertPolyWithTests
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:
Definition: simpleideals.cc:685
idPrepare
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition: ideals.cc:582
syBetti
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:771
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
singclap_pdivide
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:556
SI_SAVE_OPT1
#define SI_SAVE_OPT1(A)
Definition: options.h:21
g
g
Definition: cfModGcd.cc:4031
__p_GetComp
#define __p_GetComp(p, r)
Definition: monomials.h:61
mp_RecMin
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:1605
mod
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
pNeg
#define pNeg(p)
Definition: polys.h:185
nc_rComplete
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5537
GbSingmatic
Definition: ideals.h:130
idTest
#define idTest(id)
Definition: ideals.h:46
pDelete
#define pDelete(p_ptr)
Definition: polys.h:174
N
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:48
iiCallLibProcM
void * iiCallLibProcM(const char *n, void **args, int *arg_types, BOOLEAN &err)
args: NULL terminated arry of arguments arg_types: 0 terminated array of corresponding types
Definition: iplib.cc:646
id_Shift
void id_Shift(ideal M, int s, const ring r)
Definition: simpleideals.cc:1845
sm_RingChange
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc:258
testHomog
Definition: structs.h:40
pWeight
#define pWeight(i)
Definition: polys.h:262
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:767
loop
#define loop
Definition: structs.h:77
pMult
#define pMult(p, q)
Definition: polys.h:194
pSetComp
#define pSetComp(p, v)
Definition: polys.h:37
pJet
#define pJet(p, m)
Definition: polys.h:350
w
const CanonicalForm & w
Definition: facAbsFact.cc:55
b
CanonicalForm b
Definition: cfModGcd.cc:4044
GbModstd
Definition: ideals.h:126
id_HomIdeal
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
Definition: simpleideals.cc:805
tHomog
tHomog
Definition: structs.h:36
ringorder_C
Definition: ring.h:73
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1339
prMoveR
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
TEST_V_INTERSECT_ELIM
#define TEST_V_INTERSECT_ELIM
Definition: options.h:140
mp_MinorToResult
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:1509
rAssure_SyzOrder
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4361
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:798
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
id_Sort
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
Definition: simpleideals.cc:502
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:581
p_MinComp
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:305
TRUE
#define TRUE
Definition: auxiliary.h:98
i
int i
Definition: cfEzgcd.cc:125
ip_smatrix::nrows
int nrows
Definition: matpol.h:20
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: simpleideals.cc:113
res
CanonicalForm res
Definition: facAbsFact.cc:64
INT_CMD
Definition: tok.h:95
idrMoveR
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
block
#define block
Definition: scanner.cc:664
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition: simpleideals.cc:781
Sy_bit
#define Sy_bit(x)
Definition: options.h:31
M
#define M
Definition: sirandom.c:24
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
ppJet
#define ppJet(p, m)
Definition: polys.h:349
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:85
rAssure_dp_C
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4884
pTest
#define pTest(p)
Definition: polys.h:396
t_rep_gb
ideal t_rep_gb(const ring r, ideal arg_I, int syz_comp, BOOLEAN F4_mode)
Definition: tgb.cc:3520
binom
int binom(int n, int r)
Definition: simpleideals.cc:912
T
static jList * T
Definition: janet.cc:31
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:171
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:474
p_DivideM
poly p_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1537
omMemDup
#define omMemDup(s)
Definition: omAllocDecl.h:262
resolvente
ideal * resolvente
Definition: ideals.h:17
IDEAL_CMD
Definition: grammar.cc:284
h
static Poly * h
Definition: janet.cc:972
ip_smatrix::m
poly * m
Definition: matpol.h:18
id_DelMultiples
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
Definition: simpleideals.cc:255
GbNfmod
Definition: ideals.h:128
pOne
#define pOne()
Definition: polys.h:297
p_Farey
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:52
poly_sort::index
int index
Definition: ideals.cc:2817
intvec
Definition: intvec.h:16
isHomog
Definition: structs.h:39
pIter
#define pIter(p)
Definition: monomials.h:35
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
poly_sort
Definition: ideals.cc:2814
GbStdSat
Definition: ideals.h:129
idInitializeQuot
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition: ideals.cc:1374
wFunctional
double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:25
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:854
sm_KillModifiedRing
void sm_KillModifiedRing(ring r)
Definition: sparsmat.cc:289
pMaxComp
#define pMaxComp(p)
Definition: polys.h:281
GbSba
Definition: ideals.h:123
syGaussForOne
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:219
id_sat_vars_sp
static BOOLEAN id_sat_vars_sp(kStrategy strat)
Definition: ideals.cc:2873
pJetW
#define pJetW(p, m, iv)
Definition: polys.h:352
wCall
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:113
GbDefault
Definition: ideals.h:119
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2821
TEST_OPT_RETURN_SB
#define TEST_OPT_RETURN_SB
Definition: options.h:110
idSectWithElim
ideal idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:131
mpNew
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:36
pAdd
#define pAdd(p, q)
Definition: polys.h:190
p_Shift
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4600
ringorder_c
Definition: ring.h:72
idDeleteComps
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2538
idSort_qsort
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2825
ringorder_dp
Definition: ring.h:78
GbFfmod
Definition: ideals.h:127
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:436
p_Deg
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:578
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:878
divide
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
Definition: facAlgFuncUtil.cc:500
pDiff
#define pDiff(a, b)
Definition: polys.h:278
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
pSetmComp
#define pSetmComp(p)
TODO:
Definition: polys.h:256
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:832
ipPrint_MA0
void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:57
idCreateSpecialKbase
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2413
SI_RESTORE_OPT2
#define SI_RESTORE_OPT2(A)
Definition: options.h:25
ringorder_a
Definition: ring.h:70
Print
#define Print
Definition: emacs.cc:79
id_Vec2Ideal
ideal id_Vec2Ideal(poly vec, const ring R)
Definition: simpleideals.cc:1134
rSetSyzComp
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4990
GbGroebner
Definition: ideals.h:125
Werror
void Werror(const char *fmt,...)
Definition: reporter.cc:188
idFreeModule
ideal idFreeModule(int i)
Definition: ideals.h:110
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
idHomModule
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:95
name
char name(const Variable &v)
Definition: factory.h:180
WerrorS
void WerrorS(const char *s)
Definition: feFopen.cc:24
pEqualPolys
#define pEqualPolys(p1, p2)
Definition: polys.h:382
ringorder_s
s?
Definition: ring.h:76
m
int m
Definition: cfEzgcd.cc:121
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:27
pDiffOp
#define pDiffOp(a, b, m)
Definition: polys.h:279
WarnS
#define WarnS
Definition: emacs.cc:77
assume
#define assume(x)
Definition: mod2.h:384
ip_smatrix::rank
long rank
Definition: matpol.h:19
NULL
#define NULL
Definition: omList.c:9
kSba
ideal kSba(ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2267
p_TakeOutComp
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3443
p_SetModDeg
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3621
GbSlimgb
Definition: ideals.h:122
pSetm
#define pSetm(p)
Definition: polys.h:254
idSyzygies
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:730
mflush
#define mflush()
Definition: reporter.h:56
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:239
l
int l
Definition: cfEzgcd.cc:93
id_ReadOutPivot
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
Definition: simpleideals.cc:1490
prMoveR_NoSort
poly prMoveR_NoSort(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:101
id_CopyFirstK
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 (...
Definition: simpleideals.cc:225
OPT_SB_1
#define OPT_SB_1
Definition: options.h:93
R
#define R
Definition: sirandom.c:26
id_Mult
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...
Definition: simpleideals.cc:726
idMult
static ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition: ideals.h:83
iiCallLibProc1
void * iiCallLibProc1(const char *n, void *arg, int arg_type, BOOLEAN &err)
Definition: iplib.cc:612
nc_skew
Definition: nc.h:16
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:225
Warn
#define Warn
Definition: emacs.cc:76
pSetExp
#define pSetExp(p, i, v)
Definition: polys.h:41
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
id_satstdSaturatingVariables
static int * id_satstdSaturatingVariables
Definition: ideals.cc:2871
ringorder_wp
Definition: ring.h:81
p_IncrExp
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:580
ip_smatrix::ncols
int ncols
Definition: matpol.h:21
p
int p
Definition: cfModGcd.cc:4019
idSimpleAdd
#define idSimpleAdd(A, B)
Definition: ideals.h:41
pSeries
#define pSeries(n, p, u, w)
Definition: polys.h:354
ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:91
poly_sort::p
poly p
Definition: ideals.cc:2816
ggetid
idhdl ggetid(const char *n)
Definition: ipid.cc:522
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:173
SI_RESTORE_OPT1
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
sm_ExpBound
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition: sparsmat.cc:188
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:24
pNormalize
#define pNormalize(p)
Definition: polys.h:299
kStd
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:2086
Q
#define Q
Definition: sirandom.c:25
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition: simpleideals.cc:403
sySchreyerResolvente
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:855
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:65
id_Add
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2
Definition: simpleideals.cc:713
id_Transp
ideal id_Transp(ideal a, const ring rRing)
transpose a module
Definition: simpleideals.cc:1663
PrintLn
void PrintLn()
Definition: reporter.cc:309
nc_CheckSubalgebra
BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r)
Definition: old.gring.cc:2568
mp_Copy
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:63
id_Test
#define id_Test(A, lR)
Definition: simpleideals.h:79
MATROWS
#define MATROWS(i)
Definition: matpol.h:26
TEST_V_INTERSECT_SYZ
#define TEST_V_INTERSECT_SYZ
Definition: options.h:141
GbVariant
GbVariant
Definition: ideals.h:117
index
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:585
pSub
#define pSub(a, b)
Definition: polys.h:269
A
#define A
Definition: sirandom.c:23
SI_SAVE_OPT2
#define SI_SAVE_OPT2(A)
Definition: options.h:22
rRingOrder_t
rRingOrder_t
order stuff
Definition: ring.h:67
pNext
#define pNext(p)
Definition: monomials.h:34
pReverse
static poly pReverse(poly p)
Definition: p_polys.h:327
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
idDecompose
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2467
prCopyR
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:35
V_IDLIFT
#define V_IDLIFT
Definition: options.h:61
si_opt_2
unsigned si_opt_2
Definition: options.c:6
idPrepareStd
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:1079
idrCopyR
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
id_IsZeroDim
BOOLEAN id_IsZeroDim(ideal I, const ring r)
Definition: simpleideals.cc:1614
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:496
vec
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
rComplete
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:3368
wrp
void wrp(poly p)
Definition: polys.h:292
p_Weight
int p_Weight(int i, const ring r)
Definition: p_polys.cc:696
idMaxIdeal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:32
si_opt_1
unsigned si_opt_1
Definition: options.c:5