FflasFfpack
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | 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< ElementRandIter
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)
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
Elementinit (Element &x, const double &y) const
Elementinit (Element &x, const float &y) const
template<class Element1 >
Elementinit (Element &x, const Element1 &y) const
Elementinit (Element &x, int y=0) const
Elementinit (Element &x, long y) const
Elementassign (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
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
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
Elementaddin (Element &x, const Element &y) const
Elementsubin (Element &x, const Element &y) const
Elementmulin (Element &x, const Element &y) const
Elementdivin (Element &x, const Element &y) const
Elementnegin (Element &x) const
Elementinvin (Element &x) const
Elementaxpyin (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 bool balanced

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

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 ( ) [inline, static]

Field Documentation

int32_t modulus [protected]
double modulusinv [protected]
unsigned long lmodulus [protected]
int32_t _two64 [protected]
const bool balanced

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