@@ -43,13 +43,22 @@ derivative works thereof, in binary and source code form.
4343#include < cmath>
4444#include < cstring>
4545#include < fstream>
46+ #include < iterator>
4647#include < iostream>
4748#include < numeric>
4849#include < queue>
4950#include < sstream>
5051#include < unordered_map>
5152
5253
54+ /* Disable packing for Windows */
55+ #if defined _WIN32
56+ #define PACK
57+ #else
58+ #define PACK __attribute__ ((__packed__))
59+ #endif
60+
61+
5362template <class Key , class T > class hash_map : public std ::unordered_map<Key, T> {};
5463typedef float value_t ;
5564typedef int64_t index_t ;
@@ -98,7 +107,7 @@ std::vector<coefficient_t> multiplicative_inverse_vector(const coefficient_t m)
98107}
99108
100109#ifdef USE_COEFFICIENTS
101- struct __attribute__ ((packed)) entry_t {
110+ struct PACK entry_t {
102111 index_t index : 8 * (sizeof (index_t ) - sizeof (coefficient_t ));
103112 coefficient_t coefficient;
104113 entry_t (index_t _index, coefficient_t _coefficient)
@@ -208,7 +217,7 @@ class sparse_distance_matrix {
208217
209218 // Initialize from thresholded dense distance matrix
210219 template <typename DistanceMatrix>
211- sparse_distance_matrix (const DistanceMatrix& mat, value_t threshold) :
220+ sparse_distance_matrix (const DistanceMatrix& mat, value_t threshold) :
212221 neighbors (mat.size()), vertex_births(mat.size(), 0 ) {
213222 for (size_t i = 0 ; i < size (); ++i) {
214223 for (size_t j = 0 ; j < size (); ++j) {
@@ -219,7 +228,7 @@ class sparse_distance_matrix {
219228 }
220229 }
221230 // Initialize from COO format
222- sparse_distance_matrix (int * I, int * J, float * V, int NEdges, int N, float threshold) :
231+ sparse_distance_matrix (int * I, int * J, float * V, int NEdges, int N, float threshold) :
223232 neighbors (N), vertex_births(N, 0 ) {
224233 int i, j;
225234 value_t val;
@@ -819,7 +828,7 @@ template <> class ripser<compressed_lower_distance_matrix>::simplex_coboundary_e
819828
820829public:
821830 simplex_coboundary_enumerator (const diameter_entry_t _simplex, index_t _dim,
822- const ripser& parent)
831+ const ripser<compressed_lower_distance_matrix> & parent)
823832 : idx_below(get_index(_simplex)), idx_above(0 ), v(parent.n - 1 ), k(_dim + 1 ),
824833 vertices (_dim + 1 ), simplex(_simplex), modulus(parent.modulus), dist(parent.dist),
825834 binomial_coeff(parent.binomial_coeff) {
@@ -849,7 +858,7 @@ template <> class ripser<compressed_lower_distance_matrix>::simplex_coboundary_e
849858
850859template <> class ripser <sparse_distance_matrix>::simplex_coboundary_enumerator {
851860private:
852- const ripser& parent;
861+ const ripser<sparse_distance_matrix> & parent;
853862
854863 index_t idx_below, idx_above, v, k, max_vertex_below;
855864 const diameter_entry_t simplex;
@@ -864,7 +873,7 @@ template <> class ripser<sparse_distance_matrix>::simplex_coboundary_enumerator
864873
865874public:
866875 simplex_coboundary_enumerator (const diameter_entry_t _simplex, index_t _dim,
867- const ripser& _parent)
876+ const ripser<sparse_distance_matrix> & _parent)
868877 : parent(_parent), idx_below(get_index(_simplex)), idx_above(0 ), v(parent.n - 1 ),
869878 k (_dim + 1 ), max_vertex_below(parent.n - 1 ), simplex(_simplex), modulus(parent.modulus),
870879 dist(parent.dist), binomial_coeff(parent.binomial_coeff), vertices(parent.vertices),
@@ -944,7 +953,7 @@ template <> std::vector<diameter_index_t> ripser<sparse_distance_matrix>::get_ed
944953template <> value_t ripser<compressed_lower_distance_matrix>::get_vertex_birth(index_t i) {
945954 // TODO: Dummy for now; nonzero vertex births are only done through
946955 // sparse matrices at the moment
947- return 0.0 ;
956+ return 0.0 ;
948957}
949958
950959template <> value_t ripser<sparse_distance_matrix>::get_vertex_birth(index_t i) {
0 commit comments