2 * compare the given hilbert series with the current one, * delete not needed pairs (if possible) */
| 26 | * delete not needed pairs (if possible) |
| 27 | */ |
| 28 | void khCheck( ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, |
| 29 | kStrategy strat) |
| 30 | /* ideal S=strat->Shdl, poly p=strat->P.p */ |
| 31 | /* |
| 32 | * compute the number eledeg of elements with a degree >= deg(p) going into kStd, |
| 33 | * p is already in S and for all further q going into S yields deg(q) >= deg(p), |
| 34 | * the real computation is only done if the degree has changed, |
| 35 | * then we have eledeg == 0 on this degree and we make: |
| 36 | * - compute the Hilbert series newhilb from S |
| 37 | * (hilb is the final Hilbert series) |
| 38 | * - in module case: check that all comp up to strat->ak are used |
| 39 | * - compute the eledeg from newhilb-hilb for the first degree deg with |
| 40 | * newhilb-hilb != 0 |
| 41 | * (Remark: consider the Hilbert series with coeff. up to infinity) |
| 42 | * - clear the set L for degree < deg |
| 43 | * the number count is only for statistics (in the caller initialise count = 0), |
| 44 | * in order to get a first computation, initialise eledeg = 1 in the caller. |
| 45 | * The weights w are needed in the module case, otherwise NULL. |
| 46 | */ |
| 47 | { |
| 48 | intvec *newhilb; |
| 49 | int deg,l,ln,mw; |
| 50 | pFDegProc degp; |
| 51 | |
| 52 | eledeg--; |
| 53 | if (eledeg == 0) |
| 54 | { |
| 55 | if (strat->ak>0) |
| 56 | { |
| 57 | char *used_comp=(char*)omAlloc0(strat->ak+1); |
| 58 | int i; |
| 59 | for(i=strat->sl;i>0;i--) |
| 60 | { |
| 61 | used_comp[pGetComp(strat->S[i])]='\1'; |
| 62 | } |
| 63 | for(i=strat->ak;i>0;i--) |
| 64 | { |
| 65 | if(used_comp[i]=='\0') |
| 66 | { |
| 67 | omFree((ADDRESS)used_comp); |
| 68 | return; |
| 69 | } |
| 70 | } |
| 71 | omFree((ADDRESS)used_comp); |
| 72 | } |
| 73 | degp=currRing->pFDeg; |
| 74 | // if weights for variables were given to std computations, |
| 75 | // then pFDeg == degp == kHomModDeg (see kStd) |
| 76 | if ((degp!=kModDeg) && (degp!=kHomModDeg)) degp=p_Totaldegree; |
| 77 | // degp = pWDegree; |
| 78 | l = hilb->length()-1; |
| 79 | mw = (*hilb)[l]; |
| 80 | newhilb =hFirstSeries(strat->Shdl,w,Q,strat->kHomW); |
| 81 | ln = newhilb->length()-1; |
| 82 | deg = degp(strat->P.p,currRing); |
| 83 | loop // compare the series in degree deg, try to increase deg ----------- |
| 84 | { |
| 85 | if (deg < ln) // deg may be out of range |
no test coverage detected