diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-07-02 12:52:59 +0200 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2019-07-02 13:00:34 +0200 |
commit | b909e6c124b8d83e759793991f9db391103ebb0b (patch) | |
tree | 1fd8e02691e6a4462dd95d2b616f8b260472b599 /ripser.cpp | |
parent | cecb349da82f8bfb49d0f033ce3d03c7dcb9b767 (diff) |
cleanup add_coboundary
Diffstat (limited to 'ripser.cpp')
-rw-r--r-- | ripser.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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); |