My Project  debian-1:4.1.2-p1+ds-2
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 1004 of file hdegree.cc.

1005 {
1006  id_TestTail(S, currRing, tailRing);
1007  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
1008 
1009  int i;
1010  int k = ak;
1011  #if HAVE_RINGS
1012  if (rField_is_Ring(currRing) && (currRing->OrdSgn == -1))
1013  {
1014  //consider just monic generators (over rings with zero-divisors)
1015  ideal SS=id_Copy(S,tailRing);
1016  for(i=0;i<=idElem(S);i++)
1017  {
1018  if((SS->m[i]!=NULL)
1019  && ((p_IsPurePower(SS->m[i],tailRing)==0)
1020  ||(!n_IsUnit(pGetCoeff(SS->m[i]), tailRing->cf))))
1021  {
1022  p_Delete(&SS->m[i],tailRing);
1023  }
1024  }
1025  S=id_Copy(SS,tailRing);
1026  idSkipZeroes(S);
1027  }
1028  #if 0
1029  printf("\nThis is HC:\n");
1030  for(int ii=0;ii<=idElem(S);ii++)
1031  {
1032  pWrite(S->m[ii]);
1033  }
1034  //getchar();
1035  #endif
1036  #endif
1037  if(idElem(S) == 0)
1038  return;
1039  hNvar = (currRing->N);
1040  hexist = hInit(S, Q, &hNexist, tailRing); // tailRing?
1041  if (k!=0)
1042  hComp(hexist, hNexist, k, hexist, &hNstc);
1043  else
1044  hNstc = hNexist;
1045  assume(hNexist > 0);
1046  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1047  hvar = (varset)omAlloc((hNvar + 1) * sizeof(int));
1048  hpure = (scmon)omAlloc((1 + (hNvar * hNvar)) * sizeof(int));
1049  stcmem = hCreate(hNvar - 1);
1050  for (i = hNvar; i>0; i--)
1051  hvar[i] = i;
1053  if ((hNvar > 2) && (hNstc > 10))
1055  memset(hpure, 0, (hNvar + 1) * sizeof(int));
1056  hPure(hexist, 0, &hNstc, hvar, hNvar, hpure, &hNpure);
1057  hLexS(hexist, hNstc, hvar, hNvar);
1058  if (hEdge!=NULL)
1059  pLmFree(hEdge);
1060  hEdge = pInit();
1061  pWork = pInit();
1062  hHedgeStep(hpure, hexist, hNstc, hvar, hNvar,hEdge);
1063  pSetComp(hEdge,ak);
1064  hKill(stcmem, hNvar - 1);
1065  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1066  omFreeSize((ADDRESS)hvar, (hNvar + 1) * sizeof(int));
1067  omFreeSize((ADDRESS)hpure, (1 + (hNvar * hNvar)) * sizeof(int));
1069  pLmFree(pWork);
1070 }
void * ADDRESS
Definition: auxiliary.h:135
int i
Definition: cfEzgcd.cc:125
int k
Definition: cfEzgcd.cc:92
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:515
static void hHedgeStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, poly hEdge)
Definition: hdegree.cc:944
STATIC_VAR poly pWork
Definition: hdegree.cc:930
monf hCreate(int Nvar)
Definition: hutil.cc:999
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
Definition: hutil.cc:157
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:31
VAR varset hvar
Definition: hutil.cc:18
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1013
VAR int hNexist
Definition: hutil.cc:19
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:509
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:143
VAR monf stcmem
Definition: hutil.cc:21
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:624
VAR scfmon hwork
Definition: hutil.cc:16
VAR scmon hpure
Definition: hutil.cc:17
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
Definition: hutil.cc:316
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:205
VAR int hNpure
Definition: hutil.cc:19
VAR scfmon hexist
Definition: hutil.cc:16
VAR int hNstc
Definition: hutil.cc:19
VAR int hNvar
Definition: hutil.cc:19
scmon * scfmon
Definition: hutil.h:15
int * varset
Definition: hutil.h:16
int * scmon
Definition: hutil.h:14
ideal id_Copy(ideal h1, const ring r)
copy an ideal
STATIC_VAR jList * Q
Definition: janet.cc:30
#define assume(x)
Definition: mod2.h:390
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1216
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pSetComp(p, v)
Definition: polys.h:38
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:70
void pWrite(poly p)
Definition: polys.h:304
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int idElem(const ideal F)
count non-zero elements
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:78

