finite modulo-N arithmetic with polynomials of degree < M. More...
#include <vnl_finite.h>
Public Member Functions | |
| vnl_finite_int_poly (std::vector< Scalar > const &p) | |
| Creates a general finite_int_poly. More... | |
| vnl_finite_int_poly (Scalar const &n) | |
| Creates a degree 0 finite_int_poly. More... | |
| vnl_finite_int_poly () | |
| Default constructor. Creates a degree 0 finite_int_poly equal to 0. More... | |
| vnl_finite_int_poly (Base const &x) | |
| ~vnl_finite_int_poly ()=default | |
| std::size_t | deg () const |
| Formal degree of this polynomial. More... | |
| int | degree () const |
| Effective degree of this polynomial; equals -1 when this polynomial is 0. More... | |
| Scalar | operator[] (unsigned int i) const |
| Access to individual coefficients. More... | |
| Base & | operator= (Base const &x) |
| Assignment. More... | |
| Base & | operator= (Scalar const &n) |
| bool | operator== (Base const &x) const |
| Comparison of finite int polys. More... | |
| bool | operator!= (Base const &x) const |
| bool | operator== (Scalar const &x) const |
| bool | operator!= (Scalar const &x) const |
| Base | operator- () const |
| Unary minus - returns the additive inverse. More... | |
| Base | operator+ () const |
| Unary plus - returns the current polynomial. More... | |
| bool | operator! () const |
| Unary not - returns true if finite int poly is equal to zero. More... | |
| Base & | operator+= (Base const &r) |
| Plus&assign: replace lhs by lhs + rhs. More... | |
| Base & | operator-= (Base const &r) |
| Minus&assign: replace lhs by lhs - rhs. More... | |
| Base & | operator *= (Scalar const &n) |
| Scalar multiple of this. More... | |
| unsigned int | additive_order () const |
| The additive order of x is the smallest positive r such that r*x == 0. More... | |
| Base & | operator *= (Base const &r) |
| Multiply&assign: replace lhs by lhs * rhs, modulo the "modulo" polynomial. More... | |
| unsigned int | multiplicative_order () const |
| Return the multiplicative order of this polynomial. More... | |
Static Public Member Functions | |
| static unsigned int | cardinality () |
| The number of different finite_int polynomials of this type. More... | |
| static std::vector< Scalar > & | modulo_polynomial (std::vector< Scalar > p=std::vector< Scalar >()) |
| get/set the (irreducible) modulo polynomial of degree M. More... | |
| static bool | is_field () |
| Return true when this ring is a field. More... | |
| static Base | smallest_generator () |
| Return the smallest multiplicative generator of the units in this ring. More... | |
Private Types | |
| typedef vnl_finite_int_poly< N, M > | Base |
| typedef vnl_finite_int< N > | Scalar |
Private Member Functions | |
| void | add_modulo_poly (unsigned int m, Scalar const &x) |
| Add x to the i-th degree coefficient of val_, possibly reducing modulo the "modulo" poly. More... | |
Static Private Member Functions | |
| static unsigned int | Ntothe (unsigned int m) |
Private Attributes | |
| std::vector< Scalar > | val_ |
| M-tuple (or degree M-1 polynomial) representing this. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| template<int N, int M> | |
| vnl_finite_int_poly< N, M > | operator+ (vnl_finite_int_poly< N, M > const &r1, vnl_finite_int_poly< N, M > const &r2) |
| Returns the sum of two finite int polynomials. More... | |
| template<int N, int M> | |
| vnl_finite_int_poly< N, M > | operator- (vnl_finite_int_poly< N, M > const &r1, vnl_finite_int_poly< N, M > const &r2) |
| Returns the difference of two finite int polynomials. More... | |
| template<int N, int M> | |
| vnl_finite_int_poly< N, M > | operator * (vnl_finite_int_poly< N, M > const &r1, vnl_finite_int< N > const &r2) |
| Returns a scalar multiple of a finite int polynomial. More... | |
| template<int N, int M> | |
| vnl_finite_int_poly< N, M > | operator * (vnl_finite_int< N > const &r2, vnl_finite_int_poly< N, M > const &r1) |
| Returns a scalar multiple of a finite int polynomial. More... | |
| template<int N, int M> | |
| vnl_finite_int_poly< N, M > | operator * (vnl_finite_int_poly< N, M > const &r1, vnl_finite_int_poly< N, M > const &r2) |
| Multiplies two finite int polynomials. More... | |
| template<int N, int M> | |
| std::ostream & | operator<< (std::ostream &s, vnl_finite_int_poly< N, M > const &r) |
| formatted output. More... | |
finite modulo-N arithmetic with polynomials of degree < M.
This class implements arithmetic with polynomials of degree < M over vnl_finite_int<N>. Multiplication is defined modulo a polynomial of degree M.
For N prime, and when the "modulo" polynomial is irreducible, vnl_finite_int_poly<N,M> implements the finite field GF(N^M).
Addition, subtraction and scalar multiplication are already defined without the presence of a "modulo" polynomial. Restricted to these operations, vnl_finite_int_poly<N,M> forms an M-dimensional vector space over vnl_finite_int<N>. The current implementation does not yet implement anything more than that.
Definition at line 431 of file vnl_finite.h.
|
private |
Definition at line 433 of file vnl_finite.h.
|
private |
Definition at line 434 of file vnl_finite.h.
|
inline |
Creates a general finite_int_poly.
Definition at line 445 of file vnl_finite.h.
|
inline |
Creates a degree 0 finite_int_poly.
Definition at line 447 of file vnl_finite.h.
|
inline |
Default constructor. Creates a degree 0 finite_int_poly equal to 0.
Definition at line 449 of file vnl_finite.h.
|
inline |
Definition at line 451 of file vnl_finite.h.
|
inlinedefault |
|
inlineprivate |
Add x to the i-th degree coefficient of val_, possibly reducing modulo the "modulo" poly.
Definition at line 578 of file vnl_finite.h.
|
inline |
The additive order of x is the smallest positive r such that r*x == 0.
Definition at line 510 of file vnl_finite.h.
|
inlinestatic |
The number of different finite_int polynomials of this type.
Definition at line 442 of file vnl_finite.h.
|
inline |
Formal degree of this polynomial.
Definition at line 456 of file vnl_finite.h.
|
inline |
Effective degree of this polynomial; equals -1 when this polynomial is 0.
Definition at line 459 of file vnl_finite.h.
|
inlinestatic |
Return true when this ring is a field.
Note that this requires that N is a prime, but that condition is not sufficient: also the "modulo" polynomial must be irreducible.
Definition at line 557 of file vnl_finite.h.
|
inlinestatic |
get/set the (irreducible) modulo polynomial of degree M.
Note that this polynomial has to be set only once, i.e., once set, it applies to all vnl_finite_int_polys with the same N and M.
Definition at line 520 of file vnl_finite.h.
|
inline |
Return the multiplicative order of this polynomial.
Definition at line 547 of file vnl_finite.h.
|
inlinestaticprivate |
Definition at line 439 of file vnl_finite.h.
|
inline |
Scalar multiple of this.
Definition at line 507 of file vnl_finite.h.
|
inline |
Multiply&assign: replace lhs by lhs * rhs, modulo the "modulo" polynomial.
Definition at line 537 of file vnl_finite.h.
|
inline |
Unary not - returns true if finite int poly is equal to zero.
Definition at line 489 of file vnl_finite.h.
|
inline |
Definition at line 476 of file vnl_finite.h.
|
inline |
Definition at line 482 of file vnl_finite.h.
|
inline |
Unary plus - returns the current polynomial.
Definition at line 487 of file vnl_finite.h.
|
inline |
Plus&assign: replace lhs by lhs + rhs.
Definition at line 492 of file vnl_finite.h.
|
inline |
Unary minus - returns the additive inverse.
Definition at line 485 of file vnl_finite.h.
|
inline |
Minus&assign: replace lhs by lhs - rhs.
Definition at line 499 of file vnl_finite.h.
|
inline |
Assignment.
Definition at line 465 of file vnl_finite.h.
|
inline |
Definition at line 466 of file vnl_finite.h.
|
inline |
Comparison of finite int polys.
Definition at line 469 of file vnl_finite.h.
|
inline |
Definition at line 477 of file vnl_finite.h.
|
inline |
Access to individual coefficients.
Definition at line 462 of file vnl_finite.h.
|
inlinestatic |
Return the smallest multiplicative generator of the units in this ring.
This is only possible if the units form a cyclic group for multiplication. If not, smallest_generator() returns 1 to indicate this fact. Note that the multiplication group of a finite field is always cyclic.
Definition at line 569 of file vnl_finite.h.
|
related |
Returns a scalar multiple of a finite int polynomial.
Definition at line 608 of file vnl_finite.h.
|
related |
Returns a scalar multiple of a finite int polynomial.
Definition at line 617 of file vnl_finite.h.
|
related |
Multiplies two finite int polynomials.
NOTE: this requires the "modulo" polynomial to be set. Do this by calling modulo_polynomial(p), where p is a vector of length M+1.
Definition at line 627 of file vnl_finite.h.
|
related |
Returns the sum of two finite int polynomials.
Definition at line 591 of file vnl_finite.h.
|
related |
Returns the difference of two finite int polynomials.
Definition at line 599 of file vnl_finite.h.
|
related |
formatted output.
Definition at line 635 of file vnl_finite.h.
|
private |
M-tuple (or degree M-1 polynomial) representing this.
Definition at line 436 of file vnl_finite.h.
1.8.15