Gudhi::persistence_matrix::FieldOperators Class Reference

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

Public Types

using element_type = unspecified
 
using characteristic_type = unspecified
 

Public Member Functions

 FieldOperators (characteristic_type 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_type &characteristic)
 Sets the characteristic of the field. Can eventually be omitted if the characteristic of the class is fixed. More...
 
const characteristic_typeget_characteristic () const
 Returns the current characteristic. More...
 
template<typename Integer_type >
element_type 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_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) % characteristic, such that the result is positive. 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) % characteristic, such that the result is positive. 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) % characteristic, 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) % characteristic, such that the result is positive. Stores the result in the third element. More...
 
element_type get_inverse (const element_type &e) const
 Returns the inverse of the given element in the field. More...
 
FieldOperatorsoperator= (FieldOperators other)
 Assign operator.
 

Static Public Member Functions

static const element_typeget_additive_identity ()
 Returns the additive identity of the field. More...
 
static const element_typeget_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

Type for the field characteristic.

◆ element_type

Type for the elements in the field.

Constructor & Destructor Documentation

◆ FieldOperators()

Gudhi::persistence_matrix::FieldOperators::FieldOperators ( characteristic_type  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_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) % characteristic, such that the result is positive.

Parameters
e1First element.
e2Second element.

◆ get_additive_identity()

static const element_type& 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_type& Gudhi::persistence_matrix::FieldOperators::get_characteristic ( ) const

Returns the current characteristic.

Returns
The value of the current characteristic.

◆ get_inverse()

element_type Gudhi::persistence_matrix::FieldOperators::get_inverse ( const element_type 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_type& 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_type 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_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) % 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_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) % 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_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) % characteristic, such that the result is positive.

Parameters
e1First element.
e2Second element.

◆ set_characteristic()

void Gudhi::persistence_matrix::FieldOperators::set_characteristic ( const characteristic_type 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: