My Project  UNKNOWN_GIT_VERSION
Functions
stairc.h File Reference
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "misc/intvec.h"

Go to the source code of this file.

Functions

void scComputeHC (ideal s, ideal Q, int k, poly &hEdge, ring tailRing=currRing)
 
intvecscIndIntvec (ideal S, ideal Q=NULL)
 
int scDimInt (ideal s, ideal Q=NULL)
 
int scMultInt (ideal s, ideal Q=NULL)
 
int scMult0Int (ideal s, ideal Q=NULL, const ring tailRing=currRing)
 
void scPrintDegree (int co, int mu)
 
void scDegree (ideal s, intvec *modulweight, ideal Q=NULL)
 
ideal scKBase (int deg, ideal s, ideal Q=NULL, intvec *mv=NULL)
 

Function Documentation

◆ scComputeHC()

void scComputeHC ( ideal  s,
ideal  Q,
int  k,
poly &  hEdge,
ring  tailRing = currRing 
)

Definition at line 1005 of file hdegree.cc.

1006 {
1007  id_TestTail(S, currRing, tailRing);
1008  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
1009 
1010  int i;
1011  int k = ak;
1012  #if HAVE_RINGS
1013  if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1))
1014  {
1015  //consider just monic generators (over rings with zero-divisors)
1016  ideal SS=id_Copy(S,tailRing);
1017  for(i=0;i<=idElem(S);i++)
1018  {
1019  if((SS->m[i]!=NULL)
1020  && ((p_IsPurePower(SS->m[i],tailRing)==0)
1021  ||(!n_IsUnit(pGetCoeff(SS->m[i]), tailRing->cf))))
1022  {
1023  p_Delete(&SS->m[i],tailRing);
1024  }
1025  }
1026  S=id_Copy(SS,tailRing);
1027  idSkipZeroes(S);
1028  }
1029  #if 0
1030  printf("\nThis is HC:\n");
1031  for(int ii=0;ii<=idElem(S);ii++)
1032  {
1033  pWrite(S->m[ii]);
1034  }
1035  //getchar();
1036  #endif
1037  #endif
1038  if(idElem(S) == 0)
1039  return;
1040  hNvar = (currRing->N);
1041  hexist = hInit(S, Q, &hNexist, tailRing); // tailRing?
1042  if (k!=0)
1043  hComp(hexist, hNexist, k, hexist, &hNstc);
1044  else
1045  hNstc = hNexist;
1046  assume(hNexist > 0);
1047  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1048  hvar = (varset)omAlloc((hNvar + 1) * sizeof(int));
1049  hpure = (scmon)omAlloc((1 + (hNvar * hNvar)) * sizeof(int));
1050  stcmem = hCreate(hNvar - 1);
1051  for (i = hNvar; i>0; i--)
1052  hvar[i] = i;
1054  if ((hNvar > 2) && (hNstc > 10))
1056  memset(hpure, 0, (hNvar + 1) * sizeof(int));
1057  hPure(hexist, 0, &hNstc, hvar, hNvar, hpure, &hNpure);
1058  hLexS(hexist, hNstc, hvar, hNvar);
1059  if (hEdge!=NULL)
1060  pLmFree(hEdge);
1061  hEdge = pInit();
1062  pWork = pInit();
1063  hHedgeStep(hpure, hexist, hNstc, hvar, hNvar,hEdge);
1064  pSetComp(hEdge,ak);
1065  hKill(stcmem, hNvar - 1);
1066  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1067  omFreeSize((ADDRESS)hvar, (hNvar + 1) * sizeof(int));
1068  omFreeSize((ADDRESS)hpure, (1 + (hNvar * hNvar)) * sizeof(int));
1070  pLmFree(pWork);
1071 }

◆ scDegree()

void scDegree ( ideal  s,
intvec modulweight,
ideal  Q = NULL 
)

Definition at line 822 of file hdegree.cc.

