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 idealresolvente
 

Functions

ideal idCopyFirstK (const ideal ide, const int k, ring R=currRing)
 
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, ring r=currRing)
 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)
 
ideal idCopy (ideal A, const ring R=currRing)
 
ideal idAdd (ideal h1, ideal h2, const ring R=currRing)
 h1 + h2 More...
 
BOOLEAN idInsertPoly (ideal h1, poly h2)
 
BOOLEAN idInsertPolyWithTests (ideal h1, const int validEntries, const poly h2, const bool zeroOk, const bool duplicateOk, const ring R=currRing)
 
ideal idMult (ideal h1, ideal h2, const ring R=currRing)
 hh := h1 * h2 More...
 
BOOLEAN idIs0 (ideal h)
 
BOOLEAN idIsModule (ideal m, const ring r)
 
BOOLEAN idHomIdeal (ideal id, ideal Q=NULL, const ring R=currRing)
 
BOOLEAN idHomModule (ideal m, ideal Q, intvec **w, const ring R=currRing)
 
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, const ring R=currRing)
 
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)
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace=FALSE, intvec **w=NULL)
 
ideal idHead (ideal h)
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
ideal idVec2Ideal (poly vec, const ring R=currRing)
 
ideal idSeries (int n, ideal M, matrix U=NULL, intvec *w=NULL)
 
BOOLEAN idIsZeroDim (ideal i, const ring R=currRing)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply=TRUE)
 
intvecidSort (ideal id, BOOLEAN nolex=TRUE, const ring R=currRing)
 
ideal idModulo (ideal h1, ideal h2, tHomog h=testHomog, intvec **w=NULL)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
ideal idTransp (ideal a, const ring R=currRing)
 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 877 of file simpleideals.cc.

878 {
879  int i,result;
880 
881  if (r==0) return 1;
882  if (n-r<r) return binom(n,n-r);
883  result = n-r+1;
884  for (i=2;i<=r;i++)
885  {
886  result *= n-r+i;
887  if (result<0)
888  {
889  WarnS("overflow in binomials");
890  return 0;
891  }
892  result /= i;
893  }
894  return result;
895 }
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 
)

Definition at line 398 of file simpleideals.cc.

399 {
400  int i;
401  ideal h2;
402 
403 //#ifdef TEST
404  if (h1 == NULL)
405  {
406  h2=idInit(1,1);
407  }
408  else
409 //#endif
410  {
411  h2=idInit(IDELEMS(h1),h1->rank);
412  for (i=IDELEMS(h1)-1; i>=0; i--)
413  h2->m[i] = p_Copy(h1->m[i],r);
414  }
415  return h2;
416 }
const ideal
Definition: gb_hack.h:42
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:19
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
ideal id_Farey ( ideal  x,
number  N,
const ring  r 
)

Definition at line 2483 of file ideals.cc.

2484 {
2485  int cnt=IDELEMS(x)*x->nrows;
2486  ideal result=idInit(cnt,x->rank);
2487  result->nrows=x->nrows; // for lifting matrices
2488  result->ncols=x->ncols; // for lifting matrices
2489 
2490  int i;
2491  for(i=cnt-1;i>=0;i--)
2492  {
2493  result->m[i]=p_Farey(x->m[i],N,r);
2494  }
2495  return result;
2496 }
const ideal
Definition: gb_hack.h:42
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:19
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
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 2383 of file ideals.cc.

2384 {
2385  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2386  intvec *w = NULL;
2387 
2388  ring save_r = currRing; rChangeCurrRing(r); ideal S=idSyzygies(I,testHomog,&w); rChangeCurrRing(save_r);
2389 
2390  if (w!=NULL) delete w;
2391  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2392  id_Delete(&S, r);
2393  poly gcd_p=singclap_pdivide(f,gg, r);
2394  p_Delete(&gg, r);
2395 
2396  return gcd_p;
2397 }
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3349
f
Definition: cfModGcd.cc:4022
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
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
polyrec * poly
Definition: hilb.h:10
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)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
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 1629 of file simpleideals.cc.

1630 {
1631 // #ifdef DEBU
1632 // WarnS("tensorModuleMult!!!!");
1633 
1634  assume(m > 0);
1635  assume(M != NULL);
1636 
1637  const int n = rRing->N;
1638 
1639  assume(M->rank <= m * n);
1640 
1641  const int k = IDELEMS(M);
1642 
1643  ideal idTemp = idInit(k,m); // = {f_1, ..., f_k }
1644 
1645  for( int i = 0; i < k; i++ ) // for every w \in M
1646  {
1647  poly pTempSum = NULL;
1648 
1649  poly w = M->m[i];
1650 
1651  while(w != NULL) // for each term of w...
1652  {
1653  poly h = p_Head(w, rRing);
1654 
1655  const int gen = p_GetComp(h, rRing); // 1 ...
1656 
1657  assume(gen > 0);
1658  assume(gen <= n*m);
1659 
1660  // TODO: write a formula with %, / instead of while!
1661  /*
1662  int c = gen;
1663  int v = 1;
1664  while(c > m)
1665  {
1666  c -= m;
1667  v++;
1668  }
1669  */
1670 
1671  int cc = gen % m;
1672  if( cc == 0) cc = m;
1673  int vv = 1 + (gen - cc) / m;
1674 
1675 // assume( cc == c );
1676 // assume( vv == v );
1677 
1678  // 1<= c <= m
1679  assume( cc > 0 );
1680  assume( cc <= m );
1681 
1682  assume( vv > 0 );
1683  assume( vv <= n );
1684 
1685  assume( (cc + (vv-1)*m) == gen );
1686 
1687  p_IncrExp(h, vv, rRing); // h *= var(j) && // p_AddExp(h, vv, 1, rRing);
1688  p_SetComp(h, cc, rRing);
1689 
1690  p_Setm(h, rRing); // addjust degree after the previous steps!
1691 
1692  pTempSum = p_Add_q(pTempSum, h, rRing); // it is slow since h will be usually put to the back of pTempSum!!!
1693 
1694  pIter(w);
1695  }
1696 
1697  idTemp->m[i] = pTempSum;
1698  }
1699 
1700  // simplify idTemp???
1701 
1702  ideal idResult = id_Transp(idTemp, rRing);
1703 
1704  id_Delete(&idTemp, rRing);
1705 
1706  return(idResult);
1707 }
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 ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
void id_Delete(ideal *h, ring r)
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
polyrec * poly
Definition: hilb.h:10
#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:19
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#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
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,
const ring  R = currRing 
)
inline

