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)
 
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 hMu2
 
EXTERN_VAR long hMu
 

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

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

997{
998 monf xmem;
999 int i;
1000 xmem = (monf)omAlloc((Nvar + 1) * sizeof(monp));
1001 for (i = Nvar; i>0; i--)
1002 {
1003 xmem[i] = (monp)omAlloc(LEN_MON);
1004 xmem[i]->mo = NULL;
1005 }
1006 return xmem;
1007}
#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 732 of file hilb.cc.

733{
734 int i, j, k;
735 int m;
736 *co = *mu = 0;
737 if ((s1 == NULL) || (s2 == NULL))
738 return;
739 i = s1->length();
740 j = s2->length();
741 if (j > i)
742 return;
743 m = 0;
744 for(k=j-2; k>=0; k--)
745 m += (*s2)[k];
746 *mu = m;
747 *co = i - j;
748}
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 140 of file hutil.cc.

141{
142 int i;
143
144 if (ev_length>0)
145 {
146 for (i=ev_length-1;i>=0;i--)
147 omFreeSize(hsecure[i],((currRing->N)+1)*sizeof(int));
148 omFreeSize(hsecure, ev_length*sizeof(scmon));
149 omFreeSize(ev, ev_length*sizeof(scmon));
150 }
151}
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 35 of file hdegree.cc.

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

◆ hElimR()

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

Definition at line 742 of file hutil.cc.

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

◆ hElimS()

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

Definition at line 672 of file hutil.cc.

673{
674 int nc = *e1, z = 0, i, j, k, k1;
675 scmon n, o;
676 if (!nc || (a2 == e2))
677 return;
678 j = 0;
679 i = a2;
680 o = stc[i];
681 n = stc[0];
682 k = Nvar;
683 loop
684 {
685 k1 = var[k];
686 if (o[k1] > n[k1])
687 {
688 k = Nvar;
689 i++;
690 if (i < e2)
691 o = stc[i];
692 else
693 {
694 j++;
695 if (j < nc)
696 {
697 i = a2;
698 o = stc[i];
699 n = stc[j];
700 }
701 else
702 {
703 if (z!=0)
704 {
705 *e1 -= z;
706 hShrink(stc, 0, nc);
707 }
708 return;
709 }
710 }
711 }
712 else
713 {
714 k--;
715 if (k==0)
716 {
717 stc[j] = NULL;
718 z++;
719 j++;
720 if (j < nc)
721 {
722 i = a2;
723 o = stc[i];
724 n = stc[j];
725 k = Nvar;
726 }
727 else
728 {
729 if (z!=0)
730 {
731 *e1 -= z;
732 hShrink(stc, 0, nc);
733 }
734 return;
735 }
736 }
737 }
738 }
739}

◆ hGetmem()

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

Definition at line 1023 of file hutil.cc.

1024{
1025 scfmon x = monmem->mo;
1026 int lx = monmem->a;
1027 if ((x==NULL) || (lm > lx))
1028 {
1029 /* according to http://www.singular.uni-kl.de:8002/trac/ticket/463#comment:4
1030 * we need to work around a compiler bug:
1031 * if ((x!=NULL)&&(lx>0)) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1032 */
1033 if (x!=NULL) if (lx>0) omFreeSize((ADDRESS)x, lx * sizeof(scmon));
1034 monmem->mo = x = (scfmon)omAlloc(lm * sizeof(scmon));
1035 monmem->a = lm;
1036 }
1037 memcpy(x, old, lm * sizeof(scmon));
1038 return x;
1039}
void * ADDRESS
Definition: auxiliary.h:119

◆ hGetpure()

scmon hGetpure ( scmon  p)

Definition at line 1052 of file hutil.cc.

1053{
1054 scmon p1 = p;
1055 scmon pn;
1056 p1++;
1057 pn = p1;
1058 pn += (currRing->N);
1059 memcpy(pn, p1, (currRing->N) * sizeof(int));
1060 return pn - 1;
1061}
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 1326 of file hilb.cc.

