Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hschreiber committed Jun 3, 2024
1 parent f64342e commit a86f72e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace persistence_fields {
* There are two types of classes:
* - those defining directly a field element, allowing to use them as any integer: the operators are overwritten such
* that the calculation is done in the field. For example, if \f$ e = 2 \f$ is an instanciation of an
* \f$ \mathbb{F}_3 \f$ element class, then `e + 3` returns `2`,
* \f$ \mathbb{F}_3 \f$ element class, then `e + 3` returns an element instanciation of value `2`,
* - those only defining the operators of a field or multi-field. They represent a collection of methods taking
* one or two integers as input and treating them as elements of the field. For example, if \f$ op \f$ is an
* instanciation of a \f$ \mathbb{F}_3 \f$ operator class, `op.add(2, 3)` returns `2`.
Expand Down
2 changes: 1 addition & 1 deletion src/Persistence_matrix/example/simplex_tree_to_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ int main() {
for (auto b : st.boundary_simplex_range(sh)){
boundary.push_back(st.key(b));
}
std::sort(boundary.begin(), boundary.end()); //boundaries have to ordered
std::sort(boundary.begin(), boundary.end()); //boundaries have to be ordered

//insertion in the matrices, the id is continuously increasing from 0 so no need to give it as an argument.
bm.insert_boundary(boundary);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ inline void Base_pairing<Master_matrix>::_reduce()
columnsByDim[dim - _matrix()->get_column_dimension(i)].push_back(i);
}

for (auto cols : columnsByDim) {
for (auto i : cols) {
for (const auto& cols : columnsByDim) {
for (index i : cols) {
auto& curr = _matrix()->get_column(i);
if (curr.is_empty()) {
if (pivotsToColumn.find(i) == pivotsToColumn.end()) {
Expand Down
29 changes: 12 additions & 17 deletions src/Persistence_matrix/include/gudhi/matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

#include <gudhi/persistence_matrix_options.h>

#include <gudhi/Fields/Z2_field_operators.h>

#include <gudhi/Persistence_matrix/overlay_ididx_to_matidx.h>
#include <gudhi/Persistence_matrix/overlay_posidx_to_matidx.h>

Expand Down Expand Up @@ -146,37 +148,30 @@ class Matrix {
using pos_index = typename PersistenceMatrixOptions::index_type; /**< Type of @ref PosIdx index. */
using dimension_type = typename PersistenceMatrixOptions::dimension_type; /**< Type for dimension value. */

struct Dummy_field_operators{
using element_type = unsigned int;
using characteristic_type = element_type;
// struct Dummy_field_operators{
// using element_type = unsigned int;
// using characteristic_type = element_type;

Dummy_field_operators([[maybe_unused]] characteristic_type characteristic = 0){}
// Dummy_field_operators([[maybe_unused]] characteristic_type characteristic = 0){}

friend void swap([[maybe_unused]] Dummy_field_operators& d1, [[maybe_unused]] Dummy_field_operators& d2){}
// friend void swap([[maybe_unused]] Dummy_field_operators& d1, [[maybe_unused]] Dummy_field_operators& d2){}

static constexpr characteristic_type get_characteristic() { return 2; }
};
// static constexpr characteristic_type get_characteristic() { return 2; }
// };

/**
* @brief Coefficiants field type.
*/
using Field_operators =
typename std::conditional<PersistenceMatrixOptions::is_z2,
Dummy_field_operators,
Gudhi::persistence_fields::Z2_field_operators,
typename PersistenceMatrixOptions::Field_coeff_operators
>::type;
/**
* @brief Type of a field element.
*/
using element_type = typename std::conditional<PersistenceMatrixOptions::is_z2,
bool,
typename Field_operators::element_type
>::type;
using characteristic_type =
typename std::conditional<PersistenceMatrixOptions::is_z2,
unsigned int,
typename Field_operators::characteristic_type
>::type;
using element_type = typename Field_operators::element_type;
using characteristic_type = typename Field_operators::characteristic_type;

// TODO: move outside? unify with other bar types in Gudhi?
/**
Expand Down

0 comments on commit a86f72e

Please sign in to comment.