My Project  UNKNOWN_GIT_VERSION
Data Structures | Macros | Typedefs | Functions | Variables
hutil.h File Reference
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "misc/intvec.h"

Go to the source code of this file.

Data Structures

struct  monh
 
struct  indlist
 

Macros

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

Typedefs

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, int trunDegHs)
 
ideal RightColonOperation (ideal i, poly w, int lV)
 

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 21 of file hutil.h.

Data Fields
int a
scfmon mo

◆ sindlist

struct sindlist

Definition at line 29 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 35 of file hutil.h.

Typedef Documentation

◆ indset

typedef indlist* indset

Definition at line 28 of file hutil.h.

◆ monf

typedef monp* monf

Definition at line 20 of file hutil.h.

◆ monp

typedef monh* monp

Definition at line 19 of file hutil.h.

◆ scfmon

typedef scmon* scfmon

Definition at line 15 of file hutil.h.

◆ scmon

typedef int* scmon

Definition at line 14 of file hutil.h.

◆ varset

typedef int* varset

Definition at line 16 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:15
int k
Definition: cfEzgcd.cc:92
int i
Definition: cfEzgcd.cc:125

◆ 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:20
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define LEN_MON
Definition: hutil.h:35
monh * monp
Definition: hutil.h:19
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10

◆ hDegreeSeries()

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

Definition at line 1381 of file hilb.cc.

1382 {
1383  int i, j, k;
1384  int m;
1385  *co = *mu = 0;
1386  if ((s1 == NULL) || (s2 == NULL))
1387  return;
1388  i = s1->length();
1389  j = s2->length();
1390  if (j > i)
1391  return;
1392  m = 0;
1393  for(k=j-2; k>=0; k--)
1394  m += (*s2)[k];
1395  *mu = m;
1396  *co = i - j;
1397 }
int j
Definition: facHensel.cc:105
void mu(int **points, int sizePoints)
int k
Definition: cfEzgcd.cc:92
int m
Definition: cfEzgcd.cc:121
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:92

◆ 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
static scfmon hsecure
Definition: hutil.cc:32
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13

◆ 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:15
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:980
CanonicalForm b
Definition: cfModGcd.cc:4044
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:14
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

◆ 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 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#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 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#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:15
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:133
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * scmon
Definition: hutil.h:14
#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 }
int * scmon
Definition: hutil.h:14
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int p
Definition: cfModGcd.cc:4019

◆ HilbertSeries_OrbitData()

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

Definition at line 1969 of file hilb.cc.

