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 157 of file hutil.cc.

158 {
159  int k = 0;
160  scfmon ex = exist, co = stc;
161  int i;
162 
163  for (i = Nexist; i>0; i--)
164  {
165  if (((**ex) == 0) || ((**ex) == ak))
166  {
167  *co = *ex;
168  co++;
169  k++;
170  }
171  ex++;
172  }
173  *Nstc = k;
174 }
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 999 of file hutil.cc.

1000 {
1001  monf xmem;
1002  int i;
1003  xmem = (monf)omAlloc((Nvar + 1) * sizeof(monp));
1004  for (i = Nvar; i>0; i--)
1005  {
1006  xmem[i] = (monp)omAlloc(LEN_MON);
1007  xmem[i]->mo = NULL;
1008  }
1009  return xmem;
1010 }
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:12

◆ hDegreeSeries()

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

Definition at line 1380 of file hilb.cc.

1381 {
1382  int i, j, k;
1383  int m;
1384  *co = *mu = 0;
1385  if ((s1 == NULL) || (s2 == NULL))
1386  return;
1387  i = s1->length();
1388  j = s2->length();
1389  if (j > i)
1390  return;
1391  m = 0;
1392  for(k=j-2; k>=0; k--)
1393  m += (*s2)[k];
1394  *mu = m;
1395  *co = i - j;
1396 }
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:12
int length() const
Definition: intvec.h:94

◆ hDelete()

void hDelete ( scfmon  ev,
int  ev_length 
)

Definition at line 143 of file hutil.cc.

