Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class > Class Template Reference

Class representing an element of the \( \mathbb{F}_p \) field for any prime number \( p \). More...

Public Types

using element_type = Unsigned_integer_type
 
using characteristic_type = element_type
 

Public Member Functions

 Zp_field_element ()
 Default constructor. Sets the element to 0.
 
template<typename Integer_type , class = isInteger<Integer_type>>
 Zp_field_element (Integer_type element)
 Constructor setting the element to the given value. More...
 
 Zp_field_element (const Zp_field_element &toCopy)
 Copy constructor. More...
 
 Zp_field_element (Zp_field_element &&toMove) noexcept
 Move constructor. More...
 
Zp_field_elementoperator= (Zp_field_element other)
 Assign operator.
 
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_elementoperator= (const Integer_type &value)
 Assign operator. More...
 
 operator unsigned int () const
 Casts the element into an unsigned int.
 
Zp_field_element get_inverse () const
 Returns the inverse of the element in the field. More...
 
std::pair< Zp_field_element, unsigned int > get_partial_inverse (unsigned int productOfCharacteristics) const
 For interface purposes with multi-fields. Returns the inverse together with the argument. More...
 
element_type get_value () const
 Returns the value of the element. More...
 

Static Public Member Functions

static Zp_field_element get_additive_identity ()
 Returns the additive identity of the field. More...
 
static Zp_field_element get_multiplicative_identity ()
 Returns the multiplicative identity of the field. More...
 
static Zp_field_element get_partial_multiplicative_identity ([[maybe_unused]] unsigned int productOfCharacteristics)
 For interface purposes with multi-fields. Returns the multiplicative identity of the field. More...
 
static constexpr unsigned int get_characteristic ()
 Returns the current characteristic. More...
 

Friends

void operator+= (Zp_field_element &f1, const Zp_field_element &f2)
 operator+=
 
Zp_field_element operator+ (Zp_field_element f1, const Zp_field_element &f2)
 operator+
 
template<typename Integer_type , class = isInteger<Integer_type>>
void operator+= (Zp_field_element &f, const Integer_type &v)
 operator+=
 
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator+ (Zp_field_element f, const Integer_type &v)
 operator+ More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator+ (const Integer_type &v, Zp_field_element f)
 operator+ More...
 
void operator-= (Zp_field_element &f1, const Zp_field_element &f2)
 operator-=
 
Zp_field_element operator- (Zp_field_element f1, const Zp_field_element &f2)
 operator-
 
template<typename Integer_type , class = isInteger<Integer_type>>
void operator-= (Zp_field_element &f, const Integer_type &v)
 operator-=
 
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator- (Zp_field_element f, const Integer_type &v)
 operator- More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator- (const Integer_type &v, const Zp_field_element &f)
 operator- More...
 
void operator*= (Zp_field_element &f1, const Zp_field_element &f2)
 operator*=
 
Zp_field_element operator* (Zp_field_element f1, const Zp_field_element &f2)
 operator*
 
template<typename Integer_type , class = isInteger<Integer_type>>
void operator*= (Zp_field_element &f, const Integer_type &v)
 operator*=
 
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator* (Zp_field_element f, const Integer_type &v)
 operator* More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator* (const Integer_type &v, Zp_field_element f)
 operator* More...
 
bool operator== (const Zp_field_element &f1, const Zp_field_element &f2)
 operator==
 
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator== (const Integer_type &v, const Zp_field_element &f)
 operator== More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator== (const Zp_field_element &f, const Integer_type &v)
 operator== More...
 
bool operator!= (const Zp_field_element &f1, const Zp_field_element &f2)
 operator!=
 
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator!= (const Integer_type &v, const Zp_field_element &f)
 operator!= More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator!= (const Zp_field_element &f, const Integer_type &v)
 operator!= More...
 
void swap (Zp_field_element &f1, Zp_field_element &f2)
 Swap operator.
 

Detailed Description

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
class Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >

Class representing an element of the \( \mathbb{F}_p \) field for any prime number \( p \).

Template Parameters
characteristicValue of the characteristic of the field. Has to be a positive prime number.
Unsigned_integer_typeA native unsigned integer type: unsigned int, long unsigned int, etc. Will be used as the field element type.
Examples
example_field_operations.cpp.

Member Typedef Documentation

◆ characteristic_type

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
using Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::characteristic_type = element_type

Type for the field characteristic.

◆ element_type

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
using Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::element_type = Unsigned_integer_type

