Gröbner basis project
Codebase for research into Gröbner basis computation
Monomial Orderings

classes defining monomial orderings More...

Classes

class  CachedWGrevlex_Ordering
 the weighted grevlex ordering for a specified number of variables, with cached weights for each monomial More...
 
class  Generic_Grevlex
 generic grevlex ordering, works with any number of variables More...
 
class  Grevlex_Order_Data
 data for the grevlex monomial ordering More...
 
class  Grevlex_Ordering
 the grevlex ordering for a specified number of variables More...
 
class  Lex_Ordering
 the lex ordering for a specified number of variables More...
 
class  Matrix_Ordering
 orderings defined by a nonsingular matrix More...
 
class  Monomial_Order_Data
 data for a monomial ordering: optional, but stored in Monomial More...
 
class  Monomial_Ordering
 interface to a monomial ordering More...
 
class  Nonsingular_Matrix_Ordering_Exception
 exceptions for Matrix_Ordering More...
 
class  Weighted_Ordering
 interface to a weighted monomial ordering More...
 
class  WGrevlex
 the grevlex ordering for a specified number of variables More...
 
class  WGrevlex_Order_Data
 data for the weighted grevlex monomial ordering More...
 

Functions

bool nonsingular (NVAR_TYPE m, NVAR_TYPE n, const WT_TYPE **A)
 verifies that a matrix supplied for an ordering is not nonsingular More...
 

Detailed Description

classes defining monomial orderings


Class Documentation

◆ CachedWGrevlex_Ordering

class CachedWGrevlex_Ordering

the weighted grevlex ordering for a specified number of variables, with cached weights for each monomial

Author
John Perry
Date
2015

The weighted grevlex ordering first compares weighted sums of all exponents, then the sums of all but the last exponent, then the sums of all but the last two exponents, and so forth, until either the sums differ or it runs out of variables. Whether the weights are applied to more than one sum can be decided at construction.

Examples:
test_4by4.cpp, test_cyclicn.cpp, and test_dynamic.cpp.

Definition at line 454 of file particular_orderings.hpp.

Inheritance diagram for CachedWGrevlex_Ordering:
Weighted_Ordering Monomial_Ordering

Public Member Functions

Construction
 CachedWGrevlex_Ordering (NVAR_TYPE number_of_variables, WT_TYPE *w, bool thorough=true)
 creates a weighted grevlex ordering specific to \(n\) variables, using the weights specified by \(w\) More...
 
Basic properties
virtual const WT_TYPE * order_weights () const override
 the weights that define this ordering
 
Comparison
virtual int cmp (const Monomial &, const Monomial &) const override
 resturns 0 if they are alike; positive if first larger; negative otherwise
 
virtual bool first_larger (const Monomial &t, const Monomial &u) const override
 returns true iff \(t>u\) by sums of successively fewer exponents
 
virtual bool first_smaller (const Monomial &t, const Monomial &u) const override
 returns true iff \(t< u\) by sums of successively fewer exponents
 
virtual bool first_larger_than_multiple (const Monomial &t, const Monomial &u, const Monomial &v) const override
 returns true iff \(t>u\) by sums of successively fewer exponents
 
Utility
DEG_TYPE partial_degree (const Monomial &t, NVAR_TYPE i) const
 
DEG_TYPE compute_ith_weight (const Monomial &t, NVAR_TYPE i) const
 
virtual void set_data (Monomial &t) const override
 sets the Monomial’s monomial_ordering_data
 
Basic properties
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Protected Attributes

const bool fully_apply
 whether to apply the weights to more than the first sum
 
const NVAR_TYPE n
 the number of variables, which should remain constant
 
const WT_TYPE * weights
 the weights that define this ordering
 

Friends

I/O
ostream & operator<< (ostream &os, const CachedWGrevlex_Ordering &word)
 

Constructor & Destructor Documentation

◆ CachedWGrevlex_Ordering()

