Givaro 4.2.1
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 >:

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
 
using ConstElement
 
using ConstElement_ptr
 
using is_elt_integral
 
using is_elt_floating_point
 

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>

  • The representation of an integer a in Zpz is the value a % p
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/ModularSquareRoot.C, examples/Integer/iexponentiation.C, examples/Polynomial/PolynomialCRT.C, and examples/Polynomial/interpolate.C.

Member Typedef Documentation

◆ Storage_t

template<typename IntType, typename _Compute_t, typename Enable>
using Storage_t = IntType

◆ Residu_t

template<typename IntType, typename _Compute_t, typename Enable>
using Residu_t = IntType

◆ Compute_t

template<typename IntType, typename _Compute_t, typename Enable>
using Compute_t = _Compute_t

◆ Self_t

template<typename IntType, typename _Compute_t, typename Enable>
using Self_t = Modular<Storage_t, Compute_t>

◆ Parent_t

template<typename IntType, typename _Compute_t, typename Enable>
using Parent_t = Modular_implem<Storage_t, Compute_t, Residu_t>

◆ Element

template<typename IntType, typename _Compute_t, typename Enable>
using Element = Storage_t

◆ RandIter

template<typename IntType, typename _Compute_t, typename Enable>
typedef ModularRandIter<Self_t> RandIter

◆ NonZeroRandIter

template<typename IntType, typename _Compute_t, typename Enable>
typedef GeneralRingNonZeroRandIter<Self_t> NonZeroRandIter

◆ Element_ptr

using Element_ptr
inherited

◆ ConstElement

using ConstElement
inherited

◆ ConstElement_ptr

using ConstElement_ptr
inherited

◆ is_elt_integral

using is_elt_integral
inherited

◆ is_elt_floating_point

using is_elt_floating_point
inherited

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited

Member Function Documentation

◆ init() [1/3]

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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]

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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]

template<typename IntType, typename _Compute_t, typename Enable>
template<typename T>
Element & init ( Element & r,
const T & a ) const
inline

◆ reduce() [1/2]

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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]

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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()

◆ div()

◆ add()

◆ sub()

◆ neg()

◆ inv()

◆ mulin()

template<typename IntType, typename COMP, typename Enable>
Modular< Storage_t, Compute_t, typenamestd::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()

◆ addin()

◆ subin()

◆ negin()

◆ invin()

◆ axpy()

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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()

◆ axmy()

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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()

◆ maxpy()

template<typename Storage_t, typename Compute_t>
Modular< Storage_t, Compute_t, typenamestd::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()

◆ type_string()

template<typename IntType, typename _Compute_t, typename Enable>
static const std::string type_string ( )
inlinestatic

◆ random()

template<typename IntType, typename _Compute_t, typename Enable>
template<class Random>
Element & random ( Random & g,
Element & r ) const
inline

◆ nonzerorandom()

template<typename IntType, typename _Compute_t, typename Enable>
template<class Random>
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

template<typename IntType, typename _Compute_t, typename Enable>
Residu_t _p

◆ _pc

template<typename IntType, typename _Compute_t, typename Enable>
Compute_t _pc

◆ zero

template<typename IntType, typename _Compute_t, typename Enable>
const Element zero

◆ one

template<typename IntType, typename _Compute_t, typename Enable>
const Element one

◆ mOne

template<typename IntType, typename _Compute_t, typename Enable>
const Element mOne

◆ is_elt_integral_v

bool is_elt_integral_v
staticconstexprinherited

◆ is_elt_floating_point_v

bool is_elt_floating_point_v
staticconstexprinherited

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