diff options
author | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-12-29 23:07:00 +0100 |
---|---|---|
committer | Ulrich Bauer <mail@ulrich-bauer.org> | 2016-12-29 23:07:00 +0100 |
commit | 2989ecd1047fcae2b8fead4b8fca1a4608342576 (patch) | |
tree | d43b4d97c4d2acc330e9252f7c2b70474190ac47 | |
parent | b945df6609d9198c34a982e70dee0773ee630897 (diff) |
use sparse distance matrix when threshold is given
-rw-r--r-- | ripser.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -24,8 +24,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. //#define INDICATE_PROGRESS #define PRINT_PERSISTENCE_PAIRS -#define SPARSE_DISTANCE_MATRIX - //#define USE_GOOGLE_HASHMAP #include <algorithm> @@ -1063,14 +1061,14 @@ int main(int argc, char** argv) { std::cout << "value range: [" << *value_range.first << "," << *value_range.second << "]" << std::endl; -#ifdef SPARSE_DISTANCE_MATRIX - ripser<compressed_lower_distance_matrix>(std::move(dist), dim_max, threshold, modulus) - .compute_barcodes(); -#else - ripser<sparse_distance_matrix>(sparse_distance_matrix(dist, threshold), dim_max, threshold, - modulus) - .compute_barcodes(); -#endif + if (threshold == std::numeric_limits<value_t>::max()) + ripser<compressed_lower_distance_matrix>(std::move(dist), dim_max, threshold, modulus) + .compute_barcodes(); + else + ripser<sparse_distance_matrix>(sparse_distance_matrix(dist, threshold), dim_max, threshold, + modulus) + .compute_barcodes(); + } template <> void ripser<compressed_lower_distance_matrix>::compute_barcodes() { |