Macros | Typedefs | Functions | Variables
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
 

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)
 
ideal idMult (ideal h1, ideal h2)
 hh := h1 * h2 More...
 
BOOLEAN idIs0 (ideal h)
 returns true if h is the zero ideal More...
 
BOOLEAN idHomIdeal (ideal id, ideal Q=NULL)
 
BOOLEAN idHomModule (ideal m, ideal Q, intvec **w)
 
BOOLEAN idTestHomModule (ideal m, ideal Q, intvec *w)
 
ideal idMinBase (ideal h1)
 
void idInitChoise (int r, int beg, int end, BOOLEAN *endch, int *choise)
 
void idGetNextChoise (int r, int end, BOOLEAN *endch, int *choise)
 
int idGetNumberOfChoise (int t, int d, int begin, int end, int *choise)
 
int binom (int n, int r)
 
ideal idFreeModule (int i)
 
ideal idSect (ideal h1, ideal h2)
 
ideal idMultSect (resolvente arg, int length)
 
ideal idSyzygies (ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp=TRUE, BOOLEAN setRegularity=FALSE, int *deg=NULL)
 
ideal idLiftStd (ideal h1, matrix *m, tHomog h=testHomog, ideal *syz=NULL)
 
ideal idLift (ideal mod, ideal sumod, ideal *rest=NULL, BOOLEAN goodShape=FALSE, BOOLEAN isSB=TRUE, BOOLEAN divide=FALSE, matrix *unit=NULL)
 
void idLiftW (ideal P, ideal Q, int n, matrix &T, ideal &R, short *w=NULL)
 
intvecidMWLift (ideal mod, intvec *weights)
 
ideal idQuot (ideal h1, ideal h2, BOOLEAN h1IsStb=FALSE, BOOLEAN resultIsIdeal=FALSE)
 
ideal idElimination (ideal h1, poly delVar, intvec *hilb=NULL)
 
ideal idMinors (matrix a, int ar, ideal R=NULL)
 compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL) More...
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
 
ideal idHead (ideal h)
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
static ideal idVec2Ideal (poly vec)
 
ideal idSeries (int n, ideal M, matrix U=NULL, intvec *w=NULL)
 
static BOOLEAN idIsZeroDim (ideal i)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply=TRUE)
 
static intvecidSort (ideal id, BOOLEAN nolex=TRUE)
 
ideal idModulo (ideal h1, ideal h2, tHomog h=testHomog, intvec **w=NULL)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
ideal idXXX (ideal h1, int k)
 
poly id_GCD (poly f, poly g, const ring r)
 
ideal id_Farey (ideal x, number N, const ring r)
 
ideal id_TensorModuleMult (const int m, const ideal M, const ring rRing)
 

Variables

ring currRing
 Widely used global variable which specifies the current polynomial ring for Singular interpreter and legacy implementatins. : one should avoid using it in newer designs, for example due to possible problems in parallelization with threads. More...
 

Macro Definition Documentation

§ idDelete

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

delete an ideal

Definition at line 31 of file ideals.h.

§ idIsConstant

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

Definition at line 42 of file ideals.h.

§ idMaxIdeal

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

initialise the maximal ideal (at 0)

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

§ idPrint

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

Definition at line 48 of file ideals.h.

§ idSimpleAdd

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

Definition at line 44 of file ideals.h.

§ idTest

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

Definition at line 49 of file ideals.h.

Typedef Documentation

§ resolvente

typedef ideal* resolvente

Definition at line 20 of file ideals.h.

Function Documentation

§ binom()

int binom ( int  n,
int  r 
)

Definition at line 911 of file simpleideals.cc.

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

§ id_Copy()

ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 402 of file simpleideals.cc.

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

§ id_Farey()

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

Definition at line 2455 of file ideals.cc.

2456 {
2457  int cnt=IDELEMS(x)*x->nrows;
2458  ideal result=idInit(cnt,x->rank);
2459  result->nrows=x->nrows; // for lifting matrices
2460  result->ncols=x->ncols; // for lifting matrices
2461 
2462  int i;
2463  for(i=cnt-1;i>=0;i--)
2464  {
2465  result->m[i]=p_Farey(x->m[i],N,r);
2466  }
2467  return result;
2468 }
const ring r
Definition: syzextra.cc:208
poly p_Farey(poly p, number N, const ring r)
Definition: p_polys.cc:62
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
Variable x
Definition: cfModGcd.cc:4023
return result
Definition: facAbsBiFact.cc:76

§ id_GCD()

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

Definition at line 2355 of file ideals.cc.

2356 {
2357  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2358  intvec *w = NULL;
2359 
2360  ring save_r = currRing; rChangeCurrRing(r); ideal S=idSyzygies(I,testHomog,&w); rChangeCurrRing(save_r);
2361 
2362  if (w!=NULL) delete w;
2363  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2364  id_Delete(&S, r);
2365  poly gcd_p=singclap_pdivide(f,gg, r);
2366  p_Delete(&gg, r);
2367 
2368  return gcd_p;
2369 }
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3394
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
g
Definition: cfModGcd.cc:4031
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:547
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
FILE * f
Definition: checklibs.c:7
void rChangeCurrRing(ring r)
Definition: polys.cc:12
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
polyrec * poly
Definition: hilb.h:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:515

§ id_TensorModuleMult()

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

Definition at line 1661 of file simpleideals.cc.

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

§ idAdd()

ideal idAdd ( ideal  h1,
ideal  h2 
)
inline

h1 + h2

Definition at line 70 of file ideals.h.

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

§ idCoeffOfKBase()

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

Definition at line 2231 of file ideals.cc.

