summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2019-07-02 20:45:27 +0200
committerUlrich Bauer <mail@ulrich-bauer.org>2019-07-02 20:45:27 +0200
commit028b237e48d92efd9655a920ed38d0c441540ce8 (patch)
tree861e26500970dbf238eb1fa3e29f75e50826a6c0
parentb909e6c124b8d83e759793991f9db391103ebb0b (diff)
some cleanup
-rw-r--r--ripser.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/ripser.cpp b/ripser.cpp
index b10ec07..3d1a9e9 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -539,18 +539,16 @@ public:
if (get_diameter(coface) <= threshold) working_coboundary.push(coface);
}
}
-
+
template <typename Column>
void add_coboundary(compressed_sparse_matrix<diameter_entry_t>& reduction_matrix,
- std::vector<diameter_index_t>& columns_to_reduce,
- const index_t index_column_to_add, const coefficient_t factor,
- Column& working_reduction_column, Column& working_coboundary,
- const index_t& dim) {
- diameter_entry_t column_to_add(columns_to_reduce[index_column_to_add],
- factor);
- add_coboundary(column_to_add, working_reduction_column, working_coboundary,
- dim);
-
+ const std::vector<diameter_index_t>& columns_to_reduce,
+ const index_t index_column_to_add, const coefficient_t factor,
+ Column& working_reduction_column, Column& working_coboundary,
+ const index_t& dim) {
+ diameter_entry_t column_to_add(columns_to_reduce[index_column_to_add], factor);
+ add_coboundary(column_to_add, working_reduction_column, working_coboundary, dim);
+
for (auto it = reduction_matrix.cbegin(index_column_to_add);
it != reduction_matrix.cend(index_column_to_add); ++it) {
diameter_entry_t simplex = *it;
@@ -560,7 +558,7 @@ public:
}
}
- void compute_pairs(std::vector<diameter_index_t>& columns_to_reduce,
+ void compute_pairs(const std::vector<diameter_index_t>& columns_to_reduce,
entry_hash_map& pivot_column_index, const index_t dim) {
#ifdef PRINT_PERSISTENCE_PAIRS
@@ -604,8 +602,9 @@ public:
modulus - get_coefficient(pivot) *
multiplicative_inverse[get_coefficient(other_pivot)] %
modulus;
- add_coboundary(reduction_matrix, columns_to_reduce, index_column_to_add, factor,
- working_reduction_column, working_coboundary, dim);
+
+ add_coboundary(reduction_matrix, columns_to_reduce, index_column_to_add,
+ factor, working_reduction_column, working_coboundary, dim);
pivot = get_pivot(working_coboundary, modulus);
} else {