1327{
1328
1329 /* new story:
1330 no lV is needed, i.e. it is to be determined
1331 the rest is extracted from the interface input list in extra.cc and makes the input of this proc
1332 called from extra.cc
1333 */
1334
1335 /*
1336 * This is based on iterative right colon operations on a
1337 * two-sided monomial ideal of the free associative algebra.
1338 * The algorithm terminates for those monomial ideals
1339 * whose monomials define "regular formal languages",
1340 * that is, all monomials of the input ideal can be obtained
1341 * from finite languages by applying finite number of
1342 * rational operations.
1343 */
1344
1345 int trInd;
1346 S = minimalMonomialGenSet(S);
1347 if( !idIs0(S) && p_Totaldegree(S->m[0], currRing)==0)
1348 {
1349 PrintS("Hilbert Series:\n 0\n");
1350 return;
1351 }
1352 int (*POS)(ideal, poly, std::vector<ideal>, std::vector<poly>, int, int);
1353 if(trunDegHs != 0)
1354 {
1355 Print("\nTruncation degree = %d\n",trunDegHs);
1357 }
1358 else
1359 {
1360 if(IG_CASE)
1361 {
1362 if(idIs0(S))
1363 {
1364 WerrorS("wrong input: it is not an infinitely gen. case");
1365 return;
1366 }
1367 trInd = p_Totaldegree(S->m[IDELEMS(S)-1], currRing);
1369 }
1370 else
1372 }
1373 std::vector<ideal > idorb;
1374 std::vector< poly > polist;
1375
1376 ideal orb_init = idInit(1, 1);
1377 idorb.push_back(orb_init);
1378
1379 polist.push_back( p_One(currRing));
1380
1381 std::vector< std::vector<int> > posMat;
1382 std::vector<int> posRow(lV,0);
1383 std::vector<int> C;
1384
1385 int ds, is, ps;
1386 unsigned long lpcnt = 0;
1387
1388 poly w, wi;
1389 ideal Jwi;
1390
1391 while(lpcnt < idorb.size())
1392 {
1393 w = NULL;
1394 w = polist[lpcnt];
1395 if(lpcnt >= 1 && idIs0(idorb[lpcnt]) == FALSE)
1396 {
1397 if(p_Totaldegree(idorb[lpcnt]->m[0], currRing) != 0)
1398 {
1399 C.push_back(1);
1400 }
1401 else
1402 C.push_back(0);
1403 }
1404 else
1405 {
1406 C.push_back(1);
1407 }
1408
1409 ds = p_Totaldegree(w, currRing);
1410 lpcnt++;
1411
1412 for(is = 1; is <= lV; is++)
1413 {
1414 wi = NULL;
1415 //make new copy 'wi' of word w=polist[lpcnt]
1416 //and update it (for the colon operation).
1417 //if corresponding to wi, right colon operation gives
1418 //a new (right colon) ideal of S,
1419 //keep 'wi' in the polist else delete it
1420
1421 wi = pCopy(w);
1422 p_SetExp(wi, (ds*lV)+is, 1, currRing);
1423 p_Setm(wi, currRing);
1424 Jwi = NULL;
1425 //Jwi stores (right) colon ideal of S w.r.t. word
1426 //wi if colon operation gives a new ideal place it
1427 //in the vector of ideals 'idorb'
1428 //otherwise delete it
1429
1430 Jwi = idInit(1,1);
1431
1432 Jwi = colonIdeal(S, wi, lV, Jwi, trunDegHs);
1433 ps = (*POS)(Jwi, wi, idorb, polist, trInd, trunDegHs);
1434
1435 if(ps == 0) // finds a new ideal
1436 {
1437 posRow[is-1] = idorb.size();
1438
1439 idorb.push_back(Jwi);
1440 polist.push_back(wi);
1441 }
1442 else // ideal is already there in the set
1443 {
1444 posRow[is-1]=ps-1;
1445 idDelete(&Jwi);
1446 pDelete(&wi);
1447 }
1448 }
1449 posMat.push_back(posRow);
1450 posRow.resize(lV,0);
1451 }
1452 int lO = C.size();//size of the orbit
1453 PrintLn();
1454 Print("maximal length of words = %ld\n", p_Totaldegree(polist[lO-1], currRing));
1455 Print("\nlength of the Orbit = %d", lO);
1456 PrintLn();
1457
1458 if(odp)
1459 {
1460 Print("words description of the Orbit: \n");
1461 for(is = 0; is < lO; is++)
1462 {
1463 pWrite0(polist[is]);
1464 PrintS(" ");
1465 }
1466 PrintLn();
1467 PrintS("\nmaximal degree, #(sum_j R(w,w_j))");
1468 PrintLn();
1469 for(is = 0; is < lO; is++)
1470 {
1471 if(idIs0(idorb[is]))
1472 {
1473 PrintS("NULL\n");
1474 }
1475 else
1476 {
1477 Print("%ld, %d \n",p_Totaldegree(idorb[is]->m[IDELEMS(idorb[is])-1], currRing),IDELEMS(idorb[is]));
1478 }
1479 }
1480 }
1481
1482 for(is = idorb.size()-1; is >= 0; is--)
1483 {
1484 idDelete(&idorb[is]);
1485 }
1486 for(is = polist.size()-1; is >= 0; is--)
1487 {
1488 pDelete(&polist[is]);
1489 }
1490
1491 idorb.resize(0);
1492 polist.resize(0);
1493
1494 int adjMatrix[lO][lO];
1495 memset(adjMatrix, 0, lO*lO*sizeof(int));
1496 int rowCount, colCount;
1497 int tm = 0;
1498 if(!mgrad)
1499 {
1500 for(rowCount = 0; rowCount < lO; rowCount++)
1501 {
1502 for(colCount = 0; colCount < lV; colCount++)
1503 {
1504 tm = posMat[rowCount][colCount];
1505 adjMatrix[rowCount][tm] = adjMatrix[rowCount][tm] + 1;
1506 }
1507 }
1508 }
1509
1510 ring r = currRing;
1511 int npar;
1512 char** tt;
1514 if(!mgrad)
1515 {
1516 tt=(char**)omAlloc(sizeof(char*));
1517 tt[0] = omStrDup("t");
1518 npar = 1;
1519 }
1520 else
1521 {
1522 tt=(char**)omalloc(lV*sizeof(char*));
1523 for(is = 0; is < lV; is++)
1524 {
1525 tt[is] = (char*)omAlloc(7*sizeof(char)); //if required enlarge it later
1526 sprintf (tt[is], "t%d", is+1);
1527 }
1528 npar = lV;
1529 }
1530
1531 p.r = rDefault(0, npar, tt);
1533 char** xx = (char**)omAlloc(sizeof(char*));
1534 xx[0] = omStrDup("x");
1535 ring R = rDefault(cf, 1, xx);
1536 rChangeCurrRing(R);//rWrite(R);
1537 /*
1538 * matrix corresponding to the orbit of the ideal
1539 */
1540 matrix mR = mpNew(lO, lO);
1541 matrix cMat = mpNew(lO,1);
1542 poly rc;
1543
1544 if(!mgrad)
1545 {
1546 for(rowCount = 0; rowCount < lO; rowCount++)
1547 {
1548 for(colCount = 0; colCount < lO; colCount++)
1549 {
1550 if(adjMatrix[rowCount][colCount] != 0)
1551 {
1552 MATELEM(mR, rowCount + 1, colCount + 1) = p_ISet(adjMatrix[rowCount][colCount], R);
1553 p_SetCoeff(MATELEM(mR, rowCount + 1, colCount + 1), n_Mult(pGetCoeff(mR->m[lO*rowCount+colCount]),n_Param(1, R->cf), R->cf), R);
1554 }
1555 }
1556 }
1557 }
1558 else
1559 {
1560 for(rowCount = 0; rowCount < lO; rowCount++)
1561 {
1562 for(colCount = 0; colCount < lV; colCount++)
1563 {
1564 rc=NULL;
1565 rc=p_One(R);
1566 p_SetCoeff(rc, n_Mult(pGetCoeff(rc), n_Param(colCount+1, R->cf),R->cf), R);
1567 MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1)=p_Add_q(rc,MATELEM(mR, rowCount +1, posMat[rowCount][colCount]+1), R);
1568 }
1569 }
1570 }
1571
1572 for(rowCount = 0; rowCount < lO; rowCount++)
1573 {
1574 if(C[rowCount] != 0)
1575 {
1576 MATELEM(cMat, rowCount + 1, 1) = p_ISet(C[rowCount], R);
1577 }
1578 }
1579
1580 matrix u;
1581 unitMatrix(lO, u); //unit matrix
1582 matrix gMat = mp_Sub(u, mR, R);
1583
1584 char* s;
1585
1586 if(odp)
1587 {
1588 PrintS("\nlinear system:\n");
1589 if(!mgrad)
1590 {
1591 for(rowCount = 0; rowCount < lO; rowCount++)
1592 {
1593 Print("H(%d) = ", rowCount+1);
1594 for(colCount = 0; colCount < lV; colCount++)
1595 {
1596 StringSetS(""); nWrite(n_Param(1, R->cf));
1597 s = StringEndS(); PrintS(s);
1598 Print("*"); omFree(s);
1599 Print("H(%d) + ", posMat[rowCount][colCount] + 1);
1600 }
1601 Print(" %d\n", C[rowCount] );
1602 }
1603 PrintS("where H(1) represents the series corresp. to input ideal\n");
1604 PrintS("and i^th summand in the rhs of an eqn. is according\n");
1605 PrintS("to the right colon map corresp. to the i^th variable\n");
1606 }
1607 else
1608 {
1609 for(rowCount = 0; rowCount < lO; rowCount++)
1610 {
1611 Print("H(%d) = ", rowCount+1);
1612 for(colCount = 0; colCount < lV; colCount++)
1613 {
1614 StringSetS(""); nWrite(n_Param(colCount+1, R->cf));
1615 s = StringEndS(); PrintS(s);
1616 Print("*");omFree(s);
1617 Print("H(%d) + ", posMat[rowCount][colCount] + 1);
1618 }
1619 Print(" %d\n", C[rowCount] );
1620 }
1621 PrintS("where H(1) represents the series corresp. to input ideal\n");
1622 }
1623 }
1624 PrintLn();
1625 posMat.resize(0);
1626 C.resize(0);
1627 matrix pMat;
1628 matrix lMat;
1629 matrix uMat;
1630 matrix H_serVec = mpNew(lO, 1);
1631 matrix Hnot;
1632
1633 //std::clock_t start;
1634 //start = std::clock();
1635
1636 luDecomp(gMat, pMat, lMat, uMat, R);
1637 luSolveViaLUDecomp(pMat, lMat, uMat, cMat, H_serVec, Hnot);
1638
1639 //to print system solving time
1640 //if(odp){
1641 //std::cout<<"solving time of the system = "<<(std::clock()-start)/(double)(CLOCKS_PER_SEC / 1000)<<" ms"<<std::endl;}
1642
1643 mp_Delete(&mR, R);
1644 mp_Delete(&u, R);
1645 mp_Delete(&pMat, R);
1646 mp_Delete(&lMat, R);
1647 mp_Delete(&uMat, R);
1648 mp_Delete(&cMat, R);
1649 mp_Delete(&gMat, R);
1650 mp_Delete(&Hnot, R);
1651 //print the Hilbert series and length of the Orbit
1652 PrintLn();
1653 Print("Hilbert series:");
1654 PrintLn();
1655 pWrite(H_serVec->m[0]);
1656 if(!mgrad)
1657 {
1658 omFree(tt[0]);
1659 }
1660 else
1661 {
1662 for(is = lV-1; is >= 0; is--)
1663
1664 omFree( tt[is]);
1665 }
1666 omFree(tt);
1667 omFree(xx[0]);
1668 omFree(xx);
1669 rChangeCurrRing(r);
1670 rKill(R);
1671}
#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:633
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:780
@ 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:413
#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:1037
static ideal colonIdeal(ideal S, poly w, int lV, ideal Jwi, int trunDegHs)
Definition: hilb.cc:1291
static int positionInOrbit_FG_Case(ideal I, poly, std::vector< ideal > idorb, std::vector< poly >, int, int)
Definition: hilb.cc:1006
static int positionInOrbit_IG_Case(ideal I, poly w, std::vector< ideal > idorb, std::vector< poly > polist, int trInd, int)
Definition: hilb.cc:928
static ideal minimalMonomialGenSet(ideal I)
Definition: hilb.cc:1131
#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:6180
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:1297
poly p_One(const ring r)
Definition: p_polys.cc:1313
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934
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:486
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:410
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1505
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 564 of file hdegree.cc.

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

◆ hIndMult()

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

Definition at line 384 of file hdegree.cc.

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

◆ hInit()

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

Definition at line 31 of file hutil.cc.

32{
34 if (Q!=NULL) id_LmTest(Q, currRing);
35
37
38 if (hisModule < 0)
39 hisModule = 0;
40
41 int sl, ql, i, k = 0;
42 polyset si, qi, ss;
43 scfmon ex, ek;
44
45 if (S!=NULL)
46 {
47 si = S->m;
48 sl = IDELEMS(S);
49 }
50 else
51 {
52 si = NULL;
53 sl = 0;
54 }
55 if (Q!=NULL)
56 {
57 qi = Q->m;
58 ql = IDELEMS(Q);
59 }
60 else
61 {
62 qi = NULL;
63 ql = 0;
64 }
65 if ((sl + ql) == 0)
66 {
67 *Nexist = 0;
68 return NULL;
69 }
70 ss = si;
71 for (i = sl; i>0; i--)
72 {
73 if (*ss!=0)
74 k++;
75 ss++;
76 }
77 ss = qi;
78 for (i = ql; i>0; i--)
79 {
80 if (*ss!=0)
81 k++;
82 ss++;
83 }
84 *Nexist = k;
85 if (k==0)
86 return NULL;
87 ek = ex = (scfmon)omAlloc0(k * sizeof(scmon));
88 hsecure = (scfmon) omAlloc0(k * sizeof(scmon));
89 for (i = sl; i>0; i--)
90 {
91 if (*si!=NULL)
92 {
93 *ek = (scmon) omAlloc(((currRing->N)+1)*sizeof(int));
94 p_GetExpV(*si, *ek, currRing);
95 ek++;
96 }
97 si++;
98 }
99 for (i = ql; i>0; i--)
100 {
101 if (*qi!=NULL)
102 {
103 *ek = (scmon) omAlloc(((currRing->N)+1)*sizeof(int));
104 p_GetExpV(*qi, *ek, currRing);
105 ek++;
106 }
107 qi++;
108 }
109 memcpy(hsecure, ex, k * sizeof(scmon));
110 return ex;
111}
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:1518
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_LmTest(A, lR)
Definition: simpleideals.h:88