144 {
145  int i;
146 
147  if (ev_length>0)
148  {
149  for (i=ev_length-1;i>=0;i--)
150  omFreeSize(hsecure[i],((currRing->N)+1)*sizeof(int));
151  omFreeSize(hsecure, ev_length*sizeof(scmon));
152  omFreeSize(ev, ev_length*sizeof(scmon));
153  }
154 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static scfmon hsecure
Definition: hutil.cc:29
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:12

◆ hDimSolve()

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

Definition at line 28 of file hdegree.cc.

30 {
31  int dn, iv, rad0, b, c, x;
32  scmon pn;
33  scfmon rn;
34  if (Nrad < 2)
35  {
36  dn = Npure + Nrad;
37  if (dn < hCo)
38  hCo = dn;
39  return;
40  }
41  if (Npure+1 >= hCo)
42  return;
43  iv = Nvar;
44  while(pure[var[iv]]) iv--;
45  hStepR(rad, Nrad, var, iv, &rad0);
46  if (rad0!=0)
47  {
48  iv--;
49  if (rad0 < Nrad)
50  {
51  pn = hGetpure(pure);
52  rn = hGetmem(Nrad, rad, radmem[iv]);
53  hDimSolve(pn, Npure + 1, rn, rad0, var, iv);
54  b = rad0;
55  c = Nrad;
56  hElimR(rn, &rad0, b, c, var, iv);
57  hPure(rn, b, &c, var, iv, pn, &x);
58  hLex2R(rn, rad0, b, c, var, iv, hwork);
59  rad0 += (c - b);
60  hDimSolve(pn, Npure + x, rn, rad0, var, iv);
61  }
62  else
63  {
64  hDimSolve(pure, Npure, rad, Nrad, var, iv);
65  }
66  }
67  else
68  hCo = Npure + 1;
69 }
void hDimSolve(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:28
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:745
scfmon hwork
Definition: hutil.cc:16
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1026
int hCo
Definition: hdegree.cc:21
scmon hGetpure(scmon p)
Definition: hutil.cc:1055
scmon * scfmon
Definition: hutil.h:15
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:977
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:624
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:883
monf radmem
Definition: hutil.cc:21
Variable x
Definition: cfModGcd.cc:4023

◆ hElimR()

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

Definition at line 745 of file hutil.cc.

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

◆ hElimS()

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

Definition at line 675 of file hutil.cc.

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

◆ hGetmem()

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

Definition at line 1026 of file hutil.cc.

1027 {
1028  scfmon x = monmem->mo;
1029  int lx = monmem->a;
1030  if ((x==NULL) || (lm > lx))
1031  {
1032  /* according to http://www.singular.uni-kl.de:8002/trac/ticket/463#comment:4
1033  * we need to work around a compiler bug:
1034  * if ((x!=NULL)&&(lx>0)) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1035  */
1036  if (x!=NULL) if (lx>0) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1037  monmem->mo = x = (scfmon)omAlloc(lm * sizeof(scmon));
1038  monmem->a = lm;
1039  }
1040  memcpy(x, old, lm * sizeof(scmon));
1041  return x;
1042 }
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:12
Variable x
Definition: cfModGcd.cc:4023

◆ hGetpure()

scmon hGetpure ( scmon  p)

Definition at line 1055 of file hutil.cc.

1056 {
1057  scmon p1 = p;
1058  scmon pn;
1059  p1++;
1060  pn = p1;
1061  pn += (currRing->N);
1062  memcpy(pn, p1, (currRing->N) * sizeof(int));
1063  return pn - 1;
1064 }
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:12
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 1968 of file hilb.cc.

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

497 {
498  int dn, iv, rad0, b, c, x;
499  scmon pn;
500  scfmon rn;
501  if (Nrad < 2)
502  {
503  dn = Npure + Nrad;
504  if (dn > hCo)
505  {
506  if (!Nrad)
507  hCheckIndep(pure);
508  else
509  {
510  pn = *rad;
511  for (iv = Nvar; iv; iv--)
512  {
513  x = var[iv];
514  if (pn[x])
515  {
516  pure[x] = 1;
517  hCheckIndep(pure);
518  pure[x] = 0;
519  }
520  }
521  }
522  }
523  return;
524  }
525  iv = Nvar;
526  while(pure[var[iv]]) iv--;
527  hStepR(rad, Nrad, var, iv, &rad0);
528  iv--;
529  if (rad0 < Nrad)
530  {
531  pn = hGetpure(pure);
532  rn = hGetmem(Nrad, rad, radmem[iv]);
533  pn[var[iv + 1]] = 1;
534  hIndAllMult(pn, Npure + 1, rn, rad0, var, iv);
535  pn[var[iv + 1]] = 0;
536  b = rad0;
537  c = Nrad;
538  hElimR(rn, &rad0, b, c, var, iv);
539  hPure(rn, b, &c, var, iv, pn, &x);
540  hLex2R(rn, rad0, b, c, var, iv, hwork);
541  rad0 += (c - b);
542  hIndAllMult(pn, Npure + x, rn, rad0, var, iv);
543  }
544  else
545  {
546  hIndAllMult(pure, Npure, rad, Nrad, var, iv);
547  }
548 }
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:745
scfmon hwork
Definition: hutil.cc:16
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1026
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:495
int hCo
Definition: hdegree.cc:21
scmon hGetpure(scmon p)
Definition: hutil.cc:1055
scmon * scfmon
Definition: hutil.h:15
static void hCheckIndep(scmon pure)
Definition: hdegree.cc:471
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:977
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:624
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:883
monf radmem
Definition: hutil.cc:21
Variable x
Definition: cfModGcd.cc:4023

◆ hIndMult()

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

Definition at line 312 of file hdegree.cc.

314 {
315  int dn, iv, rad0, b, c, x;
316  scmon pn;
317  scfmon rn;
318  if (Nrad < 2)
319  {
320  dn = Npure + Nrad;
321  if (dn == hCo)
322  {
323  if (Nrad==0)
324  hIndep(pure);
325  else
326  {
327  pn = *rad;
328  for (iv = Nvar; iv!=0; iv--)
329  {
330  x = var[iv];
331  if (pn[x])
332  {
333  pure[x] = 1;
334  hIndep(pure);
335  pure[x] = 0;
336  }
337  }
338  }
339  }
340  return;
341  }
342  iv = Nvar;
343  dn = Npure+1;
344  if (dn >= hCo)
345  {
346  if (dn > hCo)
347  return;
348  loop
349  {
350  if(!pure[var[iv]])
351  {
352  if(hNotZero(rad, Nrad, var, iv))
353  {
354  pure[var[iv]] = 1;
355  hIndep(pure);
356  pure[var[iv]] = 0;
357  }
358  }
359  iv--;
360  if (!iv)
361  return;
362  }
363  }
364  while(pure[var[iv]]) iv--;
365  hStepR(rad, Nrad, var, iv, &rad0);
366  iv--;
367  if (rad0 < Nrad)
368  {
369  pn = hGetpure(pure);
370  rn = hGetmem(Nrad, rad, radmem[iv]);
371  pn[var[iv + 1]] = 1;
372  hIndMult(pn, Npure + 1, rn, rad0, var, iv);
373  pn[var[iv + 1]] = 0;
374  b = rad0;
375  c = Nrad;
376  hElimR(rn, &rad0, b, c, var, iv);
377  hPure(rn, b, &c, var, iv, pn, &x);
378  hLex2R(rn, rad0, b, c, var, iv, hwork);
379  rad0 += (c - b);
380  hIndMult(pn, Npure + x, rn, rad0, var, iv);
381  }
382  else
383  {
384  hIndMult(pure, Npure, rad, Nrad, var, iv);
385  }
386 }
void hElimR(scfmon rad, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:745
scfmon hwork
Definition: hutil.cc:16
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1026
int hCo
Definition: hdegree.cc:21
scmon hGetpure(scmon p)
Definition: hutil.cc:1055
scmon * scfmon
Definition: hutil.h:15
static BOOLEAN hNotZero(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:280
void hStepR(scfmon rad, int Nrad, varset var, int Nvar, int *a)
Definition: hutil.cc:977
#define loop
Definition: structs.h:80
CanonicalForm b
Definition: cfModGcd.cc:4044
static void hIndep(scmon pure)
Definition: hdegree.cc:295
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:312
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:624
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:883
monf radmem
Definition: hutil.cc:21
Variable x
Definition: cfModGcd.cc:4023

◆ hInit()

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

Definition at line 31 of file hutil.cc.

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

◆ hKill()

void hKill ( monf  xmem,
int  Nvar 
)

Definition at line 1013 of file hutil.cc.

1014 {
1015  int i;
1016  for (i = Nvar; i!=0; i--)
1017  {
1018  if (xmem[i]->mo!=NULL)
1019  omFreeSize((ADDRESS)xmem[i]->mo, xmem[i]->a * sizeof(scmon));
1020  omFreeSize((ADDRESS)xmem[i], LEN_MON);
1021  }
1022  omFreeSize((ADDRESS)xmem, (Nvar + 1) * sizeof(monp));
1023 }
#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:12

◆ hLex2R()

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

Definition at line 883 of file hutil.cc.

885 {
886  int j0 = 0, j = 0, i = a2, k, k1;
887  scmon n, o;
888  if (!e1)
889  {
890  for (; i < e2; i++)
891  rad[i - a2] = rad[i];
892  return;
893  }
894  else if (i == e2)
895  return;
896  n = rad[j];
897  o = rad[i];
898  loop
899  {
900  k = Nvar;
901  loop
902  {
903  k1 = var[k];
904  if (!o[k1] && n[k1])
905  {
906  w[j0] = o;
907  j0++;
908  i++;
909  if (i < e2)
910  {
911  o = rad[i];
912  break;
913  }
914  else
915  {
916  for (; j < e1; j++)
917  {
918  w[j0] = rad[j];
919  j0++;
920  }
921  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
922  return;
923  }
924  }
925  else if (o[k1] && !n[k1])
926  {
927  w[j0] = n;
928  j0++;
929  j++;
930  if (j < e1)
931  {
932  n = rad[j];
933  break;
934  }
935  else
936  {
937  for (; i < e2; i++)
938  {
939  w[j0] = rad[i];
940  j0++;
941  }
942  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
943  return;
944  }
945  }
946  k--;
947  }
948  }
949 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
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 815 of file hutil.cc.

817 {
818  int j0 = 0, j = 0, i = a2, k, k1;
819  scmon n, o;
820  if (!e1)
821  {
822  for (; i < e2; i++)
823  rad[i - a2] = rad[i];
824  return;
825  } else if (i == e2)
826  return;
827  n = rad[j];
828  o = rad[i];
829  loop
830  {
831  k = Nvar;
832  loop
833  {
834  k1 = var[k];
835  if (o[k1] < n[k1])
836  {
837  w[j0] = o;
838  j0++;
839  i++;
840  if (i < e2)
841  {
842  o = rad[i];
843  break;
844  }
845  else
846  {
847  for (; j < e1; j++)
848  {
849  w[j0] = rad[j];
850  j0++;
851  }
852  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
853  return;
854  }
855  }
856  else if (o[k1] > n[k1])
857  {
858  w[j0] = n;
859  j0++;
860  j++;
861  if (j < e1)
862  {
863  n = rad[j];
864  break;
865  }
866  else
867  {
868  for (; i < e2; i++)
869  {
870  w[j0] = rad[i];
871  j0++;
872  }
873  memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
874  return;
875  }
876  }
877  k--;
878  }
879  }
880 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
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 568 of file hutil.cc.

569 {
570  int j = 1, i = 0, k, k1;
571  scmon n, o;
572  if (Nrad < 2)
573  return;
574  n = rad[j];
575  o = rad[0];
576  k = Nvar;
577  loop
578  {
579  k1 = var[k];
580  if (!o[k1] && n[k1])
581  {
582  i++;
583  if (i < j)
584  {
585  o = rad[i];
586  k = Nvar;
587  }
588  else
589  {
590  j++;
591  if (j < Nrad)
592  {
593  i = 0;
594  o = rad[0];
595  n = rad[j];
596  k = Nvar;
597  }
598  else
599  return;
600  }
601  }
602  else if (o[k1] && !n[k1])
603  {
604  for (k = j; k > i; k--)
605  rad[k] = rad[k - 1];
606  rad[i] = n;
607  j++;
608  if (j < Nrad)
609  {
610  i = 0;
611  o = rad[0];
612  n = rad[j];
613  k = Nvar;
614  }
615  else
616  return;
617  }
618  else
619  k--;
620  }
621 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
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 509 of file hutil.cc.

510 {
511  if (Nstc < 2)
512  return;
513  int j = 1, i = 0;
514  scmon n = stc[j];
515  scmon o = stc[0];
516  int k = Nvar;
517  loop
518  {
519  int k1 = var[k];
520  if (o[k1] < n[k1])
521  {
522  i++;
523  if (i < j)
524  {
525  o = stc[i];
526  k = Nvar;
527  }
528  else
529  {
530  j++;
531  if (j < Nstc)
532  {
533  i = 0;
534  o = stc[0];
535  n = stc[j];
536  k = Nvar;
537  }
538  else
539  return;
540  }
541  }
542  else if (o[k1] > n[k1])
543  {
544  int tmp_k;
545  for (tmp_k = j; tmp_k > i; tmp_k--)
546  stc[tmp_k] = stc[tmp_k - 1];
547  stc[i] = n;
548  j++;
549  if (j < Nstc)
550  {
551  i = 0;
552  o = stc[0];
553  n = stc[j];
554  k = Nvar;
555  }
556  else
557  return;
558  }
559  else
560  {
561  k--;
562  if (k<=0) return;
563  }
564  }
565 }
int j
Definition: facHensel.cc:105
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
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 205 of file hutil.cc.

206 {
207  int i, i1, j, jj, k, l;
208  int x;
209  scmon temp, count;
210  float o, h, g, *v1;
211 
212  v1 = (float *)omAlloc(Nvar * sizeof(float));
213  temp = (int *)omAlloc(Nstc * sizeof(int));
214  count = (int *)omAlloc(Nstc * sizeof(int));
215  for (i = 1; i <= Nvar; i++)
216  {
217  i1 = var[i];
218  *temp = stc[0][i1];
219  *count = 1;
220  jj = 1;
221  for (j = 1; j < Nstc; j++)
222  {
223  x = stc[j][i1];
224  k = 0;
225  loop
226  {
227  if (x > temp[k])
228  {
229  k++;
230  if (k == jj)
231  {
232  temp[k] = x;
233  count[k] = 1;
234  jj++;
235  break;
236  }
237  }
238  else if (x < temp[k])
239  {
240  for (l = jj; l > k; l--)
241  {
242  temp[l] = temp[l-1];
243  count[l] = count[l-1];
244  }
245  temp[k] = x;
246  count[k] = 1;
247  jj++;
248  break;
249  }
250  else
251  {
252  count[k]++;
253  break;
254  }
255  }
256  }
257  h = 0.0;
258  o = (float)Nstc/(float)jj;
259  for(j = 0; j < jj; j++)
260  {
261  g = (float)count[j];
262  if (g > o)
263  g -= o;
264  else
265  g = o - g;
266  if (g > h)
267  h = g;
268  }
269  v1[i-1] = h * (float)jj;
270  }
271  omFreeSize((ADDRESS)count, Nstc * sizeof(int));
272  omFreeSize((ADDRESS)temp, Nstc * sizeof(int));
273  for (i = 1; i < Nvar; i++)
274  {
275  i1 = var[i+1];
276  h = v1[i];
277  j = 0;
278  loop
279  {
280  if (h > v1[j])
281  {
282  for (l = i; l > j; l--)
283  {
284  v1[l] = v1[l-1];
285  var[l+1] = var[l];
286  }
287  v1[j] = h;
288  var[j+1] = i1;
289  break;
290  }
291  j++;
292  if (j == i)
293  break;
294  }
295  }
296  omFreeSize((ADDRESS)v1, Nvar * sizeof(float));
297 }
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:80
#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:971
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 624 of file hutil.cc.

626 {
627  int nc = *Nstc, np = 0, nq = 0, j, i, i1, c, l;
628  scmon x;
629  for (j = a; j < nc; j++)
630  {
631  x = stc[j];
632  i = Nvar;
633  c = 2;
634  l = 0;
635  loop
636  {
637  i1 = var[i];
638  if (x[i1])
639  {
640  c--;
641  if (!c)
642  {
643  l = 0;
644  break;
645  }
646  else if (c == 1)
647  l = i1;
648  }
649  i--;
650  if (!i)
651  break;
652  }
653  if (l)
654  {
655  if (!pure[l])
656  {
657  np++;
658  pure[l] = x[l];
659  }
660  else if (x[l] < pure[l])
661  pure[l] = x[l];
662  stc[j] = NULL;
663  nq++;
664  }
665  }
666  *Npure = np;
667  if (nq!=0)
668  {
669  *Nstc -= nq;
670  hShrink(stc, a, nc);
671  }
672 }
int j
Definition: facHensel.cc:105
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:300
#define loop
Definition: structs.h:80
int * scmon
Definition: hutil.h:14
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:93

◆ hRadical()

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

Definition at line 414 of file hutil.cc.

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

◆ hStaircase()

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

Definition at line 316 of file hutil.cc.

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

◆ hStepR()

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

Definition at line 977 of file hutil.cc.

978 {
979  int k1, i;
980  k1 = var[Nvar];
981  i = 0;
982  loop
983  {
984  if (rad[i][k1])
985  {
986  *a = i;
987  return;
988  }
989  i++;
990  if (i == Nrad)
991  {
992  *a = i;
993  return;
994  }
995  }
996 }
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125

◆ hStepS()

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

Definition at line 952 of file hutil.cc.

953 {
954  int k1, i;
955  int y;
956  k1 = var[Nvar];
957  y = *x;
958  i = *a;
959  loop
960  {
961  if (y < stc[i][k1])
962  {
963  *a = i;
964  *x = stc[i][k1];
965  return;
966  }
967  i++;
968  if (i == Nstc)
969  {
970  *a = i;
971  return;
972  }
973  }
974 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
#define loop
Definition: structs.h:80
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 177 of file hutil.cc.

178 {
179  int nv, i0, i1, i, j;
180  nv = i0 = *Nvar;
181  i1 = 0;
182  for (i = 1; i <= nv; i++)
183  {
184  j = 0;
185  loop
186  {
187  if (stc[j][i]>0)
188  {
189  i1++;
190  var[i1] = i;
191  break;
192  }
193  j++;
194  if (j == Nstc)
195  {
196  var[i0] = i;
197  i0--;
198  break;
199  }
200  }
201  }
202  *Nvar = i1;
203 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125

◆ RightColonOperation()

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

Definition at line 2308 of file hilb.cc.

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

◆ slicehilb()

void slicehilb ( ideal  I)

Definition at line 1130 of file hilb.cc.

1131 {
1132  //printf("Adi changes are here: \n");
1133  int i, NNN = 0;
1134  int steps = 0, prune = 0, moreprune = 0;
1135  mpz_ptr hilbertcoef;
1136  int *hilbpower;
1137  ideal S = idInit(1,1);
1138  poly q = p_One(currRing);
1139  ideal X = idInit(1,1);
1140  X->m[0]=p_One(currRing);
1141  for(i=1;i<=currRing->N;i++)
1142  {
1143  p_SetExp(X->m[0],i,1,currRing);
1144  }
1145  p_Setm(X->m[0],currRing);
1146  I = id_Mult(I,X,currRing);
1147  ideal Itmp = SortByDeg(I);
1148  id_Delete(&I,currRing);
1149  I = Itmp;
1150  //printf("\n-------------RouneSlice--------------\n");
1151  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1152  id_Delete(&X,currRing);
1153  p_Delete(&q,currRing);
1154  //printf("\nIn total Prune got rid of %i elements\n",prune);
1155  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1156  //printf("\nSteps of rouneslice: %i\n\n", steps);
1157  printf("\n// %8d t^0",1);
1158  for(i = 0; i<NNN; i++)
1159  {
1160  if(mpz_sgn(&hilbertcoef[i])!=0)
1161  {
1162  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1163  }
1164  }
1165  PrintLn();
1166  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1167  omFreeSize(hilbpower, (NNN)*sizeof(int));
1168  //printf("\n-------------------------------------\n");
1169 }
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:974
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:1303
int i
Definition: cfEzgcd.cc:125
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:856
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:35
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:487
static ideal SortByDeg(ideal I)
Definition: hilb.cc:388
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:232

Variable Documentation

◆ hCo

int hCo

Definition at line 21 of file hdegree.cc.

◆ hexist

scfmon hexist

Definition at line 16 of file hutil.cc.

◆ hisModule

int hisModule

Definition at line 20 of file hutil.cc.

◆ hMu

int hMu

Definition at line 21 of file hdegree.cc.

◆ hMu2

int hMu2

Definition at line 21 of file hdegree.cc.

◆ hNexist

int hNexist

Definition at line 19 of file hutil.cc.

◆ hNpure

int hNpure

Definition at line 19 of file hutil.cc.

◆ hNrad

int hNrad

Definition at line 19 of file hutil.cc.

◆ hNstc

int hNstc

Definition at line 19 of file hutil.cc.

◆ hNvar

int hNvar

Definition at line 19 of file hutil.cc.

◆ hpur0

scmon hpur0

Definition at line 17 of file hutil.cc.

◆ hpure

scmon hpure

Definition at line 17 of file hutil.cc.

◆ hrad

scfmon hrad

Definition at line 16 of file hutil.cc.

◆ hsel

varset hsel

Definition at line 18 of file hutil.cc.

◆ hstc

scfmon hstc

Definition at line 16 of file hutil.cc.

◆ hvar

varset hvar

Definition at line 18 of file hutil.cc.

◆ hwork

scfmon hwork

Definition at line 16 of file hutil.cc.

◆ indlist_bin

omBin indlist_bin

Definition at line 22 of file hdegree.cc.

◆ ISet

indset ISet

Definition at line 278 of file hdegree.cc.

◆ JSet

indset JSet

Definition at line 278 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.