Givaro
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes
Modular< IntType, _Compute_t, Enable > Class Template Reference

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

#include <modular-inttype.h>

+ Inheritance diagram for Modular< IntType, _Compute_t, Enable >:
+ Collaboration diagram for Modular< IntType, _Compute_t, Enable >:

Public Types

using Storage_t = IntType
 
using Residu_t = IntType
 
using Compute_t = _Compute_t
 
using Self_t = Modular< Storage_t, Compute_t >
 
using Parent_t = Modular_implem< Storage_t, Compute_t, Residu_t >
 
using Element = Storage_t
 
typedef ModularRandIter< Self_tRandIter
 
typedef GeneralRingNonZeroRandIter< Self_tNonZeroRandIter
 
enum  
 
using Element_ptr = Element *
 
using ConstElement = const Element
 
using ConstElement_ptr = const Element *
 
using is_elt_integral = std::is_integral< Element >
 
using is_elt_floating_point = std::is_floating_point< Element >
 

Public Member Functions

Elementinit (Element &x) const
 
Elementinit (Element &x, const Integer &y) const final
 
template<typename T >
Elementinit (Element &r, const T &a) const
 
Elementreduce (Element &x, const Element &y) const
 
Elementreduce (Element &x) const
 
Elementmul (Element &r, const Element &a, const Element &b) const
 
Elementdiv (Element &r, const Element &a, const Element &b) const
 
Elementadd (Element &r, const Element &a, const Element &b) const
 
Elementsub (Element &r, const Element &a, const Element &b) const
 
Elementneg (Element &r, const Element &a) const
 
Elementinv (Element &r, const Element &a) const
 
Elementmulin (Element &r, const Element &a) const
 
Elementdivin (Element &r, const Element &a) const
 
Elementaddin (Element &r, const Element &a) const
 
Elementsubin (Element &r, const Element &a) const
 
Elementnegin (Element &r) const
 
Elementinvin (Element &r) const
 
Elementaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
 
Elementaxpyin (Element &r, const Element &a, const Element &x) const
 
Elementaxmy (Element &r, const Element &a, const Element &x, const Element &y) const
 
Elementaxmyin (Element &r, const Element &a, const Element &x) const
 
Elementmaxpy (Element &r, const Element &a, const Element &x, const Element &y) const
 
Elementmaxpyin (Element &r, const Element &a, const Element &x) const
 
template<class Random >
Elementrandom (Random &g, Element &r) const
 
template<class Random >
Elementnonzerorandom (Random &g, Element &a) const
 
Element minElement () const
 
Element maxElement () const
 
Residu_t residu () const
 
Residu_t size () const
 
Residu_t characteristic () const
 
T & characteristic (T &p) const
 
Residu_t cardinality () const
 
T & cardinality (T &p) const
 
bool isZero (const Element &a) const
 
bool isOne (const Element &a) const
 
bool isMOne (const Element &a) const
 
bool areEqual (const Element &a, const Element &b) const
 
bool isUnit (const Element &a) const
 
size_t length (const Element a) const
 
bool operator== (const Self_t &F) const
 
bool operator!= (const Self_t &F) const
 
Elementassign (Element &x, const Element &y) const
 
T & convert (T &r, const Element &a) const
 
std::ostream & write (std::ostream &s, const Element &a) const
 
std::ostream & write (std::ostream &s, const E &a) const
 
std::ostream & write (std::ostream &s, const E &a) const
 
std::ostream & write (std::ostream &s, const E &a) const
 
std::ostream & write (std::ostream &s) const
 
std::ostream & write (std::ostream &s) const
 
std::ostream & write (std::ostream &s) const
 
std::istream & read (std::istream &s)
 
std::istream & read (std::istream &, Element &) const
 

Static Public Member Functions

static const std::string type_string ()
 
static Residu_t minCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 
static Residu_t maxCardinality ()
 

Data Fields

Residu_t _p
 
Compute_t _pc
 
const Element zero
 
const Element one
 
const Element mOne
 

Static Public Attributes

static constexpr bool is_elt_integral_v
 
static constexpr bool is_elt_floating_point_v
 

Detailed Description

template<typename IntType, typename _Compute_t, typename Enable>
class Givaro::Modular< IntType, _Compute_t, Enable >

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>

Member Typedef Documentation

◆ Storage_t

using Storage_t = IntType

◆ Residu_t

using Residu_t = IntType

◆ Compute_t

using Compute_t = _Compute_t

◆ Self_t

◆ Parent_t

◆ Element

using Element = Storage_t

◆ RandIter

◆ NonZeroRandIter

◆ Element_ptr

using Element_ptr = Element*
inherited

◆ ConstElement

using ConstElement = const Element
inherited

◆ ConstElement_ptr

using ConstElement_ptr = const Element*
inherited

◆ is_elt_integral

using is_elt_integral = std::is_integral<Element>
inherited

◆ is_elt_floating_point

using is_elt_floating_point = std::is_floating_point<Element>
inherited

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited

Member Function Documentation

◆ init() [1/3]

Modular< Storage_t, Compute_t, typename std::enable_if< std::is_integral< Storage_t >::value &&std::is_integral< Compute_t >::value &&(sizeof(Storage_t)==sizeof(Compute_t)||2 *sizeof(Storage_t)==sizeof(Compute_t))>::type >::Element & init ( Element x) const
inline

◆ init() [2/3]

Modular< Storage_t, Compute_t, typename std::enable_if< std::is_integral< Storage_t >::value &&std::is_integral< Compute_t >::value &&(sizeof(Storage_t)==sizeof(Compute_t)||2 *sizeof(Storage_t)==sizeof(Compute_t))>::type >::Element & init ( Element x,
const Integer y 
) const
inlinefinalvirtual