◆ hKill()

void hKill ( monf  xmem,
int  Nvar 
)

Definition at line 1010 of file hutil.cc.

1011{
1012 int i;
1013 for (i = Nvar; i!=0; i--)
1014 {
1015 if (xmem[i]->mo!=NULL)
1016 omFreeSize((ADDRESS)xmem[i]->mo, xmem[i]->a * sizeof(scmon));
1017 omFreeSize((ADDRESS)xmem[i], LEN_MON);
1018 }
1019 omFreeSize((ADDRESS)xmem, (Nvar + 1) * sizeof(monp));
1020}

◆ hLex2R()

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

Definition at line 880 of file hutil.cc.

882{
883 int j0 = 0, j = 0, i = a2, k, k1;
884 scmon n, o;
885 if (!e1)
886 {
887 for (; i < e2; i++)
888 rad[i - a2] = rad[i];
889 return;
890 }
891 else if (i == e2)
892 return;
893 n = rad[j];
894 o = rad[i];
895 loop
896 {
897 k = Nvar;
898 loop
899 {
900 k1 = var[k];
901 if (!o[k1] && n[k1])
902 {
903 w[j0] = o;
904 j0++;
905 i++;
906 if (i < e2)
907 {
908 o = rad[i];
909 break;
910 }
911 else
912 {
913 for (; j < e1; j++)
914 {
915 w[j0] = rad[j];
916 j0++;
917 }
918 memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
919 return;
920 }
921 }
922 else if (o[k1] && !n[k1])
923 {
924 w[j0] = n;
925 j0++;
926 j++;
927 if (j < e1)
928 {
929 n = rad[j];
930 break;
931 }
932 else
933 {
934 for (; i < e2; i++)
935 {
936 w[j0] = rad[i];
937 j0++;
938 }
939 memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
940 return;
941 }
942 }
943 k--;
944 }
945 }
946}

◆ hLex2S()

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

Definition at line 812 of file hutil.cc.

814{
815 int j0 = 0, j = 0, i = a2, k, k1;
816 scmon n, o;
817 if (!e1)
818 {
819 for (; i < e2; i++)
820 rad[i - a2] = rad[i];
821 return;
822 } else if (i == e2)
823 return;
824 n = rad[j];
825 o = rad[i];
826 loop
827 {
828 k = Nvar;
829 loop
830 {
831 k1 = var[k];
832 if (o[k1] < n[k1])
833 {
834 w[j0] = o;
835 j0++;
836 i++;
837 if (i < e2)
838 {
839 o = rad[i];
840 break;
841 }
842 else
843 {
844 for (; j < e1; j++)
845 {
846 w[j0] = rad[j];
847 j0++;
848 }
849 memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
850 return;
851 }
852 }
853 else if (o[k1] > n[k1])
854 {
855 w[j0] = n;
856 j0++;
857 j++;
858 if (j < e1)
859 {
860 n = rad[j];
861 break;
862 }
863 else
864 {
865 for (; i < e2; i++)
866 {
867 w[j0] = rad[i];
868 j0++;
869 }
870 memcpy(rad, w, (e1 + e2 - a2) * sizeof(scmon));
871 return;
872 }
873 }
874 k--;
875 }
876 }
877}

