Loading...
Searching...
No Matches
Z2_field_operators Class Reference

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

`#include <gudhi/Fields/Z2_field_operators.h>`

## Public Types

using | Element = bool
using | Characteristic = unsigned int

## Public Member Functions

| Z2_field_operators ()
| Default constructor.

## Static Public Member Functions

static constexpr Characteristic | get_characteristic ()
| Returns the characteristic of the field, that is 2.
template<typename Integer_type, class = isInteger<Integer_type>>
static Element | 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.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | add (Unsigned_integer_type e1, Unsigned_integer_type e2)
| Returns the sum of two elements in the field.
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.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | subtract (Unsigned_integer_type e1, Unsigned_integer_type e2)
| Returns the subtraction in the field of the first element by the second element.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static void | subtract_inplace_front (Unsigned_integer_type &e1, Unsigned_integer_type e2)
| Stores in the first element the subtraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static void | subtract_inplace_back (Unsigned_integer_type e1, Unsigned_integer_type &e2)
| Stores in the second element the subtraction in the field of the first element by the second element, that is (e1 - e2) % 2, such that the result is positive.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | multiply (Unsigned_integer_type e1, Unsigned_integer_type e2)
| Returns the multiplication of two elements in the field.
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.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | 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.
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.
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.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | 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.
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.
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.
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.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static Element | get_inverse (Unsigned_integer_type e)
| Returns the inverse of the given element in the field.
template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>
static std::pair< Element, Characteristic > | get_partial_inverse (Unsigned_integer_type e, Characteristic productOfCharacteristics)
| For interface purposes with multi-fields. Returns the inverse together with the second argument.
static constexpr Element | get_additive_identity ()
| Returns the additive identity of the field.
static constexpr Element | get_multiplicative_identity ()
| Returns the multiplicative identity of the field.
static constexpr Element | get_partial_multiplicative_identity (Characteristic productOfCharacteristics)
| For interface purposes with multi-fields. Returns the multiplicative identity of the field.

## Detailed Description

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

Examples
  example_field_operations.cpp.

## Member Typedef Documentation

## Characteristic

using Gudhi::persistence_fields::Z2_field_operators::Characteristic = unsigned int

Type for the field characteristic.

## Element

using Gudhi::persistence_fields::Z2_field_operators::Element = bool

Type for the elements in the field.

## Member Function Documentation

## add()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::add | ( | Unsigned_integer_type | e1,
|  | Unsigned_integer_type | e2 )

inline static

Returns the sum of two elements in the field.

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 + e2) % 2 as a boolean.

## add_and_multiply()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::add_and_multiply | ( | Unsigned_integer_type | e,
|  | Unsigned_integer_type | a,
|  | Unsigned_integer_type | m )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  a | Second element.
  m | Third element.

Returns
  ((e + a) * m) % 2 as a boolean.

## add_and_multiply_inplace_back()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::add_and_multiply_inplace_back | ( | Unsigned_integer_type & | e,
|  | Unsigned_integer_type | a,
|  | Unsigned_integer_type | m )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  a | Second element.
  m | Third element.

## add_and_multiply_inplace_front()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::add_and_multiply_inplace_front | ( | Unsigned_integer_type & | e,
|  | Unsigned_integer_type | a,
|  | Unsigned_integer_type | m )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  a | Second element.
  m | Third element.

## add_inplace()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::add_inplace | ( | Unsigned_integer_type & | e1,
|  | Unsigned_integer_type | e2 )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

## are_equal()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

bool Gudhi::persistence_fields::Z2_field_operators::are_equal | ( | Unsigned_integer_type | e1,
|  | Unsigned_integer_type | e2 )

inline static

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

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element to compare.
  e2 | Second element to compare.

Returns
  true If e1 % 2 == e2 % 2.
  false Otherwise.

## get_additive_identity()

constexpr Element Gudhi::persistence_fields::Z2_field_operators::get_additive_identity | ( |  | ) |

inline static constexpr

Returns the additive identity of the field.

