Gudhi::persistence_fields::Multi_field_operators Class Reference

Class defining operators for a multi-field with "consecutive" charateristic range. More...

Public Types

using element_type = mpz_class
 
using characteristic_type = element_type
 

Public Member Functions

 Multi_field_operators ()
 Default constructor, sets the product of all characteristics to 0.
 
 Multi_field_operators (int minCharacteristic, int maxCharacteristic)
 Constructor setting the characteristics to all prime numbers between the two given integers. More...
 
 Multi_field_operators (const Multi_field_operators &toCopy)
 Copy constructor. More...
 
 Multi_field_operators (Multi_field_operators &&toMove) noexcept
 Move constructor. More...
 
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. More...
 
const characteristic_typeget_characteristic () const
 Returns the current characteristics as the product of all of them. More...
 
element_type get_value (element_type e) const
 Returns the value of an element in the field. That is the positive value of the integer modulo the current characteristic. More...
 
void get_value_inplace (element_type &e) const
 Stores in the given element the value of this element in the field. That is the positive value of the integer modulo the current characteristic. More...
 
element_type add (element_type e1, const element_type &e2) const
 Returns the sum of two elements in the field. More...
 
void add_inplace (element_type &e1, const element_type &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. More...
 
element_type substract (element_type e1, const element_type &e2) const
 Returns the substraction in the field of the first element by the second element. More...
 
void substract_inplace_front (element_type &e1, const element_type &e2) const
 Stores in the first element the substraction in the field of the first element by the second element, that is (e1 - e2) % productOfAllCharacteristics, such that the result is positive. More...
 
void substract_inplace_back (const element_type &e1, element_type &e2) const
 Stores in the second element the substraction in the field of the first element by the second element, that is (e1 - e2) % productOfAllCharacteristics, such that the result is positive. More...
 
element_type multiply (element_type e1, const element_type &e2) const
 Returns the multiplication of two elements in the field. More...
 
void multiply_inplace (element_type &e1, const element_type &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. More...
 
element_type multiply_and_add (element_type e, const element_type &m, const element_type &a) const
 Multiplies the first element with the second one and adds the third one. Returns the result in the field. More...
 
void multiply_and_add_inplace_front (element_type &e, const element_type &m, const element_type &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. More...
 
void multiply_and_add_inplace_back (const element_type &e, const element_type &m, element_type &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. More...
 
element_type add_and_multiply (element_type e, const element_type &a, const element_type &m) const
 Adds the first element to the second one and multiplies the third one with it. Returns the result in the field. More...
 
void add_and_multiply_inplace_front (element_type &e, const element_type &a, const element_type &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. More...
 
void add_and_multiply_inplace_back (const element_type &e, const element_type &a, element_type &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. More...
 
bool are_equal (const element_type &e1, const element_type &e2) const
 Returns true if the two given elements are equal in the field, false otherwise. More...
 
element_type get_inverse (const element_type &e) const
 Returns the inverse of the given element in the sense of [6] with respect to the product of all characteristics. More...
 
std::pair< element_type, characteristic_typeget_partial_inverse (const element_type &e, const characteristic_type &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 [6] for more details. More...
 
element_type get_partial_multiplicative_identity (const characteristic_type &productOfCharacteristics) const
 Returns the partial multiplicative identity of the multi-field from the given product. See [6] for more details. More...
 
Multi_field_operatorsoperator= (Multi_field_operators other)
 Assign operator.
 

Static Public Member Functions

static const element_typeget_additive_identity ()
 Returns the additive identity of a field. More...
 
static const element_typeget_multiplicative_identity ()
 Returns the multiplicative identity of a field. More...
 

Friends

void swap (Multi_field_operators &f1, Multi_field_operators &f2)
 Swap operator.
 

Detailed Description

Class defining operators for a multi-field with "consecutive" charateristic range.

Member Typedef Documentation

◆ characteristic_type

◆ element_type

Type for the elements in the field.

Constructor & Destructor Documentation

◆ Multi_field_operators() [1/3]

Gudhi::persistence_fields::Multi_field_operators::Multi_field_operators ( int  minCharacteristic,
int  maxCharacteristic 
)
inline

Constructor setting the characteristics to all prime numbers between the two given integers.

Parameters
minCharacteristicSmallest value of a prime.
maxCharacteristicHeighest value of a prime.

◆ Multi_field_operators() [2/3]

Gudhi::persistence_fields::Multi_field_operators::Multi_field_operators ( const Multi_field_operators toCopy)
inline

Copy constructor.

Parameters
toCopyOperators to copy.

◆ Multi_field_operators() [3/3]

Gudhi::persistence_fields::Multi_field_operators::Multi_field_operators ( Multi_field_operators &&  toMove)
inlinenoexcept

Move constructor.

Parameters
toMoveOperators to move.

Member Function Documentation

◆ add()

element_type Gudhi::persistence_fields::Multi_field_operators::add ( element_type  e1,
const element_type e2 
) const
inline

Returns the sum of two elements in the field.

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

◆ add_and_multiply()

element_type Gudhi::persistence_fields::Multi_field_operators::add_and_multiply ( element_type  e,
const element_type a,
const element_type m 
) const
inline

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

Parameters
eFirst element.
aSecond element.
mThird element.
Returns
((e + a) * m) % productOfAllCharacteristics, such that the result is positive.

◆ add_and_multiply_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators::add_and_multiply_inplace_back ( const element_type e,
const element_type a,
element_type 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.

Parameters
eFirst element.
aSecond element.
mThird element.

◆ add_and_multiply_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators::add_and_multiply_inplace_front ( element_type e,
const element_type a,
const element_type 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.

Parameters
eFirst element.
aSecond element.
mThird element.

◆ add_inplace()

void Gudhi::persistence_fields::Multi_field_operators::add_inplace ( element_type e1,
const element_type 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
e1First element.
e2Second element.

◆ are_equal()

bool Gudhi::persistence_fields::Multi_field_operators::are_equal ( const element_type e1,
const element_type e2 
) const
inline

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

Parameters
e1First element to compare.
e2Second element to compare.
Returns
true If e1 % productOfAllCharacteristics == e2 % productOfAllCharacteristics.
false Otherwise.

◆ get_additive_identity()

static const element_type& Gudhi::persistence_fields::Multi_field_operators::get_additive_identity ( )
inlinestatic

Returns the additive identity of a field.

Returns
The additive identity of a field.

◆ get_characteristic()

const characteristic_type& Gudhi::persistence_fields::Multi_field_operators::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_type Gudhi::persistence_fields::Multi_field_operators::get_inverse ( const element_type e) const
inline

Returns the inverse of the given element in the sense of [6] with respect to the product of all characteristics.

Parameters
eElement to get the inverse from.
Returns
Inverse in the current field.

◆ get_multiplicative_identity()

static const element_type& Gudhi::persistence_fields::Multi_field_operators::get_multiplicative_identity ( )
inlinestatic

Returns the multiplicative identity of a field.

Returns
The multiplicative identity of a field.

◆ get_partial_inverse()

std::pair<element_type, characteristic_type> Gudhi::persistence_fields::Multi_field_operators::get_partial_inverse ( const element_type e,
const characteristic_type 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 [6] for more details.

Parameters
eElement to get the inverse from.
productOfCharacteristicsProduct 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_type Gudhi::persistence_fields::Multi_field_operators::get_partial_multiplicative_identity ( const characteristic_type productOfCharacteristics) const
inline

Returns the partial multiplicative identity of the multi-field from the given product. See [6] for more details.

Parameters
productOfCharacteristicsProduct of the different characteristics to take into account in the multi-field.
Returns
The partial multiplicative identity of the multi-field.

◆ get_value()

element_type Gudhi::persistence_fields::Multi_field_operators::get_value ( element_type  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
eElement to return the value from.
Returns
e modulo the current characteristic, such that the result is positive.

◆ get_value_inplace()

void Gudhi::persistence_fields::Multi_field_operators::get_value_inplace ( element_type e) const
inline

Stores in the given element the value of this element in the field. That is the positive value of the integer modulo the current characteristic.

Parameters
eElement to return the value from.

◆ multiply()

element_type Gudhi::persistence_fields::Multi_field_operators::multiply ( element_type  e1,
const element_type e2 
) const
inline

Returns the multiplication of two elements in the field.

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

◆ multiply_and_add()

element_type Gudhi::persistence_fields::Multi_field_operators::multiply_and_add ( element_type  e,
const element_type m,
const element_type a 
) const
inline

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

Parameters
eFirst element.
mSecond element.
aThird element.
Returns
(e * m + a) % productOfAllCharacteristics, such that the result is positive.

◆ multiply_and_add_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators::multiply_and_add_inplace_back ( const element_type e,
const element_type m,
element_type 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.

Parameters
eFirst element.
mSecond element.
aThird element.

◆ multiply_and_add_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators::multiply_and_add_inplace_front ( element_type e,
const element_type m,
const element_type 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.

Parameters
eFirst element.
mSecond element.
aThird element.

◆ multiply_inplace()

void Gudhi::persistence_fields::Multi_field_operators::multiply_inplace ( element_type e1,
const element_type 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
e1First element.
e2Second element.

◆ set_characteristic()

void Gudhi::persistence_fields::Multi_field_operators::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.

Parameters
minimumSmallest value of a prime.
maximumHeighest value of a prime.

◆ substract()

element_type Gudhi::persistence_fields::Multi_field_operators::substract ( element_type  e1,
const element_type e2 
) const
inline

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

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

◆ substract_inplace_back()

void Gudhi::persistence_fields::Multi_field_operators::substract_inplace_back ( const element_type e1,
element_type e2 
) const
inline

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

Parameters
e1First element.
e2Second element.

◆ substract_inplace_front()

void Gudhi::persistence_fields::Multi_field_operators::substract_inplace_front ( element_type e1,
const element_type e2 
) const
inline

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

Parameters
e1First element.
e2Second element.

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