From 12b8e1109a569e2dad5962dc806b3dee6f0d7e4f Mon Sep 17 00:00:00 2001 From: Ulrich Bauer Date: Wed, 20 Jul 2016 08:34:59 +0200 Subject: progress indicator for sorting --- ripser.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'ripser.cpp') diff --git a/ripser.cpp b/ripser.cpp index 3661b9c..30697a9 100644 --- a/ripser.cpp +++ b/ripser.cpp @@ -401,6 +401,11 @@ void assemble_columns_to_reduce(std::vector& columns_to_reduce columns_to_reduce.clear(); +#ifdef INDICATE_PROGRESS + std::cout << "\033[K" + << "assembling " << num_simplices << " columns" << std::flush << "\r"; +#endif + for (index_t index = 0; index < num_simplices; ++index) { if (pivot_column_index.find(index) == pivot_column_index.end()) { value_t diameter = comp.diameter(index); @@ -408,8 +413,16 @@ void assemble_columns_to_reduce(std::vector& columns_to_reduce } } +#ifdef INDICATE_PROGRESS + std::cout << "\033[K" + << "sorting " << num_simplices << " columns" << std::flush << "\r"; +#endif + std::sort(columns_to_reduce.begin(), columns_to_reduce.end(), greater_diameter_or_smaller_index()); +#ifdef INDICATE_PROGRESS + std::cout << "\033[K"; +#endif } template class compressed_sparse_matrix { @@ -496,9 +509,10 @@ void compute_pairs(std::vector& columns_to_reduce, value_t diameter = get_diameter(column_to_reduce); #ifdef INDICATE_PROGRESS - std::cout << "\033[K" - << "reducing column " << i + 1 << "/" << columns_to_reduce.size() << " (diameter " - << diameter << ")" << std::flush << "\r"; + if ((i+1) % 1000 == 0) + std::cout << "\033[K" + << "reducing column " << i + 1 << "/" << columns_to_reduce.size() + << " (diameter " << diameter << ")" << std::flush << "\r"; #endif index_t j = i; -- cgit v1.2.3