◆ hLexR()

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

Definition at line 565 of file hutil.cc.

566{
567 int j = 1, i = 0, k, k1;
568 scmon n, o;
569 if (Nrad < 2)
570 return;
571 n = rad[j];
572 o = rad[0];
573 k = Nvar;
574 loop
575 {
576 k1 = var[k];
577 if (!o[k1] && n[k1])
578 {
579 i++;
580 if (i < j)
581 {
582 o = rad[i];
583 k = Nvar;
584 }
585 else
586 {
587 j++;
588 if (j < Nrad)
589 {
590 i = 0;
591 o = rad[0];
592 n = rad[j];
593 k = Nvar;
594 }
595 else
596 return;
597 }
598 }
599 else if (o[k1] && !n[k1])
600 {
601 for (k = j; k > i; k--)
602 rad[k] = rad[k - 1];
603 rad[i] = n;
604 j++;
605 if (j < Nrad)
606 {
607 i = 0;
608 o = rad[0];
609 n = rad[j];
610 k = Nvar;
611 }
612 else
613 return;
614 }
615 else
616 k--;
617 }
618}

◆ hLexS()

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

Definition at line 506 of file hutil.cc.

507{
508 if (Nstc < 2)
509 return;
510 int j = 1, i = 0;
511 scmon n = stc[j];
512 scmon o = stc[0];
513 int k = Nvar;
514 loop
515 {
516 int k1 = var[k];
517 if (o[k1] < n[k1])
518 {
519 i++;
520 if (i < j)
521 {
522 o = stc[i];
523 k = Nvar;
524 }
525 else
526 {
527 j++;
528 if (j < Nstc)
529 {
530 i = 0;
531 o = stc[0];
532 n = stc[j];
533 k = Nvar;
534 }
535 else
536 return;
537 }
538 }
539 else if (o[k1] > n[k1])
540 {
541 int tmp_k;
542 for (tmp_k = j; tmp_k > i; tmp_k--)
543 stc[tmp_k] = stc[tmp_k - 1];
544 stc[i] = n;
545 j++;
546 if (j < Nstc)
547 {
548 i = 0;
549 o = stc[0];
550 n = stc[j];
551 k = Nvar;
552 }
553 else
554 return;
555 }
556 else
557 {
558 k--;
559 if (k<=0) return;
560 }
561 }
562}

