summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <mail@ulrich-bauer.org>2019-07-13 17:03:35 +0200
committerUlrich Bauer <mail@ulrich-bauer.org>2019-07-13 17:03:35 +0200
commitdac3c59f13ba692c1d7770afa7a212d52c1a29d6 (patch)
treeaf53930e24a951125f4c6083d55bfab739529513
parent10e21898c484982d91ebcf95beccb07910f6deff (diff)
added missing headers
-rw-r--r--ripser.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 74e9b2e..70430eb 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -43,6 +43,8 @@
//#define USE_GOOGLE_HASHMAP
+#include <algorithm>
+#include <cassert>
#include <chrono>
#include <fstream>
#include <iostream>
@@ -146,7 +148,6 @@ index_t get_index(const entry_t& e) { return e.index; }
index_t get_coefficient(const entry_t& e) { return e.coefficient; }
void set_coefficient(entry_t& e, const coefficient_t c) { e.coefficient = c; }
-
std::ostream& operator<<(std::ostream& stream, const entry_t& e) {
stream << get_index(e) << ":" << get_coefficient(e);
return stream;
@@ -383,19 +384,20 @@ template <typename DistanceMatrix> class ripser {
const binomial_coeff_table binomial_coeff;
const std::vector<coefficient_t> multiplicative_inverse;
mutable std::vector<diameter_entry_t> coface_entries;
-
+
struct entry_hash {
- std::size_t operator()(const entry_t& e) const { return std::hash<index_t>()(::get_index(e)); }
+ std::size_t operator()(const entry_t& e) const {
+ return std::hash<index_t>()(::get_index(e));
+ }
};
-
+
struct equal_index {
bool operator()(const entry_t& e, const entry_t& f) const {
return ::get_index(e) == ::get_index(f);
}
};
-
- typedef hash_map<entry_t, index_t, entry_hash, equal_index> entry_hash_map;
+ typedef hash_map<entry_t, index_t, entry_hash, equal_index> entry_hash_map;
public:
ripser(DistanceMatrix&& _dist, index_t _dim_max, value_t _threshold, float _ratio,
@@ -520,7 +522,7 @@ public:
break;
else
set_coefficient(pivot,
- (get_coefficient(pivot) + get_coefficient(column.top())) % modulus);
+ (get_coefficient(pivot) + get_coefficient(column.top())) % modulus);
column.pop();
}
if (get_coefficient(pivot) == 0) pivot = -1;
@@ -537,13 +539,13 @@ public:
#endif
return pivot;
}
-
+
template <typename Column> diameter_entry_t get_pivot(Column& column) {
diameter_entry_t result = pop_pivot(column);
if (get_index(result) != -1) column.push(result);
return result;
}
-
+
template <typename Column>
diameter_entry_t init_coboundary_and_get_pivot(const diameter_entry_t simplex,
Column& working_coboundary, const index_t& dim,