diff options
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> |