summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <ulrich.bauer@tum.de>2016-05-24 17:30:06 +0200
committerUlrich Bauer <ulrich.bauer@tum.de>2016-05-24 17:30:06 +0200
commit8d1d76d2b932b36cc788950e3cbdf2f67d3dce44 (patch)
tree2323db0df3570f8ffa2c5d65f866618401f70070
parentbb8a173be181d3035e6523cb38a4eec526c4bd71 (diff)
removed binary/exponential search flags
-rw-r--r--ripser.cpp20
1 files changed, 1 insertions, 19 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 7733be6..a9236e1 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -1,6 +1,3 @@
-#define USE_BINARY_SEARCH
-//#define USE_EXPONENTIAL_SEARCH
-
//#define ASSEMBLE_REDUCTION_MATRIX
//#define USE_COEFFICIENTS
@@ -70,18 +67,8 @@ inline OutputIterator get_simplex_vertices(index_t idx, const index_t dim, index
--n;
for (index_t k = dim + 1; k > 0; --k) {
-
-#ifdef USE_BINARY_SEARCH
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
-
+ index_t count = n;
while (count > 0) {
index_t i = n;
index_t step = count >> 1;
@@ -93,15 +80,10 @@ inline OutputIterator get_simplex_vertices(index_t idx, const index_t dim, index
count = step;
}
}
-#else
- while (binomial_coeff(n, k) > idx) --n;
-#endif
-
assert(binomial_coeff(n, k) <= idx);
assert(binomial_coeff(n + 1, k) > idx);
*out++ = n;
-
idx -= binomial_coeff(n, k);
}