summaryrefslogtreecommitdiff
path: root/ripser.cpp
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2019-07-02 12:52:59 +0200
committerUlrich Bauer <mail@ulrich-bauer.org>2019-07-02 13:00:34 +0200
commitb909e6c124b8d83e759793991f9db391103ebb0b (patch)
tree1fd8e02691e6a4462dd95d2b616f8b260472b599 /ripser.cpp
parentcecb349da82f8bfb49d0f033ce3d03c7dcb9b767 (diff)
cleanup add_coboundary
Diffstat (limited to 'ripser.cpp')
-rw-r--r--ripser.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 3f19858..b10ec07 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -539,12 +539,18 @@ public:
if (get_diameter(coface) <= threshold) working_coboundary.push(coface);
}
}
-
+
template <typename Column>
void add_coboundary(compressed_sparse_matrix<diameter_entry_t>& reduction_matrix,
- const index_t index_column_to_add, const coefficient_t factor,
- Column& working_reduction_column, Column& working_coboundary,
- const index_t& dim) {
+ 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;
@@ -598,12 +604,7 @@ public:
modulus - get_coefficient(pivot) *
multiplicative_inverse[get_coefficient(other_pivot)] %
modulus;
- 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);
- add_coboundary(reduction_matrix, index_column_to_add, factor,
+ add_coboundary(reduction_matrix, columns_to_reduce, index_column_to_add, factor,
working_reduction_column, working_coboundary, dim);
pivot = get_pivot(working_coboundary, modulus);