◆ init() [3/3]

Element& init ( Element r,
const T &  a 
) const
inline

◆ reduce() [1/2]

Modular< Storage_t, Compute_t, typename std::enable_if< std::is_integral< Storage_t >::value &&std::is_integral< Compute_t >::value &&(sizeof(Storage_t)==sizeof(Compute_t)||2 *sizeof(Storage_t)==sizeof(Compute_t))>::type >::Element & reduce ( Element x,
const Element y 
) const
inline

◆ reduce() [2/2]

Modular< Storage_t, Compute_t, typename std::enable_if< std::is_integral< Storage_t >::value &&std::is_integral< Compute_t >::value &&(sizeof(Storage_t)==sizeof(Compute_t)||2 *sizeof(Storage_t)==sizeof(Compute_t))>::type >::Element & reduce ( Element x) const
inline

◆ mul()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & mul ( Element r,
const Element a,
const Element b 
) const
inline

◆ div()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & div ( Element r,
const Element a,
const Element b 
) const
inline

◆ add()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & add ( Element r,
const Element a,
const Element b 
) const
inline

◆ sub()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & sub ( Element r,
const Element a,
const Element b 
) const
inline

◆ neg()

◆ inv()

◆ mulin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & mulin ( Element r,
const Element a 
) const
inline

◆ divin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & divin ( Element r,
const Element a 
) const
inline

◆ addin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & addin ( Element r,
const Element a 
) const
inline

◆ subin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & subin ( Element r,
const Element a 
) const
inline

◆ negin()

◆ invin()

◆ axpy()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & axpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inline

◆ axpyin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & axpyin ( Element r,
const Element a,
const Element x 
) const
inline

◆ axmy()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & axmy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inline

◆ axmyin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & axmyin ( Element r,
const Element a,
const Element x 
) const
inline

◆ maxpy()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & maxpy ( Element r,
const Element a,
const Element x,
const Element y 
) const
inline

◆ maxpyin()

Modular< Storage_t, Compute_t, typename std::enable_if< is_same_ruint< Storage_t, Compute_t >::value||is_smaller_ruint< Storage_t, Compute_t >::value||is_same_rint< Storage_t, Compute_t >::value||is_smaller_rint< Storage_t, Compute_t >::value >::type >::Element & maxpyin ( Element r,
const Element a,
const Element x 
) const
inline

◆ type_string()

static const std::string type_string ( )
inlinestatic

◆ random()

Element& random ( Random &  g,
Element r 
) const
inline

◆ nonzerorandom()

Element& nonzerorandom ( Random &  g,
Element a 
) const
inline

◆ minElement()

Element minElement ( ) const
inlineinherited

◆ maxElement()

Element maxElement ( ) const
inlineinherited

◆ residu()

Residu_t residu ( ) const
inlineinherited

◆ size()

Residu_t size ( ) const
inlineinherited

◆ characteristic() [1/2]

Residu_t characteristic ( ) const
inlineinherited

◆ characteristic() [2/2]

T& characteristic ( T &  p) const
inlineinherited

◆ cardinality() [1/2]

Residu_t cardinality ( ) const
inlineinherited

◆ cardinality() [2/2]

T& cardinality ( T &  p) const
inlineinherited

◆ minCardinality()

static Residu_t minCardinality ( )
inlinestaticinherited

◆ maxCardinality() [1/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [2/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [3/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [4/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [5/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [6/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [7/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [8/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [9/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [10/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [11/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [12/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ maxCardinality() [13/13]

static Residu_t maxCardinality ( )
inlinestaticinherited

◆ isZero()

bool isZero ( const Element a) const
inlineinherited

◆ isOne()

bool isOne ( const Element a) const
inlineinherited

◆ isMOne()

bool isMOne ( const Element a) const
inlineinherited

◆ areEqual()

bool areEqual ( const Element a,
const Element b 
) const
inlineinherited

◆ isUnit()

bool isUnit ( const Element a) const
inlineinherited

◆ length()

size_t length ( const Element  a) const
inlineinherited

◆ operator==()

bool operator== ( const Self_t F) const
inlineinherited

◆ operator!=()

bool operator!= ( const Self_t F) const
inlineinherited

◆ assign()

Element& assign ( Element x,
const Element y 
) const
inlineinherited

◆ convert()

T& convert ( T &  r,
const Element a 
) const
inlineinherited

◆ write() [1/7]

std::ostream& write ( std::ostream &  s,
const Element a 
) const
inlineinherited

◆ write() [2/7]

std::ostream& write ( std::ostream &  s,
const E &  a 
) const
inlineinherited

◆ write() [3/7]

std::ostream& write ( std::ostream &  s,
const E &  a 
) const
inlineinherited

◆ write() [4/7]

std::ostream& write ( std::ostream &  s,
const E &  a 
) const
inlineinherited

◆ write() [5/7]

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

◆ write() [6/7]

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

◆ write() [7/7]

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

◆ read() [1/2]

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

◆ read() [2/2]

std::istream & read ( std::istream &  s,
Element a 
) const
inlineinherited

Field Documentation

◆ _p

◆ _pc

Compute_t _pc

◆ zero

const Element zero

◆ one

const Element one

◆ mOne

const Element mOne

◆ is_elt_integral_v

constexpr bool is_elt_integral_v
staticconstexprinherited

◆ is_elt_floating_point_v

constexpr bool is_elt_floating_point_v
staticconstexprinherited

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