source: git/Singular/khstd.cc @ 32df82

spielwiese
Last change on this file since 32df82 was 32df82, checked in by Hans Schönemann <hannes@…>, 27 years ago
* hannes: removed rcsid and Log: entries, added assignment module=poly corected type conversion int->module git-svn-id: file:///usr/local/Singular/svn/trunk@128 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.4 1997-04-02 15:07:14 Singular 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;
44  pFDegProc degp=pFDeg;
45  if (pFDeg!=kModDeg) { degp=pTotaldegree;}
46
47  eledeg--;
48  if (eledeg == 0)
49  {
50    newhilb = hHstdSeries(strat->Shdl,w,Q);
51    deg = degp(strat->P.p);
52    loop // compare the series in degree deg, try to increase deg -----------
53    {
54      if (deg < newhilb->length()) // deg may be out of range
55      {
56        if (deg < hilb->length())
57          eledeg = (*newhilb)[deg]-(*hilb)[deg];
58        else
59          eledeg = (*newhilb)[deg];
60      }
61      else
62      {
63        if (deg < hilb->length())
64          eledeg = -(*hilb)[deg];
65        else // we have newhilb = hilb
66        {
67          while (strat->Ll>=0)
68          {
69            count++;
70            if(TEST_OPT_PROT)
71            {
72              PrintS("h");
73              mflush();
74            } 
75            deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
76          }
77          return;
78        }
79      }
80      if (eledeg != 0)
81        break;
82      deg++;
83    } /* loop */
84    delete newhilb;
85    while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p) < deg)) // the essential step
86    {
87      count++;
88      if(TEST_OPT_PROT)
89      {
90        PrintS("h");
91        mflush();
92      } 
93      deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
94    }
95  }
96}
Note: See TracBrowser for help on using the repository browser.