My Project
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

EXTERN_VAR omBin indlist_bin
 
EXTERN_VAR scfmon hexist
 
EXTERN_VAR scfmon hstc
 
EXTERN_VAR scfmon hrad
 
EXTERN_VAR scfmon hwork
 
EXTERN_VAR scmon hpure
 
EXTERN_VAR scmon hpur0
 
EXTERN_VAR varset hvar
 
EXTERN_VAR varset hsel
 
EXTERN_VAR int hNexist
 
EXTERN_VAR int hNstc
 
EXTERN_VAR int hNrad
 
EXTERN_VAR int hNvar
 
EXTERN_VAR int hNpure
 
EXTERN_VAR monf stcmem
 
EXTERN_VAR monf radmem
 
EXTERN_VAR int hisModule
 
EXTERN_VAR indset ISet
 
EXTERN_VAR indset JSet
 
EXTERN_VAR int hCo
 
EXTERN_VAR int hMu
 
EXTERN_VAR 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 }
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
scmon * scfmon
Definition: hutil.h:15

◆ 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 }
#define LEN_MON
Definition: hutil.h:35
monh * monp
Definition: hutil.h:19
monp * monf
Definition: hutil.h:20
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:12

◆ hDegreeSeries()

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

Definition at line 1418 of file hilb.cc.

1419 {
1420  int i, j, k;
1421  int m;
1422  *co = *mu = 0;
1423  if ((s1 == NULL) || (s2 == NULL))
1424  return;
1425  i = s1->length();
1426  j = s2->length();
1427  if (j > i)
1428  return;
1429  m = 0;
1430  for(k=j-2; k>=0; k--)
1431  m += (*s2)[k];
1432  *mu = m;
1433  *co = i - j;
1434 }
int m
Definition: cfEzgcd.cc:128
void mu(int **points, int sizePoints)
int length() const
Definition: intvec.h:94
int j
Definition: facHensel.cc:110

◆ 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 }
STATIC_VAR scfmon hsecure
Definition: hutil.cc:29
int * scmon
Definition: hutil.h:14
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
VAR 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 34 of file hdegree.cc.

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

◆ 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 }
static void hShrink(scfmon co, int a, int Nco)
Definition: hutil.cc:300
#define loop
Definition: structs.h:79

◆ 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 }

◆ 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 }
void * ADDRESS
Definition: auxiliary.h:119

◆ 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 p
Definition: cfModGcd.cc:4078

◆ HilbertSeries_OrbitData()

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

Definition at line 2012 of file hilb.cc.

