Gudhi::persistence_matrix::FieldOperators Class Reference

Concept of the field operator classes needed for the class Matrix. More...

#include <concept/Persistence_matrix/FieldOperators.h>

Public Types

using Element = unspecified
 
using Characteristic = unspecified
 

Public Member Functions

 FieldOperators (Characteristic characteristic=0)
 Default constructor. If a non-zero characteristic is given, initializes the field with it. The characteristic can later be changed again or initialized with set_characteristic. More...
 
void set_characteristic (const Characteristic &characteristic)
 Sets the characteristic of the field. Can eventually be omitted if the characteristic of the class is fixed. More...
 
const Characteristicget_characteristic () const
 Returns the current characteristic. More...
 
template<typename Integer_type >
Element get_value (Integer_type e) const
 Returns the value of an integer in the field. That is the positive value of the integer modulo the current characteristic. More...
 
void add_inplace (Element &e1, const Element &e2) const
 Stores in the first element the sum of two given elements in the field, that is (e1 + e2) % characteristic, such that the result is positive. More...
 
void multiply_inplace (Element &e1, const Element &e2) const
 Stores in the first element the multiplication of two given elements in the field, that is (e1 * e2) % characteristic, such that the result is positive. More...
 
void multiply_and_add_inplace_front (Element &e, const Element &m, const Element &a) const
 Multiplies the first element with the second one and adds the third one, that is (e * m + a) % characteristic, such that the result is positive. Stores the result in the first element. More...
 
void multiply_and_add_inplace_back (const Element &e, const Element &m, Element &a) const
 Multiplies the first element with the second one and adds the third one, that is (e * m + a) % characteristic, such that the result is positive. Stores the result in the third element. More...
 
Element get_inverse (const Element &e) const
 Returns the inverse of the given element in the field. More...
 
FieldOperatorsoperator= (FieldOperators other)
 Assign operator.
 

Static Public Member Functions

static const Elementget_additive_identity ()
 Returns the additive identity of the field. More...
 
static const Elementget_multiplicative_identity ()
 Returns the multiplicative identity of the field. More...
 

Friends

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

Detailed Description

Member Typedef Documentation

◆ Characteristic

Type for the field characteristic.

◆ Element

Type for the elements in the field.

Constructor & Destructor Documentation

◆ FieldOperators()

Gudhi::persistence_matrix::FieldOperators::FieldOperators ( Characteristic  characteristic = 0)

Default constructor. If a non-zero characteristic is given, initializes the field with it. The characteristic can later be changed again or initialized with set_characteristic.

Parameters
characteristicPrime number corresponding to the desired characteristic of the field.

Member Function Documentation

◆ add_inplace()

void Gudhi::persistence_matrix::FieldOperators::add_inplace ( Element e1,
const Element e2 
) const

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

Parameters
e1First element.
e2Second element.

◆ get_additive_identity()

static const Element & Gudhi::persistence_matrix::FieldOperators::get_additive_identity ( )
static

Returns the additive identity of the field.

Returns
The additive identity of the field.

◆ get_characteristic()

const Characteristic & Gudhi::persistence_matrix::FieldOperators::get_characteristic ( ) const

Returns the current characteristic.

Returns
The value of the current characteristic.

◆ get_inverse()

Element Gudhi::persistence_matrix::FieldOperators::get_inverse ( const Element e) const

Returns the inverse of the given element in the field.

Parameters
eElement to get the inverse from.
Returns
Inverse in the current field of e % characteristic.

◆ get_multiplicative_identity()

static const Element & Gudhi::persistence_matrix::FieldOperators::get_multiplicative_identity ( )
static

Returns the multiplicative identity of the field.

Returns
The multiplicative identity of the field.

◆ get_value()

template<typename Integer_type >
Element Gudhi::persistence_matrix::FieldOperators::get_value ( Integer_type  e) const

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
e modulo the current characteristic, such that the result is positive.

◆ multiply_and_add_inplace_back()

void Gudhi::persistence_matrix::FieldOperators::multiply_and_add_inplace_back ( const Element e,
const Element m,
Element a 
) const

Multiplies the first element with the second one and adds the third one, that is (e * m + a) % characteristic, 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_matrix::FieldOperators::multiply_and_add_inplace_front ( Element e,
const Element m,
const Element a 
) const

Multiplies the first element with the second one and adds the third one, that is (e * m + a) % characteristic, 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_matrix::FieldOperators::multiply_inplace ( Element e1,
const Element e2 
) const

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

Parameters
e1First element.
e2Second element.

◆ set_characteristic()

void Gudhi::persistence_matrix::FieldOperators::set_characteristic ( const Characteristic characteristic)

Sets the characteristic of the field. Can eventually be omitted if the characteristic of the class is fixed.

Parameters
characteristicPrime number corresponding to the desired characteristic of the field.

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