2232 {
2233  matrix result;
2234  ideal tempKbase;
2235  poly p,q;
2236  intvec * convert;
2237  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2238 #if 0
2239  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2240  if (idIs0(arg))
2241  return mpNew(i,1);
2242  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2243  result = mpNew(i,j);
2244 #else
2245  result = mpNew(i, j);
2246  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2247 #endif
2248 
2249  tempKbase = idCreateSpecialKbase(kbase,&convert);
2250  for (k=0;k<j;k++)
2251  {
2252  p = arg->m[k];
2253  while (p!=NULL)
2254  {
2255  q = idDecompose(p,how,tempKbase,&pos);
2256  if (pos>=0)
2257  {
2258  MATELEM(result,(*convert)[pos],k+1) =
2259  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2260  }
2261  else
2262  p_Delete(&q,currRing);
2263  pIter(p);
2264  }
2265  }
2266  idDelete(&tempKbase);
2267  return result;
2268 }
#define pAdd(p, q)
Definition: polys.h:186
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2199
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2145
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ idCopy()

ideal idCopy ( ideal  A)
inline

Definition at line 62 of file ideals.h.

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

§ idCopyFirstK()

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

Definition at line 22 of file ideals.h.

23 {
24  return id_CopyFirstK(ide, k, currRing);
25 }
int k
Definition: cfEzgcd.cc:93
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 (...
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

§ idDelEquals()

void idDelEquals ( ideal  id)

Definition at line 2600 of file ideals.cc.

2601 {
2602  int idsize = IDELEMS(id);
2603  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
2604  for (int i = 0; i < idsize; i++)
2605  {
2606  id_sort[i].p = id->m[i];
2607  id_sort[i].index = i;
2608  }
2609  idSort_qsort(id_sort, idsize);
2610  int index, index_i, index_j;
2611  int i = 0;
2612  for (int j = 1; j < idsize; j++)
2613  {
2614  if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
2615  {
2616  index_i = id_sort[i].index;
2617  index_j = id_sort[j].index;
2618  if (index_j > index_i)
2619  {
2620  index = index_j;
2621  }
2622  else
2623  {
2624  index = index_i;
2625  i = j;
2626  }
2627  pDelete(&id->m[index]);
2628  }
2629  else
2630  {
2631  i = j;
2632  }
2633  }
2634  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
2635 }
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:118
#define pEqualPolys(p1, p2)
Definition: polys.h:384
int index
Definition: ideals.cc:2582
int j
Definition: myNF.cc:70
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2591
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
poly p
Definition: ideals.cc:2581
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ idDiff()

matrix idDiff ( matrix  i,
int  k 
)

Definition at line 1903 of file ideals.cc.

1904 {
1905  int e=MATCOLS(i)*MATROWS(i);
1906  matrix r=mpNew(MATROWS(i),MATCOLS(i));
1907  r->rank=i->rank;
1908  int j;
1909  for(j=0; j<e; j++)
1910  {
1911  r->m[j]=pDiff(i->m[j],k);
1912  }
1913  return r;
1914 }
int k
Definition: cfEzgcd.cc:93
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define MATCOLS(i)
Definition: matpol.h:28
#define pDiff(a, b)
Definition: polys.h:279
#define MATROWS(i)
Definition: matpol.h:27
long rank
Definition: matpol.h:20

§ idDiffOp()

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

Definition at line 1916 of file ideals.cc.

1917 {
1918  matrix r=mpNew(IDELEMS(I),IDELEMS(J));
1919  int i,j;
1920  for(i=0; i<IDELEMS(I); i++)
1921  {
1922  for(j=0; j<IDELEMS(J); j++)
1923  {
1924  MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
1925  }
1926  }
1927  return r;
1928 }
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define pDiffOp(a, b, m)
Definition: polys.h:280
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ idElimination()

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

Definition at line 1353 of file ideals.cc.

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

§ idFreeModule()

ideal idFreeModule ( int  i)
inline

Definition at line 113 of file ideals.h.

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

§ idGetNextChoise()

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

Definition at line 853 of file simpleideals.cc.

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

§ idGetNumberOfChoise()

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

Definition at line 879 of file simpleideals.cc.

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

§ idHead()

ideal idHead ( ideal  h)

§ idHomIdeal()

BOOLEAN idHomIdeal ( ideal  id,
ideal  Q = NULL 
)
inline

Definition at line 93 of file ideals.h.

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

§ idHomModule()

BOOLEAN idHomModule ( ideal  m,
ideal  Q,
intvec **  w 
)
inline

Definition at line 98 of file ideals.h.

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

§ idInitChoise()

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

Definition at line 831 of file simpleideals.cc.

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

§ idInsertPoly()

BOOLEAN idInsertPoly ( ideal  h1,
poly  h2 
)

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

Definition at line 638 of file simpleideals.cc.

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

§ idInsertPolyOnPos()

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

insert p into I on position pos

Definition at line 657 of file simpleideals.cc.

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

§ idInsertPolyWithTests()

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

Definition at line 77 of file ideals.h.

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

§ idIs0()

BOOLEAN idIs0 ( ideal  h)

returns true if h is the zero ideal

Definition at line 766 of file simpleideals.cc.

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

§ idIsSubModule()

BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 1813 of file ideals.cc.

1814 {
1815  int i;
1816  poly p;
1817 
1818  if (idIs0(id1)) return TRUE;
1819  for (i=0;i<IDELEMS(id1);i++)
1820  {
1821  if (id1->m[i] != NULL)
1822  {
1823  p = kNF(id2,currRing->qideal,id1->m[i]);
1824  if (p != NULL)
1825  {
1826  p_Delete(&p,currRing);
1827  return FALSE;
1828  }
1829  }
1830  }
1831  return TRUE;
1832 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ idIsZeroDim()

static BOOLEAN idIsZeroDim ( ideal  i)
inlinestatic

Definition at line 163 of file ideals.h.

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

§ 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 2531 of file ideals.cc.

2532 {
2533  for (int i = IDELEMS(id)-1; i >= k; i--)
2534  {
2535  if (id->m[i] != NULL) pDelete(&id->m[i]);
2536  }
2537  int kk=k;
2538  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2539  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2540  IDELEMS(id) = kk;
2541 }
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
#define pDelete(p_ptr)
Definition: polys.h:169

§ idLift()

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

Definition at line 891 of file ideals.cc.

893 {
894  int lsmod =id_RankFreeModule(submod,currRing), j, k;
895  int comps_to_add=0;
896  poly p;
897 
898  if (idIs0(submod))
899  {
900  if (unit!=NULL)
901  {
902  *unit=mpNew(1,1);
903  MATELEM(*unit,1,1)=pOne();
904  }
905  if (rest!=NULL)
906  {
907  *rest=idInit(1,mod->rank);
908  }
909  return idInit(1,mod->rank);
910  }
911  if (idIs0(mod)) /* and not idIs0(submod) */
912  {
913  WerrorS("2nd module does not lie in the first");
914  return NULL;
915  }
916  if (unit!=NULL)
917  {
918  comps_to_add = IDELEMS(submod);
919  while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
920  comps_to_add--;
921  }
923  if ((k!=0) && (lsmod==0)) lsmod=1;
924  k=si_max(k,(int)mod->rank);
925  if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
926 
927  ring orig_ring=currRing;
928  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
929  rSetSyzComp(k,syz_ring);
930 
931  ideal s_mod, s_temp;
932  if (orig_ring != syz_ring)
933  {
934  s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
935  s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
936  }
937  else
938  {
939  s_mod = mod;
940  s_temp = idCopy(submod);
941  }
942  ideal s_h3;
943  if (isSB)
944  {
945  s_h3 = idCopy(s_mod);
946  idPrepareStd(s_h3, k+comps_to_add);
947  }
948  else
949  {
950  s_h3 = idPrepare(s_mod,(tHomog)FALSE,k+comps_to_add,NULL);
951  }
952  if (!goodShape)
953  {
954  for (j=0;j<IDELEMS(s_h3);j++)
955  {
956  if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
957  p_Delete(&(s_h3->m[j]),currRing);
958  }
959  }
960  idSkipZeroes(s_h3);
961  if (lsmod==0)
962  {
963  id_Shift(s_temp,1,currRing);
964  }
965  if (unit!=NULL)
966  {
967  for(j = 0;j<comps_to_add;j++)
968  {
969  p = s_temp->m[j];
970  if (p!=NULL)
971  {
972  while (pNext(p)!=NULL) pIter(p);
973  pNext(p) = pOne();
974  pIter(p);
975  pSetComp(p,1+j+k);
976  pSetmComp(p);
977  p = pNeg(p);
978  }
979  }
980  s_temp->rank += (k+comps_to_add);
981  }
982  ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
983  s_result->rank = s_h3->rank;
984  ideal s_rest = idInit(IDELEMS(s_result),k);
985  idDelete(&s_h3);
986  idDelete(&s_temp);
987 
988  for (j=0;j<IDELEMS(s_result);j++)
989  {
990  if (s_result->m[j]!=NULL)
991  {
992  if (pGetComp(s_result->m[j])<=k)
993  {
994  if (!divide)
995  {
996  if (isSB)
997  {
998  WarnS("first module not a standardbasis\n"
999  "// ** or second not a proper submodule");
1000  }
1001  else
1002  WerrorS("2nd module does not lie in the first");
1003  idDelete(&s_result);
1004  idDelete(&s_rest);
1005  s_result=idInit(IDELEMS(submod),submod->rank);
1006  break;
1007  }
1008  else
1009  {
1010  p = s_rest->m[j] = s_result->m[j];
1011  while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1012  s_result->m[j] = pNext(p);
1013  pNext(p) = NULL;
1014  }
1015  }
1016  p_Shift(&(s_result->m[j]),-k,currRing);
1017  pNeg(s_result->m[j]);
1018  }
1019  }
1020  if ((lsmod==0) && (s_rest!=NULL))
1021  {
1022  for (j=IDELEMS(s_rest);j>0;j--)
1023  {
1024  if (s_rest->m[j-1]!=NULL)
1025  {
1026  p_Shift(&(s_rest->m[j-1]),-1,currRing);
1027  s_rest->m[j-1] = s_rest->m[j-1];
1028  }
1029  }
1030  }
1031  if(syz_ring!=orig_ring)
1032  {
1033  idDelete(&s_mod);
1034  rChangeCurrRing(orig_ring);
1035  s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1036  s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1037  rDelete(syz_ring);
1038  }
1039  if (rest!=NULL)
1040  *rest = s_rest;
1041  else
1042  idDelete(&s_rest);
1043 //idPrint(s_result);
1044  if (unit!=NULL)
1045  {
1046  *unit=mpNew(comps_to_add,comps_to_add);
1047  int i;
1048  for(i=0;i<IDELEMS(s_result);i++)
1049  {
1050  poly p=s_result->m[i];
1051  poly q=NULL;
1052  while(p!=NULL)
1053  {
1054  if(pGetComp(p)<=comps_to_add)
1055  {
1056  pSetComp(p,0);
1057  if (q!=NULL)
1058  {
1059  pNext(q)=pNext(p);
1060  }
1061  else
1062  {
1063  pIter(s_result->m[i]);
1064  }
1065  pNext(p)=NULL;
1066  MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1067  if(q!=NULL) p=pNext(q);
1068  else p=s_result->m[i];
1069  }
1070  else
1071  {
1072  q=p;
1073  pIter(p);
1074  }
1075  }
1076  p_Shift(&s_result->m[i],-comps_to_add,currRing);
1077  }
1078  }
1079  return s_result;
1080 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:857
#define pAdd(p, q)
Definition: polys.h:186
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:181
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
#define TRUE
Definition: auxiliary.h:101
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4379
void WerrorS(const char *s)
Definition: feFopen.cc:24
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
#define pMinComp(p)
Definition: polys.h:283
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void id_Shift(ideal M, int s, const ring r)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:298
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:62
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4515
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w)
Definition: ideals.cc:455
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ idLiftStd()

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

Definition at line 704 of file ideals.cc.

705 {
706  int i, j, t, inputIsIdeal=id_RankFreeModule(h1,currRing);
707  long k;
708  poly p=NULL, q;
709  intvec *w=NULL;
710 
711  idDelete((ideal*)ma);
712  BOOLEAN lift3=FALSE;
713  if (syz!=NULL) { lift3=TRUE; idDelete(syz); }
714  if (idIs0(h1))
715  {
716  *ma=mpNew(1,0);
717  if (lift3)
718  {
719  *syz=idFreeModule(IDELEMS(h1));
720  }
721  return idInit(1,h1->rank);
722  }
723 
724  BITSET save2;
725  SI_SAVE_OPT2(save2);
726 
728 
729  if ((k==1) && (!lift3)) si_opt_2 |=Sy_bit(V_IDLIFT);
730 
731  ring orig_ring = currRing;
732  ring syz_ring = rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
733  rSetSyzComp(k,syz_ring);
734 
735  ideal s_h1=h1;
736 
737  if (orig_ring != syz_ring)
738  s_h1 = idrCopyR_NoSort(h1,orig_ring,syz_ring);
739  else
740  s_h1 = h1;
741 
742  ideal s_h3=idPrepare(s_h1,hi,k,&w); // main (syz) GB computation
743 
744  ideal s_h2 = idInit(IDELEMS(s_h3), s_h3->rank);
745 
746  if (lift3) (*syz)=idInit(IDELEMS(s_h3),IDELEMS(h1));
747 
748  if (w!=NULL) delete w;
749  i = 0;
750 
751  // now sort the result, SB : leave in s_h3
752  // T: put in s_h2
753  // syz: put in *syz
754  for (j=0; j<IDELEMS(s_h3); j++)
755  {
756  if (s_h3->m[j] != NULL)
757  {
758  //if (p_MinComp(s_h3->m[j],syz_ring) <= k)
759  if (pGetComp(s_h3->m[j]) <= k) // syz_ring == currRing
760  {
761  i++;
762  q = s_h3->m[j];
763  while (pNext(q) != NULL)
764  {
765  if (pGetComp(pNext(q)) > k)
766  {
767  s_h2->m[j] = pNext(q);
768  pNext(q) = NULL;
769  }
770  else
771  {
772  pIter(q);
773  }
774  }
775  if (!inputIsIdeal) p_Shift(&(s_h3->m[j]), -1,currRing);
776  }
777  else
778  {
779  // we a syzygy here:
780  if (lift3)
781  {
782  p_Shift(&s_h3->m[j], -k,currRing);
783  (*syz)->m[j]=s_h3->m[j];
784  s_h3->m[j]=NULL;
785  }
786  else
787  p_Delete(&(s_h3->m[j]),currRing);
788  }
789  }
790  }
791  idSkipZeroes(s_h3);
792  //extern char * iiStringMatrix(matrix im, int dim,char ch);
793  //PrintS("SB: ----------------------------------------\n");
794  //PrintS(iiStringMatrix((matrix)s_h3,k,'\n'));
795  //PrintLn();
796  //PrintS("T: ----------------------------------------\n");
797  //PrintS(iiStringMatrix((matrix)s_h2,h1->rank,'\n'));
798  //PrintLn();
799 
800  if (lift3) idSkipZeroes(*syz);
801 
802  j = IDELEMS(s_h1);
803 
804 
805  if (syz_ring!=orig_ring)
806  {
807  idDelete(&s_h1);
808  rChangeCurrRing(orig_ring);
809  }
810 
811  *ma = mpNew(j,i);
812 
813  i = 1;
814  for (j=0; j<IDELEMS(s_h2); j++)
815  {
816  if (s_h2->m[j] != NULL)
817  {
818  q = prMoveR( s_h2->m[j], syz_ring,orig_ring);
819  s_h2->m[j] = NULL;
820 
821  if (q!=NULL)
822  {
823  q=pReverse(q);
824  while (q != NULL)
825  {
826  p = q;
827  pIter(q);
828  pNext(p) = NULL;
829  t=pGetComp(p);
830  pSetComp(p,0);
831  pSetmComp(p);
832  MATELEM(*ma,t-k,i) = pAdd(MATELEM(*ma,t-k,i),p);
833  }
834  }
835  i++;
836  }
837  }
838  idDelete(&s_h2);
839 
840  for (i=0; i<IDELEMS(s_h3); i++)
841  {
842  s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], syz_ring,orig_ring);
843  }
844  if (lift3)
845  {
846  for (i=0; i<IDELEMS(*syz); i++)
847  {
848  (*syz)->m[i] = prMoveR_NoSort((*syz)->m[i], syz_ring,orig_ring);
849  }
850  }
851 
852  if (syz_ring!=orig_ring) rDelete(syz_ring);
853  SI_RESTORE_OPT2(save2);
854  return s_h3;
855 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
#define pAdd(p, q)
Definition: polys.h:186
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define TRUE
Definition: auxiliary.h:101
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4379
int k
Definition: cfEzgcd.cc:93
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
ideal idFreeModule(int i)
Definition: ideals.h:113
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static poly pReverse(poly p)
Definition: p_polys.h:330
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4515
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define SI_RESTORE_OPT2(A)
Definition: options.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w)
Definition: ideals.cc:455
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
poly prMoveR_NoSort(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:102
polyrec * poly
Definition: hilb.h:10
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
#define V_IDLIFT
Definition: options.h:60
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define SI_SAVE_OPT2(A)
Definition: options.h:21

§ idLiftW()

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

Definition at line 1086 of file ideals.cc.

1087 {
1088  long N=0;
1089  int i;
1090  for(i=IDELEMS(Q)-1;i>=0;i--)
1091  if(w==NULL)
1092  N=si_max(N,p_Deg(Q->m[i],currRing));
1093  else
1094  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1095  N+=n;
1096 
1097  T=mpNew(IDELEMS(Q),IDELEMS(P));
1098  R=idInit(IDELEMS(P),P->rank);
1099 
1100  for(i=IDELEMS(P)-1;i>=0;i--)
1101  {
1102  poly p;
1103  if(w==NULL)
1104  p=ppJet(P->m[i],N);
1105  else
1106  p=ppJetW(P->m[i],N,w);
1107 
1108  int j=IDELEMS(Q)-1;
1109  while(p!=NULL)
1110  {
1111  if(pDivisibleBy(Q->m[j],p))
1112  {
1113  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1114  if(w==NULL)
1115  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1116  else
1117  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1118  pNormalize(p);
1119  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1120  p_Delete(&p0,currRing);
1121  else
1122  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1123  j=IDELEMS(Q)-1;
1124  }
1125  else
1126  {
1127  if(j==0)
1128  {
1129  poly p0=p;
1130  pIter(p);
1131  pNext(p0)=NULL;
1132  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1133  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1134  p_Delete(&p0,currRing);
1135  else
1136  R->m[i]=pAdd(R->m[i],p0);
1137  j=IDELEMS(Q)-1;
1138  }
1139  else
1140  j--;
1141  }
1142  }
1143  }
1144 }
#define pAdd(p, q)
Definition: polys.h:186
#define ppJet(p, m)
Definition: polys.h:350
return P p
Definition: myNF.cc:203
#define ppMult_mm(p, m)
Definition: polys.h:184
#define Q
Definition: sirandom.c:25
#define pJetW(p, m, iv)
Definition: polys.h:353
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:690
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
#define pSub(a, b)
Definition: polys.h:270
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
pNormalize(P.p)
const ring R
Definition: DebugPrint.cc:36
#define pJet(p, m)
Definition: polys.h:351
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
poly p_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1512
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
#define ppJetW(p, m, iv)
Definition: polys.h:352
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ idMinBase()

ideal idMinBase ( ideal  h1)

Definition at line 45 of file ideals.cc.

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

§ idMinEmbedding()

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

Definition at line 2297 of file ideals.cc.

2298 {
2299  if (idIs0(arg)) return idInit(1,arg->rank);
2300  int i,next_gen,next_comp;
2301  ideal res=arg;
2302  if (!inPlace) res = idCopy(arg);
2303  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2304  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2305  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2306 
2307  int del=0;
2308  loop
2309  {
2310  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2311  if (next_gen<0) break;
2312  del++;
2313  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2314  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2315  if ((w !=NULL)&&(*w!=NULL))
2316  {
2317  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2318  }
2319  }
2320 
2321  idDeleteComps(res,red_comp,del);
2322  idSkipZeroes(res);
2323  omFree(red_comp);
2324 
2325  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2326  {
2327  int nl=si_max((*w)->length()-del,1);
2328  intvec *wtmp=new intvec(nl);
2329  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2330  delete *w;
2331  *w=wtmp;
2332  }
2333  return res;
2334 }
loop
Definition: myNF.cc:98
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define omFree(addr)
Definition: omAllocDecl.h:261
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:62
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2270
const CanonicalForm & w
Definition: facAbsFact.cc:55
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ idMinors()

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

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

Definition at line 1744 of file ideals.cc.

1745 {
1746 
1747  const ring origR=currRing;
1748  id_Test((ideal)a, origR);
1749 
1750  const int r = a->nrows;
1751  const int c = a->ncols;
1752 
1753  if((ar<=0) || (ar>r) || (ar>c))
1754  {
1755  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
1756  return NULL;
1757  }
1758 
1759  ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
1760  long bound = sm_ExpBound(h,c,r,ar,origR);
1761  id_Delete(&h, origR);
1762 
1763  ring tmpR = sm_RingChange(origR,bound);
1764 
1765  matrix b = mpNew(r,c);
1766 
1767  for (int i=r*c-1;i>=0;i--)
1768  if (a->m[i] != NULL)
1769  b->m[i] = prCopyR(a->m[i],origR,tmpR);
1770 
1771  id_Test( (ideal)b, tmpR);
1772 
1773  if (R!=NULL)
1774  {
1775  R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
1776  //if (ar>1) // otherwise done in mpMinorToResult
1777  //{
1778  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
1779  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
1780  // idDelete((ideal*)&b); b=bb;
1781  //}
1782  id_Test( R, tmpR);
1783  }
1784 
1785 
1786  ideal result = idInit(32,1);
1787 
1788  int elems = 0;
1789 
1790  if(ar>1)
1791  mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
1792  else
1793  mp_MinorToResult(result,elems,b,r,c,R,tmpR);
1794 
1795  id_Test( (ideal)b, tmpR);
1796 
1797  id_Delete((ideal *)&b, tmpR);
1798 
1799  if (R!=NULL) id_Delete(&R,tmpR);
1800 
1801  idSkipZeroes(result);
1802  rChangeCurrRing(origR);
1803  result = idrMoveR(result,tmpR,origR);
1804  sm_KillModifiedRing(tmpR);
1805  idTest(result);
1806  return result;
1807 }
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc:263
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
int ncols
Definition: matpol.h:22
#define id_Test(A, lR)
Definition: simpleideals.h:80
void mp_RecMin(int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
produces recursively the ideal of all arxar-minors of a
Definition: matpol.cc:1508
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
entries of a are minors and go to result (only if not in R)
Definition: matpol.cc:1412
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition: sparsmat.cc:194
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int nrows
Definition: matpol.h:21
const ring R
Definition: DebugPrint.cc:36
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:12
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void sm_KillModifiedRing(ring r)
Definition: sparsmat.cc:294
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:75
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
ideal id_Matrix2Module(matrix mat, const ring R)
void Werror(const char *fmt,...)
Definition: reporter.cc:189
return result
Definition: facAbsBiFact.cc:76
#define idTest(id)
Definition: ideals.h:49

§ idModulo()

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

Definition at line 1988 of file ideals.cc.

1989 {
1990  intvec *wtmp=NULL;
1991 
1992  int i,k,rk,flength=0,slength,length;
1993  poly p,q;
1994 
1995  if (idIs0(h2))
1996  return idFreeModule(si_max(1,h2->ncols));
1997  if (!idIs0(h1))
1998  flength = id_RankFreeModule(h1,currRing);
1999  slength = id_RankFreeModule(h2,currRing);
2000  length = si_max(flength,slength);
2001  if (length==0)
2002  {
2003  length = 1;
2004  }
2005  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2006  if ((w!=NULL)&&((*w)!=NULL))
2007  {
2008  //Print("input weights:");(*w)->show(1);PrintLn();
2009  int d;
2010  int k;
2011  wtmp=new intvec(length+IDELEMS(h2));
2012  for (i=0;i<length;i++)
2013  ((*wtmp)[i])=(**w)[i];
2014  for (i=0;i<IDELEMS(h2);i++)
2015  {
2016  poly p=h2->m[i];
2017  if (p!=NULL)
2018  {
2019  d = p_Deg(p,currRing);
2020  k= pGetComp(p);
2021  if (slength>0) k--;
2022  d +=((**w)[k]);
2023  ((*wtmp)[i+length]) = d;
2024  }
2025  }
2026  //Print("weights:");wtmp->show(1);PrintLn();
2027  }
2028  for (i=0;i<IDELEMS(h2);i++)
2029  {
2030  temp->m[i] = pCopy(h2->m[i]);
2031  q = pOne();
2032  pSetComp(q,i+1+length);
2033  pSetmComp(q);
2034  if(temp->m[i]!=NULL)
2035  {
2036  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2037  p = temp->m[i];
2038  while (pNext(p)!=NULL) pIter(p);
2039  pNext(p) = q; // will be sorted later correctly
2040  }
2041  else
2042  temp->m[i]=q;
2043  }
2044  rk = k = IDELEMS(h2);
2045  if (!idIs0(h1))
2046  {
2047  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2048  IDELEMS(temp) += IDELEMS(h1);
2049  for (i=0;i<IDELEMS(h1);i++)
2050  {
2051  if (h1->m[i]!=NULL)
2052  {
2053  temp->m[k] = pCopy(h1->m[i]);
2054  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2055  k++;
2056  }
2057  }
2058  }
2059 
2060  ring orig_ring=currRing;
2061  ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE); rChangeCurrRing(syz_ring);
2062  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2063  // therefore we disable OPT_RETURN_SB for modulo:
2064  // (see tr. #701)
2065  //if (TEST_OPT_RETURN_SB)
2066  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2067  //else
2068  rSetSyzComp(length, syz_ring);
2069  ideal s_temp;
2070 
2071  if (syz_ring != orig_ring)
2072  {
2073  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2074  }
2075  else
2076  {
2077  s_temp = temp;
2078  }
2079 
2080  idTest(s_temp);
2081  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2082 
2083  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2084  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2085  {
2086  delete *w;
2087  *w=new intvec(IDELEMS(h2));
2088  for (i=0;i<IDELEMS(h2);i++)
2089  ((**w)[i])=(*wtmp)[i+length];
2090  }
2091  if (wtmp!=NULL) delete wtmp;
2092 
2093  for (i=0;i<IDELEMS(s_temp1);i++)
2094  {
2095  if ((s_temp1->m[i]!=NULL)
2096  && (((int)pGetComp(s_temp1->m[i]))<=length))
2097  {
2098  p_Delete(&(s_temp1->m[i]),currRing);
2099  }
2100  else
2101  {
2102  p_Shift(&(s_temp1->m[i]),-length,currRing);
2103  }
2104  }
2105  s_temp1->rank = rk;
2106  idSkipZeroes(s_temp1);
2107 
2108  if (syz_ring!=orig_ring)
2109  {
2110  rChangeCurrRing(orig_ring);
2111  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2112  rDelete(syz_ring);
2113  // Hmm ... here seems to be a memory leak
2114  // However, simply deleting it causes memory trouble
2115  // idDelete(&s_temp);
2116  }
2117  else
2118  {
2119  idDelete(&temp);
2120  }
2121  idTest(s_temp1);
2122  return s_temp1;
2123 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4379
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal idFreeModule(int i)
Definition: ideals.h:113
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:298
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4515
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define idTest(id)
Definition: ideals.h:49

§ idMult()

ideal idMult ( ideal  h1,
ideal  h2 
)
inline

hh := h1 * h2

Definition at line 86 of file ideals.h.

87 {
88  return id_Mult(h1, h2, currRing);
89 }
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...
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

§ idMultSect()

ideal idMultSect ( resolvente  arg,
int  length 
)

Definition at line 340 of file ideals.cc.

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

§ idMWLift()

intvec* idMWLift ( ideal  mod,
intvec weights 
)

Definition at line 2128 of file ideals.cc.

2129 {
2130  if (idIs0(mod)) return new intvec(2);
2131  int i=IDELEMS(mod);
2132  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2133  intvec *result = new intvec(i+1);
2134  while (i>0)
2135  {
2136  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2137  }
2138  return result;
2139 }
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76

§ idQuot()

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

Definition at line 1260 of file ideals.cc.

1261 {
1262  // first check for special case h1:(0)
1263  if (idIs0(h2))
1264  {
1265  ideal res;
1266  if (resultIsIdeal)
1267  {
1268  res = idInit(1,1);
1269  res->m[0] = pOne();
1270  }
1271  else
1272  res = idFreeModule(h1->rank);
1273  return res;
1274  }
1275  BITSET old_test1;
1276  SI_SAVE_OPT1(old_test1);
1277  int i, kmax;
1278  BOOLEAN addOnlyOne=TRUE;
1279  tHomog hom=isNotHomog;
1280  intvec * weights1;
1281 
1282  ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1283 
1284  hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1285 
1286  ring orig_ring=currRing;
1287  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
1288  rSetSyzComp(kmax-1,syz_ring);
1289  if (orig_ring!=syz_ring)
1290  // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1291  s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1292  idTest(s_h4);
1293  #if 0
1294  void ipPrint_MA0(matrix m, const char *name);
1295  matrix m=idModule2Matrix(idCopy(s_h4));
1296  PrintS("start:\n");
1297  ipPrint_MA0(m,"Q");
1298  idDelete((ideal *)&m);
1299  PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1300  #endif
1301  ideal s_h3;
1302  if (addOnlyOne)
1303  {
1304  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1305  }
1306  else
1307  {
1308  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1309  }
1310  SI_RESTORE_OPT1(old_test1);
1311  #if 0
1312  // only together with the above debug stuff
1313  idSkipZeroes(s_h3);
1314  m=idModule2Matrix(idCopy(s_h3));
1315  Print("result, kmax=%d:\n",kmax);
1316  ipPrint_MA0(m,"S");
1317  idDelete((ideal *)&m);
1318  #endif
1319  idTest(s_h3);
1320  if (weights1!=NULL) delete weights1;
1321  idDelete(&s_h4);
1322 
1323  for (i=0;i<IDELEMS(s_h3);i++)
1324  {
1325  if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1326  {
1327  if (resultIsIdeal)
1328  p_Shift(&s_h3->m[i],-kmax,currRing);
1329  else
1330  p_Shift(&s_h3->m[i],-kmax+1,currRing);
1331  }
1332  else
1333  p_Delete(&s_h3->m[i],currRing);
1334  }
1335  if (resultIsIdeal)
1336  s_h3->rank = 1;
1337  else
1338  s_h3->rank = h1->rank;
1339  if(syz_ring!=orig_ring)
1340  {
1341  rChangeCurrRing(orig_ring);
1342  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1343  rDelete(syz_ring);
1344  }
1345  idSkipZeroes(s_h3);
1346  idTest(s_h3);
1347  return s_h3;
1348 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TRUE
Definition: auxiliary.h:101
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4379
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
static void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:60
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define BITSET
Definition: structs.h:18
#define pGetComp(p)
Component.
Definition: polys.h:37
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition: ideals.cc:1151
Definition: intvec.h:14
tHomog
Definition: structs.h:37
ideal idFreeModule(int i)
Definition: ideals.h:113
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:298
char name(const Variable &v)
Definition: factory.h:178
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:62
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4515
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
void wrp(poly p)
Definition: polys.h:293
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:98
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:49

§ idSect()

ideal idSect ( ideal  h1,
ideal  h2 
)

Definition at line 201 of file ideals.cc.

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

§ idSeries()

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

Definition at line 1886 of file ideals.cc.

1887 {
1888  for(int i=IDELEMS(M)-1;i>=0;i--)
1889  {
1890  if(U==NULL)
1891  M->m[i]=pSeries(n,M->m[i],NULL,w);
1892  else
1893  {
1894  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
1895  MATELEM(U,i+1,i+1)=NULL;
1896  }
1897  }
1898  if(U!=NULL)
1899  idDelete((ideal*)&U);
1900  return M;
1901 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define M
Definition: sirandom.c:24
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define pSeries(n, p, u, w)
Definition: polys.h:355
#define NULL
Definition: omList.c:10
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ idSort()

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

Definition at line 171 of file ideals.h.

172 {
173  return id_Sort(id, nolex, currRing);
174 }
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 ...
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

§ idSyzygies()

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

Definition at line 515 of file ideals.cc.

517 {
518  ideal s_h1;
519  int j, k, length=0,reg;
520  BOOLEAN isMonomial=TRUE;
521  int ii, idElemens_h1;
522 
523  assume(h1 != NULL);
524 
525  idElemens_h1=IDELEMS(h1);
526 #ifdef PDEBUG
527  for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
528 #endif
529  if (idIs0(h1))
530  {
531  ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
532  return result;
533  }
534  int slength=(int)id_RankFreeModule(h1,currRing);
535  k=si_max(1,slength /*id_RankFreeModule(h1)*/);
536 
537  assume(currRing != NULL);
538  ring orig_ring=currRing;
539  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
540 
541  if (setSyzComp)
542  rSetSyzComp(k,syz_ring);
543 
544  if (orig_ring != syz_ring)
545  {
546  s_h1=idrCopyR_NoSort(h1,orig_ring,syz_ring);
547  }
548  else
549  {
550  s_h1 = h1;
551  }
552 
553  idTest(s_h1);
554 
555  ideal s_h3=idPrepare(s_h1,h,k,w); // main (syz) GB computation
556 
557  if (s_h3==NULL)
558  {
559  return idFreeModule( idElemens_h1 /*IDELEMS(h1)*/);
560  }
561 
562  if (orig_ring != syz_ring)
563  {
564  idDelete(&s_h1);
565  for (j=0; j<IDELEMS(s_h3); j++)
566  {
567  if (s_h3->m[j] != NULL)
568  {
569  if (p_MinComp(s_h3->m[j],syz_ring) > k)
570  p_Shift(&s_h3->m[j], -k,syz_ring);
571  else
572  p_Delete(&s_h3->m[j],syz_ring);
573  }
574  }
575  idSkipZeroes(s_h3);
576  s_h3->rank -= k;
577  rChangeCurrRing(orig_ring);
578  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
579  rDelete(syz_ring);
580  #ifdef HAVE_PLURAL
581  if (rIsPluralRing(orig_ring))
582  {
583  id_DelMultiples(s_h3,orig_ring);
584  idSkipZeroes(s_h3);
585  }
586  #endif
587  idTest(s_h3);
588  return s_h3;
589  }
590 
591  ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
592 
593  for (j=IDELEMS(s_h3)-1; j>=0; j--)
594  {
595  if (s_h3->m[j] != NULL)
596  {
597  if (p_MinComp(s_h3->m[j],syz_ring) <= k)
598  {
599  e->m[j] = s_h3->m[j];
600  isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
601  p_Delete(&pNext(s_h3->m[j]),syz_ring);
602  s_h3->m[j] = NULL;
603  }
604  }
605  }
606 
607  idSkipZeroes(s_h3);
608  idSkipZeroes(e);
609 
610  if ((deg != NULL)
611  && (!isMonomial)
613  && (setRegularity)
614  && (h==isHomog)
615  && (!rIsPluralRing(currRing))
616  && (!rField_is_Ring(currRing))
617  )
618  {
619  ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
620  if (dp_C_ring != syz_ring)
621  {
622  rChangeCurrRing(dp_C_ring);
623  e = idrMoveR_NoSort(e, syz_ring, dp_C_ring);
624  }
625  resolvente res = sySchreyerResolvente(e,-1,&length,TRUE, TRUE);
626  intvec * dummy = syBetti(res,length,&reg, *w);
627  *deg = reg+2;
628  delete dummy;
629  for (j=0;j<length;j++)
630  {
631  if (res[j]!=NULL) idDelete(&(res[j]));
632  }
633  omFreeSize((ADDRESS)res,length*sizeof(ideal));
634  idDelete(&e);
635  if (dp_C_ring != syz_ring)
636  {
637  rChangeCurrRing(syz_ring);
638  rDelete(dp_C_ring);
639  }
640  }
641  else
642  {
643  idDelete(&e);
644  }
645  idTest(s_h3);
646  if (currRing->qideal != NULL)
647  {
648  ideal ts_h3=kStd(s_h3,currRing->qideal,h,w);
649  idDelete(&s_h3);
650  s_h3 = ts_h3;
651  }
652  return s_h3;
653 }
#define TEST_OPT_NOTREGULARITY
Definition: options.h:114
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define pTest(p)
Definition: polys.h:399
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:101
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
void * ADDRESS
Definition: auxiliary.h:118
int k
Definition: cfEzgcd.cc:93
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
void id_DelMultiples(ideal id, const ring r)
ideal id = (id[i]), c any unit if id[i] = c*id[j] then id[j] is deleted for j > i ...
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
ideal idFreeModule(int i)
Definition: ideals.h:113
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4384
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4883
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:308
resolvente sySchreyerResolvente(ideal arg, int maxlength, int *length, BOOLEAN isMonomial=FALSE, BOOLEAN notReplace=FALSE)
Definition: syz0.cc:861
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4515
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w)
Definition: ideals.cc:455
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pNext(p)
Definition: monomials.h:43
ideal * resolvente
Definition: ideals.h:20
intvec * syBetti(resolvente res, int length, int *regularity, intvec *weights, BOOLEAN tomin, int *row_shift)
Definition: syz.cc:791
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
return result
Definition: facAbsBiFact.cc:76
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:49

§ idTestHomModule()

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

Definition at line 1834 of file ideals.cc.

1835 {
1836  if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
1837  if (idIs0(m)) return TRUE;
1838 
1839  int cmax=-1;
1840  int i;
1841  poly p=NULL;
1842  int length=IDELEMS(m);
1843  polyset P=m->m;
1844  for (i=length-1;i>=0;i--)
1845  {
1846  p=P[i];
1847  if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
1848  }
1849  if (w != NULL)
1850  if (w->length()+1 < cmax)
1851  {
1852  // Print("length: %d - %d \n", w->length(),cmax);
1853  return FALSE;
1854  }
1855 
1856  if(w!=NULL)
1857  p_SetModDeg(w, currRing);
1858 
1859  for (i=length-1;i>=0;i--)
1860  {
1861  p=P[i];
1862  if (p!=NULL)
1863  {
1864  int d=currRing->pFDeg(p,currRing);
1865  loop
1866  {
1867  pIter(p);
1868  if (p==NULL) break;
1869  if (d!=currRing->pFDeg(p,currRing))
1870  {
1871  //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
1872  if(w!=NULL)
1874  return FALSE;
1875  }
1876  }
1877  }
1878  }
1879 
1880  if(w!=NULL)
1882 
1883  return TRUE;
1884 }
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3533
#define pMaxComp(p)
Definition: polys.h:282
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
#define Q
Definition: sirandom.c:25
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:93
poly * polyset
Definition: hutil.h:15
int length() const
Definition: intvec.h:86
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ idVec2Ideal()

static ideal idVec2Ideal ( poly  vec)
inlinestatic

Definition at line 156 of file ideals.h.

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

§ idXXX()

ideal idXXX ( ideal  h1,
int  k 
)

Definition at line 657 of file ideals.cc.

658 {
659  ideal s_h1;
660  intvec *w=NULL;
661 
662  assume(currRing != NULL);
663  ring orig_ring=currRing;
664  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
665 
666  rSetSyzComp(k,syz_ring);
667 
668  if (orig_ring != syz_ring)
669  {
670  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
671  }
672  else
673  {
674  s_h1 = h1;
675  }
676 
677  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
678 
679  if (s_h3==NULL)
680  {
681  return idFreeModule(IDELEMS(h1));
682  }
683 
684  if (orig_ring != syz_ring)
685  {
686  idDelete(&s_h1);
687  idSkipZeroes(s_h3);
688  rChangeCurrRing(orig_ring);
689  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
690  rDelete(syz_ring);
691  idTest(s_h3);
692  return s_h3;
693  }
694 
695  idSkipZeroes(s_h3);
696  idTest(s_h3);
697  return s_h3;
698 }
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define TRUE
Definition: auxiliary.h:101
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
ideal idFreeModule(int i)
Definition: ideals.h:113
#define assume(x)
Definition: mod2.h:403
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4384
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4989
void rChangeCurrRing(ring r)
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:49

Variable Documentation

§ currRing

ring currRing

Widely used global variable which specifies the current polynomial ring for Singular interpreter and legacy implementatins. : one should avoid using it in newer designs, for example due to possible problems in parallelization with threads.

Definition at line 10 of file polys.cc.