CachedWGrevlex_Ordering::CachedWGrevlex_Ordering ( NVAR_TYPE  number_of_variables,
WT_TYPE *  w,
bool  thorough = true 
)

creates a weighted grevlex ordering specific to \(n\) variables, using the weights specified by \(w\)

Parameters
thoroughdetermines whether the weights are applied to subsequent orderings; if false, the second, third, etc. sums are ordinary sums of the exponents, rather than weighted sums
number_of_variablesthe number of variables this will compare; weights should have this length!
wthe weights to multiply to each exponent

Definition at line 423 of file particular_orderings.cpp.

Member Function Documentation

◆ compute_ith_weight()

DEG_TYPE CachedWGrevlex_Ordering::compute_ith_weight ( const Monomial t,
NVAR_TYPE  i 
) const
Returns
the sum of the first i exponents
Parameters
ta Monomial whose degree we want
iindex to an exponent

Definition at line 519 of file particular_orderings.cpp.

◆ partial_degree()

DEG_TYPE CachedWGrevlex_Ordering::partial_degree ( const Monomial t,
NVAR_TYPE  i 
) const
inline
Returns
the weighted sum of the first i exponents
Parameters
ta Monomial whose degree we want
iindex to an exponent
Warning
Be sure that t has the correct ordering!

Definition at line 504 of file particular_orderings.hpp.

◆ Generic_Grevlex

class Generic_Grevlex

generic grevlex ordering, works with any number of variables

Author
John Perry
Date
2015

The difference between Generic_Grevlex and Grevlex_Ordering is that the former doesn’t track any Monomial_Order_Data, while the latter relies on it. The latter should, as a result, be more time efficient, while the former is more space efficient. Generic_Grevlex will also order monomials which by design have a different number of variables, though that should not in general be something one encounters, and it’s rather dangerous with first_larger_than_multiple().

Definition at line 43 of file particular_orderings.hpp.

Inheritance diagram for Generic_Grevlex:
Monomial_Ordering

Public Member Functions

Comparison
virtual bool first_larger (const Monomial &, const Monomial &) const override
 returns true iff the first Monomial is larger than the second
 
virtual bool first_smaller (const Monomial &, const Monomial &) const override
 returns true iff the first Monomial is smaller than the second
 
virtual bool first_larger_than_multiple (const Monomial &, const Monomial &, const Monomial &) const override
 returns true iff the first Monomial is larger than the product of the second and the third
 
virtual int cmp (const Monomial &t, const Monomial &u) const override
 
Utility

sets the Monomial’s monomial_ordering_data

virtual void set_data (Monomial &t) const override
 sets monomial ordering’s data; default is to do nothing More...
 
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Member Function Documentation

◆ cmp()

virtual int Generic_Grevlex::cmp ( const Monomial t,
const Monomial u 
) const
inlineoverridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
1 if \( t > u \) , -1 if \( t < u \) , and 0 otherwise

Implements Monomial_Ordering.

Definition at line 63 of file particular_orderings.hpp.

◆ set_data()

void Generic_Grevlex::set_data ( Monomial t) const
overridevirtual

sets monomial ordering’s data; default is to do nothing

Child classes that override this function are strongly recommended to use set_ordering_degree() of the Monomial class to set a primary degree. For weighted/graded degree orderings, this typically improves performance nontrivially.

Reimplemented from Monomial_Ordering.

Definition at line 54 of file particular_orderings.cpp.

◆ Grevlex_Order_Data

class Grevlex_Order_Data

data for the grevlex monomial ordering

Author
John Perry
Date
2015

The data involves an array of \(n\) DEG_TYPE, where the first entry is the sum of the first \(n\) variables, the second entry is the sum of all but the last variable, etc.

Definition at line 97 of file particular_orderings.hpp.

Inheritance diagram for Grevlex_Order_Data:
Monomial_Order_Data