2013 {
2014 
2015  /* new story:
2016  no lV is needed, i.e. it is to be determined
2017  the rest is extracted from the interface input list in extra.cc and makes the input of this proc
2018  called from extra.cc
2019  */
2020 
2021  /*
2022  * This is based on iterative right colon operations on a
2023  * two-sided monomial ideal of the free associative algebra.
2024  * The algorithm terminates for those monomial ideals
2025  * whose monomials define "regular formal languages",
2026  * that is, all monomials of the input ideal can be obtained
2027  * from finite languages by applying finite number of
2028  * rational operations.
2029  */
2030 
2031  int trInd;
2032  S = minimalMonomialGenSet(S);
2033  if( !idIs0(S) && p_Totaldegree(S->m[0], currRing)==0)
2034  {
2035  PrintS("Hilbert Series:\n 0\n");
2036  return;
2037  }
2038  int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int, int);
2039  if(trunDegHs != 0)
2040  {
2041  Print("\nTruncation degree = %d\n",trunDegHs);
2043  }
2044  else
2045  {
2046  if(IG_CASE)
2047  {
2048  if(idIs0(S))
2049  {
2050  WerrorS("wrong input: it is not an infinitely gen. case");
2051  return;
2052  }
2053  trInd = p_Totaldegree(S->m[IDELEMS(S)-1], currRing);
2054  POS = &positionInOrbit_IG_Case;
2055  }
2056  else
2057  POS = &positionInOrbit_FG_Case;
2058  }
2059  std::vector<ideal > idorb;
2060  std::vector< poly > polist;
2061 
2062  ideal orb_init = idInit(1, 1);
2063  idorb.push_back(orb_init);
2064 
2065  polist.push_back( p_One(currRing));
2066 
2067  std::vector< std::vector<int> > posMat;
2068  std::vector<int> posRow(lV,0);
2069  std::vector<int> C;
2070 
2071  int ds, is, ps;
2072  unsigned long lpcnt = 0;
2073 
2074  poly w, wi;
2075  ideal Jwi;
2076 
2077  while(lpcnt < idorb.size())
2078  {
2079  w = NULL;
2080  w = polist[lpcnt];
2081  if(lpcnt >= 1 && idIs0(idorb[lpcnt]) == FALSE)
2082  {
2083  if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
2084  {
2085  C.push_back(1);
2086  }
2087  else
2088  C.push_back(0);
2089  }
2090  else
2091  {
2092  C.push_back(1);
2093  }
2094 
2095  ds = p_Totaldegree(w, currRing);
2096  lpcnt++;
2097 
2098  for(is = 1; is <= lV; is++)
2099  {
2100  wi = NULL;
2101  //make new copy 'wi' of word w=polist[lpcnt]
2102  //and update it (for the colon operation).
2103  //if corresponding to wi, right colon operation gives
2104  //a new (right colon) ideal of S,
2105  //keep 'wi' in the polist else delete it
2106 
2107  wi = pCopy(w);
2108  p_SetExp(wi, (ds*lV)+is, 1, currRing);
2109  p_Setm(wi, currRing);
2110  Jwi = NULL;
2111  //Jwi stores (right) colon ideal of S w.r.t. word
2112  //wi if colon operation gives a new ideal place it
2113  //in the vector of ideals 'idorb'
2114  //otherwise delete it
2115 
2116  Jwi = idInit(1,1);
2117 
2118  Jwi = colonIdeal(S, wi, lV, Jwi, trunDegHs);
2119  ps = (*POS)(Jwi, wi, idorb, polist, trInd, trunDegHs);
2120 
2121  if(ps == 0) // finds a new ideal
2122  {
2123  posRow[is-1] = idorb.size();
2124 
2125  idorb.push_back(Jwi);
2126  polist.push_back(wi);
2127  }
2128  else // ideal is already there in the set
2129  {
2130  posRow[is-1]=ps-1;
2131  idDelete(&Jwi);
2132  pDelete(&wi);
2133  }
2134  }
2135  posMat.push_back(posRow);
2136  posRow.resize(lV,0);
2137  }
2138  int lO = C.size();//size of the orbit
2139  PrintLn();
2140  Print("maximal length of words = %ld\n", p_Totaldegree(polist[lO-1], currRing));
2141  Print("\nlength of the Orbit = %d", lO);
2142  PrintLn();
2143 
2144  if(odp)
2145  {
2146  Print("words description of the Orbit: \n");
2147  for(is = 0; is < lO; is++)
2148  {
2149  pWrite0(polist[is]);
2150  PrintS(" ");
2151  }
2152  PrintLn();
2153  PrintS("\nmaximal degree, #(sum_j R(w,w_j))");
2154  PrintLn();
2155  for(is = 0; is < lO; is++)
2156  {
2157  if(idIs0(idorb[is]))
2158  {
2159  PrintS("NULL\n");
2160  }
2161  else
2162  {
2163  Print("%ld, %d \n",p_Totaldegree(idorb[is]->m[IDELEMS(idorb[is])-1], currRing),IDELEMS(idorb[is]));
2164  }
2165  }
2166  }
2167 
2168  for(is = idorb.size()-1; is >= 0; is--)
2169  {
2170  idDelete(&idorb[is]);
2171  }
2172  for(is = polist.size()-1; is >= 0; is--)
2173  {
2174  pDelete(&polist[is]);
2175  }
2176 
2177  idorb.resize(0);
2178  polist.resize(0);
2179 
2180  int adjMatrix[lO][lO];
2181  memset(adjMatrix, 0, lO*lO*sizeof(int));
2182  int rowCount, colCount;
2183  int tm = 0;
2184  if(!mgrad)
2185  {
2186  for(rowCount = 0; rowCount < lO; rowCount++)
2187  {
2188  for(colCount = 0; colCount < lV; colCount++)
2189  {
2190  tm = posMat[rowCount][colCount];
2191  adjMatrix[rowCount][tm] = adjMatrix[rowCount][tm] + 1;
2192  }
2193  }
2194  }
2195 
2196  ring r = currRing;
2197  int npar;
2198  char** tt;
2199  TransExtInfo p;
2200  if(!mgrad)
2201  {
2202  tt=(char**)omAlloc(sizeof(char*));
2203  tt[0] = omStrDup("t");
2204  npar = 1;
2205  }
2206  else
2207  {
2208  tt=(char**)omalloc(lV*sizeof(char*));
2209  for(is = 0; is < lV; is++)
2210  {
2211  tt[is] = (char*)omAlloc(7*sizeof(char)); //if required enlarge it later
2212  sprintf (tt[is], "t%d", is+1);
2213  }
2214  npar = lV;
2215  }
2216 
2217  p.r = rDefault(0, npar, tt);
2219  char** xx = (char**)omAlloc(sizeof(char*));
2220  xx[0] = omStrDup("x");
2221  ring R = rDefault(cf, 1, xx);
2222  rChangeCurrRing(R);//rWrite(R);
2223  /*
2224  * matrix corresponding to the orbit of the ideal
2225  */
2226  matrix mR = mpNew(lO, lO);
2227  matrix cMat = mpNew(lO,1);
2228  poly rc;
2229 
2230  if(!mgrad)
2231  {
2232  for(rowCount = 0; rowCount < lO; rowCount++)
2233  {
2234  for(colCount = 0; colCount < lO; colCount++)
2235  {
2236  if(adjMatrix[rowCount][colCount] != 0)
2237  {
2238  MATELEM(mR, rowCount + 1, colCount + 1) = p_ISet(adjMatrix[rowCount][colCount], R);
2239  p_SetCoeff(MATELEM(mR, rowCount + 1, colCount + 1), n_Mult(pGetCoeff(mR->m[lO*rowCount+colCount]),n_Param(1, R->cf), R->cf), R);
2240  }
2241  }
2242  }
2243  }
2244  else
2245  {
2246  for(rowCount = 0; rowCount < lO; rowCount++)
2247  {
2248  for(colCount = 0; colCount < lV; colCount++)
2249  {
2250  rc=NULL;
2251  rc=p_One(R);
2252  p_SetCoeff(rc, n_Mult(pGetCoeff(rc), n_Param(colCount+1, R->cf),R->cf), R);
2253  MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1)=p_Add_q(rc,MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1), R);
2254  }
2255  }
2256  }
2257 
2258  for(rowCount = 0; rowCount < lO; rowCount++)
2259  {
2260  if(C[rowCount] != 0)
2261  {
2262  MATELEM(cMat, rowCount + 1, 1) = p_ISet(C[rowCount], R);
2263  }
2264  }
2265 
2266  matrix u;
2267  unitMatrix(lO, u); //unit matrix
2268  matrix gMat = mp_Sub(u, mR, R);
2269 
2270  char* s;
2271 
2272  if(odp)
2273  {
2274  PrintS("\nlinear system:\n");
2275  if(!mgrad)
2276  {
2277  for(rowCount = 0; rowCount < lO; rowCount++)
2278  {
2279  Print("H(%d) = ", rowCount+1);
2280  for(colCount = 0; colCount < lV; colCount++)
2281  {
2282  StringSetS(""); nWrite(n_Param(1, R->cf));
2283  s = StringEndS(); PrintS(s);
2284  Print("*"); omFree(s);
2285  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2286  }
2287  Print(" %d\n", C[rowCount] );
2288  }
2289  PrintS("where H(1) represents the series corresp. to input ideal\n");
2290  PrintS("and i^th summand in the rhs of an eqn. is according\n");
2291  PrintS("to the right colon map corresp. to the i^th variable\n");
2292  }
2293  else
2294  {
2295  for(rowCount = 0; rowCount < lO; rowCount++)
2296  {
2297  Print("H(%d) = ", rowCount+1);
2298  for(colCount = 0; colCount < lV; colCount++)
2299  {
2300  StringSetS(""); nWrite(n_Param(colCount+1, R->cf));
2301  s = StringEndS(); PrintS(s);
2302  Print("*");omFree(s);
2303  Print("H(%d) + ", posMat[rowCount][colCount] + 1);
2304  }
2305  Print(" %d\n", C[rowCount] );
2306  }
2307  PrintS("where H(1) represents the series corresp. to input ideal\n");
2308  }
2309  }
2310  PrintLn();
2311  posMat.resize(0);
2312  C.resize(0);
2313  matrix pMat;
2314  matrix lMat;
2315  matrix uMat;
2316  matrix H_serVec = mpNew(lO, 1);
2317  matrix Hnot;
2318 
2319  //std::clock_t start;
2320  //start = std::clock();
2321 
2322  luDecomp(gMat, pMat, lMat, uMat, R);
2323  luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot);
2324 
2325  //to print system solving time
2326  //if(odp){
2327  //std::cout<<"solving time of the system = "<<(std::clock()-start)/(double)(CLOCKS_PER_SEC / 1000)<<" ms"<<std::endl;}
2328 
2329  mp_Delete(&mR, R);
2330  mp_Delete(&u, R);
2331  mp_Delete(&pMat, R);
2332  mp_Delete(&lMat, R);
2333  mp_Delete(&uMat, R);
2334  mp_Delete(&cMat, R);
2335  mp_Delete(&gMat, R);
2336  mp_Delete(&Hnot, R);
2337  //print the Hilbert series and length of the Orbit
2338  PrintLn();
2339  Print("Hilbert series:");
2340  PrintLn();
2341  pWrite(H_serVec->m[0]);
2342  if(!mgrad)
2343  {
2344  omFree(tt[0]);
2345  }
2346  else
2347  {
2348  for(is = lV-1; is >= 0; is--)
2349 
2350  omFree( tt[is]);
2351  }
2352  omFree(tt);
2353  omFree(xx[0]);
2354  omFree(xx);
2355  rChangeCurrRing(r);
2356  rKill(R);
2357 }
#define FALSE
Definition: auxiliary.h:96
CanonicalForm cf
Definition: cfModGcd.cc:4083
poly * m
Definition: matpol.h:18
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
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:783
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:354
#define Print
Definition: emacs.cc:80
const CanonicalForm int s
Definition: facAbsFact.cc:51
const CanonicalForm & w
Definition: facAbsFact.cc:51
void WerrorS(const char *s)
Definition: feFopen.cc:24
static int positionInOrbitTruncationCase(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int, int trunDegHs)
Definition: hilb.cc:1723
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
Definition: hilb.cc:1977
static int positionInOrbit_FG_Case(ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int, int)
Definition: hilb.cc:1692
static int positionInOrbit_IG_Case(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd, int)
Definition: hilb.cc:1614
static ideal minimalMonomialGenSet(ideal I)
Definition: hilb.cc:1817
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void rKill(ring r)
Definition: ipshell.cc:6174
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.
void luDecomp(const matrix aMat, matrix &pMat, matrix &lMat, matrix &uMat, const ring R)
LU-decomposition of a given (m x n)-matrix.
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...
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:880
matrix mp_Sub(matrix a, matrix b, const ring R)
Definition: matpol.cc:196
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
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
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nWrite(n)
Definition: numbers.h:29
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omalloc(size)
Definition: omAllocDecl.h:228
#define omFree(addr)
Definition: omAllocDecl.h:261
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1293
poly p_One(const ring r)
Definition: p_polys.cc:1309
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:908
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:488
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:412
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1479
void rChangeCurrRing(ring r)
Definition: polys.cc:15
#define pDelete(p_ptr)
Definition: polys.h:186
void pWrite0(poly p)
Definition: polys.h:309
void pWrite(poly p)
Definition: polys.h:308
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
void StringSetS(const char *st)
Definition: reporter.cc:128
void PrintS(const char *s)
Definition: reporter.cc:284
char * StringEndS()
Definition: reporter.cc:151
void PrintLn()
Definition: reporter.cc:310
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
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define IDELEMS(i)
Definition: simpleideals.h:23
#define R
Definition: sirandom.c:27
struct for passing initialization parameters to naInitChar
Definition: transext.h:88

◆ hIndAllMult()

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

Definition at line 569 of file hdegree.cc.

571 {
572  int dn, iv, rad0, b, c, x;
573  scmon pn;
574  scfmon rn;
575  if (Nrad < 2)
576  {
577  dn = Npure + Nrad;
578  if (dn > hCo)
579  {
580  if (!Nrad)
581  hCheckIndep(pure);
582  else
583  {
584  pn = *rad;
585  for (iv = Nvar; iv; iv--)
586  {
587  x = var[iv];
588  if (pn[x])
589  {
590  pure[x] = 1;
591  hCheckIndep(pure);
592  pure[x] = 0;
593  }
594  }
595  }
596  }
597  return;
598  }
599  iv = Nvar;
600  while(pure[var[iv]]) iv--;
601  hStepR(rad, Nrad, var, iv, &rad0);
602  iv--;
603  if (rad0 < Nrad)
604  {
605  pn = hGetpure(pure);
606  rn = hGetmem(Nrad, rad, radmem[iv]);
607  pn[var[iv + 1]] = 1;
608  hIndAllMult(pn, Npure + 1, rn, rad0, var, iv);
609  pn[var[iv + 1]] = 0;
610  b = rad0;
611  c = Nrad;
612  hElimR(rn, &rad0, b, c, var, iv);
613  hPure(rn, b, &c, var, iv, pn, &x);
614  hLex2R(rn, rad0, b, c, var, iv, hwork);
615  rad0 += (c - b);
616  hIndAllMult(pn, Npure + x, rn, rad0, var, iv);
617  }
618  else
619  {
620  hIndAllMult(pure, Npure, rad, Nrad, var, iv);
621  }
622 }
static void hCheckIndep(scmon pure)
Definition: hdegree.cc:545
void hIndAllMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:569

