Givaro
Public Types | Public Member Functions | Data Fields | Protected Member Functions | Static Protected Member Functions | Protected Attributes
Montgomery< Std32 > Class Template Reference

This class implements the standard arithmetic with Modulo Elements. More...

#include <givmontg32.h>

Public Types

enum  { size_rep = sizeof(Residu_t) }
typedef uint32_t Residu_t
typedef uint32_t Rep
typedef uint32_t Element
typedef GIV_randIter
< Montgomery< Std32 >, Rep
randIter

Public Member Functions

 Montgomery ()
 Montgomery (Residu_t p, int=1)
 Montgomery (const Montgomery< Std32 > &F)
int operator== (const Montgomery< Std32 > &BC) const
int operator!= (const Montgomery< Std32 > &BC) const
Montgomery< Std32 > & operator= (const Montgomery< Std32 > &F)
Residu_t residu () const
Residu_t size () const
Rep access (const Rep a) const
Residu_t characteristic () const
Residu_t characteristic (Residu_t p) const
Residu_t cardinality () const
Repinit (Rep &a) const
Repinit (Rep &r, const long a) const
Repinit (Rep &r, const unsigned long a) const
Repinit (Rep &a, const int i) const
Repinit (Rep &a, const unsigned int i) const
Repinit (Rep &r, const Integer &residu) const
Repinit (Rep &a, const double i) const
Repinit (Rep &a, const float i) const
unsigned long int & convert (unsigned long int &r, const Rep a) const
uint32_tconvert (uint32_t &r, const Rep a) const
int32_tconvert (int32_t &r, const Rep a) const
long int & convert (long int &r, const Rep a) const
Integerconvert (Integer &i, const Rep a) const
float & convert (float &r, const Rep a) const
double & convert (double &r, const Rep a) const
int isZero (const Rep a) const
int isOne (const Rep a) const
size_t length (const Rep a) const
int areEqual (const Rep &a, const Rep &b) const
Repmul (Rep &r, const Rep a, const Rep b) const
Repdiv (Rep &r, const Rep a, const Rep b) const
Repadd (Rep &r, const Rep a, const Rep b) const
Repsub (Rep &r, const Rep a, const Rep b) const
Repneg (Rep &r, const Rep a) const
Repinv (Rep &r, const Rep a) const
Repmulin (Rep &r, const Rep a) const
Repdivin (Rep &r, const Rep a) const
Repaddin (Rep &r, const Rep a) const
Repsubin (Rep &r, const Rep a) const
Repnegin (Rep &r) const
Repinvin (Rep &r) const
Repaxpy (Rep &r, const Rep a, const Rep b, const Rep c) const
Repaxpyin (Rep &r, const Rep a, const Rep b) const
Repaxmy (Rep &r, const Rep a, const Rep b, const Rep c) const
Repaxmyin (Rep &r, const Rep a, const Rep b) const
Repmaxpy (Rep &r, const Rep a, const Rep b, const Rep c) const
Repmaxpyin (Rep &r, const Rep a, const Rep b) const
Repassign (Rep &r, const Rep a) const
template<class RandIter >
Reprandom (RandIter &, Rep &r) const
template<class RandIter >
Reprandom (RandIter &, Rep &r, long s) const
template<class RandIter >
Reprandom (RandIter &, Rep &r, const Rep &b) const
template<class RandIter >
Repnonzerorandom (RandIter &, Rep &r) const
template<class RandIter >
Repnonzerorandom (RandIter &, Rep &r, long s) const
template<class RandIter >
Repnonzerorandom (RandIter &, Rep &r, const Rep &b) const
std::istream & read (std::istream &s)
std::ostream & write (std::ostream &s) const
std::istream & read (std::istream &s, Rep &a) const
std::ostream & write (std::ostream &s, const Rep a) const

Data Fields

const Rep zero
const Rep one

Protected Member Functions

int32_tgcdext (int32_t &d, int32_t &u, int32_t &v, const int32_t a, const int32_t b) const
int32_tinvext (int32_t &u, const int32_t a, const int32_t b) const
int32_t invext (const int32_t a, const int32_t b) const
Elementredc (Element &, const Element) const
Element redcal (const Element) const
Element redcsal (const Element) const
Elementredcin (Element &) const
Elementredcs (Element &, const Element) const
Elementredcsin (Element &) const

Static Protected Member Functions

static void Init ()
static void End ()

Protected Attributes

Residu_t _p
Residu_t _Bp
Residu_t _B2p
Residu_t _B3p
Residu_t _nim
double _dp

Detailed Description

template<>
class Givaro::Montgomery< Std32 >

This class implements the standard arithmetic with Modulo Elements.

Reduction is made through Montgomery's reduction. Representation of a is by storing (aB).

Examples:

examples/FiniteField/all_field.C, examples/FiniteField/ff_arith.C, and examples/Polynomial/PolynomialCRT.C.


Member Typedef Documentation

typedef uint32_t Residu_t
typedef uint32_t Rep
typedef uint32_t Element
typedef GIV_randIter< Montgomery<Std32> , Rep > randIter

Member Enumeration Documentation

anonymous enum
Enumerator:
size_rep 

