X-Git-Url: https://git.sthu.org/?p=libstick.git;a=blobdiff_plain;f=include%2Flibstick-0.1%2Fpersistence.h;h=0a69be22cb0acf7c974595e4a91a3037aac69c2b;hp=3840bd2f8d65a68385948187860b98c241771ea5;hb=b3a9951228b854b44c507b32a61e9d36e74709d9;hpb=754ba359b3f87df0d42f8706549b6eda32d3373d diff --git a/include/libstick-0.1/persistence.h b/include/libstick-0.1/persistence.h index 3840bd2..0a69be2 100644 --- a/include/libstick-0.1/persistence.h +++ b/include/libstick-0.1/persistence.h @@ -23,7 +23,8 @@ template class persistence { public: - typedef typename simplicial_complex::simplex_order simplex_order; + typedef simplicial_complex scomplex; + typedef typename scomplex::simplex_order simplex_order; typedef typename simplex_order::boundary_matrix boundary_matrix; typedef boolean_colmatrix transformation_matrix; @@ -109,32 +110,17 @@ class persistence { tm = create_unit_matrix(bm.size()); reduce_boundary_matrix(rbm, tm); - assert(rbm == bm * tm); lowestones = boundary_matrix(rbm.size()); for (unsigned c=0; c < rbm.size(); ++c) if (rbm.get_column(c).size() > 0) lowestones.set(rbm.get_column(c).back(), c, true); + } -#ifndef NDEBUG - for (unsigned c=0; c < lowestones.size(); ++c) - assert(lowestones.get_column(c).size() <= 1); - for (unsigned r=0; r < lowestones.size(); ++r) - assert(lowestones.get_row(r).size() <= 1); - for (unsigned c=0; c < lowestones.size(); ++c) { - // If (r,c) is a one then - // (i) a cycle dies with c --> row c is zero - // (ii) a cycle is born with r --> column r is zero - //Hence - // (i) the column r is a zero-column - // (i) the row c is a zero-column - if (lowestones.get_column(c).size() > 0) { - const IT r = lowestones.get_column(c).back(); - assert(lowestones.get_column(r).size() == 0); - assert(lowestones.get_row(c).size() == 0); - } - } -#endif + /** Get the lowest-one matrix of 'order'. */ + const boundary_matrix& get_lowestones_matrix() const { + assert(done_matrices); + return lowestones; } /** Get the boundary matrix of 'order'. */