Functions | Variables
hilb.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.h>
#include <misc/mylimits.h>
#include <misc/intvec.h>
#include <kernel/combinatorics/hilb.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/combinatorics/hutil.h>
#include <polys/monomials/ring.h>
#include <polys/monomials/p_polys.h>
#include <polys/simpleideals.h>
#include <kernel/ideals.h>

Go to the source code of this file.

Functions

static int hMinModulweight (intvec *modulweight)
 
static void hHilbEst (scfmon stc, int Nstc, varset var, int Nvar)
 
static int * hAddHilb (int Nv, int x, int *pol, int *lp)
 
static void hLastHilb (scmon pure, int Nv, varset var, int *pol, int lp)
 
static void hHilbStep (scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int *pol, int Lpol)
 
static void hWDegree (intvec *wdegree)
 
static int DegMon (poly p)
 !!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!! More...
 
static bool idDegSortTest (ideal I)
 
static ideal SortByDeg_p (ideal I, poly p)
 
static ideal SortByDeg (ideal I)
 
ideal idQuotMon (ideal Iorig, ideal p)
 
static ideal idAddMon (ideal I, ideal p)
 
static poly ChoosePVar (ideal I)
 
static poly ChoosePXL (ideal I)
 
static poly ChoosePXF (ideal I)
 
static poly ChoosePOL (ideal I)
 
static poly ChoosePOF (ideal I)
 
static poly ChoosePVL (ideal I)
 
static poly ChoosePVF (ideal I)
 
static poly ChoosePJL (ideal I)
 
static poly ChoosePJF (ideal I)
 
static poly ChooseP (ideal I)
 
static poly SearchP (ideal I)
 searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1) More...
 
static bool JustVar (ideal I)
 
static void eulerchar (ideal I, int variables, mpz_ptr ec)
 
static poly SqFree (ideal I)
 
static bool IsIn (poly p, ideal I)
 
static poly LCMmon (ideal I)
 
void rouneslice (ideal I, ideal S, poly q, poly x, int &prune, int &moreprune, int &steps, int &NNN, mpz_ptr &hilbertcoef, int *&hilbpower)
 
void slicehilb (ideal I)
 
static intvechSeries (ideal S, intvec *modulweight, int, intvec *wdegree, ideal Q, ring tailRing)
 
intvechHstdSeries (ideal S, intvec *modulweight, intvec *wdegree, ideal Q, ring tailRing)
 
