Givaro
|
Integers modulo 2. More...
#include <gf2.h>
Public Types | |
using | Self_t = GF2 |
Element type. More... | |
using | Residu_t = uint8_t |
using | Element = bool |
using | BitVector = std::vector< bool > |
using | BitReference = BitVector::reference |
using | RandIter = GIV_randIter< Self_t, bool > |
Random. More... | |
Public Member Functions | |
Element & | random (const GivRandom &g, Element &e, const Residu_t &size=0) const |
Object Management | |
GF2 () | |
Default constructor. More... | |
GF2 (int p, int exp=1) | |
Default constructor. More... | |
GF2 (const GF2 &F) | |
Copy constructor. More... | |
GF2 & | operator= (const GF2 &F) |
Assignment operator. More... | |
Element | minElement () const |
Accessors. More... | |
Element | maxElement () const |
Default constructor. More... | |
Residu_t | residu () const |
Access to the modulus. More... | |
Residu_t | size () const |
Default constructor. More... | |
Residu_t | characteristic () const |
Default constructor. More... | |
Residu_t | cardinality () const |
Default constructor. More... | |
template<class T > | |
T & | characteristic (T &p) const |
Default constructor. More... | |
template<class T > | |
T & | cardinality (T &p) const |
Default constructor. More... | |
Element & | init (Element &x, const int32_t &y) const |
Initialization of field base element from an Integer. More... | |
Element & | init (Element &x, const uint32_t &y) const |
Default constructor. More... | |
Element & | init (Element &x, const int64_t &y) const |
Default constructor. More... | |
Element & | init (Element &x, const uint64_t &y) const |
Default constructor. More... | |
Element & | init (Element &x, const float &y) const |
Default constructor. More... | |
Element & | init (Element &x, const double &y) const |
Default constructor. More... | |
Element & | init (Element &x, const Integer &y) const |
Default constructor. More... | |
Element & | init (Element &x) const |
Default constructor. More... | |
BitReference | init (BitReference x, const Integer &y=0) const |
Default constructor. More... | |
Integer & | convert (Integer &x, const Element &y) const |
Conversion of field base element to a template class T. More... | |
BitReference | convert (BitReference x, const Element &y) const |
Default constructor. More... | |
template<class T > | |
T & | convert (T &x, const Element &y) const |
Default constructor. More... | |
Element & | assign (Element &x, const Element &y) const |
Assignment of one field base element to another. More... | |
BitReference | assign (BitReference x, const Element &y) const |
Default constructor. More... | |
Integer & | cardinality (Integer &c) const |
Cardinality. More... | |
Integer & | characteristic (Integer &c) const |
Characteristic. More... | |
Arithmetic Operations | |
x <- y op z; x <- op y These operations require all elements, including x, to be initialized before the operation is called. Uninitialized field base elements will give undefined results. | |
bool | areEqual (const Element &x, const Element &y) const |
Equality of two elements. More... | |
bool | isZero (const Element &x) const |
Zero equality. More... | |
bool | isOne (const Element &x) const |
One equality. More... | |
bool | isUnit (const Element &x) const |
Invertibility. More... | |
bool | isMOne (const Element &x) const |
MOne equality. More... | |
Element & | add (Element &x, const Element &y, const Element &z) const |
Addition. More... | |
BitReference | add (BitReference x, const Element &y, const Element &z) const |
Equality of two elements. More... | |
Element & | sub (Element &x, const Element &y, const Element &z) const |
Subtraction. More... | |
BitReference | sub (BitReference x, const Element &y, const Element &z) const |
Equality of two elements. More... | |
Element & | mul (Element &x, const Element &y, const Element &z) const |
Multiplication. More... | |
BitReference | mul (BitReference x, const Element &y, const Element &z) const |
Equality of two elements. More... | |
Element & | div (Element &x, const Element &y, const Element &z) const |
Division. More... | |
BitReference | div (BitReference x, const Element &y, const Element &z) const |
Equality of two elements. More... | |
Element & | neg (Element &x, const Element &y) const |
Additive Inverse (Negation). More... | |
BitReference | neg (BitReference x, const Element &y) const |
Equality of two elements. More... | |
Element & | inv (Element &x, const Element &y) const |
Multiplicative Inverse. More... | |
BitReference | inv (BitReference x, const Element &y) const |
Equality of two elements. More... | |
BitReference | axpy (BitReference r, const Element &a, const Element &x, const Element &y) const |
Natural AXPY. More... | |
Element & | axpy (Element &r, const Element &a, const Element &x, const Element &y) const |
Equality of two elements. More... | |
BitReference | axmy (BitReference r, const Element &a, const Element &x, const Element &y) const |
Natural AXMY. More... | |
Element & | axmy (Element &r, const Element &a, const Element &x, const Element &y) const |
Equality of two elements. More... | |
BitReference | maxpy (BitReference r, const Element &a, const Element &x, const Element &y) const |
Natural MAXPY. More... | |
Element & | maxpy (Element &r, const Element &a, const Element &x, const Element &y) const |
Equality of two elements. More... | |
Input/Output Operations | |
std::ostream & | write (std::ostream &os) const |
Print field. More... | |
std::istream & | read (std::istream &is) |
Read field. More... | |
std::ostream & | write (std::ostream &os, const Element &x) const |
Print field base element. More... | |
std::istream & | read (std::istream &is, Element &x) const |
Read field base element. More... | |
std::istream & | read (std::istream &is, BitReference x) const |
Print field. More... | |
Data Fields | |
const bool | zero = false |
const bool | one = true |
const bool | mOne = true |
Inplace Arithmetic Operations | |
Element & | addin (Element &x, const Element &y) const |
Inplace Addition. More... | |
BitReference | addin (BitReference x, const Element &y) const |
Inplace Addition. More... | |
Element & | subin (Element &x, const Element &y) const |
Inplace Subtraction. More... | |
BitReference | subin (BitReference x, const Element &y) const |
Inplace Addition. More... | |
Element & | mulin (Element &x, const Element &y) const |
Inplace Multiplication. More... | |
BitReference | mulin (BitReference x, const Element &y) const |
Inplace Addition. More... | |
Element & | divin (Element &x, const Element &y) const |
Inplace Division. More... | |
BitReference | divin (BitReference x, const Element &y) const |
Inplace Addition. More... | |
Element & | negin (Element &x) const |
Inplace Additive Inverse (Inplace Negation). More... | |
BitReference | negin (BitReference x) const |
Inplace Addition. More... | |
Element & | invin (Element &x) const |
Inplace Multiplicative Inverse. More... | |
BitReference | invin (BitReference x) const |
Inplace Addition. More... | |
Element & | axpyin (Element &r, const Element &a, const Element &x) const |
Inplace AXPY. More... | |
BitReference | axpyin (BitReference r, const Element &a, const Element &x) const |
Inplace Addition. More... | |
Element & | axmyin (Element &r, const Element &a, const Element &x) const |
Inplace AXMY. More... | |
BitReference | axmyin (BitReference r, const Element &a, const Element &x) const |
Inplace Addition. More... | |
Element & | maxpyin (Element &r, const Element &a, const Element &x) const |
Inplace MAXPY. More... | |
BitReference | maxpyin (BitReference r, const Element &a, const Element &x) const |
Inplace Addition. More... | |
static int | maxCardinality () |
Inplace Addition. More... | |
Integers modulo 2.
This is a tuned implementation of the field of integers modulo
using Residu_t = uint8_t |
using Element = bool |
using BitVector = std::vector<bool> |
using BitReference = BitVector::reference |
using RandIter = GIV_randIter<Self_t, bool> |
Random.
|
inline |
Default constructor.
|
inline |
Default constructor.
Copy constructor.
Constructs Givaro::GF2 object by copying the field. This is required to allow field objects to be passed by value into functions.
F | Givaro::GF2 object. |
Assignment operator.
Required by the archetype
F | constant reference to Givaro::Modular object |
|
inline |
Accessors.
|
inline |
Default constructor.
|
inline |
Access to the modulus.
|
inline |
Default constructor.
|
inline |
Default constructor.
|
inline |
Default constructor.
|
inline |
Default constructor.
|
inline |
Default constructor.
Initialization of field base element from an Integer.
Behaves like C++ allocator construct. This function assumes the output field base element x has already been constructed, but that it is not already initialized. This is not a specialization of the template function because such a specialization is not allowed inside the class declaration.
x | field base element to contain output (reference returned). |
y | Integer. |
|
inline |
Default constructor.
Conversion of field base element to a template class T.
This function assumes the output field base element x has already been constructed, but that it is not already initialized.
x | template class T to contain output (reference returned). |
y | constant field base element. |
|
inline |
Default constructor.
|
inline |
Default constructor.
Assignment of one field base element to another.
This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Default constructor.
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Zero equality.
Test if field base element is equal to zero. This function assumes the field base element has already been constructed and initialized.
x | field base element. |
|
inline |
One equality.
Test if field base element is equal to one. This function assumes the field base element has already been constructed and initialized.
x | field base element. |
|
inline |
Invertibility.
Test if field base element is invertible. This function assumes the field base element has already been constructed and initialized.
x | field base element. |
|
inline |
MOne equality.
Test if field base element is equal to one. This function assumes the field base element has already been constructed and initialized.
x | field base element. |
|
inline |
Print field.
os | output stream to which field is written. |
|
inline |
Read field.
is | input stream from which field is read. |
|
inline |
Print field base element.
This function assumes the field base element has already been constructed and initialized.
os | output stream to which field base element is written. |
x | field base element. |
|
inline |
Read field base element.
is | input stream from which field base element is read. |
x | field base element. |
|
inline |
Print field.
os | output stream to which field is written. |
|
inline |
Addition.
x = y + z This function assumes all the field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
z | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Subtraction.
x = y - z This function assumes all the field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
z | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Multiplication.
x = y * z This function assumes all the field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
z | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Division.
x = y / z This function assumes all the field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
z | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Additive Inverse (Negation).
x = - y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Multiplicative Inverse.
x = 1 / y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Natural AXPY.
r | |
a | |
x | |
y |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Natural AXMY.
r | |
a | |
x | |
y |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Natural MAXPY.
r | |
a | |
x | |
y |
|
inline |
Equality of two elements.
This function assumes both field base elements have already been constructed and initialized.
x | field base element |
y | field base element |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Subtraction.
x -= y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Multiplication.
x *= y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Division.
x /= y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Additive Inverse (Inplace Negation).
x = - x This function assumes the field base element has already been constructed and initialized.
x | field base element (reference returned). |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace Multiplicative Inverse.
x = 1 / x This function assumes the field base elementhas already been constructed and initialized.
x | field base element (reference returned). |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace AXPY.
r | field element (reference returned). |
a | field element. |
x | field element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace AXMY.
r | field element (reference returned). |
a | field element. |
x | field element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inline |
Inplace MAXPY.
r | field element (reference returned). |
a | field element. |
x | field element. |
|
inline |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
|
inlinestatic |
Inplace Addition.
x += y This function assumes both field base elements have already been constructed and initialized.
x | field base element (reference returned). |
y | field base element. |
const bool zero = false |
const bool one = true |
const bool mOne = true |