Type for the elements in the field.

Constructor & Destructor Documentation

◆ Zp_field_element() [1/3]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::Zp_field_element ( Integer_type  element)
inline

Constructor setting the element to the given value.

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.
Parameters
elementValue of the element.

◆ Zp_field_element() [2/3]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::Zp_field_element ( const Zp_field_element< characteristic, Unsigned_integer_type, class > &  toCopy)
inline

Copy constructor.

Parameters
toCopyElement to copy.

◆ Zp_field_element() [3/3]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::Zp_field_element ( Zp_field_element< characteristic, Unsigned_integer_type, class > &&  toMove)
inlinenoexcept

Move constructor.

Parameters
toMoveElement to move.

Member Function Documentation

◆ get_additive_identity()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
static Zp_field_element Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_additive_identity ( )
inlinestatic

Returns the additive identity of the field.

Returns
0.

◆ get_characteristic()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
static constexpr unsigned int Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_characteristic ( )
inlinestaticconstexpr

Returns the current characteristic.

Returns
The value of the current characteristic.

◆ get_inverse()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
Zp_field_element Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_inverse ( ) const
inline

Returns the inverse of the element in the field.

Returns
The inverse.

◆ get_multiplicative_identity()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
static Zp_field_element Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_multiplicative_identity ( )
inlinestatic

Returns the multiplicative identity of the field.

Returns
1.

◆ get_partial_inverse()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
std::pair<Zp_field_element, unsigned int> Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_partial_inverse ( unsigned int  productOfCharacteristics) const
inline

For interface purposes with multi-fields. Returns the inverse together with the argument.

Parameters
productOfCharacteristicsSome value.
Returns
Pair whose first element is the inverse and the second element is productOfCharacteristics.

◆ get_partial_multiplicative_identity()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
static Zp_field_element Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_partial_multiplicative_identity ( [[maybe_unused] ] unsigned int  productOfCharacteristics)
inlinestatic

For interface purposes with multi-fields. Returns the multiplicative identity of the field.

Parameters
productOfCharacteristicsSome value.
Returns
1.

◆ get_value()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
element_type Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::get_value ( ) const
inline

Returns the value of the element.

Returns
Value of the element.

◆ operator=()

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element& Gudhi::persistence_fields::Zp_field_element< characteristic, Unsigned_integer_type, class >::operator= ( const Integer_type &  value)
inline

Assign operator.

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

Friends And Related Function Documentation

◆ operator!= [1/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator!= ( const Integer_type &  v,
const Zp_field_element< characteristic, Unsigned_integer_type, class > &  f 
)
friend

operator!=

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator!= [2/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator!= ( const Zp_field_element< characteristic, Unsigned_integer_type, class > &  f,
const Integer_type &  v 
)
friend

operator!=

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator* [1/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator* ( const Integer_type &  v,
Zp_field_element< characteristic, Unsigned_integer_type, class >  f 
)
friend

operator*

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator* [2/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator* ( Zp_field_element< characteristic, Unsigned_integer_type, class >  f,
const Integer_type &  v 
)
friend

operator*

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator+ [1/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator+ ( const Integer_type &  v,
Zp_field_element< characteristic, Unsigned_integer_type, class >  f 
)
friend

operator+

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator+ [2/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator+ ( Zp_field_element< characteristic, Unsigned_integer_type, class >  f,
const Integer_type &  v 
)
friend

operator+

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator- [1/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Integer_type operator- ( const Integer_type &  v,
const Zp_field_element< characteristic, Unsigned_integer_type, class > &  f 
)
friend

operator-

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator- [2/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
Zp_field_element operator- ( Zp_field_element< characteristic, Unsigned_integer_type, class >  f,
const Integer_type &  v 
)
friend

operator-

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator== [1/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator== ( const Integer_type &  v,
const Zp_field_element< characteristic, Unsigned_integer_type, class > &  f 
)
friend

operator==

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

◆ operator== [2/2]

template<unsigned int characteristic, typename Unsigned_integer_type = unsigned int, class = std::enable_if_t<std::is_unsigned_v<Unsigned_integer_type> >>
template<typename Integer_type , class = isInteger<Integer_type>>
bool operator== ( const Zp_field_element< characteristic, Unsigned_integer_type, class > &  f,
const Integer_type &  v 
)
friend

operator==

Template Parameters
Integer_typeA native integer type. Should be able to contain the characteristic if signed.

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