Data Structures | Macros | Functions
ideals.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/options.h>
#include <misc/intvec.h>
#include <coeffs/coeffs.h>
#include <coeffs/numbers.h>
#include <polys/monomials/ring.h>
#include <polys/matpol.h>
#include <polys/weight.h>
#include <polys/sparsmat.h>
#include <polys/prCopy.h>
#include <polys/nc/nc.h>
#include <kernel/ideals.h>
#include <kernel/polys.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/syz.h>
#include <polys/clapsing.h>

Go to the source code of this file.

Data Structures

struct  poly_sort
 

Macros

#define MYTEST   0
 

Functions

ideal idMinBase (ideal h1)
 
ideal idSectWithElim (ideal h1, ideal h2)
 
ideal idSect (ideal h1, ideal h2)
 
ideal idMultSect (resolvente arg, int length)
 
static ideal idPrepare (ideal h1, tHomog hom, int syzcomp, intvec **w)
 
ideal idSyzygies (ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
 
ideal idXXX (ideal h1, int k)
 
ideal idLiftStd (ideal h1, matrix *ma, tHomog hi, ideal *syz)
 
static void idPrepareStd (ideal s_temp, int k)
 
ideal idLift (ideal mod, ideal submod, ideal *rest, BOOLEAN goodShape, BOOLEAN isSB, BOOLEAN divide, matrix *unit)
 
void idLiftW (ideal P, ideal Q, int n, matrix &T, ideal &R, short *w)
 
static ideal idInitializeQuot (ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN *addOnlyOne, int *kkmax)
 
ideal idQuot (ideal h1, ideal h2, BOOLEAN h1IsStb, BOOLEAN resultIsIdeal)
 
ideal idElimination (ideal h1, poly delVar, intvec *hilb)
 
ideal idMinors (matrix a, int ar, ideal R)
 compute all ar-minors of the matrix a the caller of mpRecMin the elements of the result are not in R (if R!=NULL) More...
 
BOOLEAN idIsSubModule (ideal id1, ideal id2)
 
BOOLEAN idTestHomModule (ideal m, ideal Q, intvec *w)
 
ideal idSeries (int n, ideal M, matrix U, intvec *w)
 
matrix idDiff (matrix i, int k)
 
matrix idDiffOp (ideal I, ideal J, BOOLEAN multiply)
 
ideal idModulo (ideal h2, ideal h1, tHomog hom, intvec **w)
 
intvecidMWLift (ideal mod, intvec *weights)
 
ideal idCreateSpecialKbase (ideal kBase, intvec **convert)
 
int idIndexOfKBase (poly monom, ideal kbase)
 
poly idDecompose (poly monom, poly how, ideal kbase, int *pos)
 
matrix idCoeffOfKBase (ideal arg, ideal kbase, poly how)
 
static void idDeleteComps (ideal arg, int *red_comp, int del)
 
ideal idMinEmbedding (ideal arg, BOOLEAN inPlace, intvec **w)
 
poly id_GCD (poly f, poly g, const ring r)
 
ideal id_Farey (ideal x, number N, const ring r)
 
void idKeepFirstK (ideal id, const int k)
 keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.) More...
 
static int tCompare (const poly a, const poly b)
 
static int pCompare (const poly a, const poly b)
 
int pCompare_qsort (const void *a, const void *b)
 
void idSort_qsort (poly_sort *id_sort, int idsize)
 
void idDelEquals (ideal id)
 

Data Structure Documentation

struct poly_sort

Definition at line 2629 of file ideals.cc.

Data Fields
int index
poly p

Macro Definition Documentation

#define MYTEST   0

Definition at line 15 of file ideals.cc.

Function Documentation

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

Definition at line 2505 of file ideals.cc.

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

Definition at line 2405 of file ideals.cc.

2406 {
2407  ideal I=idInit(2,1); I->m[0]=f; I->m[1]=g;
2408  intvec *w = NULL;
2409 
2410  ring save_r = currRing; rChangeCurrRing(r); ideal S=idSyzygies(I,testHomog,&w); rChangeCurrRing(save_r);
2411 
2412  if (w!=NULL) delete w;
2413  poly gg=p_TakeOutComp(&(S->m[0]), 2, r);
2414  id_Delete(&S, r);
2415  poly gcd_p=singclap_pdivide(f,gg, r);
2416  p_Delete(&gg, r);
2417 
2418  return gcd_p;
2419 }
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
Definition: p_polys.cc:3378
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
g
Definition: cfModGcd.cc:4031
poly singclap_pdivide(poly f, poly g, const ring r)
Definition: clapsing.cc:547
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
FILE * f
Definition: checklibs.c:7
void rChangeCurrRing(ring r)
Definition: polys.cc:14
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
polyrec * poly
Definition: hilb.h:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:560
matrix idCoeffOfKBase ( ideal  arg,
ideal  kbase,
poly  how 
)

Definition at line 2281 of file ideals.cc.

2282 {
2283  matrix result;
2284  ideal tempKbase;
2285  poly p,q;
2286  intvec * convert;
2287  int i=IDELEMS(kbase),j=IDELEMS(arg),k,pos;
2288 #if 0
2289  while ((i>0) && (kbase->m[i-1]==NULL)) i--;
2290  if (idIs0(arg))
2291  return mpNew(i,1);
2292  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2293  result = mpNew(i,j);
2294 #else
2295  result = mpNew(i, j);
2296  while ((j>0) && (arg->m[j-1]==NULL)) j--;
2297 #endif
2298 
2299  tempKbase = idCreateSpecialKbase(kbase,&convert);
2300  for (k=0;k<j;k++)
2301  {
2302  p = arg->m[k];
2303  while (p!=NULL)
2304  {
2305  q = idDecompose(p,how,tempKbase,&pos);
2306  if (pos>=0)
2307  {
2308  MATELEM(result,(*convert)[pos],k+1) =
2309  pAdd(MATELEM(result,(*convert)[pos],k+1),q);
2310  }
2311  else
2312  p_Delete(&q,currRing);
2313  pIter(p);
2314  }
2315  }
2316  idDelete(&tempKbase);
2317  return result;
2318 }
#define pAdd(p, q)
Definition: polys.h:174
poly idDecompose(poly monom, poly how, ideal kbase, int *pos)
Definition: ideals.cc:2249
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
ideal idCreateSpecialKbase(ideal kBase, intvec **convert)
Definition: ideals.cc:2195
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idCreateSpecialKbase ( ideal  kBase,
intvec **  convert 
)

