Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

PowerOfTwoModular Class Template Reference

#include <poweroftwomodular.h>

List of all members.


Detailed Description

template<class Ints>
class LinBox::PowerOfTwoModular< Ints >

Ring of elements modulo some power of two
Parameters:
element  Element type, e.g. long or integer
Intermediate  Type to use for intermediate computations. This should be a data type that can support integers twice the length of the maximal modulus used


Public Types

typedef Ints Element

Public Methods

Object Management
 PowerOfTwoModular (void)
integerconvert (integer &x, const Element &y) const
Elementinit (Element &x, const Ints &y=0) const
Elementassign (Element &x, const Element &y) const
integercardinality (integer &c) const
integercharacteristic (integer &c) const
int & poweroftwo (int &c)
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.

Object Management bool areEqual (const Element &x, const Element &y) const
bool isZero (const Element &x) const
bool isOne (const Element &x) const
bool isUnit (const Element &x) const
bool isZeroDivisor (const Element &x) const
Elementgcd_poweroftwo (Element &x, const Element &y) const
bool doesdivide (const Element &x, const Element &y) const
int poweroftwoinx (const Element &x) const
Elementbezout (const Element &x, const Element &y, Element &gcd, Element &u, Element &v) const
Input/Output Operations
Arithmetic Operations std::ostream & write (std::ostream &os) const
std::istream & read (std::istream &is)
std::ostream & write (std::ostream &os, const Element &x) const
std::istream & read (std::istream &is, Element &x) 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.

Elementadd (Element &x, const Element &y, const Element &z) const
Elementsub (Element &x, const Element &y, const Element &z) const
Elementmul (Element &x, const Element &y, const Element &z) const
Elementdiv (Element &x, const Element &y, const Element &z) const
Elementneg (Element &x, const Element &y) const
Elementinv (Element &x, const Element &y) const
Elementinv2 (Element &x, const Element &y) const
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
Inplace Arithmetic Operations
x <- x op y; x <- op x

Arithmetic Operations Elementaddin (Element &x, const Element &y) const
Elementsubin (Element &x, const Element &y) const
Elementmulin (Element &x, const Element &y) const
Elementdivin (Element &x, const Element &y) const
Elementnegin (Element &x) const
Elementinvin (Element &x) const
Elementaxpyin (Element &r, const Element &a, const Element &x) const

Protected Attributes

Element _poweroftwo
 Private (non-static) element for modulus.


Member Typedef Documentation

typedef Ints Element
 

Element type


Constructor & Destructor Documentation

PowerOfTwoModular void    [inline]
 

Default constructor.


Member Function Documentation

Element& add Element   x,
const Element   y,
const Element   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:
x  field base element (reference returned).
y  field base element.
z  field base element.

Arithmetic Operations Element& addin Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

Object Management bool areEqual const Element   x,
const Element   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:
x  field base element
y  field base element

Element& assign Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

Element& axpy Element   r,
const Element   a,
const Element   x,
const Element   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:
r  field element (reference returned).
a  field element.
x  field element.
y  field element.

Element& axpyin Element   r,
const Element   a,
const Element   x
const [inline]
 

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

Returns:
reference to r.
Parameters:
r  field element (reference returned).
a  field element.
x  field element.

Element& bezout const Element   x,
const Element   y,
Element   gcd,
Element   u,
Element   v
const [inline]
 

integer& cardinality integer   c const [inline]
 

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

integer& characteristic integer   c const [inline]
 

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.

integer& convert integer   x,
const Element   y
const [inline]
 

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:
x  template class T to contain output (reference returned).
y  constant field base element.

Element& div Element   x,
const Element   y,
const Element   z
const [inline]
 

Division. x = y / z This function assumes all the field base elements have already been constructed and initialized. This fonction assumes that x divides y. That can be verified by using doesdivide(x,y)

Returns:
reference to x.
Parameters:
x  field base element (reference returned).
y  field base element.
z  field base element.

Element& divin Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

bool doesdivide const Element   x,
const Element   y
const [inline]
 

Does x divide y

Element& gcd_poweroftwo Element   x,
const Element   y
const [inline]
 

Gcd with 2^_poweroftwo * Valid for Ints up to 32 bits * Specialization is required for bigger Ints

Element& init Element   x,
const Ints &    y = 0
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:
x  field base element to contain output (reference returned).
y  integer.

Element& inv Element   x,
const Element   y
const [inline]
 

Multiplicative Inverse. x = 1 / y This function assumes both field base elements have already been constructed and initialized. This function assumes that y is odd (ie 1/y exists)

Returns:
reference to x.
Parameters:
x  field base element (reference returned).
y  field base element.

Element& inv2 Element   x,
const Element   y
const [inline]
 

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

Returns:
reference to x.
Parameters:
x  field base element (reference returned).
y  field base element.

Element& invin Element   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:
x  field base element (reference returned).

bool isOne const Element   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:
x  field base element.

bool isUnit const Element   x const [inline]
 

bool isZero const Element   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:
x  field base element.

bool isZeroDivisor const Element   x const [inline]
 

Element& mul Element   x,
const Element   y,
const Element   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:
x  field base element (reference returned).
y  field base element.
z  field base element.

Element& mulin Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

Element& neg Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

Element& negin Element   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:
x  field base element (reference returned).

int& poweroftwo int &    c [inline]
 

poweroftwo

int poweroftwoinx const Element   x const [inline]
 

Power of two in x Input Element x = 2^n*y where y is odd Output n

std::istream& read std::istream &    is,
Element   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:
is  input stream from which field base element is read.
x  field base element.

std::istream& read std::istream &    is [inline]
 

Read field.

Returns:
input stream from which field is read.
Parameters:
is  input stream from which field is read.

Element& sub Element   x,
const Element   y,
const Element   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:
x  field base element (reference returned).
y  field base element.
z  field base element.

Element& subin Element   x,
const Element   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:
x  field base element (reference returned).
y  field base element.

std::ostream& write std::ostream &    os,
const Element   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:
os  output stream to which field base element is written.
x  field base element.

Arithmetic Operations std::ostream& write std::ostream &    os const [inline]
 

Print field.

Returns:
output stream to which field is written.
Parameters:
os  output stream to which field is written.


Member Data Documentation

Element _poweroftwo [protected]
 

Private (non-static) element for modulus.


Generated on Mon Jun 20 09:16:52 2005 for linbox by doxygen1.2.18