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.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/matching/include/phat/compute_persistence_pairs.h b/matching/include/phat/compute_persistence_pairs.h
index 06f5372..bd5e3ac 100644
--- a/matching/include/phat/compute_persistence_pairs.h
+++ b/matching/include/phat/compute_persistence_pairs.h
@@ -93,7 +93,7 @@ namespace phat {
}
template< typename ReductionAlgorithm, typename Representation >
- void compute_persistence_pairs( persistence_pairs& pairs, boundary_matrix< Representation >& boundary_matrix ) {
+ void compute_persistence_pairs( persistence_pairs& pairs, boundary_matrix< Representation >& boundary_matrix, bool for_persistence_module = false ) {
ReductionAlgorithm reduce;
reduce( boundary_matrix );
pairs.clear();
@@ -107,10 +107,19 @@ namespace phat {
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);
+ if (for_persistence_module) {
+ // infinite pairs for modules: if generator is not matched to relation, it lives forever
+ for( index idx = 0; idx < boundary_matrix.get_num_rows(0); idx++ ) {
+ if(max_indices.count(idx) == 0 ) {
+ pairs.append_pair( idx, k_infinity_index);
+ }
+ }
+ } else {
+ // 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);
+ }
}
}
}