Definition at line 2195 of file ideals.cc.

2196 {
2197  int i;
2198  ideal result;
2199 
2200  if (idIs0(kBase)) return NULL;
2201  result = idInit(IDELEMS(kBase),kBase->rank);
2202  *convert = idSort(kBase,FALSE);
2203  for (i=0;i<(*convert)->length();i++)
2204  {
2205  result->m[i] = pCopy(kBase->m[(**convert)[i]-1]);
2206  }
2207  return result;
2208 }
#define FALSE
Definition: auxiliary.h:140
intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition: ideals.h:184
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
poly idDecompose ( poly  monom,
poly  how,
ideal  kbase,
int *  pos 
)

Definition at line 2249 of file ideals.cc.

2250 {
2251  int i;
2252  poly coeff=pOne(), base=pOne();
2253 
2254  for (i=1;i<=(currRing->N);i++)
2255  {
2256  if (pGetExp(how,i)>0)
2257  {
2258  pSetExp(base,i,pGetExp(monom,i));
2259  }
2260  else
2261  {
2262  pSetExp(coeff,i,pGetExp(monom,i));
2263  }
2264  }
2265  pSetComp(base,pGetComp(monom));
2266  pSetm(base);
2267  pSetCoeff(coeff,nCopy(pGetCoeff(monom)));
2268  pSetm(coeff);
2269  *pos = idIndexOfKBase(base,kbase);
2270  if (*pos<0)
2271  p_Delete(&coeff,currRing);
2273  return coeff;
2274 }
#define pSetm(p)
Definition: polys.h:241
#define pSetExp(p, i, v)
Definition: polys.h:42
int idIndexOfKBase(poly monom, ideal kbase)
Definition: ideals.cc:2213
char N base
Definition: ValueTraits.h:144
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#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
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define nCopy(n)
Definition: numbers.h:15
polyrec * poly
Definition: hilb.h:10
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void idDelEquals ( ideal  id)

Definition at line 2650 of file ideals.cc.

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

Definition at line 2320 of file ideals.cc.

2322 {
2323  int i,j;
2324  poly p;
2325 
2326  for (i=IDELEMS(arg)-1;i>=0;i--)
2327  {
2328  p = arg->m[i];
2329  while (p!=NULL)
2330  {
2331  j = pGetComp(p);
2332  if (red_comp[j]!=j)
2333  {
2334  pSetComp(p,red_comp[j]);
2335  pSetmComp(p);
2336  }
2337  pIter(p);
2338  }
2339  }
2340  (arg->rank) -= del;
2341 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
return P p
Definition: myNF.cc:203
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
matrix idDiff ( matrix  i,
int  k 
)

Definition at line 1953 of file ideals.cc.

1954 {
1955  int e=MATCOLS(i)*MATROWS(i);
1956  matrix r=mpNew(MATROWS(i),MATCOLS(i));
1957  r->rank=i->rank;
1958  int j;
1959  for(j=0; j<e; j++)
1960  {
1961  r->m[j]=pDiff(i->m[j],k);
1962  }
1963  return r;
1964 }
int k
Definition: cfEzgcd.cc:93
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
#define MATCOLS(i)
Definition: matpol.h:28
#define pDiff(a, b)
Definition: polys.h:267
#define MATROWS(i)
Definition: matpol.h:27
long rank
Definition: matpol.h:20
matrix idDiffOp ( ideal  I,
ideal  J,
BOOLEAN  multiply 
)

Definition at line 1966 of file ideals.cc.

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

Definition at line 1403 of file ideals.cc.

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

Definition at line 2213 of file ideals.cc.

2214 {
2215  int j=IDELEMS(kbase);
2216 
2217  while ((j>0) && (kbase->m[j-1]==NULL)) j--;
2218  if (j==0) return -1;
2219  int i=(currRing->N);
2220  while (i>0)
2221  {
2222  loop
2223  {
2224  if (pGetExp(monom,i)>pGetExp(kbase->m[j-1],i)) return -1;
2225  if (pGetExp(monom,i)==pGetExp(kbase->m[j-1],i)) break;
2226  j--;
2227  if (j==0) return -1;
2228  }
2229  if (i==1)
2230  {
2231  while(j>0)
2232  {
2233  if (pGetComp(monom)==pGetComp(kbase->m[j-1])) return j-1;
2234  if (pGetComp(monom)>pGetComp(kbase->m[j-1])) return -1;
2235  j--;
2236  }
2237  }
2238  i--;
2239  }
2240  return -1;
2241 }
loop
Definition: myNF.cc:98
#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
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
static ideal idInitializeQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb,
BOOLEAN addOnlyOne,
int *  kkmax 
)
static

addOnlyOne &&

Definition at line 1198 of file ideals.cc.

