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

GMPRationalField Class Reference

#include <gmp-rational.h>

Inheritance diagram for GMPRationalField:

FieldInterface List of all members.

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 Methods

Input Output Operations Common
Object Interface 
GMPRationalField (int p=0, int exp=1)
integer & get_num (integer &x, const Element &y) const
integer & get_den (integer &x, const Element &y) const
int sign (const Element &x) const
Object Management
x <- convert (y)

 GMPRationalField (const GMPRationalField &F)
 ~GMPRationalField (void)
GMPRationalField & operator= (const GMPRationalField &F)
Element & init (Element &x, const integer &y=0) const
integer & convert (integer &x, const Element &y=0) const
Element & assign (Element &x, const Element &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 elements will give undefined results.

Object Management bool areEqual (const Element &x, const Element &y) const
Element & add (Element &x, const Element &y, const Element &z) const
Element & sub (Element &x, const Element &y, const Element &z) const
Element & mul (Element &x, const Element &y, const Element &z) const
Element & div (Element &x, const Element &y, const Element &z) const
Element & neg (Element &x, const Element &y) const
Element & inv (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.

Arithmetic Operations bool isZero (const Element &x) const
bool isOne (const Element &x) const
Element & addin (Element &x, const Element &y) const
Element & subin (Element &x, const Element &y) const
Element & mulin (Element &x, const Element &y) const
Element & axpy (Element &r, const Element &a, const Element &x, const Element &y) const
Element & axpyin (Element &r, const Element &a, const Element &x) const
Element & divin (Element &x, const Element &y) const
Element & negin (Element &x) const
Element & invin (Element &x) const
Input/Output Operations
Inplace 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

Static Public Methods

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

Input Output Operations Common Object Interface GMPRationalField (  int    p = 0,
int    exp = 1
)  [inline]
 


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

Object Management 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& 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.

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]
 

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.

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

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

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

int getMaxModulus (    )  [inline, static]
 

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.

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.

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

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.

Arithmetic Operations 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.

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& 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& 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& 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).

GMPRationalField& operator= (  const GMPRationalField &    F )  [inline]
 

Assignment operator.

Also vacuous

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?

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.

int sign (  const Element &    x )  const [inline]
 

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

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.

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


Member Data Documentation

const Element neg_one
 

const Element one
 

const Element zero
 


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