Data Structures | Macros | Typedefs | Functions | Variables
hutil.h File Reference

Go to the source code of this file.

Data Structures

struct  monh
 
struct  indlist
 

Macros

#define LEN_MON   (sizeof(scfmon) + sizeof(int))
 

Typedefs

typedef polyrec * poly
 
typedef polypolyset
 
typedef int * scmon
 
typedef scmonscfmon
 
typedef int * varset
 
typedef monh * monp
 
typedef monpmonf
 
typedef indlist * indset
 

Functions

void hDelete (scfmon ev, int ev_length)
 
void hComp (scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
 
void hSupp (scfmon stc, int Nstc, varset var, int *Nvar)
 
void hOrdSupp (scfmon stc, int Nstc, varset var, int Nvar)
 
void hStaircase (scfmon stc, int *Nstc, varset var, int Nvar)
 
void hRadical (scfmon rad, int *Nrad, int Nvar)
 
void hLexS (scfmon stc, int Nstc, varset var, int Nvar)
 
void hLexR (scfmon rad, int Nrad, varset var, int Nvar)
 
void hPure (scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
 
void hElimS (scfmon stc, int *e1, int a2, int e2, varset var, int Nvar)
 
void hElimR (scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
 
void hLex2S (scfmon stc, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
 
void hLex2R (scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
 
void hStepS (scfmon stc, int Nstc, varset var, int Nvar, int *a, int *x)
 
void hStepR (scfmon rad, int Nrad, varset var, int Nvar, int *a)
 
monf hCreate (int Nvar)
 
void hKill (monf xmem, int Nvar)
 
scfmon hGetmem (int lm, scfmon old, monp monmem)
 
scmon hGetpure (scmon p)
 
void hDimSolve (scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
 
void hIndMult (scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
 
void hIndAllMult (scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
 
void hDegreeSeries (intvec *s1, intvec *s2, int *co, int *mu)
 
scfmon hInit (ideal S, ideal Q, int *Nexist, ring tailRing)
 
void slicehilb (ideal I)
 
void HilbertSeries_OrbitData (ideal S, int lV, bool ig, bool mgrad, bool odp)
 

Variables

omBin indlist_bin
 
scfmon hexist
 
scfmon hstc
 
scfmon hrad
 
scfmon hwork
 
scmon hpure
 
scmon hpur0
 
varset hvar
 
varset hsel
 
int hNexist
 
int hNstc
 
int hNrad
 
int hNvar
 
int hNpure
 
monf stcmem
 
monf radmem
 
int hisModule
 
indset ISet
 
indset JSet
 
int hCo
 
int hMu
 
int hMu2
 

Data Structure Documentation

◆ monrec

struct monrec

Definition at line 24 of file hutil.h.

Data Fields
int a
scfmon mo

◆ sindlist

struct sindlist

Definition at line 32 of file hutil.h.

Data Fields
indset nx
intvec * set

Macro Definition Documentation

◆ LEN_MON

#define LEN_MON   (sizeof(scfmon) + sizeof(int))

Definition at line 38 of file hutil.h.

Typedef Documentation

◆ indset

typedef indlist* indset

Definition at line 31 of file hutil.h.

◆ monf

typedef monp* monf

Definition at line 23 of file hutil.h.

◆ monp

typedef monh* monp

Definition at line 22 of file hutil.h.

◆ poly

typedef polyrec* poly

Definition at line 14 of file hutil.h.

◆ polyset

typedef poly* polyset

Definition at line 15 of file hutil.h.

◆ scfmon

typedef scmon* scfmon

Definition at line 18 of file hutil.h.

◆ scmon

typedef int* scmon

Definition at line 17 of file hutil.h.

◆ varset

typedef int* varset

Definition at line 19 of file hutil.h.

Function Documentation

◆ hComp()

void hComp ( scfmon  exist,
int  Nexist,
int  ak,
scfmon  stc,
int *  Nstc 
)

Definition at line 160 of file hutil.cc.

161 {
162  int k = 0;
163  scfmon ex = exist, co = stc;
164  int i;
165 
166  for (i = Nexist; i>0; i--)
167  {
168  if (((**ex) == 0) || ((**ex) == ak))
169  {
170  *co = *ex;
171  co++;
172  k++;
173  }
174  ex++;
175  }
176  *Nstc = k;
177 }
scmon * scfmon
Definition: hutil.h:18
int k
Definition: cfEzgcd.cc:93
int i
Definition: cfEzgcd.cc:123
strat ak
Definition: myNF.cc:321

◆ hCreate()

monf hCreate ( int  Nvar)

Definition at line 1002 of file hutil.cc.

1003 {
1004  monf xmem;
1005  int i;
1006  xmem = (monf)omAlloc((Nvar + 1) * sizeof(monp));
1007  for (i = Nvar; i>0; i--)
1008  {
1009  xmem[i] = (monp)omAlloc(LEN_MON);
1010  xmem[i]->mo = NULL;
1011  }
1012  return xmem;
1013 }
monp * monf
Definition: hutil.h:23
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define LEN_MON
Definition: hutil.h:38
monh * monp
Definition: hutil.h:22
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hDegreeSeries()

void hDegreeSeries ( intvec s1,
intvec s2,
int *  co,
int *  mu 
)

Definition at line 1351 of file hilb.cc.

1352 {
1353  int m, i, j, k;
1354  *co = *mu = 0;
1355  if ((s1 == NULL) || (s2 == NULL))
1356  return;
1357  i = s1->length();
1358  j = s2->length();
1359  if (j > i)
1360  return;
1361  m = 0;
1362  for(k=j-2; k>=0; k--)
1363  m += (*s2)[k];
1364  *mu = m;
1365  *co = i - j;
1366 }
void mu(int **points, int sizePoints)
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:86

◆ hDelete()

void hDelete ( scfmon  ev,
int  ev_length 
)

Definition at line 146 of file hutil.cc.

147 {
148  int i;
149 
150  if (ev_length>0)
151  {
152  for (i=ev_length-1;i>=0;i--)
153  omFreeSize(hsecure[i],((currRing->N)+1)*sizeof(int));
154  omFreeSize(hsecure, ev_length*sizeof(scmon));
155  omFreeSize(ev, ev_length*sizeof(scmon));
156  }
157 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static scfmon hsecure
Definition: hutil.cc:32
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123

◆ hDimSolve()

void hDimSolve ( scmon  pure,
int  Npure,
scfmon  rad,
int  Nrad,
varset  var,
int  Nvar 
)

Definition at line 29 of file hdegree.cc.

31 {
32  int dn, iv, rad0, b, c, x;
33  scmon pn;
34  scfmon rn;
35  if (Nrad < 2)
36  {
37  dn = Npure + Nrad;
38  if (dn < hCo)
39  hCo = dn;
40  return;
41  }
42  if (Npure+1 >= hCo)
43  return;
44  iv = Nvar;
45  while(pure[var[iv]]) iv--;
46  hStepR(rad, Nrad, var, iv, &rad0);
47  if (rad0!=0)
48  {
49  iv--;
50  if (rad0 < Nrad)
51  {
52  pn = hGetpure(pure);
53  rn = hGetmem(Nrad, rad, radmem[iv]);
54  hDimSolve(pn, Npure + 1, rn, rad0, var, iv);
55  b = rad0;
56  c = Nrad;
57  hElimR(rn, &rad0, b, c, var, iv);
58  hPure(rn, b, &c, var, iv, pn, &x);
59  hLex2R(rn, rad0, b, c, var, iv, hwork);
60  rad0 += (c - b);
61  hDimSolve(pn, Npure + x, rn, rad0, var, iv);
62  }
63  else
64  {
65  hDimSolve(pure, Npure, rad, Nrad, var, iv);
66  }
67  }
68  else
69  hCo = Npure + 1;
70 }
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:29
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:748
scfmon hwork
Definition: hutil.cc:19
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1029
int hCo
Definition: hdegree.cc:22
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
scmon * scfmon
Definition: hutil.h:18
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:980
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
int * scmon
Definition: hutil.h:17
void hLex2R(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition: hutil.cc:886
monf radmem
Definition: hutil.cc:24
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

◆ hElimR()

void hElimR ( scfmon  rad,
int *  e1,
int  a2,
int  e2,
varset  var,
int  Nvar 
)

Definition at line 748 of file hutil.cc.

749 {
750  int nc = *e1, z = 0, i, j, k, k1;
751  scmon n, o;
752  if (!nc || (a2 == e2))
753  return;
754  j = 0;
755  i = a2;
756  o = rad[i];
757  n = rad[0];
758  k = Nvar;
759  loop
760  {
761  k1 = var[k];
762  if (o[k1] && !n[k1])
763  {
764  k = Nvar;
765  i++;
766  if (i < e2)
767  o = rad[i];
768  else
769  {
770  j++;
771  if (j < nc)
772  {
773  i = a2;
774  o = rad[i];
775  n = rad[j];
776  }
777  else
778  {
779  if (z!=0)
780  {
781  *e1 -= z;
782  hShrink(rad, 0, nc);
783  }
784  return;
785  }
786  }
787  }
788  else
789  {
790  k--;
791  if (!k)
792  {
793  rad[j] = NULL;
794  z++;
795  j++;
796  if (j < nc)
797  {
798  i = a2;
799  o = rad[i];
800  n = rad[j];
801  k = Nvar;
802  }
803  else
804  {
805  if (z!=0)
806  {
807  *e1 -= z;
808  hShrink(rad, 0, nc);
809  }
810  return;
811  }
812  }
813  }
814  }
815 }
loop
Definition: myNF.cc:98
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hElimS()

void hElimS ( scfmon  stc,
int *  e1,
int  a2,
int  e2,
varset  var,
int  Nvar 
)

Definition at line 678 of file hutil.cc.

679 {
680  int nc = *e1, z = 0, i, j, k, k1;
681  scmon n, o;
682  if (!nc || (a2 == e2))
683  return;
684  j = 0;
685  i = a2;
686  o = stc[i];
687  n = stc[0];
688  k = Nvar;
689  loop
690  {
691  k1 = var[k];
692  if (o[k1] > n[k1])
693  {
694  k = Nvar;
695  i++;
696  if (i < e2)
697  o = stc[i];
698  else
699  {
700  j++;
701  if (j < nc)
702  {
703  i = a2;
704  o = stc[i];
705  n = stc[j];
706  }
707  else
708  {
709  if (z!=0)
710  {
711  *e1 -= z;
712  hShrink(stc, 0, nc);
713  }
714  return;
715  }
716  }
717  }
718  else
719  {
720  k--;
721  if (k==0)
722  {
723  stc[j] = NULL;
724  z++;
725  j++;
726  if (j < nc)
727  {
728  i = a2;
729  o = stc[i];
730  n = stc[j];
731  k = Nvar;
732  }
733  else
734  {
735  if (z!=0)
736  {
737  *e1 -= z;
738  hShrink(stc, 0, nc);
739  }
740  return;
741  }
742  }
743  }
744  }
745 }
loop
Definition: myNF.cc:98
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hGetmem()

scfmon hGetmem ( int  lm,
scfmon  old,
monp  monmem 
)

Definition at line 1029 of file hutil.cc.

1030 {
1031  scfmon x = monmem->mo;
1032  int lx = monmem->a;
1033  if ((x==NULL) || (lm > lx))
1034  {
1035  /* according to http://www.singular.uni-kl.de:8002/trac/ticket/463#comment:4
1036  * we need to work around a compiler bug:
1037  * if ((x!=NULL)&&(lx>0)) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1038  */
1039  if (x!=NULL) if (lx>0) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1040  monmem->mo = x = (scfmon)omAlloc(lm * sizeof(scmon));
1041  monmem->a = lm;
1042  }
1043  memcpy(x, old, lm * sizeof(scmon));
1044  return x;
1045 }
scmon * scfmon
Definition: hutil.h:18
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * scmon
Definition: hutil.h:17
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023

◆ hGetpure()

scmon hGetpure ( scmon  p)

Definition at line 1058 of file hutil.cc.

1059 {
1060  scmon p1 = p;
1061  scmon pn;
1062  p1++;
1063  pn = p1;
1064  pn += (currRing->N);
1065  memcpy(pn, p1, (currRing->N) * sizeof(int));
1066  return pn - 1;
1067 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int * scmon
Definition: hutil.h:17

◆ HilbertSeries_OrbitData()

void HilbertSeries_OrbitData ( ideal  S,
int  lV,
bool  ig,
bool  mgrad,
bool  odp 
)

Definition at line 1861 of file hilb.cc.

1862 {
1863  /*
1864  * It is based on iterative right colon operation to the
1865  * monomial ideals of the free associative algebras.
1866  * The algorithm terminates for the monomial right
1867  * ideals whose monomials define regular formal language,
1868  * that is, all the monomials of ideal can be obtained from
1869  * finite subsets by applying the finite number
1870  * of elementary operations.
1871  */
1872 
1873  int trInd;
1874  S = minimalMonomialsGenSet(S);
1875 
1876  int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int);
1877  if(IG_CASE)
1878  {
1879  if(idIs0(S))
1880  {
1881  WerrorS("wrong input:not the infinitely gen. case");
1882  return;
1883  }
1884  trInd = p_Totaldegree(S->m[IDELEMS(S)-1], currRing);
1885  POS = &positionInOrbit_IG_Case;
1886  }
1887  else
1888  {
1889  POS = &positionInOrbit_FG_Case;
1890  }
1891 
1892  std::vector<ideal > idorb;
1893  std::vector< poly > polist;
1894 
1895  ideal orb_init = idInit(1, 1);
1896  idorb.push_back(orb_init);
1897 
1898  polist.push_back( p_One(currRing));
1899 
1900  std::vector< std::vector<int> > posMat;
1901  std::vector<int> posRow(lV,0);
1902  std::vector<int> C;
1903 
1904  int ds, is, ps;
1905  int lpcnt = 0;
1906 
1907  poly w, wi;
1908  ideal Jwi;
1909 
1910  while(lpcnt < idorb.size())
1911  {
1912  w = NULL;
1913  w = polist[lpcnt];
1914 
1915  if(lpcnt >= 1)
1916  {
1917  if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
1918  {
1919  C.push_back(1);
1920  }
1921  else
1922  C.push_back(0);
1923  }
1924  else
1925  C.push_back(1);
1926 
1927  ds = p_Totaldegree(w, currRing);
1928  lpcnt++;
1929 
1930  for(is = 1; is <= lV; is++)
1931  {
1932  wi = NULL;
1933  //make new copy of word w=polist[lpcnt];
1934  //in wi and update it (next colon word)
1935  //if corresponding to wi get a new ideal(colon of S),
1936  //keep it in the polist else delete it
1937 
1938  wi = pCopy(w);
1939  p_SetExp(wi, (ds*lV)+is, 1, currRing);
1940  p_Setm(wi, currRing);
1941 
1942  Jwi = NULL;
1943  //Jwi stores colon ideal of S w.r.t. wi
1944  //if get a new ideal place it in the idorb
1945  //otherwise delete it
1946  Jwi = idInit(1,1);
1947 
1948  Jwi = colonIdeal(S, wi, lV, Jwi);
1949  ps = (*POS)(Jwi, wi, idorb, polist, trInd);
1950 
1951  if(ps == 0) // finds a new ideal
1952  {
1953  posRow[is-1] = idorb.size();
1954 
1955  idorb.push_back(Jwi);
1956  polist.push_back(wi);
1957  }
1958  else // ideal is already there in the orbit
1959  {
1960  posRow[is-1]=ps-1;
1961  idDelete(&Jwi);
1962  pDelete(&wi);
1963  }
1964  }
1965  posMat.push_back(posRow);
1966  posRow.resize(lV,0);
1967  }
1968  int lO = C.size();//size of the orbit
1969  PrintLn();
1970  Print("Maximal length of words = %ld\n", p_Totaldegree(polist[lO-1], currRing));
1971  Print("\nOrbit length = %d\n", lO);
1972  PrintLn();
1973 
1974  if(odp)
1975  {
1976  Print("Words description of the Orbit: \n");
1977  for(is = 0; is < lO; is++)
1978  {
1979  pWrite0(polist[is]);
1980  PrintS(" ");
1981  }
1982  PrintLn();
1983  }
1984 
1985  for(is = idorb.size()-1; is >= 0; is--)
1986  {
1987  idDelete(&idorb[is]);
1988  }
1989  for(is = polist.size()-1; is >= 0; is--)
1990  {
1991  pDelete(&polist[is]);
1992  }
1993 
1994  idorb.resize(0);
1995  polist.resize(0);
1996 
1997  int adjMatrix[lO][lO];
1998  memset(adjMatrix, 0, lO*lO*sizeof(int));
1999  int rowCount, colCount;
2000  int tm = 0;
2001  if(!mgrad)
2002  {
2003  for(rowCount = 0; rowCount < lO; rowCount++)
2004  {
2005  for(colCount = 0; colCount < lV; colCount++)
2006  {
2007  tm = posMat[rowCount][colCount];
2008  adjMatrix[rowCount][tm] = adjMatrix[rowCount][tm] + 1;
2009  }
2010  }
2011  }
2012 
2013  ring r = currRing;
2014  int npar;
2015  char** tt;
2016  TransExtInfo p;
2017  if(!mgrad)
2018  {
2019  tt=(char**)omalloc(sizeof(char*));
2020  tt[0] = omStrDup("t");
2021  npar = 1;
2022  }
2023  else
2024  {
2025  tt=(char**)omalloc(lV*sizeof(char*));
2026  for(is = 0; is < lV; is++)
2027  {
2028  tt[is] = (char*)omalloc(7*sizeof(char)); //if required enlarge it later
2029  sprintf (tt[is], "t(%d)", is+1);
2030  }
2031  npar = lV;
2032  }
2033 
2034  p.r = rDefault(0, npar, tt);
2035  coeffs cf = nInitChar(n_transExt, &p);
2036  char** xx = (char**)omalloc(sizeof(char*));
2037  xx[0] = omStrDup("x");
2038  ring R = rDefault(cf, 1, xx);
2039  rChangeCurrRing(R);//rWrite(R);
2040  /*
2041  * matrix corresponding to the orbit of the ideal
2042  */
2043  matrix mR = mpNew(lO, lO);
2044  matrix cMat = mpNew(lO,1);
2045  poly rc;
2046 
2047  if(!mgrad)
2048  {
2049  for(rowCount = 0; rowCount < lO; rowCount++)
2050  {
2051  for(colCount = 0; colCount < lO; colCount++)
2052  {
2053  if(adjMatrix[rowCount][colCount] != 0)
2054  {
2055  MATELEM(mR, rowCount + 1, colCount + 1) = p_ISet(adjMatrix[rowCount][colCount], R);
2056  p_SetCoeff(MATELEM(mR, rowCount + 1, colCount + 1), n_Mult(pGetCoeff(mR->m[lO*rowCount+colCount]),n_Param(1, R->cf), R->cf), R);
2057  }
2058  }
2059  }
2060  }
2061  else
2062  {
2063  for(rowCount = 0; rowCount < lO; rowCount++)
2064  {
2065  for(colCount = 0; colCount < lV; colCount++)
2066  {
2067  rc=NULL;
2068  rc=p_One(R);
2069  p_SetCoeff(rc, n_Mult(pGetCoeff(rc), n_Param(colCount+1, R->cf),R->cf), R);
2070  MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1)=p_Add_q(rc,MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1), R);
2071  }
2072  }
2073  }
2074 
2075  for(rowCount = 0; rowCount < lO; rowCount++)
2076  {
2077  if(C[rowCount] != 0)
2078  {
2079  MATELEM(cMat, rowCount + 1, 1) = p_ISet(C[rowCount], R);
2080  }
2081  }
2082 
2083  matrix u;
2084  unitMatrix(lO, u); //unit matrix
2085  matrix gMat = mp_Sub(u, mR, R);
2086  char* s;
2087  if(odp)
2088  {
2089  PrintS("\nlinear system:\n");
2090  if(!mgrad)
2091  {
2092  for(rowCount = 0; rowCount < lO; rowCount++)
2093  {
2094  Print("H(%d) = ", rowCount+1);
2095  for(colCount = 0; colCount < lV; colCount++)
2096  {
2097  StringSetS(""); nWrite(n_Param(1, R->cf));
2098  s = StringEndS(); PrintS(s);
2099  Print("*"); omFree(s);
2100  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2101  }
2102  Print(" %d\n", C[rowCount] );
2103  }
2104  PrintS("where H(1) represents the series corresp. to input ideal\n");
2105  PrintS("and i^th summand in the rhs of an eqn. is according\n");
2106  PrintS("to the right colon map corresp. to the i^th variable\n");
2107  }
2108  else
2109  {
2110  for(rowCount = 0; rowCount < lO; rowCount++)
2111  {
2112  Print("H(%d) = ", rowCount+1);
2113  for(colCount = 0; colCount < lV; colCount++)
2114  {
2115  StringSetS(""); nWrite(n_Param(colCount+1, R->cf));
2116  s = StringEndS(); PrintS(s);
2117  Print("*");omFree(s);
2118  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2119  }
2120  Print(" %d\n", C[rowCount] );
2121  }
2122  PrintS("where H(1) represents the series corresp. to input ideal\n");
2123  }
2124  }
2125  posMat.resize(0);
2126  C.resize(0);
2127  matrix pMat;
2128  matrix lMat;
2129  matrix uMat;
2130  luDecomp(gMat, pMat, lMat, uMat, R);
2131  matrix H_serVec = mpNew(lO, 1);
2132  matrix Hnot;
2133  luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot);
2134 
2135  mp_Delete(&mR, R);
2136  mp_Delete(&u, R);
2137  mp_Delete(&pMat, R);
2138  mp_Delete(&lMat, R);
2139  mp_Delete(&uMat, R);
2140  mp_Delete(&cMat, R);
2141  mp_Delete(&gMat, R);
2142  mp_Delete(&Hnot, R);
2143  //print the Hilbert series and Orbit length
2144  PrintLn();
2145  Print("Hilbert series:");
2146  PrintLn();
2147  pWrite(H_serVec->m[0]);
2148  PrintLn();
2149  if(!mgrad)
2150  {
2151  omFree(tt[0]);
2152  }
2153  else
2154  {
2155  for(is = lV-1; is >= 0; is--)
2156 
2157  omFree( tt[is]);
2158  }
2159  omFree(tt);
2160  omFree(xx[0]);
2161  omFree(xx);
2162  rChangeCurrRing(r);
2163  rKill(R);
2164 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
bool luSolveViaLUDecomp(const matrix pMat, const matrix lMat, const matrix uMat, const matrix bVec, matrix &xVec, matrix &H)
Solves the linear system A * x = b, where A is an (m x n)-matrix which is given by its LU-decompositi...
#define nWrite(n)
Definition: numbers.h:29
static int positionInOrbit_FG_Case(ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int)
Definition: hilb.cc:1616
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:39
return P p
Definition: myNF.cc:203
bool unitMatrix(const int n, matrix &unitMat, const ring R)
Creates a new matrix which is the (nxn) unit matrix, and returns true in case of success.
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void pWrite(poly p)
Definition: polys.h:290
void WerrorS(const char *s)
Definition: feFopen.cc:24
char * StringEndS()
Definition: reporter.cc:151
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
void pWrite0(poly p)
Definition: polys.h:291
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static int positionInOrbit_IG_Case(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd)
Definition: hilb.cc:1537
static FORCE_INLINE number n_Param(const int iParameter, const coeffs r)
return the (iParameter^th) parameter as a NEW number NOTE: parameter numbering: 1..n_NumberOfParameters(...)
Definition: coeffs.h:817
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly * m
Definition: matpol.h:19
void luDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &uMat, const ring R)
LU-decomposition of a given (m x n)-matrix.
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1314
void rKill(ring r)
Definition: ipshell.cc:6057
#define omFree(addr)
Definition: omAllocDecl.h:261
The main handler for Singular numbers which are suitable for Singular polynomials.
void StringSetS(const char *st)
Definition: reporter.cc:128
const ring R
Definition: DebugPrint.cc:36
static ideal minimalMonomialsGenSet(ideal I)
Definition: hilb.cc:1668
int m
Definition: cfEzgcd.cc:119
struct for passing initialization parameters to naInitChar
Definition: transext.h:93
void PrintS(const char *s)
Definition: reporter.cc:284
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl)
Definition: ring.cc:113
#define IDELEMS(i)
Definition: simpleideals.h:24
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:789
void rChangeCurrRing(ring r)
Definition: polys.cc:12
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:44
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi)
Definition: hilb.cc:1831
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:483
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define omalloc(size)
Definition: omAllocDecl.h:228
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:169
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition: matpol.cc:203
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1298
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define MATELEM(mat, i, j)
Definition: matpol.h:29
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:341
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ hIndAllMult()

void hIndAllMult ( scmon  pure,
int  Npure,
scfmon  rad,
int  Nrad,
varset  var,
int  Nvar 
)

Definition at line 496 of file hdegree.cc.

498 {
499  int dn, iv, rad0, b, c, x;
500  scmon pn;
501  scfmon rn;
502  if (Nrad < 2)
503  {
504  dn = Npure + Nrad;
505  if (dn > hCo)
506  {
507  if (!Nrad)
508  hCheckIndep(pure);
509  else
510  {
511  pn = *rad;
512  for (iv = Nvar; iv; iv--)
513  {
514  x = var[iv];
515  if (pn[x])
516  {
517  pure[x] = 1;
518  hCheckIndep(pure);
519  pure[x] = 0;
520  }
521  }
522  }
523  }
524  return;
525  }
526  iv = Nvar;
527  while(pure[var[iv]]) iv--;
528  hStepR(rad, Nrad, var, iv, &rad0);
529  iv--;
530  if (rad0 < Nrad)
531  {
532  pn = hGetpure(pure);
533  rn = hGetmem(Nrad, rad, radmem[iv]);
534  pn[var[iv + 1]] = 1;
535  hIndAllMult(pn, Npure + 1, rn, rad0, var, iv);
536  pn[var[iv + 1]] = 0;
537  b = rad0;
538  c = Nrad;
539  hElimR(rn, &rad0, b, c, var, iv);
540  hPure(rn, b, &c, var, iv, pn, &x);
541  hLex2R(rn, rad0, b, c, var, iv, hwork);
542  rad0 += (c - b);
543  hIndAllMult(pn, Npure + x, rn, rad0, var, iv);
544  }
545  else
546  {
547  hIndAllMult(pure, Npure, rad, Nrad, var, iv);
548  }
549 }
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:748
scfmon hwork
Definition: hutil.cc:19
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1029
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:496
int hCo
Definition: hdegree.cc:22
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
scmon * scfmon
Definition: hutil.h:18
static void hCheckIndep(scmon pure)
Definition: hdegree.cc:472
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:980
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
int * scmon
Definition: hutil.h:17
void hLex2R(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition: hutil.cc:886
monf radmem
Definition: hutil.cc:24
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

◆ hIndMult()

void hIndMult ( scmon  pure,
int  Npure,
scfmon  rad,
int  Nrad,
varset  var,
int  Nvar 
)

Definition at line 313 of file hdegree.cc.

315 {
316  int dn, iv, rad0, b, c, x;
317  scmon pn;
318  scfmon rn;
319  if (Nrad < 2)
320  {
321  dn = Npure + Nrad;
322  if (dn == hCo)
323  {
324  if (Nrad==0)
325  hIndep(pure);
326  else
327  {
328  pn = *rad;
329  for (iv = Nvar; iv!=0; iv--)
330  {
331  x = var[iv];
332  if (pn[x])
333  {
334  pure[x] = 1;
335  hIndep(pure);
336  pure[x] = 0;
337  }
338  }
339  }
340  }
341  return;
342  }
343  iv = Nvar;
344  dn = Npure+1;
345  if (dn >= hCo)
346  {
347  if (dn > hCo)
348  return;
349  loop
350  {
351  if(!pure[var[iv]])
352  {
353  if(hNotZero(rad, Nrad, var, iv))
354  {
355  pure[var[iv]] = 1;
356  hIndep(pure);
357  pure[var[iv]] = 0;
358  }
359  }
360  iv--;
361  if (!iv)
362  return;
363  }
364  }
365  while(pure[var[iv]]) iv--;
366  hStepR(rad, Nrad, var, iv, &rad0);
367  iv--;
368  if (rad0 < Nrad)
369  {
370  pn = hGetpure(pure);
371  rn = hGetmem(Nrad, rad, radmem[iv]);
372  pn[var[iv + 1]] = 1;
373  hIndMult(pn, Npure + 1, rn, rad0, var, iv);
374  pn[var[iv + 1]] = 0;
375  b = rad0;
376  c = Nrad;
377  hElimR(rn, &rad0, b, c, var, iv);
378  hPure(rn, b, &c, var, iv, pn, &x);
379  hLex2R(rn, rad0, b, c, var, iv, hwork);
380  rad0 += (c - b);
381  hIndMult(pn, Npure + x, rn, rad0, var, iv);
382  }
383  else
384  {
385  hIndMult(pure, Npure, rad, Nrad, var, iv);
386  }
387 }
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:748
scfmon hwork
Definition: hutil.cc:19
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1029
int hCo
Definition: hdegree.cc:22
loop
Definition: myNF.cc:98
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
scmon * scfmon
Definition: hutil.h:18
static BOOLEAN hNotZero(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:281
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:980
static void hIndep(scmon pure)
Definition: hdegree.cc:296
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:313
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
int * scmon
Definition: hutil.h:17
void hLex2R(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition: hutil.cc:886
monf radmem
Definition: hutil.cc:24
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

◆ hInit()

scfmon hInit ( ideal  S,
ideal  Q,
int *  Nexist,
ring  tailRing 
)

Definition at line 34 of file hutil.cc.

35 {
38 
39 // if (tailRing != currRing)
41 // else
42 // hisModule = id_RankFreeModule(S, currRing);
43 
44  if (hisModule < 0)
45  hisModule = 0;
46 
47  int sl, ql, i, k = 0;
48  polyset si, qi, ss;
49  scfmon ex, ek;
50 
51  if (S!=NULL)
52  {
53  si = S->m;
54  sl = IDELEMS(S);
55  }
56  else
57  {
58  si = NULL;
59  sl = 0;
60  }
61  if (Q!=NULL)
62  {
63  qi = Q->m;
64  ql = IDELEMS(Q);
65  }
66  else
67  {
68  qi = NULL;
69  ql = 0;
70  }
71  if ((sl + ql) == 0)
72  {
73  *Nexist = 0;
74  return NULL;
75  }
76  ss = si;
77  for (i = sl; i>0; i--)
78  {
79  if (*ss!=0)
80  k++;
81  ss++;
82  }
83  ss = qi;
84  for (i = ql; i>0; i--)
85  {
86  if (*ss!=0)
87  k++;
88  ss++;
89  }
90  *Nexist = k;
91  if (k==0)
92  return NULL;
93  ek = ex = (scfmon)omAlloc0(k * sizeof(scmon));
94  hsecure = (scfmon) omAlloc0(k * sizeof(scmon));
95  for (i = sl; i>0; i--)
96  {
97  if (*si!=NULL)
98  {
99  *ek = (scmon) omAlloc(((currRing->N)+1)*sizeof(int));
100  p_GetExpV(*si, *ek, currRing);
101  ek++;
102  }
103  si++;
104  }
105  for (i = ql; i>0; i--)
106  {
107  if (*qi!=NULL)
108  {
109  *ek = (scmon) omAlloc(((currRing->N)+1)*sizeof(int));
110  p_GetExpV(*qi, *ek, currRing);
111  ek++;
112  }
113  qi++;
114  }
115  memcpy(hsecure, ex, k * sizeof(scmon));
116  return ex;
117 }
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:79
scmon * scfmon
Definition: hutil.h:18
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1443
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static scfmon hsecure
Definition: hutil.cc:32
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
int hisModule
Definition: hutil.cc:23
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ hKill()

void hKill ( monf  xmem,
int  Nvar 
)

Definition at line 1016 of file hutil.cc.

1017 {
1018  int i;
1019  for (i = Nvar; i!=0; i--)
1020  {
1021  if (xmem[i]->mo!=NULL)
1022  omFreeSize((ADDRESS)xmem[i]->mo, xmem[i]->a * sizeof(scmon));
1023  omFreeSize((ADDRESS)xmem[i], LEN_MON);
1024  }
1025  omFreeSize((ADDRESS)xmem, (Nvar + 1) * sizeof(monp));
1026 }
const poly a
Definition: syzextra.cc:212
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
#define LEN_MON
Definition: hutil.h:38
monh * monp
Definition: hutil.h:22
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hLex2R()

void hLex2R ( scfmon  rad,
int  e1,
int  a2,
int  e2,
varset  var,
int  Nvar,
scfmon  w 
)

Definition at line 886 of file hutil.cc.

888 {
889  int j0 = 0, j = 0, i = a2, k, k1;
890  scmon n, o;
891  if (!e1)
892  {
893  for (; i < e2; i++)
894  rad[i - a2] = rad[i];
895  return;
896  }
897  else if (i == e2)
898  return;
899  n = rad[j];
900  o = rad[i];
901  loop
902  {
903  k = Nvar;
904  loop
905  {
906  k1 = var[k];
907  if (!o[k1] && n[k1])
908  {
909  w[j0] = o;
910  j0++;
911  i++;
912  if (i < e2)
913  {
914  o = rad[i];
915  break;
916  }
917  else
918  {
919  for (; j < e1; j++)
920  {
921  w[j0] = rad[j];
922  j0++;
923  }
924  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
925  return;
926  }
927  }
928  else if (o[k1] && !n[k1])
929  {
930  w[j0] = n;
931  j0++;
932  j++;
933  if (j < e1)
934  {
935  n = rad[j];
936  break;
937  }
938  else
939  {
940  for (; i < e2; i++)
941  {
942  w[j0] = rad[i];
943  j0++;
944  }
945  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
946  return;
947  }
948  }
949  k--;
950  }
951  }
952 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ hLex2S()

void hLex2S ( scfmon  stc,
int  e1,
int  a2,
int  e2,
varset  var,
int  Nvar,
scfmon  w 
)

Definition at line 818 of file hutil.cc.

820 {
821  int j0 = 0, j = 0, i = a2, k, k1;
822  scmon n, o;
823  if (!e1)
824  {
825  for (; i < e2; i++)
826  rad[i - a2] = rad[i];
827  return;
828  } else if (i == e2)
829  return;
830  n = rad[j];
831  o = rad[i];
832  loop
833  {
834  k = Nvar;
835  loop
836  {
837  k1 = var[k];
838  if (o[k1] < n[k1])
839  {
840  w[j0] = o;
841  j0++;
842  i++;
843  if (i < e2)
844  {
845  o = rad[i];
846  break;
847  }
848  else
849  {
850  for (; j < e1; j++)
851  {
852  w[j0] = rad[j];
853  j0++;
854  }
855  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
856  return;
857  }
858  }
859  else if (o[k1] > n[k1])
860  {
861  w[j0] = n;
862  j0++;
863  j++;
864  if (j < e1)
865  {
866  n = rad[j];
867  break;
868  }
869  else
870  {
871  for (; i < e2; i++)
872  {
873  w[j0] = rad[i];
874  j0++;
875  }
876  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
877  return;
878  }
879  }
880  k--;
881  }
882  }
883 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
const CanonicalForm & w
Definition: facAbsFact.cc:55

◆ hLexR()

void hLexR ( scfmon  rad,
int  Nrad,
varset  var,
int  Nvar 
)

Definition at line 571 of file hutil.cc.

572 {
573  int j = 1, i = 0, k, k1;
574  scmon n, o;
575  if (Nrad < 2)
576  return;
577  n = rad[j];
578  o = rad[0];
579  k = Nvar;
580  loop
581  {
582  k1 = var[k];
583  if (!o[k1] && n[k1])
584  {
585  i++;
586  if (i < j)
587  {
588  o = rad[i];
589  k = Nvar;
590  }
591  else
592  {
593  j++;
594  if (j < Nrad)
595  {
596  i = 0;
597  o = rad[0];
598  n = rad[j];
599  k = Nvar;
600  }
601  else
602  return;
603  }
604  }
605  else if (o[k1] && !n[k1])
606  {
607  for (k = j; k > i; k--)
608  rad[k] = rad[k - 1];
609  rad[i] = n;
610  j++;
611  if (j < Nrad)
612  {
613  i = 0;
614  o = rad[0];
615  n = rad[j];
616  k = Nvar;
617  }
618  else
619  return;
620  }
621  else
622  k--;
623  }
624 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123

◆ hLexS()

void hLexS ( scfmon  stc,
int  Nstc,
varset  var,
int  Nvar 
)

Definition at line 512 of file hutil.cc.

513 {
514  if (Nstc < 2)
515  return;
516  int j = 1, i = 0;
517  scmon n = stc[j];
518  scmon o = stc[0];
519  int k = Nvar;
520  loop
521  {
522  int k1 = var[k];
523  if (o[k1] < n[k1])
524  {
525  i++;
526  if (i < j)
527  {
528  o = stc[i];
529  k = Nvar;
530  }
531  else
532  {
533  j++;
534  if (j < Nstc)
535  {
536  i = 0;
537  o = stc[0];
538  n = stc[j];
539  k = Nvar;
540  }
541  else
542  return;
543  }
544  }
545  else if (o[k1] > n[k1])
546  {
547  int tmp_k;
548  for (tmp_k = j; tmp_k > i; tmp_k--)
549  stc[tmp_k] = stc[tmp_k - 1];
550  stc[i] = n;
551  j++;
552  if (j < Nstc)
553  {
554  i = 0;
555  o = stc[0];
556  n = stc[j];
557  k = Nvar;
558  }
559  else
560  return;
561  }
562  else
563  {
564  k--;
565  if (k<=0) return;
566  }
567  }
568 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123

◆ hOrdSupp()

void hOrdSupp ( scfmon  stc,
int  Nstc,
varset  var,
int  Nvar 
)

Definition at line 208 of file hutil.cc.

209 {
210  int i, i1, j, jj, k, l;
211  int x;
212  scmon temp, count;
213  float o, h, g, *v1;
214 
215  v1 = (float *)omAlloc(Nvar * sizeof(float));
216  temp = (int *)omAlloc(Nstc * sizeof(int));
217  count = (int *)omAlloc(Nstc * sizeof(int));
218  for (i = 1; i <= Nvar; i++)
219  {
220  i1 = var[i];
221  *temp = stc[0][i1];
222  *count = 1;
223  jj = 1;
224  for (j = 1; j < Nstc; j++)
225  {
226  x = stc[j][i1];
227  k = 0;
228  loop
229  {
230  if (x > temp[k])
231  {
232  k++;
233  if (k == jj)
234  {
235  temp[k] = x;
236  count[k] = 1;
237  jj++;
238  break;
239  }
240  }
241  else if (x < temp[k])
242  {
243  for (l = jj; l > k; l--)
244  {
245  temp[l] = temp[l-1];
246  count[l] = count[l-1];
247  }
248  temp[k] = x;
249  count[k] = 1;
250  jj++;
251  break;
252  }
253  else
254  {
255  count[k]++;
256  break;
257  }
258  }
259  }
260  h = 0.0;
261  o = (float)Nstc/(float)jj;
262  for(j = 0; j < jj; j++)
263  {
264  g = (float)count[j];
265  if (g > o)
266  g -= o;
267  else
268  g = o - g;
269  if (g > h)
270  h = g;
271  }
272  v1[i-1] = h * (float)jj;
273  }
274  omFreeSize((ADDRESS)count, Nstc * sizeof(int));
275  omFreeSize((ADDRESS)temp, Nstc * sizeof(int));
276  for (i = 1; i < Nvar; i++)
277  {
278  i1 = var[i+1];
279  h = v1[i];
280  j = 0;
281  loop
282  {
283  if (h > v1[j])
284  {
285  for (l = i; l > j; l--)
286  {
287  v1[l] = v1[l-1];
288  var[l+1] = var[l];
289  }
290  v1[j] = h;
291  var[j+1] = i1;
292  break;
293  }
294  j++;
295  if (j == i)
296  break;
297  }
298  }
299  omFreeSize((ADDRESS)v1, Nvar * sizeof(float));
300 }
int status int void size_t count
Definition: si_signals.h:59
loop
Definition: myNF.cc:98
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:115
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
Variable x
Definition: cfModGcd.cc:4023
static Poly * h
Definition: janet.cc:978
int l
Definition: cfEzgcd.cc:94

◆ hPure()

void hPure ( scfmon  stc,
int  a,
int *  Nstc,
varset  var,
int  Nvar,
scmon  pure,
int *  Npure 
)

Definition at line 627 of file hutil.cc.

629 {
630  int nc = *Nstc, np = 0, nq = 0, j, i, i1, c, l;
631  scmon x;
632  for (j = a; j < nc; j++)
633  {
634  x = stc[j];
635  i = Nvar;
636  c = 2;
637  l = 0;
638  loop
639  {
640  i1 = var[i];
641  if (x[i1])
642  {
643  c--;
644  if (!c)
645  {
646  l = 0;
647  break;
648  }
649  else if (c == 1)
650  l = i1;
651  }
652  i--;
653  if (!i)
654  break;
655  }
656  if (l)
657  {
658  if (!pure[l])
659  {
660  np++;
661  pure[l] = x[l];
662  }
663  else if (x[l] < pure[l])
664  pure[l] = x[l];
665  stc[j] = NULL;
666  nq++;
667  }
668  }
669  *Npure = np;
670  if (nq!=0)
671  {
672  *Nstc -= nq;
673  hShrink(stc, a, nc);
674  }
675 }
const poly a
Definition: syzextra.cc:212
loop
Definition: myNF.cc:98
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:94

◆ hRadical()

void hRadical ( scfmon  rad,
int *  Nrad,
int  Nvar 
)

Definition at line 417 of file hutil.cc.

418 {
419  int nc = *Nrad, z = 0, i, j, k;
420  scmon n, o;
421  if (nc < 2)
422  return;
423  i = 0;
424  j = 1;
425  n = rad[j];
426  o = rad[0];
427  k = Nvar;
428  loop
429  {
430  if ((o[k]!=0) && (n[k]==0))
431  {
432  loop
433  {
434  k--;
435  if (k==0)
436  {
437  rad[i] = NULL;
438  z++;
439  break;
440  }
441  else
442  {
443  if ((o[k]==0) && (n[k]!=0))
444  break;
445  }
446  }
447  k = Nvar;
448  }
449  else if (!o[k] && n[k])
450  {
451  loop
452  {
453  k--;
454  if (!k)
455  {
456  rad[j] = NULL;
457  z++;
458  break;
459  }
460  else
461  {
462  if (o[k] && !n[k])
463  break;
464  }
465  }
466  k = Nvar;
467  }
468  else
469  {
470  k--;
471  if (!k)
472  {
473  rad[j] = NULL;
474  z++;
475  k = Nvar;
476  }
477  }
478  if (k == Nvar)
479  {
480  if (!rad[j])
481  i = j - 1;
482  loop
483  {
484  i++;
485  if (i == j)
486  {
487  i = -1;
488  j++;
489  if (j < nc)
490  n = rad[j];
491  else
492  {
493  if (z)
494  {
495  *Nrad -= z;
496  hShrink(rad, 0, nc);
497  }
498  return;
499  }
500  }
501  else if (rad[i])
502  {
503  o = rad[i];
504  break;
505  }
506  }
507  }
508  }
509 }
loop
Definition: myNF.cc:98
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hStaircase()

void hStaircase ( scfmon  stc,
int *  Nstc,
varset  var,
int  Nvar 
)

Definition at line 319 of file hutil.cc.

320 {
321  int nc = *Nstc;
322  if (nc < 2)
323  return;
324  int z = 0;
325  int i = 0;
326  int j = 1;
327  scmon n = stc[1 /*j*/];
328  scmon o = stc[0];
329  int k = Nvar;
330  loop
331  {
332  int k1 = var[k];
333  if (o[k1] > n[k1])
334  {
335  loop
336  {
337  k--;
338  if (k==0)
339  {
340  stc[i] = NULL;
341  z++;
342  break;
343  }
344  else
345  {
346  k1 = var[k];
347  if (o[k1] < n[k1])
348  break;
349  }
350  }
351  k = Nvar;
352  }
353  else if (o[k1] < n[k1])
354  {
355  loop
356  {
357  k--;
358  if (k==0)
359  {
360  stc[j] = NULL;
361  z++;
362  break;
363  }
364  else
365  {
366  k1 = var[k];
367  if (o[k1] > n[k1])
368  break;
369  }
370  }
371  k = Nvar;
372  }
373  else
374  {
375  k--;
376  if (k==0)
377  {
378  stc[j] = NULL;
379  z++;
380  k = Nvar;
381  }
382  }
383  if (k == Nvar)
384  {
385  if (stc[j]==NULL)
386  i = j - 1;
387  loop
388  {
389  i++;
390  if (i == j)
391  {
392  i = -1;
393  j++;
394  if (j < nc)
395  n = stc[j];
396  else
397  {
398  if (z!=0)
399  {
400  *Nstc -= z;
401  hShrink(stc, 0, nc);
402  }
403  return;
404  }
405  }
406  else if (stc[i]!=NULL)
407  {
408  o = stc[i];
409  break;
410  }
411  }
412  }
413  }
414 }
loop
Definition: myNF.cc:98
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int * scmon
Definition: hutil.h:17
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ hStepR()

void hStepR ( scfmon  rad,
int  Nrad,
varset  var,
int  Nvar,
int *  a 
)

Definition at line 980 of file hutil.cc.

981 {
982  int k1, i;
983  k1 = var[Nvar];
984  i = 0;
985  loop
986  {
987  if (rad[i][k1])
988  {
989  *a = i;
990  return;
991  }
992  i++;
993  if (i == Nrad)
994  {
995  *a = i;
996  return;
997  }
998  }
999 }
const poly a
Definition: syzextra.cc:212
loop
Definition: myNF.cc:98
int i
Definition: cfEzgcd.cc:123

◆ hStepS()

void hStepS ( scfmon  stc,
int  Nstc,
varset  var,
int  Nvar,
int *  a,
int *  x 
)

Definition at line 955 of file hutil.cc.

956 {
957  int k1, i;
958  int y;
959  k1 = var[Nvar];
960  y = *x;
961  i = *a;
962  loop
963  {
964  if (y < stc[i][k1])
965  {
966  *a = i;
967  *x = stc[i][k1];
968  return;
969  }
970  i++;
971  if (i == Nstc)
972  {
973  *a = i;
974  return;
975  }
976  }
977 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
const poly a
Definition: syzextra.cc:212
loop
Definition: myNF.cc:98
int i
Definition: cfEzgcd.cc:123
Variable x
Definition: cfModGcd.cc:4023

◆ hSupp()

void hSupp ( scfmon  stc,
int  Nstc,
varset  var,
int *  Nvar 
)

Definition at line 180 of file hutil.cc.

181 {
182  int nv, i0, i1, i, j;
183  nv = i0 = *Nvar;
184  i1 = 0;
185  for (i = 1; i <= nv; i++)
186  {
187  j = 0;
188  loop
189  {
190  if (stc[j][i]>0)
191  {
192  i1++;
193  var[i1] = i;
194  break;
195  }
196  j++;
197  if (j == Nstc)
198  {
199  var[i0] = i;
200  i0--;
201  break;
202  }
203  }
204  }
205  *Nvar = i1;
206 }
loop
Definition: myNF.cc:98
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123

◆ slicehilb()

void slicehilb ( ideal  I)

Definition at line 1105 of file hilb.cc.

1106 {
1107  //printf("Adi changes are here: \n");
1108  int i, NNN = 0;
1109  int steps = 0, prune = 0, moreprune = 0;
1110  mpz_ptr hilbertcoef;
1111  int *hilbpower;
1112  ideal S = idInit(1,1);
1113  poly q = p_ISet(1,currRing);
1114  ideal X = idInit(1,1);
1115  X->m[0]=p_One(currRing);
1116  for(i=1;i<=currRing->N;i++)
1117  {
1118  p_SetExp(X->m[0],i,1,currRing);
1119  }
1120  p_Setm(X->m[0],currRing);
1121  I = id_Mult(I,X,currRing);
1122  I = SortByDeg(I);
1123  //printf("\n-------------RouneSlice--------------\n");
1124  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1125  //printf("\nIn total Prune got rid of %i elements\n",prune);
1126  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1127  //printf("\nSteps of rouneslice: %i\n\n", steps);
1128  mpz_t coefhilb;
1129  mpz_t dummy;
1130  mpz_init(coefhilb);
1131  mpz_init(dummy);
1132  printf("\n// %8d t^0",1);
1133  for(i = 0; i<NNN; i++)
1134  {
1135  if(mpz_sgn(&hilbertcoef[i])!=0)
1136  {
1137  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1138  }
1139  }
1140  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1141  omFreeSize(hilbpower, (NNN)*sizeof(int));
1142  //printf("\n-------------------------------------\n");
1143 }
void rouneslice(ideal I, ideal S, poly q, poly x, int &prune, int &moreprune, int &steps, int &NNN, mpz_ptr &hilbertcoef, int *&hilbpower)
Definition: hilb.cc:951
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void prune(Variable &alpha)
Definition: variable.cc:261
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly p_One(const ring r)
Definition: p_polys.cc:1314
int i
Definition: cfEzgcd.cc:123
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...
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:483
static ideal SortByDeg(ideal I)
Definition: hilb.cc:365
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1298

Variable Documentation

◆ hCo

int hCo

Definition at line 22 of file hdegree.cc.

◆ hexist

scfmon hexist

Definition at line 19 of file hutil.cc.

◆ hisModule

int hisModule

Definition at line 23 of file hutil.cc.

◆ hMu

int hMu

Definition at line 22 of file hdegree.cc.

◆ hMu2

int hMu2

Definition at line 22 of file hdegree.cc.

◆ hNexist

int hNexist

Definition at line 22 of file hutil.cc.

◆ hNpure

int hNpure

Definition at line 22 of file hutil.cc.

◆ hNrad

int hNrad

Definition at line 22 of file hutil.cc.

◆ hNstc

int hNstc

Definition at line 22 of file hutil.cc.

◆ hNvar

int hNvar

Definition at line 22 of file hutil.cc.

◆ hpur0

scmon hpur0

Definition at line 20 of file hutil.cc.

◆ hpure

scmon hpure

Definition at line 20 of file hutil.cc.

◆ hrad

scfmon hrad

Definition at line 19 of file hutil.cc.

◆ hsel

varset hsel

Definition at line 21 of file hutil.cc.

◆ hstc

scfmon hstc

Definition at line 19 of file hutil.cc.

◆ hvar

varset hvar

Definition at line 21 of file hutil.cc.

◆ hwork

scfmon hwork

Definition at line 19 of file hutil.cc.

◆ indlist_bin

omBin indlist_bin

Definition at line 23 of file hdegree.cc.

◆ ISet

indset ISet

Definition at line 279 of file hdegree.cc.

◆ JSet

indset JSet

Definition at line 279 of file hdegree.cc.

◆ radmem

monf radmem

Definition at line 48 of file hutil.h.

◆ stcmem

monf stcmem

Definition at line 48 of file hutil.h.