1199 {
1200  idTest(h1);
1201  idTest(h2);
1202 
1203  ideal temph1;
1204  poly p,q = NULL;
1205  int i,l,ll,k,kkk,kmax;
1206  int j = 0;
1207  int k1 = id_RankFreeModule(h1,currRing);
1208  int k2 = id_RankFreeModule(h2,currRing);
1209  tHomog hom=isNotHomog;
1210  k=si_max(k1,k2);
1211  if (k==0)
1212  k = 1;
1213  if ((k2==0) && (k>1)) *addOnlyOne = FALSE;
1214  intvec * weights;
1215  hom = (tHomog)idHomModule(h1,currRing->qideal,&weights);
1216  if /**addOnlyOne &&*/ (/*(*/ !h1IsStb /*)*/)
1217  temph1 = kStd(h1,currRing->qideal,hom,&weights,NULL);
1218  else
1219  temph1 = idCopy(h1);
1220  if (weights!=NULL) delete weights;
1221  idTest(temph1);
1222 /*--- making a single vector from h2 ---------------------*/
1223  for (i=0; i<IDELEMS(h2); i++)
1224  {
1225  if (h2->m[i] != NULL)
1226  {
1227  p = pCopy(h2->m[i]);
1228  if (k2 == 0)
1229  p_Shift(&p,j*k+1,currRing);
1230  else
1231  p_Shift(&p,j*k,currRing);
1232  q = pAdd(q,p);
1233  j++;
1234  }
1235  }
1236  *kkmax = kmax = j*k+1;
1237 /*--- adding a monomial for the result (syzygy) ----------*/
1238  p = q;
1239  while (pNext(p)!=NULL) pIter(p);
1240  pNext(p) = pOne();
1241  pIter(p);
1242  pSetComp(p,kmax);
1243  pSetmComp(p);
1244 /*--- constructing the big matrix ------------------------*/
1245  ideal h4 = idInit(16,kmax+k-1);
1246  h4->m[0] = q;
1247  if (k2 == 0)
1248  {
1249  if (k > IDELEMS(h4))
1250  {
1251  pEnlargeSet(&(h4->m),IDELEMS(h4),k-IDELEMS(h4));
1252  IDELEMS(h4) = k;
1253  }
1254  for (i=1; i<k; i++)
1255  {
1256  if (h4->m[i-1]!=NULL)
1257  {
1258  p = p_Copy_noCheck(h4->m[i-1], currRing); p_Shift(&p,1,currRing);
1259  // pTest(p);
1260  h4->m[i] = p;
1261  }
1262  }
1263  }
1264  idSkipZeroes(h4);
1265  kkk = IDELEMS(h4);
1266  i = IDELEMS(temph1);
1267  for (l=0; l<i; l++)
1268  {
1269  if(temph1->m[l]!=NULL)
1270  {
1271  for (ll=0; ll<j; ll++)
1272  {
1273  p = pCopy(temph1->m[l]);
1274  if (k1 == 0)
1275  p_Shift(&p,ll*k+1,currRing);
1276  else
1277  p_Shift(&p,ll*k,currRing);
1278  if (kkk >= IDELEMS(h4))
1279  {
1280  pEnlargeSet(&(h4->m),IDELEMS(h4),16);
1281  IDELEMS(h4) += 16;
1282  }
1283  h4->m[kkk] = p;
1284  kkk++;
1285  }
1286  }
1287  }
1288 /*--- if h2 goes in as single vector - the h1-part is just SB ---*/
1289  if (*addOnlyOne)
1290  {
1291  idSkipZeroes(h4);
1292  p = h4->m[0];
1293  for (i=0;i<IDELEMS(h4)-1;i++)
1294  {
1295  h4->m[i] = h4->m[i+1];
1296  }
1297  h4->m[IDELEMS(h4)-1] = p;
1298  #ifdef HAVE_RINGS
1299  if(!rField_is_Ring(currRing))
1300  #endif
1301  si_opt_1 |= Sy_bit(OPT_SB_1);
1302  }
1303  idDelete(&temph1);
1304  //idTest(h4);//see remark at the beginning
1305  return h4;
1306 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
unsigned si_opt_1
Definition: options.c:5
#define pAdd(p, q)
Definition: polys.h:174
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
int k
Definition: cfEzgcd.cc:93
#define Sy_bit(x)
Definition: options.h:30
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
Definition: p_polys.h:804
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:76
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:437
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
#define pNext(p)
Definition: monomials.h:43
#define OPT_SB_1
Definition: options.h:90
polyrec * poly
Definition: hilb.h:10
BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:111
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define idTest(id)
Definition: ideals.h:63
BOOLEAN idIsSubModule ( ideal  id1,
ideal  id2 
)

Definition at line 1863 of file ideals.cc.

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

keeps the first k (>= 1) entries of the given ideal (Note that the kept polynomials may be zero.)

Definition at line 2581 of file ideals.cc.

2582 {
2583  for (int i = IDELEMS(id)-1; i >= k; i--)
2584  {
2585  if (id->m[i] != NULL) pDelete(&id->m[i]);
2586  }
2587  int kk=k;
2588  if (k==0) kk=1; /* ideals must have at least one element(0)*/
2589  pEnlargeSet(&(id->m), IDELEMS(id), kk-IDELEMS(id));
2590  IDELEMS(id) = kk;
2591 }
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
#define pDelete(p_ptr)
Definition: polys.h:157
ideal idLift ( ideal  mod,
ideal  submod,
ideal *  rest,
BOOLEAN  goodShape,
BOOLEAN  isSB,
BOOLEAN  divide,
matrix unit 
)

Definition at line 938 of file ideals.cc.

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

Definition at line 751 of file ideals.cc.

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

Definition at line 1133 of file ideals.cc.

1134 {
1135  long N=0;
1136  int i;
1137  for(i=IDELEMS(Q)-1;i>=0;i--)
1138  if(w==NULL)
1139  N=si_max(N,p_Deg(Q->m[i],currRing));
1140  else
1141  N=si_max(N,p_DegW(Q->m[i],w,currRing));
1142  N+=n;
1143 
1144  T=mpNew(IDELEMS(Q),IDELEMS(P));
1145  R=idInit(IDELEMS(P),P->rank);
1146 
1147  for(i=IDELEMS(P)-1;i>=0;i--)
1148  {
1149  poly p;
1150  if(w==NULL)
1151  p=ppJet(P->m[i],N);
1152  else
1153  p=ppJetW(P->m[i],N,w);
1154 
1155  int j=IDELEMS(Q)-1;
1156  while(p!=NULL)
1157  {
1158  if(pDivisibleBy(Q->m[j],p))
1159  {
1160  poly p0=p_DivideM(pHead(p),pHead(Q->m[j]),currRing);
1161  if(w==NULL)
1162  p=pJet(pSub(p,ppMult_mm(Q->m[j],p0)),N);
1163  else
1164  p=pJetW(pSub(p,ppMult_mm(Q->m[j],p0)),N,w);
1165  pNormalize(p);
1166  if(((w==NULL)&&(p_Deg(p0,currRing)>n))||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1167  p_Delete(&p0,currRing);
1168  else
1169  MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
1170  j=IDELEMS(Q)-1;
1171  }
1172  else
1173  {
1174  if(j==0)
1175  {
1176  poly p0=p;
1177  pIter(p);
1178  pNext(p0)=NULL;
1179  if(((w==NULL)&&(p_Deg(p0,currRing)>n))
1180  ||((w!=NULL)&&(p_DegW(p0,w,currRing)>n)))
1181  p_Delete(&p0,currRing);
1182  else
1183  R->m[i]=pAdd(R->m[i],p0);
1184  j=IDELEMS(Q)-1;
1185  }
1186  else
1187  j--;
1188  }
1189  }
1190  }
1191 }
#define pAdd(p, q)
Definition: polys.h:174
#define ppJet(p, m)
Definition: polys.h:338
return P p
Definition: myNF.cc:203
#define ppMult_mm(p, m)
Definition: polys.h:172
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define Q
Definition: sirandom.c:25
#define pJetW(p, m, iv)
Definition: polys.h:341
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_DegW(poly p, const short *w, const ring R)
Definition: p_polys.cc:689
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
#define pSub(a, b)
Definition: polys.h:258
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define pJet(p, m)
Definition: polys.h:339
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
poly p_DivideM(poly a, poly b, const ring r)
Definition: p_polys.cc:1501
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:126
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
#define ppJetW(p, m, iv)
Definition: polys.h:340
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ideal idMinBase ( ideal  h1)

Definition at line 53 of file ideals.cc.

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

Definition at line 2347 of file ideals.cc.

2348 {
2349  if (idIs0(arg)) return idInit(1,arg->rank);
2350  int i,next_gen,next_comp;
2351  ideal res=arg;
2352  if (!inPlace) res = idCopy(arg);
2353  res->rank=si_max(res->rank,id_RankFreeModule(res,currRing));
2354  int *red_comp=(int*)omAlloc((res->rank+1)*sizeof(int));
2355  for (i=res->rank;i>=0;i--) red_comp[i]=i;
2356 
2357  int del=0;
2358  loop
2359  {
2360  next_gen = id_ReadOutPivot(res, &next_comp, currRing);
2361  if (next_gen<0) break;
2362  del++;
2363  syGaussForOne(res,next_gen,next_comp,0,IDELEMS(res));
2364  for(i=next_comp+1;i<=arg->rank;i++) red_comp[i]--;
2365  if ((w !=NULL)&&(*w!=NULL))
2366  {
2367  for(i=next_comp;i<(*w)->length();i++) (**w)[i-1]=(**w)[i];
2368  }
2369  }
2370 
2371  idDeleteComps(res,red_comp,del);
2372  idSkipZeroes(res);
2373  omFree(red_comp);
2374 
2375  if ((w !=NULL)&&(*w!=NULL) &&(del>0))
2376  {
2377  int nl=si_max((*w)->length()-del,1);
2378  intvec *wtmp=new intvec(nl);
2379  for(i=0;i<res->rank;i++) (*wtmp)[i]=(**w)[i];
2380  delete *w;
2381  *w=wtmp;
2382  }
2383  return res;
2384 }
loop
Definition: myNF.cc:98
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define omFree(addr)
Definition: omAllocDecl.h:261
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:76
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static void idDeleteComps(ideal arg, int *red_comp, int del)
Definition: ideals.cc:2320
const CanonicalForm & w
Definition: facAbsFact.cc:55
void syGaussForOne(ideal syz, int elnum, int ModComp, int from, int till)
Definition: syz.cc:223
int id_ReadOutPivot(ideal arg, int *comp, const ring r)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
ideal idMinors ( matrix  a,
int  ar,
ideal  R 
)

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

Definition at line 1794 of file ideals.cc.

1795 {
1796 
1797  const ring origR=currRing;
1798  id_Test((ideal)a, origR);
1799 
1800  const int r = a->nrows;
1801  const int c = a->ncols;
1802 
1803  if((ar<=0) || (ar>r) || (ar>c))
1804  {
1805  Werror("%d-th minor, matrix is %dx%d",ar,r,c);
1806  return NULL;
1807  }
1808 
1809  ideal h = id_Matrix2Module(mp_Copy(a,origR),origR);
1810  long bound = sm_ExpBound(h,c,r,ar,origR);
1811  id_Delete(&h, origR);
1812 
1813  ring tmpR = sm_RingChange(origR,bound);
1814 
1815  matrix b = mpNew(r,c);
1816 
1817  for (int i=r*c-1;i>=0;i--)
1818  if (a->m[i] != NULL)
1819  b->m[i] = prCopyR(a->m[i],origR,tmpR);
1820 
1821  id_Test( (ideal)b, tmpR);
1822 
1823  if (R!=NULL)
1824  {
1825  R = idrCopyR(R,origR,tmpR); // TODO: overwrites R? memory leak?
1826  //if (ar>1) // otherwise done in mpMinorToResult
1827  //{
1828  // matrix bb=(matrix)kNF(R,currRing->qideal,(ideal)b);
1829  // bb->rank=b->rank; bb->nrows=b->nrows; bb->ncols=b->ncols;
1830  // idDelete((ideal*)&b); b=bb;
1831  //}
1832  id_Test( R, tmpR);
1833  }
1834 
1835 
1836  ideal result = idInit(32,1);
1837 
1838  int elems = 0;
1839 
1840  if(ar>1)
1841  mp_RecMin(ar-1,result,elems,b,r,c,NULL,R,tmpR);
1842  else
1843  mp_MinorToResult(result,elems,b,r,c,R,tmpR);
1844 
1845  id_Test( (ideal)b, tmpR);
1846 
1847  id_Delete((ideal *)&b, tmpR);
1848 
1849  if (R!=NULL) idDelete(&R);
1850 
1851  idSkipZeroes(result);
1852  rChangeCurrRing(origR);
1853  result = idrMoveR(result,tmpR,origR);
1854  sm_KillModifiedRing(tmpR);
1855  idTest(result);
1856  return result;
1857 }
ring sm_RingChange(const ring origR, long bound)
Definition: sparsmat.cc:263
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
int ncols
Definition: matpol.h:22
#define id_Test(A, lR)
Definition: simpleideals.h:80
void mp_RecMin(int ar, ideal result, int &elems, matrix a, int lr, int lc, poly barDiv, ideal R, const ring r)
produces recursively the ideal of all arxar-minors of a
Definition: matpol.cc:1508
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void mp_MinorToResult(ideal result, int &elems, matrix a, int r, int c, ideal R, const ring)
entries of a are minors and go to result (only if not in R)
Definition: matpol.cc:1412
long sm_ExpBound(ideal m, int di, int ra, int t, const ring currRing)
Definition: sparsmat.cc:194
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
poly * m
Definition: matpol.h:19
const ring r
Definition: syzextra.cc:208
int nrows
Definition: matpol.h:21
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
int i
Definition: cfEzgcd.cc:123
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
Definition: polys.cc:14
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void sm_KillModifiedRing(ring r)
Definition: sparsmat.cc:294
#define R
Definition: sirandom.c:26
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:75
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213
ideal id_Matrix2Module(matrix mat, const ring R)
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define idTest(id)
Definition: ideals.h:63
ideal idModulo ( ideal  h2,
ideal  h1,
tHomog  hom,
intvec **  w 
)

Definition at line 2038 of file ideals.cc.

2039 {
2040  intvec *wtmp=NULL;
2041 
2042  int i,k,rk,flength=0,slength,length;
2043  poly p,q;
2044 
2045  if (idIs0(h2))
2046  return idFreeModule(si_max(1,h2->ncols));
2047  if (!idIs0(h1))
2048  flength = id_RankFreeModule(h1,currRing);
2049  slength = id_RankFreeModule(h2,currRing);
2050  length = si_max(flength,slength);
2051  if (length==0)
2052  {
2053  length = 1;
2054  }
2055  ideal temp = idInit(IDELEMS(h2),length+IDELEMS(h2));
2056  if ((w!=NULL)&&((*w)!=NULL))
2057  {
2058  //Print("input weights:");(*w)->show(1);PrintLn();
2059  int d;
2060  int k;
2061  wtmp=new intvec(length+IDELEMS(h2));
2062  for (i=0;i<length;i++)
2063  ((*wtmp)[i])=(**w)[i];
2064  for (i=0;i<IDELEMS(h2);i++)
2065  {
2066  poly p=h2->m[i];
2067  if (p!=NULL)
2068  {
2069  d = p_Deg(p,currRing);
2070  k= pGetComp(p);
2071  if (slength>0) k--;
2072  d +=((**w)[k]);
2073  ((*wtmp)[i+length]) = d;
2074  }
2075  }
2076  //Print("weights:");wtmp->show(1);PrintLn();
2077  }
2078  for (i=0;i<IDELEMS(h2);i++)
2079  {
2080  temp->m[i] = pCopy(h2->m[i]);
2081  q = pOne();
2082  pSetComp(q,i+1+length);
2083  pSetmComp(q);
2084  if(temp->m[i]!=NULL)
2085  {
2086  if (slength==0) p_Shift(&(temp->m[i]),1,currRing);
2087  p = temp->m[i];
2088  while (pNext(p)!=NULL) pIter(p);
2089  pNext(p) = q; // will be sorted later correctly
2090  }
2091  else
2092  temp->m[i]=q;
2093  }
2094  rk = k = IDELEMS(h2);
2095  if (!idIs0(h1))
2096  {
2097  pEnlargeSet(&(temp->m),IDELEMS(temp),IDELEMS(h1));
2098  IDELEMS(temp) += IDELEMS(h1);
2099  for (i=0;i<IDELEMS(h1);i++)
2100  {
2101  if (h1->m[i]!=NULL)
2102  {
2103  temp->m[k] = pCopy(h1->m[i]);
2104  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
2105  k++;
2106  }
2107  }
2108  }
2109 
2110  ring orig_ring=currRing;
2111  ring syz_ring=rAssure_SyzOrder(orig_ring, TRUE); rChangeCurrRing(syz_ring);
2112  // we can use OPT_RETURN_SB only, if syz_ring==orig_ring,
2113  // therefore we disable OPT_RETURN_SB for modulo:
2114  // (see tr. #701)
2115  //if (TEST_OPT_RETURN_SB)
2116  // rSetSyzComp(IDELEMS(h2)+length, syz_ring);
2117  //else
2118  rSetSyzComp(length, syz_ring);
2119  ideal s_temp;
2120 
2121  if (syz_ring != orig_ring)
2122  {
2123  s_temp = idrMoveR_NoSort(temp, orig_ring, syz_ring);
2124  }
2125  else
2126  {
2127  s_temp = temp;
2128  }
2129 
2130  idTest(s_temp);
2131  ideal s_temp1 = kStd(s_temp,currRing->qideal,hom,&wtmp,NULL,length);
2132 
2133  //if (wtmp!=NULL) Print("output weights:");wtmp->show(1);PrintLn();
2134  if ((w!=NULL) && (*w !=NULL) && (wtmp!=NULL))
2135  {
2136  delete *w;
2137  *w=new intvec(IDELEMS(h2));
2138  for (i=0;i<IDELEMS(h2);i++)
2139  ((**w)[i])=(*wtmp)[i+length];
2140  }
2141  if (wtmp!=NULL) delete wtmp;
2142 
2143  for (i=0;i<IDELEMS(s_temp1);i++)
2144  {
2145  if ((s_temp1->m[i]!=NULL)
2146  && (((int)pGetComp(s_temp1->m[i]))<=length))
2147  {
2148  p_Delete(&(s_temp1->m[i]),currRing);
2149  }
2150  else
2151  {
2152  p_Shift(&(s_temp1->m[i]),-length,currRing);
2153  }
2154  }
2155  s_temp1->rank = rk;
2156  idSkipZeroes(s_temp1);
2157 
2158  if (syz_ring!=orig_ring)
2159  {
2160  rChangeCurrRing(orig_ring);
2161  s_temp1 = idrMoveR_NoSort(s_temp1, syz_ring, orig_ring);
2162  rDelete(syz_ring);
2163  // Hmm ... here seems to be a memory leak
2164  // However, simply deleting it causes memory trouble
2165  // idDelete(&s_temp);
2166  }
2167  else
2168  {
2169  idDelete(&temp);
2170  }
2171  idTest(s_temp1);
2172  return s_temp1;
2173 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal idFreeModule(int i)
Definition: ideals.h:126
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3540
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define idTest(id)
Definition: ideals.h:63
ideal idMultSect ( resolvente  arg,
int  length 
)

Definition at line 350 of file ideals.cc.

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

Definition at line 2178 of file ideals.cc.

2179 {
2180  if (idIs0(mod)) return new intvec(2);
2181  int i=IDELEMS(mod);
2182  while ((i>0) && (mod->m[i-1]==NULL)) i--;
2183  intvec *result = new intvec(i+1);
2184  while (i>0)
2185  {
2186  (*result)[i]=currRing->pFDeg(mod->m[i],currRing)+(*weights)[pGetComp(mod->m[i])];
2187  }
2188  return result;
2189 }
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
return result
Definition: facAbsBiFact.cc:76
static ideal idPrepare ( ideal  h1,
tHomog  hom,
int  syzcomp,
intvec **  w 
)
static

Definition at line 465 of file ideals.cc.

466 {
467  ideal h2, h3;
468  int i;
469  int j,k;
470  poly p,q;
471 
472  if (idIs0(h1)) return NULL;
473  k = id_RankFreeModule(h1,currRing);
474  h2=idCopy(h1);
475  i = IDELEMS(h2)-1;
476  if (k == 0)
477  {
478  id_Shift(h2,1,currRing);
479  k = 1;
480  }
481  if (syzcomp<k)
482  {
483  Warn("syzcomp too low, should be %d instead of %d",k,syzcomp);
484  syzcomp = k;
486  }
487  h2->rank = syzcomp+i+1;
488 
489  //if (hom==testHomog)
490  //{
491  // if(idHomIdeal(h1,currRing->qideal))
492  // {
493  // hom=TRUE;
494  // }
495  //}
496 
497 #if MYTEST
498 #ifdef RDEBUG
499  Print("Prepare::h2: ");
500  idPrint(h2);
501 
502  for(j=0;j<IDELEMS(h2);j++) pTest(h2->m[j]);
503 
504 #endif
505 #endif
506 
507  for (j=0; j<=i; j++)
508  {
509  p = h2->m[j];
510  q = pOne();
511  pSetComp(q,syzcomp+1+j);
512  pSetmComp(q);
513  if (p!=NULL)
514  {
515  while (pNext(p)) pIter(p);
516  p->next = q;
517  }
518  else
519  h2->m[j]=q;
520  }
521 
522 #ifdef PDEBUG
523  for(j=0;j<IDELEMS(h2);j++) pTest(h2->m[j]);
524 
525 #if MYTEST
526 #ifdef RDEBUG
527  Print("Prepare::Input: ");
528  idPrint(h2);
529 
530  Print("Prepare::currQuotient: ");
531  idPrint(currRing->qideal);
532 #endif
533 #endif
534 
535 #endif
536 
537  idTest(h2);
538 
539  h3 = kStd(h2,currRing->qideal,hom,w,NULL,syzcomp);
540 
541 #if MYTEST
542 #ifdef RDEBUG
543  Print("Prepare::Output: ");
544  idPrint(h3);
545  for(j=0;j<IDELEMS(h2);j++) pTest(h3->m[j]);
546 #endif
547 #endif
548 
549 
550  idDelete(&h2);
551  return h3;
552 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
#define pTest(p)
Definition: polys.h:387
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
int k
Definition: cfEzgcd.cc:93
#define 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)
#define idPrint(id)
Definition: ideals.h:62
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
#define pSetComp(p, v)
Definition: polys.h:38
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idCopy(ideal A)
Definition: ideals.h:76
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define idTest(id)
Definition: ideals.h:63
#define Warn
Definition: emacs.cc:80
static void idPrepareStd ( ideal  s_temp,
int  k 
)
static

Definition at line 904 of file ideals.cc.

905 {
906  int j,rk=id_RankFreeModule(s_temp,currRing);
907  poly p,q;
908 
909  if (rk == 0)
910  {
911  for (j=0; j<IDELEMS(s_temp); j++)
912  {
913  if (s_temp->m[j]!=NULL) pSetCompP(s_temp->m[j],1);
914  }
915  k = si_max(k,1);
916  }
917  for (j=0; j<IDELEMS(s_temp); j++)
918  {
919  if (s_temp->m[j]!=NULL)
920  {
921  p = s_temp->m[j];
922  q = pOne();
923  //pGetCoeff(q)=nInpNeg(pGetCoeff(q)); //set q to -1
924  pSetComp(q,k+1+j);
925  pSetmComp(q);
926  while (pNext(p)) pIter(p);
927  pNext(p) = q;
928  }
929  }
930  s_temp->rank += k;
931 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
return P p
Definition: myNF.cc:203
int k
Definition: cfEzgcd.cc:93
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
#define pSetCompP(a, i)
Definition: polys.h:274
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
ideal idQuot ( ideal  h1,
ideal  h2,
BOOLEAN  h1IsStb,
BOOLEAN  resultIsIdeal 
)

Definition at line 1310 of file ideals.cc.

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

Definition at line 211 of file ideals.cc.

212 {
213  int i,j,k,length;
214  int flength = id_RankFreeModule(h1,currRing);
215  int slength = id_RankFreeModule(h2,currRing);
216  int rank=si_max(h1->rank,h2->rank);
217  if ((idIs0(h1)) || (idIs0(h2))) return idInit(1,rank);
218 
219  ideal first,second,temp,temp1,result;
220  poly p,q;
221 
222  if (IDELEMS(h1)<IDELEMS(h2))
223  {
224  first = h1;
225  second = h2;
226  }
227  else
228  {
229  first = h2;
230  second = h1;
231  int t=flength; flength=slength; slength=t;
232  }
233  length = si_max(flength,slength);
234  if (length==0)
235  {
236  if ((currRing->qideal==NULL)
237  && (currRing->OrdSgn==1)
238  && (!rIsPluralRing(currRing))
240  return idSectWithElim(first,second);
241  else length = 1;
242  }
243  if (TEST_OPT_PROT) PrintS("intersect by syzygy methods\n");
244  j = IDELEMS(first);
245 
246  ring orig_ring=currRing;
247  ring syz_ring=rAssure_SyzOrder(orig_ring,TRUE); rChangeCurrRing(syz_ring);
248  rSetSyzComp(length, syz_ring);
249 
250  while ((j>0) && (first->m[j-1]==NULL)) j--;
251  temp = idInit(j /*IDELEMS(first)*/+IDELEMS(second),length+j);
252  k = 0;
253  for (i=0;i<j;i++)
254  {
255  if (first->m[i]!=NULL)
256  {
257  if (syz_ring==orig_ring)
258  temp->m[k] = pCopy(first->m[i]);
259  else
260  temp->m[k] = prCopyR(first->m[i], orig_ring, syz_ring);
261  q = pOne();
262  pSetComp(q,i+1+length);
263  pSetmComp(q);
264  if (flength==0) p_Shift(&(temp->m[k]),1,currRing);
265  p = temp->m[k];
266  while (pNext(p)!=NULL) pIter(p);
267  pNext(p) = q;
268  k++;
269  }
270  }
271  for (i=0;i<IDELEMS(second);i++)
272  {
273  if (second->m[i]!=NULL)
274  {
275  if (syz_ring==orig_ring)
276  temp->m[k] = pCopy(second->m[i]);
277  else
278  temp->m[k] = prCopyR(second->m[i], orig_ring,currRing);
279  if (slength==0) p_Shift(&(temp->m[k]),1,currRing);
280  k++;
281  }
282  }
283  intvec *w=NULL;
284  temp1 = kStd(temp,currRing->qideal,testHomog,&w,NULL,length);
285  if (w!=NULL) delete w;
286  idDelete(&temp);
287  if(syz_ring!=orig_ring)
288  rChangeCurrRing(orig_ring);
289 
290  result = idInit(IDELEMS(temp1),rank);
291  j = 0;
292  for (i=0;i<IDELEMS(temp1);i++)
293  {
294  if ((temp1->m[i]!=NULL)
295  && (p_GetComp(temp1->m[i],syz_ring)>length))
296  {
297  if(syz_ring==orig_ring)
298  {
299  p = temp1->m[i];
300  }
301  else
302  {
303  p = prMoveR(temp1->m[i], syz_ring,orig_ring);
304  }
305  temp1->m[i]=NULL;
306  while (p!=NULL)
307  {
308  q = pNext(p);
309  pNext(p) = NULL;
310  k = pGetComp(p)-1-length;
311  pSetComp(p,0);
312  pSetmComp(p);
313  /* Warning! multiply only from the left! it's very important for Plural */
314  result->m[j] = pAdd(result->m[j],pMult(p,pCopy(first->m[k])));
315  p = q;
316  }
317  j++;
318  }
319  }
320  if(syz_ring!=orig_ring)
321  {
322  rChangeCurrRing(syz_ring);
323  idDelete(&temp1);
324  rChangeCurrRing(orig_ring);
325  rDelete(syz_ring);
326  }
327  else
328  {
329  idDelete(&temp1);
330  }
331 
332  idSkipZeroes(result);
333  if (TEST_OPT_RETURN_SB)
334  {
335  w=NULL;
336  temp1=kStd(result,currRing->qideal,testHomog,&w);
337  if (w!=NULL) delete w;
338  idDelete(&result);
339  idSkipZeroes(temp1);
340  return temp1;
341  }
342  else //temp1=kInterRed(result,currRing->qideal);
343  return result;
344 }
#define pSetmComp(p)
TODO:
Definition: polys.h:243
#define pAdd(p, q)
Definition: polys.h:174
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define TRUE
Definition: auxiliary.h:144
ring rAssure_SyzOrder(const ring r, BOOLEAN complete)
Definition: ring.cc:4381
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
int k
Definition: cfEzgcd.cc:93
#define TEST_V_INTERSECT_ELIM
Definition: options.h:136
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int j
Definition: myNF.cc:70
ideal idSectWithElim(ideal h1, ideal h2)
Definition: ideals.cc:141
#define pSetComp(p, v)
Definition: polys.h:38
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
Definition: p_polys.cc:4485
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
#define pMult(p, q)
Definition: polys.h:178
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pNext(p)
Definition: monomials.h:43
#define TEST_V_INTERSECT_SYZ
Definition: options.h:137
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
return result
Definition: facAbsBiFact.cc:76
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
ideal idSectWithElim ( ideal  h1,
ideal  h2 
)

Definition at line 141 of file ideals.cc.

143 {
144  if (TEST_OPT_PROT) PrintS("intersect by elimination method\n");
145  assume(!idIs0(h1));
146  assume(!idIs0(h2));
147  assume(IDELEMS(h1)<=IDELEMS(h2));
150  // add a new variable:
151  int j;
152  ring origRing=currRing;
153  ring r=rCopy0(origRing);
154  r->N++;
155  r->block0[0]=1;
156  r->block1[0]= r->N;
157  omFree(r->order);
158  r->order=(int*)omAlloc0(3*sizeof(int*));
159  r->order[0]=ringorder_dp;
160  r->order[1]=ringorder_C;
161  char **names=(char**)omAlloc0(rVar(r) * sizeof(char_ptr));
162  for (j=0;j<r->N-1;j++) names[j]=r->names[j];
163  names[r->N-1]=omStrDup("@");
164  omFree(r->names);
165  r->names=names;
166  rComplete(r,TRUE);
167  // fetch h1, h2
168  ideal h;
169  h1=idrCopyR(h1,origRing,r);
170  h2=idrCopyR(h2,origRing,r);
171  // switch to temp. ring r
172  rChangeCurrRing(r);
173  // create 1-t, t
174  poly omt=p_One(currRing);
175  p_SetExp(omt,r->N,1,currRing);
176  poly t=p_Copy(omt,currRing);
177  p_Setm(omt,currRing);
178  omt=p_Neg(omt,currRing);
179  omt=p_Add_q(omt,pOne(),currRing);
180  // compute (1-t)*h1
181  h1=(ideal)mp_MultP((matrix)h1,omt,currRing);
182  // compute t*h2
183  h2=(ideal)mp_MultP((matrix)h2,pCopy(t),currRing);
184  // (1-t)h1 + t*h2
185  h=idInit(IDELEMS(h1)+IDELEMS(h2),1);
186  int l;
187  for (l=IDELEMS(h1)-1; l>=0; l--)
188  {
189  h->m[l] = h1->m[l]; h1->m[l]=NULL;
190  }
191  j=IDELEMS(h1);
192  for (l=IDELEMS(h2)-1; l>=0; l--)
193  {
194  h->m[l+j] = h2->m[l]; h2->m[l]=NULL;
195  }
196  idDelete(&h1);
197  idDelete(&h2);
198  // eliminate t:
199 
200  ideal res=idElimination(h,t);
201  // cleanup
202  idDelete(&h);
203  if (res!=NULL) res=idrMoveR(res,r,origRing);
204  rChangeCurrRing(origRing);
205  rDelete(r);
206  return res;
207 }
#define TEST_OPT_PROT
Definition: options.h:98
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
#define TRUE
Definition: auxiliary.h:144
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
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
char * char_ptr
Definition: structs.h:56
const ring r
Definition: syzextra.cc:208
ideal idElimination(ideal h1, poly delVar, intvec *hilb)
Definition: ideals.cc:1403
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
poly p_One(const ring r)
Definition: p_polys.cc:1318
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1318
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
#define IDELEMS(i)
Definition: simpleideals.h:24
void rChangeCurrRing(ring r)
Definition: polys.cc:14
matrix mp_MultP(matrix a, poly p, const ring R)
multiply a matrix 'a' by a poly 'p', destroy the args
Definition: matpol.cc:159
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:193
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
static Poly * h
Definition: janet.cc:978
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define omStrDup(s)
Definition: omAllocDecl.h:263
ideal idSeries ( int  n,
ideal  M,
matrix  U,
intvec w 
)

Definition at line 1936 of file ideals.cc.

1937 {
1938  for(int i=IDELEMS(M)-1;i>=0;i--)
1939  {
1940  if(U==NULL)
1941  M->m[i]=pSeries(n,M->m[i],NULL,w);
1942  else
1943  {
1944  M->m[i]=pSeries(n,M->m[i],MATELEM(U,i+1,i+1),w);
1945  MATELEM(U,i+1,i+1)=NULL;
1946  }
1947  }
1948  if(U!=NULL)
1949  idDelete((ideal*)&U);
1950  return M;
1951 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define M
Definition: sirandom.c:24
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define pSeries(n, p, u, w)
Definition: polys.h:343
#define NULL
Definition: omList.c:10
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void idSort_qsort ( poly_sort id_sort,
int  idsize 
)

Definition at line 2641 of file ideals.cc.

2642 {
2643  qsort(id_sort, idsize, sizeof(poly_sort), pCompare_qsort);
2644 }
int pCompare_qsort(const void *a, const void *b)
Definition: ideals.cc:2635
ideal idSyzygies ( ideal  h1,
tHomog  h,
intvec **  w,
BOOLEAN  setSyzComp,
BOOLEAN  setRegularity,
int *  deg 
)

Definition at line 560 of file ideals.cc.

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

Definition at line 1884 of file ideals.cc.

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

Definition at line 704 of file ideals.cc.

705 {
706  ideal s_h1;
707  intvec *w=NULL;
708 
709  assume(currRing != NULL);
710  ring orig_ring=currRing;
711  ring syz_ring=rAssure_SyzComp(orig_ring,TRUE); rChangeCurrRing(syz_ring);
712 
713  rSetSyzComp(k,syz_ring);
714 
715  if (orig_ring != syz_ring)
716  {
717  s_h1=idrCopyR_NoSort(h1,orig_ring, syz_ring);
718  }
719  else
720  {
721  s_h1 = h1;
722  }
723 
724  ideal s_h3=kStd(s_h1,NULL,testHomog,&w,NULL,k);
725 
726  if (s_h3==NULL)
727  {
728  return idFreeModule(IDELEMS(h1));
729  }
730 
731  if (orig_ring != syz_ring)
732  {
733  idDelete(&s_h1);
734  idSkipZeroes(s_h3);
735  rChangeCurrRing(orig_ring);
736  s_h3 = idrMoveR_NoSort(s_h3, syz_ring, orig_ring);
737  rDelete(syz_ring);
738  idTest(s_h3);
739  return s_h3;
740  }
741 
742  idSkipZeroes(s_h3);
743  idTest(s_h3);
744  return s_h3;
745 }
#define TRUE
Definition: auxiliary.h:144
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2221
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
Definition: intvec.h:16
ideal idFreeModule(int i)
Definition: ideals.h:126
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4386
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rSetSyzComp(int k, const ring r)
Definition: ring.cc:4991
void rChangeCurrRing(ring r)
Definition: polys.cc:14
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
const CanonicalForm & w
Definition: facAbsFact.cc:55
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:206
void idDelete(ideal *h)
delete an ideal
Definition: ideals.h:31
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:262
#define idTest(id)
Definition: ideals.h:63
static int pCompare ( const poly  a,
const poly  b 
)
static

Definition at line 2613 of file ideals.cc.

2614 {
2615  int r = tCompare(a, b);
2616  if (r != 0) return(r);
2617 
2618  poly aa = a;
2619  poly bb = b;
2620  while (r == 0 && aa != NULL && bb != NULL)
2621  {
2622  pIter(aa);
2623  pIter(bb);
2624  r = tCompare(aa, bb);
2625  }
2626  return(r);
2627 }
const poly a
Definition: syzextra.cc:212
static int tCompare(const poly a, const poly b)
Definition: ideals.cc:2596
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
polyrec * poly
Definition: hilb.h:10
const poly b
Definition: syzextra.cc:213
int pCompare_qsort ( const void *  a,
const void *  b 
)

Definition at line 2635 of file ideals.cc.

2636 {
2637  int res = pCompare(((poly_sort *)a)->p, ((poly_sort *)b)->p);
2638  return(res);
2639 }
const poly a
Definition: syzextra.cc:212
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
static int pCompare(const poly a, const poly b)
Definition: ideals.cc:2613
const poly b
Definition: syzextra.cc:213
static int tCompare ( const poly  a,
const poly  b 
)
static

Definition at line 2596 of file ideals.cc.

2597 {
2598  if (b == NULL) return(a != NULL);
2599  if (a == NULL) return(-1);
2600 
2601  /* a != NULL && b != NULL */
2602  int r = pLmCmp(a, b);
2603  if (r != 0) return(r);
2604  number h = nSub(pGetCoeff(a), pGetCoeff(b));
2605  r = -1 + nIsZero(h) + 2*nGreaterZero(h); /* -1: <, 0:==, 1: > */
2606  nDelete(&h);
2607  return(r);
2608 }
const poly a
Definition: syzextra.cc:212
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
const ring r
Definition: syzextra.cc:208
#define nGreaterZero(n)
Definition: numbers.h:27
#define nSub(n1, n2)
Definition: numbers.h:22
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
const poly b
Definition: syzextra.cc:213