Macaulay2 Engine
Loading...
Searching...
No Matches

◆ KBasis()

KBasis::KBasis ( const Matrix * bottom,
const int * lo_degree,
const int * hi_degree,
std::vector< int > heftvec,
std::vector< int > varlist,
bool do_truncation,
int limit )
private

Definition at line 168 of file matrix-kbasis.cpp.

175 : bottom_matrix(bottom),
176 mHeftVector(heftvec),
177 mVariables(varlist),
178 do_truncation(do_truncation0),
179 weight_has_zeros(false),
180 limit(limit0),
181 lo_degree(lo_degree0),
182 hi_degree(hi_degree0),
183 kb_error(false)
184{
185 P = bottom->get_ring()->cast_to_PolynomialRing();
186 M = P->getMonoid();
187 D = P->get_degree_ring()->getMonoid();
188
189 if (lo_degree == nullptr && hi_degree == nullptr) { computation_type = KB_FULL; }
190 else if (mHeftVector.size() == 1) { computation_type = KB_SINGLE; }
191 else { computation_type = KB_MULTI; }
192
193 // Compute the (non-negative) weights of each of the variables in
194 // 'mVariables'.
195
196 var_wts = newarray_atomic(int, mVariables.size());
197 var_degs = newarray_atomic(int, mVariables.size() * mHeftVector.size());
198 int *exp =
199 newarray_atomic(int, D->n_vars()); // used to hold exponent vectors
200 int next = 0;
201 for (int i = 0; i < mVariables.size(); i++, next += mHeftVector.size())
202 {
203 int v = mVariables[i];
204 D->to_expvector(M->degree_of_var(v), exp);
206 if (var_wts[i] == 0) weight_has_zeros = true;
207 exponents::copy(mHeftVector.size(), exp, var_degs + next);
208 }
209 freemem(exp);
210
211 // Set the recursion variables
212 kb_exp = newarray_atomic_clear(int, P->n_vars());
213 kb_exp_weight = 0;
214
215 if (lo_degree != nullptr)
218 if (hi_degree != nullptr)
221
222 if (lo_degree && hi_degree && mHeftVector.size() == 1 && mHeftVector[0] < 0)
223 {
224 int t = kb_target_lo_weight;
227 }
228
229 kb_mon = M->make_one();
230
231 mat = MatrixConstructor(bottom->rows(), 0);
232 kb_exp_multidegree = D->make_one();
233
234 if (mHeftVector.size() > 1 && lo_degree != nullptr)
235 {
236 kb_target_multidegree = D->make_one();
238 }
239 else { kb_target_multidegree = nullptr; }
240}
static Exponent weight(int nvars, ConstExponents a, const std::vector< Exponent > &wts)
static void copy(int nvars, ConstExponents a, Exponents result)
const Monoid * M
int * kb_exp_multidegree
const Matrix * bottom_matrix
std::vector< int > mVariables
const Monoid * D
const int * lo_degree
MatrixConstructor mat
bool do_truncation
int * var_degs
const int * hi_degree
const PolynomialRing * P
enum KBasis::@037164154004220152265360251131226313056117246356 computation_type
int kb_target_hi_weight
std::vector< int > mHeftVector
int kb_target_lo_weight
int * kb_target_multidegree
int kb_exp_weight
int * var_wts
bool weight_has_zeros
const Ring * get_ring() const
Definition matrix.hpp:134
const FreeModule * rows() const
Definition matrix.hpp:144
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
void freemem(void *s)
Definition m2-mem.cpp:103
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2298
#define newarray_atomic_clear(T, len)
Definition newdelete.hpp:93
#define newarray_atomic(T, len)
Definition newdelete.hpp:91

References bottom_matrix, computation_type, ExponentVector< int, true >::copy(), D, do_truncation, freemem(), Matrix::get_ring(), hi_degree, kb_error, kb_exp, kb_exp_multidegree, kb_exp_weight, KB_FULL, kb_mon, kb_target_hi_weight, kb_target_lo_weight, kb_target_multidegree, limit, lo_degree, M, mat, Matrix, mHeftVector, mVariables, newarray_atomic, newarray_atomic_clear, P, Matrix::rows(), var_degs, var_wts, ExponentVector< int, true >::weight(), and weight_has_zeros.

Referenced by k_basis().