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 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

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)
 
void idDelete (ideal *h)
 delete an ideal More...
 
static int idSize (const ideal id)
 Count the effective size of an ideal (without the trailing allocated zero-elements) More...
 
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 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)
 
ideal idVec2Ideal (poly vec)
 
ideal idSeries (int n, ideal M, matrix U=NULL, intvec *w=NULL)
 
BOOLEAN idIsZeroDim (ideal i)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply=TRUE)
 
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 idTransp (ideal a)
 transpose a module More...
 
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

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

Definition at line 56 of file ideals.h.

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

initialise the maximal ideal (at 0)

Definition at line 38 of file ideals.h.

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

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

Definition at line 42 of file ideals.h.

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

Definition at line 62 of file ideals.h.

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

Definition at line 58 of file ideals.h.

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

Definition at line 63 of file ideals.h.

Typedef Documentation

typedef ideal* resolvente

Definition at line 20 of file ideals.h.

Function Documentation

int binom ( int  n,
int  r 
)

Definition at line 894 of file simpleideals.cc.

895 {
896  int i,result;
897 
898  if (r==0) return 1;
899  if (n-r<r) return binom(n,n-r);
900  result = n-r+1;
901  for (i=2;i<=r;i++)
902  {
903  result *= n-r+i;
904  if (result<0)
905  {
906  WarnS("overflow in binomials");
907  return 0;
908  }
909  result /= i;
910  }
911  return result;
912 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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
ideal id_Copy ( ideal  h1,
const ring  r 
)

copy an ideal

Definition at line 409 of file simpleideals.cc.

410 {
411  id_Test(h1, r);
412 
413  ideal h2 = idInit(IDELEMS(h1), h1->rank);
414  for (int i=IDELEMS(h1)-1; i>=0; i--)
415  h2->m[i] = p_Copy(h1->m[i],r);
416  return h2;
417 }
#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:811
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
ideal id_Farey ( ideal  x,
number  N,
const ring  r 
)

Definition at line 2505 of file ideals.cc.

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

Definition at line 2405 of file ideals.cc.

2406 {
2407  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2408  intvec *w = NULL;
2409 
2410  ring save_r = currRing; rChangeCurrRing(r); ideal S=idSyzygies(I,testHomog,&w); rChangeCurrRing(save_r);
2411 
2412  if (w!=NULL) delete w;
2413  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2414  id_Delete(&S, r);
2415  poly gcd_p=singclap_pdivide(f,gg, r);
2416  p_Delete(&gg, r);
2417 
2418  return gcd_p;
2419 }
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3378
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:12
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
FILE * f
Definition: checklibs.c:7
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:560
ideal id_TensorModuleMult ( const int  m,
const ideal  M,
const ring  rRing 
)

Definition at line 1641 of file simpleideals.cc.

1642 {
1643 // #ifdef DEBU
1644 // WarnS("tensorModuleMult!!!!");
1645 
1646  assume(m > 0);
1647  assume(M != NULL);
1648 
1649  const int n = rRing->N;
1650 
1651  assume(M->rank <= m * n);
1652 
1653  const int k = IDELEMS(M);
1654 
1655  ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
1656 
1657  for( int i = 0; i < k; i++ ) // for every w \in M
1658  {
1659  poly pTempSum = NULL;
1660 
1661  poly w = M->m[i];
1662 
1663  while(w != NULL) // for each term of w...
1664  {
1665  poly h = p_Head(w, rRing);
1666 
1667  const int gen = p_GetComp(h, rRing); // 1 ...
1668 
1669  assume(gen > 0);
1670  assume(gen <= n*m);
1671 
1672  // TODO: write a formula with %, / instead of while!
1673  /*
1674  int c = gen;
1675  int v = 1;
1676  while(c > m)
1677  {
1678  c -= m;
1679  v++;
1680  }
1681  */
1682 
1683  int cc = gen % m;
1684  if( cc == 0) cc = m;
1685  int vv = 1 + (gen - cc) / m;
1686 
1687 // assume( cc == c );
1688 // assume( vv == v );
1689 
1690  // 1<= c <= m
1691  assume( cc > 0 );
1692  assume( cc <= m );
1693 
1694  assume( vv > 0 );
1695  assume( vv <= n );
1696 
1697  assume( (cc + (vv-1)*m) == gen );
1698 
1699  p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
1700  p_SetComp(h, cc, rRing);
1701 
1702  p_Setm(h, rRing); // addjust degree after the previous steps!
1703 
1704  pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
1705 
1706  pIter(w);
1707  }
1708 
1709  idTemp->m[i] = pTempSum;
1710  }
1711 
1712  // simplify idTemp???
1713 
1714  ideal idResult = id_Transp(idTemp, rRing);
1715 
1716  id_Delete(&idTemp, rRing);
1717 
1718  return(idResult);
1719 }
ideal id_Transp(ideal a, const ring rRing)
static long p_IncrExp(poly p, int v, ring r)
Definition: p_polys.h:587
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
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:819
#define assume(x)
Definition: mod2.h:405
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:436
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
static Poly * h
Definition: janet.cc:978
ideal idAdd ( ideal  h1,
ideal  h2 
)
inline

h1 + h2

Definition at line 84 of file ideals.h.

85 {
86  return id_Add(h1, h2, currRing);
87 }
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:12
matrix idCoeffOfKBase ( ideal  arg,
ideal  kbase,
poly  how 
)

Definition at line 2281 of file ideals.cc.

2282 {
2283  matrix result;
2284  ideal tempKbase;
2285  poly p,q;
2286  intvec * convert;
2287  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2288 #if 0
2289  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2290  if (idIs0(arg))
2291  return mpNew(i,1);
2292  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2293  result = mpNew(i,j);
2294 #else
2295  result = mpNew(i, j);
2296  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2297 #endif
2298 
2299  tempKbase = idCreateSpecialKbase(kbase,&convert);
2300  for (k=0;k<j;k++)
2301  {
2302  p = arg->m[k];
2303  while (p!=NULL)
2304  {
2305  q = idDecompose(p,how,tempKbase,&pos);
2306  if (pos>=0)
2307  {
2308  MATELEM(result,(*convert)[pos],k+1) =
2309  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2310  }
2311  else
2312  p_Delete(&q,currRing);
2313  pIter(p);
2314  }
2315  }
2316  idDelete(&tempKbase);
2317  return result;
2318 }
#define pAdd(p, q)
Definition: polys.h:174
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2249
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:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2195
#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:850
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idCopy ( ideal  A)
inline

Definition at line 76 of file ideals.h.

77 {
78  return id_Copy(A, currRing);
79 }
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:12
ideal idCopyFirstK ( const ideal  ide,
const int  k 
)
inline

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:12
void idDelEquals ( ideal  id)

Definition at line 2650 of file ideals.cc.

2651 {
2652  int idsize = IDELEMS(id);
2653  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
2654  for (int i = 0; i < idsize; i++)
2655  {
2656  id_sort[i].p = id->m[i];
2657  id_sort[i].index = i;
2658  }
2659  idSort_qsort(id_sort, idsize);
2660  int index, index_i, index_j;
2661  int i = 0;
2662  for (int j = 1; j < idsize; j++)
2663  {
2664  if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
2665  {
2666  index_i = id_sort[i].index;
2667  index_j = id_sort[j].index;
2668  if (index_j > index_i)
2669  {
2670  index = index_j;
2671  }
2672  else
2673  {
2674  index = index_i;
2675  i = j;
2676  }
2677  pDelete(&id->m[index]);
2678  }
2679  else
2680  {
2681  i = j;
2682  }
2683  }
2684  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
2685 }
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
#define pEqualPolys(p1, p2)
Definition: polys.h:372
int index
Definition: ideals.cc:2632
int j
Definition: myNF.cc:70
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2641
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:597
poly p
Definition: ideals.cc:2631
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:157
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void idDelete ( ideal *  h)
inline

delete an ideal

Definition at line 31 of file ideals.h.

32 {
34 }
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
static Poly * h
Definition: janet.cc:978
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
matrix idDiff ( matrix  i,
int  k 
)

Definition at line 1953 of file ideals.cc.

1954 {
1955  int e=MATCOLS(i)*MATROWS(i);
1956  matrix r=mpNew(MATROWS(i),MATCOLS(i));
1957  r->rank=i->rank;
1958  int j;
1959  for(j=0; j<e; j++)
1960  {
1961  r->m[j]=pDiff(i->m[j],k);
1962  }
1963  return r;
1964 }
int k
Definition: cfEzgcd.cc:93
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:267
#define MATROWS(i)
Definition: matpol.h:27
long rank
Definition: matpol.h:20
matrix idDiffOp ( ideal  I,
ideal  J,
BOOLEAN  multiply = TRUE 
)

Definition at line 1966 of file ideals.cc.

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

Definition at line 1403 of file ideals.cc.

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

Definition at line 126 of file ideals.h.

127 {
128  return id_FreeModule (i, currRing);
129 }
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:12
void idGetNextChoise ( int  r,
int  end,
BOOLEAN endch,
int *  choise 
)

Definition at line 836 of file simpleideals.cc.

837 {
838  int i = r-1,j;
839  while ((i >= 0) && (choise[i] == end))
840  {
841  i--;
842  end--;
843  }
844  if (i == -1)
845  *endch = TRUE;
846  else
847  {
848  choise[i]++;
849  for (j=i+1; j<r; j++)
850  {
851  choise[j] = choise[i]+j-i;
852  }
853  *endch = FALSE;
854  }
855 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int idGetNumberOfChoise ( int  t,
int  d,
int  begin,
int  end,
int *  choise 
)

Definition at line 862 of file simpleideals.cc.

863 {
864  int * localchoise,i,result=0;
865  BOOLEAN b=FALSE;
866 
867  if (d<=1) return 1;
868  localchoise=(int*)omAlloc((d-1)*sizeof(int));
869  idInitChoise(d-1,begin,end,&b,localchoise);
870  while (!b)
871  {
872  result++;
873  i = 0;
874  while ((i<t) && (localchoise[i]==choise[i])) i++;
875  if (i>=t)
876  {
877  i = t+1;
878  while ((i<d) && (localchoise[i-1]==choise[i])) i++;
879  if (i>=d)
880  {
881  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
882  return result;
883  }
884  }
885  idGetNextChoise(d-1,end,&b,localchoise);
886  }
887  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
888  return 0;
889 }
#define FALSE
Definition: auxiliary.h:140
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:161
#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:131
const poly b
Definition: syzextra.cc:213
return result
Definition: facAbsBiFact.cc:76
ideal idHead ( ideal  h)
BOOLEAN idHomIdeal ( ideal  id,
ideal  Q = NULL 
)
inline

Definition at line 106 of file ideals.h.

107 {
108  return id_HomIdeal(id, Q, currRing);
109 }
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:12
BOOLEAN idHomModule ( ideal  m,
ideal  Q,
intvec **  w 
)
inline

Definition at line 111 of file ideals.h.

112 {
113  return id_HomModule(m, Q, w, currRing);
114 }
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:12
void idInitChoise ( int  r,
int  beg,
int  end,
BOOLEAN endch,
int *  choise 
)

Definition at line 814 of file simpleideals.cc.

815 {
816  /*returns the first choise of r numbers between beg and end*/
817  int i;
818  for (i=0; i<r; i++)
819  {
820  choise[i] = 0;
821  }
822  if (r <= end-beg+1)
823  for (i=0; i<r; i++)
824  {
825  choise[i] = beg+i;
826  }
827  if (r > end-beg+1)
828  *endch = TRUE;
829  else
830  *endch = FALSE;
831 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
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 642 of file simpleideals.cc.

643 {
644  if (h2==NULL) return FALSE;
645  assume (h1 != NULL);
646 
647  int j = IDELEMS(h1) - 1;
648 
649  while ((j >= 0) && (h1->m[j] == NULL)) j--;
650  j++;
651  if (j==IDELEMS(h1))
652  {
653  pEnlargeSet(&(h1->m),IDELEMS(h1),16);
654  IDELEMS(h1)+=16;
655  }
656  h1->m[j]=h2;
657  return TRUE;
658 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#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:3540
BOOLEAN idInsertPolyWithTests ( ideal  h1,
const int  validEntries,
const poly  h2,
const bool  zeroOk,
const bool  duplicateOk 
)
inline

Definition at line 90 of file ideals.h.

91 {
92  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, currRing);
93 }
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:12
BOOLEAN idIs0 ( ideal  h)

returns true if h is the zero ideal

Definition at line 749 of file simpleideals.cc.

750 {
751  assume (h != NULL); // will fail :(
752 // if (h == NULL) return TRUE;
753 
754  for( int i = IDELEMS(h)-1; i >= 0; i-- )
755  if(h->m[i] != NULL)
756  return FALSE;
757 
758  return TRUE;
759 
760 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
#define assume(x)
Definition: mod2.h:405
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
BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 1863 of file ideals.cc.

1864 {
1865  int i;
1866  poly p;
1867 
1868  if (idIs0(id1)) return TRUE;
1869  for (i=0;i<IDELEMS(id1);i++)
1870  {
1871  if (id1->m[i] != NULL)
1872  {
1873  p = kNF(id2,currRing->qideal,id1->m[i]);
1874  if (p != NULL)
1875  {
1876  p_Delete(&p,currRing);
1877  return FALSE;
1878  }
1879  }
1880  }
1881  return TRUE;
1882 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:850
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN idIsZeroDim ( ideal  i)
inline

Definition at line 176 of file ideals.h.

177 {
178  return id_IsZeroDim(i, currRing);
179 }
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:12
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 2581 of file ideals.cc.

2582 {
2583  for (int i = IDELEMS(id)-1; i >= k; i--)
2584  {
2585  if (id->m[i] != NULL) pDelete(&id->m[i]);
2586  }
2587  int kk=k;
2588  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2589  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2590  IDELEMS(id) = kk;
2591 }
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:3540
#define pDelete(p_ptr)
Definition: polys.h:157
ideal idLift ( ideal  mod,
ideal  sumod,
ideal *  rest = NULL,
BOOLEAN  goodShape = FALSE,
BOOLEAN  isSB = TRUE,
BOOLEAN  divide = FALSE,
matrix unit = NULL 
)

Definition at line 938 of file ideals.cc.

940 {
941  int lsmod =id_RankFreeModule(submod,currRing), j, k;
942  int comps_to_add=0;
943  poly p;
944 
945  if (idIs0(submod))
946  {
947  if (unit!=NULL)
948  {
949  *unit=mpNew(1,1);
950  MATELEM(*unit,1,1)=pOne();
951  }
952  if (rest!=NULL)
953  {
954  *rest=idInit(1,mod->rank);
955  }
956  return idInit(1,mod->rank);
957  }
958  if (idIs0(mod)) /* and not idIs0(submod) */
959  {
960  WerrorS("2nd module does not lie in the first");
961  return NULL;
962  }
963  if (unit!=NULL)
964  {
965  comps_to_add = IDELEMS(submod);
966  while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
967  comps_to_add--;
968  }
970  if ((k!=0) && (lsmod==0)) lsmod=1;
971  k=si_max(k,(int)mod->rank);
972  if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
973 
974  ring orig_ring=currRing;
975  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
976  rSetSyzComp(k,syz_ring);
977 
978  ideal s_mod, s_temp;
979  if (orig_ring != syz_ring)
980  {
981  s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
982  s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
983  }
984  else
985  {
986  s_mod = mod;
987  s_temp = idCopy(submod);
988  }
989  ideal s_h3;
990  if (isSB)
991  {
992  s_h3 = idCopy(s_mod);
993  idPrepareStd(s_h3, k+comps_to_add);
994  }
995  else
996  {
997  s_h3 = idPrepare(s_mod,(tHomog)FALSE,k+comps_to_add,NULL);
998  }
999  if (!goodShape)
1000  {
1001  for (j=0;j<IDELEMS(s_h3);j++)
1002  {
1003  if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
1004  p_Delete(&(s_h3->m[j]),currRing);
1005  }
1006  }
1007  idSkipZeroes(s_h3);
1008  if (lsmod==0)
1009  {
1010  id_Shift(s_temp,1,currRing);
1011  }
1012  if (unit!=NULL)
1013  {
1014  for(j = 0;j<comps_to_add;j++)
1015  {
1016  p = s_temp->m[j];
1017  if (p!=NULL)
1018  {
1019  while (pNext(p)!=NULL) pIter(p);
1020  pNext(p) = pOne();
1021  pIter(p);
1022  pSetComp(p,1+j+k);
1023  pSetmComp(p);
1024  p = pNeg(p);
1025  }
1026  }
1027  s_temp->rank += k;
1028  }
1029  ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1030  s_result->rank = s_h3->rank;
1031  ideal s_rest = idInit(IDELEMS(s_result),k);
1032  idDelete(&s_h3);
1033  idDelete(&s_temp);
1034 
1035  for (j=0;j<IDELEMS(s_result);j++)
1036  {
1037  if (s_result->m[j]!=NULL)
1038  {
1039  if (pGetComp(s_result->m[j])<=k)
1040  {
1041  if (!divide)
1042  {
1043  if (isSB)
1044  {
1045  WarnS("first module not a standardbasis\n"
1046  "// ** or second not a proper submodule");
1047  }
1048  else
1049  WerrorS("2nd module does not lie in the first");
1050  idDelete(&s_result);
1051  idDelete(&s_rest);
1052  s_result=idInit(IDELEMS(submod),submod->rank);
1053  break;
1054  }
1055  else
1056  {
1057  p = s_rest->m[j] = s_result->m[j];
1058  while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1059  s_result->m[j] = pNext(p);
1060  pNext(p) = NULL;
1061  }
1062  }
1063  p_Shift(&(s_result->m[j]),-k,currRing);
1064  pNeg(s_result->m[j]);
1065  }
1066  }
1067  if ((lsmod==0) && (s_rest!=NULL))
1068  {
1069  for (j=IDELEMS(s_rest);j>0;j--)
1070  {
1071  if (s_rest->m[j-1]!=NULL)
1072  {
1073  p_Shift(&(s_rest->m[j-1]),-1,currRing);
1074  s_rest->m[j-1] = s_rest->m[j-1];
1075  }
1076  }
1077  }
1078  if(syz_ring!=orig_ring)
1079  {
1080  idDelete(&s_mod);
1081  rChangeCurrRing(orig_ring);
1082  s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1083  s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1084  rDelete(syz_ring);
1085  }
1086  if (rest!=NULL)
1087  *rest = s_rest;
1088  else
1089  idDelete(&s_rest);
1090 //idPrint(s_result);
1091  if (unit!=NULL)
1092  {
1093  *unit=mpNew(comps_to_add,comps_to_add);
1094  int i;
1095  for(i=0;i<IDELEMS(s_result);i++)
1096  {
1097  poly p=s_result->m[i];
1098  poly q=NULL;
1099  while(p!=NULL)
1100  {
1101  if(pGetComp(p)<=comps_to_add)
1102  {
1103  pSetComp(p,0);
1104  if (q!=NULL)
1105  {
1106  pNext(q)=pNext(p);
1107  }
1108  else
1109  {
1110  pIter(s_result->m[i]);
1111  }
1112  pNext(p)=NULL;
1113  MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1114  if(q!=NULL) p=pNext(q);
1115  else p=s_result->m[i];
1116  }
1117  else
1118  {
1119  q=p;
1120  pIter(p);
1121  }
1122  }
1123  p_Shift(&s_result->m[i],-comps_to_add,currRing);
1124  }
1125  }
1126  return s_result;
1127 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:904
#define pAdd(p, q)
Definition: polys.h:174
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define pNeg(p)
Definition: polys.h:169
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
#define pMinComp(p)
Definition: polys.h:271
#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:12
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:166
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#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:76
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
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:850
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:465
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idLiftStd ( ideal  h1,
matrix m,
tHomog  h = testHomog,
ideal *  syz = NULL 
)

Definition at line 751 of file ideals.cc.

752 {
753  int i, j, t, inputIsIdeal=id_RankFreeModule(h1,currRing);
754  long k;
755  poly p=NULL, q;
756  intvec *w=NULL;
757 
758  idDelete((ideal*)ma);
759  BOOLEAN lift3=FALSE;
760  if (syz!=NULL) { lift3=TRUE; idDelete(syz); }
761  if (idIs0(h1))
762  {
763  *ma=mpNew(1,0);
764  if (lift3)
765  {
766  *syz=idFreeModule(IDELEMS(h1));
767  }
768  return idInit(1,h1->rank);
769  }
770 
771  BITSET save2;
772  SI_SAVE_OPT2(save2);
773 
774  k=si_max((long)1,id_RankFreeModule(h1,currRing));
775 
776  if ((k==1) && (!lift3)) si_opt_2 |=Sy_bit(V_IDLIFT);
777 
778  ring orig_ring = currRing;
779  ring syz_ring = rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
780  rSetSyzComp(k,syz_ring);
781 
782  ideal s_h1=h1;
783 
784  if (orig_ring != syz_ring)
785  s_h1 = idrCopyR_NoSort(h1,orig_ring,syz_ring);
786  else
787  s_h1 = h1;
788 
789  ideal s_h3=idPrepare(s_h1,hi,k,&w); // main (syz) GB computation
790 
791  ideal s_h2 = idInit(IDELEMS(s_h3), s_h3->rank);
792 
793  if (lift3) (*syz)=idInit(IDELEMS(s_h3),IDELEMS(h1));
794 
795  if (w!=NULL) delete w;
796  i = 0;
797 
798  // now sort the result, SB : leave in s_h3
799  // T: put in s_h2
800  // syz: put in *syz
801  for (j=0; j<IDELEMS(s_h3); j++)
802  {
803  if (s_h3->m[j] != NULL)
804  {
805  //if (p_MinComp(s_h3->m[j],syz_ring) <= k)
806  if (pGetComp(s_h3->m[j]) <= k) // syz_ring == currRing
807  {
808  i++;
809  q = s_h3->m[j];
810  while (pNext(q) != NULL)
811  {
812  if (pGetComp(pNext(q)) > k)
813  {
814  s_h2->m[j] = pNext(q);
815  pNext(q) = NULL;
816  }
817  else
818  {
819  pIter(q);
820  }
821  }
822  if (!inputIsIdeal) p_Shift(&(s_h3->m[j]), -1,currRing);
823  }
824  else
825  {
826  // we a syzygy here:
827  if (lift3)
828  {
829  p_Shift(&s_h3->m[j], -k,currRing);
830  (*syz)->m[j]=s_h3->m[j];
831  s_h3->m[j]=NULL;
832  }
833  else
834  p_Delete(&(s_h3->m[j]),currRing);
835  }
836  }
837  }
838  idSkipZeroes(s_h3);
839  //extern char * iiStringMatrix(matrix im, int dim,char ch);
840  //PrintS("SB: ----------------------------------------\n");
841  //PrintS(iiStringMatrix((matrix)s_h3,k,'\n'));
842  //PrintLn();
843  //PrintS("T: ----------------------------------------\n");
844  //PrintS(iiStringMatrix((matrix)s_h2,h1->rank,'\n'));
845  //PrintLn();
846 
847  if (lift3) idSkipZeroes(*syz);
848 
849  j = IDELEMS(s_h1);
850 
851 
852  if (syz_ring!=orig_ring)
853  {
854  idDelete(&s_h1);
855  rChangeCurrRing(orig_ring);
856  }
857 
858  *ma = mpNew(j,i);
859 
860  i = 1;
861  for (j=0; j<IDELEMS(s_h2); j++)
862  {
863  if (s_h2->m[j] != NULL)
864  {
865  q = prMoveR( s_h2->m[j], syz_ring,orig_ring);
866  s_h2->m[j] = NULL;
867 
868  if (q!=NULL)
869  {
870  q=pReverse(q);
871  while (q != NULL)
872  {
873  p = q;
874  pIter(q);
875  pNext(p) = NULL;
876  t=pGetComp(p);
877  pSetComp(p,0);
878  pSetmComp(p);
879  MATELEM(*ma,t-k,i) = pAdd(MATELEM(*ma,t-k,i),p);
880  }
881  }
882  i++;
883  }
884  }
885  idDelete(&s_h2);
886 
887  for (i=0; i<IDELEMS(s_h3); i++)
888  {
889  s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], syz_ring,orig_ring);
890  }
891  if (lift3)
892  {
893  for (i=0; i<IDELEMS(*syz); i++)
894  {
895  (*syz)->m[i] = prMoveR_NoSort((*syz)->m[i], syz_ring,orig_ring);
896  }
897  }
898 
899  if (syz_ring!=orig_ring) rDelete(syz_ring);
900  SI_RESTORE_OPT2(save2);
901  return s_h3;
902 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
#define pAdd(p, q)
Definition: polys.h:174
#define FALSE
Definition: auxiliary.h:140
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:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
int k
Definition: cfEzgcd.cc:93
#define BITSET
Definition: structs.h:17
#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:12
Definition: intvec.h:16
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:126
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
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:324
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
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:850
#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:465
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:131
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define SI_SAVE_OPT2(A)
Definition: options.h:21
void idLiftW ( ideal  P,
ideal  Q,
int  n,
matrix T,
ideal &  R,
short *  w = NULL 
)

Definition at line 1133 of file ideals.cc.

1134 {
1135  long N=0;
1136  int i;
1137  for(i=IDELEMS(Q)-1;i>=0;i--)
1138  if(w==NULL)
1139  N=si_max(N,p_Deg(Q->m[i],currRing));
1140  else
1141  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1142  N+=n;
1143 
1144  T=mpNew(IDELEMS(Q),IDELEMS(P));
1145  R=idInit(IDELEMS(P),P->rank);
1146 
1147  for(i=IDELEMS(P)-1;i>=0;i--)
1148  {
1149  poly p;
1150  if(w==NULL)
1151  p=ppJet(P->m[i],N);
1152  else
1153  p=ppJetW(P->m[i],N,w);
1154 
1155  int j=IDELEMS(Q)-1;
1156  while(p!=NULL)
1157  {
1158  if(pDivisibleBy(Q->m[j],p))
1159  {
1160  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1161  if(w==NULL)
1162  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1163  else
1164  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1165  pNormalize(p);
1166  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1167  p_Delete(&p0,currRing);
1168  else
1169  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1170  j=IDELEMS(Q)-1;
1171  }
1172  else
1173  {
1174  if(j==0)
1175  {
1176  poly p0=p;
1177  pIter(p);
1178  pNext(p0)=NULL;
1179  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1180  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1181  p_Delete(&p0,currRing);
1182  else
1183  R->m[i]=pAdd(R->m[i],p0);
1184  j=IDELEMS(Q)-1;
1185  }
1186  else
1187  j--;
1188  }
1189  }
1190  }
1191 }
#define pAdd(p, q)
Definition: polys.h:174
#define ppJet(p, m)
Definition: polys.h:338
return P p
Definition: myNF.cc:203
#define ppMult_mm(p, m)
Definition: polys.h:172
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define Q
Definition: sirandom.c:25
#define pJetW(p, m, iv)
Definition: polys.h:341
#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:12
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:689
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
#define pSub(a, b)
Definition: polys.h:258
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define pJet(p, m)
Definition: polys.h:339
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
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:850
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:1501
#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:126
#define R
Definition: sirandom.c:26
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:340
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idMinBase ( ideal  h1)

Definition at line 53 of file ideals.cc.

54 {
55  ideal h2, h3,h4,e;
56  int j,k;
57  int i,l,ll;
58  intvec * wth;
59  BOOLEAN homog;
60  #ifdef HAVE_RINGS
62  {
63  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
64  e=idCopy(h1);
65  return e;
66  }
67  #endif
68  homog = idHomModule(h1,currRing->qideal,&wth);
70  {
71  if(!homog)
72  {
73  WarnS("minbase applies only to the local or homogeneous case over coefficient fields");
74  e=idCopy(h1);
75  return e;
76  }
77  else
78  {
79  ideal re=kMin_std(h1,currRing->qideal,(tHomog)homog,&wth,h2,NULL,0,3);
80  idDelete(&re);
81  return h2;
82  }
83  }
84  e=idInit(1,h1->rank);
85  if (idIs0(h1))
86  {
87  return e;
88  }
89  pEnlargeSet(&(e->m),IDELEMS(e),15);
90  IDELEMS(e) = 16;
91  h2 = kStd(h1,currRing->qideal,isNotHomog,NULL);
92  h3 = idMaxIdeal(1);
93  h4=idMult(h2,h3);
94  idDelete(&h3);
95  h3=kStd(h4,currRing->qideal,isNotHomog,NULL);
96  k = IDELEMS(h3);
97  while ((k > 0) && (h3->m[k-1] == NULL)) k--;
98  j = -1;
99  l = IDELEMS(h2);
100  while ((l > 0) && (h2->m[l-1] == NULL)) l--;
101  for (i=l-1; i>=0; i--)
102  {
103  if (h2->m[i] != NULL)
104  {
105  ll = 0;
106  while ((ll < k) && ((h3->m[ll] == NULL)
107  || !pDivisibleBy(h3->m[ll],h2->m[i])))
108  ll++;
109  if (ll >= k)
110  {
111  j++;
112  if (j > IDELEMS(e)-1)
113  {
114  pEnlargeSet(&(e->m),IDELEMS(e),16);
115  IDELEMS(e) += 16;
116  }
117  e->m[j] = pCopy(h2->m[i]);
118  }
119  }
120  }
121  idDelete(&h2);
122  idDelete(&h3);
123  idDelete(&h4);
124  if (currRing->qideal!=NULL)
125  {
126  h3=idInit(1,e->rank);
127  h2=kNF(h3,currRing->qideal,e);
128  idDelete(&h3);
129  idDelete(&e);
130  e=h2;
131  }
132  idSkipZeroes(e);
133  return e;
134 }
#define idMaxIdeal(D)
initialise the maximal ideal (at 0)
Definition: ideals.h:38
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2815
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:2221
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:12
Definition: intvec.h:16
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:76
ideal idMult(ideal h1, ideal h2)
hh := h1 * h2
Definition: ideals.h:99
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:437
#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:126
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:752
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2664
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:111
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
ideal idMinEmbedding ( ideal  arg,
BOOLEAN  inPlace = FALSE,
intvec **  w = NULL 
)

Definition at line 2347 of file ideals.cc.

2348 {
2349  if (idIs0(arg)) return idInit(1,arg->rank);
2350  int i,next_gen,next_comp;
2351  ideal res=arg;
2352  if (!inPlace) res = idCopy(arg);
2353  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2354  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2355  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2356 
2357  int del=0;
2358  loop
2359  {
2360  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2361  if (next_gen<0) break;
2362  del++;
2363  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2364  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2365  if ((w !=NULL)&&(*w!=NULL))
2366  {
2367  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2368  }
2369  }
2370 
2371  idDeleteComps(res,red_comp,del);
2372  idSkipZeroes(res);
2373  omFree(red_comp);
2374 
2375  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2376  {
2377  int nl=si_max((*w)->length()-del,1);
2378  intvec *wtmp=new intvec(nl);
2379  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2380  delete *w;
2381  *w=wtmp;
2382  }
2383  return res;
2384 }
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:12
Definition: intvec.h:16
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:166
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:76
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:2320
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
ideal idMinors ( matrix  a,
int  ar,
ideal  R = NULL 
)

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

Definition at line 1794 of file ideals.cc.

1795 {
1796 
1797  const ring origR=currRing;
1798  id_Test((ideal)a, origR);
1799 
1800  const int r = a->nrows;
1801  const int c = a->ncols;
1802 
1803  if((ar<=0) || (ar>r) || (ar>c))
1804  {
1805  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
1806  return NULL;
1807  }
1808 
1809  ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
1810  long bound = sm_ExpBound(h,c,r,ar,origR);
1811  id_Delete(&h, origR);
1812 
1813  ring tmpR = sm_RingChange(origR,bound);
1814 
1815  matrix b = mpNew(r,c);
1816 
1817  for (int i=r*c-1;i>=0;i--)
1818  if (a->m[i] != NULL)
1819  b->m[i] = prCopyR(a->m[i],origR,tmpR);
1820 
1821  id_Test( (ideal)b, tmpR);
1822 
1823  if (R!=NULL)
1824  {
1825  R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
1826  //if (ar>1) // otherwise done in mpMinorToResult
1827  //{
1828  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
1829  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
1830  // idDelete((ideal*)&b); b=bb;
1831  //}
1832  id_Test( R, tmpR);
1833  }
1834 
1835 
1836  ideal result = idInit(32,1);
1837 
1838  int elems = 0;
1839 
1840  if(ar>1)
1841  mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
1842  else
1843  mp_MinorToResult(result,elems,b,r,c,R,tmpR);
1844 
1845  id_Test( (ideal)b, tmpR);
1846 
1847  id_Delete((ideal *)&b, tmpR);
1848 
1849  if (R!=NULL) idDelete(&R);
1850 
1851  idSkipZeroes(result);
1852  rChangeCurrRing(origR);
1853  result = idrMoveR(result,tmpR,origR);
1854  sm_KillModifiedRing(tmpR);
1855  idTest(result);
1856  return result;
1857 }
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc: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:12
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int nrows
Definition: matpol.h:21
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:14
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
#define R
Definition: sirandom.c:26
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:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define idTest(id)
Definition: ideals.h:63
ideal idModulo ( ideal  h1,
ideal  h2,
tHomog  h = testHomog,
intvec **  w = NULL 
)

Definition at line 2038 of file ideals.cc.

2039 {
2040  intvec *wtmp=NULL;
2041 
2042  int i,k,rk,flength=0,slength,length;
2043  poly p,q;
2044 
2045  if (idIs0(h2))
2046  return idFreeModule(si_max(1,h2->ncols));
2047  if (!idIs0(h1))
2048  flength = id_RankFreeModule(h1,currRing);
2049  slength = id_RankFreeModule(h2,currRing);
2050  length = si_max(flength,slength);
2051  if (length==0)
2052  {
2053  length = 1;
2054  }
2055  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2056  if ((w!=NULL)&&((*w)!=NULL))
2057  {
2058  //Print("input weights:");(*w)->show(1);PrintLn();
2059  int d;
2060  int k;
2061  wtmp=new intvec(length+IDELEMS(h2));
2062  for (i=0;i<length;i++)
2063  ((*wtmp)[i])=(**w)[i];
2064  for (i=0;i<IDELEMS(h2);i++)
2065  {
2066  poly p=h2->m[i];
2067  if (p!=NULL)
2068  {
2069  d = p_Deg(p,currRing);
2070  k= pGetComp(p);
2071  if (slength>0) k--;
2072  d +=((**w)[k]);
2073  ((*wtmp)[i+length]) = d;
2074  }
2075  }
2076  //Print("weights:");wtmp->show(1);PrintLn();
2077  }
2078  for (i=0;i<IDELEMS(h2);i++)
2079  {
2080  temp->m[i] = pCopy(h2->m[i]);
2081  q = pOne();
2082  pSetComp(q,i+1+length);
2083  pSetmComp(q);
2084  if(temp->m[i]!=NULL)
2085  {
2086  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2087  p = temp->m[i];
2088  while (pNext(p)!=NULL) pIter(p);
2089  pNext(p) = q; // will be sorted later correctly
2090  }
2091  else
2092  temp->m[i]=q;
2093  }
2094  rk = k = IDELEMS(h2);
2095  if (!idIs0(h1))
2096  {
2097  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2098  IDELEMS(temp) += IDELEMS(h1);
2099  for (i=0;i<IDELEMS(h1);i++)
2100  {
2101  if (h1->m[i]!=NULL)
2102  {
2103  temp->m[k] = pCopy(h1->m[i]);
2104  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2105  k++;
2106  }
2107  }
2108  }
2109 
2110  ring orig_ring=currRing;
2111  ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE); rChangeCurrRing(syz_ring);
2112  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2113  // therefore we disable OPT_RETURN_SB for modulo:
2114  // (see tr. #701)
2115  //if (TEST_OPT_RETURN_SB)
2116  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2117  //else
2118  rSetSyzComp(length, syz_ring);
2119  ideal s_temp;
2120 
2121  if (syz_ring != orig_ring)
2122  {
2123  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2124  }
2125  else
2126  {
2127  s_temp = temp;
2128  }
2129 
2130  idTest(s_temp);
2131  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2132 
2133  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2134  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2135  {
2136  delete *w;
2137  *w=new intvec(IDELEMS(h2));
2138  for (i=0;i<IDELEMS(h2);i++)
2139  ((**w)[i])=(*wtmp)[i+length];
2140  }
2141  if (wtmp!=NULL) delete wtmp;
2142 
2143  for (i=0;i<IDELEMS(s_temp1);i++)
2144  {
2145  if ((s_temp1->m[i]!=NULL)
2146  && (((int)pGetComp(s_temp1->m[i]))<=length))
2147  {
2148  p_Delete(&(s_temp1->m[i]),currRing);
2149  }
2150  else
2151  {
2152  p_Shift(&(s_temp1->m[i]),-length,currRing);
2153  }
2154  }
2155  s_temp1->rank = rk;
2156  idSkipZeroes(s_temp1);
2157 
2158  if (syz_ring!=orig_ring)
2159  {
2160  rChangeCurrRing(orig_ring);
2161  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2162  rDelete(syz_ring);
2163  // Hmm ... here seems to be a memory leak
2164  // However, simply deleting it causes memory trouble
2165  // idDelete(&s_temp);
2166  }
2167  else
2168  {
2169  idDelete(&temp);
2170  }
2171  idTest(s_temp1);
2172  return s_temp1;
2173 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
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:2221
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:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
Definition: intvec.h:16
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:126
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#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:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:3540
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
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:156
#define idTest(id)
Definition: ideals.h:63
ideal idMult ( ideal  h1,
ideal  h2 
)
inline

hh := h1 * h2

Definition at line 99 of file ideals.h.

100 {
101  return id_Mult(h1, h2, currRing);
102 }
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:12
ideal idMultSect ( resolvente  arg,
int  length 
)

Definition at line 350 of file ideals.cc.

351 {
352  int i,j=0,k=0,syzComp,l,maxrk=-1,realrki;
353  ideal bigmat,tempstd,result;
354  poly p;
355  int isIdeal=0;
356  intvec * w=NULL;
357 
358  /* find 0-ideals and max rank -----------------------------------*/
359  for (i=0;i<length;i++)
360  {
361  if (!idIs0(arg[i]))
362  {
363  realrki=id_RankFreeModule(arg[i],currRing);
364  k++;
365  j += IDELEMS(arg[i]);
366  if (realrki>maxrk) maxrk = realrki;
367  }
368  else
369  {
370  if (arg[i]!=NULL)
371  {
372  return idInit(1,arg[i]->rank);
373  }
374  }
375  }
376  if (maxrk == 0)
377  {
378  isIdeal = 1;
379  maxrk = 1;
380  }
381  /* init -----------------------------------------------------------*/
382  j += maxrk;
383  syzComp = k*maxrk;
384 
385  ring orig_ring=currRing;
386  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
387  rSetSyzComp(syzComp, syz_ring);
388 
389  bigmat = idInit(j,(k+1)*maxrk);
390  /* create unit matrices ------------------------------------------*/
391  for (i=0;i<maxrk;i++)
392  {
393  for (j=0;j<=k;j++)
394  {
395  p = pOne();
396  pSetComp(p,i+1+j*maxrk);
397  pSetmComp(p);
398  bigmat->m[i] = pAdd(bigmat->m[i],p);
399  }
400  }
401  /* enter given ideals ------------------------------------------*/
402  i = maxrk;
403  k = 0;
404  for (j=0;j<length;j++)
405  {
406  if (arg[j]!=NULL)
407  {
408  for (l=0;l<IDELEMS(arg[j]);l++)
409  {
410  if (arg[j]->m[l]!=NULL)
411  {
412  if (syz_ring==orig_ring)
413  bigmat->m[i] = pCopy(arg[j]->m[l]);
414  else
415  bigmat->m[i] = prCopyR(arg[j]->m[l], orig_ring,currRing);
416  p_Shift(&(bigmat->m[i]),k*maxrk+isIdeal,currRing);
417  i++;
418  }
419  }
420  k++;
421  }
422  }
423  /* std computation --------------------------------------------*/
424  tempstd = kStd(bigmat,currRing->qideal,testHomog,&w,NULL,syzComp);
425  if (w!=NULL) delete w;
426  idDelete(&bigmat);
427 
428  if(syz_ring!=orig_ring)
429  rChangeCurrRing(orig_ring);
430 
431  /* interprete result ----------------------------------------*/
432  result = idInit(IDELEMS(tempstd),maxrk);
433  k = 0;
434  for (j=0;j<IDELEMS(tempstd);j++)
435  {
436  if ((tempstd->m[j]!=NULL) && (p_GetComp(tempstd->m[j],syz_ring)>syzComp))
437  {
438  if (syz_ring==orig_ring)
439  p = pCopy(tempstd->m[j]);
440  else
441  p = prCopyR(tempstd->m[j], syz_ring,currRing);
442  p_Shift(&p,-syzComp-isIdeal,currRing);
443  result->m[k] = p;
444  k++;
445  }
446  }
447  /* clean up ----------------------------------------------------*/
448  if(syz_ring!=orig_ring)
449  rChangeCurrRing(syz_ring);
450  idDelete(&tempstd);
451  if(syz_ring!=orig_ring)
452  {
453  rChangeCurrRing(orig_ring);
454  rDelete(syz_ring);
455  }
456  idSkipZeroes(result);
457  return result;
458 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
#define pAdd(p, q)
Definition: polys.h:174
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
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:2221
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:12
Definition: intvec.h:16
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:286
#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:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
intvec* idMWLift ( ideal  mod,
intvec weights 
)

Definition at line 2178 of file ideals.cc.

2179 {
2180  if (idIs0(mod)) return new intvec(2);
2181  int i=IDELEMS(mod);
2182  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2183  intvec *result = new intvec(i+1);
2184  while (i>0)
2185  {
2186  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2187  }
2188  return result;
2189 }
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:12
Definition: intvec.h:16
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
ideal idQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb = FALSE,
BOOLEAN  resultIsIdeal = FALSE 
)

Definition at line 1310 of file ideals.cc.

1311 {
1312  // first check for special case h1:(0)
1313  if (idIs0(h2))
1314  {
1315  ideal res;
1316  if (resultIsIdeal)
1317  {
1318  res = idInit(1,1);
1319  res->m[0] = pOne();
1320  }
1321  else
1322  res = idFreeModule(h1->rank);
1323  return res;
1324  }
1325  BITSET old_test1;
1326  SI_SAVE_OPT1(old_test1);
1327  int i, kmax;
1328  BOOLEAN addOnlyOne=TRUE;
1329  tHomog hom=isNotHomog;
1330  intvec * weights1;
1331 
1332  ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1333 
1334  hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1335 
1336  ring orig_ring=currRing;
1337  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
1338  rSetSyzComp(kmax-1,syz_ring);
1339  if (orig_ring!=syz_ring)
1340  // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1341  s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1342  idTest(s_h4);
1343  #if 0
1344  void ipPrint_MA0(matrix m, const char *name);
1345  matrix m=idModule2Matrix(idCopy(s_h4));
1346  PrintS("start:\n");
1347  ipPrint_MA0(m,"Q");
1348  idDelete((ideal *)&m);
1349  PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1350  #endif
1351  ideal s_h3;
1352  if (addOnlyOne)
1353  {
1354  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1355  }
1356  else
1357  {
1358  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1359  }
1360  SI_RESTORE_OPT1(old_test1);
1361  #if 0
1362  // only together with the above debug stuff
1363  idSkipZeroes(s_h3);
1364  m=idModule2Matrix(idCopy(s_h3));
1365  Print("result, kmax=%d:\n",kmax);
1366  ipPrint_MA0(m,"S");
1367  idDelete((ideal *)&m);
1368  #endif
1369  idTest(s_h3);
1370  if (weights1!=NULL) delete weights1;
1371  idDelete(&s_h4);
1372 
1373  for (i=0;i<IDELEMS(s_h3);i++)
1374  {
1375  if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1376  {
1377  if (resultIsIdeal)
1378  p_Shift(&s_h3->m[i],-kmax,currRing);
1379  else
1380  p_Shift(&s_h3->m[i],-kmax+1,currRing);
1381  }
1382  else
1383  p_Delete(&s_h3->m[i],currRing);
1384  }
1385  if (resultIsIdeal)
1386  s_h3->rank = 1;
1387  else
1388  s_h3->rank = h1->rank;
1389  if(syz_ring!=orig_ring)
1390  {
1391  rChangeCurrRing(orig_ring);
1392  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1393  rDelete(syz_ring);
1394  }
1395  idSkipZeroes(s_h3);
1396  idTest(s_h3);
1397  return s_h3;
1398 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
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:2221
static void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:63
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define BITSET
Definition: structs.h:17
#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:12
static ideal idInitializeQuot(ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
Definition: ideals.cc:1198
Definition: intvec.h:16
tHomog
Definition: structs.h:37
ideal idFreeModule(int i)
Definition: ideals.h:126
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:294
#define pOne()
Definition: polys.h:286
#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:76
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
char name(const Variable &v)
Definition: variable.h:95
#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:281
int BOOLEAN
Definition: auxiliary.h:131
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:111
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:63
ideal idSect ( ideal  h1,
ideal  h2 
)

Definition at line 211 of file ideals.cc.

212 {
213  int i,j,k,length;
214  int flength = id_RankFreeModule(h1,currRing);
215  int slength = id_RankFreeModule(h2,currRing);
216  int rank=si_max(h1->rank,h2->rank);
217  if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
218 
219  ideal first,second,temp,temp1,result;
220  poly p,q;
221 
222  if (IDELEMS(h1)<IDELEMS(h2))
223  {
224  first = h1;
225  second = h2;
226  }
227  else
228  {
229  first = h2;
230  second = h1;
231  int t=flength; flength=slength; slength=t;
232  }
233  length = si_max(flength,slength);
234  if (length==0)
235  {
236  if ((currRing->qideal==NULL)
237  && (currRing->OrdSgn==1)
238  && (!rIsPluralRing(currRing))
240  return idSectWithElim(first,second);
241  else length = 1;
242  }
243  if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
244  j = IDELEMS(first);
245 
246  ring orig_ring=currRing;
247  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
248  rSetSyzComp(length, syz_ring);
249 
250  while ((j>0) && (first->m[j-1]==NULL)) j--;
251  temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
252  k = 0;
253  for (i=0;i<j;i++)
254  {
255  if (first->m[i]!=NULL)
256  {
257  if (syz_ring==orig_ring)
258  temp->m[k] = pCopy(first->m[i]);
259  else
260  temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
261  q = pOne();
262  pSetComp(q,i+1+length);
263  pSetmComp(q);
264  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
265  p = temp->m[k];
266  while (pNext(p)!=NULL) pIter(p);
267  pNext(p) = q;
268  k++;
269  }
270  }
271  for (i=0;i<IDELEMS(second);i++)
272  {
273  if (second->m[i]!=NULL)
274  {
275  if (syz_ring==orig_ring)
276  temp->m[k] = pCopy(second->m[i]);
277  else
278  temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
279  if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
280  k++;
281  }
282  }
283  intvec *w=NULL;
284  temp1 = kStd(temp,currRing->qideal,testHomog,&w,NULL,length);
285  if (w!=NULL) delete w;
286  idDelete(&temp);
287  if(syz_ring!=orig_ring)
288  rChangeCurrRing(orig_ring);
289 
290  result = idInit(IDELEMS(temp1),rank);
291  j = 0;
292  for (i=0;i<IDELEMS(temp1);i++)
293  {
294  if ((temp1->m[i]!=NULL)
295  && (p_GetComp(temp1->m[i],syz_ring)>length))
296  {
297  if(syz_ring==orig_ring)
298  {
299  p = temp1->m[i];
300  }
301  else
302  {
303  p = prMoveR(temp1->m[i], syz_ring,orig_ring);
304  }
305  temp1->m[i]=NULL;
306  while (p!=NULL)
307  {
308  q = pNext(p);
309  pNext(p) = NULL;
310  k = pGetComp(p)-1-length;
311  pSetComp(p,0);
312  pSetmComp(p);
313  /* Warning! multiply only from the left! it's very important for Plural */
314  result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
315  p = q;
316  }
317  j++;
318  }
319  }
320  if(syz_ring!=orig_ring)
321  {
322  rChangeCurrRing(syz_ring);
323  idDelete(&temp1);
324  rChangeCurrRing(orig_ring);
325  rDelete(syz_ring);
326  }
327  else
328  {
329  idDelete(&temp1);
330  }
331 
332  idSkipZeroes(result);
333  if (TEST_OPT_RETURN_SB)
334  {
335  w=NULL;
336  temp1=kStd(result,currRing->qideal,testHomog,&w);
337  if (w!=NULL) delete w;
338  idDelete(&result);
339  idSkipZeroes(temp1);
340  return temp1;
341  }
342  else //temp1=kInterRed(result,currRing->qideal);
343  return result;
344 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
#define pAdd(p, q)
Definition: polys.h:174
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#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:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
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:2221
int k
Definition: cfEzgcd.cc:93
#define TEST_V_INTERSECT_ELIM
Definition: options.h:136
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
#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:12
Definition: intvec.h:16
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 idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:141
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
#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:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
#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:178
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
ideal idSeries ( int  n,
ideal  M,
matrix  U = NULL,
intvec w = NULL 
)

Definition at line 1936 of file ideals.cc.

1937 {
1938  for(int i=IDELEMS(M)-1;i>=0;i--)
1939  {
1940  if(U==NULL)
1941  M->m[i]=pSeries(n,M->m[i],NULL,w);
1942  else
1943  {
1944  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
1945  MATELEM(U,i+1,i+1)=NULL;
1946  }
1947  }
1948  if(U!=NULL)
1949  idDelete((ideal*)&U);
1950  return M;
1951 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#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:343
#define NULL
Definition: omList.c:10
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define MATELEM(mat, i, j)
Definition: matpol.h:29
static int idSize ( const ideal  id)
inlinestatic

Count the effective size of an ideal (without the trailing allocated zero-elements)

Definition at line 46 of file ideals.h.

47 {
48  int j = IDELEMS(id) - 1;
49  poly* mm = id->m;
50  while ((j >= 0) && (mm[j] == NULL)) j--;
51  return (j + 1);
52 }
int j
Definition: myNF.cc:70
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
intvec* idSort ( ideal  id,
BOOLEAN  nolex = TRUE 
)
inline

Definition at line 184 of file ideals.h.

185 {
186  return id_Sort(id, nolex, currRing);
187 }
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:12
ideal idSyzygies ( ideal  h1,
tHomog  h,
intvec **  w,
BOOLEAN  setSyzComp = TRUE,
BOOLEAN  setRegularity = FALSE,
int *  deg = NULL 
)

Definition at line 560 of file ideals.cc.

562 {
563  ideal s_h1;
564  int j, k, length=0,reg;
565  BOOLEAN isMonomial=TRUE;
566  int ii, idElemens_h1;
567 
568  assume(h1 != NULL);
569 
570  idElemens_h1=IDELEMS(h1);
571 #ifdef PDEBUG
572  for(ii=0;ii<idElemens_h1 /*IDELEMS(h1)*/;ii++) pTest(h1->m[ii]);
573 #endif
574  if (idIs0(h1))
575  {
576  ideal result=idFreeModule(idElemens_h1/*IDELEMS(h1)*/);
577  return result;
578  }
579  int slength=(int)id_RankFreeModule(h1,currRing);
580  k=si_max(1,slength /*id_RankFreeModule(h1)*/);
581 
582  assume(currRing != NULL);
583  ring orig_ring=currRing;
584  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
585 
586  if (setSyzComp)
587  rSetSyzComp(k,syz_ring);
588 
589  if (orig_ring != syz_ring)
590  {
591  s_h1=idrCopyR_NoSort(h1,orig_ring,syz_ring);
592  }
593  else
594  {
595  s_h1 = h1;
596  }
597 
598  idTest(s_h1);
599 
600  ideal s_h3=idPrepare(s_h1,h,k,w); // main (syz) GB computation
601 
602  if (s_h3==NULL)
603  {
604  return idFreeModule( idElemens_h1 /*IDELEMS(h1)*/);
605  }
606 
607  if (orig_ring != syz_ring)
608  {
609  idDelete(&s_h1);
610  for (j=0; j<IDELEMS(s_h3); j++)
611  {
612  if (s_h3->m[j] != NULL)
613  {
614  if (p_MinComp(s_h3->m[j],syz_ring) > k)
615  p_Shift(&s_h3->m[j], -k,syz_ring);
616  else
617  p_Delete(&s_h3->m[j],syz_ring);
618  }
619  }
620  idSkipZeroes(s_h3);
621  s_h3->rank -= k;
622  rChangeCurrRing(orig_ring);
623  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
624  rDelete(syz_ring);
625  #ifdef HAVE_PLURAL
626  if (rIsPluralRing(orig_ring))
627  {
628  id_DelMultiples(s_h3,orig_ring);
629  idSkipZeroes(s_h3);
630  }
631  #endif
632  idTest(s_h3);
633  return s_h3;
634  }
635 
636  ideal e = idInit(IDELEMS(s_h3), s_h3->rank);
637 
638  for (j=IDELEMS(s_h3)-1; j>=0; j--)
639  {
640  if (s_h3->m[j] != NULL)
641  {
642  if (p_MinComp(s_h3->m[j],syz_ring) <= k)
643  {
644  e->m[j] = s_h3->m[j];
645  isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
646  p_Delete(&pNext(s_h3->m[j]),syz_ring);
647  s_h3->m[j] = NULL;
648  }
649  }
650  }
651 
652  idSkipZeroes(s_h3);
653  idSkipZeroes(e);
654 
655  if ((deg != NULL)
656  && (!isMonomial)
658  && (setRegularity)
659  && (h==isHomog)
660  && (!rIsPluralRing(currRing))
661  #ifdef HAVE_RINGS
662  && (!rField_is_Ring(currRing))
663  #endif
664  )
665  {
666  ring dp_C_ring = rAssure_dp_C(syz_ring); // will do rChangeCurrRing later
667  if (dp_C_ring != syz_ring)
668  {
669  rChangeCurrRing(dp_C_ring);
670  e = idrMoveR_NoSort(e, syz_ring, dp_C_ring);
671  }
672  resolvente res = sySchreyerResolvente(e,-1,&length,TRUE, TRUE);
673  intvec * dummy = syBetti(res,length,&reg, *w);
674  *deg = reg+2;
675  delete dummy;
676  for (j=0;j<length;j++)
677  {
678  if (res[j]!=NULL) idDelete(&(res[j]));
679  }
680  omFreeSize((ADDRESS)res,length*sizeof(ideal));
681  idDelete(&e);
682  if (dp_C_ring != syz_ring)
683  {
684  rChangeCurrRing(syz_ring);
685  rDelete(dp_C_ring);
686  }
687  }
688  else
689  {
690  idDelete(&e);
691  }
692  idTest(s_h3);
693  if (currRing->qideal != NULL)
694  {
695  ideal ts_h3=kStd(s_h3,currRing->qideal,h,w);
696  idDelete(&s_h3);
697  s_h3 = ts_h3;
698  }
699  return s_h3;
700 }
#define TEST_OPT_NOTREGULARITY
Definition: options.h:114
#define pTest(p)
Definition: polys.h:387
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TRUE
Definition: auxiliary.h:144
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:2221
void * ADDRESS
Definition: auxiliary.h:161
int k
Definition: cfEzgcd.cc:93
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
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:12
Definition: intvec.h:16
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:126
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4386
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4885
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:302
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:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:437
#define NULL
Definition: omList.c:10
static ideal idPrepare(ideal h1, tHomog hom, int syzcomp, intvec **w)
Definition: ideals.cc:465
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:793
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
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:63
BOOLEAN idTestHomModule ( ideal  m,
ideal  Q,
intvec w 
)

Definition at line 1884 of file ideals.cc.

1885 {
1886  if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
1887  if (idIs0(m)) return TRUE;
1888 
1889  int cmax=-1;
1890  int i;
1891  poly p=NULL;
1892  int length=IDELEMS(m);
1893  polyset P=m->m;
1894  for (i=length-1;i>=0;i--)
1895  {
1896  p=P[i];
1897  if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
1898  }
1899  if (w != NULL)
1900  if (w->length()+1 < cmax)
1901  {
1902  // Print("length: %d - %d \n", w->length(),cmax);
1903  return FALSE;
1904  }
1905 
1906  if(w!=NULL)
1907  p_SetModDeg(w, currRing);
1908 
1909  for (i=length-1;i>=0;i--)
1910  {
1911  p=P[i];
1912  if (p!=NULL)
1913  {
1914  int d=currRing->pFDeg(p,currRing);
1915  loop
1916  {
1917  pIter(p);
1918  if (p==NULL) break;
1919  if (d!=currRing->pFDeg(p,currRing))
1920  {
1921  //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
1922  if(w!=NULL)
1924  return FALSE;
1925  }
1926  }
1927  }
1928  }
1929 
1930  if(w!=NULL)
1932 
1933  return TRUE;
1934 }
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3517
#define pMaxComp(p)
Definition: polys.h:270
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
#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:12
int m
Definition: cfEzgcd.cc:119
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:106
poly * polyset
Definition: hutil.h:17
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idTransp ( ideal  a)
inline

transpose a module

Definition at line 193 of file ideals.h.

194 {
195  return id_Transp(a, currRing);
196 }
ideal id_Transp(ideal a, const ring rRing)
const poly a
Definition: syzextra.cc:212
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
ideal idVec2Ideal ( poly  vec)
inline

Definition at line 169 of file ideals.h.

170 {
171  return id_Vec2Ideal(vec, currRing);
172 }
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:12
ideal idXXX ( ideal  h1,
int  k 
)

Definition at line 704 of file ideals.cc.

705 {
706  ideal s_h1;
707  intvec *w=NULL;
708 
709  assume(currRing != NULL);
710  ring orig_ring=currRing;
711  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
712 
713  rSetSyzComp(k,syz_ring);
714 
715  if (orig_ring != syz_ring)
716  {
717  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
718  }
719  else
720  {
721  s_h1 = h1;
722  }
723 
724  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
725 
726  if (s_h3==NULL)
727  {
728  return idFreeModule(IDELEMS(h1));
729  }
730 
731  if (orig_ring != syz_ring)
732  {
733  idDelete(&s_h1);
734  idSkipZeroes(s_h3);
735  rChangeCurrRing(orig_ring);
736  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
737  rDelete(syz_ring);
738  idTest(s_h3);
739  return s_h3;
740  }
741 
742  idSkipZeroes(s_h3);
743  idTest(s_h3);
744  return s_h3;
745 }
#define TRUE
Definition: auxiliary.h:144
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:2221
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:12
Definition: intvec.h:16
ideal idFreeModule(int i)
Definition: ideals.h:126
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4386
#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:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#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
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:63

Variable Documentation

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 12 of file polys.cc.