From b78097422182b412513d9c72c3e4d6ef3e2a439d Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Sun, 25 Oct 2015 19:38:52 +0100 Subject: store summed coefficients in reduction matrix (instead of individual summands from the heap) --- ripser.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index df739d6..e7a7546 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -58,6 +58,9 @@ public: } }; +// +// https://comeoncodeon.wordpress.com/2011/10/09/modular-multiplicative-inverse/ +// std::vector multiplicative_inverse_vector (const int m) { std::vector mod_inverse(m); mod_inverse[1] = 1; @@ -764,8 +767,7 @@ void compute_pairs( reduction_matrix.pop_back(); while(!reduction_column.empty()) { - entry_t e = reduction_column.top(); - reduction_column.pop(); + entry_t e = pop_pivot(reduction_column, modulus); reduction_matrix.push_back(make_entry( get_index(e), #ifdef USE_COEFFICIENTS @@ -808,15 +810,17 @@ void compute_pairs( } #endif + + #ifdef ASSEMBLE_REDUCTION_MATRIX + std::cout << "reduction matrix fill-in: " << i + 1 << " + " << reduction_matrix.entries.size() - i + 1 << std::endl; + #endif + } #ifdef INDICATE_PROGRESS std::cout << "\033[K"; #endif - - #ifdef ASSEMBLE_REDUCTION_MATRIX - std::cout << "reduction matrix fill-in: " << columns_to_reduce.size() << " + " << reduction_matrix.entries.size() - columns_to_reduce.size() << std::endl; - #endif + } bool is_prime(const long n) { -- cgit v1.2.3