h1 + h2

Definition at line 84 of file ideals.h.

85 {
86  return id_Add(h1, h2, R);
87 }
ideal id_Add(ideal h1, ideal h2, const ring r)
#define R
Definition: sirandom.c:26
matrix idCoeffOfKBase ( ideal  arg,
ideal  kbase,
poly  how 
)

Definition at line 2259 of file ideals.cc.

2260 {
2261  matrix result;
2262  ideal tempKbase;
2263  poly p,q;
2264  intvec * convert;
2265  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2266 #if 0
2267  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2268  if (idIs0(arg))
2269  return mpNew(i,1);
2270  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2271  result = mpNew(i,j);
2272 #else
2273  result = mpNew(i, j);
2274  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2275 #endif
2276 
2277  tempKbase = idCreateSpecialKbase(kbase,&convert);
2278  for (k=0;k<j;k++)
2279  {
2280  p = arg->m[k];
2281  while (p!=NULL)
2282  {
2283  q = idDecompose(p,how,tempKbase,&pos);
2284  if (pos>=0)
2285  {
2286  MATELEM(result,(*convert)[pos],k+1) =
2287  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2288  }
2289  else
2290  p_Delete(&q,currRing);
2291  pIter(p);
2292  }
2293  }
2294  idDelete(&tempKbase);
2295  return result;
2296 }
#define pAdd(p, q)
Definition: polys.h:174
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2227
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
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
polyrec * poly
Definition: hilb.h:10
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2173
#define IDELEMS(i)
Definition: simpleideals.h:19
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
BOOLEAN idIs0(ideal h)
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idCopy ( ideal  A,
const ring  R = currRing 
)
inline

Definition at line 76 of file ideals.h.

77 {
78  return id_Copy(A, R);
79 }
ideal id_Copy(ideal h1, const ring r)
#define A
Definition: sirandom.c:23
#define R
Definition: sirandom.c:26
ideal idCopyFirstK ( const ideal  ide,
const int  k,
ring  R = currRing 
)
inline

Definition at line 22 of file ideals.h.

23 {
24  return id_CopyFirstK(ide, k, R);
25 }
int k
Definition: cfEzgcd.cc:93
#define R
Definition: sirandom.c:26
ideal id_CopyFirstK(const ideal ide, const int k, const ring r)
void idDelEquals ( ideal  id)

Definition at line 2628 of file ideals.cc.

2629 {
2630  int idsize = IDELEMS(id);
2631  poly_sort *id_sort = (poly_sort *)omAlloc0(idsize*sizeof(poly_sort));
2632  for (int i = 0; i < idsize; i++)
2633  {
2634  id_sort[i].p = id->m[i];
2635  id_sort[i].index = i;
2636  }
2637  idSort_qsort(id_sort, idsize);
2638  int index, index_i, index_j;
2639  int i = 0;
2640  for (int j = 1; j < idsize; j++)
2641  {
2642  if (id_sort[i].p != NULL && pEqualPolys(id_sort[i].p, id_sort[j].p))
2643  {
2644  index_i = id_sort[i].index;
2645  index_j = id_sort[j].index;
2646  if (index_j > index_i)
2647  {
2648  index = index_j;
2649  }
2650  else
2651  {
2652  index = index_i;
2653  i = j;
2654  }
2655  pDelete(&id->m[index]);
2656  }
2657  else
2658  {
2659  i = j;
2660  }
2661  }
2662  omFreeSize((ADDRESS)(id_sort), idsize*sizeof(poly_sort));
2663 }
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:2610
int j
Definition: myNF.cc:70
void idSort_qsort(poly_sort *id_sort, int idsize)
Definition: ideals.cc:2619
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
poly p
Definition: ideals.cc:2609
#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,
ring  r = currRing 
)
inline

delete an ideal

Definition at line 31 of file ideals.h.

32 {
33  id_Delete(h, r);
34 }
void id_Delete(ideal *h, ring r)
const ring r
Definition: syzextra.cc:208
static Poly * h
Definition: janet.cc:978
matrix idDiff ( matrix  i,
int  k 
)

Definition at line 1931 of file ideals.cc.

1932 {
1933  int e=MATCOLS(i)*MATROWS(i);
1934  matrix r=mpNew(MATROWS(i),MATCOLS(i));
1935  r->rank=i->rank;
1936  int j;
1937  for(j=0; j<e; j++)
1938  {
1939  r->m[j]=pDiff(i->m[j],k);
1940  }
1941  return r;
1942 }
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 1944 of file ideals.cc.

1945 {
1946  matrix r=mpNew(IDELEMS(I),IDELEMS(J));
1947  int i,j;
1948  for(i=0; i<IDELEMS(I); i++)
1949  {
1950  for(j=0; j<IDELEMS(J); j++)
1951  {
1952  MATELEM(r,i+1,j+1)=pDiffOp(I->m[i],J->m[j],multiply);
1953  }
1954  }
1955  return r;
1956 }
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:19
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 1397 of file ideals.cc.

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

