From 028b237e48d92efd9655a920ed38d0c441540ce8 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Tue, 2 Jul 2019 20:45:27 +0200 Subject: some cleanup --- ripser.cpp | 25 ++++++++++++------------- 1 file 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 void add_coboundary(compressed_sparse_matrix& reduction_matrix, - std::vector& 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& 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& columns_to_reduce, + void compute_pairs(const std::vector& 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 { -- cgit v1.2.3