linbox
Public Types
ParamFuzzy Class Reference

Abstract parameterized field of "fuzzy" doubles. More...

#include <param-fuzzy.h>

+ Inheritance diagram for ParamFuzzy:
+ Collaboration diagram for ParamFuzzy:

Public Types

typedef double Element
 element type. More...
 
typedef ParamFuzzyRandIter RandIter
 Random iterator generator type. More...
 

Public Member Functions

Object Management
 ParamFuzzy (const double &value=.000000001)
 Constructor from an integer. More...
 
 ParamFuzzy (const ParamFuzzy &F)
 Copy constructor. More...
 
ParamFuzzyoperator= (const ParamFuzzy &F)
 Assignment operator. More...
 
Elementinit (Element &x, const integer &y=0) const
 Initialization of field base element from an integer. More...
 
Elementinit (Element &x, const double &y) const
 init (from double) More...
 
integerconvert (integer &x, const Element &y) const
 Conversion of field base element to a template class T. More...
 
double & convert (double &x, const Element &y) const
 convert (double) More...
 
Elementassign (Element &x, const Element &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 Element &x, const Element &y) const
 Equality of two elements. More...
 
Elementadd (Element &x, const Element &y, const Element &z) const
 Addition. More...
 
Elementsub (Element &x, const Element &y, const Element &z) const
 Subtraction. More...
 
Elementmul (Element &x, const Element &y, const Element &z) const
 Multiplication. More...
 
Elementdiv (Element &x, const Element &y, const Element &z) const
 Division. More...
 
Elementneg (Element &x, const Element &y) const
 Additive Inverse (Negation). More...
 
Elementinv (Element &x, const Element &y) const
 Multiplicative Inverse. More...
 
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
 Natural AXPY. More...
 
Inplace Arithmetic Operations

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

bool isZero (const Element &x) const
 Zero equality. More...
 
bool isOne (const Element &x) const
 One equality. More...
 
bool isMOne (const Element &x) const
 Zero equality. More...
 
bool isUnit (const Element &x) const
 Zero equality. More...
 
Elementaddin (Element &x, const Element &y) const
 Inplace Addition. More...
 
Elementsubin (Element &x, const Element &y) const
 Inplace Subtraction. More...
 
Elementmulin (Element &x, const Element &y) const
 Inplace Multiplication. More...
 
Elementdivin (Element &x, const Element &y) const
 Inplace Division. More...
 
Elementnegin (Element &x) const
 Inplace Additive Inverse (Inplace Negation). More...
 
Elementinvin (Element &x) const
 Inplace Multiplicative Inverse. More...
 
Elementaxpyin (Element &r, const Element &a, const Element &x) const
 Inplace AXPY. More...
 
Input/Output Operations
std::ostream & write (std::ostream &os) const
 Print field. More...
 
std::istream & read (std::istream &is)
 Read field. More...
 
std::ostream & write (std::ostream &os, const Element &x) const
 Print field base element. More...
 
std::istream & read (std::istream &is, Element &x) const
 Read field base element. More...
 

Detailed Description

Abstract parameterized field of "fuzzy" doubles.

Field has (non-static, non-negative) member to contain "fuzz value" of field. Doubles within this fuzz value are considered to be equal.

Member Typedef Documentation

◆ Element

typedef double Element

element type.

It must meet the common object interface of elements as given in the the archetype ElementArchetype.

◆ RandIter

typedef ParamFuzzyRandIter RandIter

Random iterator generator type.

It must meet the common object interface of random element generators as given in the the archetype RandIterArchetype.

Constructor & Destructor Documentation

◆ ParamFuzzy() [1/2]

ParamFuzzy ( const double &  value = .000000001)
inline

Constructor from an integer.

Sets the fuzz value of the field throug the static member of the element type.

Parameters
valueconstant reference to double fuzz value

◆ ParamFuzzy() [2/2]

ParamFuzzy ( const ParamFuzzy F)
inline

Copy constructor.

Constructs ParamFuzzy object by copying the field. This is required to allow field objects to be passed by value into functions.

Parameters
FParamFuzzy object.

Member Function Documentation

◆ operator=()

ParamFuzzy& operator= ( const ParamFuzzy F)
inline

Assignment operator.

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

◆ init() [1/2]

Element& init ( Element x,
const integer 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
xfield base element to contain output (reference returned).
yinteger.

◆ init() [2/2]

Element& init ( Element x,
const double &  y 
) const
inline

init (from double)

Parameters
x,y

◆ convert() [1/2]

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
xtemplate class T to contain output (reference returned).
yconstant field base element.

◆ convert() [2/2]

double& convert ( double &  x,
const Element y 
) const
inline

convert (double)

Parameters
x,y

◆ assign()

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
xfield base element (reference returned).
yfield base element.

◆ cardinality()

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

◆ characteristic()

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.

◆ areEqual()

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
xfield base element
yfield base element

◆ add()

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
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ sub()

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
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ mul()

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
xfield base element (reference returned).
yfield base element.
zfield base element.

◆ div()

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.

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

◆ neg()

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
xfield base element (reference returned).
yfield base element.

◆ inv()

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.

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

◆ axpy()

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
rfield element (reference returned).
afield element.
xfield element.
yfield element.

◆ isZero()

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
xfield base element.

◆ isOne()

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
xfield base element.

◆ isMOne()

bool isMOne ( 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
xfield base element.

◆ isUnit()

bool isUnit ( 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
xfield base element.

◆ addin()

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
xfield base element (reference returned).
yfield base element.

◆ subin()

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
xfield base element (reference returned).
yfield base element.

◆ mulin()

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
xfield base element (reference returned).
yfield base element.

◆ divin()

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
xfield base element (reference returned).
yfield base element.

◆ negin()

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
xfield base element (reference returned).

◆ invin()

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
xfield base element (reference returned).

◆ axpyin()

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

◆ read() [1/2]

std::istream& read ( std::istream &  is)
inline

Read field.

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

◆ write() [2/2]

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
osoutput stream to which field base element is written.
xfield base element.

◆ read() [2/2]

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
isinput stream from which field base element is read.
xfield base element.

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