My Project  debian-1:4.1.2-p1+ds-2
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 submod, 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 921 of file simpleideals.cc.

923 {
924  int i,result;
925 
926  if (r==0) return 1;
927  if (n-r<r) return binom(n,n-r);
928  result = n-r+1;
929  for (i=2;i<=r;i++)
930  {
931  result *= n-r+i;
932  if (result<0)
933  {
934  WarnS("overflow in binomials");
935  return 0;
936  }
937  result /= i;
938  }
939  return result;

◆ id_Copy()

ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 412 of file simpleideals.cc.

414 {
415  id_Test(h1, r);
416 
417  ideal h2 = idInit(IDELEMS(h1), h1->rank);
418  for (int i=IDELEMS(h1)-1; i>=0; i--)
419  h2->m[i] = p_Copy(h1->m[i],r);
420  return h2;

◆ id_Farey()

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

Definition at line 2723 of file ideals.cc.

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

◆ id_GCD()

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

Definition at line 2620 of file ideals.cc.

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

◆ id_Satstd()

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

Definition at line 2981 of file ideals.cc.

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

◆ id_TensorModuleMult()

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

Definition at line 1789 of file simpleideals.cc.

1791 {
1792 // #ifdef DEBU
1793 // WarnS("tensorModuleMult!!!!");
1794 
1795  assume(m > 0);
1796  assume(M != NULL);
1797 
1798  const int n = rRing->N;
1799 
1800  assume(M->rank <= m * n);
1801 
1802  const int k = IDELEMS(M);
1803 
1804  ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
1805 
1806  for( int i = 0; i < k; i++ ) // for every w \in M
1807  {
1808  poly pTempSum = NULL;
1809 
1810  poly w = M->m[i];
1811 
1812  while(w != NULL) // for each term of w...
1813  {
1814  poly h = p_Head(w, rRing);
1815 
1816  const int gen = __p_GetComp(h, rRing); // 1 ...
1817 
1818  assume(gen > 0);
1819  assume(gen <= n*m);
1820 
1821  // TODO: write a formula with %, / instead of while!
1822  /*
1823  int c = gen;
1824  int v = 1;
1825  while(c > m)
1826  {
1827  c -= m;
1828  v++;
1829  }
1830  */
1831 
1832  int cc = gen % m;
1833  if( cc == 0) cc = m;
1834  int vv = 1 + (gen - cc) / m;
1835 
1836 // assume( cc == c );
1837 // assume( vv == v );
1838 
1839  // 1<= c <= m
1840  assume( cc > 0 );
1841  assume( cc <= m );
1842 
1843  assume( vv > 0 );
1844  assume( vv <= n );
1845 
1846  assume( (cc + (vv-1)*m) == gen );
1847 
1848  p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
1849  p_SetComp(h, cc, rRing);
1850 
1851  p_Setm(h, rRing); // addjust degree after the previous steps!
1852 
1853  pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
1854 
1855  pIter(w);
1856  }
1857 
1858  idTemp->m[i] = pTempSum;
1859  }
1860 
1861  // simplify idTemp???
1862 
1863  ideal idResult = id_Transp(idTemp, rRing);
1864 
1865  id_Delete(&idTemp, rRing);
1866 
1867  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 2496 of file ideals.cc.

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

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

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

◆ idDiff()

matrix idDiff ( matrix  i,
int  k 
)

Definition at line 2166 of file ideals.cc.

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

◆ idDiffOp()

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

Definition at line 2179 of file ideals.cc.

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

◆ idElimination()

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

Definition at line 1571 of file ideals.cc.

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

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

865 {
866  int i = r-1,j;
867  while ((i >= 0) && (choise[i] == end))
868  {
869  i--;
870  end--;
871  }
872  if (i == -1)
873  *endch = TRUE;
874  else
875  {
876  choise[i]++;
877  for (j=i+1; j<r; j++)
878  {
879  choise[j] = choise[i]+j-i;
880  }
881  *endch = FALSE;
882  }

◆ idGetNumberOfChoise()

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

Definition at line 889 of file simpleideals.cc.

891 {
892  int * localchoise,i,result=0;
893  BOOLEAN b=FALSE;
894 
895  if (d<=1) return 1;
896  localchoise=(int*)omAlloc((d-1)*sizeof(int));
897  idInitChoise(d-1,begin,end,&b,localchoise);
898  while (!b)
899  {
900  result++;
901  i = 0;
902  while ((i<t) && (localchoise[i]==choise[i])) i++;
903  if (i>=t)
904  {
905  i = t+1;
906  while ((i<d) && (localchoise[i-1]==choise[i])) i++;
907  if (i>=d)
908  {
909  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
910  return result;
911  }
912  }
913  idGetNextChoise(d-1,end,&b,localchoise);
914  }
915  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
916  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 841 of file simpleideals.cc.

843 {
844  /*returns the first choise of r numbers between beg and end*/
845  int i;
846  for (i=0; i<r; i++)
847  {
848  choise[i] = 0;
849  }
850  if (r <= end-beg+1)
851  for (i=0; i<r; i++)
852  {
853  choise[i] = beg+i;
854  }
855  if (r > end-beg+1)
856  *endch = TRUE;
857  else
858  *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 648 of file simpleideals.cc.

650 {
651  if (h2==NULL) return FALSE;
652  assume (h1 != NULL);
653 
654  int j = IDELEMS(h1) - 1;
655 
656  while ((j >= 0) && (h1->m[j] == NULL)) j--;
657  j++;
658  if (j==IDELEMS(h1))
659  {
660  pEnlargeSet(&(h1->m),IDELEMS(h1),16);
661  IDELEMS(h1)+=16;
662  }
663  h1->m[j]=h2;
664  return TRUE;

◆ idInsertPolyOnPos()

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

insert p into I on position pos

Definition at line 667 of file simpleideals.cc.

669 {
670  if (p==NULL) return FALSE;
671  assume (I != NULL);
672 
673  int j = IDELEMS(I) - 1;
674 
675  while ((j >= 0) && (I->m[j] == NULL)) j--;
676  j++;
677  if (j==IDELEMS(I))
678  {
679  pEnlargeSet(&(I->m),IDELEMS(I),IDELEMS(I)+1);
680  IDELEMS(I)+=1;
681  }
682  for(j = IDELEMS(I)-1;j>pos;j--)
683  I->m[j] = I->m[j-1];
684  I->m[pos]=p;
685  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 776 of file simpleideals.cc.

778 {
779  assume (h != NULL); // will fail :(
780 // if (h == NULL) return TRUE;
781 
782  for( int i = IDELEMS(h)-1; i >= 0; i-- )
783  if(h->m[i] != NULL)
784  return FALSE;
785 
786  return TRUE;
787 

◆ idIsSubModule()

BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 2076 of file ideals.cc.

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

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

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

◆ idLift()

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

Definition at line 1111 of file ideals.cc.

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

◆ idLiftStd()

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

Definition at line 923 of file ideals.cc.

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

◆ idLiftW()

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

Definition at line 1306 of file ideals.cc.

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

◆ idMinBase()

ideal idMinBase ( ideal  h1)

Definition at line 47 of file ideals.cc.

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

◆ idMinEmbedding()

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

Definition at line 2562 of file ideals.cc.

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

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

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

◆ idModulo()

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

Definition at line 2251 of file ideals.cc.

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

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

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

◆ idMWLift()

intvec* idMWLift ( ideal  mod,
intvec weights 
)

Definition at line 2393 of file ideals.cc.

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

◆ idQuot()

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

Definition at line 1476 of file ideals.cc.

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

◆ idSect()

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

Definition at line 199 of file ideals.cc.

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

◆ idSeries()

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

Definition at line 2149 of file ideals.cc.

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

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

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

◆ idTestHomModule()

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

Definition at line 2097 of file ideals.cc.

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

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

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

◆ syGetAlgorithm()

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

Definition at line 3027 of file ideals.cc.

3028 {
3029  GbVariant alg=GbDefault;
3030  if (strcmp(n,"slimgb")==0) alg=GbSlimgb;
3031  else if (strcmp(n,"std")==0) alg=GbStd;
3032  else if (strcmp(n,"sba")==0) alg=GbSba;
3033  else if (strcmp(n,"singmatic")==0) alg=GbSingmatic;
3034  else if (strcmp(n,"groebner")==0) alg=GbGroebner;
3035  else if (strcmp(n,"modstd")==0) alg=GbModstd;
3036  else if (strcmp(n,"ffmod")==0) alg=GbFfmod;
3037  else if (strcmp(n,"nfmod")==0) alg=GbNfmod;
3038  else if (strcmp(n,"std:sat")==0) alg=GbStdSat;
3039  else Warn(">>%s<< is an unknown algorithm",n);
3040 
3041  if (alg==GbSlimgb) // test conditions for slimgb
3042  {
3043  if(rHasGlobalOrdering(r)
3044  &&(!rIsPluralRing(r))
3045  &&(r->qideal==NULL)
3046  &&(!rField_is_Ring(r)))
3047  {
3048  return GbSlimgb;
3049  }
3050  if (TEST_OPT_PROT)
3051  WarnS("requires: coef:field, commutative, global ordering, not qring");
3052  }
3053  else if (alg==GbSba) // cond. for sba
3054  {
3055  if(rField_is_Domain(r)
3056  &&(!rIsPluralRing(r))
3057  &&(rHasGlobalOrdering(r)))
3058  {
3059  return GbSba;
3060  }
3061  if (TEST_OPT_PROT)
3062  WarnS("requires: coef:domain, commutative, global ordering");
3063  }
3064  else if (alg==GbGroebner) // cond. for groebner
3065  {
3066  return GbGroebner;
3067  }
3068  else if(alg==GbModstd) // cond for modstd: Q or Q(a)
3069  {
3070  if(ggetid("modStd")==NULL)
3071  {
3072  WarnS(">>modStd<< not found");
3073  }
3074  else if(rField_is_Q(r)
3075  &&(!rIsPluralRing(r))
3076  &&(rHasGlobalOrdering(r)))
3077  {
3078  return GbModstd;
3079  }
3080  if (TEST_OPT_PROT)
3081  WarnS("requires: coef:QQ, commutative, global ordering");
3082  }
3083  else if(alg==GbStdSat) // cond for std:sat: 2 blocks of variables
3084  {
3085  if(ggetid("satstd")==NULL)
3086  {
3087  WarnS(">>satstd<< not found");
3088  }
3089  else
3090  {
3091  return GbStdSat;
3092  }
3093  }
3094 
3095  return GbStd; // no conditions for std
3096 }
id_FreeModule
ideal id_FreeModule(int i, const ring r)
the free module of rank i
Definition: simpleideals.cc:943
rHasGlobalOrdering
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:753
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:96
id_HomModule
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
Definition: simpleideals.cc:1403
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:679
ip_smatrix
Definition: matpol.h:13
kGroebner
ideal kGroebner(ideal F, ideal Q)
Definition: ipshell.cc:6230
rAssure_SyzComp
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4395
pGetComp
#define pGetComp(p)
Component.
Definition: polys.h:36
TEST_OPT_NOTREGULARITY
#define TEST_OPT_NOTREGULARITY
Definition: options.h:116
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:456
j
int j
Definition: facHensel.cc:105
f
FILE * f
Definition: checklibs.c:9
pMinComp
#define pMinComp(p)
Definition: polys.h:284
omFree
#define omFree(addr)
Definition: omAllocDecl.h:259
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition: options.h:100
id_Matrix2Module
ideal id_Matrix2Module(matrix mat, const ring R)
converts mat to module, destroys mat
Definition: simpleideals.cc:1239
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:204
x
Variable x
Definition: cfModGcd.cc:4023
ppMult_mm
#define ppMult_mm(p, m)
Definition: polys.h:189
MATELEM
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:481
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:2674
polyset
poly * polyset
Definition: polys.h:244
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:260
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3653
ADDRESS
void * ADDRESS
Definition: auxiliary.h:135
si_opt_1
VAR unsigned si_opt_1
Definition: options.c:5
MODUL_CMD
Definition: grammar.cc:287
ringorder_ws
Definition: ring.h:85
p_Var
int p_Var(poly m, const ring r)
Definition: p_polys.cc:4558
h
STATIC_VAR Poly * h
Definition: janet.cc:971
p_Head
static poly p_Head(poly p, const ring r)
copy the i(leading) term of p
Definition: p_polys.h:810
GbStd
Definition: ideals.h:121
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
BITSET
#define BITSET
Definition: structs.h:19
isNotHomog
Definition: structs.h:40
nc_exterior
Definition: nc.h:21
ppJetW
#define ppJetW(p, m, iv)
Definition: polys.h:353
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:694
idPrepare
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w, GbVariant alg)
Definition: ideals.cc:580
syBetti
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:770
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:557
SI_SAVE_OPT1
#define SI_SAVE_OPT1(A)
Definition: options.h:20
g
g
Definition: cfModGcd.cc:4031
__p_GetComp
#define __p_GetComp(p, r)
Definition: monomials.h:60
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:1602
mod
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
pNeg
#define pNeg(p)
Definition: polys.h:186
nc_rComplete
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5533
GbSingmatic
Definition: ideals.h:130
idTest
#define idTest(id)
Definition: ideals.h:46
sValAssign_sys::arg
short arg
Definition: gentable.cc:107
pDelete
#define pDelete(p_ptr)
Definition: polys.h:175
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:647
id_Shift
void id_Shift(ideal M, int s, const ring r)
Definition: simpleideals.cc:1918
sm_RingChange
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc:257
testHomog
Definition: structs.h:42
pWeight
#define pWeight(i)
Definition: polys.h:264
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition: simpleideals.cc:776
loop
#define loop
Definition: structs.h:79
pMult
#define pMult(p, q)
Definition: polys.h:195
pSetComp
#define pSetComp(p, v)
Definition: polys.h:37
pJet
#define pJet(p, m)
Definition: polys.h:352
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:814
tHomog
tHomog
Definition: structs.h:38
ringorder_C
Definition: ring.h:72
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1364
prMoveR
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:89
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:396
TEST_V_INTERSECT_ELIM
#define TEST_V_INTERSECT_ELIM
Definition: options.h:139
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:1506
rAssure_SyzOrder
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4390
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:796
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:511
rVar
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:586
p_MinComp
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:303
TRUE
#define TRUE
Definition: auxiliary.h:100
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:122
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:247
block
#define block
Definition: scanner.cc:665
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:790
Sy_bit
#define Sy_bit(x)
Definition: options.h:30
M
#define M
Definition: sirandom.c:25
PrintS
void PrintS(const char *s)
Definition: reporter.cc:283
ppJet
#define ppJet(p, m)
Definition: polys.h:351
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
BOOLEAN
int BOOLEAN
Definition: auxiliary.h:87
rAssure_dp_C
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4899
pTest
#define pTest(p)
Definition: polys.h:398
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:921
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:180
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:478
p_DivideM
poly p_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1557
omMemDup
#define omMemDup(s)
Definition: omAllocDecl.h:262
resolvente
ideal * resolvente
Definition: ideals.h:17
IDEAL_CMD
Definition: grammar.cc:284
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:264
GbNfmod
Definition: ideals.h:128
pOne
#define pOne()
Definition: polys.h:299
p_Farey
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:50
poly_sort::index
int index
Definition: ideals.cc:2814
intvec
Definition: intvec.h:18
isHomog
Definition: structs.h:41
Q
STATIC_VAR jList * Q
Definition: janet.cc:30
pIter
#define pIter(p)
Definition: monomials.h:34
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
poly_sort
Definition: ideals.cc:2811
T
STATIC_VAR jList * T
Definition: janet.cc:30
GbStdSat
Definition: ideals.h:129
idInitializeQuot
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition: ideals.cc:1371
idGetNextChoise
void idGetNextChoise(int r, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:863
sm_KillModifiedRing
void sm_KillModifiedRing(ring r)
Definition: sparsmat.cc:288
wFunctional
THREAD_VAR double(* wFunctional)(int *degw, int *lpol, int npol, double *rel, double wx, double wNsqr)
Definition: weight.cc:19
pMaxComp
#define pMaxComp(p)
Definition: polys.h:283
GbSba
Definition: ideals.h:123
syGaussForOne
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:218
id_sat_vars_sp
static BOOLEAN id_sat_vars_sp(kStrategy strat)
Definition: ideals.cc:2870
pJetW
#define pJetW(p, m, iv)
Definition: polys.h:354
wCall
void wCall(poly *s, int sl, int *x, double wNsqr, const ring R)
Definition: weight.cc:107
GbDefault
Definition: ideals.h:119
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2823
TEST_OPT_RETURN_SB
#define TEST_OPT_RETURN_SB
Definition: options.h:109
idSectWithElim
ideal idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:129
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:191
p_Shift
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4608
ringorder_c
Definition: ring.h:71
id_satstdSaturatingVariables
STATIC_VAR int * id_satstdSaturatingVariables
Definition: ideals.cc:2868
idDeleteComps
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2535
idSort_qsort
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2822
ringorder_dp
Definition: ring.h:77
GbFfmod
Definition: ideals.h:127
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:447
p_Deg
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:576
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:845
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:880
divide
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
Definition: facAlgFuncUtil.cc:500
pDiff
#define pDiff(a, b)
Definition: polys.h:280
si_max
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
bound
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
pSetmComp
#define pSetmComp(p)
TODO:
Definition: polys.h:258
idInitChoise
void idInitChoise(int r, int beg, int end, BOOLEAN *endch, int *choise)
Definition: simpleideals.cc:841
ipPrint_MA0
void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:56
idCreateSpecialKbase
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2410
SI_RESTORE_OPT2
#define SI_RESTORE_OPT2(A)
Definition: options.h:24
ringorder_a
Definition: ring.h:69
Print
#define Print
Definition: emacs.cc:79
id_Vec2Ideal
ideal id_Vec2Ideal(poly vec, const ring R)
Definition: simpleideals.cc:1207
rSetSyzComp
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:5005
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:34
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:384
ringorder_s
s?
Definition: ring.h:75
m
int m
Definition: cfEzgcd.cc:121
MATCOLS
#define MATCOLS(i)
Definition: matpol.h:27
pDiffOp
#define pDiffOp(a, b, m)
Definition: polys.h:281
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:11
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:2272
p_TakeOutComp
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3452
p_SetModDeg
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3630
GbSlimgb
Definition: ideals.h:122
pSetm
#define pSetm(p)
Definition: polys.h:256
idSyzygies
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition: ideals.cc:728
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:237
l
int l
Definition: cfEzgcd.cc:93
id_ReadOutPivot
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
Definition: simpleideals.cc:1563
prMoveR_NoSort
poly prMoveR_NoSort(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:100
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:234
OPT_SB_1
#define OPT_SB_1
Definition: options.h:92
R
#define R
Definition: sirandom.c:27
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:735
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:613
nc_skew
Definition: nc.h:16
p_Setm
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:223
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
ringorder_wp
Definition: ring.h:80
p_IncrExp
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:578
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
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
pSeries
#define pSeries(n, p, u, w)
Definition: polys.h:356
ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:90
poly_sort::p
poly p
Definition: ideals.cc:2813
ggetid
idhdl ggetid(const char *n)
Definition: ipid.cc:520
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
pCopy
#define pCopy(p)
return a copy of the poly
Definition: polys.h:174
SI_RESTORE_OPT1
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
sm_ExpBound
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition: sparsmat.cc:187
IDELEMS
#define IDELEMS(i)
Definition: simpleideals.h:23
pNormalize
#define pNormalize(p)
Definition: polys.h:301
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:2087
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition: simpleideals.cc:412
sySchreyerResolvente
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:854
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:722
id_Transp
ideal id_Transp(ideal a, const ring rRing)
transpose a module
Definition: simpleideals.cc:1736
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:78
MATROWS
#define MATROWS(i)
Definition: matpol.h:26
TEST_V_INTERSECT_SYZ
#define TEST_V_INTERSECT_SYZ
Definition: options.h:140
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:271
A
#define A
Definition: sirandom.c:24
SI_SAVE_OPT2
#define SI_SAVE_OPT2(A)
Definition: options.h:21
rRingOrder_t
rRingOrder_t
order stuff
Definition: ring.h:66
pNext
#define pNext(p)
Definition: monomials.h:33
pReverse
static poly pReverse(poly p)
Definition: p_polys.h:325
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
idDecompose
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2464
prCopyR
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:34
si_opt_2
VAR unsigned si_opt_2
Definition: options.c:6
V_IDLIFT
#define V_IDLIFT
Definition: options.h:60
idPrepareStd
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:1077
idrCopyR
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:191
id_IsZeroDim
BOOLEAN id_IsZeroDim(ideal I, const ring r)
Definition: simpleideals.cc:1687
rField_is_Q
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:500
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:3397
wrp
void wrp(poly p)
Definition: polys.h:294
p_Weight
int p_Weight(int i, const ring r)
Definition: p_polys.cc:694
idMaxIdeal
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:32