diff options
author | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-01-14 16:17:43 +0100 |
---|---|---|
committer | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-02-18 15:02:39 +0100 |
commit | ee65fce990b1dc683e1220c18c5f404a82373e55 (patch) | |
tree | 6c4aabba39f4f302024d17ff088d14653a12563e /matching/include/persistence_module.h | |
parent | 6942d80c4d49239bca9cace9833aa74aee11ddcb (diff) |
Interim: matching distance for modules
1. Templatize DistanceCalculator (DiagramProvider)
2. Add BifiltrationProxy with the same interface as ModulePresentation
(dimension fixed).
3. Call Hera with relative error.
4. Add class ModulePresentation.
To-Do: reading module presentations from Rivet format.
Diffstat (limited to 'matching/include/persistence_module.h')
-rw-r--r-- | matching/include/persistence_module.h | 63 |
1 files changed, 47 insertions, 16 deletions
diff --git a/matching/include/persistence_module.h b/matching/include/persistence_module.h index 50ae8d2..ea9cfd0 100644 --- a/matching/include/persistence_module.h +++ b/matching/include/persistence_module.h @@ -12,37 +12,68 @@ namespace md { - class Relation { + + class ModulePresentation { public: - Relation() {} - Relation(const Point& _pos) - :position_(_pos) { } + struct Relation { - Real get_x() const { return position_.x; } + Point position_; + IntPoint bigrade_; - Real get_y() const { return position_.y; } + Relation() {} + Relation(const Point& _pos) : position_(_pos) { } - private: - Point position_; - }; + Real get_x() const { return position_.x; } + Real get_y() const { return position_.y; } - class PersistenceModule { - public: - using Box = md::Box; + IndexVec components_; - PersistenceModule() { } + }; - PersistenceModule(const std::string& fname); // read from file + ModulePresentation() { } - Diagram slice_diagram(const DualPoint& line); + ModulePresentation(const std::string& fname); // read from file + Diagram weighted_slice_diagram(const DualPoint& line) const; + + // translate all points by vector (a,a) + void translate(Real a); + + // return minimal value of x- and y-coordinates + Real minimal_coordinate() const { return std::min(min_x(), min_x()); } + + // return box that contains all positions of all simplices Box bounding_box() const; + friend std::ostream& operator<<(std::ostream& os, const ModulePresentation& mp); + + Real max_x() const { return max_x_; } + + Real max_y() const { return max_y_; } + + Real min_x() const { return min_x_; } + + Real min_y() const { return min_y_; } + + PointVec positions() const; + private: - std::vector<Point> generators_; + + Real max_x_ { std::numeric_limits<Real>::max() }; + Real max_y_ { std::numeric_limits<Real>::max() }; + Real min_x_ { -std::numeric_limits<Real>::max() }; + Real min_y_ { -std::numeric_limits<Real>::max() }; + Box bounding_box_; + + PointVec generators_; std::vector<Relation> relations_; + PointVec positions_; + + void init_boundaries(); + void project_generators(const DualPoint& slice, IndexVec& sorted_indices, RealVec& projections) const; + void project_relations(const DualPoint& slice, IndexVec& sorted_indices, RealVec& projections) const; }; // template<typename R = double> |