Gröbner basis project
Codebase for research into Gröbner basis computation
|
Element of a field of prime characteristic. More...
#include <fields.hpp>
Public Member Functions | |
Construction | |
Prime_Field_Element (Prime_Field *field) | |
Constructs a prime field element in the specified field, with the value 0. More... | |
Prime_Field_Element (COEF_TYPE value, Prime_Field *field) | |
Constructs a prime field element in the specified field, with the specified value. More... | |
Basic properties | |
The following functions give information about the monomial, but do not modify it. | |
COEF_TYPE | value () const |
The value of the element. This always satisfies \(0\leq a\leq m\). | |
unsigned | modulus () const |
The field's modulus. | |
Prime_Field * | field () const |
The field this element lies in. | |
bool | like (const Prime_Field_Element &b) const |
true iff this and b have the same modulus. | |
COEF_TYPE | inverse () const |
Returns the multiplicative inverse of this . | |
bool | is_zero () const |
Is this the additive identity? | |
bool | is_one () const |
Is this the multiplicative identity? | |
Modification | |
void | assign (COEF_TYPE val, Prime_Field *K) |
for initializing arrays of Prime_Field_Element | |
Computation | |
Computes something, and may modify | |
void | negate () |
“Negates” this . | |
void | operator+= (const Prime_Field_Element &other) |
void | operator-= (const Prime_Field_Element &other) |
Decreases the value of this . | |
void | operator*= (const Prime_Field_Element &other) |
Changes the value of this . | |
void | operator*= (const COEF_TYPE b) |
Changes the value of this . This function is useful for avoiding the construction of a prime field element when you know what you want to multiply. | |
void | operator/= (const Prime_Field_Element &other) |
Changes the value of this . Multiplies by multiplicative inverse of other . | |
Protected Attributes | |
COEF_TYPE | a |
the number’s value; descendants should ensure \(0\leq a<m\) | |
Prime_Field * | F |
the field this element lives in; used to find inverses | |
unsigned | m |
the number’ modulus, stored here to avoid the expense of accessing it in \(F\). | |
Friends | |
Friend functions for computation | |
Will not modify | |
Prime_Field_Element | operator+ (const Prime_Field_Element &, const Prime_Field_Element &) |
Does not modify this . More... | |
Prime_Field_Element | operator- (const Prime_Field_Element &, const Prime_Field_Element &) |
Does not modify this . More... | |
Prime_Field_Element | operator* (const Prime_Field_Element &, const Prime_Field_Element &) |
Does not modify this . More... | |
Prime_Field_Element | operator+ (const Prime_Field_Element &, const int) |
Does not modify this . | |
Prime_Field_Element | operator- (const Prime_Field_Element &, const int) |
Does not modify this . | |
Prime_Field_Element | operator* (const Prime_Field_Element &, const int) |
Does not modify this . | |
Prime_Field_Element | operator- (const Prime_Field_Element &) |
Does not modify this . If you want to modify this , see negate(). | |
I/O | |
Will not modify | |
ostream & | operator<< (ostream &, const Prime_Field_Element &) |
Element of a field of prime characteristic.
This class encapsulates an element of a field of prime characteristic (Prime_Field).
this
lives in while this
is still active. Behavior is unpredictable in this circumstance, as the field is necessary for some record keeping, e.g., to look up multiplicative inverses. Definition at line 118 of file fields.hpp.
Prime_Field_Element::Prime_Field_Element | ( | Prime_Field * | field | ) |
Constructs a prime field element in the specified field, with the value 0.
A pointer to field
is attached to this
in order to find inverses during arithmetic.
this
is still active. Behavior is unpredictable in this circumstance. Definition at line 45 of file fields.cpp.
Prime_Field_Element::Prime_Field_Element | ( | COEF_TYPE | value, |
Prime_Field * | field | ||
) |
Constructs a prime field element in the specified field, with the specified value.
A pointer to field
is attached to this
in order to find inverses during arithmetic.
this
is still active. Behavior is unpredictable in this circumstance. Definition at line 49 of file fields.cpp.
void Prime_Field_Element::operator+= | ( | const Prime_Field_Element & | other | ) |
Increases the value of this
.
Definition at line 74 of file fields.cpp.
|
friend |
Does not modify this
.
Assume the terms have the same modulus. Behavior undefined if not!
Definition at line 120 of file fields.cpp.
|
friend |
Does not modify this
.
Assume the terms have the same modulus. Behavior undefined if not!
Definition at line 100 of file fields.cpp.
|
friend |
Does not modify this
.
Assume the terms have the same modulus. Behavior undefined if not!
Definition at line 110 of file fields.cpp.