From a86f72efe7d6513aa1bd1b503abcc5baf87121f1 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Mon, 3 Jun 2024 16:45:28 +0200 Subject: [PATCH] small changes --- .../doc/Intro_field_elements_and_operators.h | 2 +- .../example/simplex_tree_to_matrix.cpp | 2 +- .../gudhi/Persistence_matrix/base_pairing.h | 4 +-- src/Persistence_matrix/include/gudhi/matrix.h | 29 ++++++++----------- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/Persistence_matrix/doc/Intro_field_elements_and_operators.h b/src/Persistence_matrix/doc/Intro_field_elements_and_operators.h index d7bddb10a0..938fccc842 100644 --- a/src/Persistence_matrix/doc/Intro_field_elements_and_operators.h +++ b/src/Persistence_matrix/doc/Intro_field_elements_and_operators.h @@ -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`. diff --git a/src/Persistence_matrix/example/simplex_tree_to_matrix.cpp b/src/Persistence_matrix/example/simplex_tree_to_matrix.cpp index 4f20be5d46..3799d3fe15 100644 --- a/src/Persistence_matrix/example/simplex_tree_to_matrix.cpp +++ b/src/Persistence_matrix/example/simplex_tree_to_matrix.cpp @@ -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); diff --git a/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h b/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h index 89761d6486..31c95e35d1 100644 --- a/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h +++ b/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h @@ -147,8 +147,8 @@ inline void Base_pairing::_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()) { diff --git a/src/Persistence_matrix/include/gudhi/matrix.h b/src/Persistence_matrix/include/gudhi/matrix.h index e4574f4a51..22e54c5b88 100644 --- a/src/Persistence_matrix/include/gudhi/matrix.h +++ b/src/Persistence_matrix/include/gudhi/matrix.h @@ -28,6 +28,8 @@ #include +#include + #include #include @@ -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::type; /** * @brief Type of a field element. */ - using element_type = typename std::conditional::type; - using characteristic_type = - typename std::conditional::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? /**