X-Git-Url: http://git.sthu.org/?a=blobdiff_plain;f=include%2Flibstick-0.1%2Fpersistence.h;h=d7cc25f23878266da513ea123399d7b2522d1092;hb=7336073618c7d862759add5cbbe45465e496b029;hp=49ddb9db4a68947c7b871dafe9cff79cb694f2b6;hpb=9836f51097f5c72a6d7ccc107d1a04dffc4fa7b8;p=libstick.git diff --git a/include/libstick-0.1/persistence.h b/include/libstick-0.1/persistence.h index 49ddb9d..d7cc25f 100644 --- a/include/libstick-0.1/persistence.h +++ b/include/libstick-0.1/persistence.h @@ -94,6 +94,11 @@ class persistence { done_diagrams = false; } + /** Get simplicial order of this persistence object. */ + const simplex_order& get_order() const { + return order; + } + /** Get boundary matrix 'bm' of 'order', compute reduces boundary * matrix 'rbm', and the transformation matrix 'tm' such that rbm = bm * * tm. */ @@ -112,7 +117,7 @@ class persistence { //if (c % 100 == 0) //std::cout << "c = " << c << " (" << (100.0*float(c)/rbm.width()) << " %)" << std::endl; // Reduce as long as we need to reduce - while (rbm.get_column(c).size() > 0) { + while (!rbm.get_column(c).isempty()) { // (r, c) is the lowest one of col const IT r = rbm.get_column(c).back(); // This column contains its lowest one on the same row @@ -132,7 +137,7 @@ class persistence { } // A lowest one remained, recall it - if (rbm.get_column(c).size() > 0) { + if (!rbm.get_column(c).isempty()) { const IT r = rbm.get_column(c).back(); assert(lowestones[r] == 0); assert(r < c); @@ -195,11 +200,11 @@ class persistence { break; } - os << std::endl; + os << "(value: " << order.get_simplex(c).value << ")" << std::endl; os << " boundary: " << bm.get_column(c) << std::endl; typename boolean_colmatrix::column_type col = rbm.get_column(c); - if (col.size() == 0) { + if (col.isempty()) { os << " \033[1;32mbirth\033[0;m of a cycle: " << tm.get_column(c) << std::endl; } else { os << " \033[1;31mdeath\033[0;m of a cycle: " << rbm.get_column(c) << std::endl; @@ -235,7 +240,7 @@ class persistence { for (unsigned c=0; c < lowestones.size(); ++c) { // A cycle was born - if (rbm.get_column(c).size() == 0) { + if (rbm.get_column(c).isempty()) { const int dim = order.get_simplex(c).dim; // Create a diagram point @@ -260,7 +265,7 @@ class persistence { // or not be, tertium non datur. for (unsigned c=0; c < lowestones.size(); ++c) { // A class died with c - if (rbm.get_column(c).size() != 0) + if (!rbm.get_column(c).isempty()) assert(c == 0 || deaths.count(c) > 0); else assert(births.count(c) > 0);