823 {
824  id_Test(S, currRing);
825  if( Q!=NULL ) id_Test(Q, currRing);
826 
827  int co, mu, l;
828  intvec *hseries2;
829  intvec *hseries1 = hFirstSeries(S, modulweight, Q);
830  l = hseries1->length()-1;
831  if (l > 1)
832  hseries2 = hSecondSeries(hseries1);
833  else
834  hseries2 = hseries1;
835  hDegreeSeries(hseries1, hseries2, &co, &mu);
836  if ((l == 1) &&(mu == 0))
837  scPrintDegree((currRing->N)+1, 0);
838  else
839  scPrintDegree(co, mu);
840  if (l>1)
841  delete hseries1;
842  delete hseries2;
843 }

◆ scDimInt()

int scDimInt ( ideal  s,
ideal  Q = NULL 
)

Definition at line 72 of file hdegree.cc.

73 {
74  id_Test(S, currRing);
75  if( Q!=NULL ) id_Test(Q, currRing);
76 
77  int mc;
78  hexist = hInit(S, Q, &hNexist, currRing);
79  if (!hNexist)
80  return (currRing->N);
81  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
82  hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
83  hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
84  mc = hisModule;
85  if (!mc)
86  {
87  hrad = hexist;
88  hNrad = hNexist;
89  }
90  else
91  hrad = (scfmon)omAlloc(hNexist * sizeof(scmon));
92  radmem = hCreate((currRing->N) - 1);
93  hCo = (currRing->N) + 1;
94  loop
95  {
96  if (mc)
97  hComp(hexist, hNexist, mc, hrad, &hNrad);
98  if (hNrad)
99  {
100  hNvar = (currRing->N);
101  hRadical(hrad, &hNrad, hNvar);
102  hSupp(hrad, hNrad, hvar, &hNvar);
103  if (hNvar)
104  {
105  memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
106  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
107  hLexR(hrad, hNrad, hvar, hNvar);
109  }
110  }
111  else
112  {
113  hCo = 0;
114  break;
115  }
116  mc--;
117  if (mc <= 0)
118  break;
119  }
120  hKill(radmem, (currRing->N) - 1);
121  omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
122  omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
123  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
125  if (hisModule)
126  omFreeSize((ADDRESS)hrad, hNexist * sizeof(scmon));
127  return (currRing->N) - hCo;
128 }

◆ scIndIntvec()

intvec* scIndIntvec ( ideal  S,
ideal  Q = NULL 
)

Definition at line 212 of file hdegree.cc.

213 {
214  id_Test(S, currRing);
215  if( Q!=NULL ) id_Test(Q, currRing);
216 
217  intvec *Set=new intvec((currRing->N));
218  int mc,i;
219  hexist = hInit(S, Q, &hNexist, currRing);
220  if (hNexist==0)
221  {
222  for(i=0; i<(currRing->N); i++)
223  (*Set)[i]=1;
224  return Set;
225  }
226  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
227  hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
228  hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
229  hInd = (scmon)omAlloc0((1 + (currRing->N)) * sizeof(int));
230  mc = hisModule;
231  if (mc==0)
232  {
233  hrad = hexist;
234  hNrad = hNexist;
235  }
236  else
237  hrad = (scfmon)omAlloc(hNexist * sizeof(scmon));
238  radmem = hCreate((currRing->N) - 1);
239  hCo = (currRing->N) + 1;
240  loop
241  {
242  if (mc!=0)
243  hComp(hexist, hNexist, mc, hrad, &hNrad);
244  if (hNrad!=0)
245  {
246  hNvar = (currRing->N);
247  hRadical(hrad, &hNrad, hNvar);
248  hSupp(hrad, hNrad, hvar, &hNvar);
249  if (hNvar!=0)
250  {
251  memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
252  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
253  hLexR(hrad, hNrad, hvar, hNvar);
255  }
256  }
257  else
258  {
259  hCo = 0;
260  break;
261  }
262  mc--;
263  if (mc <= 0)
264  break;
265  }
266  for(i=0; i<(currRing->N); i++)
267  (*Set)[i] = hInd[i+1];
268  hKill(radmem, (currRing->N) - 1);
269  omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
270  omFreeSize((ADDRESS)hInd, (1 + (currRing->N)) * sizeof(int));
271  omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
272  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
274  if (hisModule)
275  omFreeSize((ADDRESS)hrad, hNexist * sizeof(scmon));
276  return Set;
277 }

