diff options
author | Ulrich Bauer <ulrich.bauer@tum.de> | 2015-11-06 20:50:35 -0500 |
---|---|---|
committer | Ulrich Bauer <ulrich.bauer@tum.de> | 2015-11-06 21:20:16 -0500 |
commit | f73c30662a802a2ddbfdc29305f434045f183005 (patch) | |
tree | bf54b4962fe64b7b7e50dfde831e9356a55ee3f1 /ripser.cpp | |
parent | a3bcb7808cde47fc89285b57bd948a8db7305e97 (diff) |
efficient diameter caching
Diffstat (limited to 'ripser.cpp')
-rw-r--r-- | ripser.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -218,8 +218,6 @@ std::ostream& operator<< (std::ostream& stream, const entry_t& e) { typedef index_t entry_t; -#endif - inline index_t get_index(entry_t i) { return i; } @@ -232,6 +230,7 @@ inline entry_t make_entry(index_t _index, coefficient_t _value) { return entry_t(_index); } +#endif struct greater_index { bool operator() (const entry_t& a, const entry_t& b) { @@ -578,7 +577,8 @@ template <typename Heap> inline entry_t pop_pivot(Heap& column, coefficient_t modulus) { entry_t result = get_pivot(column, modulus); - column.pop(); + if (!column.empty()) + column.pop(); return result; } @@ -618,7 +618,11 @@ void assemble_columns_to_reduce ( } } + #ifdef STORE_DIAMETERS std::sort(columns_to_reduce.begin(), columns_to_reduce.end(), std::greater<diameter_index_t>()); + #else + std::sort(columns_to_reduce.begin(), columns_to_reduce.end(), comp); + #endif } |