Intermediate commit while converting to the new architecture
* Converted Filtration into StaticPersistence and DynamicPersistenceTrails
(both right now work with the underlying std::vector rather than std::list order)
* Filtration is now just an auxilliary glue (a map between Complex and Persistence)
* Whether chains are vectors or lists can be interchanged
* Added PersistenceDiagram with a simple bottleneck_distance() function
* Converted triangle, alphashapes3d, and cech-complex examples
* Lots of organizational changes
(factoring utilities out into containers.h, indirect.h, property-maps.h)
* Trying to document along the way with NaturalDocs-type comments
#include "utilities/containers.h"
template<class C, class I, class CT>
template<class Comparison>
Filtration<C,I,CT>::
Filtration(ComplexIndex bg, ComplexIndex end, const Comparison& cmp):
order_(RecursiveIterator<ComplexIndex>(bg),
RecursiveIterator<ComplexIndex>(end)),
reverse_order_(order_.size()),
complex_order_map_(bg, reverse_order_.begin()),
simplex_index_map_(bg, end)
{
std::sort(order_.begin(), order_.end(), IndirectComparison<ComplexIndex, Comparison>(cmp));
for (Index obg = order_.begin(), cur = obg; cur != order_.end(); ++cur)
reverse_order_[*cur - bg] = cur - obg;
}
template<class C, class I, class CT>
template<class Cycle, class Map>
void
Filtration<C,I,CT>::
boundary(const Index& i, Cycle& bdry, const Map& map) const
{
AssertMsg(bdry.empty(), "We are initializing the boundary from scratch");
SimplexBoundary simplex_bdry = (*i)->boundary();
ContainerTraits<Cycle>::reserve(bdry, simplex_bdry.size());
typename Map::template rebind_from<IntermediateIndex>::other order_bdry_map(0, map.to());
for (typename SimplexBoundary::const_iterator cur = simplex_bdry.begin(); cur != simplex_bdry.end(); ++cur)
{
//std::cout << *cur << std::endl;
//std::cout << simplex_index_map_[*cur] - complex_order_map_.from() << std::endl;
bdry.push_back(order_bdry_map[*complex_order_map_[simplex_index_map_[*cur]]]);
//std::cout << bdry.back() - order_bdry_map.to() << std::endl;
}
}
template<class C, class I, class CT>
std::ostream&
Filtration<C,I,CT>::
operator<<(std::ostream& out) const
{
for (Index i = begin(); i != end(); ++i)
out << **i << std::endl;
return out;
}