From 2989ecd1047fcae2b8fead4b8fca1a4608342576 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Thu, 29 Dec 2016 23:07:00 +0100 Subject: use sparse distance matrix when threshold is given --- ripser.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index 3054441..4ac5033 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -24,8 +24,6 @@ with this program. If not, see . //#define INDICATE_PROGRESS #define PRINT_PERSISTENCE_PAIRS -#define SPARSE_DISTANCE_MATRIX - //#define USE_GOOGLE_HASHMAP #include @@ -1063,14 +1061,14 @@ int main(int argc, char** argv) { std::cout << "value range: [" << *value_range.first << "," << *value_range.second << "]" << std::endl; -#ifdef SPARSE_DISTANCE_MATRIX - ripser(std::move(dist), dim_max, threshold, modulus) - .compute_barcodes(); -#else - ripser(sparse_distance_matrix(dist, threshold), dim_max, threshold, - modulus) - .compute_barcodes(); -#endif + if (threshold == std::numeric_limits::max()) + ripser(std::move(dist), dim_max, threshold, modulus) + .compute_barcodes(); + else + ripser(sparse_distance_matrix(dist, threshold), dim_max, threshold, + modulus) + .compute_barcodes(); + } template <> void ripser::compute_barcodes() { -- cgit v1.2.3