Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

GMPRationalField Class Reference

#include <gmp-rational.h>

Inheritance diagram for GMPRationalField:

FieldInterface

Common Object Interface for a LinBox Field.

typedef GMPRationalElement Element
 element type.

typedef GMPRationalRandIter RandIter
 Random iterator generator type.

const Element zero
const Element one
const Element neg_one

Public Member Functions

 GMPRationalField (int p=0, int exp=1)
integerget_num (integer &x, const Element &y) const
integerget_den (integer &x, const Element &y) const
int sign (const Element &x) const
Object Management
x <- convert (y)

 GMPRationalField (const GMPRationalField &F)
 ~GMPRationalField (void)
GMPRationalFieldoperator= (const GMPRationalField &F)
Elementinit (Element &x, const integer &y=0) const
integerconvert (integer &x, const Element &y=0) const
Elementassign (Element &x, const Element &y) const
integercardinality (integer &c) const
integercharacteristic (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 elements will give undefined results.

bool areEqual (const Element &x, const Element &y) const
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
Inplace Arithmetic Operations
x <- x op y; x <- op x These operations require all elements, including x, to be initialized before the operation is called. Uninitialized field elements will give undefined results.

bool isZero (const Element &x) const
bool isOne (const Element &x) const
Elementaddin (Element &x, const Element &y) const
Elementsubin (Element &x, const Element &y) const
Elementmulin (Element &x, const Element &y) const
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
Elementaxpyin (Element &r, const Element &a, const Element &x) const
Elementdivin (Element &x, const Element &y) const
Elementnegin (Element &x) const
Elementinvin (Element &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 Element &x) const
std::istream & read (std::istream &is, Element &x) const

Static Public Member Functions

int getMaxModulus ()

Member Typedef Documentation

typedef GMPRationalElement Element
 

element type.

typedef GMPRationalRandIter RandIter
 

Random iterator generator type.


Constructor & Destructor Documentation

GMPRationalField const GMPRationalField F  )  [inline]
 

Copy constructor.

Vacuous, since this field is unparametric so there is no need to construct multiple field objects

~GMPRationalField void   )  [inline]
 

Destructor.

Also vacuous, since there is no de-initialization system

GMPRationalField int  p = 0,
int  exp = 1
[inline]
 


Member Function Documentation

GMPRationalField& operator= const GMPRationalField F  )  [inline]
 

Assignment operator.

Also vacuous

Element& init Element x,
const integer y = 0
const [inline]
 

Initialization of field element from an integer. Behaves like C++ allocator construct. This function assumes the output field element x has already been constructed, but that it is not necessarily already initialized. In this implementation, this means the _elem_ptr of x exists, but that it may be the null pointer.

Returns:
reference to field element.
Parameters:
x field element to contain output (reference returned).
y constant reference to integer.

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

Conversion of field element to an integer. This function assumes the output field element x has already been constructed, but that it is not already initialized. In this implementation, this means the _elem_ptr of y exists, and that it is not the null pointer.

Returns floor (numerator (y) / denominator (y))

Returns:
reference to integer.
Parameters:
x reference to integer to contain output (reference returned).
y constant reference to field element.

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

Assignment of one field element to another. This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y, _elem_ptr exists and does not point to null.

Returns:
reference to x
Parameters:
x field element (reference returned).
y field element.
FIXME: Is this x := y? I am assuming so.

integer& cardinality integer c  )  const [inline]
 

Cardinality. Return integer representing cardinality of the field. Returns a non-negative integer for all fields with finite cardinality, and returns -1 to signify a field of infinite cardinality.

Returns:
constant reference to integer representing cardinality of the field

integer& characteristic integer c  )  const [inline]
 

Characteristic. Return integer representing characteristic of the field. Returns a positive integer to all fields with finite characteristic, and returns 0 to signify a field of infinite characteristic.

Returns:
constant reference to integer representing characteristic of the field.

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

Equality of two elements. This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y, _elem_ptr exists and does not point to null.

Returns:
boolean true if equal, false if not.
Parameters:
x field element
y field element

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

Addition. x = y + z This function assumes all the field elements have already been constructed and initialized. In this implementation, this means for x, y, and z, _elem_ptr exists and does not point to null.

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

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

Subtraction. x = y - z This function assumes all the field elements have already been constructed and initialized. In this implementation, this means for x, y, and z, _elem_ptr exists and does not point to null.

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

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

Multiplication. x = y * z This function assumes all the field elements have already been constructed and initialized. In this implementation, this means for x, y, and z, _elem_ptr exists and does not point to null.

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

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

Division. x = y / z This function assumes all the field elements have already been constructed and initialized. In this implementation, this means for x, y, and z, _elem_ptr exists and does not point to null.

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

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

Additive Inverse (Negation). x = - y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

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

Multiplicative Inverse. x = 1 / y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

bool isZero const Element x  )  const [inline]
 

Zero equality. Test if field element is equal to zero. This function assumes the field element has already been constructed and initialized. In this implementation, this means the _elem_ptr of x exists and does not point to null.

Returns:
boolean true if equals zero, false if not.
Parameters:
x field element.

bool isOne const Element x  )  const [inline]
 

One equality. Test if field element is equal to one. This function assumes the field element has already been constructed and initialized. In this implementation, this means the _elem_ptr of x exists and does not point to null.

Returns:
boolean true if equals one, false if not.
Parameters:
x field element.

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

Inplace Addition. x += y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

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

Inplace Subtraction. x -= y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

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

Inplace Multiplication. x *= y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

Element& axpy Element r,
const Element a,
const Element x,
const Element y
const [inline]
 

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

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

Inplace Division. x /= y This function assumes both field elements have already been constructed and initialized. In this implementation, this means for both x and y _elem_ptr exists and does not point to null.

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

Element& negin Element x  )  const [inline]
 

Inplace Additive Inverse (Inplace Negation). x = - x This function assumes the field element has already been constructed and initialized. In this implementation, this means the _elem_ptr of x exists and does not point to null.

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

Element& invin Element x  )  const [inline]
 

Inplace Multiplicative Inverse. x = 1 / x This function assumes the field elementhas already been constructed and initialized. In this implementation, this means the _elem_ptr of x exists and does not point to null.

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

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.
This does not do much...

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.
This does not do much either...

FIXME: Read the same thing written above, and throw an exception if the strings do not match.

std::ostream& write std::ostream &  os,
const Element x
const [inline]
 

Print field element. This function assumes the field element has already been constructed and initialized. In this implementation, this means for the _elem_ptr for x exists and does not point to null.

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

std::istream& read std::istream &  is,
Element x
const [inline]
 

Read field element. This function assumes the field element has already been constructed and initialized. In this implementation, this means for the _elem_ptr for x exists and does not point to null.

Returns:
input stream from which field element is read.
Parameters:
is input stream from which field element is read.
x field element.
FIXME: Avoid the magical limit on size here FIXME: Right now it skips over everything until it finds something that looks like a number. Is this really the correct policy?

int getMaxModulus  )  [inline, static]
 

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

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

int sign const Element x  )  const [inline]
 


Field Documentation

const Element zero
 

const Element one
 

const Element neg_one
 


Generated on Fri Jul 8 10:29:51 2005 for linbox by doxygen 1.3.7