My Project
Loading...
Searching...
No Matches
khstd.h File Reference
#include "kernel/structs.h"
#include "coeffs/bigintmat.h"

Go to the source code of this file.

Functions

void khCheck (ideal Q, intvec *w, bigintmat *hilb, int &eledeg, int &count, kStrategy strat)
 
void khCheckLocInhom (ideal Q, intvec *w, bigintmat *hilb, int &count, kStrategy strat)
 

Function Documentation

◆ khCheck()

void khCheck ( ideal Q,
intvec * w,
bigintmat * hilb,
int & eledeg,
int & count,
kStrategy strat )

Definition at line 28 of file khstd.cc.

47{
48 bigintmat *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->cols();
79 mw = n_Int(BIMATELEM(*hilb,1,l),coeffs_BIGINT);
80 newhilb =hFirstSeries0b(strat->Shdl,Q,strat->kHomW,w,currRing,coeffs_BIGINT);
81 ln = newhilb->cols();
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
86 {
87 if (deg < l)
88 {
89 number s=n_Sub(BIMATELEM(*newhilb,1,deg+1),
90 BIMATELEM(*hilb,1,deg+1),coeffs_BIGINT);
91 eledeg = n_Int(s,coeffs_BIGINT);
92 }
93 else
94 eledeg = n_Int(BIMATELEM(*newhilb,1,deg+1),coeffs_BIGINT);
95 }
96 else
97 {
98 if (deg < l)
99 eledeg = -n_Int(BIMATELEM(*hilb,1,deg+1),coeffs_BIGINT);
100 else // we have newhilb = hilb
101 {
102 while (strat->Ll>=0)
103 {
104 count++;
105 if(TEST_OPT_PROT)
106 {
107 PrintS("h");
108 mflush();
109 }
110 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
111 }
112 delete newhilb;
113 return;
114 }
115 }
116 if (eledeg > 0) // elements to delete
117 break;
118 else if (eledeg <0) // strange....see bug_43
119 return;
120 deg++;
121 } /* loop */
122 delete newhilb;
123 while ((strat->Ll>=0) && (degp(strat->L[strat->Ll].p,currRing)-mw < deg)) // the essential step
124 {
125 count++;
126 if(TEST_OPT_PROT)
127 {
128 PrintS("h");
129 mflush();
130 }
131 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
132 }
133 }
134}
void * ADDRESS
Definition auxiliary.h:120
#define BIMATELEM(M, I, J)
Definition bigintmat.h:133
int l
Definition cfEzgcd.cc:100
int i
Definition cfEzgcd.cc:132
Matrices of numbers.
Definition bigintmat.h:51
int cols() const
Definition bigintmat.h:144
int Ll
Definition kutil.h:352
polyset S
Definition kutil.h:307
int ak
Definition kutil.h:354
intvec * kHomW
Definition kutil.h:337
ideal Shdl
Definition kutil.h:304
LObject P
Definition kutil.h:303
LSet L
Definition kutil.h:328
int sl
Definition kutil.h:349
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
Definition coeffs.h:548
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
Definition coeffs.h:656
const CanonicalForm int s
Definition facAbsFact.cc:51
const CanonicalForm & w
Definition facAbsFact.cc:51
bigintmat * hFirstSeries0b(ideal I, ideal Q, intvec *wdegree, intvec *shifts, const ring src, const coeffs biv_cf)
Definition hilb.cc:2655
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2417
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2407
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1215
#define omFree(addr)
#define omAlloc0(size)
#define TEST_OPT_PROT
Definition options.h:105
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1523
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define pGetComp(p)
Component.
Definition polys.h:38
void PrintS(const char *s)
Definition reporter.cc:284
#define mflush()
Definition reporter.h:58
long(* pFDegProc)(poly p, ring r)
Definition ring.h:39
int status int void size_t count
Definition si_signals.h:69
#define Q
Definition sirandom.c:26
#define loop
Definition structs.h:71

◆ khCheckLocInhom()

void khCheckLocInhom ( ideal Q,
intvec * w,
bigintmat * hilb,
int & count,
kStrategy strat )

Definition at line 248 of file khstd.cc.

259{
260 ideal Lm;
261 bigintmat *newhilb;
262
263 Lm = id_Head(strat->Shdl,currRing);
264
265 newhilb =hFirstSeries0b(strat->Shdl,Q,strat->kHomW,w,currRing,coeffs_BIGINT);
266
267 if(newhilb->compare(hilb) == 0)
268 {
269 while (strat->Ll>=0)
270 {
271 count++;
272 if(TEST_OPT_PROT)
273 {
274 PrintS("h");
275 mflush();
276 }
277 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
278 }
279 delete newhilb;
280 return;
281 }
282 id_Delete(&Lm,currRing);
283}
int compare(const bigintmat *op) const
Definition bigintmat.cc:360
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
ideal id_Head(ideal h, const ring r)
returns the ideals of initial terms