source: git/kernel/khstd.cc @ d969cb

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