Loading...
Searching...
No Matches
Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics Class Reference
Persistence Fields

Class defining operators for a multi-field with "consecutive" characteristic range, such that productOfAllCharacteristics ^ 2 fits into an unsigned int. More...

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

## Public Types

using | Element = unsigned int
using | Characteristic = Element

## Public Member Functions

| Multi_field_operators_with_small_characteristics ()
| Default constructor, sets the product of all characteristics to 0.
| Multi_field_operators_with_small_characteristics (int minCharacteristic, int maxCharacteristic)
| Constructor setting the characteristics to all prime numbers between the two given integers. The product of all primes to the square has to fit into an unsigned int.
| Multi_field_operators_with_small_characteristics (const Multi_field_operators_with_small_characteristics &toCopy)
| Copy constructor.
| Multi_field_operators_with_small_characteristics (Multi_field_operators_with_small_characteristics &&toMove) noexcept
| Move constructor.
void | set_characteristic (int minimum, int maximum)
| Set the characteristics of the field, which are stored in a single value as a product of all of them. The characteristics will be all prime numbers in the given interval. The product of all primes to the square has to fit into an unsigned int.
const Characteristic & | get_characteristic () const
| Returns the current characteristics as the product of all of them.
Element | get_value (Element e) const
| Returns the value of an element in the field. That is the positive value of the integer modulo the current characteristic.
Element | add (Element e1, Element e2) const
| Returns the sum of two elements in the field.
void | add_inplace (Element &e1, Element e2) const
| Stores in the first element the sum of two given elements in the field, that is (e1 + e2) % productOfAllCharacteristics, such that the result is positive.
Element | subtract (Element e1, Element e2) const
| Returns the subtraction in the field of the first element by the second element.
void | subtract_inplace_front (Element &e1, Element e2) const
| Stores in the first element the subtraction in the field of the first element by the second element, that is (e1 - e2) % productOfAllCharacteristics, such that the result is positive.
void | subtract_inplace_back (Element e1, Element &e2) const
| Stores in the second element the subtraction in the field of the first element by the second element, that is (e1 - e2) % productOfAllCharacteristics, such that the result is positive.
Element | multiply (Element e1, Element e2) const
| Returns the multiplication of two elements in the field.
void | multiply_inplace (Element &e1, Element e2) const
| Stores in the first element the multiplication of two given elements in the field, that is (e1 * e2) % productOfAllCharacteristics, such that the result is positive.
Element | multiply_and_add (Element e, Element m, Element a) const
| Multiplies the first element with the second one and adds the third one. Returns the result in the field.
void | multiply_and_add_inplace_front (Element &e, Element m, Element a) const
| Multiplies the first element with the second one and adds the third one, that is (e * m + a) % productOfAllCharacteristics, such that the result is positive. Stores the result in the first element.
void | multiply_and_add_inplace_back (Element e, Element m, Element &a) const
| Multiplies the first element with the second one and adds the third one, that is (e * m + a) % productOfAllCharacteristics, such that the result is positive. Stores the result in the third element.
Element | add_and_multiply (Element e, Element a, Element m) const
| Adds the first element to the second one and multiplies the third one with it. Returns the result in the field.
void | add_and_multiply_inplace_front (Element &e, Element a, Element m) const
| Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % productOfAllCharacteristics, such that the result is positive. Stores the result in the first element.
void | add_and_multiply_inplace_back (Element e, Element a, Element &m) const
| Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % productOfAllCharacteristics, such that the result is positive. Stores the result in the third element.
bool | are_equal (Element e1, Element e2) const
| Returns true if the two given elements are equal in the field, false otherwise.
Element | get_inverse (const Element &e) const
| Returns the inverse of the given element in the sense of [boissonnat:hal-00922572] with respect to the product of all characteristics.
std::pair< Element, Characteristic > | get_partial_inverse (const Element &e, const Characteristic &productOfCharacteristics) const
| Returns the inverse of the given element in the multi-field corresponding to the given sub-product of the product of all characteristics in the multi-field. See [boissonnat:hal-00922572] for more details.
Element | get_partial_multiplicative_identity (const Characteristic &productOfCharacteristics) const
| Returns the partial multiplicative identity of the multi-field from the given product. See [boissonnat:hal-00922572] for more details.
Multi_field_operators_with_small_characteristics & | operator= (Multi_field_operators_with_small_characteristics other)
| Assign operator.

## Static Public Member Functions

static constexpr Element | get_additive_identity ()
| Returns the additive identity of a field.
static constexpr Element | get_multiplicative_identity ()
| Returns the multiplicative identity of a field.

## Friends

void | swap (Multi_field_operators_with_small_characteristics &f1, Multi_field_operators_with_small_characteristics &f2)
| Swap operator.

## Detailed Description

Class defining operators for a multi-field with "consecutive" characteristic range, such that productOfAllCharacteristics ^ 2 fits into an unsigned int.

## Member Typedef Documentation

## Characteristic

using Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::Characteristic = Element

Type for the field characteristic.

## Element

using Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::Element = unsigned int

Type for the elements in the field.

## Constructor & Destructor Documentation

## Multi_field_operators_with_small_characteristics() [1/3]

Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::Multi_field_operators_with_small_characteristics | ( | int | minCharacteristic,
|  | int | maxCharacteristic )

inline

Constructor setting the characteristics to all prime numbers between the two given integers. The product of all primes to the square has to fit into an unsigned int.

Parameters

  minCharacteristic | Smallest value of a prime.
  maxCharacteristic | Highest value of a prime.

## Multi_field_operators_with_small_characteristics() [2/3]

Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::Multi_field_operators_with_small_characteristics | ( | const Multi_field_operators_with_small_characteristics & | toCopy | ) |

inline

Copy constructor.

Parameters

  toCopy | Operators to copy.

## Multi_field_operators_with_small_characteristics() [3/3]

Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::Multi_field_operators_with_small_characteristics | ( | Multi_field_operators_with_small_characteristics && | toMove | ) |

inline noexcept

Move constructor.

Parameters

  toMove | Operators to move.

## Member Function Documentation

## add()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::add | ( | Element | e1,
|  | Element | e2 ) const

inline

Returns the sum of two elements in the field.

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 + e2) % productOfAllCharacteristics, such that the result is positive.

## add_and_multiply()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::add_and_multiply | ( | Element | e,
|  | Element | a,
|  | Element | m ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

Returns
  ((e + a) * m) % productOfAllCharacteristics, such that the result is positive.

## add_and_multiply_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::add_and_multiply_inplace_back | ( | Element | e,
|  | Element | a,
|  | Element & | m ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

## add_and_multiply_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::add_and_multiply_inplace_front | ( | Element & | e,
|  | Element | a,
|  | Element | m ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

## add_inplace()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::add_inplace | ( | Element & | e1,
|  | Element | e2 ) const

inline

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

Parameters

  e1 | First element.
  e2 | Second element.

## are_equal()

bool Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::are_equal | ( | Element | e1,
|  | Element | e2 ) const

inline

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

Parameters

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

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

## get_additive_identity()

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

inline static constexpr

Returns the additive identity of a field.

Returns
  The additive identity of a field.

## get_characteristic()

const Characteristic & Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::get_characteristic | ( |  | ) | const

inline

Returns the current characteristics as the product of all of them.

Returns
  The value of the current characteristic.

## get_inverse()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::get_inverse | ( | const Element & | e | ) | const

inline

Returns the inverse of the given element in the sense of [boissonnat:hal-00922572] with respect to the product of all characteristics.

Parameters

  e | Element to get the inverse from.

Returns
  Inverse in the current field.

## get_multiplicative_identity()

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

inline static constexpr

Returns the multiplicative identity of a field.

Returns
  The multiplicative identity of a field.

## get_partial_inverse()

std::pair< Element, Characteristic > Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::get_partial_inverse | ( | const Element & | e,
|  | const Characteristic & | productOfCharacteristics ) const

inline

Returns the inverse of the given element in the multi-field corresponding to the given sub-product of the product of all characteristics in the multi-field. See [boissonnat:hal-00922572] for more details.

Parameters

  e | Element to get the inverse from.
  productOfCharacteristics | Product of the different characteristics to take into account in the multi-field.

Returns
  Pair of the inverse of `e` and the characteristic the inverse is coming from.

## get_partial_multiplicative_identity()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::get_partial_multiplicative_identity | ( | const Characteristic & | productOfCharacteristics | ) | const

inline

Returns the partial multiplicative identity of the multi-field from the given product. See [boissonnat:hal-00922572] for more details.

Parameters

  productOfCharacteristics | Product of the different characteristics to take into account in the multi-field.

Returns
  The partial multiplicative identity of the multi-field.

## get_value()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::get_value | ( | Element | e | ) | const

inline

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

Parameters

  e | Integer to return the value from.

Returns
  `e` modulo the current characteristic, such that the result is positive.

## multiply()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::multiply | ( | Element | e1,
|  | Element | e2 ) const

inline

Returns the multiplication of two elements in the field.

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 * e2) % productOfAllCharacteristics, such that the result is positive.

## multiply_and_add()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::multiply_and_add | ( | Element | e,
|  | Element | m,
|  | Element | a ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

Returns
  (e * m + a) % productOfAllCharacteristics, such that the result is positive.

## multiply_and_add_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::multiply_and_add_inplace_back | ( | Element | e,
|  | Element | m,
|  | Element & | a ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

## multiply_and_add_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::multiply_and_add_inplace_front | ( | Element & | e,
|  | Element | m,
|  | Element | a ) const

inline

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

Warning
  Not overflow safe.

Parameters

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

## multiply_inplace()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::multiply_inplace | ( | Element & | e1,
|  | Element | e2 ) const

inline

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

Parameters

  e1 | First element.
  e2 | Second element.

## set_characteristic()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::set_characteristic | ( | int | minimum,
|  | int | maximum )

inline

Set the characteristics of the field, which are stored in a single value as a product of all of them. The characteristics will be all prime numbers in the given interval. The product of all primes to the square has to fit into an unsigned int.

Parameters

  minimum | Smallest value of a prime.
  maximum | Highest value of a prime.

## subtract()

Element Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::subtract | ( | Element | e1,
|  | Element | e2 ) const

inline

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

Parameters

  e1 | First element.
  e2 | Second element.

Returns
  (e1 - e2) % productOfAllCharacteristics, such that the result is positive.

## subtract_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::subtract_inplace_back | ( | Element | e1,
|  | Element & | e2 ) const

inline

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

Parameters

  e1 | First element.
  e2 | Second element.

## subtract_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators_with_small_characteristics::subtract_inplace_front | ( | Element & | e1,
|  | Element | e2 ) const

inline

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

Parameters

  e1 | First element.
  e2 | Second element.

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

- include/gudhi/Fields/Multi_field_small_operators.h