intvechFirstSeries (ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
 
intvechSecondSeries (intvec *hseries1)
 
void hDegreeSeries (intvec *s1, intvec *s2, int *co, int *mu)
 
static void hPrintHilb (intvec *hseries)
 
void hLookSeries (ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
 

Variables

static int ** Qpol
 
static int * Q0
 
static int * Ql
 
static int hLength
 

Function Documentation

§ ChooseP()

static poly ChooseP ( ideal  I)
static

Definition at line 731 of file hilb.cc.

732 {
733  poly m;
734  // TEST TO SEE WHICH ONE IS BETTER
735  //m = ChoosePXL(I);
736  //m = ChoosePXF(I);
737  //m = ChoosePOL(I);
738  //m = ChoosePOF(I);
739  //m = ChoosePVL(I);
740  //m = ChoosePVF(I);
741  m = ChoosePJL(I);
742  //m = ChoosePJF(I);
743  return(m);
744 }
static poly ChoosePJL(ideal I)
Definition: hilb.cc:675
int m
Definition: cfEzgcd.cc:119
polyrec * poly
Definition: hilb.h:10

§ ChoosePJF()

static poly ChoosePJF ( ideal  I)
static

Definition at line 703 of file hilb.cc.

704 {
705  int i,j,dummy;
706  bool flag = TRUE;
707  poly m = p_ISet(1,currRing);
708  for(i = 0;(i<=IDELEMS(I)-1) && (flag);i++)
709  {
710  flag = TRUE;
711  for(j=1;(j<=currRing->N) && (flag);j++)
712  {
713  dummy = p_GetExp(I->m[i],j,currRing);
714  if(dummy >= 2)
715  {
716  p_SetExp(m,j,dummy-1,currRing);
717  p_Setm(m,currRing);
718  flag = FALSE;
719  }
720  }
721  if(!p_IsOne(m, currRing))
722  {
723  return(m);
724  }
725  }
726  m = ChoosePVar(I);
727  return(m);
728 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ ChoosePJL()

static poly ChoosePJL ( ideal  I)
static

Definition at line 675 of file hilb.cc.

676 {
677  int i,j,dummy;
678  bool flag = TRUE;
679  poly m = p_ISet(1,currRing);
680  for(i = IDELEMS(I)-1;(i>=0) && (flag);i--)
681  {
682  flag = TRUE;
683  for(j=1;(j<=currRing->N) && (flag);j++)
684  {
685  dummy = p_GetExp(I->m[i],j,currRing);
686  if(dummy >= 2)
687  {
688  p_SetExp(m,j,dummy-1,currRing);
689  p_Setm(m,currRing);
690  flag = FALSE;
691  }
692  }
693  if(!p_IsOne(m, currRing))
694  {
695  return(m);
696  }
697  }
698  m = ChoosePVar(I);
699  return(m);
700 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ ChoosePOF()

static poly ChoosePOF ( ideal  I)
static

Definition at line 589 of file hilb.cc.

590 {
591  int i,j,dummy;
592  poly m;
593  for(i = 0 ;i<=IDELEMS(I)-1;i++)
594  {
595  m = p_Copy(I->m[i],currRing);
596  for(j=1;j<=currRing->N;j++)
597  {
598  dummy = p_GetExp(m,j,currRing);
599  if(dummy > 0)
600  {
601  p_SetExp(m,j,dummy-1,currRing);
602  p_Setm(m,currRing);
603  }
604  }
605  if(!p_IsOne(m, currRing))
606  {
607  return(m);
608  }
609  else
610  {
611  p_Delete(&m,currRing);
612  }
613  }
614  m = ChoosePVar(I);
615  return(m);
616 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10

§ ChoosePOL()

static poly ChoosePOL ( ideal  I)
static

Definition at line 559 of file hilb.cc.

560 {
561  int i,j,dummy;
562  poly m;
563  for(i = IDELEMS(I)-1;i>=0;i--)
564  {
565  m = p_Copy(I->m[i],currRing);
566  for(j=1;j<=currRing->N;j++)
567  {
568  dummy = p_GetExp(m,j,currRing);
569  if(dummy > 0)
570  {
571  p_SetExp(m,j,dummy-1,currRing);
572  p_Setm(m,currRing);
573  }
574  }
575  if(!p_IsOne(m, currRing))
576  {
577  return(m);
578  }
579  else
580  {
581  p_Delete(&m,currRing);
582  }
583  }
584  m = ChoosePVar(I);
585  return(m);
586 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10

§ ChoosePVar()

static poly ChoosePVar ( ideal  I)
static

Definition at line 461 of file hilb.cc.

462 {
463  bool flag=TRUE;
464  int i,j;
465  poly res;
466  for(i=1;i<=currRing->N;i++)
467  {
468  flag=TRUE;
469  for(j=IDELEMS(I)-1;(j>=0)&&(flag);j--)
470  {
471  if(p_GetExp(I->m[j], i, currRing)>0)
472  {
473  flag=FALSE;
474  }
475  }
476 
477  if(flag == TRUE)
478  {
479  res = p_ISet(1, currRing);
480  p_SetExp(res, i, 1, currRing);
481  p_Setm(res,currRing);
482  return(res);
483  }
484  else
485  {
486  p_Delete(&res, currRing);
487  }
488  }
489  return(NULL); //i.e. it is the maximal ideal
490 }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ ChoosePVF()

static poly ChoosePVF ( ideal  I)
static

Definition at line 647 of file hilb.cc.

648 {
649  int i,j,dummy;
650  bool flag = TRUE;
651  poly m = p_ISet(1,currRing);
652  for(i = 0;(i<=IDELEMS(I)-1) && (flag);i++)
653  {
654  flag = TRUE;
655  for(j=1;(j<=currRing->N) && (flag);j++)
656  {
657  dummy = p_GetExp(I->m[i],j,currRing);
658  if(dummy >= 2)
659  {
660  p_SetExp(m,j,1,currRing);
661  p_Setm(m,currRing);
662  flag = FALSE;
663  }
664  }
665  if(!p_IsOne(m, currRing))
666  {
667  return(m);
668  }
669  }
670  m = ChoosePVar(I);
671  return(m);
672 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ ChoosePVL()

static poly ChoosePVL ( ideal  I)
static

Definition at line 619 of file hilb.cc.

620 {
621  int i,j,dummy;
622  bool flag = TRUE;
623  poly m = p_ISet(1,currRing);
624  for(i = IDELEMS(I)-1;(i>=0) && (flag);i--)
625  {
626  flag = TRUE;
627  for(j=1;(j<=currRing->N) && (flag);j++)
628  {
629  dummy = p_GetExp(I->m[i],j,currRing);
630  if(dummy >= 2)
631  {
632  p_SetExp(m,j,1,currRing);
633  p_Setm(m,currRing);
634  flag = FALSE;
635  }
636  }
637  if(!p_IsOne(m, currRing))
638  {
639  return(m);
640  }
641  }
642  m = ChoosePVar(I);
643  return(m);
644 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ ChoosePXF()

static poly ChoosePXF ( ideal  I)
static

Definition at line 526 of file hilb.cc.

527 {
528  int i,j,dummy=0;
529  poly m;
530  for(i =0 ; (i<=IDELEMS(I)-1) && (dummy == 0); i++)
531  {
532  for(j = 1; (j<=currRing->N) && (dummy == 0); j++)
533  {
534  if(p_GetExp(I->m[i],j, currRing)>1)
535  {
536  dummy = 1;
537  }
538  }
539  }
540  m = p_Copy(I->m[i-1],currRing);
541  for(j = 1; j<=currRing->N; j++)
542  {
543  dummy = p_GetExp(m,j,currRing);
544  if(dummy >= 1)
545  {
546  p_SetExp(m, j, dummy-1, currRing);
547  }
548  }
549  if(!p_IsOne(m, currRing))
550  {
551  p_Setm(m, currRing);
552  return(m);
553  }
554  m = ChoosePVar(I);
555  return(m);
556 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10

§ ChoosePXL()

static poly ChoosePXL ( ideal  I)
static

Definition at line 493 of file hilb.cc.

494 {
495  int i,j,dummy=0;
496  poly m;
497  for(i = IDELEMS(I)-1; (i>=0) && (dummy == 0); i--)
498  {
499  for(j = 1; (j<=currRing->N) && (dummy == 0); j++)
500  {
501  if(p_GetExp(I->m[i],j, currRing)>1)
502  {
503  dummy = 1;
504  }
505  }
506  }
507  m = p_Copy(I->m[i+1],currRing);
508  for(j = 1; j<=currRing->N; j++)
509  {
510  dummy = p_GetExp(m,j,currRing);
511  if(dummy >= 1)
512  {
513  p_SetExp(m, j, dummy-1, currRing);
514  }
515  }
516  if(!p_IsOne(m, currRing))
517  {
518  p_Setm(m, currRing);
519  return(m);
520  }
521  m = ChoosePVar(I);
522  return(m);
523 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
Definition: p_polys.h:1884
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10

§ DegMon()

static int DegMon ( poly  p)
static

!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Definition at line 232 of file hilb.cc.

233 {
234  #if 1
235  int i,deg;
236  deg = 0;
237  for(i=1;i<=currRing->N;i++)
238  {
239  deg = deg + p_GetExp(p, i, currRing);
240  }
241  return(deg);
242  #else
243  return(p_Deg(p, currRing));
244  #endif
245 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123

§ eulerchar()

static void eulerchar ( ideal  I,
int  variables,
mpz_ptr  ec 
)
static

Definition at line 804 of file hilb.cc.

805 {
806  loop
807  {
808  mpz_t dummy;
809  if(JustVar(I) == TRUE)
810  {
811  if(IDELEMS(I) == variables)
812  {
813  mpz_init(dummy);
814  if((variables % 2) == 0)
815  {mpz_set_si(dummy, 1);}
816  else
817  {mpz_set_si(dummy, -1);}
818  mpz_add(ec, ec, dummy);
819  }
820  //mpz_clear(dummy);
821  return;
822  }
823  ideal p = idInit(1,1);
824  p->m[0] = SearchP(I);
825  //idPrint(I);
826  //idPrint(p);
827  //printf("\nNow get in idQuotMon\n");
828  ideal Ip = idQuotMon(I,p);
829  //idPrint(Ip);
830  //Ip = SortByDeg(Ip);
831  int i,howmanyvarinp = 0;
832  for(i = 1;i<=currRing->N;i++)
833  {
834  if(p_GetExp(p->m[0],i,currRing)>0)
835  {
836  howmanyvarinp++;
837  }
838  }
839  eulerchar(Ip, variables-howmanyvarinp, ec);
840  id_Delete(&Ip, currRing);
841  I = idAddMon(I,p);
842  }
843 }
ideal idQuotMon(ideal Iorig, ideal p)
Definition: hilb.cc:389
static int variables
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
static bool JustVar(ideal I)
Definition: hilb.cc:773
#define TRUE
Definition: auxiliary.h:101
static ideal idAddMon(ideal I, ideal p)
Definition: hilb.cc:449
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static poly SearchP(ideal I)
searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1) ...
Definition: hilb.cc:747
static void eulerchar(ideal I, int variables, mpz_ptr ec)
Definition: hilb.cc:804

§ hAddHilb()

static int* hAddHilb ( int  Nv,
int  x,
int *  pol,
int *  lp 
)
static

Definition at line 92 of file hilb.cc.

93 {
94  int l = *lp, ln, i;
95  int *pon;
96  *lp = ln = l + x;
97  pon = Qpol[Nv];
98  memcpy(pon, pol, l * sizeof(int));
99  if (l > x)
100  {
101  for (i = x; i < l; i++)
102  pon[i] -= pol[i - x];
103  for (i = l; i < ln; i++)
104  pon[i] = -pol[i - x];
105  }
106  else
107  {
108  for (i = l; i < x; i++)
109  pon[i] = 0;
110  for (i = x; i < ln; i++)
111  pon[i] = -pol[i - x];
112  }
113  return pon;
114 }
int i
Definition: cfEzgcd.cc:123
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:94
static int ** Qpol
Definition: hilb.cc:32

§ hDegreeSeries()

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

Definition at line 1340 of file hilb.cc.

1341 {
1342  int m, i, j, k;
1343  *co = *mu = 0;
1344  if ((s1 == NULL) || (s2 == NULL))
1345  return;
1346  i = s1->length();
1347  j = s2->length();
1348  if (j > i)
1349  return;
1350  m = 0;
1351  for(k=j-2; k>=0; k--)
1352  m += (*s2)[k];
1353  *mu = m;
1354  *co = i - j;
1355 }
void mu(int **points, int sizePoints)
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:86

§ hFirstSeries()

intvec* hFirstSeries ( ideal  S,
intvec modulweight,
ideal  Q,
intvec wdegree,
ring  tailRing 
)

Definition at line 1298 of file hilb.cc.

1299 {
1301  if (Q!= NULL) id_TestTail(Q, currRing, tailRing);
1302 
1303  return hSeries(S, modulweight, 1, wdegree, Q, tailRing);
1304 }
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:79
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static intvec * hSeries(ideal S, intvec *modulweight, int, intvec *wdegree, ideal Q, ring tailRing)
Definition: hilb.cc:1135
#define NULL
Definition: omList.c:10

§ hHilbEst()

static void hHilbEst ( scfmon  stc,
int  Nstc,
varset  var,
int  Nvar 
)
static

Definition at line 51 of file hilb.cc.

52 {
53  int i, j;
54  int x, y, z = 1;
55  int *p;
56  for (i = Nvar; i>0; i--)
57  {
58  x = 0;
59  for (j = 0; j < Nstc; j++)
60  {
61  y = stc[j][var[i]];
62  if (y > x)
63  x = y;
64  }
65  z += x;
66  j = i - 1;
67  if (z > Ql[j])
68  {
69  if (z>(MAX_INT_VAL)/2)
70  {
71  WerrorS("internal arrays too big");
72  return;
73  }
74  p = (int *)omAlloc((unsigned long)z * sizeof(int));
75  if (Ql[j]!=0)
76  {
77  if (j==0)
78  memcpy(p, Qpol[j], Ql[j] * sizeof(int));
79  omFreeSize((ADDRESS)Qpol[j], Ql[j] * sizeof(int));
80  }
81  if (j==0)
82  {
83  for (x = Ql[j]; x < z; x++)
84  p[x] = 0;
85  }
86  Ql[j] = z;
87  Qpol[j] = p;
88  }
89  }
90 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
return P p
Definition: myNF.cc:203
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void * ADDRESS
Definition: auxiliary.h:118
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define omAlloc(size)
Definition: omAllocDecl.h:210
int j
Definition: myNF.cc:70
const int MAX_INT_VAL
Definition: mylimits.h:12
int i
Definition: cfEzgcd.cc:123
static int * Ql
Definition: hilb.cc:33
Variable x
Definition: cfModGcd.cc:4023
static int ** Qpol
Definition: hilb.cc:32

§ hHilbStep()

static void hHilbStep ( scmon  pure,
scfmon  stc,
int  Nstc,
varset  var,
int  Nvar,
int *  pol,
int  Lpol 
)
static

Definition at line 143 of file hilb.cc.

145 {
146  int iv = Nvar -1, ln, a, a0, a1, b, i;
147  int x, x0;
148  scmon pn;
149  scfmon sn;
150  int *pon;
151  if (Nstc==0)
152  {
153  hLastHilb(pure, iv, var, pol, Lpol);
154  return;
155  }
156  x = a = 0;
157  pn = hGetpure(pure);
158  sn = hGetmem(Nstc, stc, stcmem[iv]);
159  hStepS(sn, Nstc, var, Nvar, &a, &x);
160  Q0[iv] = Q0[Nvar];
161  ln = Lpol;
162  pon = pol;
163  if (a == Nstc)
164  {
165  x = pure[var[Nvar]];
166  if (x!=0)
167  pon = hAddHilb(iv, x, pon, &ln);
168  hHilbStep(pn, sn, a, var, iv, pon, ln);
169  return;
170  }
171  else
172  {
173  pon = hAddHilb(iv, x, pon, &ln);
174  hHilbStep(pn, sn, a, var, iv, pon, ln);
175  }
176  b = a;
177  x0 = 0;
178  loop
179  {
180  Q0[iv] += (x - x0);
181  a0 = a;
182  x0 = x;
183  hStepS(sn, Nstc, var, Nvar, &a, &x);
184  hElimS(sn, &b, a0, a, var, iv);
185  a1 = a;
186  hPure(sn, a0, &a1, var, iv, pn, &i);
187  hLex2S(sn, b, a0, a1, var, iv, hwork);
188  b += (a1 - a0);
189  ln = Lpol;
190  if (a < Nstc)
191  {
192  pon = hAddHilb(iv, x - x0, pol, &ln);
193  hHilbStep(pn, sn, b, var, iv, pon, ln);
194  }
195  else
196  {
197  x = pure[var[Nvar]];
198  if (x!=0)
199  pon = hAddHilb(iv, x - x0, pol, &ln);
200  else
201  pon = pol;
202  hHilbStep(pn, sn, b, var, iv, pon, ln);
203  return;
204  }
205  }
206 }
const poly a
Definition: syzextra.cc:212
scfmon hwork
Definition: hutil.cc:19
scfmon hGetmem(int lm, scfmon old, monp monmem)
Definition: hutil.cc:1029
void hElimS(scfmon stc, int *e1, int a2, int e2, varset var, int Nvar)
Definition: hutil.cc:678
static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int *pol, int Lpol)
Definition: hilb.cc:143
loop
Definition: myNF.cc:98
scmon hGetpure(scmon p)
Definition: hutil.cc:1058
static void hLastHilb(scmon pure, int Nv, varset var, int *pol, int lp)
Definition: hilb.cc:116
scmon * scfmon
Definition: hutil.h:20
static int * Q0
Definition: hilb.cc:33
static int * hAddHilb(int Nv, int x, int *pol, int *lp)
Definition: hilb.cc:92
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
int * scmon
Definition: hutil.h:19
int i
Definition: cfEzgcd.cc:123
void hLex2S(scfmon rad, int e1, int a2, int e2, varset var, int Nvar, scfmon w)
Definition: hutil.cc:818
monf stcmem
Definition: hutil.cc:24
void hStepS(scfmon stc, int Nstc, varset var, int Nvar, int *a, int *x)
Definition: hutil.cc:955
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

§ hHstdSeries()

intvec* hHstdSeries ( ideal  S,
intvec modulweight,
intvec wdegree,
ideal  Q,
ring  tailRing 
)

Definition at line 1291 of file hilb.cc.

1292 {
1294  if (Q!=NULL) id_TestTail(Q, currRing, tailRing);
1295  return hSeries(S, modulweight, 0, wdegree, Q, tailRing);
1296 }
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:79
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static intvec * hSeries(ideal S, intvec *modulweight, int, intvec *wdegree, ideal Q, ring tailRing)
Definition: hilb.cc:1135
#define NULL
Definition: omList.c:10

§ hLastHilb()

static void hLastHilb ( scmon  pure,
int  Nv,
varset  var,
int *  pol,
int  lp 
)
static

Definition at line 116 of file hilb.cc.

117 {
118  int l = lp, x, i, j;
119  int *p, *pl;
120  p = pol;
121  for (i = Nv; i>0; i--)
122  {
123  x = pure[var[i + 1]];
124  if (x!=0)
125  p = hAddHilb(i, x, p, &l);
126  }
127  pl = *Qpol;
128  j = Q0[Nv + 1];
129  for (i = 0; i < l; i++)
130  pl[i + j] += p[i];
131  x = pure[var[1]];
132  if (x!=0)
133  {
134  j += x;
135  for (i = 0; i < l; i++)
136  pl[i + j] -= p[i];
137  }
138  j += l;
139  if (j > hLength)
140  hLength = j;
141 }
static int hLength
Definition: hilb.cc:34
return P p
Definition: myNF.cc:203
static int * Q0
Definition: hilb.cc:33
int j
Definition: myNF.cc:70
static int * hAddHilb(int Nv, int x, int *pol, int *lp)
Definition: hilb.cc:92
int i
Definition: cfEzgcd.cc:123
Variable x
Definition: cfModGcd.cc:4023
int l
Definition: cfEzgcd.cc:94
static int ** Qpol
Definition: hilb.cc:32

§ hLookSeries()

void hLookSeries ( ideal  S,
intvec modulweight,
ideal  Q,
intvec wdegree,
ring  tailRing 
)

Definition at line 1377 of file hilb.cc.

1378 {
1380 
1381  intvec *hseries1 = hFirstSeries(S, modulweight, Q, wdegree, tailRing);
1382 
1383  hPrintHilb(hseries1);
1384 
1385  const int l = hseries1->length()-1;
1386 
1387  intvec *hseries2 = (l > 1) ? hSecondSeries(hseries1) : hseries1;
1388 
1389  int co, mu;
1390  hDegreeSeries(hseries1, hseries2, &co, &mu);
1391 
1392  PrintLn();
1393  hPrintHilb(hseries2);
1394  if ((l == 1) &&(mu == 0))
1395  scPrintDegree(rVar(currRing)+1, 0);
1396  else
1397  scPrintDegree(co, mu);
1398  if (l>1)
1399  delete hseries1;
1400  delete hseries2;
1401 }
#define id_TestTail(A, lR, tR)
Definition: simpleideals.h:79
void PrintLn()
Definition: reporter.cc:310
void mu(int **points, int sizePoints)
void scPrintDegree(int co, int mu)
Definition: hdegree.cc:808
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
void hDegreeSeries(intvec *s1, intvec *s2, int *co, int *mu)
Definition: hilb.cc:1340
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
Definition: intvec.h:14
int length() const
Definition: intvec.h:86
intvec * hSecondSeries(intvec *hseries1)
Definition: hilb.cc:1306
intvec * hFirstSeries(ideal S, intvec *modulweight, ideal Q, intvec *wdegree, ring tailRing)
Definition: hilb.cc:1298
int l
Definition: cfEzgcd.cc:94
static void hPrintHilb(intvec *hseries)
Definition: hilb.cc:1357

§ hMinModulweight()

static int hMinModulweight ( intvec modulweight)
static

Definition at line 37 of file hilb.cc.

38 {
39  int i,j,k;
40 
41  if(modulweight==NULL) return 0;
42  j=(*modulweight)[0];
43  for(i=modulweight->rows()-1;i!=0;i--)
44  {
45  k=(*modulweight)[i];
46  if(k<j) j=k;
47  }
48  return j;
49 }
int rows() const
Definition: intvec.h:88
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

§ hPrintHilb()

static void hPrintHilb ( intvec hseries)
static

Definition at line 1357 of file hilb.cc.

1358 {
1359  int i, j, l, k;
1360  if (hseries == NULL)
1361  return;
1362  l = hseries->length()-1;
1363  k = (*hseries)[l];
1364  for (i = 0; i < l; i++)
1365  {
1366  j = (*hseries)[i];
1367  if (j != 0)
1368  {
1369  Print("// %8d t^%d\n", j, i+k);
1370  }
1371  }
1372 }
#define Print
Definition: emacs.cc:83
int k
Definition: cfEzgcd.cc:93
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:86
int l
Definition: cfEzgcd.cc:94

§ hSecondSeries()

intvec* hSecondSeries ( intvec hseries1)

Definition at line 1306 of file hilb.cc.

1307 {
1308  intvec *work, *hseries2;
1309  int i, j, k, s, t, l;
1310  if (hseries1 == NULL)
1311  return NULL;
1312  work = new intvec(hseries1);
1313  k = l = work->length()-1;
1314  s = 0;
1315  for (i = k-1; i >= 0; i--)
1316  s += (*work)[i];
1317  loop
1318  {
1319  if ((s != 0) || (k == 1))
1320  break;
1321  s = 0;
1322  t = (*work)[k-1];
1323  k--;
1324  for (i = k-1; i >= 0; i--)
1325  {
1326  j = (*work)[i];
1327  (*work)[i] = -t;
1328  s += t;
1329  t += j;
1330  }
1331  }
1332  hseries2 = new intvec(k+1);
1333  for (i = k-1; i >= 0; i--)
1334  (*hseries2)[i] = (*work)[i];
1335  (*hseries2)[k] = (*work)[l];
1336  delete work;
1337  return hseries2;
1338 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
Definition: intvec.h:14
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int length() const
Definition: intvec.h:86
int l
Definition: cfEzgcd.cc:94

§ hSeries()

static intvec* hSeries ( ideal  S,
intvec modulweight,
int  ,
intvec wdegree,
ideal  Q,
ring  tailRing 
)
static

Definition at line 1135 of file hilb.cc.

1137 {
1138 // id_TestTail(S, currRing, tailRing);
1139 
1140  intvec *work, *hseries1=NULL;
1141  int mc;
1142  int p0;
1143  int i, j, k, l, ii, mw;
1144  hexist = hInit(S, Q, &hNexist, tailRing);
1145  if (hNexist==0)
1146  {
1147  hseries1=new intvec(2);
1148  (*hseries1)[0]=1;
1149  (*hseries1)[1]=0;
1150  return hseries1;
1151  }
1152 
1153  #if 0
1154  if (wdegree == NULL)
1155  hWeight();
1156  else
1157  hWDegree(wdegree);
1158  #else
1159  if (wdegree != NULL) hWDegree(wdegree);
1160  #endif
1161 
1162  p0 = 1;
1163  hwork = (scfmon)omAlloc(hNexist * sizeof(scmon));
1164  hvar = (varset)omAlloc(((currRing->N) + 1) * sizeof(int));
1165  hpure = (scmon)omAlloc((1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1166  stcmem = hCreate((currRing->N) - 1);
1167  Qpol = (int **)omAlloc(((currRing->N) + 1) * sizeof(int *));
1168  Ql = (int *)omAlloc0(((currRing->N) + 1) * sizeof(int));
1169  Q0 = (int *)omAlloc(((currRing->N) + 1) * sizeof(int));
1170  *Qpol = NULL;
1171  hLength = k = j = 0;
1172  mc = hisModule;
1173  if (mc!=0)
1174  {
1175  mw = hMinModulweight(modulweight);
1176  hstc = (scfmon)omAlloc(hNexist * sizeof(scmon));
1177  }
1178  else
1179  {
1180  mw = 0;
1181  hstc = hexist;
1182  hNstc = hNexist;
1183  }
1184  loop
1185  {
1186  if (mc!=0)
1187  {
1188  hComp(hexist, hNexist, mc, hstc, &hNstc);
1189  if (modulweight != NULL)
1190  j = (*modulweight)[mc-1]-mw;
1191  }
1192  if (hNstc!=0)
1193  {
1194  hNvar = (currRing->N);
1195  for (i = hNvar; i>=0; i--)
1196  hvar[i] = i;
1197  //if (notstc) // TODO: no mon divides another
1199  hSupp(hstc, hNstc, hvar, &hNvar);
1200  if (hNvar!=0)
1201  {
1202  if ((hNvar > 2) && (hNstc > 10))
1205  memset(hpure, 0, ((currRing->N) + 1) * sizeof(int));
1206  hPure(hstc, 0, &hNstc, hvar, hNvar, hpure, &hNpure);
1207  hLexS(hstc, hNstc, hvar, hNvar);
1208  Q0[hNvar] = 0;
1209  hHilbStep(hpure, hstc, hNstc, hvar, hNvar, &p0, 1);
1210  }
1211  }
1212  else
1213  {
1214  if(*Qpol!=NULL)
1215  (**Qpol)++;
1216  else
1217  {
1218  *Qpol = (int *)omAlloc(sizeof(int));
1219  hLength = *Ql = **Qpol = 1;
1220  }
1221  }
1222  if (*Qpol!=NULL)
1223  {
1224  i = hLength;
1225  while ((i > 0) && ((*Qpol)[i - 1] == 0))
1226  i--;
1227  if (i > 0)
1228  {
1229  l = i + j;
1230  if (l > k)
1231  {
1232  work = new intvec(l);
1233  for (ii=0; ii<k; ii++)
1234  (*work)[ii] = (*hseries1)[ii];
1235  if (hseries1 != NULL)
1236  delete hseries1;
1237  hseries1 = work;
1238  k = l;
1239  }
1240  while (i > 0)
1241  {
1242  (*hseries1)[i + j - 1] += (*Qpol)[i - 1];
1243  (*Qpol)[i - 1] = 0;
1244  i--;
1245  }
1246  }
1247  }
1248  mc--;
1249  if (mc <= 0)
1250  break;
1251  }
1252  if (k==0)
1253  {
1254  hseries1=new intvec(2);
1255  (*hseries1)[0]=0;
1256  (*hseries1)[1]=0;
1257  }
1258  else
1259  {
1260  l = k+1;
1261  while ((*hseries1)[l-2]==0) l--;
1262  if (l!=k)
1263  {
1264  work = new intvec(l);
1265  for (ii=l-2; ii>=0; ii--)
1266  (*work)[ii] = (*hseries1)[ii];
1267  delete hseries1;
1268  hseries1 = work;
1269  }
1270  (*hseries1)[l-1] = mw;
1271  }
1272  for (i = 0; i <= (currRing->N); i++)
1273  {
1274  if (Ql[i]!=0)
1275  omFreeSize((ADDRESS)Qpol[i], Ql[i] * sizeof(int));
1276  }
1277  omFreeSize((ADDRESS)Q0, ((currRing->N) + 1) * sizeof(int));
1278  omFreeSize((ADDRESS)Ql, ((currRing->N) + 1) * sizeof(int));
1279  omFreeSize((ADDRESS)Qpol, ((currRing->N) + 1) * sizeof(int *));
1280  hKill(stcmem, (currRing->N) - 1);
1281  omFreeSize((ADDRESS)hpure, (1 + ((currRing->N) * (currRing->N))) * sizeof(int));
1282  omFreeSize((ADDRESS)hvar, ((currRing->N) + 1) * sizeof(int));
1283  omFreeSize((ADDRESS)hwork, hNexist * sizeof(scmon));
1285  if (hisModule!=0)
1286  omFreeSize((ADDRESS)hstc, hNexist * sizeof(scmon));
1287  return hseries1;
1288 }
int hNstc
Definition: hutil.cc:22
void hLexS(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:512
static int hLength
Definition: hilb.cc:34
scfmon hwork
Definition: hutil.cc:19
int hNexist
Definition: hutil.cc:22
int * varset
Definition: hutil.h:21
static void hHilbStep(scmon pure, scfmon stc, int Nstc, varset var, int Nvar, int *pol, int Lpol)
Definition: hilb.cc:143
loop
Definition: myNF.cc:98
scmon * scfmon
Definition: hutil.h:20
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
scfmon hexist
Definition: hutil.cc:19
static int * Q0
Definition: hilb.cc:33
monf hCreate(int Nvar)
Definition: hutil.cc:1002
int hNvar
Definition: hutil.cc:22
void * ADDRESS
Definition: auxiliary.h:118
int hNpure
Definition: hutil.cc:22
scmon hpure
Definition: hutil.cc:20
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
void hDelete(scfmon ev, int ev_length)
Definition: hutil.cc:146
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void hOrdSupp(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hutil.cc:208
Definition: intvec.h:14
void hKill(monf xmem, int Nvar)
Definition: hutil.cc:1016
varset hvar
Definition: hutil.cc:21
int j
Definition: myNF.cc:70
static void hWDegree(intvec *wdegree)
Definition: hilb.cc:211
void hPure(scfmon stc, int a, int *Nstc, varset var, int Nvar, scmon pure, int *Npure)
Definition: hutil.cc:627
void hStaircase(scfmon stc, int *Nstc, varset var, int Nvar)
Definition: hutil.cc:319
int * scmon
Definition: hutil.h:19
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static int * Ql
Definition: hilb.cc:33
monf stcmem
Definition: hutil.cc:24
int hisModule
Definition: hutil.cc:23
scfmon hstc
Definition: hutil.cc:19
static int hMinModulweight(intvec *modulweight)
Definition: hilb.cc:37
void hComp(scfmon exist, int Nexist, int ak, scfmon stc, int *Nstc)
Definition: hutil.cc:160
scfmon hInit(ideal S, ideal Q, int *Nexist, ring tailRing)
Definition: hutil.cc:34
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
static int ** Qpol
Definition: hilb.cc:32
static void hHilbEst(scfmon stc, int Nstc, varset var, int Nvar)
Definition: hilb.cc:51
void hSupp(scfmon stc, int Nstc, varset var, int *Nvar)
Definition: hutil.cc:180

§ hWDegree()

static void hWDegree ( intvec wdegree)
static

Definition at line 211 of file hilb.cc.

212 {
213  int i, k;
214  int x;
215 
216  for (i=(currRing->N); i; i--)
217  {
218  x = (*wdegree)[i-1];
219  if (x != 1)
220  {
221  for (k=hNexist-1; k>=0; k--)
222  {
223  hexist[k][i] *= x;
224  }
225  }
226  }
227 }
int hNexist
Definition: hutil.cc:22
scfmon hexist
Definition: hutil.cc:19
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
Variable x
Definition: cfModGcd.cc:4023

§ idAddMon()

static ideal idAddMon ( ideal  I,
ideal  p 
)
static

Definition at line 449 of file hilb.cc.

450 {
451  #if 1
452  I = SortByDeg_p(I,p->m[0]);
453  #else
454  I = id_Add(I,p,currRing);
455  #endif
456  //idSkipZeroes(I);
457  return(I);
458 }
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ideal id_Add(ideal h1, ideal h2, const ring r)
h1 + h2
static ideal SortByDeg_p(ideal I, poly p)
Definition: hilb.cc:268

§ idDegSortTest()

static bool idDegSortTest ( ideal  I)
static

Definition at line 248 of file hilb.cc.

249 {
250  if((I == NULL)||(idIs0(I)))
251  {
252  return(TRUE);
253  }
254  for(int i = 0; i<IDELEMS(I)-1; i++)
255  {
256  if(DegMon(I->m[i])>DegMon(I->m[i+1]))
257  {
258  idPrint(I);
259  WerrorS("Ideal is not deg sorted!!");
260  return(FALSE);
261  }
262  }
263  return(TRUE);
264 }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define idPrint(id)
Definition: ideals.h:48
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ idQuotMon()

ideal idQuotMon ( ideal  Iorig,
ideal  p 
)

Definition at line 389 of file hilb.cc.

390 {
391  if(idIs0(Iorig))
392  {
393  ideal res = idInit(1,1);
394  res->m[0] = poly(0);
395  return(res);
396  }
397  if(idIs0(p))
398  {
399  ideal res = idInit(1,1);
400  res->m[0] = pOne();
401  return(res);
402  }
403  ideal I = idCopy(Iorig);
404  ideal res = idInit(IDELEMS(I),1);
405  int i,j;
406  int dummy;
407  for(i = 0; i<IDELEMS(I); i++)
408  {
409  res->m[i] = p_Copy(I->m[i], currRing);
410  for(j = 1; (j<=currRing->N) ; j++)
411  {
412  dummy = p_GetExp(p->m[0], j, currRing);
413  if(dummy > 0)
414  {
415  if(p_GetExp(I->m[i], j, currRing) < dummy)
416  {
417  p_SetExp(res->m[i], j, 0, currRing);
418  }
419  else
420  {
421  p_SetExp(res->m[i], j, p_GetExp(I->m[i], j, currRing) - dummy, currRing);
422  }
423  }
424  }
425  p_Setm(res->m[i], currRing);
426  if(DegMon(res->m[i]) == DegMon(I->m[i]))
427  {
428  res->m[i] = NULL; // pDelete
429  }
430  else
431  {
432  I->m[i] = NULL; // pDelete
433  }
434  }
435  idSkipZeroes(res);
436  idSkipZeroes(I);
437  if(!idIs0(res))
438  {
439  for(i = 0; i<=IDELEMS(res)-1; i++)
440  {
441  I = SortByDeg_p(I,res->m[i]);
442  }
443  }
444  //idDegSortTest(I);
445  return(I);
446 }
return P p
Definition: myNF.cc:203
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:298
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:62
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
static ideal SortByDeg_p(ideal I, poly p)
Definition: hilb.cc:268
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ IsIn()

static bool IsIn ( poly  p,
ideal  I 
)
static

Definition at line 875 of file hilb.cc.

876 {
877  //assumes that I is ordered by degree
878  if(idIs0(I))
879  {
880  if(p==poly(0))
881  {
882  return(TRUE);
883  }
884  else
885  {
886  return(FALSE);
887  }
888  }
889  if(p==poly(0))
890  {
891  return(FALSE);
892  }
893  int i,j;
894  bool flag;
895  for(i = 0;i<IDELEMS(I);i++)
896  {
897  flag = TRUE;
898  for(j = 1;(j<=currRing->N) &&(flag);j++)
899  {
900  if(p_GetExp(p, j, currRing)<p_GetExp(I->m[i], j, currRing))
901  {
902  flag = FALSE;
903  }
904  }
905  if(flag)
906  {
907  return(TRUE);
908  }
909  }
910  return(FALSE);
911 }
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ JustVar()

static bool JustVar ( ideal  I)
static

Definition at line 773 of file hilb.cc.

774 {
775  #if 0
776  int i,j;
777  bool foundone;
778  for(i=0;i<=IDELEMS(I)-1;i++)
779  {
780  foundone = FALSE;
781  for(j = 1;j<=currRing->N;j++)
782  {
783  if(p_GetExp(I->m[i], j, currRing)>0)
784  {
785  if(foundone == TRUE)
786  {
787  return(FALSE);
788  }
789  foundone = TRUE;
790  }
791  }
792  }
793  return(TRUE);
794  #else
795  if(DegMon(I->m[IDELEMS(I)-1])>1)
796  {
797  return(FALSE);
798  }
799  return(TRUE);
800  #endif
801 }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232

§ LCMmon()

static poly LCMmon ( ideal  I)
static

Definition at line 914 of file hilb.cc.

915 {
916  if(idIs0(I))
917  {
918  return(NULL);
919  }
920  poly m;
921  int dummy,i,j;
922  m = p_ISet(1,currRing);
923  for(i=1;i<=currRing->N;i++)
924  {
925  dummy=0;
926  for(j=IDELEMS(I)-1;j>=0;j--)
927  {
928  if(p_GetExp(I->m[j],i,currRing) > dummy)
929  {
930  dummy = p_GetExp(I->m[j],i,currRing);
931  }
932  }
933  p_SetExp(m,i,dummy,currRing);
934  }
935  p_Setm(m,currRing);
936  return(m);
937 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
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:1297

§ rouneslice()

void rouneslice ( ideal  I,
ideal  S,
poly  q,
poly  x,
int &  prune,
int &  moreprune,
int &  steps,
int &  NNN,
mpz_ptr &  hilbertcoef,
int *&  hilbpower 
)

Definition at line 940 of file hilb.cc.

941 {
942  loop
943  {
944  (steps)++;
945  int i,j;
946  int dummy;
947  poly m;
948  ideal p, koszsimp;
949  //----------- PRUNING OF S ---------------
950  //S SHOULD IN THIS POINT BE ORDERED BY DEGREE
951  for(i=IDELEMS(S)-1;i>=0;i--)
952  {
953  if(IsIn(S->m[i],I))
954  {
955  S->m[i]=NULL;
956  prune++;
957  }
958  }
959  idSkipZeroes(S);
960  //----------------------------------------
961  for(i=IDELEMS(I)-1;i>=0;i--)
962  {
963  m = p_Copy(I->m[i],currRing);
964  for(j=1;j<=currRing->N;j++)
965  {
966  dummy = p_GetExp(m,j,currRing);
967  if(dummy > 0)
968  {
969  p_SetExp(m,j,dummy-1,currRing);
970  }
971  }
972  p_Setm(m, currRing);
973  if(IsIn(m,S))
974  {
975  I->m[i]=NULL;
976  //printf("\n Deleted, since pi(m) is in S\n");pWrite(m);
977  }
978  }
979  idSkipZeroes(I);
980  //----------- MORE PRUNING OF S ------------
981  m = LCMmon(I);
982  if(m != NULL)
983  {
984  for(i=0;i<IDELEMS(S);i++)
985  {
986  if(!(p_DivisibleBy(S->m[i], m, currRing)))
987  {
988  S->m[i] = NULL;
989  j++;
990  moreprune++;
991  }
992  else
993  {
994  if(pLmEqual(S->m[i],m))
995  {
996  S->m[i] = NULL;
997  moreprune++;
998  }
999  }
1000  }
1001  idSkipZeroes(S);
1002  }
1003  /*printf("\n---------------------------\n");
1004  printf("\n I\n");idPrint(I);
1005  printf("\n S\n");idPrint(S);
1006  printf("\n q\n");pWrite(q);
1007  getchar();*/
1008 
1009  if(idIs0(I))
1010  {
1011  id_Delete(&I, currRing);
1012  id_Delete(&S, currRing);
1013  p_Delete(&m, currRing);
1014  break;
1015  }
1016  m = LCMmon(I);
1017  if(!p_DivisibleBy(x,m, currRing))
1018  {
1019  //printf("\nx does not divide lcm(I)");
1020  //printf("\nEmpty set");pWrite(q);
1021  id_Delete(&I, currRing);
1022  id_Delete(&S, currRing);
1023  p_Delete(&m, currRing);
1024  break;
1025  }
1026  m = SqFree(I);
1027  if(m==NULL)
1028  {
1029  //printf("\n Corner: ");
1030  //pWrite(q);
1031  //printf("\n With the facets of the dual simplex:\n");
1032  //idPrint(I);
1033  mpz_t ec;
1034  mpz_init(ec);
1035  mpz_ptr ec_ptr = ec;
1036  eulerchar(I, currRing->N, ec_ptr);
1037  bool flag = FALSE;
1038  if(NNN==0)
1039  {
1040  hilbertcoef = (mpz_ptr)omAlloc((NNN+1)*sizeof(mpz_t));
1041  hilbpower = (int*)omAlloc((NNN+1)*sizeof(int));
1042  mpz_init( &hilbertcoef[NNN]);
1043  mpz_set( &hilbertcoef[NNN], ec);
1044  mpz_clear(ec);
1045  hilbpower[NNN] = DegMon(q);
1046  NNN++;
1047  }
1048  else
1049  {
1050  //I look if the power appears already
1051  for(i = 0;(i<NNN)&&(flag == FALSE)&&(DegMon(q)>=hilbpower[i]);i++)
1052  {
1053  if((hilbpower[i]) == (DegMon(q)))
1054  {
1055  flag = TRUE;
1056  mpz_add(&hilbertcoef[i],&hilbertcoef[i],ec_ptr);
1057  }
1058  }
1059  if(flag == FALSE)
1060  {
1061  hilbertcoef = (mpz_ptr)omRealloc(hilbertcoef, (NNN+1)*sizeof(mpz_t));
1062  hilbpower = (int*)omRealloc(hilbpower, (NNN+1)*sizeof(int));
1063  mpz_init(&hilbertcoef[NNN]);
1064  for(j = NNN; j>i; j--)
1065  {
1066  mpz_set(&hilbertcoef[j],&hilbertcoef[j-1]);
1067  hilbpower[j] = hilbpower[j-1];
1068  }
1069  mpz_set( &hilbertcoef[i], ec);
1070  mpz_clear(ec);
1071  hilbpower[i] = DegMon(q);
1072  NNN++;
1073  }
1074  }
1075  break;
1076  }
1077  m = ChooseP(I);
1078  p = idInit(1,1);
1079  p->m[0] = m;
1080  ideal Ip = idQuotMon(I,p);
1081  ideal Sp = idQuotMon(S,p);
1082  poly pq = pp_Mult_mm(q,m,currRing);
1083  rouneslice(Ip, Sp, pq, x, prune, moreprune, steps, NNN, hilbertcoef,hilbpower);
1084  //id_Delete(&Ip, currRing);
1085  //id_Delete(&Sp, currRing);
1086  S = idAddMon(S,p);
1087  p->m[0]=NULL;
1088  id_Delete(&p, currRing); // p->m[0] was also in S
1089  p_Delete(&pq,currRing);
1090  }
1091 }
ideal idQuotMon(ideal Iorig, ideal p)
Definition: hilb.cc:389
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:940
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
static bool IsIn(poly p, ideal I)
Definition: hilb.cc:875
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:101
static ideal idAddMon(ideal I, ideal p)
Definition: hilb.cc:449
#define omAlloc(size)
Definition: omAllocDecl.h:210
static poly LCMmon(ideal I)
Definition: hilb.cc:914
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void prune(Variable &alpha)
Definition: variable.cc:261
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
static poly ChooseP(ideal I)
Definition: hilb.cc:731
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define omRealloc(addr, size)
Definition: omAllocDecl.h:225
static poly SqFree(ideal I)
Definition: hilb.cc:846
#define pLmEqual(p1, p2)
Definition: polys.h:111
static void eulerchar(ideal I, int variables, mpz_ptr ec)
Definition: hilb.cc:804

§ SearchP()

static poly SearchP ( ideal  I)
static

searches for a monomial of degree d>=2 and divides it by a variable (result monomial of deg d-1)

Definition at line 747 of file hilb.cc.

748 {
749  int i,j,exp;
750  poly res;
751  if(DegMon(I->m[IDELEMS(I)-1])<=1)
752  {
753  res = ChoosePVar(I);
754  return(res);
755  }
756  i = IDELEMS(I)-1;
757  res = p_Copy(I->m[i], currRing);
758  for(j=1;j<=currRing->N;j++)
759  {
760  exp = p_GetExp(I->m[i], j, currRing);
761  if(exp > 0)
762  {
763  p_SetExp(res, j, exp - 1, currRing);
764  p_Setm(res,currRing);
765  break;
766  }
767  }
768  assume( j <= currRing->N );
769  return(res);
770 }
static poly ChoosePVar(ideal I)
Definition: hilb.cc:461
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10

§ slicehilb()

void slicehilb ( ideal  I)

Definition at line 1094 of file hilb.cc.

1095 {
1096  //printf("Adi changes are here: \n");
1097  int i, NNN = 0;
1098  int steps = 0, prune = 0, moreprune = 0;
1099  mpz_ptr hilbertcoef;
1100  int *hilbpower;
1101  ideal S = idInit(1,1);
1102  poly q = p_ISet(1,currRing);
1103  ideal X = idInit(1,1);
1104  X->m[0]=p_One(currRing);
1105  for(i=1;i<=currRing->N;i++)
1106  {
1107  p_SetExp(X->m[0],i,1,currRing);
1108  }
1109  p_Setm(X->m[0],currRing);
1110  I = id_Mult(I,X,currRing);
1111  I = SortByDeg(I);
1112  //printf("\n-------------RouneSlice--------------\n");
1113  rouneslice(I,S,q,X->m[0],prune, moreprune, steps, NNN, hilbertcoef, hilbpower);
1114  //printf("\nIn total Prune got rid of %i elements\n",prune);
1115  //printf("\nIn total More Prune got rid of %i elements\n",moreprune);
1116  //printf("\nSteps of rouneslice: %i\n\n", steps);
1117  mpz_t coefhilb;
1118  mpz_t dummy;
1119  mpz_init(coefhilb);
1120  mpz_init(dummy);
1121  printf("\n// %8d t^0",1);
1122  for(i = 0; i<NNN; i++)
1123  {
1124  if(mpz_sgn(&hilbertcoef[i])!=0)
1125  {
1126  gmp_printf("\n// %8Zd t^%d",&hilbertcoef[i],hilbpower[i]);
1127  }
1128  }
1129  omFreeSize(hilbertcoef, (NNN)*sizeof(mpz_t));
1130  omFreeSize(hilbpower, (NNN)*sizeof(int));
1131  //printf("\n-------------------------------------\n");
1132 }
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:940
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void prune(Variable &alpha)
Definition: variable.cc:261
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly p_One(const ring r)
Definition: p_polys.cc:1313
int i
Definition: cfEzgcd.cc:123
ideal id_Mult(ideal h1, ideal h2, const ring R)
h1 * h2 one h_i must be an ideal (with at least one column) the other h_i may be a module (with no co...
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
static ideal SortByDeg(ideal I)
Definition: hilb.cc:368
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

§ SortByDeg()

static ideal SortByDeg ( ideal  I)
static

Definition at line 368 of file hilb.cc.

369 {
370  if(idIs0(I))
371  {
372  return(I);
373  }
374  int i;
375  ideal res;
376  idSkipZeroes(I);
377  res = idInit(1,1);
378  res->m[0] = poly(0);
379  for(i = 0; i<=IDELEMS(I)-1;i++)
380  {
381  res = SortByDeg_p(res, I->m[i]);
382  }
383  idSkipZeroes(res);
384  //idDegSortTest(res);
385  return(res);
386 }
poly res
Definition: myNF.cc:322
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static ideal SortByDeg_p(ideal I, poly p)
Definition: hilb.cc:268
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ SortByDeg_p()

static ideal SortByDeg_p ( ideal  I,
poly  p 
)
static

Definition at line 268 of file hilb.cc.

269 {
270  int i,j;
271  if((I == NULL) || (idIs0(I)))
272  {
273  ideal res = idInit(1,1);
274  res->m[0] = p;
275  return(res);
276  }
277  idSkipZeroes(I);
278  #if 1
279  for(i = 0; (i<IDELEMS(I)) && (DegMon(I->m[i])<=DegMon(p)); i++)
280  {
281  if(p_DivisibleBy( I->m[i],p, currRing))
282  {
283  return(I);
284  }
285  }
286  for(i = IDELEMS(I)-1; (i>=0) && (DegMon(I->m[i])>=DegMon(p)); i--)
287  {
288  if(p_DivisibleBy(p,I->m[i], currRing))
289  {
290  I->m[i] = NULL;
291  }
292  }
293  if(idIs0(I))
294  {
295  idSkipZeroes(I);
296  I->m[0] = p;
297  return(I);
298  }
299  #endif
300  idSkipZeroes(I);
301  //First I take the case when all generators have the same degree
302  if(DegMon(I->m[0]) == DegMon(I->m[IDELEMS(I)-1]))
303  {
304  if(DegMon(p)<DegMon(I->m[0]))
305  {
306  idInsertPoly(I,p);
307  idSkipZeroes(I);
308  for(i=IDELEMS(I)-1;i>=1; i--)
309  {
310  I->m[i] = I->m[i-1];
311  }
312  I->m[0] = p;
313  return(I);
314  }
315  if(DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))
316  {
317  idInsertPoly(I,p);
318  idSkipZeroes(I);
319  return(I);
320  }
321  }
322  if(DegMon(p)<=DegMon(I->m[0]))
323  {
324  idInsertPoly(I,p);
325  idSkipZeroes(I);
326  for(i=IDELEMS(I)-1;i>=1; i--)
327  {
328  I->m[i] = I->m[i-1];
329  }
330  I->m[0] = p;
331  return(I);
332  }
333  if(DegMon(p)>=DegMon(I->m[IDELEMS(I)-1]))
334  {
335  idInsertPoly(I,p);
336  idSkipZeroes(I);
337  return(I);
338  }
339  for(i = IDELEMS(I)-2; ;)
340  {
341  if(DegMon(p)==DegMon(I->m[i]))
342  {
343  idInsertPoly(I,p);
344  idSkipZeroes(I);
345  for(j = IDELEMS(I)-1; j>=i+1;j--)
346  {
347  I->m[j] = I->m[j-1];
348  }
349  I->m[i] = p;
350  return(I);
351  }
352  if(DegMon(p)>DegMon(I->m[i]))
353  {
354  idInsertPoly(I,p);
355  idSkipZeroes(I);
356  for(j = IDELEMS(I)-1; j>=i+2;j--)
357  {
358  I->m[j] = I->m[j-1];
359  }
360  I->m[i+1] = p;
361  return(I);
362  }
363  i--;
364  }
365 }
return P p
Definition: myNF.cc:203
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1777
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

§ SqFree()

static poly SqFree ( ideal  I)
static

Definition at line 846 of file hilb.cc.

847 {
848  int i,j;
849  bool flag=TRUE;
850  poly notsqrfree = NULL;
851  if(DegMon(I->m[IDELEMS(I)-1])<=1)
852  {
853  return(notsqrfree);
854  }
855  for(i=IDELEMS(I)-1;(i>=0)&&(flag);i--)
856  {
857  for(j=1;(j<=currRing->N)&&(flag);j++)
858  {
859  if(p_GetExp(I->m[i],j,currRing)>1)
860  {
861  flag=FALSE;
862  notsqrfree = p_ISet(1,currRing);
863  p_SetExp(notsqrfree,j,1,currRing);
864  }
865  }
866  }
867  if(notsqrfree != NULL)
868  {
869  p_Setm(notsqrfree,currRing);
870  }
871  return(notsqrfree);
872 }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define NULL
Definition: omList.c:10
static int DegMon(poly p)
!!!!!!!!!!!!!!!!!!!! Just for Monomial Ideals !!!!!!!!!!!!!!!!!!!!!!!!!!!!
Definition: hilb.cc:232
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297

Variable Documentation

§ hLength

int hLength
static

Definition at line 34 of file hilb.cc.

§ Q0

int* Q0
static

Definition at line 33 of file hilb.cc.

§ Ql

int * Ql
static

Definition at line 33 of file hilb.cc.

§ Qpol

int** Qpol
static

Definition at line 32 of file hilb.cc.