Class defining operators for the \( \mathbb{F}_p \) field for any prime number \( p \). More...
Public Types | |
using | element_type = Unsigned_integer_type |
using | characteristic_type = element_type |
Public Member Functions | |
Zp_field_operators (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... | |
Zp_field_operators (const Zp_field_operators &toCopy) | |
Copy constructor. More... | |
Zp_field_operators (Zp_field_operators &&toMove) noexcept | |
Move constructor. More... | |
void | set_characteristic (characteristic_type characteristic) |
Sets the characteristic of the field. More... | |
const characteristic_type & | get_characteristic () const |
Returns the current characteristic. More... | |
element_type | get_value (element_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... | |
template<typename Signed_integer_type , class = isSignedInteger<Signed_integer_type>> | |
element_type | get_value (Signed_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... | |
element_type | add (element_type e1, element_type e2) const |
Returns the sum of two elements in the field. More... | |
void | add_inplace (element_type &e1, 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... | |
element_type | substract (element_type e1, 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, 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) % 2 , such that the result is positive. More... | |
void | substract_inplace_back (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) % 2 , such that the result is positive. More... | |
element_type | multiply (element_type e1, element_type e2) const |
Returns the multiplication of two elements in the field. More... | |
void | multiply_inplace (element_type &e1, 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... | |
element_type | multiply_and_add (element_type e, element_type m, 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, 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 first element. More... | |
void | multiply_and_add_inplace_back (element_type e, 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 | add_and_multiply (element_type e, element_type a, 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, 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) % characteristic , such that the result is positive. Stores the result in the first element. More... | |
void | add_and_multiply_inplace_back (element_type e, 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) % characteristic , such that the result is positive. Stores the result in the third element. More... | |
bool | are_equal (element_type e1, element_type e2) const |
Returns true if the two given elements are equal in the field, false otherwise. More... | |
element_type | get_inverse (element_type e) const |
Returns the inverse of the given element in the field. More... | |
std::pair< element_type, characteristic_type > | get_partial_inverse (element_type e, characteristic_type productOfCharacteristics) const |
For interface purposes with multi-fields. Returns the inverse together with the second argument. More... | |
Zp_field_operators & | operator= (Zp_field_operators other) |
Assign operator. | |
Static Public Member Functions | |
static constexpr element_type | get_additive_identity () |
Returns the additive identity of the field. More... | |
static constexpr element_type | get_multiplicative_identity () |
Returns the multiplicative identity of the field. More... | |
static constexpr element_type | get_partial_multiplicative_identity ([[maybe_unused]] characteristic_type productOfCharacteristics) |
For interface purposes with multi-fields. Returns the multiplicative identity of the field. More... | |
Friends | |
void | swap (Zp_field_operators &f1, Zp_field_operators &f2) |
Swap operator. | |
Class defining operators for the \( \mathbb{F}_p \) field for any prime number \( p \).
Unsigned_integer_type | A native unsigned integer type: unsigned int, long unsigned int, etc. Will be used as the field element type. |
using Gudhi::persistence_fields::Zp_field_operators< Unsigned_integer_type, class >::characteristic_type = element_type |
Type for the field characteristic.
using Gudhi::persistence_fields::Zp_field_operators< Unsigned_integer_type, class >::element_type = Unsigned_integer_type |
Type for the elements in the field.
|
inline |
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.
characteristic | Prime number corresponding to the desired characteristic of the field. |
|
inline |
Copy constructor.
toCopy | Operators to copy. |
|
inlinenoexcept |
Move constructor.
toMove | Operators to move. |
|
inline |
Returns the sum of two elements in the field.
e1 | First element. |
e2 | Second element. |
(e1 + e2) % characteristic
, such that the result is positive.
|
inline |
Adds the first element to the second one and multiplies the third one with it. Returns the result in the field.
e | First element. |
a | Second element. |
m | Third element. |
((e + a) * m) % characteristic
, such that the result is positive.
|
inline |
Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % characteristic
, such that the result is positive. Stores the result in the third element.
e | First element. |
a | Second element. |
m | Third element. |
|
inline |
Adds the first element to the second one and multiplies the third one with it, that is ((e + a) * m) % characteristic
, such that the result is positive. Stores the result in the first element.
e | First element. |
a | Second element. |
m | Third element. |
|
inline |
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.
e1 | First element. |
e2 | Second element. |
|
inline |
Returns true if the two given elements are equal in the field, false otherwise.
e1 | First element to compare. |
e2 | Second element to compare. |
e1 % characteristic == e2 % characteristic
.
|
inlinestaticconstexpr |
Returns the additive identity of the field.
|
inline |
Returns the current characteristic.
|
inline |
Returns the inverse of the given element in the field.
e | Element to get the inverse from. |
e % characteristic
.
|
inlinestaticconstexpr |
Returns the multiplicative identity of the field.
|
inline |
For interface purposes with multi-fields. Returns the inverse together with the second argument.
e | Element to get the inverse from. |
productOfCharacteristics | Some value. |
e
and the second element is productOfCharacteristics
.
|
inlinestaticconstexpr |
For interface purposes with multi-fields. Returns the multiplicative identity of the field.
productOfCharacteristics | Some value. |
|
inline |
Returns the value of an integer in the field. That is the positive value of the integer modulo the current characteristic.
e | Unsigned integer to return the value from. |
e
modulo the current characteristic, such that the result is positive.
|
inline |
Returns the value of an integer in the field. That is the positive value of the integer modulo the current characteristic.
Signed_integer_type | A native signed integer type: int, long int, etc. |
e | Integer to return the value from. |
e
modulo the current characteristic, such that the result is positive.
|
inline |
Returns the multiplication of two elements in the field.
e1 | First element. |
e2 | Second element. |
(e1 * e2) % characteristic
, such that the result is positive.
|
inline |
Multiplies the first element with the second one and adds the third one. Returns the result in the field.
e | First element. |
m | Second element. |
a | Third element. |
(e * m + a) % characteristic
, such that the result is positive.
|
inline |
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.
e | First element. |
m | Second element. |
a | Third element. |
|
inline |
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.
e | First element. |
m | Second element. |
a | Third element. |
|
inline |
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.
e1 | First element. |
e2 | Second element. |
|
inline |
Sets the characteristic of the field.
characteristic | Prime number corresponding to the desired characteristic of the field. |
|
inline |
Returns the substraction in the field of the first element by the second element.
e1 | First element. |
e2 | Second element. |
(e1 - e2) % characteristic
, such that the result is positive.
|
inline |
Stores in the second element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2
, such that the result is positive.
e1 | First element. |
e2 | Second element. |
|
inline |
Stores in the first element the substraction in the field of the first element by the second element, that is (e1 - e2) % 2
, such that the result is positive.
e1 | First element. |
e2 | Second element. |