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

◆ Monoid() [2/2]

Monoid::Monoid ( const MonomialOrdering * mo,
const PolynomialRing * DR,
const std::vector< std::string > names,
const std::vector< int > degs,
const std::vector< int > hefts )
private

Definition at line 83 of file monoid.cpp.

88 : mDegreeMonoid(deg_ring->getMonoid()),
89 mDegreeRing(deg_ring),
90 mo_(mo),
91 monorder_(nullptr), // set below
93 mVariableNames(names),
94 mDegrees(degs),
95 mHeftVector(hefts),
96 mHeftDegrees({}), // set below, except in the trivial case.
97 exp_size(0), // set below
98 monomial_size_(0), // set below
100 first_weights_slot_(-1), // set below
101 n_invertible_vars_(0), // set below
102 n_before_component_(0), // set below
103 n_after_component_(0), // set below
104 component_up_(true), // set below
105 local_vars({}), // set below
106 overflow(nullptr)
107// nslots: set below
108{
110
111 monomial_size_ = monorder_->nslots;
112 n_before_component_ = monorder_->nslots_before_component;
114 component_up_ = monorder_->component_up;
115
116 // Set nslots_
117 int total = 0;
118 for (int i = 0; i < monorder_->nblocks; i++)
119 {
120 total += monorder_->blocks[i].nslots;
121 nslots_.push_back(total);
122 }
123
124 // Set first_weight_value_
125 bool get_out = false;
127 for (int i = 0; i < monorder_->nblocks && !get_out; i++)
128 {
129 switch (monorder_->blocks[i].typ)
130 {
131 case MO_LEX:
132 case MO_LEX2:
133 case MO_LEX4:
134 case MO_NC_LEX:
135 get_out = true;
136 break;
137 case MO_REVLEX:
138 case MO_LAURENT:
140 case MO_GREVLEX:
141 case MO_GREVLEX2:
142 case MO_GREVLEX4:
143 case MO_GREVLEX_WTS:
144 case MO_GREVLEX2_WTS:
145 case MO_GREVLEX4_WTS:
146 case MO_WEIGHTS:
148 case MO_POSITION_UP:
149 continue;
150 case MO_POSITION_DOWN:
151 continue;
152 default:
153 INTERNAL_ERROR("monomial order block type not handled");
154 }
155 }
157
159
160 set_degrees();
162
164
165 for (int i=0; i<n_vars(); ++i)
166 {
167 bool isLaurent = isLaurentVariable(i);
168 mLaurentVariablesPredicate.push_back(isLaurent);
169 }
170
171 // Debugging only:
172 // fprintf(stderr, "%d variables < 1\n", local_vars->len);
173 // if (local_vars->len > 0)
174 // {
175 // fprintf(stderr, "they are: ");
176 // for (int i=0; i<local_vars->len; i++)
177 // fprintf(stderr, "%d ", local_vars->array[i]);
178 // fprintf(stderr, "\n");
179 // }
180}
bool component_up_
indicates whether free module components are ordered lexicographically
Definition monoid.hpp:136
const std::vector< int > mDegrees
length mVariableCount * (length of a single degree vector)
Definition monoid.hpp:103
std::vector< bool > mLaurentVariablesPredicate
These are the variables which can have negative exponents.
Definition monoid.hpp:140
int n_after_component_
Definition monoid.hpp:134
const Monoid * mDegreeMonoid
Definition monoid.hpp:90
int first_weights_slot_
Definition monoid.hpp:129
gc_vector< int > nslots_
number of slots per monomial order block
Definition monoid.hpp:143
int n_vars() const
Definition monoid.hpp:207
size_t exp_size
Definition monoid.hpp:120
const PolynomialRing * mDegreeRing
Definition monoid.hpp:91
int n_invertible_vars_
number of invertible variables
Definition monoid.hpp:131
void set_degrees()
sets mHeftDegrees and mDegreeOfVar
Definition monoid.cpp:182
const int mVariableCount
number of variables
Definition monoid.hpp:99
const MonomialOrdering * mo_
the monomial ordering of the variables
Definition monoid.hpp:94
void set_overflow_flags()
used for preventing overflows
Definition monoid.cpp:242
std::vector< int > mHeftDegrees
length mVariableCount
Definition monoid.hpp:108
enum Monoid::overflow_type * overflow
std::vector< int > local_vars
These are the variables which are < 1 in the monomial order.
Definition monoid.hpp:138
int n_before_component_
indicates where the free module components are in the monomial order
Definition monoid.hpp:133
const std::vector< int > mHeftVector
length of a single degree vector
Definition monoid.hpp:105
bool isLaurentVariable(int i) const
Definition monoid.hpp:197
const std::vector< std::string > mVariableNames
names of variables
Definition monoid.hpp:101
int monomial_bound_
Definition monoid.hpp:124
int monomial_size_
size of an encoded monomial
Definition monoid.hpp:123
MonomialOrder * monorder_
Definition monoid.hpp:96
void INTERNAL_ERROR(const char *s,...)
Definition error.c:36
MonomialOrder * monomialOrderMake(const MonomialOrdering *mo)
#define EXPONENT_BYTE_SIZE(nvars)
Definition monoid.hpp:63
int rawNumberOfInvertibleVariables(const MonomialOrdering *mo)
M2_arrayint rawNonTermOrderVariables(const MonomialOrdering *mo)
int rawNumberOfVariables(const MonomialOrdering *mo)
@ MO_GREVLEX4_WTS
@ MO_LAURENT_REVLEX
@ MO_NC_LEX
@ MO_LEX4
@ MO_REVLEX
@ MO_POSITION_UP
@ MO_LEX
@ MO_GREVLEX
@ MO_LEX2
@ MO_GREVLEX4
@ MO_LAURENT
@ MO_GREVLEX2_WTS
@ MO_WEIGHTS
@ MO_POSITION_DOWN
@ MO_GREVLEX2
@ MO_GREVLEX_WTS
std::vector< T > M2_arrayint_to_stdvector(M2_arrayint arr)
Definition util.hpp:96

References mDegreeMonoid, mDegreeRing, mDegrees, mHeftDegrees, mHeftVector, mo_, monorder_, mVariableCount, mVariableNames, and rawNumberOfVariables().