summaryrefslogtreecommitdiff
path: root/src/python/include/Persistent_cohomology_interface.h
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2020-03-07 14:05:05 +0100
committerMarc Glisse <marc.glisse@inria.fr>2020-03-07 14:05:05 +0100
commit35e08b30836fb0c419c0377eaf51d2a3b16e7670 (patch)
treef6e659e8d0b0b37c8ee4576a075fd727bcddd313 /src/python/include/Persistent_cohomology_interface.h
parent64199fd8037556f135f90102ba8270cccf9d3e60 (diff)
min_persistence for generators
Diffstat (limited to 'src/python/include/Persistent_cohomology_interface.h')
-rw-r--r--src/python/include/Persistent_cohomology_interface.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/python/include/Persistent_cohomology_interface.h b/src/python/include/Persistent_cohomology_interface.h
index 6e9aac52..8e721fc0 100644
--- a/src/python/include/Persistent_cohomology_interface.h
+++ b/src/python/include/Persistent_cohomology_interface.h
@@ -95,11 +95,10 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
}
// TODO: (possibly at the python level)
- // - an option to ignore intervals of length 0?
// - an option to return only some of those vectors?
typedef std::pair<std::vector<std::vector<int>>, std::vector<std::vector<int>>> Generators;
- Generators lower_star_generators() {
+ Generators lower_star_generators(double min_persistence) {
Generators out;
// diags[i] should be interpreted as vector<array<int,2>>
auto& diags = out.first;
@@ -108,6 +107,8 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
for (auto pair : Base::get_persistent_pairs()) {
auto s = std::get<0>(pair);
auto t = std::get<1>(pair);
+ if(stptr_->filtration(t) - stptr_->filtration(s) <= min_persistence)
+ continue;
int dim = stptr_->dimension(s);
auto v = stptr_->vertex_with_same_filtration(s);
if(t == stptr_->null_simplex()) {
@@ -123,7 +124,8 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
return out;
}
- Generators flag_generators() {
+ // An alternative, to avoid those different sizes, would be to "pad" vertex generator v as (v, v) or (v, -1). When using it as index, this corresponds to adding the vertex filtration values either on the diagonal of the distance matrix, or as an extra row or column.
+ Generators flag_generators(double min_persistence) {
Generators out;
// diags[0] should be interpreted as vector<array<int,3>> and other diags[i] as vector<array<int,4>>
auto& diags = out.first;
@@ -132,6 +134,8 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
for (auto pair : Base::get_persistent_pairs()) {
auto s = std::get<0>(pair);
auto t = std::get<1>(pair);
+ if(stptr_->filtration(t) - stptr_->filtration(s) <= min_persistence)
+ continue;
int dim = stptr_->dimension(s);
bool infinite = t == stptr_->null_simplex();
if(infinite) {