source: git/Singular/khstd.cc @ fc83e4

spielwiese
Last change on this file since fc83e4 was fc83e4, checked in by Olaf Bachmann <obachman@…>, 23 years ago
* bug fixes for tailRing git-svn-id: file:///usr/local/Singular/svn/trunk@4705 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: khstd.cc,v 1.12 2000-11-08 15:34:57 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 weights for variables were given to std computations,
51    // then pFDeg == degp == kHomModDeg (see kStd)
52    if ((degp!=kModDeg) && (degp!=kHomModDeg)) degp=pTotaldegree;
53    l = hilb->length()-1;
54    mw = (*hilb)[l];
55    newhilb = hHstdSeries(strat->Shdl,w,strat->kHomW,Q,strat->tailRing);
56    ln = newhilb->length()-1;
57    deg = degp(strat->P.p)-mw;
58    loop // compare the series in degree deg, try to increase deg -----------
59    {
60      if (deg < ln) // deg may be out of range
61      {
62        if (deg < l)
63          eledeg = (*newhilb)[deg]-(*hilb)[deg];
64        else
65          eledeg = (*newhilb)[deg];
66      }
67      else
68      {
69        if (deg < l)
70          eledeg = -(*hilb)[deg];
71        else // we have newhilb = hilb
72        {
73          while (strat->Ll>=0)
74          {
75            count++;
76            if(TEST_OPT_PROT)
77            {
78              PrintS("h");
79              mflush();
80            }
81            deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
82          }
83          delete newhilb;
84          return;
85        }
86      }
87      if (eledeg != 0)
88        break;
89      deg++;
90    } /* loop */
91    delete newhilb;
92    while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p)-mw < deg)) // the essential step
93    {
94      count++;
95      if(TEST_OPT_PROT)
96      {
97        PrintS("h");
98        mflush();
99      }
100      deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
101    }
102  }
103}
Note: See TracBrowser for help on using the repository browser.