linbox
Public Types | Protected Attributes
FieldEnvelope< Field > Class Template Reference

Derived class used to implement the field archetypeHelps to minimize code bloat. More...

#include <envelope.h>

+ Inheritance diagram for FieldEnvelope< Field >:
+ Collaboration diagram for FieldEnvelope< Field >:

Public Types

typedef ElementEnvelope< Field > Element
 element type. More...
 
typedef RandIterEnvelope< Field > RandIter
 Random iterator generator type. More...
 

Public Member Functions

Object Management
 FieldEnvelope (void)
 Default constructor. More...
 
 FieldEnvelope (const Field &F)
 Constructor from field to be wrapped. More...
 
 FieldEnvelope (const FieldEnvelope &E)
 Copy constructor. More...
 
FieldAbstractclone () const
 Virtual copy constructor. More...
 
FieldAbstractoperator= (const FieldAbstract &F)
 Assignment operator. More...
 
ElementAbstractinit (ElementAbstract &x) const
 Initialization of field base element from an integer. More...
 
ElementAbstractinit (ElementAbstract &x, const integer &y) const
 Initialization of field base element from an integer. More...
 
integerconvert (integer &x, const ElementAbstract &y) const
 Conversion of field base element to a template class T. More...
 
ElementAbstractassign (ElementAbstract &x, const ElementAbstract &y) const
 Assignment of one field base element to another. More...
 
integercardinality (integer &c) const
 Cardinality. More...
 
integercharacteristic (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 ElementAbstract &x, const ElementAbstract &y) const
 Equality of two elements. More...
 
ElementAbstractadd (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const
 Addition. More...
 
ElementAbstractsub (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const
 Subtraction. More...
 
ElementAbstractmul (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const
 Multiplication. More...
 
ElementAbstractdiv (ElementAbstract &x, const ElementAbstract &y, const ElementAbstract &z) const
 Division. More...
 
ElementAbstractneg (ElementAbstract &x, const ElementAbstract &y) const
 Additive Inverse (Negation). More...
 
ElementAbstractinv (ElementAbstract &x, const ElementAbstract &y) const
 Multiplicative Inverse. More...
 
ElementAbstractaxpy (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x, const ElementAbstract &y) const
 Natural AXPY. More...
 
ElementAbstractaxmy (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x, const ElementAbstract &y) const
 Natural AXMY. More...
 
ElementAbstractmaxpy (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x, const ElementAbstract &y) const
 Natural MAXPY. More...
 
Inplace Arithmetic Operations

x <- x op y; x <- op x

bool isZero (const ElementAbstract &x) const
 Zero equality. More...
 
bool isOne (const ElementAbstract &x) const
 One equality. More...
 
bool isMOne (const ElementAbstract &x) const
 MOne equality. More...
 
bool isUnit (const ElementAbstract &x) const
 invertibility. More...
 
ElementAbstractaddin (ElementAbstract &x, const ElementAbstract &y) const
 Inplace Addition. More...
 
ElementAbstractsubin (ElementAbstract &x, const ElementAbstract &y) const
 Inplace Subtraction. More...
 
ElementAbstractmulin (ElementAbstract &x, const ElementAbstract &y) const
 Inplace Multiplication. More...
 
ElementAbstractdivin (ElementAbstract &x, const ElementAbstract &y) const
 Inplace Division. More...
 
ElementAbstractnegin (ElementAbstract &x) const
 Inplace Additive Inverse (Inplace Negation). More...
 
ElementAbstractinvin (ElementAbstract &x) const
 Inplace Multiplicative Inverse. More...
 
ElementAbstractaxpyin (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x) const
 Inplace AXPY. More...
 
ElementAbstractaxmyin (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x) const
 Inplace AXMY. More...
 
ElementAbstractmaxpyin (ElementAbstract &r, const ElementAbstract &a, const ElementAbstract &x) const
 Inplace MAXPY. More...
 
Input/Output Operations
std::ostream & write (std::ostream &os) const
 Print field. More...
 
std::ostream & write (std::ostream &os, const ElementAbstract &x) const
 Print field base element. More...
 
std::istream & read (std::istream &is, ElementAbstract &x) const
 Read field base element. More...
 

Protected Attributes

Field _field
 Wrapped field.
 

Detailed Description

template<class Field>
class LinBox::FieldEnvelope< 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.

Member Typedef Documentation

◆ Element

typedef ElementEnvelope<Field> Element

element type.

It is derived from the class ElementAbstract, and it must contain a wrapped field element.

◆ RandIter

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.

Constructor & Destructor Documentation

◆ FieldEnvelope() [1/3]

FieldEnvelope ( void  )
inline

Default constructor.

In this implementation, this means copying the field E._field.

◆ FieldEnvelope() [2/3]

FieldEnvelope ( const Field &  F)
inline

Constructor from field to be wrapped.

Parameters
FField object to be wrapped.

◆ FieldEnvelope() [3/3]

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._field.

Parameters
EFieldEnvelope object.

Member Function Documentation

◆ clone()

FieldAbstract* clone ( ) const
inlinevirtual

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.

Returns
pointer to new object in dynamic memory.

Implements FieldAbstract.

◆ operator=()

FieldAbstract& operator= ( const FieldAbstract F)
inlinevirtual

Assignment operator.

Required by abstract base class.

Returns
reference to FieldAbstract object for self
Parameters
Fconstant reference to FieldAbstract object

Implements FieldAbstract.

◆ init() [1/2]

ElementAbstract& init ( ElementAbstract x) const
inline

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.

Returns
reference to field base element.
Parameters
xfield base element to contain output (reference returned).
yinteger.

◆ init() [2/2]

ElementAbstract& init ( ElementAbstract x,
const integer y 
) const
inlinevirtual

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.

Returns
reference to field base element.
Parameters
xfield base element to contain output (reference returned).
yinteger.

Implements FieldAbstract.

◆ convert()

integer& convert ( integer x,
const ElementAbstract y 
) const
inlinevirtual

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.

Returns
reference to template class T.
Parameters
xtemplate class T to contain output (reference returned).
yconstant field base element.

Implements FieldAbstract.

◆ assign()

ElementAbstract& assign ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Assignment of one field base element to another.

This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x
Parameters
xfield base element (reference returned).
yfield base element.

◆ cardinality()

integer& cardinality ( integer c) const
inlinevirtual

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.

Returns
integer representing cardinality of the domain

Implements FieldAbstract.

◆ characteristic()

integer& characteristic ( integer c) const
inlinevirtual

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.

Returns
integer representing characteristic of the domain.

Implements FieldAbstract.

◆ areEqual()

bool areEqual ( const ElementAbstract x,
const ElementAbstract y 
) const
inline

Equality of two elements.

This function assumes both field base elements have already been constructed and initialized.

Returns
boolean true if equal, false if not.
Parameters
xfield base element
yfield base element

◆ add()

ElementAbstract& add ( ElementAbstract x,
const ElementAbstract y,
const ElementAbstract z 
) const
inline

Addition.

x = y + z This function assumes all the field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ sub()

ElementAbstract& sub ( ElementAbstract x,
const ElementAbstract y,
const ElementAbstract z 
) const
inline

Subtraction.

x = y - z This function assumes all the field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ mul()

ElementAbstract& mul ( ElementAbstract x,
const ElementAbstract y,
const ElementAbstract z 
) const
inline

Multiplication.

x = y * z This function assumes all the field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ div()

ElementAbstract& div ( ElementAbstract x,
const ElementAbstract y,
const ElementAbstract z 
) const
inline

Division.

x = y / z This function assumes all the field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ neg()

ElementAbstract& neg ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Additive Inverse (Negation).

x = - y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ inv()

ElementAbstract& inv ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Multiplicative Inverse.

x = 1 / y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ axpy()

ElementAbstract& axpy ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x,
const ElementAbstract y 
) const
inline

Natural AXPY.

r = a * x + y This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.
yfield element.

◆ axmy()

ElementAbstract& axmy ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x,
const ElementAbstract y 
) const
inline

Natural AXMY.

r = a * x - y This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.
yfield element.

◆ maxpy()

ElementAbstract& maxpy ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x,
const ElementAbstract y 
) const
inline

