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

Forward declaration for Givaro::Modular. More...

#include <modular-inttype.h>

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

Public Types

enum  { size_rep = sizeof(Residu_t) }
 
typedef Modular< IntType > Self_t
 
typedef IntType Residu_t
 
using Element = typename FiniteFieldInterface< IntType >::Element
 
typedef ModularRandIter< Self_tRandIter
 
typedef GeneralRingNonZeroRandIter< Self_tNonZeroRandIter
 
typedef ElementElement_ptr
 
typedef const Element ConstElement
 
typedef const ElementConstElement_ptr
 

Public Member Functions

 ~Modular () noexcept
 
 Modular ()
 
 Modular (const Residu_t p)
 
template<class IntConvType >
 Modular (const IntConvType &p, const IntConvType &e=1)
 
 Modular (const Integer &p, const Integer &e=Integer::one)
 
 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 Integer &y) const
 
template<typename T >
Elementinit (Element &r, const T &a) const
 
Elementassign (Element &x, const Element &y) 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
 
template<class Random >
Elementrandom (const Random &g, Element &r) const
 
template<class Random >
Elementnonzerorandom (const Random &g, Element &a) const
 
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
 
template<>
Modular< int16_t, int16_t >::Residu_t maxCardinality ()
 
template<>
Modular< int16_t, uint16_t >::Residu_t maxCardinality ()
 
template<>
Modular< int16_t, uint32_t >::Residu_t maxCardinality ()
 
template<>
Modular< int16_t, int32_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< int32_t, int32_t >::Residu_t maxCardinality ()
 
template<>
Modular< int32_t, uint32_t >::Residu_t maxCardinality ()
 
template<>
Modular< int32_t, uint64_t >::Residu_t maxCardinality ()
 
template<>
Modular< int32_t, int64_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< int64_t, uint64_t >::Residu_t maxCardinality ()
 
template<>
Modular< int64_t, int64_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< int8_t, int8_t >::Residu_t maxCardinality ()
 
template<>
Modular< int8_t, uint8_t >::Residu_t maxCardinality ()
 
template<>
Modular< int8_t, uint16_t >::Residu_t maxCardinality ()
 
template<>
Modular< int8_t, int16_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< uint16_t, int16_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint16_t, uint16_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint16_t, uint32_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint16_t, int32_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< uint32_t, int32_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint32_t, uint32_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint32_t, uint64_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint32_t, int64_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
Modular< uint64_t, uint64_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint64_t, int64_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &os) const
 
template<>
std::ostream & write (std::ostream &os) const
 
template<>
Modular< uint8_t, int8_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint8_t, uint8_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint8_t, uint16_t >::Residu_t maxCardinality ()
 
template<>
Modular< uint8_t, int16_t >::Residu_t maxCardinality ()
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
template<>
std::ostream & write (std::ostream &s) const
 
virtual IntType & div (IntType &r, const IntType &a, const IntType &b) const =0
 
virtual IntType & inv (IntType &r, const IntType &a) const =0
 
virtual IntType & divin (IntType &r, const IntType &a) const =0
 
virtual IntType & invin (IntType &r) const =0
 
virtual bool isZero (const Element &a) const =0
 
virtual bool isOne (const Element &a) const =0
 
virtual bool isMOne (const Element &a) const =0
 
virtual bool areEqual (const Element &a, const Element &b) const =0
 
virtual Elementmul (Element &r, const Element &a, const Element &b) const =0
 
virtual Elementadd (Element &r, const Element &a, const Element &b) const =0
 
virtual Elementsub (Element &r, const Element &a, const Element &b) const =0
 
virtual Elementneg (Element &r, const Element &a) const =0
 
virtual Elementmulin (Element &r, const Element &a) const =0
 
virtual Elementaddin (Element &r, const Element &a) const =0
 
virtual Elementsubin (Element &r, const Element &a) const =0
 
virtual Elementnegin (Element &r) const =0
 
virtual Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const =0
 
virtual Elementaxpyin (Element &r, const Element &a, const Element &x) const =0
 
virtual Elementaxmy (Element &r, const Element &a, const Element &x, const Element &y) const =0
 
virtual Elementaxmyin (Element &r, const Element &a, const Element &x) const =0
 
virtual Elementmaxpy (Element &r, const Element &a, const Element &x, const Element &y) const =0
 
virtual Elementmaxpyin (Element &r, const Element &a, const Element &x) const =0
 

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 IntType, typename COMP>
class Givaro::Modular< IntType, COMP >

Forward declaration for Givaro::Modular.

This class implement the standard arithmetic with Modulo Elements.

Elements will be stored in the storage type. While arithmetics will occur on the unsigned version of COMP type. Example: Modular<int32_t, uint64_t>

Examples:
examples/FiniteField/all_field.C, examples/FiniteField/exponentiation.C, examples/FiniteField/ff_arith.C, examples/FiniteField/kronecker.C, examples/FiniteField/zpz_atomic.C, examples/Integer/iexponentiation.C, examples/Integer/ModularSquareRoot.C, examples/Polynomial/interpolate.C, and examples/Polynomial/PolynomialCRT.C.

Member Typedef Documentation

typedef Modular<IntType> Self_t
typedef IntType Residu_t
using Element = typename FiniteFieldInterface<IntType>::Element
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 ( )
inlinenoexcept
Modular ( )
inline
Modular ( const Residu_t  p)
inline
Modular ( const IntConvType &  p,
const IntConvType &  e = 1 
)
inline
Modular ( const Integer p,
const Integer e = Integer::one 
)
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
inlineoverride
bool isOne ( const Element a) const
inlineoverride
bool isMOne ( const Element a) const
inlineoverride
bool areEqual ( const Element a,
const Element b 
) const
inlineoverride
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< Integer >::Element & init ( Element x) const
inline
Modular< float >::Element & init ( Element x,
const Integer y 
) const
inline
Element& init ( Element r,
const T &  a 
) const
inline
Modular< Integer >::Element & assign ( Element x,
const Element y 
) const
inline
T& convert ( T &  r,
const Element a 
) const
inline
Modular< Integer >::Element & reduce ( Element x,
const Element y 
) const
inline
Modular< Integer >::Element & reduce ( Element x) const
inline
Modular< IntType, COMP >::Element & mul ( Element r,
const Element a,
const Element b 
) const
inlineoverride
Modular< IntType, COMP >::Element & div ( Element r,
const Element a,
const Element b 
) const
inlineoverride
Modular< IntType, COMP >::Element & add ( Element r,
const Element a,
const Element b 
) const
inlineoverride
Modular< IntType, COMP >::Element & sub ( Element r,
const Element a,
const Element b 
) const
inlineoverride
Modular< IntType, COMP >::Element & neg ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & inv ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & mulin ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & divin ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & addin ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & subin ( Element r,
const Element a 
) const
inlineoverride
Modular< IntType, COMP >::Element & negin ( Element r) const
inlineoverride
Modular< IntType, COMP >::Element & invin ( Element r) const
inlineoverride
Modular< IntType, COMP >::Element & axpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverride
Modular< IntType, COMP >::Element & axpyin ( Element r,
const Element a,
const Element x 
) const
inlineoverride
Modular< IntType, COMP >::Element & axmy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverride
Modular< IntType, COMP >::Element & axmyin ( Element r,
const Element a,
const Element x 
) const
inlineoverride
Modular< IntType, COMP >::Element & maxpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inlineoverride
Modular< IntType, COMP >::Element & maxpyin ( Element r,
const Element a,
const Element x 
) const
inlineoverride
Element& random ( const Random &  g,
Element r 
) const
inline
Element& nonzerorandom ( const Random &  g,
Element a 
) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::istream & read ( std::istream &  s,
Element a 
) const
inline
std::ostream & write ( std::ostream &  s,
const Element a 
) const
inline
Modular< int16_t, int16_t >::Residu_t maxCardinality ( )
inline
Modular< int16_t, uint16_t >::Residu_t maxCardinality ( )
inline
Modular< int16_t, uint32_t >::Residu_t maxCardinality ( )
inline
Modular< int16_t, int32_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< int32_t, int32_t >::Residu_t maxCardinality ( )
inline
Modular< int32_t, uint32_t >::Residu_t maxCardinality ( )
inline
Modular< int32_t, uint64_t >::Residu_t maxCardinality ( )
inline
Modular< int32_t, int64_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< int64_t, uint64_t >::Residu_t maxCardinality ( )
inline
Modular< int64_t, int64_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< int8_t, int8_t >::Residu_t maxCardinality ( )
inline
Modular< int8_t, uint8_t >::Residu_t maxCardinality ( )
inline
Modular< int8_t, uint16_t >::Residu_t maxCardinality ( )
inline
Modular< int8_t, int16_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< uint16_t, int16_t >::Residu_t maxCardinality ( )
inline
Modular< uint16_t, uint16_t >::Residu_t maxCardinality ( )
inline
Modular< uint16_t, uint32_t >::Residu_t maxCardinality ( )
inline
Modular< uint16_t, int32_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< uint32_t, int32_t >::Residu_t maxCardinality ( )
inline
Modular< uint32_t, uint32_t >::Residu_t maxCardinality ( )
inline
Modular< uint32_t, uint64_t >::Residu_t maxCardinality ( )
inline
Modular< uint32_t, int64_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
Modular< uint64_t, uint64_t >::Residu_t maxCardinality ( )
inline
Modular< uint64_t, int64_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  os) const
inline
std::ostream & write ( std::ostream &  os) const
inline
Modular< uint8_t, int8_t >::Residu_t maxCardinality ( )
inline
Modular< uint8_t, uint8_t >::Residu_t maxCardinality ( )
inline
Modular< uint8_t, uint16_t >::Residu_t maxCardinality ( )
inline
Modular< uint8_t, int16_t >::Residu_t maxCardinality ( )
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
std::ostream & write ( std::ostream &  s) const
inline
virtual IntType & div ( IntType &  r,
const IntType &  a,
const IntType &  b 
) const
pure virtualinherited
virtual IntType & inv ( IntType &  r,
const IntType &  a 
) const
pure virtualinherited
virtual IntType & divin ( IntType &  r,
const IntType &  a 
) const
pure virtualinherited
virtual IntType & invin ( IntType &  r) const
pure virtualinherited
virtual bool isZero ( const Element a) const
pure virtualinherited
virtual bool isOne ( const Element a) const
pure virtualinherited
virtual bool isMOne ( const Element a) const
pure virtualinherited
virtual bool areEqual ( const Element a,
const Element b 
) const
pure virtualinherited
virtual Element& mul ( Element r,
const Element a,
const Element b 
) const
pure virtualinherited
virtual Element& add ( Element r,
const Element a,
const Element b 
) const
pure virtualinherited
virtual Element& sub ( Element r,
const Element a,
const Element b 
) const
pure virtualinherited
virtual Element& neg ( Element r,
const Element a 
) const
pure virtualinherited
virtual Element& mulin ( Element r,
const Element a 
) const
pure virtualinherited
virtual Element& addin ( Element r,
const Element a 
) const
pure virtualinherited
virtual Element& subin ( Element r,
const Element a 
) const
pure virtualinherited
virtual Element& negin ( Element r) const
pure virtualinherited
virtual Element& axpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
pure virtualinherited
virtual Element& axpyin ( Element r,
const Element a,
const Element x 
) const
pure virtualinherited
virtual Element& axmy ( Element r,
const Element a,
const Element x,
const Element y 
) const
pure virtualinherited
virtual Element& axmyin ( Element r,
const Element a,
const Element x 
) const
pure virtualinherited
virtual Element& maxpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
pure virtualinherited
virtual Element& maxpyin ( Element r,
const Element a,
const Element x 
) const
pure virtualinherited

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: