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

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

#include <modular-int64.h>

Public Types

typedef int64_t Element
typedef ModularRandIter< int64_t > RandIter

Public Member Functions

 Modular ()
 Modular (int64_t value, int64_t exp=1)
 Modular (const Modular< int64_t > &mf)
const Modular & operator= (const Modular< int64_t > &F)
unsigned long & cardinality (unsigned long &c) const
unsigned long & characteristic (unsigned long &c) const
unsigned long characteristic () const
unsigned long cardinality () const
int64_t & convert (int64_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

Static Public Member Functions

static int64_t getMaxModulus ()

Data Fields

const bool balanced

Protected Attributes

int64_t modulus
double modulusinv
unsigned long lmodulus
int64_t _two64

Detailed Description

template<>
class FFPACK::Modular< int64_t >

Specialization of Modular to int64_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^62.

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


Member Typedef Documentation

typedef int64_t Element
typedef ModularRandIter<int64_t> RandIter

Constructor & Destructor Documentation

Modular ( ) [inline]
Modular ( int64_t  value,
int64_t  exp = 1 
) [inline]
Modular ( const Modular< int64_t > &  mf) [inline]

Member Function Documentation

const Modular& operator= ( const Modular< int64_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]
int64_t& convert ( int64_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]
static int64_t getMaxModulus ( ) [inline, static]

Field Documentation

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

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