source: git/Singular/khstd.cc @ 5480da

spielwiese
Last change on this file since 5480da was 3e54dd, checked in by Wilfred Pohl <pohl@…>, 26 years ago
modulweight git-svn-id: file:///usr/local/Singular/svn/trunk@934 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.5 1997-11-25 15:29:57 pohl Exp $ */
5/*
6* ABSTRACT:utils for hilbert driven std
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 std,
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=pFDeg;
45  if (pFDeg!=kModDeg) { degp=pTotaldegree;}//quasihomogen!!
46
47  eledeg--;
48  if (eledeg == 0)
49  {
50    l = hilb->length()-1;
51    mw = (*hilb)[l];
52    newhilb = hHstdSeries(strat->Shdl,w,Q);
53    ln = newhilb->length()-1;
54    deg = degp(strat->P.p)-mw;
55    loop // compare the series in degree deg, try to increase deg -----------
56    {
57      if (deg < ln) // deg may be out of range
58      {
59        if (deg < l)
60          eledeg = (*newhilb)[deg]-(*hilb)[deg];
61        else
62          eledeg = (*newhilb)[deg];
63      }
64      else
65      {
66        if (deg < l)
67          eledeg = -(*hilb)[deg];
68        else // we have newhilb = hilb
69        {
70          while (strat->Ll>=0)
71          {
72            count++;
73            if(TEST_OPT_PROT)
74            {
75              PrintS("h");
76              mflush();
77            } 
78            deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
79          }
80          return;
81        }
82      }
83      if (eledeg != 0)
84        break;
85      deg++;
86    } /* loop */
87    delete newhilb;
88    while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p)-mw < deg)) // the essential step
89    {
90      count++;
91      if(TEST_OPT_PROT)
92      {
93        PrintS("h");
94        mflush();
95      } 
96      deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
97    }
98  }
99}
Note: See TracBrowser for help on using the repository browser.