summaryrefslogtreecommitdiff
path: root/matching/include
diff options
context:
space:
mode:
Diffstat (limited to 'matching/include')
-rw-r--r--matching/include/matching_distance.h2
-rw-r--r--matching/include/matching_distance.hpp1
-rw-r--r--matching/include/persistence_module.h2
-rw-r--r--matching/include/persistence_module.hpp19
4 files changed, 17 insertions, 7 deletions
diff --git a/matching/include/matching_distance.h b/matching/include/matching_distance.h
index 276cc3a..e82a97c 100644
--- a/matching/include/matching_distance.h
+++ b/matching/include/matching_distance.h
@@ -152,7 +152,7 @@ namespace md {
int max_depth {6}; // maximal number of refinenemnts
int initialization_depth {3};
int dim {0}; // in which dim to calculate the distance; use ALL_DIMENSIONS to get max over all dims
- BoundStrategy bound_strategy {BoundStrategy::bruteforce};
+ BoundStrategy bound_strategy {BoundStrategy::local_combined};
TraverseStrategy traverse_strategy {TraverseStrategy::breadth_first};
bool tolerate_max_iter_exceeded {true};
Real actual_error {std::numeric_limits<Real>::max()};
diff --git a/matching/include/matching_distance.hpp b/matching/include/matching_distance.hpp
index 48c8464..7cff073 100644
--- a/matching/include/matching_distance.hpp
+++ b/matching/include/matching_distance.hpp
@@ -193,6 +193,7 @@ namespace md {
// make all coordinates non-negative
auto min_coord = std::min(module_a_.minimal_coordinate(),
module_b_.minimal_coordinate());
+ spd::debug("in DistanceCalculator ctor, min_coord = {}", min_coord);
if (min_coord < 0) {
module_a_.translate(-min_coord);
module_b_.translate(-min_coord);
diff --git a/matching/include/persistence_module.h b/matching/include/persistence_module.h
index e99771f..4a261bb 100644
--- a/matching/include/persistence_module.h
+++ b/matching/include/persistence_module.h
@@ -47,7 +47,7 @@ namespace md {
IndexVec components_;
Relation() {}
- Relation(const Point<Real>& _pos, const IndexVec& _components);
+ Relation(const Point<Real>& _pos, const IndexVec& _components) : position_(_pos), components_(_components) {}
Real get_x() const { return position_.x; }
Real get_y() const { return position_.y; }
diff --git a/matching/include/persistence_module.hpp b/matching/include/persistence_module.hpp
index 6e49b2e..128fed9 100644
--- a/matching/include/persistence_module.hpp
+++ b/matching/include/persistence_module.hpp
@@ -34,10 +34,10 @@ namespace md {
template<class Real>
void ModulePresentation<Real>::init_boundaries()
{
- max_x_ = std::numeric_limits<Real>::max();
- max_y_ = std::numeric_limits<Real>::max();
- min_x_ = -std::numeric_limits<Real>::max();
- min_y_ = -std::numeric_limits<Real>::max();
+ max_x_ = -std::numeric_limits<Real>::max();
+ max_y_ = -std::numeric_limits<Real>::max();
+ min_x_ = std::numeric_limits<Real>::max();
+ min_y_ = std::numeric_limits<Real>::max();
for(const auto& gen : positions_) {
min_x_ = std::min(gen.x, min_x_);
@@ -55,6 +55,7 @@ namespace md {
generators_(_generators),
relations_(_relations)
{
+ positions_ = concat_gen_and_rel_positions(generators_, relations_);
init_boundaries();
}
@@ -85,6 +86,7 @@ namespace md {
void ModulePresentation<Real>::project_generators(const DualPoint<Real>& slice,
IndexVec& sorted_indices, RealVec& projections) const
{
+ spd::debug("Enter project_generators, slice = {}", slice);
size_t num_gens = generators_.size();
RealVec gen_values;
@@ -97,6 +99,7 @@ namespace md {
projections.reserve(num_gens);
for(auto i : sorted_indices) {
projections.push_back(gen_values[i]);
+ spd::debug("added push = {}", gen_values[i]);
}
}
@@ -104,6 +107,8 @@ namespace md {
void ModulePresentation<Real>::project_relations(const DualPoint<Real>& slice, IndexVec& sorted_rel_indices,
RealVec& projections) const
{
+
+ spd::debug("Enter project_relations, slice = {}", slice);
size_t num_rels = relations_.size();
RealVec rel_values;
@@ -116,12 +121,14 @@ namespace md {
projections.reserve(num_rels);
for(auto i : sorted_rel_indices) {
projections.push_back(rel_values[i]);
+ spd::debug("added push = {}", rel_values[i]);
}
}
template<class Real>
Diagram<Real> ModulePresentation<Real>::weighted_slice_diagram(const DualPoint<Real>& slice) const
{
+ spd::debug("Enter weighted_slice_diagram, slice = {}", slice);
IndexVec sorted_gen_indices, sorted_rel_indices;
RealVec gen_projections, rel_projections;
@@ -138,7 +145,8 @@ namespace md {
j = sorted_gen_indices[j];
}
std::sort(current_relation.begin(), current_relation.end());
- phat_matrix.set_dim(i, current_relation.size());
+ // modules do not have dimension, set all to 0
+ phat_matrix.set_dim(i, 0);
phat_matrix.set_col(i, current_relation);
}
@@ -154,6 +162,7 @@ namespace md {
bool is_finite_pair = new_pair.second != phat::k_infinity_index;
Real birth = gen_projections.at(new_pair.first);
Real death = is_finite_pair ? rel_projections.at(new_pair.second) : real_inf;
+ spd::debug("i = {}, birth = {}, death = {}", i, new_pair.first, new_pair.second);
if (birth != death) {
dgm.emplace_back(birth, death);
}