Definition at line 129 of file ideals.h.

130 {
131  return id_FreeModule (i, R);
132 }
ideal id_FreeModule(int i, const ring r)
int i
Definition: cfEzgcd.cc:123
#define R
Definition: sirandom.c:26
void idGetNextChoise ( int  r,
int  end,
BOOLEAN endch,
int choise 
)

Definition at line 819 of file simpleideals.cc.

820 {
821  int i = r-1,j;
822  while ((i >= 0) && (choise[i] == end))
823  {
824  i--;
825  end--;
826  }
827  if (i == -1)
828  *endch = TRUE;
829  else
830  {
831  choise[i]++;
832  for (j=i+1; j<r; j++)
833  {
834  choise[j] = choise[i]+j-i;
835  }
836  *endch = FALSE;
837  }
838 }
#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 845 of file simpleideals.cc.

846 {
847  int * localchoise,i,result=0;
848  BOOLEAN b=FALSE;
849 
850  if (d<=1) return 1;
851  localchoise=(int*)omAlloc((d-1)*sizeof(int));
852  idInitChoise(d-1,begin,end,&b,localchoise);
853  while (!b)
854  {
855  result++;
856  i = 0;
857  while ((i<t) && (localchoise[i]==choise[i])) i++;
858  if (i>=t)
859  {
860  i = t+1;
861  while ((i<d) && (localchoise[i-1]==choise[i])) i++;
862  if (i>=d)
863  {
864  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
865  return result;
866  }
867  }
868  idGetNextChoise(d-1,end,&b,localchoise);
869  }
870  omFreeSize((ADDRESS)localchoise,(d-1)*sizeof(int));
871  return 0;
872 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#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,
const ring  R = currRing 
)
inline

Definition at line 109 of file ideals.h.

110 {
111  return id_HomIdeal(id, Q, R);
112 }
BOOLEAN id_HomIdeal(ideal id, ideal Q, const ring r)
#define Q
Definition: sirandom.c:25
#define R
Definition: sirandom.c:26
BOOLEAN idHomModule ( ideal  m,
ideal  Q,
intvec **  w,
const ring  R = currRing 
)
inline

Definition at line 114 of file ideals.h.

115 {
116  return id_HomModule(m, Q, w, R);
117 }
BOOLEAN id_HomModule(ideal m, ideal Q, intvec **w, const ring R)
#define Q
Definition: sirandom.c:25
int m
Definition: cfEzgcd.cc:119
#define R
Definition: sirandom.c:26
void idInitChoise ( int  r,
int  beg,
int  end,
BOOLEAN endch,
int choise 
)

Definition at line 797 of file simpleideals.cc.

798 {
799  /*returns the first choise of r numbers between beg and end*/
800  int i;
801  for (i=0; i<r; i++)
802  {
803  choise[i] = 0;
804  }
805  if (r <= end-beg+1)
806  for (i=0; i<r; i++)
807  {
808  choise[i] = beg+i;
809  }
810  if (r > end-beg+1)
811  *endch = TRUE;
812  else
813  *endch = FALSE;
814 }
#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 
)

Definition at line 607 of file simpleideals.cc.

