FflasFfpack
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Protected Attributes
Modular< int32_t > Class Template Reference

Specialization of Modular to int32_t element type with efficient dot product. More...

#include <modular-int32.h>

Public Types

typedef int32_t Element
typedef ModularRandIter< Element > RandIter
typedef NonzeroRandIter
< Modular< Element >
, ModularRandIter< Element > > 
NonZeroRandIter

Public Member Functions

 Modular ()
 Modular (int32_t value, int32_t exp=1)
 Modular (unsigned long int value)
 Modular (long int value)
 Modular (const Modular< int32_t > &mf)
Modular< Element > & assign (const Modular< Element > &F)
const Modular & operator= (const Modular< int32_t > &F)
unsigned long & cardinality (unsigned long &c) const
unsigned long & characteristic (unsigned long &c) const
unsigned long characteristic () const
unsigned long cardinality () const
int32_t & convert (int32_t &x, const Element &y) const
double & convert (double &x, const Element &y) const
float & convert (float &x, const Element &y) const
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
Element & init (Element &x, const double &y) const
Element & init (Element &x, const float &y) const
template<class Element1 >
Element & init (Element &x, const Element1 &y) const
Element & init (Element &x, int y=0) const
Element & init (Element &x, long y) const
Element & assign (Element &x, const Element &y) const
bool areEqual (const Element &x, const Element &y) const
bool isZero (const Element &x) const
bool isOne (const Element &x) 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
Element & axpy (Element &r, const Element &a, const Element &x, const Element &y) 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 & divin (Element &x, const Element &y) const
Element & negin (Element &x) const
Element & invin (Element &x) const
Element & axpyin (Element &r, const Element &a, const Element &x) const
unsigned long AccBound (const Element &r) const

Static Public Member Functions

static int32_t getMaxModulus ()

Data Fields

const Element one
const Element zero
const Element mOne

Static Public Attributes

static const bool balanced = false

Protected Attributes

int32_t modulus
double modulusinv
unsigned long lmodulus
int32_t _two64

Detailed Description

template<>
class FFPACK::Modular< int32_t >

Specialization of Modular to int32_t element type with efficient dot product.

Efficient element operations for dot product, mul, axpy, by using floating point inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.

For some uses this is the most efficient field for primes in the range from half word to 2^30.

Requires: Modulus < 2^30. Intended use: 2^15 < prime modulus < 2^30.

Todo:
what about this _two64 not so usefull here ?? (but in linbox)

Member Typedef Documentation

typedef int32_t Element

Constructor & Destructor Documentation

Modular ( )
inline
Modular ( int32_t  value,
int32_t  exp = 1 
)
inline
Modular ( unsigned long int  value)
inline
Modular ( long int  value)
inline
Modular ( const Modular< int32_t > &  mf)
inline

Member Function Documentation

Modular<Element>& assign ( const Modular< Element > &  F)
inline
const Modular& operator= ( const Modular< int32_t > &  F)
inline
unsigned long& cardinality ( unsigned long &  c) const
inline
unsigned long& characteristic ( unsigned long &  c) const
inline
unsigned long characteristic ( ) const
inline
unsigned long cardinality ( ) const
inline
int32_t& convert ( int32_t &  x,
const Element &  y 
) const
inline
double& convert ( double &  x,
const Element &  y 
) const
inline
float& convert ( float &  x,
const Element &  y 
) const
inline
std::ostream& write ( std::ostream &  os) const
inline
std::istream& read ( std::istream &  is)
inline
std::ostream& write ( std::ostream &  os,
const Element &  x 
) const
inline
std::istream& read ( std::istream &  is,
Element &  x 
) const
inline
Element& init ( Element &  x,
const double &  y 
) const
inline
Element& init ( Element &  x,
const float &  y 
) const
inline
Element& init ( Element &  x,
const Element1 &  y 
) const
inline
Element& init ( Element &  x,
int  y = 0 
) const
inline
Element& init ( Element &  x,
long  y 
) const
inline
Element& assign ( Element &  x,
const Element &  y 
) const
inline
bool areEqual ( const Element &  x,
const Element &  y 
) const
inline
bool isZero ( const Element &  x) const
inline
bool isOne ( const Element &  x) const
inline
Element& add ( Element &  x,
const Element &  y,
const Element &  z 
) const
inline
Element& sub ( Element &  x,
const Element &  y,
const Element &  z 
) const
inline
Element& mul ( Element &  x,
const Element &  y,
const Element &  z 
) const
inline
Element& div ( Element &  x,
const Element &  y,
const Element &  z 
) const
inline
Element& neg ( Element &  x,
const Element &  y 
) const
inline
Element& inv ( Element &  x,
const Element &  y 
) const
inline
Element& axpy ( Element &  r,
const Element &  a,
const Element &  x,
const Element &  y 
) const
inline
Element& addin ( Element &  x,
const Element &  y 
) const
inline
Element& subin ( Element &  x,
const Element &  y 
) const
inline
Element& mulin ( Element &  x,
const Element &  y 
) const
inline
Element& divin ( Element &  x,
const Element &  y 
) const
inline
Element& negin ( Element &  x) const
inline
Element& invin ( Element &  x) const
inline
Element& axpyin ( Element &  r,
const Element &  a,
const Element &  x 
) const
inline
unsigned long AccBound ( const Element &  r) const
inline
static int32_t getMaxModulus ( )
inlinestatic

Field Documentation

int32_t modulus
protected
double modulusinv
protected
unsigned long lmodulus
protected
int32_t _two64
protected
const Element one
const Element zero
const Element mOne
const bool balanced = false
static

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