◆ scKBase()

ideal scKBase ( int  deg,
ideal  s,
ideal  Q = NULL,
intvec mv = NULL 
)

Definition at line 1353 of file hdegree.cc.

1354 {
1355  if( Q!=NULL) id_Test(Q, currRing);
1356 
1357  int i, di;
1358  poly p;
1359 
1360  if (deg < 0)
1361  {
1362  di = scDimInt(s, Q);
1363  if (di != 0)
1364  {
1365  //Werror("KBase not finite");
1366  return idInit(1,s->rank);
1367  }
1368  }
1369  stcmem = hCreate((currRing->N) - 1);
1370  hexist = hInit(s, Q, &hNexist, currRing);
1371  p = last = pInit();
1372  /*pNext(p) = NULL;*/
1373  act = (scmon)omAlloc(((currRing->N) + 1) * sizeof(int));
1374  *act = 0;
1375  if (!hNexist)
1376  {
1377  scAll((currRing->N), deg);
1378  goto ende;
1379  }
1380  if (!hisModule)
1381  {
1382  if (deg < 0) scInKbase(hexist, hNexist, (currRing->N));
1383  else scDegKbase(hexist, hNexist, (currRing->N), deg);
1384  }
1385  else
1386  {
1387  hstc = (scfmon)omAlloc(hNexist * sizeof(scmon));
1388  for (i = 1; i <= hisModule; i++)
1389  {
1390  *act = i;
1391  hComp(hexist, hNexist, i, hstc, &hNstc);
1392  int deg_ei=deg;
1393  if (mv!=NULL) deg_ei -= (*mv)[i-1];
1394  if ((deg < 0) || (deg_ei>=0))
1395  {
1396  if (hNstc)
1397  {
1398  if (deg < 0) scInKbase(hstc, hNstc, (currRing->N));
1399  else scDegKbase(hstc, hNstc, (currRing->N), deg_ei);
1400  }
1401  else
1402  scAll((currRing->N), deg_ei);
1403  }
1404  }
1405  omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon));
1406  }
1407 ende:
1409  omFreeSize((ADDRESS)act, ((currRing->N) + 1) * sizeof(int));
1410  hKill(stcmem, (currRing->N) - 1);
1411  pLmFree(&p);
1412  if (p == NULL)
1413  return idInit(1,s->rank);
1414 
1415  last = p;
1416  return scIdKbase(p, s->rank);
1417 }

◆ scMult0Int()

int scMult0Int ( ideal  s,
ideal  Q = NULL,
const ring  tailRing = currRing 
)

Definition at line 919 of file hdegree.cc.

920 {
921  id_TestTail(S, currRing, tailRing);
922  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
923 
924  hDegree0(S, Q, tailRing);
925  return hMu;
926 }

◆ scMultInt()

int scMultInt ( ideal  s,
ideal  Q = NULL 
)

Definition at line 799 of file hdegree.cc.

800 {
801  id_Test(S, currRing);
802  if( Q!=NULL ) id_Test(Q, currRing);
803 
804  hDegree(S, Q);
805  return hMu;
806 }

◆ scPrintDegree()

void scPrintDegree ( int  co,
int  mu 
)

Definition at line 808 of file hdegree.cc.