Natural MAXPY.

r = y - a * x This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.
yfield element.

◆ isZero()

bool isZero ( const ElementAbstract x) const
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.

Returns
boolean true if equals zero, false if not.
Parameters
xfield base element.

◆ isOne()

bool isOne ( const ElementAbstract x) const
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.

Returns
boolean true if equals one, false if not.
Parameters
xfield base element.

◆ isMOne()

bool isMOne ( const ElementAbstract x) const
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.

Returns
boolean true if equals one, false if not.
Parameters
xfield base element.

◆ isUnit()

bool isUnit ( const ElementAbstract x) const
inline

invertibility.

Test if field element is a unit. This function assumes the field element has already been constructed and initialized. Purely virtual.

Returns
boolean true if is a unit, false if not.
Parameters
xfield element.

◆ addin()

ElementAbstract& addin ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Inplace Addition.

x += y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ subin()

ElementAbstract& subin ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Inplace Subtraction.

x -= y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ mulin()

ElementAbstract& mulin ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Inplace Multiplication.

x *= y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ divin()

ElementAbstract& divin ( ElementAbstract x,
const ElementAbstract y 
) const
inline

Inplace Division.

x /= y This function assumes both field base elements have already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).
yfield base element.

◆ negin()

ElementAbstract& negin ( ElementAbstract x) const
inline

Inplace Additive Inverse (Inplace Negation).

x = - x This function assumes the field base element has already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).

◆ invin()

ElementAbstract& invin ( ElementAbstract x) const
inline

Inplace Multiplicative Inverse.

x = 1 / x This function assumes the field base elementhas already been constructed and initialized.

Returns
reference to x.
Parameters
xfield base element (reference returned).

◆ axpyin()

ElementAbstract& axpyin ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x 
) const
inline

Inplace AXPY.

r += a * x This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.

◆ axmyin()

ElementAbstract& axmyin ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x 
) const
inline

Inplace AXMY.

r = a * x - r This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.

◆ maxpyin()

ElementAbstract& maxpyin ( ElementAbstract r,
const ElementAbstract a,
const ElementAbstract x 
) const
inline

Inplace MAXPY.

r -= a * x This function assumes all field elements have already been constructed and initialized.

Returns
reference to r.
Parameters
rfield element (reference returned).
afield element.
xfield element.

◆ write() [1/2]

std::ostream& write ( std::ostream &  os) const
inline

Print field.

Returns
output stream to which field is written.
Parameters
osoutput stream to which field is written.

◆ write() [2/2]

std::ostream& write ( std::ostream &  os,
const ElementAbstract x 
) const
inline

Print field base element.

This function assumes the field base element has already been constructed and initialized.

Returns
output stream to which field base element is written.
Parameters
osoutput stream to which field base element is written.
xfield base element.

◆ read()

std::istream& read ( std::istream &  is,
ElementAbstract x 
) const
inline

Read field base element.

This function assumes the field base element has already been constructed and initialized.

Returns
input stream from which field base element is read.
Parameters
isinput stream from which field base element is read.
xfield base element.

The documentation for this class was generated from the following file: