Gröbner basis project
Codebase for research into Gröbner basis computation
|
Information necessary for a field modulo a prime. More...
#include <fields.hpp>
Public Member Functions | |
Construction | |
Prime_Field (unsigned modulus, bool show_modulus=false) | |
Please read detailed information. More... | |
Prime_Field (const Prime_Field &F) | |
Copy constructor: copies previously-computed inverses. More... | |
Destruction | |
~Prime_Field () | |
Basic properties | |
The following functions give information about the prime field, but do not modify it. | |
unsigned | modulus () const |
Returns the field's modulus. | |
COEF_TYPE | inverse (COEF_TYPE a) |
Returns the inverse of \(a\), modulo \(m\). More... | |
Prime_Field_Element | unity () |
“unity” is the multiplicative identity. | |
Prime_Field_Element | zero () |
“zero” is the additive identity. | |
I/O | |
void | set_print_modulus (bool b) |
determines whether to print the modulus | |
bool | get_print_modulus () |
indicates whether to print the modulus | |
Protected Attributes | |
COEF_TYPE * | Fi |
for \(i\neq0\), \(Fi_i\) is multiplicative inverse of \(i\), mod \(m\) | |
unsigned | m |
characteristic/modulus of the field | |
bool | print_modulus |
determines whether a coefficient's modulus is printed | |
Information necessary for a field modulo a prime.
This class encapsulates the information necessary for a field modulo a prime: both the modulus \(m\) and a list of inverses of non-zero elements. The constructors do not verify that \(m\) is prime, but expect misbehavior if not.
Definition at line 32 of file fields.hpp.
Prime_Field::Prime_Field | ( | unsigned | modulus, |
bool | show_modulus = false |
||
) |
Please read detailed information.
modulus | All computation in this field is done modulo this number; it should be prime, but we do not check this. See this warning. |
show_modulus | indicates whether the modulus is shown when printing an element of this field. You probably don't want this. |
modulus
is prime. If \(m\) is not prime, behavior is undefined, and probably spectacularly bad. Definition at line 6 of file fields.cpp.
Prime_Field::Prime_Field | ( | const Prime_Field & | F | ) |
Copy constructor: copies previously-computed inverses.
Allocates new data, so you can discard F
later if you want.
Definition at line 13 of file fields.cpp.
COEF_TYPE Prime_Field::inverse | ( | COEF_TYPE | a | ) |
Returns the inverse of \(a\), modulo \(m\).
Looks up the inverse in a table. If the inverse is not yet known, this function computes it using the Extended Euclidean Algorithm.
Definition at line 23 of file fields.cpp.