GNU Radio's DVBS2RX Package
gr::dvbs2rx::gf2m_poly< T > Class Template Reference

Polynomial over GF(2^m). More...

#include <gf.h>

Public Member Functions

 gf2m_poly (const galois_field< T > *const gf, std::vector< T > &&coefs)
 Construct a new polynomial over GF(2^m).
 
template<typename Y >
 gf2m_poly (const galois_field< T > *const gf, const gf2_poly< Y > &gf2_poly)
 Construct a polynomial over GF(2^m) from a polynomial over GF(2).
 
gf2m_poly< T > operator+ (const gf2m_poly< T > &x) const
 GF(2^m) polynomial addition.
 
gf2m_poly< T > operator* (T x) const
 Multiplication by a scalar.
 
gf2m_poly< T > operator* (const gf2m_poly< T > &x) const
 Multiplication by another GF(2^m) polynomial.
 
bool operator== (const gf2m_poly< T > &x) const
 Equal comparator.
 
operator[] (uint32_t index) const
 Access a polynomial coefficient.
 
eval (T x) const
 Evaluate the polynomial for a given GF(2^m) element.
 
eval_by_exp (uint32_t i) const
 Evaluate the polynomial for an element alpha^i given by its exponent i.
 
std::vector< uint32_t > search_roots_in_exp_range (uint32_t i_start, uint32_t i_end, uint32_t max_roots=std::numeric_limits< uint32_t >::max()) const
 Search roots by evaluating the polynomial for elements in a given range.
 
const std::vector< T > & get_poly () const
 Get the polynomial coefficients.
 
int degree () const
 Get the polynomial degree.
 
gf2_poly< T > to_gf2_poly () const
 Convert the polynomial to a GF(2) polynomial.
 

Detailed Description

template<typename T>
class gr::dvbs2rx::gf2m_poly< T >

Polynomial over GF(2^m).

A polynomial whose coefficients are elements from a GF(2^m) extension field.

Template Parameters
TType used to represent each polynomial coefficient as a GF(2^m) element.

Constructor & Destructor Documentation

◆ gf2m_poly() [1/2]

template<typename T >
gr::dvbs2rx::gf2m_poly< T >::gf2m_poly ( const galois_field< T > *const gf,
std::vector< T > && coefs )

Construct a new polynomial over GF(2^m).

Parameters
gfReference Galois field.
coefsPolynomial coefficients.

◆ gf2m_poly() [2/2]

template<typename T >
template<typename Y >
gr::dvbs2rx::gf2m_poly< T >::gf2m_poly ( const galois_field< T > *const gf,
const gf2_poly< Y > & gf2_poly )
inline

Construct a polynomial over GF(2^m) from a polynomial over GF(2).

Parameters
gfReference Galois field.
gf2_polyReference polynomial over GF(2).

References gr::dvbs2rx::gf2_poly< T >::degree(), gr::dvbs2rx::gf2_poly< T >::get_poly(), and gr::dvbs2rx::is_bit_set().

Member Function Documentation

◆ degree()

template<typename T >
int gr::dvbs2rx::gf2m_poly< T >::degree ( ) const
inline

Get the polynomial degree.

Returns
int Degree.
Note
By convention, the zero polynomial has degree -1.

◆ eval()

template<typename T >
T gr::dvbs2rx::gf2m_poly< T >::eval ( T x) const

Evaluate the polynomial for a given GF(2^m) element.

Assuming the underlying polynomial is p(x), this function evaluates p(x) for a given x from GF(2^m).

Parameters
xGF(2^m) value for which the polynomial should be evaluated.
Returns
T Evaluation result within GF(2^m).

◆ eval_by_exp()

template<typename T >
T gr::dvbs2rx::gf2m_poly< T >::eval_by_exp ( uint32_t i) const

Evaluate the polynomial for an element alpha^i given by its exponent i.

Assuming the underlying polynomial is p(x), this function evaluates p(x) for a given x from GF(2^m). The difference to the operator() is that this function takes x by its exponent i. If x = alpha^i, this function takes i as input instead of x.