◆ scDegree()

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

Definition at line 821 of file hdegree.cc.

822 {
823  id_Test(S, currRing);
824  if( Q!=NULL ) id_Test(Q, currRing);
825 
826  int co, mu, l;
827  intvec *hseries2;
828  intvec *hseries1 = hFirstSeries(S, modulweight, Q);
829  l = hseries1->length()-1;
830  if (l > 1)
831  hseries2 = hSecondSeries(hseries1);
832  else
833  hseries2 = hseries1;
834  hDegreeSeries(hseries1, hseries2, &co, &mu);
835  if ((l == 1) &&(mu == 0))
836  scPrintDegree((currRing->N)+1, 0);
837  else
838  scPrintDegree(co, mu);
839  if (l>1)
840  delete hseries1;
841  delete hseries2;
842 }
int l
Definition: cfEzgcd.cc:93
void mu(int **points, int sizePoints)
Definition: intvec.h:23
int length() const
Definition: intvec.h:94
void scPrintDegree(int co, int mu)
Definition: hdegree.cc:807
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
Definition: hilb.cc:1380
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1345
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1335
#define id_Test(A, lR)
Definition: simpleideals.h:79

◆ scDimInt()

int scDimInt ( ideal  s,
ideal  Q = NULL 
)

Definition at line 71 of file hdegree.cc.

72 {
73  id_Test(S, currRing);
74  if( Q!=NULL ) id_Test(Q, currRing);
75 
76  int mc;
77  hexist = hInit(S, Q, &hNexist, currRing);
78  if (!hNexist)
79  return (currRing->N);
80  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
81  hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
82  hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
83  mc = hisModule;
84  if (!mc)
85  {
86  hrad = hexist;
87  hNrad = hNexist;
88  }
89  else
90  hrad = (scfmon)omAlloc(hNexist * sizeof(scmon));
91  radmem = hCreate((currRing->N) - 1);
92  hCo = (currRing->N) + 1;
93  loop
94  {
95  if (mc)
96  hComp(hexist, hNexist, mc, hrad, &hNrad);
97  if (hNrad)
98  {
99  hNvar = (currRing->N);
100  hRadical(hrad, &hNrad, hNvar);
101  hSupp(hrad, hNrad, hvar, &hNvar);
102  if (hNvar)
103  {
104  memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
105  hPure(hrad, 0, &hNrad, hvar, hNvar, hpure, &hNpure);
106  hLexR(hrad, hNrad, hvar, hNvar);
108  }
109  }
110  else
111  {
112  hCo = 0;
113  break;
114  }
115  mc--;
116  if (mc <= 0)
117  break;
118  }
119  hKill(radmem, (currRing->N) - 1);
120  omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
121  omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
122  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
124  if (hisModule)
125  omFreeSize((ADDRESS)hrad, hNexist * sizeof(scmon));
126  return (currRing->N) - hCo;
127 }
VAR int hCo
Definition: hdegree.cc:21
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:28
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:177
void hLexR(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hutil.cc:568
VAR scfmon hrad
Definition: hutil.cc:16
VAR int hisModule
Definition: hutil.cc:20
VAR monf radmem
Definition: hutil.cc:21
VAR int hNrad
Definition: hutil.cc:19
void hRadical(scfmon rad, int *Nrad, int Nvar)
Definition: hutil.cc:414
#define loop
Definition: structs.h:80

◆ scIndIntvec()

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

Definition at line 211 of file hdegree.cc.

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

◆ scKBase()

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

Definition at line 1352 of file hdegree.cc.

1353 {
1354  if( Q!=NULL) id_Test(Q, currRing);
1355 
1356  int i, di;
1357  poly p;
1358 
1359  if (deg < 0)
1360  {
1361  di = scDimInt(s, Q);
1362  if (di != 0)
1363  {
1364  //Werror("KBase not finite");
1365  return idInit(1,s->rank);
1366  }
1367  }
1368  stcmem = hCreate((currRing->N) - 1);
1369  hexist = hInit(s, Q, &hNexist, currRing);
1370  p = last = pInit();
1371  /*pNext(p) = NULL;*/
1372  act = (scmon)omAlloc(((currRing->N) + 1) * sizeof(int));
1373  *act = 0;
1374  if (!hNexist)
1375  {
1376  scAll((currRing->N), deg);
1377  goto ende;
1378  }
1379  if (!hisModule)
1380  {
1381  if (deg < 0) scInKbase(hexist, hNexist, (currRing->N));
1382  else scDegKbase(hexist, hNexist, (currRing->N), deg);
1383  }
1384  else
1385  {
1386  hstc = (scfmon)omAlloc(hNexist * sizeof(scmon));
1387  for (i = 1; i <= hisModule; i++)
1388  {
1389  *act = i;
1390  hComp(hexist, hNexist, i, hstc, &hNstc);
1391  int deg_ei=deg;
1392  if (mv!=NULL) deg_ei -= (*mv)[i-1];
1393  if ((deg < 0) || (deg_ei>=0))
1394  {
1395  if (hNstc)
1396  {
1397  if (deg < 0) scInKbase(hstc, hNstc, (currRing->N));
1398  else scDegKbase(hstc, hNstc, (currRing->N), deg_ei);
1399  }
1400  else
1401  scAll((currRing->N), deg_ei);
1402  }
1403  }
1404  omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon));
1405  }
1406 ende:
1408  omFreeSize((ADDRESS)act, ((currRing->N) + 1) * sizeof(int));
1409  hKill(stcmem, (currRing->N) - 1);
1410  pLmFree(&p);
1411  if (p == NULL)
1412  return idInit(1,s->rank);
1413 
1414  last = p;
1415  return scIdKbase(p, s->rank);
1416 }
int p
Definition: cfModGcd.cc:4019
const CanonicalForm int s
Definition: facAbsFact.cc:55
STATIC_VAR poly last
Definition: hdegree.cc:1076
static void scAll(int Nvar, int deg)
Definition: hdegree.cc:1163
static void scDegKbase(scfmon stc, int Nstc, int Nvar, int deg)
Definition: hdegree.cc:1197
STATIC_VAR scmon act
Definition: hdegree.cc:1077
static ideal scIdKbase(poly q, const int rank)
Definition: hdegree.cc:1334
static void scInKbase(scfmon stc, int Nstc, int Nvar)
Definition: hdegree.cc:1278
int scDimInt(ideal S, ideal Q)
Definition: hdegree.cc:71
VAR scfmon hstc
Definition: hutil.cc:16
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35

◆ scMult0Int()

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

Definition at line 918 of file hdegree.cc.

919 {
920  id_TestTail(S, currRing, tailRing);
921  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
922 
923  hDegree0(S, Q, tailRing);
924  return hMu;
925 }
VAR int hMu
Definition: hdegree.cc:21
static void hDegree0(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:844

◆ scMultInt()

int scMultInt ( ideal  s,
ideal  Q = NULL 
)

Definition at line 798 of file hdegree.cc.

799 {
800  id_Test(S, currRing);
801  if( Q!=NULL ) id_Test(Q, currRing);
802 
803  hDegree(S, Q);
804  return hMu;
805 }
static void hDegree(ideal S, ideal Q)
Definition: hdegree.cc:697

◆ scPrintDegree()

void scPrintDegree ( int  co,
int  mu 
)

Definition at line 807 of file hdegree.cc.

808 {
809  int di = (currRing->N)-co;
810  if (currRing->OrdSgn == 1)
811  {
812  if (di>0)
813  Print("// dimension (proj.) = %d\n// degree (proj.) = %d\n", di-1, mu);
814  else
815  Print("// dimension (affine) = 0\n// degree (affine) = %d\n", mu);
816  }
817  else
818  Print("// dimension (local) = %d\n// multiplicity = %d\n", di, mu);
819 }
#define Print
Definition: emacs.cc:80