diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-11-30 17:46:00 -0500 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-11-30 17:46:00 -0500 |
commit | c86c7fc1620363b4a78699c88644d5d8c6051379 (patch) | |
tree | afaf932b575dfd0b0c949731a101e024b7621577 | |
parent | 7c3dee0ebd452f43e170ea5cdd95c65562025462 (diff) |
cleanup
-rw-r--r-- | ripser.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
@@ -137,6 +137,8 @@ index_t get_index(diameter_index_t i) { return i.second; } class diameter_entry_t : public std::pair<value_t, entry_t> { public: diameter_entry_t(std::pair<value_t, entry_t> p) : std::pair<value_t, entry_t>(p) {} + diameter_entry_t(entry_t e) : std::pair<value_t, entry_t>(0, e) {} + diameter_entry_t() : diameter_entry_t(0) {} diameter_entry_t(value_t _diameter, index_t _index, coefficient_t _coefficient) : std::pair<value_t, entry_t>(_diameter, make_entry(_index, _coefficient)) {} diameter_entry_t(diameter_index_t _diameter_index, coefficient_t _coefficient) @@ -203,14 +205,6 @@ public: size_t size() const { return neighbors.size(); } }; -template <class T> struct second_argument_greater { - bool operator()(const T& lhs, const T& rhs) const { return lhs.second > rhs.second; } -}; - -template <class T> struct second_argument_equal_to { - bool operator()(const T& lhs, const T& rhs) const { return lhs.second == rhs.second; } -}; - template <> void compressed_distance_matrix<LOWER_TRIANGULAR>::init_rows() { value_t* pointer = &distances[0]; for (index_t i = 1; i < size(); ++i) { @@ -494,16 +488,16 @@ public: return out; } -// value_t compute_diameter(const index_t index, index_t dim) const { -// value_t diam = -std::numeric_limits<value_t>::infinity(); -// -// vertices.clear(); -// get_simplex_vertices(index, dim, sparse_dist.size(), std::back_inserter(vertices)); -// -// for (index_t i = 0; i <= dim; ++i) -// for (index_t j = 0; j < i; ++j) { diam = std::max(diam, sparse_dist(vertices[i], vertices[j])); } -// return diam; -// } + value_t compute_diameter(const index_t index, index_t dim) const { + value_t diam = -std::numeric_limits<value_t>::infinity(); + + vertices.clear(); + get_simplex_vertices(index, dim, sparse_dist.size(), std::back_inserter(vertices)); + + for (index_t i = 0; i <= dim; ++i) + for (index_t j = 0; j < i; ++j) { diam = std::max(diam, dist(vertices[i], vertices[j])); } + return diam; + } void assemble_columns_to_reduce(std::vector<diameter_index_t>& simplices, std::vector<diameter_index_t>& columns_to_reduce, |