Parameters
iExponent of the GF(2^m) value for which the polynomial should be evaluated.
Returns
T Evaluation result within GF(2^m).
Note
Since the zero element (additive identity) cannot be represented as a power of the primitive element, there is no exponent i for the zero element. Hence, this function can only evaluate the polynomial for non-zero elements.

◆ get_poly()

template<typename T >
const std::vector< T > & gr::dvbs2rx::gf2m_poly< T >::get_poly ( ) const
inline

Get the polynomial coefficients.

Returns
const std::vector<T>& Reference to vector of polynomial coefficients.

Referenced by gr::dvbs2rx::gf2m_poly< T >::operator==().

◆ operator*() [1/2]

template<typename T >
gf2m_poly< T > gr::dvbs2rx::gf2m_poly< T >::operator* ( const gf2m_poly< T > & x) const

Multiplication by another GF(2^m) polynomial.

Parameters
xPolynomial to multiply.
Returns
gf2m_poly<T> Multiplication result.

◆ operator*() [2/2]

template<typename T >
gf2m_poly< T > gr::dvbs2rx::gf2m_poly< T >::operator* ( T x) const

Multiplication by a scalar.

Parameters
xScalar to multiply.
Returns
gf2m_poly<T> Multiplication result.

◆ operator+()

template<typename T >
gf2m_poly< T > gr::dvbs2rx::gf2m_poly< T >::operator+ ( const gf2m_poly< T > & x) const

GF(2^m) polynomial addition.

Parameters
xPolynomial to add.
Returns
gf2m_poly<T> Addition result.

◆ operator==()

template<typename T >
bool gr::dvbs2rx::gf2m_poly< T >::operator== ( const gf2m_poly< T > & x) const
inline

Equal comparator.

Parameters
xThe other GF(2^m) polynomial.
Returns
bool Whether they are equal.

References gr::dvbs2rx::gf2m_poly< T >::get_poly().

◆ operator[]()

template<typename T >
T gr::dvbs2rx::gf2m_poly< T >::operator[] ( uint32_t index) const
inline

Access a polynomial coefficient.

Parameters
indexIndex of the target coefficient.
Returns
T Polynomial coefficient.

◆ search_roots_in_exp_range()

template<typename T >
std::vector< uint32_t > gr::dvbs2rx::gf2m_poly< T >::search_roots_in_exp_range ( uint32_t i_start,
uint32_t i_end,
uint32_t max_roots = std::numeric_limits< uint32_t >::max() ) const

Search roots by evaluating the polynomial for elements in a given range.

Evaluates the polynomial for all alpha^i with i varying in [i_start, i_end] and returns the elements for which the polynomial evaluates to zero (the roots) given by their exponents. For instance, if alpha^2 and alpha^3 are roots of the polynomial, this function returns the vector [2, 3].

The implementation does not simply rely on the eval() or eval_by_exp() functions. Instead, it is optimized by leveraging the fact that the evaluation is for a contiguous range of exponents. Hence, when searching for polynomial roots in GF(2^m), it is preferable to use this function instead of manually calling the eval() or eval_by_exp() functions.

Parameters
i_startExponent of element alpha^i_start at the start of the range.
i_endExponent of element alpha^i_end at the end of the range.
max_rootsMaximum number of roots to be returned. When defined, the search is stopped earlier as soon as this number of roots is found.
Returns
std::vector<uint32_t> Vector with the exponents associated with the GF(2^m) roots found in the range.

◆ to_gf2_poly()

template<typename T >
gf2_poly< T > gr::dvbs2rx::gf2m_poly< T >::to_gf2_poly ( ) const

Convert the polynomial to a GF(2) polynomial.

Works when all coefficients of the local polynomial are either unit or zero such that it can be reduced to a polynomial over GF(2). Otherwise, throws runtime error.

Returns
gf2_poly<T> Polynomial over GF(2).

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