linbox
1
|
Derived class used to implement the field archetypeHelps to minimize code bloat. This class implements all purely virtual member functions of the abstract base class. This class is used to wrap a LinBox field so that it might be used with the Field archetype. More...
#include <envelope.h>
Public Types | |
typedef ElementEnvelope< Field > | Element |
typedef RandIterEnvelope< Field > | RandIter |
Public Member Functions | |
Object Management | |
FieldEnvelope (void) | |
FieldEnvelope (const Field &F) | |
FieldEnvelope (const FieldEnvelope &E) | |
FieldAbstract * | clone () const |
FieldAbstract & | operator= (const FieldAbstract &F) |
ElementAbstract & | init (ElementAbstract &x, const integer &y=0) const |
integer & | convert (integer &x, const ElementAbstract &y) const |
ElementAbstract & | assign (ElementAbstract &x, const ElementAbstract &y) const |
integer & | cardinality (integer &c) const |
integer & | characteristic (integer &c) const |
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 ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | add (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const |
ElementAbstract & | sub (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const |
ElementAbstract & | mul (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const |
ElementAbstract & | div (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const |
ElementAbstract & | neg (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | inv (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | axpy (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x, const ElementAbstract &y) const |
Inplace Arithmetic Operations | |
x <- x op y; x <- op x | |
bool | isZero (const ElementAbstract &x) const |
bool | isOne (const ElementAbstract &x) const |
ElementAbstract & | addin (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | subin (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | mulin (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | divin (ElementAbstract &x, const ElementAbstract &y) const |
ElementAbstract & | negin (ElementAbstract &x) const |
ElementAbstract & | invin (ElementAbstract &x) const |
ElementAbstract & | axpyin (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x) const |
Input/Output Operations | |
std::ostream & | write (std::ostream &os) const |
std::istream & | read (std::istream &is) |
std::ostream & | write (std::ostream &os, const ElementAbstract &x) const |
std::istream & | read (std::istream &is, ElementAbstract &x) const |
Protected Attributes | |
Field | _field |
Wrapped field. |
Derived class used to implement the field archetype
Helps to minimize code bloat. This class implements all purely virtual member functions of the abstract base class. This class is used to wrap a LinBox field so that it might be used with the Field archetype.
typedef ElementEnvelope<Field> Element |
element type. It is derived from the class ElementAbstract, and it must contain a wrapped field element.
Reimplemented from FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
typedef RandIterEnvelope<Field> RandIter |
Random iterator generator type. It is derived from the class RandIterAbstract, and it must contain a wrapped field random iterator generator.
Reimplemented from FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
FieldEnvelope | ( | void | ) | [inline] |
Default constructor. In this implementation, this means copying the field { E.}.
FieldEnvelope | ( | const Field & | F | ) | [inline] |
Constructor from field to be wrapped.
F | Field object to be wrapped. |
FieldEnvelope | ( | const FieldEnvelope< Field > & | E | ) | [inline] |
Copy constructor. Constructs FieldEnvelope object by copying the field. This is required to allow field objects to be passed by value into functions. In this implementation, this means copying the field { E.}.
E | FieldEnvelope object. |
FieldAbstract* clone | ( | ) | const [inline, virtual] |
Virtual copy constructor. Required because constructors cannot be virtual. Passes construction on to derived classes. This function is not part of the common object interface.
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
FieldAbstract& operator= | ( | const FieldAbstract & | F | ) | [inline, virtual] |
Assignment operator. Required by abstract base class.
F | constant reference to FieldAbstract object |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& init | ( | ElementAbstract & | x, |
const integer & | y = 0 |
||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
integer& convert | ( | integer & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& assign | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
integer& cardinality | ( | integer & | c | ) | const [inline, virtual] |
Cardinality. Return integer representing cardinality of the domain. Returns a non-negative integer for all domains with finite cardinality, and returns -1 to signify a domain of infinite cardinality.
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
integer& characteristic | ( | integer & | c | ) | const [inline, virtual] |
Characteristic. Return integer representing characteristic of the domain. Returns a positive integer to all domains with finite characteristic, and returns 0 to signify a domain of infinite characteristic.
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
bool areEqual | ( | const ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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 |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& add | ( | ElementAbstract & | x, |
const ElementAbstract & | y, | ||
const ElementAbstract & | z | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& sub | ( | ElementAbstract & | x, |
const ElementAbstract & | y, | ||
const ElementAbstract & | z | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& mul | ( | ElementAbstract & | x, |
const ElementAbstract & | y, | ||
const ElementAbstract & | z | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& div | ( | ElementAbstract & | x, |
const ElementAbstract & | y, | ||
const ElementAbstract & | z | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& neg | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& inv | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& axpy | ( | ElementAbstract & | r, |
const ElementAbstract & | a, | ||
const ElementAbstract & | x, | ||
const ElementAbstract & | y | ||
) | const [inline, virtual] |
Natural AXPY. r = a * x + y This function assumes all field elements have already been constructed and initialized.
r | field element (reference returned). |
a | field element. |
x | field element. |
y | field element. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
bool isZero | ( | const ElementAbstract & | x | ) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
bool isOne | ( | const ElementAbstract & | x | ) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& addin | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& subin | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& mulin | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& divin | ( | ElementAbstract & | x, |
const ElementAbstract & | y | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& negin | ( | ElementAbstract & | x | ) | const [inline, virtual] |
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). |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& invin | ( | ElementAbstract & | x | ) | const [inline, virtual] |
Inplace Multiplicative Inverse. x = 1 / x This function assumes the field base elementhas already been constructed and initialized.
x | field base element (reference returned). |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
ElementAbstract& axpyin | ( | ElementAbstract & | r, |
const ElementAbstract & | a, | ||
const ElementAbstract & | x | ||
) | const [inline, virtual] |
Inplace AXPY. r += a * x This function assumes all field elements have already been constructed and initialized.
r | field element (reference returned). |
a | field element. |
x | field element. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
std::ostream& write | ( | std::ostream & | os | ) | const [inline, virtual] |
Print field.
os | output stream to which field is written. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
std::istream& read | ( | std::istream & | is | ) | [inline, virtual] |
Read field.
is | input stream from which field is read. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
std::ostream& write | ( | std::ostream & | os, |
const ElementAbstract & | x | ||
) | const [inline, virtual] |
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. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.
std::istream& read | ( | std::istream & | is, |
ElementAbstract & | x | ||
) | const [inline, virtual] |
Read field base element. This function assumes the field base element has already been constructed and initialized.
is | input stream from which field base element is read. |
x | field base element. |
Implements FieldAbstract.
Reimplemented in RingEnvelope< Ring >.