|
linbox
|
#include <gmp-rational.h>
Inheritance diagram for GMPRationalField:Public Member Functions | |
Object Management | |
x <- convert (y) | |
| GMPRationalField (const GMPRationalField &) | |
| Copy constructor. | |
| ~GMPRationalField (void) | |
| Destructor. | |
| GMPRationalField & | operator= (const GMPRationalField &) |
| Assignment operator. | |
| Element & | init (Element &x, const integer &y=0) const |
| Initialization of field element from an integer. | |
| Element & | init (Element &x, const integer &num, const integer &den) const |
| Copy constructor. | |
| Element & | init (Element &x, const int64_t &y) const |
| Copy constructor. | |
| Element & | init (Element &x, const uint64_t &y) const |
| Copy constructor. | |
| integer & | convert (integer &x, const Element &y=0) const |
| Conversion of field element to an integer. | |
| Element & | assign (Element &x, const Element &y) const |
| Assignment of one field element to another. | |
| integer & | cardinality (integer &c) const |
| is infinite (signified by -1 here) | |
| integer & | characteristic (integer &c) const |
| of the rationals is 0. | |
| integer | cardinality () const |
| Copy constructor. | |
| integer | characteristic () const |
| Copy constructor. | |
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 |
| Equality of two elements. | |
| Element & | add (Element &x, const Element &y, const Element &z) const |
| Addition. | |
| Element & | sub (Element &x, const Element &y, const Element &z) const |
| Subtraction. | |
| Element & | mul (Element &x, const Element &y, const Element &z) const |
| Multiplication. | |
| Element & | div (Element &x, const Element &y, const Element &z) const |
| Division. | |
| Element & | neg (Element &x, const Element &y) const |
| Additive Inverse (Negation). | |
| Element & | inv (Element &x, const Element &y) const |
| Multiplicative Inverse. | |
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 |
| Zero equality. | |
| bool | isOne (const Element &x) const |
| One equality. | |
| bool | isMOne (const Element &x) const |
| MOne equality. | |
| bool | isUnit (const Element &x) const |
| Zero equality. | |
| Element & | addin (Element &x, const Element &y) const |
| Inplace Addition. | |
| Element & | subin (Element &x, const Element &y) const |
| Inplace Subtraction. | |
| Element & | mulin (Element &x, const Element &y) const |
| Inplace Multiplication. | |
| Element & | axpy (Element &r, const Element &a, const Element &x, const Element &y) const |
| axpy. | |
| Element & | axpyin (Element &r, const Element &a, const Element &x) const |
| axpyin. | |
| Element & | divin (Element &x, const Element &y) const |
| Inplace Division. | |
| Element & | negin (Element &x) const |
| Inplace Additive Inverse (Inplace Negation). | |
| Element & | invin (Element &x) const |
| Inplace Multiplicative Inverse. | |
Common Object Interface for a LinBox Field. | |
These methods are required of all LinBox fields. | |
| typedef GMPRationalElement | Element |
| element type. | |
| typedef GMPRationalElement * | Element_ptr |
| pointer to element type. | |
| typedef const Element_ptr | ConstElement_ptr |
| const pointer to element type. | |
| typedef GMPRationalRandIter | RandIter |
| Random iterator generator type. | |
| const Element | zero |
| element type. | |
| const Element | one |
| element type. | |
| const Element | mOne |
| element type. | |
Input/Output Operations | |
| std::ostream & | write (std::ostream &os) const |
| Print field. | |
| std::istream & | read (std::istream &is) |
| Read field. | |
| std::ostream & | write (std::ostream &os, const Element &x) const |
| Print field element. | |
| std::istream & | read (std::istream &is, Element &x) const |
| Read field element. | |
| GMPRationalField (int p=0, int exp=1) | |
| Print field. | |
| integer & | get_num (integer &x, const Element &y) const |
| get numerator. | |
| integer & | get_den (integer &x, const Element &y) const |
| get denominator. | |
| int | sign (const Element &x) const |
| sign. | |
| integer & | bitsize (integer &bs, const Element &q) const |
| Bitsize as sum of bitsizes of numerator and denominator. | |
| static int | maxCardinality () |
| max modulus. | |
| typedef GMPRationalElement Element |
element type.
| typedef GMPRationalElement* Element_ptr |
pointer to element type.
| typedef const Element_ptr ConstElement_ptr |
const pointer to element type.
| typedef GMPRationalRandIter RandIter |
Random iterator generator type.
|
inline |
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
|
inline |
Destructor.
Also vacuous, since there is no de-initialization system
|
inline |
Print field.
| os | output stream to which field is written. |
This does not do much...
|
inline |
Assignment operator.
Also vacuous
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.
| x | field element to contain output (reference returned). |
| y | constant reference to integer. |
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
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))
| x | reference to integer to contain output (reference returned). |
| y | constant reference to field element. |
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.
| x | field element (reference returned). |
| y | field element. |
FIXME: Is this x := y? I am assuming so.
|
inline |
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
|
inline |
Copy constructor.
Vacuous, since this field is unparametric so there is no need to construct multiple field objects
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.
| x | field element |
| y | field element |
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.
| x | field element (reference returned). |
| y | field element. |
| z | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
| z | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
| z | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
| z | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
|
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.
| x | field element. |
|
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.
| x | field element. |
|
inline |
MOne 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.
| x | field element. |
|
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.
| x | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
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.
| x | field element (reference returned). |
| y | field element. |
|
inline |
axpy.
r = a*x + y
| r | |
| a | |
| x | |
| y |
axpyin.
r += a*x
| r | |
| a | |
| x |
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.
| x | field element (reference returned). |
| y | field element. |
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.
| x | field element (reference returned). |
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.
| x | field element (reference returned). |
|
inline |
Print field.
| os | output stream to which field is written. |
This does not do much...
|
inline |
Read field.
| 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.
|
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.
| os | output stream to which field element is written. |
| x | field element. |
|
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.
| 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?
aniau.nosp@m.@ast.nosp@m.ronet.nosp@m..pl: 06/2009: supports scientific E/e notation for decimal fractions
|
inlinestatic |
max modulus.
get numerator.
| x | numerator of y |
| y |
get denominator.
| x | denominator of y |
| y |
|
inline |
sign.
| x |
x Bitsize as sum of bitsizes of numerator and denominator.
| bs | |
| q |
bs | const Element zero |
element type.
| const Element one |
element type.
| const Element mOne |
element type.