809 {
810  int di = (currRing->N)-co;
811  if (currRing->OrdSgn == 1)
812  {
813  if (di>0)
814  Print("// dimension (proj.) = %d\n// degree (proj.) = %d\n", di-1, mu);
815  else
816  Print("// dimension (affine) = 0\n// degree (affine) = %d\n", mu);
817  }
818  else
819  Print("// dimension (local) = %d\n// multiplicity = %d\n", di, mu);
820 }
hStaircase
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
Definition: hutil.cc:318
idElem
int idElem(const ideal F)
count non-zero elements
Definition: simpleideals.cc:209
k
int k
Definition: cfEzgcd.cc:92
pLmFree
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:68
hHedgeStep
static void hHedgeStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, poly hEdge)
Definition: hdegree.cc:945
hIndSolve
static void hIndSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:133
ADDRESS
void * ADDRESS
Definition: auxiliary.h:133
hRadical
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:416
hMu
int hMu
Definition: hdegree.cc:22
hNrad
int hNrad
Definition: hutil.cc:21
scIdKbase
static ideal scIdKbase(poly q, const int rank)
Definition: hdegree.cc:1335
scInKbase
static void scInKbase(scfmon stc, int Nstc, int Nvar)
Definition: hdegree.cc:1279
hDimSolve
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
hexist
scfmon hexist
Definition: hutil.cc:18
scfmon
scmon * scfmon
Definition: hutil.h:14
loop
#define loop
Definition: structs.h:77
pSetComp
#define pSetComp(p, v)
Definition: polys.h:37
scDimInt
int scDimInt(ideal S, ideal Q)
Definition: hdegree.cc:72
mu
void mu(int **points, int sizePoints)
Definition: cfNewtonPolygon.cc:467
hNexist
int hNexist
Definition: hutil.cc:21
scAll
static void scAll(int Nvar, int deg)
Definition: hdegree.cc:1164
currRing
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
hInd
static scmon hInd
Definition: hdegree.cc:131
i
int i
Definition: cfEzgcd.cc:125
act
static scmon act
Definition: hdegree.cc:1078
hpure
scmon hpure
Definition: hutil.cc:19
omFreeSize
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:258
hwork
scfmon hwork
Definition: hutil.cc:18
hvar
varset hvar
Definition: hutil.cc:20
hDegree0
static void hDegree0(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:845
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition: simpleideals.cc:171
rField_is_Ring
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:474
hrad
scfmon hrad
Definition: hutil.cc:18
hComp
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
Definition: hutil.cc:159
hKill
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1015
pInit
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:59
intvec
Definition: intvec.h:16
omAlloc
#define omAlloc(size)
Definition: omAllocDecl.h:208
hDelete
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:145
hCo
int hCo
Definition: hdegree.cc:22
scmon
int * scmon
Definition: hutil.h:13
scDegKbase
static void scDegKbase(scfmon stc, int Nstc, int Nvar, int deg)
Definition: hdegree.cc:1198
stcmem
monf stcmem
Definition: hutil.cc:23
last
static poly last
Definition: hdegree.cc:1077
hNpure
int hNpure
Definition: hutil.cc:21
hSecondSeries
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1346
hPure
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:626
hstc
scfmon hstc
Definition: hutil.cc:18
p_IsPurePower
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1215
varset
int * varset
Definition: hutil.h:15
p_Delete
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
hInit
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:33
hFirstSeries
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1336
hNvar
int hNvar
Definition: hutil.cc:21
hDegree
static void hDegree(ideal S, ideal Q)
Definition: hdegree.cc:698
hOrdSupp
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:207
Print
#define Print
Definition: emacs.cc:79
hSupp
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:179
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:36
id_TestTail
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:78
assume
#define assume(x)
Definition: mod2.h:384
hisModule
int hisModule
Definition: hutil.cc:22
NULL
#define NULL
Definition: omList.c:9
pWork
static poly pWork
Definition: hdegree.cc:931
l
int l
Definition: cfEzgcd.cc:93
p
int p
Definition: cfModGcd.cc:4019
s
const CanonicalForm int s
Definition: facAbsFact.cc:55
hDegreeSeries
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
Definition: hilb.cc:1381
Q
#define Q
Definition: sirandom.c:25
id_Copy
ideal id_Copy(ideal h1, const ring r)
copy an ideal
Definition: simpleideals.cc:403
radmem
monf radmem
Definition: hutil.cc:23
pGetCoeff
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:42
hNstc
int hNstc
Definition: hutil.cc:21
intvec::length
int length() const
Definition: intvec.h:92
scPrintDegree
void scPrintDegree(int co, int mu)
Definition: hdegree.cc:808
id_Test
#define id_Test(A, lR)
Definition: simpleideals.h:79
hLexR
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:570
n_IsUnit
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:514
omAlloc0
#define omAlloc0(size)
Definition: omAllocDecl.h:209
hLexS
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:511
hCreate
monf hCreate(int Nvar)
Definition: hutil.cc:1001
pWrite
void pWrite(poly p)
Definition: polys.h:290