source: git/Singular/khstd.cc @ 64d729

spielwiese
Last change on this file since 64d729 was 02e9a1, checked in by Wilfred Pohl <pohl@…>, 25 years ago
quasihomogen for std with hilbert series git-svn-id: file:///usr/local/Singular/svn/trunk@2756 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: khstd.cc,v 1.8 1998-12-15 10:06:47 pohl Exp $ */
5/*
6* ABSTRACT:utils for hilbert driven kStd
7*/
8
9#include "mod2.h"
10#include "tok.h"
11#include "febase.h"
12#include "polys.h"
13#include "intvec.h"
14#include "kutil.h"
15#include "stairc.h"
16#include "kstd1.h"
17#include "khstd.h"
18
19/*2
20* compare the given hilbert series with the current one,
21* delete not needed pairs (if possible)
22*/
23void khCheck( ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count,
24              kStrategy strat)
25  /* ideal S=strat->Shdl, poly p=strat->P.p */
26/*
27* compute the number eledeg of elements with a degree >= deg(p) going into kStd,
28* p is already in S and for all further q going into S yields deg(q) >= deg(p),
29* the real computation is only done if the degree has changed,
30* then we have eledeg == 0 on this degree and we make:
31*   - compute the Hilbert series newhilb from S
32*     (hilb is the final Hilbert series)
33*   - compute the eledeg from newhilb-hilb for the first degree deg with
34*     newhilb-hilb != 0
35*     (Remark: consider the Hilbert series with coeff. up to infinity)
36*   - clear the set L for degree < deg
37* the number count is only for statistics (in the caller initialise count = 0),
38* in order to get a first computation, initialise eledeg = 1 in the caller.
39* The weights w are needed in the module case, otherwise NULL.
40*/
41{
42  intvec *newhilb;
43  int deg,l,ln,mw;
44  pFDegProc degp;
45
46  eledeg--;
47  if (eledeg == 0)
48  {
49    degp=pFDeg;
50    if ((degp!=kModDeg) && (degp!=kHomModDeg)) degp=pWDegree;
51    l = hilb->length()-1;
52    mw = (*hilb)[l];
53    newhilb = hHstdSeries(strat->Shdl,w,strat->kHomW,Q);
54    ln = newhilb->length()-1;
55    deg = degp(strat->P.p)-mw;
56    loop // compare the series in degree deg, try to increase deg -----------
57    {
58      if (deg < ln) // deg may be out of range
59      {
60        if (deg < l)
61          eledeg = (*newhilb)[deg]-(*hilb)[deg];
62        else
63          eledeg = (*newhilb)[deg];
64      }
65      else
66      {
67        if (deg < l)
68          eledeg = -(*hilb)[deg];
69        else // we have newhilb = hilb
70        {
71          while (strat->Ll>=0)
72          {
73            count++;
74            if(TEST_OPT_PROT)
75            {
76              PrintS("h");
77              mflush();
78            }
79            deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
80          }
81          return;
82        }
83      }
84      if (eledeg != 0)
85        break;
86      deg++;
87    } /* loop */
88    delete newhilb;
89    while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p)-mw < deg)) // the essential step
90    {
91      count++;
92      if(TEST_OPT_PROT)
93      {
94        PrintS("h");
95        mflush();
96      }
97      deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
98    }
99  }
100}
Note: See TracBrowser for help on using the repository browser.