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

◆ GBWeight()

GBWeight::GBWeight ( const FreeModule * F,
M2_arrayint wts )

Definition at line 7 of file gbweight.cpp.

7 : F_(F)
8{
9 // If wts has length 0 or is NULL:
10 // Use the primary degrees, if they are positive.
11 // For each that is negative, use "1"
12
13 // If the wt vector is not part of the degrees, then set
14 // use_component_degrees to false.
15
16 const PolynomialRing *A = F->get_ring()->cast_to_PolynomialRing();
17 assert(A != 0);
18 R_ = A->get_gb_ring();
19
20 const Monoid *M = R_->get_flattened_monoid();
21 nvars_ = R_->n_vars();
22
24
25 if (!wts0 || wts0->len != nvars_)
26 {
28 for (int i = 0; i < nvars_; i++)
29 {
30 int d = M->primary_degree_of_var(i);
31 wts_->array[i] = (d > 0 ? d : 1);
32 if (d <= 0) use_component_degrees_ = false;
33 }
34 }
35 else
36 {
37 // Use the provided wt vector
39 for (int i = 0; i < nvars_; i++)
40 {
41 int d = wts0->array[i];
42 wts_->array[i] = (d > 0 ? d : 1);
43 }
44 }
45
47
49 {
50 Fdegs_ = newarray_atomic(long, F->rank() + 1);
51 Fdegs_[0] = 0;
52 for (int j = 0; j < F->rank(); j++) Fdegs_[j + 1] = F->primary_degree(j);
53 }
54 else
55 Fdegs_ = nullptr;
56}
const Ring * get_ring() const
Definition freemod.hpp:102
int primary_degree(int i) const
Definition freemod.cpp:440
int rank() const
Definition freemod.hpp:105
GBRing * R_
Definition gbweight.hpp:73
M2_arrayint wts_
Definition gbweight.hpp:68
bool use_component_degrees_
Definition gbweight.hpp:69
const FreeModule * F_
Definition gbweight.hpp:70
size_t exp_size
Definition gbweight.hpp:75
int nvars_
Definition gbweight.hpp:72
long * Fdegs_
Definition gbweight.hpp:76
int primary_degree_of_var(int v) const
Definition monoid.hpp:177
virtual GBRing * get_gb_ring() const
Definition polyring.hpp:276
virtual const PolynomialRing * cast_to_PolynomialRing() const
Definition ring.hpp:243
M2_arrayint M2_makearrayint(int n)
Definition m2-types.cpp:6
#define EXPONENT_BYTE_SIZE(nvars)
Definition monoid.hpp:63
#define newarray_atomic(T, len)
Definition newdelete.hpp:91

References exp_size, EXPONENT_BYTE_SIZE, F_, Fdegs_, PolynomialRing::get_gb_ring(), FreeModule::get_ring(), M2_makearrayint(), newarray_atomic, nvars_, FreeModule::primary_degree(), Monoid::primary_degree_of_var(), R_, FreeModule::rank(), use_component_degrees_, and wts_.