Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Modular< int32 > Class Template Reference

#include <modular-balance-int32.h>

Inheritance diagram for Modular< int32 >:

FieldInterface FieldInterface PIRModular< int32 > List of all members.

Detailed Description

template<>
class LinBox::Modular< int32 >

Specialization of Modular to int32 element type with efficient dot product. @doc 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.


Public Types

typedef int32 Element
typedef ModularRandIter< int32 > RandIter
typedef int32 Element
typedef ModularRandIter< int32 > RandIter

Public Methods

 Modular ()
 Modular (int32 value, int exp=1)
 Modular (const Modular< int32 > &mf)
const Modular & operator= (const Modular< int32 > &F)
integer & cardinality (integer &c) const
integer & characteristic (integer &c) const
integer & convert (integer &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 integer &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
 Modular ()
 Modular (int32 value, int32 exp=1)
 Modular (const Modular< int32 > &mf)
const Modular & operator= (const Modular< int32 > &F)
integer & cardinality (integer &c) const
integer & characteristic (integer &c) const
integer & convert (integer &x, const Element &y) const
double & convert (double &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
template<class Element1> Element & init (Element &x, const Element1 &y) const
Element & init (Element &x, const integer &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

Static Public Methods

int32 getMaxModulus ()

Protected Attributes

int32 modulus
int32 halfmodulus
int32 nhalfmodulus
double modulusinv
int32 _two64

Friends

class FieldAXPY< Modular< int32 > >
class DotProductDomain< Modular< int32 > >
class MVProductDomain< Modular< int32 > >


Member Typedef Documentation

typedef int32 Element
 

Reimplemented in PIRModular< int32 >.

typedef int32 Element
 

Reimplemented in PIRModular< int32 >.

typedef ModularRandIter<int32> RandIter
 

Reimplemented in PIRModular< int32 >.

typedef ModularRandIter<int32> RandIter
 

Reimplemented in PIRModular< int32 >.


Member Function Documentation

Element& add (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& add (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& addin (  Element &    x,
const Element &    y
)  const [inline]
 

Element& addin (  Element &    x,
const Element &    y
)  const [inline]
 

bool areEqual (  const Element &    x,
const Element &    y
)  const [inline]
 

bool areEqual (  const Element &    x,
const Element &    y
)  const [inline]
 

Element& assign (  Element &    x,
const Element &    y
)  const [inline]
 

Element& assign (  Element &    x,
const Element &    y
)  const [inline]
 

Element& axpy (  Element &    r,
const Element &    a,
const Element &    x,
const Element &    y
)  const [inline]
 

Element& axpy (  Element &    r,
const Element &    a,
const Element &    x,
const Element &    y
)  const [inline]
 

Element& axpyin (  Element &    r,
const Element &    a,
const Element &    x
)  const [inline]
 

Element& axpyin (  Element &    r,
const Element &    a,
const Element &    x
)  const [inline]
 

integer& cardinality (  integer &    c )  const [inline]
 

integer& cardinality (  integer &    c )  const [inline]
 

integer& characteristic (  integer &    c )  const [inline]
 

integer& characteristic (  integer &    c )  const [inline]
 

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

integer& convert (  integer &    x,
const Element &    y
)  const [inline]
 

integer& convert (  integer &    x,
const Element &    y
)  const [inline]
 

Element& div (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Reimplemented in PIRModular< int32 >.

Element& div (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Reimplemented in PIRModular< int32 >.

Element& divin (  Element &    x,
const Element &    y
)  const [inline]
 

Reimplemented in PIRModular< int32 >.

Element& divin (  Element &    x,
const Element &    y
)  const [inline]
 

Reimplemented in PIRModular< int32 >.

int32 getMaxModulus (    )  [inline, static]
 

Element& init (  Element &    x,
long    y
)  const [inline]
 

Element& init (  Element &    x,
int    y = 0
)  const [inline]
 

Element& init (  Element &    x,
const integer &    y
)  const [inline]
 

Element& init (  Element &    x,
const Element1 &    y
)  const [inline]
 

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

Element& init (  Element &    x,
long    y
)  const [inline]
 

Element& init (  Element &    x,
int    y = 0
)  const [inline]
 

Element& init (  Element &    x,
const integer &    y
)  const [inline]
 

Element& inv (  Element &    x,
const Element &    y
)  const [inline]
 

Element& inv (  Element &    x,
const Element &    y
)  const [inline]
 

Element& invin (  Element &    x )  const [inline]
 

Element& invin (  Element &    x )  const [inline]
 

bool isOne (  const Element &    x )  const [inline]
 

bool isOne (  const Element &    x )  const [inline]
 

bool isZero (  const Element &    x )  const [inline]
 

bool isZero (  const Element &    x )  const [inline]
 

Modular (  const Modular< int32 > &    mf )  [inline]
 

Modular (  int32    value,
int32    exp = 1
)  [inline]
 

Modular (    )  [inline]
 

Modular (  const Modular< int32 > &    mf )  [inline]
 

Modular (  int32    value,
int    exp = 1
)  [inline]
 

Modular (    )  [inline]
 

Element& mul (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& mul (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& mulin (  Element &    x,
const Element &    y
)  const [inline]
 

Element& mulin (  Element &    x,
const Element &    y
)  const [inline]
 

Element& neg (  Element &    x,
const Element &    y
)  const [inline]
 

Element& neg (  Element &    x,
const Element &    y
)  const [inline]
 

Element& negin (  Element &    x )  const [inline]
 

Element& negin (  Element &    x )  const [inline]
 

const Modular& operator= (  const Modular< int32 > &    F )  [inline]
 

const Modular& operator= (  const Modular< int32 > &    F )  [inline]
 

std::istream& read (  std::istream &    is,
Element &    x
)  const [inline]
 

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

std::istream& read (  std::istream &    is,
Element &    x
)  const [inline]
 

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

Element& sub (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& sub (  Element &    x,
const Element &    y,
const Element &    z
)  const [inline]
 

Element& subin (  Element &    x,
const Element &    y
)  const [inline]
 

Element& subin (  Element &    x,
const Element &    y
)  const [inline]
 

std::ostream& write (  std::ostream &    os,
const Element &    x
)  const [inline]
 

std::ostream& write (  std::ostream &    os )  const [inline]
 

std::ostream& write (  std::ostream &    os,
const Element &    x
)  const [inline]
 

std::ostream& write (  std::ostream &    os )  const [inline]
 


Friends And Related Function Documentation

DotProductDomain< Modular< int32 > > [friend]
 

FieldAXPY< Modular< int32 > > [friend]
 

friend class MVProductDomain< Modular< int32 > > [friend]
 


Member Data Documentation

int32 _two64 [protected]
 

int32 halfmodulus [protected]
 

int32 modulus [protected]
 

double modulusinv [protected]
 

int32 nhalfmodulus [protected]
 


Generated on Mon Jun 20 09:16:55 2005 for linbox by doxygen1.2.18