1970 {
1971  /*
1972  * This is based on iterative right colon operations on a
1973  * two-sided monomial ideal of the free associative algebra.
1974  * The algorithm terminates for those monomial ideals
1975  * whose monomials define "regular formal languages",
1976  * that is, all monomials of the input ideal can be obtained
1977  * from finite languages by applying finite number of
1978  * rational operations.
1979  */
1980 
1981  int trInd;
1982  S = minimalMonomialGenSet(S);
1983  if( !idIs0(S) && p_Totaldegree(S->m[0], currRing)==0)
1984  {
1985  PrintS("Hilbert Series:\n 0\n");
1986  return;
1987  }
1988  int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int, int);
1989  if(trunDegHs != 0)
1990  {
1991  Print("\nTruncation degree = %d\n",trunDegHs);
1993  }
1994  else
1995  {
1996  if(IG_CASE)
1997  {
1998  if(idIs0(S))
1999  {
2000  WerrorS("wrong input: it is not an infinitely gen. case");
2001  return;
2002  }
2003  trInd = p_Totaldegree(S->m[IDELEMS(S)-1], currRing);
2004  POS = &positionInOrbit_IG_Case;
2005  }
2006  else
2007  POS = &positionInOrbit_FG_Case;
2008  }
2009  std::vector<ideal > idorb;
2010  std::vector< poly > polist;
2011 
2012  ideal orb_init = idInit(1, 1);
2013  idorb.push_back(orb_init);
2014 
2015  polist.push_back( p_One(currRing));
2016 
2017  std::vector< std::vector<int> > posMat;
2018  std::vector<int> posRow(lV,0);
2019  std::vector<int> C;
2020 
2021  int ds, is, ps;
2022  int lpcnt = 0;
2023 
2024  poly w, wi;
2025  ideal Jwi;
2026 
2027  while(lpcnt < idorb.size())
2028  {
2029  w = NULL;
2030  w = polist[lpcnt];
2031  if(lpcnt >= 1 && idIs0(idorb[lpcnt]) == FALSE)
2032  {
2033  if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
2034  {
2035  C.push_back(1);
2036  }
2037  else
2038  C.push_back(0);
2039  }
2040  else
2041  {
2042  C.push_back(1);
2043  }
2044 
2045  ds = p_Totaldegree(w, currRing);
2046  lpcnt++;
2047 
2048  for(is = 1; is <= lV; is++)
2049  {
2050  wi = NULL;
2051  //make new copy 'wi' of word w=polist[lpcnt]
2052  //and update it (for the colon operation).
2053  //if corresponding to wi, right colon operation gives
2054  //a new (right colon) ideal of S,
2055  //keep 'wi' in the polist else delete it
2056 
2057  wi = pCopy(w);
2058  p_SetExp(wi, (ds*lV)+is, 1, currRing);
2059  p_Setm(wi, currRing);
2060  Jwi = NULL;
2061  //Jwi stores (right) colon ideal of S w.r.t. word
2062  //wi if colon operation gives a new ideal place it
2063  //in the vector of ideals 'idorb'
2064  //otherwise delete it
2065 
2066  Jwi = idInit(1,1);
2067 
2068  Jwi = colonIdeal(S, wi, lV, Jwi, trunDegHs);
2069  ps = (*POS)(Jwi, wi, idorb, polist, trInd, trunDegHs);
2070 
2071  if(ps == 0) // finds a new ideal
2072  {
2073  posRow[is-1] = idorb.size();
2074 
2075  idorb.push_back(Jwi);
2076  polist.push_back(wi);
2077  }
2078  else // ideal is already there in the set
2079  {
2080  posRow[is-1]=ps-1;
2081  idDelete(&Jwi);
2082  pDelete(&wi);
2083  }
2084  }
2085  posMat.push_back(posRow);
2086  posRow.resize(lV,0);
2087  }
2088  int lO = C.size();//size of the orbit
2089  PrintLn();
2090  Print("maximal length of words = %ld\n", p_Totaldegree(polist[lO-1], currRing));
2091  Print("\nlength of the Orbit = %d", lO);
2092  PrintLn();
2093 
2094  if(odp)
2095  {
2096  Print("words description of the Orbit: \n");
2097  for(is = 0; is < lO; is++)
2098  {
2099  pWrite0(polist[is]);
2100  PrintS(" ");
2101  }
2102  PrintLn();
2103  PrintS("\nmaximal degree, #(sum_j R(w,w_j))");
2104  PrintLn();
2105  for(is = 0; is < lO; is++)
2106  {
2107  if(idIs0(idorb[is]))
2108  {
2109  PrintS("NULL\n");
2110  }
2111  else
2112  {
2113  Print("%ld, %d \n",p_Totaldegree(idorb[is]->m[IDELEMS(idorb[is])-1], currRing),IDELEMS(idorb[is]));
2114  }
2115  }
2116  }
2117 
2118  for(is = idorb.size()-1; is >= 0; is--)
2119  {
2120  idDelete(&idorb[is]);
2121  }
2122  for(is = polist.size()-1; is >= 0; is--)
2123  {
2124  pDelete(&polist[is]);
2125  }
2126 
2127  idorb.resize(0);
2128  polist.resize(0);
2129 
2130  int adjMatrix[lO][lO];
2131  memset(adjMatrix, 0, lO*lO*sizeof(int));
2132  int rowCount, colCount;
2133  int tm = 0;
2134  if(!mgrad)
2135  {
2136  for(rowCount = 0; rowCount < lO; rowCount++)
2137  {
2138  for(colCount = 0; colCount < lV; colCount++)
2139  {
2140  tm = posMat[rowCount][colCount];
2141  adjMatrix[rowCount][tm] = adjMatrix[rowCount][tm] + 1;
2142  }
2143  }
2144  }
2145 
2146  ring r = currRing;
2147  int npar;
2148  char** tt;
2149  TransExtInfo p;
2150  if(!mgrad)
2151  {
2152  tt=(char**)omAlloc(sizeof(char*));
2153  tt[0] = omStrDup("t");
2154  npar = 1;
2155  }
2156  else
2157  {
2158  tt=(char**)omalloc(lV*sizeof(char*));
2159  for(is = 0; is < lV; is++)
2160  {
2161  tt[is] = (char*)omAlloc(7*sizeof(char)); //if required enlarge it later
2162  sprintf (tt[is], "t%d", is+1);
2163  }
2164  npar = lV;
2165  }
2166 
2167  p.r = rDefault(0, npar, tt);
2169  char** xx = (char**)omAlloc(sizeof(char*));
2170  xx[0] = omStrDup("x");
2171  ring R = rDefault(cf, 1, xx);
2172  rChangeCurrRing(R);//rWrite(R);
2173  /*
2174  * matrix corresponding to the orbit of the ideal
2175  */
2176  matrix mR = mpNew(lO, lO);
2177  matrix cMat = mpNew(lO,1);
2178  poly rc;
2179 
2180  if(!mgrad)
2181  {
2182  for(rowCount = 0; rowCount < lO; rowCount++)
2183  {
2184  for(colCount = 0; colCount < lO; colCount++)
2185  {
2186  if(adjMatrix[rowCount][colCount] != 0)
2187  {
2188  MATELEM(mR, rowCount + 1, colCount + 1) = p_ISet(adjMatrix[rowCount][colCount], R);
2189  p_SetCoeff(MATELEM(mR, rowCount + 1, colCount + 1), n_Mult(pGetCoeff(mR->m[lO*rowCount+colCount]),n_Param(1, R->cf), R->cf), R);
2190  }
2191  }
2192  }
2193  }
2194  else
2195  {
2196  for(rowCount = 0; rowCount < lO; rowCount++)
2197  {
2198  for(colCount = 0; colCount < lV; colCount++)
2199  {
2200  rc=NULL;
2201  rc=p_One(R);
2202  p_SetCoeff(rc, n_Mult(pGetCoeff(rc), n_Param(colCount+1, R->cf),R->cf), R);
2203  MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1)=p_Add_q(rc,MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1), R);
2204  }
2205  }
2206  }
2207 
2208  for(rowCount = 0; rowCount < lO; rowCount++)
2209  {
2210  if(C[rowCount] != 0)
2211  {
2212  MATELEM(cMat, rowCount + 1, 1) = p_ISet(C[rowCount], R);
2213  }
2214  }
2215 
2216  matrix u;
2217  unitMatrix(lO, u); //unit matrix
2218  matrix gMat = mp_Sub(u, mR, R);
2219 
2220  char* s;
2221 
2222  if(odp)
2223  {
2224  PrintS("\nlinear system:\n");
2225  if(!mgrad)
2226  {
2227  for(rowCount = 0; rowCount < lO; rowCount++)
2228  {
2229  Print("H(%d) = ", rowCount+1);
2230  for(colCount = 0; colCount < lV; colCount++)
2231  {
2232  StringSetS(""); nWrite(n_Param(1, R->cf));
2233  s = StringEndS(); PrintS(s);
2234  Print("*"); omFree(s);
2235  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2236  }
2237  Print(" %d\n", C[rowCount] );
2238  }
2239  PrintS("where H(1) represents the series corresp. to input ideal\n");
2240  PrintS("and i^th summand in the rhs of an eqn. is according\n");
2241  PrintS("to the right colon map corresp. to the i^th variable\n");
2242  }
2243  else
2244  {
2245  for(rowCount = 0; rowCount < lO; rowCount++)
2246  {
2247  Print("H(%d) = ", rowCount+1);
2248  for(colCount = 0; colCount < lV; colCount++)
2249  {
2250  StringSetS(""); nWrite(n_Param(colCount+1, R->cf));
2251  s = StringEndS(); PrintS(s);
2252  Print("*");omFree(s);
2253  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2254  }
2255  Print(" %d\n", C[rowCount] );
2256  }
2257  PrintS("where H(1) represents the series corresp. to input ideal\n");
2258  }
2259  }
2260  PrintLn();
2261  posMat.resize(0);
2262  C.resize(0);
2263  matrix pMat;
2264  matrix lMat;
2265  matrix uMat;
2266  matrix H_serVec = mpNew(lO, 1);
2267  matrix Hnot;
2268 
2269  //std::clock_t start;
2270  //start = std::clock();
2271 
2272  luDecomp(gMat, pMat, lMat, uMat, R);
2273  luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot);
2274 
2275  //to print system solving time
2276  //if(odp){
2277  //std::cout<<"solving time of the system = "<<(std::clock()-start)/(double)(CLOCKS_PER_SEC / 1000)<<" ms"<<std::endl;}
2278 
2279  mp_Delete(&mR, R);
2280  mp_Delete(&u, R);
2281  mp_Delete(&pMat, R);
2282  mp_Delete(&lMat, R);
2283  mp_Delete(&uMat, R);
2284  mp_Delete(&cMat, R);
2285  mp_Delete(&gMat, R);
2286  mp_Delete(&Hnot, R);
2287  //print the Hilbert series and length of the Orbit
2288  PrintLn();
2289  Print("Hilbert series:");
2290  PrintLn();
2291  pWrite(H_serVec->m[0]);
2292  if(!mgrad)
2293  {
2294  omFree(tt[0]);
2295  }
2296  else
2297  {
2298  for(is = lV-1; is >= 0; is--)
2299 
2300  omFree( tt[is]);
2301  }
2302  omFree(tt);
2303  omFree(xx[0]);
2304  omFree(xx);
2305  rChangeCurrRing(r);
2306  rKill(R);
2307 }
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:30
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#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
#define FALSE
Definition: auxiliary.h:94
static int positionInOrbitTruncationCase(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int, int trunDegHs)
Definition: hilb.cc:1680
static ideal minimalMonomialGenSet(ideal I)
Definition: hilb.cc:1774
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:1444
void pWrite(poly p)
Definition: polys.h:302
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:45
#define omAlloc(size)
Definition: omAllocDecl.h:210
void pWrite0(poly p)
Definition: polys.h:303
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:413
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....
Definition: coeffs.h:805
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:636
poly * m
Definition: matpol.h:18
void luDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &uMat, const ring R)
LU-decomposition of a given (m x n)-matrix.
poly p_One(const ring r)
Definition: p_polys.cc:1305
void rKill(ring r)
Definition: ipshell.cc:6119
#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
static int positionInOrbit_FG_Case(ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int, int)
Definition: hilb.cc:1649
static int positionInOrbit_IG_Case(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd, int trunDegHs)
Definition: hilb.cc:1571
int m
Definition: cfEzgcd.cc:121
struct for passing initialization parameters to naInitChar
Definition: transext.h:88
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:883
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:103
void rChangeCurrRing(ring r)
Definition: polys.cc:15
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define omalloc(size)
Definition: omAllocDecl.h:228
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
const CanonicalForm & w
Definition: facAbsFact.cc:55
#define pDelete(p_ptr)
Definition: polys.h:181
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234
int p
Definition: cfModGcd.cc:4019
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition: matpol.cc:196
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:893
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
Definition: hilb.cc:1934
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:1289
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
#define MATELEM(mat, i, j)
Definition: matpol.h:28
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:350
#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:15
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
CanonicalForm b
Definition: cfModGcd.cc:4044
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:14
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