Returns
  false.

## get_characteristic()

constexpr Characteristic Gudhi::persistence_fields::Z2_field_operators::get_characteristic | ( |  | ) |

inline static constexpr

Returns the characteristic of the field, that is 2.

Returns
  2.

## get_inverse()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::get_inverse | ( | Unsigned_integer_type | e | ) |

inline static

Returns the inverse of the given element in the field.

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | Element to get the inverse from.

Returns
  Inverse in the current field of e % 2.

## get_multiplicative_identity()

constexpr Element Gudhi::persistence_fields::Z2_field_operators::get_multiplicative_identity | ( |  | ) |

inline static constexpr

Returns the multiplicative identity of the field.

Returns
  true.

## get_partial_inverse()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

std::pair< Element, Characteristic > Gudhi::persistence_fields::Z2_field_operators::get_partial_inverse | ( | Unsigned_integer_type | e,
|  | Characteristic | productOfCharacteristics )

inline static

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

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | Element to get the inverse from.
  productOfCharacteristics | Some value.

Returns
  Pair whose first element is the inverse of `e` and the second element is `productOfCharacteristics`.

## get_partial_multiplicative_identity()

constexpr Element Gudhi::persistence_fields::Z2_field_operators::get_partial_multiplicative_identity | ( | Characteristic | productOfCharacteristics | ) |

inline static constexpr

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

Parameters

  productOfCharacteristics | Some value.

Returns
  true.

## get_value()

template<typename Integer_type, class = isInteger<Integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::get_value | ( | Integer_type | e | ) |

inline static

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

Template Parameters

  Integer_type | A native integer type: int, unsigned int, long int, bool, etc.

Parameters

  e | Integer to return the value from.

Returns
  A boolean representing e % 2.

## multiply()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::multiply | ( | Unsigned_integer_type | e1,
|  | Unsigned_integer_type | e2 )

inline static

Returns the multiplication of two elements in the field.

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 * e2) % 2 as a boolean.

## multiply_and_add()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::multiply_and_add | ( | Unsigned_integer_type | e,
|  | Unsigned_integer_type | m,
|  | Unsigned_integer_type | a )

inline static

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

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  m | Second element.
  a | Third element.

Returns
  (e * m + a) % 2 as a boolean.

## multiply_and_add_inplace_back()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::multiply_and_add_inplace_back | ( | Unsigned_integer_type | e,
|  | Unsigned_integer_type | m,
|  | Unsigned_integer_type & | a )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  m | Second element.
  a | Third element.

## multiply_and_add_inplace_front()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::multiply_and_add_inplace_front | ( | Unsigned_integer_type & | e,
|  | Unsigned_integer_type | m,
|  | Unsigned_integer_type | a )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e | First element.
  m | Second element.
  a | Third element.

## multiply_inplace()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::multiply_inplace | ( | Unsigned_integer_type & | e1,
|  | Unsigned_integer_type | e2 )

inline static

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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

## subtract()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

Element Gudhi::persistence_fields::Z2_field_operators::subtract | ( | Unsigned_integer_type | e1,
|  | Unsigned_integer_type | e2 )

inline static

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

Template Parameters

  Unsigned_integer_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 - e2) % 2 as a boolean.

## subtract_inplace_back()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::subtract_inplace_back | ( | Unsigned_integer_type | e1,
|  | Unsigned_integer_type & | e2 )

inline static

Stores in the second element the subtraction 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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

## subtract_inplace_front()

template<typename Unsigned_integer_type, class = isUnsignedInteger<Unsigned_integer_type>>

void Gudhi::persistence_fields::Z2_field_operators::subtract_inplace_front | ( | Unsigned_integer_type & | e1,
|  | Unsigned_integer_type | e2 )

inline static

Stores in the first element the subtraction 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_type | A native unsigned integer type: unsigned int, bool, etc.

Parameters

  e1 | First element.
  e2 | Second element.

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

- include/gudhi/Fields/Z2_field_operators.h