608 {
609  if (h2==NULL) return FALSE;
610  int j = IDELEMS(h1)-1;
611  while ((j >= 0) && (h1->m[j] == NULL)) j--;
612  j++;
613  if (j==IDELEMS(h1))
614  {
615  pEnlargeSet(&(h1->m),IDELEMS(h1),16);
616  IDELEMS(h1)+=16;
617  }
618  h1->m[j]=h2;
619  return TRUE;
620 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int j
Definition: myNF.cc:70
#define IDELEMS(i)
Definition: simpleideals.h:19
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
BOOLEAN idInsertPolyWithTests ( ideal  h1,
const int  validEntries,
const poly  h2,
const bool  zeroOk,
const bool  duplicateOk,
const ring  R = currRing 
)
inline

Definition at line 90 of file ideals.h.

91 {
92  return id_InsertPolyWithTests (h1, validEntries, h2, zeroOk, duplicateOk, R);
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:
#define R
Definition: sirandom.c:26
BOOLEAN idIs0 ( ideal  h)

Definition at line 709 of file simpleideals.cc.

710 {
711  int i;
712 
713  if (h == NULL) return TRUE;
714  i = IDELEMS(h)-1;
715  while ((i >= 0) && (h->m[i] == NULL))
716  {
717  i--;
718  }
719  if (i < 0)
720  return TRUE;
721  else
722  return FALSE;
723 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
BOOLEAN idIsModule ( ideal  m,
const ring  r 
)

Definition at line 752 of file simpleideals.cc.

753 {
754  if (id != NULL && rRing_has_Comp(r))
755  {
756  int j, l = IDELEMS(id);
757  for (j=0; j<l; j++)
758  {
759  if (id->m[j] != NULL && p_GetComp(id->m[j], r) > 0) return TRUE;
760  }
761  }
762  return FALSE;
763 }
#define FALSE
Definition: auxiliary.h:140
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define IDELEMS(i)
Definition: simpleideals.h:19
#define rRing_has_Comp(r)
Definition: monomials.h:274
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 1841 of file ideals.cc.

1842 {
1843  int i;
1844  poly p;
1845 
1846  if (idIs0(id1)) return TRUE;
1847  for (i=0;i<IDELEMS(id1);i++)
1848  {
1849  if (id1->m[i] != NULL)
1850  {
1851  p = kNF(id2,currRing->qideal,id1->m[i]);
1852  if (p != NULL)
1853  {
1854  p_Delete(&p,currRing);
1855  return FALSE;
1856  }
1857  }
1858  }
1859  return TRUE;
1860 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2598
#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
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
BOOLEAN idIsZeroDim ( ideal  i,
const ring  R = currRing 
)
inline

Definition at line 179 of file ideals.h.

180 {
181  return id_IsZeroDim(i, R);
182 }
int i
Definition: cfEzgcd.cc:123
#define R
Definition: sirandom.c:26
BOOLEAN id_IsZeroDim(ideal I, const ring r)
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 2559 of file ideals.cc.

2560 {
2561  for (int i = IDELEMS(id)-1; i >= k; i--)
2562  {
2563  if (id->m[i] != NULL) pDelete(&id->m[i]);
2564  }
2565  int kk=k;
2566  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2567  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2568  IDELEMS(id) = kk;
2569 }
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
#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 933 of file ideals.cc.

935 {
936  int lsmod =id_RankFreeModule(submod,currRing), j, k;
937  int comps_to_add=0;
938  poly p;
939 
940  if (idIs0(submod))
941  {
942  if (unit!=NULL)
943  {
944  *unit=mpNew(1,1);
945  MATELEM(*unit,1,1)=pOne();
946  }
947  if (rest!=NULL)
948  {
949  *rest=idInit(1,mod->rank);
950  }
951  return idInit(1,mod->rank);
952  }
953  if (idIs0(mod)) /* and not idIs0(submod) */
954  {
955  WerrorS("2nd module does not lie in the first");
956  return NULL;
957  }
958  if (unit!=NULL)
959  {
960  comps_to_add = IDELEMS(submod);
961  while ((comps_to_add>0) && (submod->m[comps_to_add-1]==NULL))
962  comps_to_add--;
963  }
965  if ((k!=0) && (lsmod==0)) lsmod=1;
966  k=si_max(k,(int)mod->rank);
967  if (k<submod->rank) { WarnS("rk(submod) > rk(mod) ?");k=submod->rank; }
968 
969  ring orig_ring=currRing;
970  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
971  rSetSyzComp(k,syz_ring);
972 
973  ideal s_mod, s_temp;
974  if (orig_ring != syz_ring)
975  {
976  s_mod = idrCopyR_NoSort(mod,orig_ring,syz_ring);
977  s_temp = idrCopyR_NoSort(submod,orig_ring,syz_ring);
978  }
979  else
980  {
981  s_mod = mod;
982  s_temp = idCopy(submod);
983  }
984  ideal s_h3;
985  if (isSB)
986  {
987  s_h3 = idCopy(s_mod);
988  idPrepareStd(s_h3, k+comps_to_add);
989  }
990  else
991  {
992  s_h3 = idPrepare(s_mod,(tHomog)FALSE,k+comps_to_add,NULL);
993  }
994  if (!goodShape)
995  {
996  for (j=0;j<IDELEMS(s_h3);j++)
997  {
998  if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
999  p_Delete(&(s_h3->m[j]),currRing);
1000  }
1001  }
1002  idSkipZeroes(s_h3);
1003  if (lsmod==0)
1004  {
1005  id_Shift(s_temp,1,currRing);
1006  }
1007  if (unit!=NULL)
1008  {
1009  for(j = 0;j<comps_to_add;j++)
1010  {
1011  p = s_temp->m[j];
1012  if (p!=NULL)
1013  {
1014  while (pNext(p)!=NULL) pIter(p);
1015  pNext(p) = pOne();
1016  pIter(p);
1017  pSetComp(p,1+j+k);
1018  pSetmComp(p);
1019  p = pNeg(p);
1020  }
1021  }
1022  }
1023  ideal s_result = kNF(s_h3,currRing->qideal,s_temp,k);
1024  s_result->rank = s_h3->rank;
1025  ideal s_rest = idInit(IDELEMS(s_result),k);
1026  idDelete(&s_h3);
1027  idDelete(&s_temp);
1028 
1029  for (j=0;j<IDELEMS(s_result);j++)
1030  {
1031  if (s_result->m[j]!=NULL)
1032  {
1033  if (pGetComp(s_result->m[j])<=k)
1034  {
1035  if (!divide)
1036  {
1037  if (isSB)
1038  {
1039  WarnS("first module not a standardbasis\n"
1040  "// ** or second not a proper submodule");
1041  }
1042  else
1043  WerrorS("2nd module does not lie in the first");
1044  idDelete(&s_result);
1045  idDelete(&s_rest);
1046  s_result=idInit(IDELEMS(submod),submod->rank);
1047  break;
1048  }
1049  else
1050  {
1051  p = s_rest->m[j] = s_result->m[j];
1052  while ((pNext(p)!=NULL) && (pGetComp(pNext(p))<=k)) pIter(p);
1053  s_result->m[j] = pNext(p);
1054  pNext(p) = NULL;
1055  }
1056  }
1057  p_Shift(&(s_result->m[j]),-k,currRing);
1058  pNeg(s_result->m[j]);
1059  }
1060  }
1061  if ((lsmod==0) && (!idIs0(s_rest)))
1062  {
1063  for (j=IDELEMS(s_rest);j>0;j--)
1064  {
1065  if (s_rest->m[j-1]!=NULL)
1066  {
1067  p_Shift(&(s_rest->m[j-1]),-1,currRing);
1068  s_rest->m[j-1] = s_rest->m[j-1];
1069  }
1070  }
1071  }
1072  if(syz_ring!=orig_ring)
1073  {
1074  idDelete(&s_mod);
1075  rChangeCurrRing(orig_ring);
1076  s_result = idrMoveR_NoSort(s_result, syz_ring, orig_ring);
1077  s_rest = idrMoveR_NoSort(s_rest, syz_ring, orig_ring);
1078  rDelete(syz_ring);
1079  }
1080  if (rest!=NULL)
1081  *rest = s_rest;
1082  else
1083  idDelete(&s_rest);
1084 //idPrint(s_result);
1085  if (unit!=NULL)
1086  {
1087  *unit=mpNew(comps_to_add,comps_to_add);
1088  int i;
1089  for(i=0;i<IDELEMS(s_result);i++)
1090  {
1091  poly p=s_result->m[i];
1092  poly q=NULL;
1093  while(p!=NULL)
1094  {
1095  if(pGetComp(p)<=comps_to_add)
1096  {
1097  pSetComp(p,0);
1098  if (q!=NULL)
1099  {
1100  pNext(q)=pNext(p);
1101  }
1102  else
1103  {
1104  pIter(s_result->m[i]);
1105  }
1106  pNext(p)=NULL;
1107  MATELEM(*unit,i+1,i+1)=pAdd(MATELEM(*unit,i+1,i+1),p);
1108  if(q!=NULL) p=pNext(q);
1109  else p=s_result->m[i];
1110  }
1111  else
1112  {
1113  q=p;
1114  pIter(p);
1115  }
1116  }
1117  p_Shift(&s_result->m[i],-comps_to_add,currRing);
1118  }
1119  }
1120  return s_result;
1121 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2598
static void idPrepareStd(ideal s_temp, int k)
Definition: ideals.cc:900
#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
const ideal
Definition: gb_hack.h:42
#define pNeg(p)
Definition: polys.h:169
CanonicalForm divide(const CanonicalForm &ff, const CanonicalForm &f, const CFList &as)
#define TRUE
Definition: auxiliary.h:144
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)
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
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)
Definition: simpleideals.cc:40
#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 idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
BOOLEAN idIs0(ideal h)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#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_SyzComp(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  while (q != NULL)
869  {
870  p = q;
871  pIter(q);
872  pNext(p) = NULL;
873  t=pGetComp(p);
874  pSetComp(p,0);
875  pSetmComp(p);
876  MATELEM(*ma,t-k,i) = pAdd(MATELEM(*ma,t-k,i),p);
877  }
878  i++;
879  }
880  }
881  idDelete(&s_h2);
882 
883  for (i=0; i<IDELEMS(s_h3); i++)
884  {
885  s_h3->m[i] = prMoveR_NoSort(s_h3->m[i], syz_ring,orig_ring);
886  }
887  if (lift3)
888  {
889  for (i=0; i<IDELEMS(*syz); i++)
890  {
891  (*syz)->m[i] = prMoveR_NoSort((*syz)->m[i], syz_ring,orig_ring);
892  }
893  }
894 
895  if (syz_ring!=orig_ring) rDelete(syz_ring);
896  SI_RESTORE_OPT2(save2);
897  return s_h3;
898 }
#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:90
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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)
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
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)
Definition: simpleideals.cc:40
#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:101
unsigned si_opt_2
Definition: options.c:6
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define V_IDLIFT
Definition: options.h:60
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define SI_SAVE_OPT2(A)
Definition: options.h:21
void idLiftW ( ideal  P,
ideal  Q,
int  n,
matrix T,
ideal R,
short *  w = NULL 
)