Public Member Functions

Construction
 Grevlex_Order_Data (const Monomial &t)
 creates an array of partial weights of t More...
 
 Grevlex_Order_Data (const Grevlex_Order_Data &)
 copy constructor
 
virtual Grevlex_Order_Dataclone () override
 clone “constructor”
 
Destruction
 ~Grevlex_Order_Data ()
 deletes the array creates by the constructor
 
Basic properties
DEG_TYPE operator[] (NVAR_TYPE i) const
 returns the sum of the first \(i\) variables’ exponents
 
virtual DEG_TYPE grading (NVAR_TYPE i) const override
 default value is useless; orderings that supply gradings should redefine
 
Computation
void assign_gradings (const Monomial &)
 assigns gradings to a pre-allocated array More...
 
- Public Member Functions inherited from Monomial_Order_Data
virtual ~Monomial_Order_Data ()
 does nothing but guarantee polymorphism (stupid, stupid C++)
 

Protected Attributes

DEG_TYPE * gradings
 list of partial sums of exponents
 
const NVAR_TYPE number_of_gradings
 length of gradings
 

Constructor & Destructor Documentation

◆ Grevlex_Order_Data()

Grevlex_Order_Data::Grevlex_Order_Data ( const Monomial t)

creates an array of partial weights of t

Parameters
ta Monomial whose parial weights this caches

Definition at line 223 of file particular_orderings.cpp.

Member Function Documentation

◆ assign_gradings()

void Grevlex_Order_Data::assign_gradings ( const Monomial t)

assigns gradings to a pre-allocated array

Warning
This does not create the array if it does not exist already!

Definition at line 215 of file particular_orderings.cpp.

◆ Grevlex_Ordering

class Grevlex_Ordering

the grevlex ordering for a specified number of variables

Author
John Perry
Date
2015

The grevlex ordering first compares the sums of the exponents, then the sums of all but the last exponent, then the sums of all but the last two exponents, and so forth, until either the sums differ or it runs out of variables.

Examples:
test_cyclicn.cpp.

Definition at line 150 of file particular_orderings.hpp.

Inheritance diagram for Grevlex_Ordering:
Monomial_Ordering

Public Member Functions

Construction
 Grevlex_Ordering (NVAR_TYPE number_of_variables)
 creates a grevlex ordering specific to the specified number of variables
 
Comparison
virtual bool first_larger (const Monomial &t, const Monomial &u) const override
 returns true iff \(t>u\) by sums of successively fewer exponents
 
virtual bool first_smaller (const Monomial &t, const Monomial &u) const override
 returns true iff \(t< u\) by sums of successively fewer exponents
 
virtual bool first_larger_than_multiple (const Monomial &t, const Monomial &u, const Monomial &v) const override
 
DEG_TYPE partial_degree (const Monomial &t, NVAR_TYPE i) const
 
virtual int cmp (const Monomial &t, const Monomial &u) const override
 
Utility
DEG_TYPE compute_ith_weight (const Monomial &t, NVAR_TYPE i) const
 computes the sum of the first i exponents
 
virtual void set_data (Monomial &t) const override
 sets the Monomial’s monomial_ordering_data
 
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Protected Attributes

const NVAR_TYPE n
 the number of variables, which should remain constant
 

Member Function Documentation

◆ cmp()

virtual int Grevlex_Ordering::cmp ( const Monomial t,
const Monomial u 
) const
inlineoverridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
1 if \( t > u \) , -1 if \( t < u \) , and 0 otherwise

Implements Monomial_Ordering.

Definition at line 190 of file particular_orderings.hpp.

◆ first_larger_than_multiple()

bool Grevlex_Ordering::first_larger_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
overridevirtual
Parameters
ta Monomial, to compare to \( uv \)
ua Monomial, to multiply to \( v \)
va Monomial, to multiply to \( u \)
Returns
true iff \(t>uv\)

Implements Monomial_Ordering.

Definition at line 287 of file particular_orderings.cpp.

◆ partial_degree()

DEG_TYPE Grevlex_Ordering::partial_degree ( const Monomial t,
NVAR_TYPE  i 
) const
Returns
the weighted sum of the first i exponents
Warning
Be sure that t has the correct ordering!
Parameters
ta Monomial whose partial degree we want
iindex of the indeterminate to which we compute the degree

Definition at line 306 of file particular_orderings.cpp.

◆ Lex_Ordering

class Lex_Ordering

the lex ordering for a specified number of variables

Author
John Perry
Date
2015

The lex ordering is a dictionary ordering. The first variable is considered largest, and monomials with a larger degree in the first variable will be considered larger than monomials with a smaller degree in the first variable, regardless of the overall degree in all variables.

Examples:
test_cyclicn.cpp.

Definition at line 328 of file particular_orderings.hpp.

Inheritance diagram for Lex_Ordering:
Monomial_Ordering

Public Member Functions

Construction
 Lex_Ordering (NVAR_TYPE number_of_variables)
 creates a lex ordering specific to \(n\) variables More...
 
Comparison
virtual bool first_larger (const Monomial &t, const Monomial &u) const override
 
virtual bool first_smaller (const Monomial &t, const Monomial &u) const override
 
virtual bool first_larger_than_multiple (const Monomial &t, const Monomial &u, const Monomial &v) const override
 
virtual int cmp (const Monomial &t, const Monomial &u) const override
 
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
virtual void set_data (Monomial &) const
 sets monomial ordering’s data; default is to do nothing More...
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Protected Attributes

const NVAR_TYPE n
 the number of variables, which should remain constant
 

Constructor & Destructor Documentation

◆ Lex_Ordering()

Lex_Ordering::Lex_Ordering ( NVAR_TYPE  number_of_variables)

creates a lex ordering specific to \(n\) variables

Parameters
number_of_variablesnumber of variables this ordering should check

Definition at line 329 of file particular_orderings.cpp.

Member Function Documentation

◆ cmp()

virtual int Lex_Ordering::cmp ( const Monomial t,
const Monomial u 
) const
inlineoverridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
1 if \( t>u \) , -1 if \( t < u \) , and 0 otherwise

Implements Monomial_Ordering.

Definition at line 366 of file particular_orderings.hpp.

◆ first_larger()

bool Lex_Ordering::first_larger ( const Monomial t,
const Monomial u 
) const
overridevirtual
Returns
true iff \(t>u\)
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)

Implements Monomial_Ordering.

Definition at line 332 of file particular_orderings.cpp.

◆ first_larger_than_multiple()

bool Lex_Ordering::first_larger_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
overridevirtual
Parameters
ta Monomial, to compare to \( uv \)
ua Monomial, to multiply to \( v \)
va Monomial, to multiply to \( u \)
Returns
true iff \(t>uv\)

Implements Monomial_Ordering.

Definition at line 364 of file particular_orderings.cpp.

◆ first_smaller()

bool Lex_Ordering::first_smaller ( const Monomial t,
const Monomial u 
) const
overridevirtual
Returns
true iff \(t< u\)
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)

Implements Monomial_Ordering.

Definition at line 348 of file particular_orderings.cpp.

◆ Matrix_Ordering

class Matrix_Ordering

orderings defined by a nonsingular matrix

Author
John Perry
Date
2016

Definition at line 556 of file particular_orderings.hpp.

Inheritance diagram for Matrix_Ordering:
Monomial_Ordering

Public Member Functions

 Matrix_Ordering (NVAR_TYPE rows, NVAR_TYPE cols, const WT_TYPE **data)
 checks that data defines a nonsingular matrix, and sets things up More...
 
virtual int cmp (const Monomial &t, const Monomial &u) const override
 
virtual bool first_larger (const Monomial &t, const Monomial &u) const override
 
