# HG changeset patch # User Dmitriy Morozov <morozov@cs.duke.edu> # Date 1190289769 14400 # Node ID aee8f549d3249b95d581c2dc441bd3032b4e572d # Parent addeb7563cb2209f83318943ac85fa85f5960c52 Added ability to not store trails in pair_simplices() computation diff -r addeb7563cb2 -r aee8f549d324 examples/alphashapes/alphashapes3d.cpp --- a/examples/alphashapes/alphashapes3d.cpp Thu Sep 20 07:31:40 2007 -0400 +++ b/examples/alphashapes/alphashapes3d.cpp Thu Sep 20 08:02:49 2007 -0400 @@ -43,7 +43,7 @@ af.append(*cur); af.fill_simplex_index_map(); std::cout << "Filled simplex-index map" << std::endl; - af.pair_simplices(af.begin(), af.end()); + af.pair_simplices(af.begin(), af.end(), false); std::cout << "Simplices paired" << std::endl; for (AlphaFiltration::Index i = af.begin(); i != af.end(); ++i) diff -r addeb7563cb2 -r aee8f549d324 examples/cech-complex/cech-complex.cpp --- a/examples/cech-complex/cech-complex.cpp Thu Sep 20 07:31:40 2007 -0400 +++ b/examples/cech-complex/cech-complex.cpp Thu Sep 20 08:02:49 2007 -0400 @@ -73,6 +73,9 @@ int main(int argc, char** argv) { + SetFrequency(GetCounter("filtration/pair"), 10000); + SetTrigger(GetCounter("filtration/pair"), GetCounter("")); + // Read in the point set and compute its Delaunay triangulation std::istream& in = std::cin; int ambient_d, homology_d; @@ -114,7 +117,7 @@ // Compute persistence cf.fill_simplex_index_map(); - cf.pair_simplices(cf.begin(), cf.end()); + cf.pair_simplices(cf.begin(), cf.end(), false); std::cout << "Simplices paired" << std::endl; for (CechFiltration::Index i = cf.begin(); i != cf.end(); ++i) diff -r addeb7563cb2 -r aee8f549d324 include/topology/filtration.h --- a/include/topology/filtration.h Thu Sep 20 07:31:40 2007 -0400 +++ b/include/topology/filtration.h Thu Sep 20 08:02:49 2007 -0400 @@ -59,8 +59,8 @@ /// \name Core Functionality /// @{ /// Computes RU decomposition of the simplices in [bg, end) range, assuming that everything before bg has been paired - void pair_simplices(Index bg, Index end); - void pair_simplices() { pair_simplices(begin(), end()); } + void pair_simplices(Index bg, Index end, bool store_trails = true); + void pair_simplices(bool store_trails = true) { pair_simplices(begin(), end(), store_trails); } bool transpose(Index i, bool maintain_lazy = true); bool is_paired() const; Index append(const Simplex& s); ///< Appends s to the filtration @@ -107,6 +107,7 @@ void pairing_switch(Index i, Index j); bool paired; + bool trails_stored; SimplexMap inverse_simplices; Vineyard* vineyard_; diff -r addeb7563cb2 -r aee8f549d324 include/topology/filtration.hpp --- a/include/topology/filtration.hpp Thu Sep 20 07:31:40 2007 -0400 +++ b/include/topology/filtration.hpp Thu Sep 20 08:02:49 2007 -0400 @@ -44,8 +44,13 @@ template<class S, class FS, class V> void Filtration<S, FS, V>:: -pair_simplices(Index bg, Index end) +pair_simplices(Index bg, Index end, bool store_trails) { + if (!is_paired()) + trails_stored = store_trails; + else + trails_stored &= store_trails; + rLog(rlFiltration, "Entered: compute_pairing"); for (Index j = bg; j != end; ++j) { @@ -81,7 +86,7 @@ rLog(rlFiltration, " Adding: [%s] + [%s]", tostring(bdry).c_str(), tostring(i->pair()->cycle()).c_str()); bdry.add(i->pair()->cycle(), get_consistency_cmp()); - i->pair()->trail().append(j, get_consistency_cmp()); + if (store_trails) i->pair()->trail().append(j, get_consistency_cmp()); Count(cFiltrationPairTrailLength); rLog(rlFiltration, "After addition: %s", tostring(bdry).c_str()); } @@ -107,6 +112,7 @@ transpose(Index i, bool maintain_lazy) { AssertMsg(vineyard() != 0, "We must have a vineyard for transpositions"); + AssertMsg(trails_stored, "We must have trails (matrix U) to perform transpositions"); Index i_orig = i++;