◆ hIndMult()

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

Definition at line 386 of file hdegree.cc.

388 {
389  int dn, iv, rad0, b, c, x;
390  scmon pn;
391  scfmon rn;
392  if (Nrad < 2)
393  {
394  dn = Npure + Nrad;
395  if (dn == hCo)
396  {
397  if (Nrad==0)
398  hIndep(pure);
399  else
400  {
401  pn = *rad;
402  for (iv = Nvar; iv!=0; iv--)
403  {
404  x = var[iv];
405  if (pn[x])
406  {
407  pure[x] = 1;
408  hIndep(pure);
409  pure[x] = 0;
410  }
411  }
412  }
413  }
414  return;
415  }
416  iv = Nvar;
417  dn = Npure+1;
418  if (dn >= hCo)
419  {
420  if (dn > hCo)
421  return;
422  loop
423  {
424  if(!pure[var[iv]])
425  {
426  if(hNotZero(rad, Nrad, var, iv))
427  {
428  pure[var[iv]] = 1;
429  hIndep(pure);
430  pure[var[iv]] = 0;
431  }
432  }
433  iv--;
434  if (!iv)
435  return;
436  }
437  }
438  while(pure[var[iv]]) iv--;
439  hStepR(rad, Nrad, var, iv, &rad0);
440  iv--;
441  if (rad0 < Nrad)
442  {
443  pn = hGetpure(pure);
444  rn = hGetmem(Nrad, rad, radmem[iv]);
445  pn[var[iv + 1]] = 1;
446  hIndMult(pn, Npure + 1, rn, rad0, var, iv);
447  pn[var[iv + 1]] = 0;
448  b = rad0;
449  c = Nrad;
450  hElimR(rn, &rad0, b, c, var, iv);
451  hPure(rn, b, &c, var, iv, pn, &x);
452  hLex2R(rn, rad0, b, c, var, iv, hwork);
453  rad0 += (c - b);
454  hIndMult(pn, Npure + x, rn, rad0, var, iv);
455  }
456  else
457  {
458  hIndMult(pure, Npure, rad, Nrad, var, iv);
459  }
460 }
void hIndMult(scmon pure, int Npure, scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:386
static BOOLEAN hNotZero(scfmon rad, int Nrad, varset var, int Nvar)
Definition: hdegree.cc:354
static void hIndep(scmon pure)
Definition: hdegree.cc:369

◆ 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 }
VAR int hisModule
Definition: hutil.cc:20
STATIC_VAR jList * Q
Definition: janet.cc:30
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1492
poly * polyset
Definition: polys.h:259
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:77

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 l
Definition: cfEzgcd.cc:100
g
Definition: cfModGcd.cc:4090
STATIC_VAR Poly * h
Definition: janet.cc:971
int status int void size_t count
Definition: si_signals.h:59

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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 }

