Givaro
Public Types | Public Member Functions | Protected Attributes
ZpzDom< IntType > Class Template Reference

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

#include <givzpzGen.h>

Public Types

enum  { size_rep = sizeof(Residu_t) }
typedef IntType Residu_t
 type to store residue
typedef IntType Rep
 Representation of Element of the domain ZpzDom.
typedef IntType Element
typedef Rep * Array
 Representation of vector of the Element.
typedef const Rep * constArray
 Representation of vector of the Element.

Public Member Functions

ZpzDom< IntType > & operator= (const ZpzDom< IntType > &F)
 Copy.
 ZpzDom ()
 Constructor.
 ZpzDom (Residu_t p)
 Constructor.
 ZpzDom (const ZpzDom< IntType > &F)
 Constructor.
int operator== (const ZpzDom< IntType > &BC) const
 (in)Equality
int operator!= (const ZpzDom< IntType > &BC) const
 (in)Equality
int areEqual (const Rep &a, const Rep &b) const
 (in)Equality
Residu_t residu () const
 Access to the modulus.
Residu_t size () const
 Access to the modulus.
Rep access (const Rep &a) const
 Access to the modulus.
Residu_t characteristic () const
 Access to the modulus.
Residu_t characteristic (Residu_t p) const
 Access to the modulus.
Residu_t cardinality () const
 Access to the modulus.
Rep & init (Rep &a) const
 Init a representation.
void init (const size_t, Array a, constArray b) const
 Init a representation.
Rep & init (Rep &r, const long int a) const
 Init a representation.
Rep & init (Rep &r, const unsigned long int a) const
 Init a representation.
Rep & init (Rep &a, const int i) const
 Init a representation.
Rep & init (Rep &a, const unsigned int i) const
 Init a representation.
Rep & init (Rep &a, const IntType &i) const
 Init a representation.
Rep & init (Rep &a, const double i) const
 Init a representation.
Rep & init (Rep &a, const float i) const
 Init a representation.
float & convert (float &r, const Rep &a) const
 Conversion.
double & convert (double &r, const Rep &a) const
 Conversion.
long int & convert (long int &r, const Rep &a) const
 Conversion.
unsigned long int & convert (unsigned long int &r, const Rep &a) const
 Conversion.
IntType & convert (IntType &i, const Rep &a) const
 Conversion.
int isZero (const Rep &a) const
 Misc methods.
int isOne (const Rep &a) const
 Misc methods.
size_t length (const Rep &a) const
 Misc methods.