Constructor & Destructor Documentation

Montgomery ( ) [inline]
Montgomery ( Residu_t  p,
int  = 1 
) [inline]
Montgomery ( const Montgomery< Std32 > &  F) [inline]

Member Function Documentation

int operator== ( const Montgomery< Std32 > &  BC) const [inline]
int operator!= ( const Montgomery< Std32 > &  BC) const [inline]
Montgomery<Std32>& operator= ( const Montgomery< Std32 > &  F) [inline]
Montgomery< Std32 >::Residu_t residu ( ) const [inline]
Residu_t size ( ) const [inline]
Rep access ( const Rep  a) const [inline]
Residu_t characteristic ( ) const [inline]
Residu_t characteristic ( Residu_t  p) const [inline]
Residu_t cardinality ( ) const [inline]
Montgomery< Std32 >::Rep & init ( Rep a) const [inline]
Montgomery< Std32 >::Rep & init ( Rep r,
const long  a 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep r,
const unsigned long  a 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep a,
const int  i 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep a,
const unsigned int  i 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep r,
const Integer residu 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep a,
const double  i 
) const [inline]
Montgomery< Std32 >::Rep & init ( Rep a,
const float  i 
) const [inline]
unsigned long int& convert ( unsigned long int &  r,
const Rep  a 
) const [inline]
uint32_t& convert ( uint32_t r,
const Rep  a 
) const [inline]
int32_t& convert ( int32_t r,
const Rep  a 
) const [inline]
long int& convert ( long int &  r,
const Rep  a 
) const [inline]
Integer& convert ( Integer i,
const Rep  a 
) const [inline]
float& convert ( float &  r,
const Rep  a 
) const [inline]
double& convert ( double &  r,
const Rep  a 
) const [inline]
int isZero ( const Rep  a) const [inline]
int isOne ( const Rep  a) const [inline]
size_t length ( const Rep  a) const [inline]
int areEqual ( const Rep a,
const Rep b 
) const [inline]
Montgomery< Std32 >::Rep & mul ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & div ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & add ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & sub ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & neg ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & inv ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & mulin ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & divin ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & addin ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & subin ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & negin ( Rep r) const [inline]
Montgomery< Std32 >::Rep & invin ( Rep r) const [inline]
Montgomery< Std32 >::Rep & axpy ( Rep r,
const Rep  a,
const Rep  b,
const Rep  c 
) const [inline]
Montgomery< Std32 >::Rep & axpyin ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & axmy ( Rep r,
const Rep  a,
const Rep  b,
const Rep  c 
) const [inline]
Montgomery< Std32 >::Rep & axmyin ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & maxpy ( Rep r,
const Rep  a,
const Rep  b,
const Rep  c 
) const [inline]
Montgomery< Std32 >::Rep & maxpyin ( Rep r,
const Rep  a,
const Rep  b 
) const [inline]
Montgomery< Std32 >::Rep & assign ( Rep r,
const Rep  a 
) const [inline]
Montgomery< Std32 >::Rep & random ( RandIter &  g,
Rep r 
) const [inline]
Montgomery< Std32 >::Rep & random ( RandIter &  g,
Rep r,
long  s 
) const [inline]
Montgomery< Std32 >::Rep & random ( RandIter &  g,
Rep r,
const Rep b 
) const [inline]
Montgomery< Std32 >::Rep & nonzerorandom ( RandIter &  g,
Rep r 
) const [inline]
Montgomery< Std32 >::Rep & nonzerorandom ( RandIter &  g,
Rep r,
long  s 
) const [inline]
Montgomery< Std32 >::Rep & nonzerorandom ( RandIter &  g,
Rep r,
const Rep b 
) const [inline]
std::istream & read ( std::istream &  s) [inline]
std::ostream & write ( std::ostream &  s) const [inline]
std::istream & read ( std::istream &  s,
Rep a 
) const [inline]
std::ostream & write ( std::ostream &  s,
const Rep  a 
) const [inline]
int32_t & gcdext ( int32_t d,
int32_t u,
int32_t v,
const int32_t  a,
const int32_t  b 
) const [protected]
int32_t & invext ( int32_t u,
const int32_t  a,
const int32_t  b 
) const [protected]
int32_t invext ( const int32_t  a,
const int32_t  b 
) const [protected]
Montgomery< Std32 >::Element & redc ( Element r,
const Element  c 
) const [inline, protected]
Montgomery< Std32 >::Element redcal ( const Element  c) const [inline, protected]
Montgomery< Std32 >::Element redcsal ( const Element  c) const [inline, protected]
Montgomery< Std32 >::Element & redcin ( Element r) const [inline, protected]
Montgomery< Std32 >::Element & redcs ( Element r,
const Element  c 
) const [inline, protected]
Montgomery< Std32 >::Element & redcsin ( Element r) const [inline, protected]
void Init ( ) [static, protected]
void End ( ) [static, protected]

Field Documentation

Residu_t _p [protected]
Residu_t _Bp [protected]
Residu_t _B2p [protected]
Residu_t _B3p [protected]
Residu_t _nim [protected]
double _dp [protected]
const Rep zero
const Rep one

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