◆ 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:53

◆ 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 }

◆ RightColonOperation()

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

Definition at line 2359 of file hilb.cc.

2360 {
2361  /*
2362  * This returns right colon ideal of a monomial two-sided ideal of
2363  * the free associative algebra with respect to a monomial 'w'
2364  * (S:_R w).
2365  */
2366  S = minimalMonomialGenSet(S);
2367  ideal Iw = idInit(1,1);
2368  Iw = colonIdeal(S, w, lV, Iw, 0);
2369  return (Iw);
2370 }

◆ slicehilb()

void slicehilb ( ideal  I)

Definition at line 1168 of file hilb.cc.

1169 {
1170  //printf("Adi changes are here: \n");
1171  int i, NNN = 0;
1172  int steps = 0, prune = 0, moreprune = 0;
1173  mpz_ptr hilbertcoef;
1174  int *hilbpower;
1175  ideal S = idInit(1,1);
1176  poly q = p_One(currRing);
1177  ideal X = idInit(1,1);
1178  X->m[0]=p_One(currRing);
1179  for(i=1;i<=currRing->N;i++)
1180  {
1181  p_SetExp(X->m[0],i,1,currRing);
1182  }
1183  p_Setm(X->m[0],currRing);
1184  I = id_Mult(I,X,currRing);
1185  ideal Itmp = SortByDeg(I);
1186  id_Delete(&I,currRing);
1187  I = Itmp;
1188  //printf("\n-------------RouneSlice--------------\n");
1189  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1190  id_Delete(&X,currRing);
1191  p_Delete(&q,currRing);
1192  //printf("\nIn total Prune got rid of %i elements\n",prune);
1193  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1194  //printf("\nSteps of rouneslice: %i\n\n", steps);
1195  printf("\n// %8d t^0",1);
1196  for(i = 0; i<NNN; i++)
1197  {
1198  if(mpz_sgn(&hilbertcoef[i])!=0)
1199  {
1200  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1201  }
1202  }
1203  PrintLn();
1204  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1205  omFreeSize(hilbpower, (NNN)*sizeof(int));
1206  //printf("\n-------------------------------------\n");
1207 }
void FACTORY_PUBLIC prune(Variable &alpha)
Definition: variable.cc:261
static ideal SortByDeg(ideal I)
Definition: hilb.cc:426
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:1012
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:873
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
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...