Rep & mul (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & div (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & add (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & sub (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & neg (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & inv (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & mulin (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & divin (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & addin (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & subin (Rep &r, const Rep &a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & negin (Rep &r) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & invin (Rep &r) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void mul (const size_t sz, Array r, constArray a, constArray b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void mul (const size_t sz, Array r, constArray a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void div (const size_t sz, Array r, constArray a, constArray b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void div (const size_t sz, Array r, constArray a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void add (const size_t sz, Array r, constArray a, constArray b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void add (const size_t sz, Array r, constArray a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void sub (const size_t sz, Array r, constArray a, constArray b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void sub (const size_t sz, Array r, constArray a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void neg (const size_t sz, Array r, constArray a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void inv (const size_t sz, Array r, constArray a) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & axpy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void axpy (const size_t sz, Array r, constArray a, constArray x, constArray c) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & axpyin (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void axpyin (const size_t sz, Array r, constArray a, constArray x) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & axmy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void axmy (const size_t sz, Array r, constArray a, constArray x, constArray c) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & axmyin (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & maxpy (Rep &r, const Rep &a, const Rep &b, const Rep &c) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
Rep & maxpyin (Rep &r, const Rep &a, const Rep &b) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void maxpyin (const size_t sz, Array r, constArray a, constArray x) const
 Operations with reduction: r <- a op b mod p, r <- op a mod p.
void assign (const size_t sz, Array r, constArray a) const
 Misc: r <- a mod p.
Rep & assign (Rep &r, const Rep &a) const
 Misc: r <- a mod p.
Rep & assign (Rep &r, const long a) const
 Misc: r <- a mod p.
Rep & assign (Rep &r, const unsigned long a) const
 Misc: r <- a mod p.
Rep & assign (Rep &r, const short a) const
 Misc: r <- a mod p.
Rep & assign (Rep &r, const unsigned short a) const
 Misc: r <- a mod p.
Rep & reduceadd (Rep &r, const size_t sz, constArray a) const
 Misc.
Rep & reducemul (Rep &r, const size_t sz, constArray a) const
 Misc.
void i2d (const size_t sz, double *r, constArray a) const
 Misc.
void d2i (const size_t sz, Array r, const double *a) const
 Misc.
std::istream & read (std::istream &s)
 IO methods.
std::ostream & write (std::ostream &s) const
 IO methods.
std::istream & read (std::istream &s, Rep &a) const
 IO methods.
std::ostream & write (std::ostream &s, const Rep &a) const
 IO methods.

Data Fields

const Rep zero
 Constantes.
const Rep one
 1
const Rep mOne
 -1

Static Protected Member Functions

static void Init ()
static void End ()

Protected Attributes

Residu_t _p
 data representation of the domain:
typedef GIV_randIter< ZpzDom
< IntType >, Rep > 
randIter
 Random.
template<class RandIter >
Rep & random (RandIter &, Rep &r) const
 Random.
template<class RandIter >
Rep & random (RandIter &, Rep &r, long s) const
 Random.
template<class RandIter >
Rep & random (RandIter &, Rep &r, const Rep &b) const
 Random.
template<class RandIter >
Rep & nonzerorandom (RandIter &, Rep &r) const
 Random.
template<class RandIter >
Rep & nonzerorandom (RandIter &, Rep &r, long s) const
 Random.
template<class RandIter >
Rep & nonzerorandom (RandIter &, Rep &r, const Rep &b) const
 Random.

Detailed Description

template<typename IntType>
class Givaro::ZpzDom< IntType >

This class implement the standard arithmetic with Modulo Elements.


Member Typedef Documentation

typedef IntType Residu_t

type to store residue

typedef IntType Rep

Representation of Element of the domain ZpzDom.

typedef IntType Element
typedef Rep* Array

Representation of vector of the Element.

typedef const Rep* constArray

Representation of vector of the Element.

typedef GIV_randIter< ZpzDom<IntType> , Rep > randIter

Random.


Member Enumeration Documentation

anonymous enum
Enumerator:
size_rep 

Constructor & Destructor Documentation

ZpzDom ( )
inline

Constructor.

ZpzDom ( Residu_t  p)
inline

Constructor.

ZpzDom ( const ZpzDom< IntType > &  F)
inline

Constructor.


Member Function Documentation

ZpzDom<IntType>& operator= ( const ZpzDom< IntType > &  F)
inline

Copy.

int operator== ( const ZpzDom< IntType > &  BC) const
inline

(in)Equality

int operator!= ( const ZpzDom< IntType > &  BC) const
inline

(in)Equality

int areEqual ( const Rep &  a,
const Rep &  b 
) const
inline

(in)Equality

ZpzDom< IntType >::Residu_t residu ( ) const
inline

Access to the modulus.

Residu_t size ( ) const
inline

Access to the modulus.

Rep access ( const Rep &  a) const
inline

Access to the modulus.

Residu_t characteristic ( ) const
inline

Access to the modulus.

Residu_t characteristic ( Residu_t  p) const
inline

Access to the modulus.

Residu_t cardinality ( ) const
inline

Access to the modulus.

ZpzDom< IntType >::Rep & init ( Rep &  a) const
inline

Init a representation.

void init ( const size_t  sz,
Array  a,
constArray  b 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  r,
const long int  a 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  r,
const unsigned long int  a 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  a,
const int  i 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  a,
const unsigned int  i 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  a,
const IntType &  i 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  a,
const double  i 
) const
inline

Init a representation.

ZpzDom< IntType >::Rep & init ( Rep &  a,
const float  i 
) const
inline

Init a representation.

float& convert ( float &  r,
const Rep &  a 
) const
inline

Conversion.

double& convert ( double &  r,
const Rep &  a 
) const
inline

Conversion.

long int& convert ( long int &  r,
const Rep &  a 
) const
inline

Conversion.

unsigned long int& convert ( unsigned long int &  r,
const Rep &  a 
) const
inline

Conversion.

IntType& convert ( IntType &  i,
const Rep &  a 
) const
inline

Conversion.

int isZero ( const Rep &  a) const
inline

Misc methods.

int isOne ( const Rep &  a) const
inline

Misc methods.

size_t length ( const Rep &  a) const
inline

Misc methods.

ZpzDom< IntType >::Rep & mul ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & div ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & add ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & sub ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & neg ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & inv ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & mulin ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & divin ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & addin ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & subin ( Rep &  r,
const Rep &  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & negin ( Rep &  r) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & invin ( Rep &  r) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void mul ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void mul ( const size_t  sz,
Array  r,
constArray  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void div ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void div ( const size_t  sz,
Array  r,
constArray  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void add ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void add ( const size_t  sz,
Array  r,
constArray  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void sub ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void sub ( const size_t  sz,
Array  r,
constArray  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void neg ( const size_t  sz,
Array  r,
constArray  a 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void inv ( const size_t  sz,
Array  r,
constArray  a 
) const

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & axpy ( Rep &  r,
const Rep &  a,
const Rep &  b,
const Rep &  c 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void axpy ( const size_t  sz,
Array  r,
constArray  a,
constArray  x,
constArray  c 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & axpyin ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void axpyin ( const size_t  sz,
Array  r,
constArray  a,
constArray  x 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & axmy ( Rep &  r,
const Rep &  a,
const Rep &  b,
const Rep &  c 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void axmy ( const size_t  sz,
Array  r,
constArray  a,
constArray  x,
constArray  c 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & axmyin ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & maxpy ( Rep &  r,
const Rep &  a,
const Rep &  b,
const Rep &  c 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

ZpzDom< IntType >::Rep & maxpyin ( Rep &  r,
const Rep &  a,
const Rep &  b 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void maxpyin ( const size_t  sz,
Array  r,
constArray  a,
constArray  x 
) const
inline

Operations with reduction: r <- a op b mod p, r <- op a mod p.

void assign ( const size_t  sz,
Array  r,
constArray  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & assign ( Rep &  r,
const Rep &  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & assign ( Rep &  r,
const long  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & assign ( Rep &  r,
const unsigned long  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & assign ( Rep &  r,
const short  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & assign ( Rep &  r,
const unsigned short  a 
) const
inline

Misc: r <- a mod p.

ZpzDom< IntType >::Rep & random ( RandIter &  g,
Rep &  r 
) const
inline

Random.

ZpzDom< IntType >::Rep & random ( RandIter &  g,
Rep &  r,
long  s 
) const
inline

Random.

ZpzDom< IntType >::Rep & random ( RandIter &  g,
Rep &  r,
const Rep &  b 
) const
inline

Random.

ZpzDom< IntType >::Rep & nonzerorandom ( RandIter &  g,
Rep &  r 
) const
inline

Random.

ZpzDom< IntType >::Rep & nonzerorandom ( RandIter &  g,
Rep &  r,
long  s 
) const
inline

Random.

ZpzDom< IntType >::Rep & nonzerorandom ( RandIter &  g,
Rep &  r,
const Rep &  b 
) const
inline

Random.

Rep& reduceadd ( Rep &  r,
const size_t  sz,
constArray  a 
) const

Misc.

Rep& reducemul ( Rep &  r,
const size_t  sz,
constArray  a 
) const

Misc.

void i2d ( const size_t  sz,
double *  r,
constArray  a 
) const
inline

Misc.

void d2i ( const size_t  sz,
Array  r,
const double *  a 
) const
inline

Misc.

std::istream & read ( std::istream &  s)
inline

IO methods.

std::ostream & write ( std::ostream &  s) const
inline

IO methods.

std::istream & read ( std::istream &  s,
Rep &  a 
) const
inline

IO methods.

std::ostream & write ( std::ostream &  s,
const Rep &  a 
) const
inline

IO methods.

static void Init ( )
inlinestaticprotected

??

static void End ( )
inlinestaticprotected

??


Field Documentation

const Rep zero

Constantes.

0

const Rep one

1

const Rep mOne

-1

Residu_t _p
protected

data representation of the domain:


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