Definition at line 1127 of file ideals.cc.

1128 {
1129  long N=0;
1130  int i;
1131  for(i=IDELEMS(Q)-1;i>=0;i--)
1132  if(w==NULL)
1133  N=si_max(N,p_Deg(Q->m[i],currRing));
1134  else
1135  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1136  N+=n;
1137 
1138  T=mpNew(IDELEMS(Q),IDELEMS(P));
1139  R=idInit(IDELEMS(P),P->rank);
1140 
1141  for(i=IDELEMS(P)-1;i>=0;i--)
1142  {
1143  poly p;
1144  if(w==NULL)
1145  p=ppJet(P->m[i],N);
1146  else
1147  p=ppJetW(P->m[i],N,w);
1148 
1149  int j=IDELEMS(Q)-1;
1150  while(p!=NULL)
1151  {
1152  if(pDivisibleBy(Q->m[j],p))
1153  {
1154  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1155  if(w==NULL)
1156  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1157  else
1158  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1159  pNormalize(p);
1160  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1161  p_Delete(&p0,currRing);
1162  else
1163  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1164  j=IDELEMS(Q)-1;
1165  }
1166  else
1167  {
1168  if(j==0)
1169  {
1170  poly p0=p;
1171  pIter(p);
1172  pNext(p0)=NULL;
1173  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1174  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1175  p_Delete(&p0,currRing);
1176  else
1177  R->m[i]=pAdd(R->m[i],p0);
1178  j=IDELEMS(Q)-1;
1179  }
1180  else
1181  j--;
1182  }
1183  }
1184  }
1185 }
#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
polyrec * poly
Definition: hilb.h:10
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:19
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)
Definition: simpleideals.cc:40
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
#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:2598
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
const ideal
Definition: gb_hack.h:42
int k
Definition: cfEzgcd.cc:93
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w, const ring R=currRing)
Definition: ideals.h:114
#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
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
ideal idMult(ideal h1, ideal h2, const ring R=currRing)
hh := h1 * h2
Definition: ideals.h:99
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#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:3511
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
ideal kMin_std(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
Definition: kstd1.cc:2447
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
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 2325 of file ideals.cc.

2326 {
2327  if (idIs0(arg)) return idInit(1,arg->rank);
2328  int i,next_gen,next_comp;
2329  ideal res=arg;
2330  if (!inPlace) res = idCopy(arg);
2331  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2332  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2333  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2334 
2335  int del=0;
2336  loop
2337  {
2338  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2339  if (next_gen<0) break;
2340  del++;
2341  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2342  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2343  if ((w !=NULL)&&(*w!=NULL))
2344  {
2345  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2346  }
2347  }
2348 
2349  idDeleteComps(res,red_comp,del);
2350  idSkipZeroes(res);
2351  omFree(red_comp);
2352 
2353  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2354  {
2355  int nl=si_max((*w)->length()-del,1);
2356  intvec *wtmp=new intvec(nl);
2357  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2358  delete *w;
2359  *w=wtmp;
2360  }
2361  return res;
2362 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
loop
Definition: myNF.cc:98
const ideal
Definition: gb_hack.h:42
#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)
#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:19
void idSkipZeroes(ideal ide)
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2298
const CanonicalForm & w
Definition: facAbsFact.cc:55
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
BOOLEAN idIs0(ideal h)
ideal idMinors ( matrix  a,
int  ar,
ideal  R = NULL 
)

Definition at line 1788 of file ideals.cc.

1789 {
1790  int elems=0;
1791  int r=a->nrows,c=a->ncols;
1792  int i;
1793  matrix b;
1794  ideal result,h;
1795  ring origR=currRing;
1796  ring tmpR;
1797  long bound;
1798 
1799  if((ar<=0) || (ar>r) || (ar>c))
1800  {
1801  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
1802  return NULL;
1803  }
1804  h = id_Matrix2Module(mp_Copy(a,origR),origR);
1805  bound = sm_ExpBound(h,c,r,ar,origR);
1806  idDelete(&h);
1807  tmpR=sm_RingChange(origR,bound);
1808  b = mpNew(r,c);
1809  for (i=r*c-1;i>=0;i--)
1810  {
1811  if (a->m[i])
1812  b->m[i] = prCopyR(a->m[i],origR,tmpR);
1813  }
1814  if (R!=NULL)
1815  {
1816  R = idrCopyR(R,origR,tmpR);
1817  //if (ar>1) // otherwise done in mpMinorToResult
1818  //{
1819  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
1820  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
1821  // idDelete((ideal*)&b); b=bb;
1822  //}
1823  }
1824  result=idInit(32,1);
1825  if(ar>1) mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
1826  else mp_MinorToResult(result,elems,b,r,c,R,tmpR);
1827  idDelete((ideal *)&b);
1828  if (R!=NULL) idDelete(&R);
1829  idSkipZeroes(result);
1830  rChangeCurrRing(origR);
1831  result = idrMoveR(result,tmpR,origR);
1832  sm_KillModifiedRing(tmpR);
1833  idTest(result);
1834  return result;
1835 }
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
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:1507
const ideal
Definition: gb_hack.h:42
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:1411
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:248
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
void idSkipZeroes(ideal ide)
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)
Definition: simpleideals.cc:40
#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:192
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:74
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
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 2016 of file ideals.cc.

2017 {
2018  intvec *wtmp=NULL;
2019 
2020  int i,k,rk,flength=0,slength,length;
2021  poly p,q;
2022 
2023  if (idIs0(h2))
2024  return idFreeModule(si_max(1,h2->ncols));
2025  if (!idIs0(h1))
2026  flength = id_RankFreeModule(h1,currRing);
2027  slength = id_RankFreeModule(h2,currRing);
2028  length = si_max(flength,slength);
2029  if (length==0)
2030  {
2031  length = 1;
2032  }
2033  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2034  if ((w!=NULL)&&((*w)!=NULL))
2035  {
2036  //Print("input weights:");(*w)->show(1);PrintLn();
2037  int d;
2038  int k;
2039  wtmp=new intvec(length+IDELEMS(h2));
2040  for (i=0;i<length;i++)
2041  ((*wtmp)[i])=(**w)[i];
2042  for (i=0;i<IDELEMS(h2);i++)
2043  {
2044  poly p=h2->m[i];
2045  if (p!=NULL)
2046  {
2047  d = p_Deg(p,currRing);
2048  k= pGetComp(p);
2049  if (slength>0) k--;
2050  d +=((**w)[k]);
2051  ((*wtmp)[i+length]) = d;
2052  }
2053  }
2054  //Print("weights:");wtmp->show(1);PrintLn();
2055  }
2056  for (i=0;i<IDELEMS(h2);i++)
2057  {
2058  temp->m[i] = pCopy(h2->m[i]);
2059  q = pOne();
2060  pSetComp(q,i+1+length);
2061  pSetmComp(q);
2062  if(temp->m[i]!=NULL)
2063  {
2064  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2065  p = temp->m[i];
2066  while (pNext(p)!=NULL) pIter(p);
2067  pNext(p) = q; // will be sorted later correctly
2068  }
2069  else
2070  temp->m[i]=q;
2071  }
2072  rk = k = IDELEMS(h2);
2073  if (!idIs0(h1))
2074  {
2075  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2076  IDELEMS(temp) += IDELEMS(h1);
2077  for (i=0;i<IDELEMS(h1);i++)
2078  {
2079  if (h1->m[i]!=NULL)
2080  {
2081  temp->m[k] = pCopy(h1->m[i]);
2082  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2083  k++;
2084  }
2085  }
2086  }
2087 
2088  ring orig_ring=currRing;
2089  ring syz_ring=rAssure_SyzComp(orig_ring, TRUE); rChangeCurrRing(syz_ring);
2090  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2091  // therefore we disable OPT_RETURN_SB for modulo:
2092  // (see tr. #701)
2093  //if (TEST_OPT_RETURN_SB)
2094  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2095  //else
2096  rSetSyzComp(length, syz_ring);
2097  ideal s_temp;
2098 
2099  if (syz_ring != orig_ring)
2100  {
2101  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2102  }
2103  else
2104  {
2105  s_temp = temp;
2106  }
2107 
2108  idTest(s_temp);
2109  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2110 
2111  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2112  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2113  {
2114  delete *w;
2115  *w=new intvec(IDELEMS(h2));
2116  for (i=0;i<IDELEMS(h2);i++)
2117  ((**w)[i])=(*wtmp)[i+length];
2118  }
2119  if (wtmp!=NULL) delete wtmp;
2120 
2121  for (i=0;i<IDELEMS(s_temp1);i++)
2122  {
2123  if ((s_temp1->m[i]!=NULL)
2124  && (((int)pGetComp(s_temp1->m[i]))<=length))
2125  {
2126  p_Delete(&(s_temp1->m[i]),currRing);
2127  }
2128  else
2129  {
2130  p_Shift(&(s_temp1->m[i]),-length,currRing);
2131  }
2132  }
2133  s_temp1->rank = rk;
2134  idSkipZeroes(s_temp1);
2135 
2136  if (syz_ring!=orig_ring)
2137  {
2138  rChangeCurrRing(orig_ring);
2139  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2140  rDelete(syz_ring);
2141  // Hmm ... here seems to be a memory leak
2142  // However, simply deleting it causes memory trouble
2143  // idDelete(&s_temp);
2144  }
2145  else
2146  {
2147  idDelete(&temp);
2148  }
2149  idTest(s_temp1);
2150  return s_temp1;
2151 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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)
polyrec * poly
Definition: hilb.h:10
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
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
BOOLEAN idIs0(ideal h)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#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,
const ring  R = currRing 
)
inline

