summaryrefslogtreecommitdiff
path: root/matching/include/phat/compute_persistence_pairs.h
diff options
context:
space:
mode:
Diffstat (limited to 'matching/include/phat/compute_persistence_pairs.h')
-rw-r--r--matching/include/phat/compute_persistence_pairs.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/matching/include/phat/compute_persistence_pairs.h b/matching/include/phat/compute_persistence_pairs.h
index 48be65c..06f5372 100644
--- a/matching/include/phat/compute_persistence_pairs.h
+++ b/matching/include/phat/compute_persistence_pairs.h
@@ -97,14 +97,23 @@ namespace phat {
ReductionAlgorithm reduce;
reduce( boundary_matrix );
pairs.clear();
+ std::set<index> max_indices;
+ // finite pairs
for( index idx = 0; idx < boundary_matrix.get_num_cols(); idx++ ) {
if( !boundary_matrix.is_empty( idx ) ) {
index birth = boundary_matrix.get_max_index( idx );
+ max_indices.insert(birth);
index death = idx;
pairs.append_pair( birth, death );
}
}
- }
+ // infinite pairs: column idx is 0, and row idx does not contain a lowest one
+ for( index idx = 0; idx < boundary_matrix.get_num_cols(); idx++ ) {
+ if(boundary_matrix.is_empty(idx) && max_indices.count(idx) == 0 ) {
+ pairs.append_pair( idx, k_infinity_index);
+ }
+ }
+ }
template< typename ReductionAlgorithm, typename Representation >
void compute_persistence_pairs_dualized( persistence_pairs& pairs, boundary_matrix< Representation >& boundary_matrix ) {