◆ hOrdSupp()

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

Definition at line 202 of file hutil.cc.

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

623{
624 int nc = *Nstc, np = 0, nq = 0, j, i, i1, c, l;
625 scmon x;
626 for (j = a; j < nc; j++)
627 {
628 x = stc[j];
629 i = Nvar;
630 c = 2;
631 l = 0;
632 loop
633 {
634 i1 = var[i];
635 if (x[i1])
636 {
637 c--;
638 if (!c)
639 {
640 l = 0;
641 break;
642 }
643 else if (c == 1)
644 l = i1;
645 }
646 i--;
647 if (!i)
648 break;
649 }
650 if (l)
651 {
652 if (!pure[l])
653 {
654 np++;
655 pure[l] = x[l];
656 }
657 else if (x[l] < pure[l])
658 pure[l] = x[l];
659 stc[j] = NULL;
660 nq++;
661 }
662 }
663 *Npure = np;
664 if (nq!=0)
665 {
666 *Nstc -= nq;
667 hShrink(stc, a, nc);
668 }
669}

◆ hRadical()

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

Definition at line 411 of file hutil.cc.

412{
413 int nc = *Nrad, z = 0, i, j, k;
414 scmon n, o;
415 if (nc < 2)
416 return;
417 i = 0;
418 j = 1;
419 n = rad[j];
420 o = rad[0];
421 k = Nvar;
422 loop
423 {
424 if ((o[k]!=0) && (n[k]==0))
425 {
426 loop
427 {
428 k--;
429 if (k==0)
430 {
431 rad[i] = NULL;
432 z++;
433 break;
434 }
435 else
436 {
437 if ((o[k]==0) && (n[k]!=0))
438 break;
439 }
440 }
441 k = Nvar;
442 }
443 else if (!o[k] && n[k])
444 {
445 loop
446 {
447 k--;
448 if (!k)
449 {
450 rad[j] = NULL;
451 z++;
452 break;
453 }
454 else
455 {
456 if (o[k] && !n[k])
457 break;
458 }
459 }
460 k = Nvar;
461 }
462 else
463 {
464 k--;
465 if (!k)
466 {
467 rad[j] = NULL;
468 z++;
469 k = Nvar;
470 }
471 }
472 if (k == Nvar)
473 {
474 if (!rad[j])
475 i = j - 1;
476 loop
477 {
478 i++;
479 if (i == j)
480 {
481 i = -1;
482 j++;
483 if (j < nc)
484 n = rad[j];
485 else
486 {
487 if (z)
488 {
489 *Nrad -= z;
490 hShrink(rad, 0, nc);
491 }
492 return;
493 }
494 }
495 else if (rad[i])
496 {
497 o = rad[i];
498 break;
499 }
500 }
501 }
502 }
503}

