source: git/Singular/khstd.cc @ 6e56de

spielwiese
Last change on this file since 6e56de was 416465, checked in by Olaf Bachmann <obachman@…>, 24 years ago
* bug-fixes from work with Thomas git-svn-id: file:///usr/local/Singular/svn/trunk@3826 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.8 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: khstd.cc,v 1.10 1999-11-15 17:20:13 obachman 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          delete newhilb;
82          return;
83        }
84      }
85      if (eledeg != 0)
86        break;
87      deg++;
88    } /* loop */
89    delete newhilb;
90    while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p)-mw < deg)) // the essential step
91    {
92      count++;
93      if(TEST_OPT_PROT)
94      {
95        PrintS("h");
96        mflush();
97      }
98      deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
99    }
100  }
101}
Note: See TracBrowser for help on using the repository browser.