◆ 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
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
scmon * scfmon
Definition: hutil.h:15
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
#define loop
Definition: structs.h:78
CanonicalForm b
Definition: cfModGcd.cc:4044
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:14
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

◆ hInit()

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

Definition at line 34 of file hutil.cc.

35 {
36  id_TestTail(S, currRing, tailRing);
37  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
38 
39 // if (tailRing != currRing)
40  hisModule = id_RankFreeModule(S, currRing, tailRing);
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:15
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1457
int k
Definition: cfEzgcd.cc:92
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
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:14
poly * polyset
Definition: polys.h:254
int i
Definition: cfEzgcd.cc:125
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
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 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:133
#define LEN_MON
Definition: hutil.h:35
monh * monp
Definition: hutil.h:19
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#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 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
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 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
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 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125

◆ 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 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125

◆ 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
int j
Definition: facHensel.cc:105
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:133
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
Variable x
Definition: cfModGcd.cc:4023
static Poly * h
Definition: janet.cc:972
int l
Definition: cfEzgcd.cc:93

◆ 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 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:93

◆ 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 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#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 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:303
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:78
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#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 }
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125

◆ 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
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125
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 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:78
int i
Definition: cfEzgcd.cc:125

◆ RightColonOperation()

ideal RightColonOperation ( ideal  i,
poly  w,
int  lV 
)

Definition at line 2309 of file hilb.cc.

2310 {
2311  /*
2312  * This returns right colon ideal of a monomial two-sided ideal of
2313  * the free associative algebra with respect to a monomial 'w'
2314  * (S:_R w).
2315  */
2316  S = minimalMonomialGenSet(S);
2317  ideal Iw = idInit(1,1);
2318  Iw = colonIdeal(S, w, lV, Iw, 0);
2319  return (Iw);
2320 }
static ideal minimalMonomialGenSet(ideal I)
Definition: hilb.cc:1774
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
const CanonicalForm & w
Definition: facAbsFact.cc:55
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
Definition: hilb.cc:1934

◆ slicehilb()

void slicehilb ( ideal  I)

Definition at line 1131 of file hilb.cc.

1132 {
1133  //printf("Adi changes are here: \n");
1134  int i, NNN = 0;
1135  int steps = 0, prune = 0, moreprune = 0;
1136  mpz_ptr hilbertcoef;
1137  int *hilbpower;
1138  ideal S = idInit(1,1);
1139  poly q = p_One(currRing);
1140  ideal X = idInit(1,1);
1141  X->m[0]=p_One(currRing);
1142  for(i=1;i<=currRing->N;i++)
1143  {
1144  p_SetExp(X->m[0],i,1,currRing);
1145  }
1146  p_Setm(X->m[0],currRing);
1147  I = id_Mult(I,X,currRing);
1148  ideal Itmp = SortByDeg(I);
1149  id_Delete(&I,currRing);
1150  I = Itmp;
1151  //printf("\n-------------RouneSlice--------------\n");
1152  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1153  id_Delete(&X,currRing);
1154  p_Delete(&q,currRing);
1155  //printf("\nIn total Prune got rid of %i elements\n",prune);
1156  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1157  //printf("\nSteps of rouneslice: %i\n\n", steps);
1158  printf("\n// %8d t^0",1);
1159  for(i = 0; i<NNN; i++)
1160  {
1161  if(mpz_sgn(&hilbertcoef[i])!=0)
1162  {
1163  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1164  }
1165  }
1166  PrintLn();
1167  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1168  omFreeSize(hilbpower, (NNN)*sizeof(int));
1169  //printf("\n-------------------------------------\n");
1170 }
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:975
void PrintLn()
Definition: reporter.cc:310
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
void prune(Variable &alpha)
Definition: variable.cc:261
poly p_One(const ring r)
Definition: p_polys.cc:1305
int i
Definition: cfEzgcd.cc:125
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
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:37
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:489
static ideal SortByDeg(ideal I)
Definition: hilb.cc:389
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:234

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 45 of file hutil.h.

◆ stcmem

monf stcmem

Definition at line 45 of file hutil.h.