Gudhi::persistence_fields::Z2_field_operators Class Reference

Class defining operators for the \( \mathbb{F}_2 \) field. More...

Public Types

using element_type = bool
 
using characteristic_type = unsigned int
 

Public Member Functions

 Z2_field_operators ()
 Default constructor.
 

Static Public Member Functions

static constexpr characteristic_type get_characteristic ()
 Returns the characteristic of the field, that is 2. More...
 
template<typename Integer_type , class = isInteger<Integer_type>>
static element_type get_value (Integer_type e)
 Returns the value of an integer in the field. That is the positive value of the integer modulo the current characteristic. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type add (Unsigned_integer_type e1, Unsigned_integer_type e2)
 Returns the sum of two elements in the field. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void add_inplace (Unsigned_integer_type &e1, Unsigned_integer_type e2)
 Stores in the first element the sum of two given elements in the field, that is (e1 + e2) % 2, such that the result is positive. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type substract (Unsigned_integer_type e1, Unsigned_integer_type e2)
 Returns the substraction in the field of the first element by the second element. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void substract_inplace_front (Unsigned_integer_type &e1, Unsigned_integer_type e2)
 Stores in the first element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void substract_inplace_back (Unsigned_integer_type e1, Unsigned_integer_type &e2)
 Stores in the second element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type multiply (Unsigned_integer_type e1, Unsigned_integer_type e2)
 Returns the multiplication of two elements in the field. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void multiply_inplace (Unsigned_integer_type &e1, Unsigned_integer_type e2)
 Stores in the first element the multiplication of two given elements in the field, that is (e1 * e2) % 2, such that the result is positive. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type multiply_and_add (Unsigned_integer_type e, Unsigned_integer_type m, Unsigned_integer_type a)
 Multiplies the first element with the second one and adds the third one. Returns the result in the field. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void multiply_and_add_inplace_front (Unsigned_integer_type &e, Unsigned_integer_type m, Unsigned_integer_type a)
 Multiplies the first element with the second one and adds the third one, that is (e * m + a) % 2, such that the result is positive. Stores the result in the first element. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void multiply_and_add_inplace_back (Unsigned_integer_type e, Unsigned_integer_type m, Unsigned_integer_type &a)
 Multiplies the first element with the second one and adds the third one, that is (e * m + a) % 2, such that the result is positive. Stores the result in the third element. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type add_and_multiply (Unsigned_integer_type e, Unsigned_integer_type a, Unsigned_integer_type m)
 Adds the first element to the second one and multiplies the third one with it. Returns the result in the field. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void add_and_multiply_inplace_front (Unsigned_integer_type &e, Unsigned_integer_type a, Unsigned_integer_type m)
 Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % 2, such that the result is positive. Stores the result in the first element. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void add_and_multiply_inplace_back (Unsigned_integer_type &e, Unsigned_integer_type a, Unsigned_integer_type m)
 Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % 2, such that the result is positive. Stores the result in the third element. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static bool are_equal (Unsigned_integer_type e1, Unsigned_integer_type e2)
 Returns true if the two given elements are equal in the field, false otherwise. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type get_inverse (Unsigned_integer_type e)
 Returns the inverse of the given element in the field. More...
 
template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static std::pair< element_type, characteristic_typeget_partial_inverse (Unsigned_integer_type e, characteristic_type productOfCharacteristics)
 For interface purposes with multi-fields. Returns the inverse together with the second argument. More...
 
static constexpr element_type get_additive_identity ()
 Returns the additive identity of the field. More...
 
static constexpr element_type get_multiplicative_identity ()
 Returns the multiplicative identity of the field. More...
 
static constexpr element_type get_partial_multiplicative_identity ([[maybe_unused]] characteristic_type productOfCharacteristics)
 For interface purposes with multi-fields. Returns the multiplicative identity of the field. More...
 

Detailed Description

Class defining operators for the \( \mathbb{F}_2 \) field.

Examples
example_field_operations.cpp.

Member Typedef Documentation

◆ characteristic_type

Type for the field characteristic.

◆ element_type

Type for the elements in the field.

Member Function Documentation

