From 639c09d9ce8868a47abf6d0fe177812afaa4a365 Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Thu, 22 Oct 2015 15:12:28 +0200 Subject: option for exponential search --- ripser.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ripser.cpp b/ripser.cpp index c4310c5..ab20b8a 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -16,6 +16,7 @@ typedef long index_t; #define PRECOMPUTE_DIAMETERS_IN_TOP_DIMENSION #define USE_BINARY_SEARCH +#define USE_EXPONENTIAL_SEARCH #define INDICATE_PROGRESS @@ -69,7 +70,11 @@ OutputIterator get_simplex_vertices( index_t idx, const index_t dim, index_t n, if ( binomial_coeff( n , k ) > idx ) { index_t count; + #ifdef USE_EXPONENTIAL_SEARCH for (count = 1; (binomial_coeff( n - count , k ) > idx); count = std::min(count << 1, n)); + #else + count = n; + #endif while (count > 0) { index_t i = n; -- cgit v1.2.3