Givaro
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Protected Attributes
Modular< int16_t, COMP > Class Template Reference

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

#include <modular-int16.h>

+ Inheritance diagram for Modular< int16_t, COMP >:
+ Collaboration diagram for Modular< int16_t, COMP >:

Public Types

enum  { size_rep = sizeof(Residu_t) }
 
using Self_t = Modular< int16_t, COMP >
 
using Residu_t = uint16_t
 
using Compute_t = typename std::make_unsigned< COMP >::type
 
typedef ElementArray
 
typedef const ElementconstArray
 
typedef ModularRandIter< Self_tRandIter
 
typedef GeneralRingNonZeroRandIter< Self_tNonZeroRandIter
 
typedef int16_t Element
 
typedef ElementElement_ptr
 
typedef const Element ConstElement
 
typedef const ElementConstElement_ptr
 

Public Member Functions

 Modular ()
 
 Modular (const Residu_t p)
 
 Modular (const Self_t &F)
 
Element minElement () const override
 
Element maxElement () const override
 
Residu_t residu () const
 
Residu_t size () const
 
Residu_t characteristic () const
 
Residu_t cardinality () const
 
template<class T >
T & characteristic (T &p) const
 
template<class T >
T & cardinality (T &p) const
 
bool isZero (const Element &a) const override
 
bool isOne (const Element &a) const override
 
bool isMOne (const Element &a) const override
 
bool areEqual (const Element &a, const Element &b) const override
 
size_t length (const Element a) const
 
bool operator== (const Self_t &F) const
 
bool operator!= (const Self_t &F) const
 
Self_toperator= (const Self_t &F)
 
Elementinit (Element &x) const
 
Elementinit (Element &x, const float y) const
 
Elementinit (Element &x, const double y) const
 
Elementinit (Element &x, const int32_t y) const
 
Elementinit (Element &x, const uint32_t y) const
 
Elementinit (Element &x, const int64_t y) const
 
Elementinit (Element &x, const uint64_t y) const
 
Elementinit (Element &x, const Integer &y) const
 
template<typename T >
Elementinit (Element &r, const T &a) const
 
void init (const size_t, Array a, constArray b) const
 
Elementassign (Element &x, const Element &y) const
 
void assign (const size_t sz, Array r, constArray a) const
 
template<typename T >
T & convert (T &r, const Element &a) const
 
Elementreduce (Element &x, const Element &y) const
 
Elementreduce (Element &x) const
 
Elementmul (Element &r, const Element &a, const Element &b) const override
 
Elementdiv (Element &r, const Element &a, const Element &b) const override
 
Elementadd (Element &r, const Element &a, const Element &b) const override
 
Elementsub (Element &r, const Element &a, const Element &b) const override
 
Elementneg (Element &r, const Element &a) const override
 
Elementinv (Element &r, const Element &a) const override
 
Elementmulin (Element &r, const Element &a) const override
 
Elementdivin (Element &r, const Element &a) const override
 
Elementaddin (Element &r, const Element &a) const override
 
Elementsubin (Element &r, const Element &a) const override
 
Elementnegin (Element &r) const override
 
Elementinvin (Element &r) const override
 
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const override
 
Elementaxpyin (Element &r, const Element &a, const Element &x) const override
 
Elementaxmy (Element &r, const Element &a, const Element &x, const Element &y) const override
 
Elementaxmyin (Element &r, const Element &a, const Element &x) const override
 
Elementmaxpy (Element &r, const Element &a, const Element &x, const Element &y) const override
 
Elementmaxpyin (Element &r, const Element &a, const Element &x) const override
 
void mul (const size_t sz, Array r, constArray a, constArray b) const
 
void mul (const size_t sz, Array r, constArray a, Element b) const
 
void div (const size_t sz, Array r, constArray a, constArray b) const
 
void div (const size_t sz, Array r, constArray a, Element b) const
 
void add (const size_t sz, Array r, constArray a, constArray b) const
 
void add (const size_t sz, Array r, constArray a, Element b) const
 
void sub (const size_t sz, Array r, constArray a, constArray b) const
 
void sub (const size_t sz, Array r, constArray a, Element b) const
 
void neg (const size_t sz, Array r, constArray a) const
 
void inv (const size_t sz, Array r, constArray a) const
 
void axpy (const size_t sz, Array r, constArray a, constArray x, constArray c) const
 
void axpyin (const size_t sz, Array r, constArray a, constArray x) const
 
void axmy (const size_t sz, Array r, constArray a, constArray x, constArray c) const
 
void maxpyin (const size_t sz, Array r, constArray a, constArray x) const
 
Elementreduceadd (Element &r, const size_t sz, constArray a) const
 
Elementreducemul (Element &r, const size_t sz, constArray a) const
 
Elementdotprod (Element &r, const size_t sz, constArray a, constArray b) const
 
Elementdotprod (Element &r, const int bound, const size_t sz, constArray a, constArray b) const
 
void i2d (const size_t sz, double *r, constArray a) const
 
void d2i (const size_t sz, Array r, const double *a) const
 
template<class Random >
Elementrandom (const Random &g, Element &r) const
 
template<class Random >
Elementnonzerorandom (const Random &g, Element &a) const
 
std::istream & read (std::istream &s)
 
std::ostream & write (std::ostream &s) const
 
std::istream & read (std::istream &s, Element &a) const
 
std::ostream & write (std::ostream &s, const Element a) const
 

Static Public Member Functions

static Residu_t maxCardinality ()
 
static Residu_t minCardinality ()
 

Data Fields

const Element zero
 
const Element one
 
const Element mOne
 

Protected Attributes

Residu_t _p
 

Detailed Description

template<typename COMP>
class Givaro::Modular< int16_t, COMP >

This class implement the standard arithmetic with Modulo Elements.

Member Typedef Documentation

using Self_t = Modular<int16_t, COMP>
using Residu_t = uint16_t
using Compute_t = typename std::make_unsigned<COMP>::type
typedef Element* Array
typedef const Element* constArray
typedef int16_t Element
inherited
typedef Element* Element_ptr
inherited
typedef const Element ConstElement
inherited
typedef const Element* ConstElement_ptr
inherited

Member Enumeration Documentation

anonymous enum
Enumerator
size_rep 

Constructor & Destructor Documentation

Modular ( )
inline
Modular ( const Residu_t  p)
inline
Modular ( const Self_t F)
inline

Member Function Documentation

Element minElement ( ) const
inlineoverridevirtual
Element maxElement ( ) const
inlineoverridevirtual
Residu_t residu ( ) const
inline
Residu_t size ( ) const
inline
Residu_t characteristic ( ) const
inline
Residu_t cardinality ( ) const
inline
T& characteristic ( T &  p) const
inline
T& cardinality ( T &  p) const
inline
static Residu_t maxCardinality ( )
inlinestatic
static Residu_t minCardinality ( )
inlinestatic
bool isZero ( const Element a) const
inlineoverridevirtual
bool isOne ( const Element a) const
inlineoverridevirtual
bool isMOne ( const Element a) const
inlineoverridevirtual
bool areEqual ( const Element a,
const Element b 
) const
inlineoverridevirtual
size_t length ( const Element  a) const
inline
bool operator== ( const Self_t F) const
inline
bool operator!= ( const Self_t F) const
inline
Self_t& operator= ( const Self_t F)
inline
Modular< int16_t, COMP >::Element & init ( Element x) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const float  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const double  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const int32_t  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const uint32_t  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const int64_t  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const uint64_t  y 
) const
inline
Modular< int16_t, COMP >::Element & init ( Element x,
const Integer y 
) const
inline
Element& init ( Element r,
const T &  a 
) const
inline
void init ( const size_t  sz,
Array  a,
constArray  b 
) const
inline
Modular< int16_t, COMP >::Element & assign ( Element x,
const Element y 
) const
inline
void assign ( const size_t  sz,
Array  r,
constArray  a 
) const
inline
T& convert ( T &  r,
const Element a 
) const
inline
Modular< int16_t, COMP >::Element & reduce ( Element x,
const Element y 
) const
inline
Modular< int16_t, COMP >::Element & reduce ( Element x) const
inline
Modular< int16_t, COMP >::Element & mul ( Element r,
const Element a,
const Element b 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & div ( Element r,
const Element a,
const Element b 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & add ( Element r,
const Element a,
const Element b 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & sub ( Element r,
const Element a,
const Element b 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & neg ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & inv ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & mulin ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & divin ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & addin ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & subin ( Element r,
const Element a 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & negin ( Element r) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & invin ( Element r) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & axpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & axpyin ( Element r,
const Element a,
const Element x 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & axmy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & axmyin ( Element r,
const Element a,
const Element x 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & maxpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverridevirtual
Modular< int16_t, COMP >::Element & maxpyin ( Element r,
const Element a,
const Element x 
) const
inlineoverridevirtual
void mul ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline
void mul ( const size_t  sz,
Array  r,
constArray  a,
Element  b 
) const
inline
void div ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline
void div ( const size_t  sz,
Array  r,
constArray  a,
Element  b 
) const
inline
void add ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline
void add ( const size_t  sz,
Array  r,
constArray  a,
Element  b 
) const
inline
void sub ( const size_t  sz,
Array  r,
constArray  a,
constArray  b 
) const
inline
void sub ( const size_t  sz,
Array  r,
constArray  a,
Element  b 
) const
inline
void neg ( const size_t  sz,
Array  r,
constArray  a 
) const
inline
void inv ( const size_t  sz,
Array  r,
constArray  a 
) const
void axpy ( const size_t  sz,
Array  r,
constArray  a,
constArray  x,
constArray  c 
) const
inline
void axpyin ( const size_t  sz,
Array  r,
constArray  a,
constArray  x 
) const
inline
void axmy ( const size_t  sz,
Array  r,
constArray  a,
constArray  x,
constArray  c 
) const
inline
void maxpyin ( const size_t  sz,
Array  r,
constArray  a,
constArray  x 
) const
inline
Element& reduceadd ( Element r,
const size_t  sz,
constArray  a 
) const
Element& reducemul ( Element r,
const size_t  sz,
constArray  a 
) const
Modular< int16_t, COMP >::Element & dotprod ( Element r,
const size_t  sz,
constArray  a,
constArray  b 
) const
inline
Modular< int16_t, COMP >::Element & dotprod ( Element r,
const int  bound,
const size_t  sz,
constArray  a,
constArray  b 
) const
inline
void i2d ( const size_t  sz,
double *  r,
constArray  a 
) const
inline
void d2i ( const size_t  sz,
Array  r,
const double *  a 
) const
inline
Element& random ( const Random &  g,
Element r 
) const
inline
Element& nonzerorandom ( const Random &  g,
Element a 
) const
inline
std::istream & read ( std::istream &  s)
inline
std::ostream& write ( std::ostream &  s) const
std::istream & read ( std::istream &  s,
Element a 
) const
inline
std::ostream & write ( std::ostream &  s,
const Element  a 
) const
inline

Field Documentation

const Element zero
const Element one
const Element mOne
Residu_t _p
protected

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