◆ add()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::add ( Unsigned_integer_type  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Returns the sum of two elements in the field.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.
Returns
(e1 + e2) % 2 as a boolean.

◆ add_and_multiply()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::add_and_multiply ( Unsigned_integer_type  e,
Unsigned_integer_type  a,
Unsigned_integer_type  m 
)
inlinestatic

Adds the first element to the second one and multiplies the third one with it. Returns the result in the field.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
aSecond element.
mThird element.
Returns
((e + a) * m) % 2 as a boolean.

◆ add_and_multiply_inplace_back()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::add_and_multiply_inplace_back ( Unsigned_integer_type &  e,
Unsigned_integer_type  a,
Unsigned_integer_type  m 
)
inlinestatic

Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % 2, such that the result is positive. Stores the result in the third element.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
aSecond element.
mThird element.

◆ add_and_multiply_inplace_front()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::add_and_multiply_inplace_front ( Unsigned_integer_type &  e,
Unsigned_integer_type  a,
Unsigned_integer_type  m 
)
inlinestatic

Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % 2, such that the result is positive. Stores the result in the first element.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
aSecond element.
mThird element.

◆ add_inplace()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::add_inplace ( Unsigned_integer_type &  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Stores in the first element the sum of two given elements in the field, that is (e1 + e2) % 2, such that the result is positive.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.

◆ are_equal()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static bool Gudhi::persistence_fields::Z2_field_operators::are_equal ( Unsigned_integer_type  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Returns true if the two given elements are equal in the field, false otherwise.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element to compare.
e2Second element to compare.
Returns
true If e1 % 2 == e2 % 2.
false Otherwise.

◆ get_additive_identity()

static constexpr element_type Gudhi::persistence_fields::Z2_field_operators::get_additive_identity ( )
inlinestaticconstexpr

Returns the additive identity of the field.

Returns
false.

◆ get_characteristic()

static constexpr characteristic_type Gudhi::persistence_fields::Z2_field_operators::get_characteristic ( )
inlinestaticconstexpr

Returns the characteristic of the field, that is 2.

Returns
2.

◆ get_inverse()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::get_inverse ( Unsigned_integer_type  e)
inlinestatic

Returns the inverse of the given element in the field.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eElement to get the inverse from.
Returns
Inverse in the current field of e % 2.

◆ get_multiplicative_identity()

static constexpr element_type Gudhi::persistence_fields::Z2_field_operators::get_multiplicative_identity ( )
inlinestaticconstexpr

Returns the multiplicative identity of the field.

Returns
true.

◆ get_partial_inverse()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static std::pair<element_type, characteristic_type> Gudhi::persistence_fields::Z2_field_operators::get_partial_inverse ( Unsigned_integer_type  e,
characteristic_type  productOfCharacteristics 
)
inlinestatic

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

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eElement to get the inverse from.
productOfCharacteristicsSome value.
Returns
Pair whose first element is the inverse of e and the second element is productOfCharacteristics.

◆ get_partial_multiplicative_identity()

static constexpr element_type Gudhi::persistence_fields::Z2_field_operators::get_partial_multiplicative_identity ( [[maybe_unused] ] characteristic_type  productOfCharacteristics)
inlinestaticconstexpr

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

Parameters
productOfCharacteristicsSome value.
Returns
true.

◆ get_value()

template<typename Integer_type , class = isInteger<Integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::get_value ( Integer_type  e)
inlinestatic

Returns the value of an integer in the field. That is the positive value of the integer modulo the current characteristic.

Template Parameters
Integer_typeA native integer type: int, unsigned int, long int, bool, etc.
Parameters
eInteger to return the value from.
Returns
A boolean representing e % 2.

◆ multiply()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::multiply ( Unsigned_integer_type  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Returns the multiplication of two elements in the field.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.
Returns
(e1 * e2) % 2 as a boolean.

◆ multiply_and_add()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::multiply_and_add ( Unsigned_integer_type  e,
Unsigned_integer_type  m,
Unsigned_integer_type  a 
)
inlinestatic

Multiplies the first element with the second one and adds the third one. Returns the result in the field.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
mSecond element.
aThird element.
Returns
(e * m + a) % 2 as a boolean.

◆ multiply_and_add_inplace_back()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::multiply_and_add_inplace_back ( Unsigned_integer_type  e,
Unsigned_integer_type  m,
Unsigned_integer_type &  a 
)
inlinestatic

Multiplies the first element with the second one and adds the third one, that is (e * m + a) % 2, such that the result is positive. Stores the result in the third element.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
mSecond element.
aThird element.

◆ multiply_and_add_inplace_front()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::multiply_and_add_inplace_front ( Unsigned_integer_type &  e,
Unsigned_integer_type  m,
Unsigned_integer_type  a 
)
inlinestatic

Multiplies the first element with the second one and adds the third one, that is (e * m + a) % 2, such that the result is positive. Stores the result in the first element.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
eFirst element.
mSecond element.
aThird element.

◆ multiply_inplace()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::multiply_inplace ( Unsigned_integer_type &  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Stores in the first element the multiplication of two given elements in the field, that is (e1 * e2) % 2, such that the result is positive.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.

◆ substract()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static element_type Gudhi::persistence_fields::Z2_field_operators::substract ( Unsigned_integer_type  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Returns the substraction in the field of the first element by the second element.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.
Returns
(e1 - e2) % 2 as a boolean.

◆ substract_inplace_back()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::substract_inplace_back ( Unsigned_integer_type  e1,
Unsigned_integer_type &  e2 
)
inlinestatic

Stores in the second element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.

◆ substract_inplace_front()

template<typename Unsigned_integer_type , class = isUnsignedInteger<Unsigned_integer_type>>
static void Gudhi::persistence_fields::Z2_field_operators::substract_inplace_front ( Unsigned_integer_type &  e1,
Unsigned_integer_type  e2 
)
inlinestatic

Stores in the first element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive.

Template Parameters
Unsigned_integer_typeA native unsigned integer type: unsigned int, bool, etc.
Parameters
e1First element.
e2Second element.

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