hh := h1 * h2

Definition at line 99 of file ideals.h.

100 {
101  return id_Mult(h1, h2, R);
102 }
ideal id_Mult(ideal h1, ideal h2, const ring r)
#define R
Definition: sirandom.c:26
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_SyzComp(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
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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)
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyrec * poly
Definition: hilb.h:10
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
#define pSetComp(p, v)
Definition: polys.h:38
int m
Definition: cfEzgcd.cc:119
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#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
BOOLEAN idIs0(ideal h)
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 2156 of file ideals.cc.

2157 {
2158  if (idIs0(mod)) return new intvec(2);
2159  int i=IDELEMS(mod);
2160  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2161  intvec *result = new intvec(i+1);
2162  while (i>0)
2163  {
2164  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2165  }
2166  return result;
2167 }
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:19
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
return result
Definition: facAbsBiFact.cc:76
ideal idQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb = FALSE,
BOOLEAN  resultIsIdeal = FALSE 
)

Definition at line 1304 of file ideals.cc.

1305 {
1306  // first check for special case h1:(0)
1307  if (idIs0(h2))
1308  {
1309  ideal res;
1310  if (resultIsIdeal)
1311  {
1312  res = idInit(1,1);
1313  res->m[0] = pOne();
1314  }
1315  else
1316  res = idFreeModule(h1->rank);
1317  return res;
1318  }
1319  BITSET old_test1;
1320  SI_SAVE_OPT1(old_test1);
1321  int i, kmax;
1322  BOOLEAN addOnlyOne=TRUE;
1323  tHomog hom=isNotHomog;
1324  intvec * weights1;
1325 
1326  ideal s_h4 = idInitializeQuot (h1,h2,h1IsStb,&addOnlyOne,&kmax);
1327 
1328  hom = (tHomog)idHomModule(s_h4,currRing->qideal,&weights1);
1329 
1330  ring orig_ring=currRing;
1331  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
1332  rSetSyzComp(kmax-1,syz_ring);
1333  if (orig_ring!=syz_ring)
1334  // s_h4 = idrMoveR_NoSort(s_h4,orig_ring, syz_ring);
1335  s_h4 = idrMoveR(s_h4,orig_ring, syz_ring);
1336  idTest(s_h4);
1337  #if 0
1338  void ipPrint_MA0(matrix m, const char *name);
1339  matrix m=idModule2Matrix(idCopy(s_h4));
1340  PrintS("start:\n");
1341  ipPrint_MA0(m,"Q");
1342  idDelete((ideal *)&m);
1343  PrintS("last elem:");wrp(s_h4->m[IDELEMS(s_h4)-1]);PrintLn();
1344  #endif
1345  ideal s_h3;
1346  if (addOnlyOne)
1347  {
1348  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,0/*kmax-1*/,IDELEMS(s_h4)-1);
1349  }
1350  else
1351  {
1352  s_h3 = kStd(s_h4,currRing->qideal,hom,&weights1,NULL,kmax-1);
1353  }
1354  SI_RESTORE_OPT1(old_test1);
1355  #if 0
1356  // only together with the above debug stuff
1357  idSkipZeroes(s_h3);
1358  m=idModule2Matrix(idCopy(s_h3));
1359  Print("result, kmax=%d:\n",kmax);
1360  ipPrint_MA0(m,"S");
1361  idDelete((ideal *)&m);
1362  #endif
1363  idTest(s_h3);
1364  if (weights1!=NULL) delete weights1;
1365  idDelete(&s_h4);
1366 
1367  for (i=0;i<IDELEMS(s_h3);i++)
1368  {
1369  if ((s_h3->m[i]!=NULL) && (pGetComp(s_h3->m[i])>=kmax))
1370  {
1371  if (resultIsIdeal)
1372  p_Shift(&s_h3->m[i],-kmax,currRing);
1373  else
1374  p_Shift(&s_h3->m[i],-kmax+1,currRing);
1375  }
1376  else
1377  p_Delete(&s_h3->m[i],currRing);
1378  }
1379  if (resultIsIdeal)
1380  s_h3->rank = 1;
1381  else
1382  s_h3->rank = h1->rank;
1383  if(syz_ring!=orig_ring)
1384  {
1385  rChangeCurrRing(orig_ring);
1386  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
1387  rDelete(syz_ring);
1388  }
1389  idSkipZeroes(s_h3);
1390  idTest(s_h3);
1391  return s_h3;
1392 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
static void ipPrint_MA0(matrix m, const char *name)
Definition: ipprint.cc:63
#define SI_SAVE_OPT1(A)
Definition: options.h:20
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w, const ring R=currRing)
Definition: ideals.h:114
#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:1192
Definition: intvec.h:16
tHomog
Definition: structs.h:37
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
int m
Definition: cfEzgcd.cc:119
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
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
ideal idCopy(ideal A, const ring R=currRing)
Definition: ideals.h:76
void wrp(poly p)
Definition: polys.h:281
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#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_SyzComp(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
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#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:90
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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:355
#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)
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
ideal idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:141
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#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
BOOLEAN idIs0(ideal h)
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 1914 of file ideals.cc.

1915 {
1916  for(int i=IDELEMS(M)-1;i>=0;i--)
1917  {
1918  if(U==NULL)
1919  M->m[i]=pSeries(n,M->m[i],NULL,w);
1920  else
1921  {
1922  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
1923  MATELEM(U,i+1,i+1)=NULL;
1924  }
1925  }
1926  if(U!=NULL)
1927  idDelete((ideal*)&U);
1928  return M;
1929 }
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define M
Definition: sirandom.c:24
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
#define pSeries(n, p, u, w)
Definition: polys.h:343
#define NULL
Definition: omList.c:10
#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
polyrec * poly
Definition: hilb.h:10
#define IDELEMS(i)
Definition: simpleideals.h:19
#define NULL
Definition: omList.c:10
intvec* idSort ( ideal  id,
BOOLEAN  nolex = TRUE,
const ring  R = currRing 
)
inline

Definition at line 187 of file ideals.h.

188 {
189  return id_Sort(id, nolex, R);
190 }
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 ...
#define R
Definition: sirandom.c:26
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
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
#define pTest(p)
Definition: polys.h:387
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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:355
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)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
ring rAssure_dp_C(const ring r)
Definition: ring.cc:4858
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
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:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:4482
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#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)
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
return result
Definition: facAbsBiFact.cc:76
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#define idTest(id)
Definition: ideals.h:63
BOOLEAN idTestHomModule ( ideal  m,
ideal  Q,
intvec w 
)

Definition at line 1862 of file ideals.cc.

1863 {
1864  if ((Q!=NULL) && (!idHomIdeal(Q,NULL))) { PrintS(" Q not hom\n"); return FALSE;}
1865  if (idIs0(m)) return TRUE;
1866 
1867  int cmax=-1;
1868  int i;
1869  poly p=NULL;
1870  int length=IDELEMS(m);
1871  polyset P=m->m;
1872  for (i=length-1;i>=0;i--)
1873  {
1874  p=P[i];
1875  if (p!=NULL) cmax=si_max(cmax,(int)pMaxComp(p)+1);
1876  }
1877  if (w != NULL)
1878  if (w->length()+1 < cmax)
1879  {
1880  // Print("length: %d - %d \n", w->length(),cmax);
1881  return FALSE;
1882  }
1883 
1884  if(w!=NULL)
1885  p_SetModDeg(w, currRing);
1886 
1887  for (i=length-1;i>=0;i--)
1888  {
1889  p=P[i];
1890  if (p!=NULL)
1891  {
1892  int d=currRing->pFDeg(p,currRing);
1893  loop
1894  {
1895  pIter(p);
1896  if (p==NULL) break;
1897  if (d!=currRing->pFDeg(p,currRing))
1898  {
1899  //pWrite(q); wrp(p); Print(" -> %d - %d\n",d,pFDeg(p,currRing));
1900  if(w!=NULL)
1902  return FALSE;
1903  }
1904  }
1905  }
1906  }
1907 
1908  if(w!=NULL)
1910 
1911  return TRUE;
1912 }
BOOLEAN idHomIdeal(ideal id, ideal Q=NULL, const ring R=currRing)
Definition: ideals.h:109
void p_SetModDeg(intvec *w, ring r)
Definition: p_polys.cc:3488
#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:85
#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
polyrec * poly
Definition: hilb.h:10
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:19
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:17
kBucketDestroy & P
Definition: myNF.cc:191
BOOLEAN idIs0(ideal h)
ideal idTransp ( ideal  a,
const ring  R = currRing 
)
inline

transpose a module

Definition at line 196 of file ideals.h.

197 {
198  return id_Transp(a, R);
199 }
ideal id_Transp(ideal a, const ring rRing)
const poly a
Definition: syzextra.cc:212
#define R
Definition: sirandom.c:26
ideal idVec2Ideal ( poly  vec,
const ring  R = currRing 
)
inline

Definition at line 172 of file ideals.h.

173 {
174  return id_Vec2Ideal(vec, R);
175 }
fq_nmod_poly_t * vec
Definition: facHensel.cc:103
#define R
Definition: sirandom.c:26
ideal id_Vec2Ideal(poly vec, const ring R)
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 }
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
Definition: kstd1.cc:2067
const ideal
Definition: gb_hack.h:42
#define TRUE
Definition: auxiliary.h:144
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
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
ideal idFreeModule(int i, const ring R=currRing)
Definition: ideals.h:129
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4959
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:205
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#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.