From 492fb75554bf60bccc36c8af98e0bc93b02a612b Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Wed, 28 Mar 2018 15:30:59 +0200 Subject: output dim 0 cocycles --- ripser.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/ripser.cpp b/ripser.cpp index bdf8ff9..b98af75 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -1015,6 +1015,19 @@ void ripser::compute_barcodes() { if (get_diameter(e) != 0) std::cout << " [0," << get_diameter(e) << ")" << std::endl; #endif + std::cout << "{"; + bool nonempty = false; + for (index_t w = 0; w < n; ++w) + if (dset.find(w) == u) { + if (nonempty) std::cout << ", "; nonempty = true; + std::cout << "[" << w << "]"; +#ifdef USE_COEFFICIENTS + std::cout << ":" << 1; +#endif + } + std::cout << "}" << std::endl; + + dset.link(u, v); } else columns_to_reduce.push_back(e); @@ -1023,10 +1036,21 @@ void ripser::compute_barcodes() { #ifdef PRINT_PERSISTENCE_PAIRS for (index_t i = 0; i < n; ++i) - if (dset.find(i) == i) std::cout << " [0, )" << std::endl << std::flush; + if (dset.find(i) == i) { + std::cout << " [0, )" << std::endl << std::flush; + std::cout << "{"; + for (index_t w = 0; w < n; ++w) { + if (w > 0) std::cout << ", "; + std::cout << "[" << w << "]"; +#ifdef USE_COEFFICIENTS + std::cout << ":" << 1; #endif - } - + } + std::cout << "}" << std::endl; +#endif + } + } + for (index_t dim = 1; dim <= dim_max; ++dim) { hash_map pivot_column_index; pivot_column_index.reserve(columns_to_reduce.size()); -- cgit v1.2.3