summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Bauer <ulrich.bauer@tum.de>2015-11-13 18:21:26 -0500
committerUlrich Bauer <ulrich.bauer@tum.de>2015-11-13 23:53:56 -0500
commit0ae0988875cbf9f3c8603a7db2c743c041e7cb61 (patch)
treec3c8a003aa32a2a4cff7d75d214a305f71668d4e
parentfb72e5364eca5112f0239a467d02d37f43063491 (diff)
use google sparse hash map
-rw-r--r--ripser.cpp14
-rw-r--r--ripser.xcodeproj/project.pbxproj2
2 files changed, 9 insertions, 7 deletions
diff --git a/ripser.cpp b/ripser.cpp
index 54a3ae2..0e480f5 100644
--- a/ripser.cpp
+++ b/ripser.cpp
@@ -6,7 +6,7 @@
#include <string>
#include <cassert>
#include <queue>
-#include <unordered_map>
+#include <sparsehash/sparse_hash_map>
#include "prettyprint.hpp"
typedef float value_t;
@@ -627,7 +627,7 @@ typedef index_t diameter_index_t;
template <typename Comparator>
void assemble_columns_to_reduce (
std::vector<diameter_index_t>& columns_to_reduce,
- std::unordered_map<index_t, index_t>& pivot_column_index,
+ google::sparse_hash_map<index_t, index_t>& pivot_column_index,
const Comparator& comp,
index_t dim, index_t n,
value_t threshold,
@@ -750,7 +750,7 @@ inline void push_entry(Heap& column, index_t i, coefficient_t c, value_t diamete
template <typename ComparatorCofaces, typename Comparator>
void compute_pairs(
std::vector<diameter_index_t>& columns_to_reduce,
- std::unordered_map<index_t, index_t>& pivot_column_index,
+ google::sparse_hash_map<index_t, index_t>& pivot_column_index,
const ComparatorCofaces& comp, const Comparator& comp_prev,
index_t dim, index_t n,
value_t threshold,
@@ -1173,7 +1173,7 @@ int main( int argc, char** argv ) {
rips_filtration_diameter_comparator comp(diameters[1], dim + 1, binomial_coeff);
rips_filtration_comparator<decltype(dist)> comp_prev(dist, dim, binomial_coeff);
- std::unordered_map<index_t, index_t> pivot_column_index;
+ google::sparse_hash_map<index_t, index_t> pivot_column_index;
compute_pairs(
columns_to_reduce,
@@ -1222,8 +1222,8 @@ int main( int argc, char** argv ) {
#endif
- std::unordered_map<index_t, index_t> pivot_column_index;
- pivot_column_index.reserve(columns_to_reduce.size());
+ google::sparse_hash_map<index_t, index_t> pivot_column_index;
+ pivot_column_index.resize(columns_to_reduce.size());
compute_pairs(
columns_to_reduce,
@@ -1259,7 +1259,7 @@ int main( int argc, char** argv ) {
rips_filtration_comparator<decltype(dist)> comp(dist, dim + 1, binomial_coeff);
std::unordered_map<index_t, index_t> pivot_column_index;
- pivot_column_index.reserve(columns_to_reduce.size());
+ pivot_column_index.resize(columns_to_reduce.size());
compute_pairs(
columns_to_reduce,
diff --git a/ripser.xcodeproj/project.pbxproj b/ripser.xcodeproj/project.pbxproj
index 196bac0..951d862 100644
--- a/ripser.xcodeproj/project.pbxproj
+++ b/ripser.xcodeproj/project.pbxproj
@@ -160,6 +160,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = /opt/local/include;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
@@ -196,6 +197,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = /opt/local/include;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;