virtual bool first_larger_than_multiple (const Monomial &t, const Monomial &u, const Monomial &v) const override
 
virtual bool first_smaller (const Monomial &t, const Monomial &u) const override
 

Protected Attributes

const NVAR_TYPE m
 the number of rows
 
const NVAR_TYPE n
 the number of columns
 
const WT_TYPE ** W
 the matrix that defines this ordering
 

Constructor & Destructor Documentation

◆ Matrix_Ordering()

Matrix_Ordering::Matrix_Ordering ( NVAR_TYPE  rows,
NVAR_TYPE  cols,
const WT_TYPE **  data 
)

checks that data defines a nonsingular matrix, and sets things up

Parameters
rowsnumber of rows desired in the matrix
colsnumber of columns desired in the matrix
datashould contain \( rows \times cols \) elements

Definition at line 620 of file particular_orderings.cpp.

Member Function Documentation

◆ cmp()

virtual int Matrix_Ordering::cmp ( const Monomial t,
const Monomial u 
) const
inlineoverridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
1 if \( t>u \) , -1 if \( t < u \) , and 0 otherwise

Implements Monomial_Ordering.

Definition at line 592 of file particular_orderings.hpp.

◆ first_larger()

bool Matrix_Ordering::first_larger ( const Monomial t,
const Monomial u 
) const
overridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
true iff first Monomial is larger than second

Implements Monomial_Ordering.

Definition at line 627 of file particular_orderings.cpp.

◆ first_larger_than_multiple()

bool Matrix_Ordering::first_larger_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
overridevirtual
Parameters
ta Monomial, to compare to \( uv \)
ua Monomial, to multiply to \( v \)
va Monomial, to multiply to \( u \)
Returns
true iff first Monomial is larger than product of second and third

Implements Monomial_Ordering.

Definition at line 673 of file particular_orderings.cpp.

◆ first_smaller()

bool Matrix_Ordering::first_smaller ( const Monomial t,
const Monomial u 
) const
overridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
true iff first Monomial is smaller than second

Implements Monomial_Ordering.

Definition at line 650 of file particular_orderings.cpp.

◆ Monomial_Order_Data

class Monomial_Order_Data

data for a monomial ordering: optional, but stored in Monomial

Author
John Perry
Date
2015

Definition at line 39 of file monomial_ordering.hpp.

Inheritance diagram for Monomial_Order_Data:
Grevlex_Order_Data WGrevlex_Order_Data

Public Member Functions

Construction
virtual Monomial_Order_Dataclone ()
 default clone returns nullptr
 
Basic data
virtual DEG_TYPE grading (NVAR_TYPE) const
 default value is useless; orderings that supply gradings should redefine
 
Destruction
virtual ~Monomial_Order_Data ()
 does nothing but guarantee polymorphism (stupid, stupid C++)
 

◆ Monomial_Ordering

class Monomial_Ordering

interface to a monomial ordering

Author
John Perry
Date
2015
Warning
Avoid changing the monomial ordering data in the comparison functions, as the user may wish to compare two monomials according to a different ordering than the current value. This is the reason those functions are marked to leave the Monomials constant. The expected behavior is that first_larger() does whatever the ordering wants, so if you need monomial data check first to decide whether it exists, and applies to this ordering! Use set_data() if you want to change the monomials first.
There is no strict need to check whether the monomials are associated to the same ordering, but if the ordering uses Monomial_Order_Data one would be foolhardy not to check first.
Examples:
test_cyclicn.cpp, and test_dynamic.cpp.

Definition at line 77 of file monomial_ordering.hpp.

Inheritance diagram for Monomial_Ordering:
Generic_Grevlex Grevlex_Ordering Lex_Ordering Matrix_Ordering Weighted_Ordering CachedWGrevlex_Ordering WGrevlex

Public Member Functions

Destruction
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
Utility
virtual void set_data (Monomial &) const
 sets monomial ordering’s data; default is to do nothing More...
 
Comparison
virtual int cmp (const Monomial &t, const Monomial &u) const =0
 {@ More...
 
virtual bool first_larger (const Monomial &, const Monomial &) const =0
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
virtual bool first_smaller (const Monomial &, const Monomial &) const =0
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
virtual bool first_larger_than_multiple (const Monomial &, const Monomial &, const Monomial &) const =0
 returns true iff the first Monomial is larger than the specified multiple of the second
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Member Function Documentation

◆ cmp()

virtual int Monomial_Ordering::cmp ( const Monomial t,
const Monomial u 
) const
pure virtual

{@

Parameters
ta Monomial to compare to \( u \)
ua Monomial to compare to \( t \)
Returns
0 if the Monomials are like; negative if smaller, positive if larger – for efficiency, you probably want to redefine this

Implemented in Matrix_Ordering, CachedWGrevlex_Ordering, Lex_Ordering, WGrevlex, Grevlex_Ordering, and Generic_Grevlex.

◆ first_larger()

virtual bool Monomial_Ordering::first_larger ( const Monomial ,
const Monomial  
) const
pure virtual
Returns
true iff the first Monomial is larger than the second

Implemented in Matrix_Ordering, CachedWGrevlex_Ordering, Lex_Ordering, WGrevlex, Grevlex_Ordering, and Generic_Grevlex.

◆ first_larger_or_equal()

bool Monomial_Ordering::first_larger_or_equal ( const Monomial t,
const Monomial u 
) const
Returns
true iff the first Monomial is larger or equal to the second
See also
first_larger()
Warning
Do not override unless you know what you’re doing

Definition at line 471 of file monomial.cpp.

◆ first_larger_or_equal_than_multiple()

bool Monomial_Ordering::first_larger_or_equal_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
Returns
true iff the first Monomial is larger or equal to the specified multiple of the second
See also
first_larger()
Warning
Do not override unless you know what you’re doing

Definition at line 477 of file monomial.cpp.

◆ first_smaller()

virtual bool Monomial_Ordering::first_smaller ( const Monomial ,
const Monomial  
) const
pure virtual
Returns
true iff the first Monomial is smaller than the second
Warning
Do not override unless you know what you’re doing

Implemented in Matrix_Ordering, CachedWGrevlex_Ordering, Lex_Ordering, WGrevlex, Grevlex_Ordering, and Generic_Grevlex.

◆ first_smaller_or_equal()

bool Monomial_Ordering::first_smaller_or_equal ( const Monomial t,
const Monomial u 
) const
Returns
true iff the first Monomial is smaller or equal to the second
See also
first_larger()
Warning
Do not override unless you know what you’re doing

Definition at line 30 of file monomial_ordering.cpp.

◆ first_smaller_or_equal_than_multiple()

bool Monomial_Ordering::first_smaller_or_equal_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
Returns
true iff the first Monomial is smaller or equal to the specified multiple of the second
See also
first_larger()
Warning
Do not override unless you know what you’re doing

Definition at line 42 of file monomial_ordering.cpp.

◆ first_smaller_than_multiple()

bool Monomial_Ordering::first_smaller_than_multiple ( const Monomial t,
const Monomial u,
const Monomial v 
) const
Returns
true iff the first Monomial is smaller than the specified multiple of the second
Warning
Do not override unless you know what you’re doing

Definition at line 36 of file monomial_ordering.cpp.

◆ set_data()

void Monomial_Ordering::set_data ( Monomial t) const
virtual

sets monomial ordering’s data; default is to do nothing

Child classes that override this function are strongly recommended to use set_ordering_degree() of the Monomial class to set a primary degree. For weighted/graded degree orderings, this typically improves performance nontrivially.

Reimplemented in CachedWGrevlex_Ordering, WGrevlex, Grevlex_Ordering, and Generic_Grevlex.

Definition at line 467 of file monomial.cpp.

◆ Nonsingular_Matrix_Ordering_Exception

class Nonsingular_Matrix_Ordering_Exception

exceptions for Matrix_Ordering

Author
John Perry
Date
2016

Definition at line 545 of file particular_orderings.hpp.

Inheritance diagram for Nonsingular_Matrix_Ordering_Exception:

◆ Weighted_Ordering

class Weighted_Ordering

interface to a weighted monomial ordering

Author
John Perry
Date
2016
See also
Monomial_Ordering

This class adds all of one method to Monomial_Ordering.

Definition at line 177 of file monomial_ordering.hpp.

Inheritance diagram for Weighted_Ordering:
Monomial_Ordering CachedWGrevlex_Ordering WGrevlex

Public Member Functions

Basic properties
virtual const WT_TYPE * order_weights () const =0
 returns the weights used by this orderings
 
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
virtual void set_data (Monomial &) const
 sets monomial ordering’s data; default is to do nothing More...
 
virtual int cmp (const Monomial &t, const Monomial &u) const =0
 {@ More...
 
virtual bool first_larger (const Monomial &, const Monomial &) const =0
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
virtual bool first_smaller (const Monomial &, const Monomial &) const =0
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
virtual bool first_larger_than_multiple (const Monomial &, const Monomial &, const Monomial &) const =0
 returns true iff the first Monomial is larger than the specified multiple of the second
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

◆ WGrevlex

class WGrevlex

the grevlex ordering for a specified number of variables

Author
John Perry
Date
2016

The grevlex ordering first compares the sums of the exponents, then the sums of all but the last exponent, then the sums of all but the last two exponents, and so forth, until either the sums differ or it runs out of variables.

Definition at line 226 of file particular_orderings.hpp.

Inheritance diagram for WGrevlex:
Weighted_Ordering Monomial_Ordering

Public Member Functions

Construction
 WGrevlex (NVAR_TYPE, WT_TYPE *, bool=true)
 Creates a grevlex ordering specific to the specified number of variables, with the given weights. The final parameter indicates whether to apply the weights when breaking ties.
 
Basic properties
virtual const WT_TYPE * order_weights () const override
 this weighted ordering’s weights
 
Comparison
virtual bool first_larger (const Monomial &t, const Monomial &u) const override
 returns true iff \(t>u\) by weighted sums of successively fewer exponents
 
virtual bool first_smaller (const Monomial &t, const Monomial &u) const override
 returns true iff \(t< u\) by weighted sums of successively fewer exponents
 
virtual bool first_larger_than_multiple (const Monomial &t, const Monomial &u, const Monomial &v) const override
 returns true iff \(t>uv\) by weighted sums of successively fewer exponents
 
DEG_TYPE partial_degree (const Monomial &t, NVAR_TYPE i) const
 
virtual int cmp (const Monomial &t, const Monomial &u) const override
 
Utility
DEG_TYPE compute_ith_weight (const Monomial &t, NVAR_TYPE i) const
 computes the weighted sum of the first i exponents
 
virtual void set_data (Monomial &t) const override
 sets the Monomial’s monomial_ordering_data
 
Basic properties
- Public Member Functions inherited from Monomial_Ordering
virtual ~Monomial_Ordering ()
 needs virtual destructor for polymorphic delete
 
bool first_larger_or_equal (const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal (const Monomial &, const Monomial &) const
 
bool first_larger_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 
bool first_smaller_or_equal_than_multiple (const Monomial &, const Monomial &, const Monomial &) const
 

Protected Attributes

const NVAR_TYPE n
 the number of variables, which should remain constant
 
bool thorough_weighting
 whether to apply the weights to all the variables
 
WT_TYPE * weights
 the weights for this ordering
 

Friends

I/O
ostream & operator<< (ostream &os, const WGrevlex &word)
 

Member Function Documentation

◆ cmp()

virtual int WGrevlex::cmp ( const Monomial t,
const Monomial u 
) const
inlineoverridevirtual
Parameters
ta Monomial, to compare to \( u \)
ua Monomial, to compare to \( t \)
Returns
1 if \( t > u \) , -1 if \( t < u \) , and 0 otherwise

Implements Monomial_Ordering.

Definition at line 273 of file particular_orderings.hpp.

◆ partial_degree()

DEG_TYPE WGrevlex::partial_degree ( const Monomial t,
NVAR_TYPE  i 
) const
Returns
the weighted sum of the first i exponents
Warning
Be sure that t has the correct ordering!
Parameters
ta Monomial whose partial degree we want
iindex of the indeterminate to which we compute the degree

◆ WGrevlex_Order_Data

class WGrevlex_Order_Data

data for the weighted grevlex monomial ordering

Author
John Perry
Date
2015

The data involves an array of \(n\) DEG_TYPE, where the first entry is a weighted sum of the first \(n\) variables, the second entry is the ordinary sum of all but the last variable, etc.

Definition at line 390 of file particular_orderings.hpp.

Inheritance diagram for WGrevlex_Order_Data:
Monomial_Order_Data

Public Member Functions

Construction
 WGrevlex_Order_Data (Monomial &t)
 creates an array of partial weights of t More...
 
 WGrevlex_Order_Data (const WGrevlex_Order_Data &)
 copy constructor
 
virtual WGrevlex_Order_Dataclone () override
 clone constructor
 
Destruction
 ~WGrevlex_Order_Data ()
 deletes the array of partial weights
 
returns the weighted sum of the first \f$i\f$ variables
DEG_TYPE operator[] (NVAR_TYPE i) const
 
virtual DEG_TYPE grading (NVAR_TYPE i) const override
 default value is useless; orderings that supply gradings should redefine
 
Computation
void assign_gradings (Monomial &t)
 assigns gradings to a pre-allocated array More...
 
Memory management
void * operator new (size_t)
 requests memory form WGrevlex_Ordering's Grading_Order_Data_Allocator
 
void operator delete (void *)
 returns data to WGrevlex_Ordering's Grading_Order_Data_Allocator
 
- Public Member Functions inherited from Monomial_Order_Data
virtual ~Monomial_Order_Data ()
 does nothing but guarantee polymorphism (stupid, stupid C++)
 

Protected Attributes

DEG_TYPE * gradings
 array of partial weighted sums of exponents
 
const NVAR_TYPE number_of_gradings
 length of gradings
 

Constructor & Destructor Documentation

◆ WGrevlex_Order_Data()

WGrevlex_Order_Data::WGrevlex_Order_Data ( Monomial t)

creates an array of partial weights of t

Warning
Assign the correct ordering to t first!
Parameters
ta Monomial whose weights this will cache

Definition at line 397 of file particular_orderings.cpp.

Member Function Documentation

◆ assign_gradings()

void WGrevlex_Order_Data::assign_gradings ( Monomial t)

assigns gradings to a pre-allocated array

Warning
This does not create the array if it does not exist already!
Parameters
ta Monomial whose gradings we want

Definition at line 383 of file particular_orderings.cpp.

Function Documentation

◆ nonsingular()

bool nonsingular ( NVAR_TYPE  m,
NVAR_TYPE  n,
const WT_TYPE **  A 
)

verifies that a matrix supplied for an ordering is not nonsingular

Author
John Perry
Date
2016

For the time being, this reduces the matrix to upper triangular form (if possible) and then checks that the diagonal is nonzero.

Parameters
mnumber of rows in the matrix referenced by A
nnumber of columns in the matrix referenced by A
Aarray of at least \( m\times n \) elements
Returns
true if and only if the matrix referenced by A is nonsingular

Definition at line 558 of file particular_orderings.cpp.