Variable Documentation

◆ hCo

EXTERN_VAR int hCo

Definition at line 47 of file hutil.h.

◆ hexist

Definition at line 39 of file hutil.h.

◆ hisModule

EXTERN_VAR int hisModule

Definition at line 44 of file hutil.h.

◆ hMu

EXTERN_VAR int hMu

Definition at line 47 of file hutil.h.

◆ hMu2

EXTERN_VAR int hMu2

Definition at line 47 of file hutil.h.

◆ hNexist

EXTERN_VAR int hNexist

Definition at line 42 of file hutil.h.

◆ hNpure

EXTERN_VAR int hNpure

Definition at line 42 of file hutil.h.

◆ hNrad

EXTERN_VAR int hNrad

Definition at line 42 of file hutil.h.

◆ hNstc

EXTERN_VAR int hNstc

Definition at line 42 of file hutil.h.

◆ hNvar

EXTERN_VAR int hNvar

Definition at line 42 of file hutil.h.

◆ hpur0

Definition at line 40 of file hutil.h.

◆ hpure

Definition at line 40 of file hutil.h.

◆ hrad

Definition at line 39 of file hutil.h.

◆ hsel

Definition at line 41 of file hutil.h.

◆ hstc

Definition at line 39 of file hutil.h.

◆ hvar

Definition at line 41 of file hutil.h.

◆ hwork

Definition at line 39 of file hutil.h.

◆ indlist_bin

EXTERN_VAR omBin indlist_bin

Definition at line 37 of file hutil.h.

◆ ISet

Definition at line 46 of file hutil.h.

◆ JSet

Definition at line 46 of file hutil.h.

◆ radmem

EXTERN_VAR monf radmem

Definition at line 43 of file hutil.h.

◆ stcmem

EXTERN_VAR monf stcmem

Definition at line 43 of file hutil.h.