◆ hStaircase()

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

Definition at line 313 of file hutil.cc.

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

◆ hStepR()

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

Definition at line 974 of file hutil.cc.

975{
976 int k1, i;
977 k1 = var[Nvar];
978 i = 0;
979 loop
980 {
981 if (rad[i][k1])
982 {
983 *a = i;
984 return;
985 }
986 i++;
987 if (i == Nrad)
988 {
989 *a = i;
990 return;
991 }
992 }
993}

◆ hStepS()

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

Definition at line 949 of file hutil.cc.

950{
951 int k1, i;
952 int y;
953 k1 = var[Nvar];
954 y = *x;
955 i = *a;
956 loop
957 {
958 if (y < stc[i][k1])
959 {
960 *a = i;
961 *x = stc[i][k1];
962 return;
963 }
964 i++;
965 if (i == Nstc)
966 {
967 *a = i;
968 return;
969 }
970 }
971}
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 174 of file hutil.cc.

175{
176 int nv, i0, i1, i, j;
177 nv = i0 = *Nvar;
178 i1 = 0;
179 for (i = 1; i <= nv; i++)
180 {
181 j = 0;
182 loop
183 {
184 if (stc[j][i]>0)
185 {
186 i1++;
187 var[i1] = i;
188 break;
189 }
190 j++;
191 if (j == Nstc)
192 {
193 var[i0] = i;
194 i0--;
195 break;
196 }
197 }
198 }
199 *Nvar = i1;
200}

◆ RightColonOperation()

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

Definition at line 1673 of file hilb.cc.

1674{
1675 /*
1676 * This returns right colon ideal of a monomial two-sided ideal of
1677 * the free associative algebra with respect to a monomial 'w'
1678 * (S:_R w).
1679 */
1680 S = minimalMonomialGenSet(S);
1681 ideal Iw = idInit(1,1);
1682 Iw = colonIdeal(S, w, lV, Iw, 0);
1683 return (Iw);
1684}

◆ slicehilb()

void slicehilb ( ideal  I)

Definition at line 656 of file hilb.cc.

657{
658 //printf("Adi changes are here: \n");
659 int i, NNN = 0;
660 int steps = 0, prune = 0, moreprune = 0;
661 mpz_ptr hilbertcoef;
662 int *hilbpower;
663 ideal S = idInit(1,1);
664 poly q = p_One(currRing);
665 ideal X = idInit(1,1);
666 X->m[0]=p_One(currRing);
667 for(i=1;i<=currRing->N;i++)
668 {
669 p_SetExp(X->m[0],i,1,currRing);
670 }
671 p_Setm(X->m[0],currRing);
672 I = id_Mult(I,X,currRing);
673 ideal Itmp = SortByDeg(I);
675 I = Itmp;
676 //printf("\n-------------RouneSlice--------------\n");
677 rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
679 p_Delete(&q,currRing);
680 //printf("\nIn total Prune got rid of %i elements\n",prune);
681 //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
682 //printf("\nSteps of rouneslice: %i\n\n", steps);
683 printf("\n// %8d t^0",1);
684 for(i = 0; i<NNN; i++)
685 {
686 if(mpz_sgn(&hilbertcoef[i])!=0)
687 {
688 gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
689 }
690 }
691 PrintLn();
692 omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
693 omFreeSize(hilbpower, (NNN)*sizeof(int));
694 //printf("\n-------------------------------------\n");
695}
void FACTORY_PUBLIC prune(Variable &alpha)
Definition: variable.cc:261
static 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:500
static ideal SortByDeg(ideal I)
Definition: hilb.cc:167
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
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 long hMu

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