BasisElementGradedReverseLexOrder< VariableOrder, BasisElement > Struct Template Reference

Detailed Description

template<typename VariableOrder, typename BasisElement>
struct drake::symbolic::BasisElementGradedReverseLexOrder< VariableOrder, BasisElement >

Implements Graded reverse lexicographic order.

Template Parameters
VariableOrderVariableOrder{}(v1, v2) is true if v1 < v2.
BasisElementA derived class of PolynomialBasisElement.

We first compare the total degree of the PolynomialBasisElement; if there is a tie, then we use the graded reverse lexicographical order as the tie breaker.

Take monomials with variables {x, y, z} and total degree<=2 as an example, with the order x > y > z. To get the graded reverse lexicographical order, we take the following steps:

First find all the monomials using the total degree. The monomials with degree 2 are {x², y², z², xy, xz, yz}. The monomials with degree 1 are {x, y, z}, and the monomials with degree 0 is {1}. To break the tie between monomials with the same total degree, first sort them in the reverse lexicographical order, namely x < y < z. The lexicographical order compares two monomials by first comparing the exponent of the largest variable, if there is a tie then go forth to the second largest variable. Thus z² > zy >zx

y² > yx > x². Finally reverse the order as x² > xy > y² > xz > yz > z² > x y > z.

There is an introduction to monomial order in https://en.wikipedia.org/wiki/Monomial_order, and an introduction to graded reverse lexicographical order in https://en.wikipedia.org/wiki/Monomial_order#Graded_reverse_lexicographic_order

#include <drake/common/symbolic_polynomial_basis_element.h>

Public Member Functions

bool operator() (const BasisElement &m1, const BasisElement &m2) const
 Returns true if m1 < m2 under the Graded reverse lexicographic order. More...

Member Function Documentation

◆ operator()()

bool operator() ( const BasisElement &  m1,
const BasisElement &  m2 
) const

Returns true if m1 < m2 under the Graded reverse lexicographic order.

The documentation for this struct was generated from the following file: