multipers 2.4.0b1__cp312-cp312-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- multipers/.dylibs/libboost_timer.dylib +0 -0
- multipers/.dylibs/libc++.1.0.dylib +0 -0
- multipers/.dylibs/libtbb.12.17.dylib +0 -0
- multipers/__init__.py +33 -0
- multipers/_signed_measure_meta.py +426 -0
- multipers/_slicer_meta.py +231 -0
- multipers/array_api/__init__.py +62 -0
- multipers/array_api/numpy.py +124 -0
- multipers/array_api/torch.py +133 -0
- multipers/data/MOL2.py +458 -0
- multipers/data/UCR.py +18 -0
- multipers/data/__init__.py +1 -0
- multipers/data/graphs.py +466 -0
- multipers/data/immuno_regions.py +27 -0
- multipers/data/minimal_presentation_to_st_bf.py +0 -0
- multipers/data/pytorch2simplextree.py +91 -0
- multipers/data/shape3d.py +101 -0
- multipers/data/synthetic.py +113 -0
- multipers/distances.py +202 -0
- multipers/filtration_conversions.pxd +736 -0
- multipers/filtration_conversions.pxd.tp +226 -0
- multipers/filtrations/__init__.py +21 -0
- multipers/filtrations/density.py +529 -0
- multipers/filtrations/filtrations.py +480 -0
- multipers/filtrations.pxd +534 -0
- multipers/filtrations.pxd.tp +332 -0
- multipers/function_rips.cpython-312-darwin.so +0 -0
- multipers/function_rips.pyx +104 -0
- multipers/grids.cpython-312-darwin.so +0 -0
- multipers/grids.pyx +538 -0
- multipers/gudhi/Persistence_slices_interface.h +213 -0
- multipers/gudhi/Simplex_tree_interface.h +274 -0
- multipers/gudhi/Simplex_tree_multi_interface.h +648 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex.h +450 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_base.h +1070 -0
- multipers/gudhi/gudhi/Bitmap_cubical_complex_periodic_boundary_conditions_base.h +579 -0
- multipers/gudhi/gudhi/Debug_utils.h +52 -0
- multipers/gudhi/gudhi/Degree_rips_bifiltration.h +2307 -0
- multipers/gudhi/gudhi/Dynamic_multi_parameter_filtration.h +2524 -0
- multipers/gudhi/gudhi/Fields/Multi_field.h +453 -0
- multipers/gudhi/gudhi/Fields/Multi_field_operators.h +460 -0
- multipers/gudhi/gudhi/Fields/Multi_field_shared.h +444 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small.h +584 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_operators.h +490 -0
- multipers/gudhi/gudhi/Fields/Multi_field_small_shared.h +580 -0
- multipers/gudhi/gudhi/Fields/Z2_field.h +391 -0
- multipers/gudhi/gudhi/Fields/Z2_field_operators.h +389 -0
- multipers/gudhi/gudhi/Fields/Zp_field.h +493 -0
- multipers/gudhi/gudhi/Fields/Zp_field_operators.h +384 -0
- multipers/gudhi/gudhi/Fields/Zp_field_shared.h +492 -0
- multipers/gudhi/gudhi/Flag_complex_edge_collapser.h +337 -0
- multipers/gudhi/gudhi/Matrix.h +2200 -0
- multipers/gudhi/gudhi/Multi_filtration/Multi_parameter_generator.h +1712 -0
- multipers/gudhi/gudhi/Multi_filtration/multi_filtration_conversions.h +237 -0
- multipers/gudhi/gudhi/Multi_filtration/multi_filtration_utils.h +225 -0
- multipers/gudhi/gudhi/Multi_parameter_filtered_complex.h +485 -0
- multipers/gudhi/gudhi/Multi_parameter_filtration.h +2643 -0
- multipers/gudhi/gudhi/Multi_persistence/Box.h +233 -0
- multipers/gudhi/gudhi/Multi_persistence/Line.h +309 -0
- multipers/gudhi/gudhi/Multi_persistence/Multi_parameter_filtered_complex_pcoh_interface.h +268 -0
- multipers/gudhi/gudhi/Multi_persistence/Persistence_interface_cohomology.h +159 -0
- multipers/gudhi/gudhi/Multi_persistence/Persistence_interface_matrix.h +463 -0
- multipers/gudhi/gudhi/Multi_persistence/Point.h +853 -0
- multipers/gudhi/gudhi/Off_reader.h +173 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix.h +834 -0
- multipers/gudhi/gudhi/Persistence_matrix/Base_matrix_with_column_compression.h +838 -0
- multipers/gudhi/gudhi/Persistence_matrix/Boundary_matrix.h +833 -0
- multipers/gudhi/gudhi/Persistence_matrix/Chain_matrix.h +1367 -0
- multipers/gudhi/gudhi/Persistence_matrix/Id_to_index_overlay.h +1157 -0
- multipers/gudhi/gudhi/Persistence_matrix/Position_to_index_overlay.h +869 -0
- multipers/gudhi/gudhi/Persistence_matrix/RU_matrix.h +905 -0
- multipers/gudhi/gudhi/Persistence_matrix/allocators/entry_constructors.h +122 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_pairing.h +260 -0
- multipers/gudhi/gudhi/Persistence_matrix/base_swap.h +288 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_pairing.h +170 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_rep_cycles.h +247 -0
- multipers/gudhi/gudhi/Persistence_matrix/chain_vine_swap.h +571 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/chain_column_extra_properties.h +182 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_dimension_holder.h +130 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/column_utilities.h +235 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/entry_types.h +312 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/heap_column.h +1092 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_list_column.h +923 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/intrusive_set_column.h +914 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/list_column.h +930 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/naive_vector_column.h +1071 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/row_access.h +203 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/set_column.h +886 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/unordered_set_column.h +984 -0
- multipers/gudhi/gudhi/Persistence_matrix/columns/vector_column.h +1213 -0
- multipers/gudhi/gudhi/Persistence_matrix/index_mapper.h +58 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_dimension_holders.h +227 -0
- multipers/gudhi/gudhi/Persistence_matrix/matrix_row_access.h +200 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_pairing.h +166 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_rep_cycles.h +319 -0
- multipers/gudhi/gudhi/Persistence_matrix/ru_vine_swap.h +562 -0
- multipers/gudhi/gudhi/Persistence_on_a_line.h +152 -0
- multipers/gudhi/gudhi/Persistence_on_rectangle.h +617 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Field_Zp.h +118 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Multi_field.h +173 -0
- multipers/gudhi/gudhi/Persistent_cohomology/Persistent_cohomology_column.h +128 -0
- multipers/gudhi/gudhi/Persistent_cohomology.h +769 -0
- multipers/gudhi/gudhi/Points_off_io.h +171 -0
- multipers/gudhi/gudhi/Projective_cover_kernel.h +379 -0
- multipers/gudhi/gudhi/Simple_object_pool.h +69 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_iterators.h +559 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_node_explicit_storage.h +83 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_siblings.h +121 -0
- multipers/gudhi/gudhi/Simplex_tree/Simplex_tree_star_simplex_iterators.h +277 -0
- multipers/gudhi/gudhi/Simplex_tree/filtration_value_utils.h +155 -0
- multipers/gudhi/gudhi/Simplex_tree/hooks_simplex_base.h +62 -0
- multipers/gudhi/gudhi/Simplex_tree/indexing_tag.h +27 -0
- multipers/gudhi/gudhi/Simplex_tree/serialization_utils.h +60 -0
- multipers/gudhi/gudhi/Simplex_tree/simplex_tree_options.h +105 -0
- multipers/gudhi/gudhi/Simplex_tree.h +3170 -0
- multipers/gudhi/gudhi/Slicer.h +848 -0
- multipers/gudhi/gudhi/Thread_safe_slicer.h +393 -0
- multipers/gudhi/gudhi/distance_functions.h +62 -0
- multipers/gudhi/gudhi/graph_simplicial_complex.h +104 -0
- multipers/gudhi/gudhi/multi_simplex_tree_helpers.h +147 -0
- multipers/gudhi/gudhi/persistence_interval.h +263 -0
- multipers/gudhi/gudhi/persistence_matrix_options.h +188 -0
- multipers/gudhi/gudhi/reader_utils.h +367 -0
- multipers/gudhi/gudhi/simple_mdspan.h +484 -0
- multipers/gudhi/gudhi/slicer_helpers.h +779 -0
- multipers/gudhi/tmp_h0_pers/mma_interface_h0.h +223 -0
- multipers/gudhi/tmp_h0_pers/naive_merge_tree.h +536 -0
- multipers/io.cpython-312-darwin.so +0 -0
- multipers/io.pyx +472 -0
- multipers/ml/__init__.py +0 -0
- multipers/ml/accuracies.py +90 -0
- multipers/ml/invariants_with_persistable.py +79 -0
- multipers/ml/kernels.py +176 -0
- multipers/ml/mma.py +713 -0
- multipers/ml/one.py +472 -0
- multipers/ml/point_clouds.py +352 -0
- multipers/ml/signed_measures.py +1667 -0
- multipers/ml/sliced_wasserstein.py +461 -0
- multipers/ml/tools.py +113 -0
- multipers/mma_structures.cpython-312-darwin.so +0 -0
- multipers/mma_structures.pxd +134 -0
- multipers/mma_structures.pyx +1483 -0
- multipers/mma_structures.pyx.tp +1126 -0
- multipers/multi_parameter_rank_invariant/diff_helpers.h +85 -0
- multipers/multi_parameter_rank_invariant/euler_characteristic.h +95 -0
- multipers/multi_parameter_rank_invariant/function_rips.h +317 -0
- multipers/multi_parameter_rank_invariant/hilbert_function.h +761 -0
- multipers/multi_parameter_rank_invariant/persistence_slices.h +149 -0
- multipers/multi_parameter_rank_invariant/rank_invariant.h +350 -0
- multipers/multiparameter_edge_collapse.py +41 -0
- multipers/multiparameter_module_approximation/approximation.h +2541 -0
- multipers/multiparameter_module_approximation/debug.h +107 -0
- multipers/multiparameter_module_approximation/format_python-cpp.h +292 -0
- multipers/multiparameter_module_approximation/utilities.h +428 -0
- multipers/multiparameter_module_approximation.cpython-312-darwin.so +0 -0
- multipers/multiparameter_module_approximation.pyx +286 -0
- multipers/ops.cpython-312-darwin.so +0 -0
- multipers/ops.pyx +231 -0
- multipers/pickle.py +89 -0
- multipers/plots.py +550 -0
- multipers/point_measure.cpython-312-darwin.so +0 -0
- multipers/point_measure.pyx +409 -0
- multipers/simplex_tree_multi.cpython-312-darwin.so +0 -0
- multipers/simplex_tree_multi.pxd +136 -0
- multipers/simplex_tree_multi.pyx +11719 -0
- multipers/simplex_tree_multi.pyx.tp +2102 -0
- multipers/slicer.cpython-312-darwin.so +0 -0
- multipers/slicer.pxd +2097 -0
- multipers/slicer.pxd.tp +263 -0
- multipers/slicer.pyx +13042 -0
- multipers/slicer.pyx.tp +1259 -0
- multipers/tensor/tensor.h +672 -0
- multipers/tensor.pxd +13 -0
- multipers/test.pyx +44 -0
- multipers/tests/__init__.py +70 -0
- multipers/torch/__init__.py +1 -0
- multipers/torch/diff_grids.py +240 -0
- multipers/torch/rips_density.py +310 -0
- multipers/vector_interface.pxd +46 -0
- multipers-2.4.0b1.dist-info/METADATA +131 -0
- multipers-2.4.0b1.dist-info/RECORD +184 -0
- multipers-2.4.0b1.dist-info/WHEEL +6 -0
- multipers-2.4.0b1.dist-info/licenses/LICENSE +21 -0
- multipers-2.4.0b1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
|
|
2
|
+
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
|
|
3
|
+
* Author(s): Hannah Schreiber
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2025 Inria
|
|
6
|
+
*
|
|
7
|
+
* Modification(s):
|
|
8
|
+
* - YYYY/MM Author: Description of the modification
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @file Multi_parameter_filtered_complex_pcoh_interface.h
|
|
13
|
+
* @author Hannah Schreiber
|
|
14
|
+
* @brief Contains the @ref Gudhi::multi_persistence::Multi_parameter_filtered_complex_pcoh_interface class.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef MP_COMPLEX_PCOH_INTERFACE_H_INCLUDED
|
|
18
|
+
#define MP_COMPLEX_PCOH_INTERFACE_H_INCLUDED
|
|
19
|
+
|
|
20
|
+
#include <utility>
|
|
21
|
+
#include <vector>
|
|
22
|
+
|
|
23
|
+
#include <gudhi/Debug_utils.h>
|
|
24
|
+
#include <gudhi/Multi_parameter_filtered_complex.h>
|
|
25
|
+
|
|
26
|
+
namespace Gudhi {
|
|
27
|
+
namespace multi_persistence {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @class Multi_parameter_filtered_complex_pcoh_interface Multi_parameter_filtered_complex_pcoh_interface.h \
|
|
31
|
+
* gudhi/Multi_persistence/Multi_parameter_filtered_complex_pcoh_interface.h
|
|
32
|
+
* @ingroup multi_persistence
|
|
33
|
+
*
|
|
34
|
+
* @brief Interface respecting the @ref FilteredComplex concept to use
|
|
35
|
+
* @ref Gudhi::persistent_cohomology::Persistent_cohomology with an instantiation of
|
|
36
|
+
* @ref Multi_parameter_filtered_complex.
|
|
37
|
+
*
|
|
38
|
+
* @tparam MultiFiltrationValue Filtration value type used in @ref Multi_parameter_filtered_complex.
|
|
39
|
+
*/
|
|
40
|
+
template <class MultiFiltrationValue>
|
|
41
|
+
class Multi_parameter_filtered_complex_pcoh_interface
|
|
42
|
+
{
|
|
43
|
+
public:
|
|
44
|
+
using Complex = Multi_parameter_filtered_complex<MultiFiltrationValue>; /**< Complex type */
|
|
45
|
+
using Simplex_key = std::uint32_t; /**< Simplex_key type */
|
|
46
|
+
using Simplex_handle = Simplex_key; /**< Simplex_handle type */
|
|
47
|
+
using Filtration_value = Simplex_key; /**< Internal filtration value type */
|
|
48
|
+
using Dimension = int; /**< Internal dimension type */
|
|
49
|
+
using Map = std::vector<Simplex_handle>; /**< Map type */
|
|
50
|
+
using Filtration_simplex_range = Map; /**< Filtration_simplex_range type */
|
|
51
|
+
using Boundary_simplex_range = Map; /**< Boundary_simplex_range type */
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @brief Default constructor, storing null pointers.Can be tested with @ref is_initialized(), but any other method
|
|
55
|
+
* should not be used with this constructor.
|
|
56
|
+
*/
|
|
57
|
+
Multi_parameter_filtered_complex_pcoh_interface() : boundaries_(nullptr), newToOldPerm_(nullptr) {}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @brief Constructs the interface and stores a pointer to the given complex and the given permutation. Assumes that
|
|
61
|
+
* the pointers remain valid through the whole life of the instance. If they get invalidated, they can be updated
|
|
62
|
+
* via the copy/move constructors if the content did not change (otherwise, reconstruct from scratch with
|
|
63
|
+
* @ref reinitialize).
|
|
64
|
+
*
|
|
65
|
+
* @param boundaries Complex to interface.
|
|
66
|
+
* @param permutation Permutation map indicating the order of the cells stored in @p boundaries as a standard
|
|
67
|
+
* 1-dimensional filtration. I.e., `permutation[i]` corresponds to the index in `boundaries` which should be
|
|
68
|
+
* used as the i-th cell in the filtration.
|
|
69
|
+
*/
|
|
70
|
+
Multi_parameter_filtered_complex_pcoh_interface(const Complex &boundaries, const Map &permutation)
|
|
71
|
+
: boundaries_(&boundaries), newToOldPerm_(&permutation), keys_(boundaries.get_number_of_cycle_generators(), -1)
|
|
72
|
+
{}
|
|
73
|
+
|
|
74
|
+
Multi_parameter_filtered_complex_pcoh_interface(const Multi_parameter_filtered_complex_pcoh_interface &other) =
|
|
75
|
+
delete;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @brief Copy constructor. Copies the complex pointer from @p other and updates the permutation pointer with the
|
|
79
|
+
* given map if the complex was initialized.
|
|
80
|
+
*
|
|
81
|
+
* @param other Interface to copy.
|
|
82
|
+
* @param permutation Permutation map. Has to correspond to the same map than in @p other, except that its address
|
|
83
|
+
* does not have to be the same.
|
|
84
|
+
*/
|
|
85
|
+
Multi_parameter_filtered_complex_pcoh_interface(const Multi_parameter_filtered_complex_pcoh_interface &other,
|
|
86
|
+
const Map &permutation)
|
|
87
|
+
: boundaries_(other.boundaries_),
|
|
88
|
+
newToOldPerm_(boundaries_ != nullptr ? &permutation : nullptr),
|
|
89
|
+
keys_(other.keys_)
|
|
90
|
+
{
|
|
91
|
+
GUDHI_CHECK(!other.is_initialized() || permutation == *other.newToOldPerm_,
|
|
92
|
+
"Only the address of the permutation vector is allowed to change, not its content.");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @brief Copy constructor. Updates the pointers with the given complex and map if @p other was initialized.
|
|
97
|
+
*
|
|
98
|
+
* @param other Interface to copy.
|
|
99
|
+
* @param boundaries Complex. Has to correspond to the same complex than in @p other, except that its address
|
|
100
|
+
* does not have to be the same.
|
|
101
|
+
* @param permutation Permutation map. Has to correspond to the same map than in @p other, except that its address
|
|
102
|
+
* does not have to be the same.
|
|
103
|
+
*/
|
|
104
|
+
Multi_parameter_filtered_complex_pcoh_interface(const Multi_parameter_filtered_complex_pcoh_interface &other,
|
|
105
|
+
const Complex &boundaries,
|
|
106
|
+
const Map &permutation)
|
|
107
|
+
: boundaries_(other.is_initialized() ? &boundaries : nullptr),
|
|
108
|
+
newToOldPerm_(other.is_initialized() ? &permutation : nullptr),
|
|
109
|
+
keys_(other.keys_)
|
|
110
|
+
{
|
|
111
|
+
GUDHI_CHECK(!other.is_initialized() || permutation == *other.newToOldPerm_,
|
|
112
|
+
"Only the address of the permutation vector is allowed to change, not its content.");
|
|
113
|
+
GUDHI_CHECK(!other.is_initialized() || boundaries.get_boundaries() == *other.boundaries_->get_boundaries(),
|
|
114
|
+
"Only the address of the complex is allowed to change, not its content.");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
Multi_parameter_filtered_complex_pcoh_interface(Multi_parameter_filtered_complex_pcoh_interface &&other) = delete;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @brief Move constructor. Moves the complex pointer from @p other and updates the permutation pointer with the
|
|
121
|
+
* given map if the complex was initialized.
|
|
122
|
+
*
|
|
123
|
+
* @param other Interface to move.
|
|
124
|
+
* @param permutation Permutation map. Has to correspond to the same map than in @p other, except that its address
|
|
125
|
+
* does not have to be the same.
|
|
126
|
+
*/
|
|
127
|
+
Multi_parameter_filtered_complex_pcoh_interface(Multi_parameter_filtered_complex_pcoh_interface &&other,
|
|
128
|
+
const Map &permutation)
|
|
129
|
+
: boundaries_(std::exchange(other.boundaries_, nullptr)),
|
|
130
|
+
newToOldPerm_(boundaries_ != nullptr ? &permutation : nullptr),
|
|
131
|
+
keys_(std::move(other.keys_))
|
|
132
|
+
{
|
|
133
|
+
other.newToOldPerm_ = nullptr;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @brief Move constructor. Updates the pointers with the given complex and map if @p other was initialized.
|
|
138
|
+
*
|
|
139
|
+
* @param other Interface to move.
|
|
140
|
+
* @param boundaries Complex. Has to correspond to the same complex than in @p other, except that its address
|
|
141
|
+
* does not have to be the same.
|
|
142
|
+
* @param permutation Permutation map. Has to correspond to the same map than in @p other, except that its address
|
|
143
|
+
* does not have to be the same.
|
|
144
|
+
*/
|
|
145
|
+
Multi_parameter_filtered_complex_pcoh_interface(Multi_parameter_filtered_complex_pcoh_interface &&other,
|
|
146
|
+
const Complex &boundaries,
|
|
147
|
+
const Map &permutation)
|
|
148
|
+
: boundaries_(other.is_initialized() ? &boundaries : nullptr),
|
|
149
|
+
newToOldPerm_(other.is_initialized() ? &permutation : nullptr),
|
|
150
|
+
keys_(std::move(other.keys_))
|
|
151
|
+
{
|
|
152
|
+
other.boundaries_ = nullptr;
|
|
153
|
+
other.newToOldPerm_ = nullptr;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
~Multi_parameter_filtered_complex_pcoh_interface() = default;
|
|
157
|
+
|
|
158
|
+
Multi_parameter_filtered_complex_pcoh_interface &operator=(
|
|
159
|
+
const Multi_parameter_filtered_complex_pcoh_interface &other) = delete;
|
|
160
|
+
Multi_parameter_filtered_complex_pcoh_interface &operator=(
|
|
161
|
+
Multi_parameter_filtered_complex_pcoh_interface &&other) noexcept = delete;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @brief Swap operator.
|
|
165
|
+
*/
|
|
166
|
+
friend void swap(Multi_parameter_filtered_complex_pcoh_interface &be1,
|
|
167
|
+
Multi_parameter_filtered_complex_pcoh_interface &be2) noexcept
|
|
168
|
+
{
|
|
169
|
+
std::swap(be1.boundaries_, be2.boundaries_);
|
|
170
|
+
std::swap(be1.newToOldPerm_, be2.newToOldPerm_);
|
|
171
|
+
be1.keys_.swap(be2.keys_);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @brief Reinitializes the interface with the new given complex and permutation.
|
|
176
|
+
* To use instead of the classical assign operator `operator=`.
|
|
177
|
+
*/
|
|
178
|
+
void reinitialize(const Complex &boundaries, const Map &permutation)
|
|
179
|
+
{
|
|
180
|
+
boundaries_ = &boundaries;
|
|
181
|
+
newToOldPerm_ = &permutation;
|
|
182
|
+
keys_ = Map(boundaries.get_number_of_cycle_generators(), -1);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
void reset()
|
|
186
|
+
{
|
|
187
|
+
boundaries_ = nullptr;
|
|
188
|
+
newToOldPerm_ = nullptr;
|
|
189
|
+
keys_.clear();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @brief Returns `true` if and only if all pointers are not null.
|
|
194
|
+
*/
|
|
195
|
+
[[nodiscard]] bool is_initialized() const { return boundaries_ != nullptr && newToOldPerm_ != nullptr; }
|
|
196
|
+
|
|
197
|
+
[[nodiscard]] std::size_t num_simplices() const { return newToOldPerm_->size(); }
|
|
198
|
+
|
|
199
|
+
[[nodiscard]] Filtration_value filtration(Simplex_handle sh) const
|
|
200
|
+
{
|
|
201
|
+
return sh == null_simplex() ? std::numeric_limits<Filtration_value>::max() : keys_[sh];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
[[nodiscard]] Dimension dimension() const { return boundaries_->get_max_dimension(); }
|
|
205
|
+
|
|
206
|
+
[[nodiscard]] Dimension dimension(Simplex_handle sh) const
|
|
207
|
+
{
|
|
208
|
+
return sh == null_simplex() ? -1 : boundaries_->get_dimensions()[sh];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// assumes that pcoh will assign the keys from 0 to n in order of filtrations
|
|
212
|
+
void assign_key(Simplex_handle sh, Simplex_key key)
|
|
213
|
+
{
|
|
214
|
+
if (sh != null_simplex()) keys_[sh] = key;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
[[nodiscard]] Simplex_key key(Simplex_handle sh) const { return sh == null_simplex() ? null_key() : keys_[sh]; }
|
|
218
|
+
|
|
219
|
+
static constexpr Simplex_key null_key() { return static_cast<Simplex_key>(-1); }
|
|
220
|
+
|
|
221
|
+
[[nodiscard]] Simplex_handle simplex(Simplex_key key) const
|
|
222
|
+
{
|
|
223
|
+
return key == null_key() ? null_simplex() : (*newToOldPerm_)[key];
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static constexpr Simplex_handle null_simplex() { return static_cast<Simplex_handle>(-1); }
|
|
227
|
+
|
|
228
|
+
// only used in update_cohomology_groups_edge, so not used without optimizations
|
|
229
|
+
[[nodiscard]] std::pair<Simplex_handle, Simplex_handle> endpoints(Simplex_handle sh) const
|
|
230
|
+
{
|
|
231
|
+
if (sh == null_simplex()) return {null_simplex(), null_simplex()};
|
|
232
|
+
GUDHI_CHECK(dimension(sh) == 1, "Endpoints only available for edges.");
|
|
233
|
+
const auto &col = boundary_simplex_range(sh);
|
|
234
|
+
GUDHI_CHECK(col.size() == 2, "Edge should have two vertices as border.");
|
|
235
|
+
return {col[0], col[1]};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
[[nodiscard]] const Filtration_simplex_range &filtration_simplex_range() const { return *newToOldPerm_; }
|
|
239
|
+
|
|
240
|
+
[[nodiscard]] const Boundary_simplex_range &boundary_simplex_range(Simplex_handle sh) const
|
|
241
|
+
{
|
|
242
|
+
return boundaries_->get_boundaries()[sh];
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
friend std::ostream &operator<<(std::ostream &stream,
|
|
246
|
+
const Multi_parameter_filtered_complex_pcoh_interface &complex)
|
|
247
|
+
{
|
|
248
|
+
stream << "[\n";
|
|
249
|
+
for (auto i : complex.filtration_simplex_range()) {
|
|
250
|
+
stream << "[";
|
|
251
|
+
for (const auto &idx : complex.boundary_simplex_range(i)) stream << complex.keys_[idx] << ", ";
|
|
252
|
+
stream << "]\n";
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
stream << "]\n";
|
|
256
|
+
return stream;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
private:
|
|
260
|
+
Complex const *boundaries_; /**< Pointer to complex. */
|
|
261
|
+
Map const *newToOldPerm_; /**< Pointer to filtration position to complex position map. */
|
|
262
|
+
Map keys_; /**< Keys assigned to a cell. TODO: potentially the identity. If yes, to remove. */
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
} // namespace multi_persistence
|
|
266
|
+
} // namespace Gudhi
|
|
267
|
+
|
|
268
|
+
#endif // MP_COMPLEX_PCOH_INTERFACE_H_INCLUDED
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
|
|
2
|
+
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
|
|
3
|
+
* Author(s): Hannah Schreiber
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2025 Inria
|
|
6
|
+
*
|
|
7
|
+
* Modification(s):
|
|
8
|
+
* - YYYY/MM Author: Description of the modification
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @file Persistence_interface_cohomology.h
|
|
13
|
+
* @author Hannah Schreiber
|
|
14
|
+
* @brief Contains the @ref Gudhi::multi_persistence::Persistence_interface_cohomology class.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef MP_PERSISTENCE_INTERFACE_COHOMOLOGY_H_INCLUDED
|
|
18
|
+
#define MP_PERSISTENCE_INTERFACE_COHOMOLOGY_H_INCLUDED
|
|
19
|
+
|
|
20
|
+
#include <vector>
|
|
21
|
+
|
|
22
|
+
#include <boost/range/iterator_range_core.hpp>
|
|
23
|
+
|
|
24
|
+
#include <gudhi/Multi_persistence/Multi_parameter_filtered_complex_pcoh_interface.h>
|
|
25
|
+
#include <gudhi/persistence_interval.h>
|
|
26
|
+
#include <gudhi/Persistent_cohomology.h>
|
|
27
|
+
|
|
28
|
+
namespace Gudhi {
|
|
29
|
+
namespace multi_persistence {
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @class Persistence_interface_cohomology Persistence_interface_cohomology.h \
|
|
33
|
+
* gudhi/Multi_persistence/Persistence_interface_cohomology.h
|
|
34
|
+
* @ingroup multi_persistence
|
|
35
|
+
*
|
|
36
|
+
* @brief Interface respecting the @ref PersistenceAlgorithm concept to use @ref Slicer with the cohomology
|
|
37
|
+
* algorithm implemented in @ref Gudhi::persistent_cohomology::Persistent_cohomology.
|
|
38
|
+
*
|
|
39
|
+
* @tparam MultiFiltrationValue Filtration value type used in @ref Slicer.
|
|
40
|
+
*/
|
|
41
|
+
template <class MultiFiltrationValue>
|
|
42
|
+
class Persistence_interface_cohomology
|
|
43
|
+
{
|
|
44
|
+
public:
|
|
45
|
+
using PCOH_complex = Multi_parameter_filtered_complex_pcoh_interface<MultiFiltrationValue>;
|
|
46
|
+
using Complex = typename PCOH_complex::Complex; /**< Complex type */
|
|
47
|
+
using Dimension = typename PCOH_complex::Dimension; /**< Dimension type */
|
|
48
|
+
using Index = typename PCOH_complex::Simplex_key; /**< Index type */
|
|
49
|
+
using Map = typename PCOH_complex::Map; /**< Map type */
|
|
50
|
+
using Bar = Gudhi::persistence_matrix::Persistence_interval<Dimension, Index>; /**< Bar type */
|
|
51
|
+
using Field_Zp = Gudhi::persistent_cohomology::Field_Zp;
|
|
52
|
+
using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomology<PCOH_complex, Field_Zp>;
|
|
53
|
+
using Barcode = std::vector<Bar>; /**< Barcode type */
|
|
54
|
+
template<class Complex>
|
|
55
|
+
using As_type = Persistence_interface_cohomology<typename Complex::Filtration_value>; /**< This type. */
|
|
56
|
+
|
|
57
|
+
static constexpr const auto nullDeath = Bar::inf;
|
|
58
|
+
static constexpr const bool is_vine = false; /** False. */
|
|
59
|
+
static constexpr const bool has_rep_cycles = false; /** False. */
|
|
60
|
+
|
|
61
|
+
Persistence_interface_cohomology() : interface_(), barcode_() {}
|
|
62
|
+
|
|
63
|
+
// `permutation` is assumed to have stable size, i.e., its address never changes
|
|
64
|
+
Persistence_interface_cohomology(const Complex& cpx, const Map& permutation) : interface_(cpx, permutation)
|
|
65
|
+
{
|
|
66
|
+
_initialize();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Persistence_interface_cohomology(const Persistence_interface_cohomology& other) = delete;
|
|
70
|
+
|
|
71
|
+
// permutation is assumed to be the same than from the copied object, just its address can change
|
|
72
|
+
Persistence_interface_cohomology(const Persistence_interface_cohomology& other, const Map& permutation)
|
|
73
|
+
: interface_(other.interface_, permutation), barcode_(other.barcode_)
|
|
74
|
+
{}
|
|
75
|
+
|
|
76
|
+
Persistence_interface_cohomology(Persistence_interface_cohomology&& other) = delete;
|
|
77
|
+
|
|
78
|
+
// permutation is assumed to be the same than from the moved object, just its address can change
|
|
79
|
+
Persistence_interface_cohomology(Persistence_interface_cohomology&& other, const Map& permutation)
|
|
80
|
+
: interface_(std::move(other.interface_), permutation), barcode_(std::move(other.barcode_))
|
|
81
|
+
{}
|
|
82
|
+
|
|
83
|
+
~Persistence_interface_cohomology() = default;
|
|
84
|
+
|
|
85
|
+
Persistence_interface_cohomology& operator=(const Persistence_interface_cohomology& other) = delete;
|
|
86
|
+
Persistence_interface_cohomology& operator=(Persistence_interface_cohomology&& other) noexcept = delete;
|
|
87
|
+
|
|
88
|
+
// TODO: swap?
|
|
89
|
+
|
|
90
|
+
template <class Complex>
|
|
91
|
+
void reinitialize(const Complex& cpx, const Map& permutation)
|
|
92
|
+
{
|
|
93
|
+
interface_.reinitialize(cpx, permutation);
|
|
94
|
+
_initialize();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
void reset()
|
|
98
|
+
{
|
|
99
|
+
interface_.reset();
|
|
100
|
+
barcode_.clear();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[[nodiscard]] bool is_initialized() const { return interface_.is_initialized(); }
|
|
104
|
+
|
|
105
|
+
Dimension get_dimension(Index i) const
|
|
106
|
+
{
|
|
107
|
+
GUDHI_CHECK(is_initialized(), "Dimension can not be computed uninitialized.");
|
|
108
|
+
return interface_.dimension(interface_.simplex(i));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const Barcode& get_barcode()
|
|
112
|
+
{
|
|
113
|
+
GUDHI_CHECK(is_initialized(), "Barcode can not be computed uninitialized.");
|
|
114
|
+
return barcode_;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @brief Outstream operator.
|
|
119
|
+
*/
|
|
120
|
+
friend std::ostream& operator<<(std::ostream& stream, const Persistence_interface_cohomology& pers)
|
|
121
|
+
{
|
|
122
|
+
stream << "Complex:\n";
|
|
123
|
+
stream << pers.interface_ << "\n";
|
|
124
|
+
stream << "Barcode:\n";
|
|
125
|
+
for (const auto bar : pers.barcode_) {
|
|
126
|
+
stream << bar << "\n";
|
|
127
|
+
}
|
|
128
|
+
stream << "\n";
|
|
129
|
+
|
|
130
|
+
return stream;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
private:
|
|
134
|
+
PCOH_complex interface_;
|
|
135
|
+
Barcode barcode_;
|
|
136
|
+
|
|
137
|
+
void _initialize()
|
|
138
|
+
{
|
|
139
|
+
Persistent_cohomology pcoh(interface_, true);
|
|
140
|
+
pcoh.init_coefficients(2);
|
|
141
|
+
pcoh.compute_persistent_cohomology_without_optimizations(0);
|
|
142
|
+
const auto& pairs = pcoh.get_persistent_pairs();
|
|
143
|
+
|
|
144
|
+
barcode_ = Barcode(pairs.size());
|
|
145
|
+
Index i = 0;
|
|
146
|
+
for (const auto& p : pairs) {
|
|
147
|
+
auto& b = barcode_[i];
|
|
148
|
+
b.dim = interface_.dimension(get<0>(p));
|
|
149
|
+
b.birth = get<0>(p);
|
|
150
|
+
b.death = get<1>(p) == PCOH_complex::null_simplex() ? Bar::inf : get<1>(p);
|
|
151
|
+
++i;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
} // namespace multi_persistence
|
|
157
|
+
} // namespace Gudhi
|
|
158
|
+
|
|
159
|
+
#endif // MP_PERSISTENCE_INTERFACE_COHOMOLOGY_H_INCLUDED
|