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,853 @@
|
|
|
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 Point.h
|
|
13
|
+
* @author Hannah Schreiber
|
|
14
|
+
* @brief Contains the @ref Gudhi::multi_persistence::Point class.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
#ifndef MP_POINT_H_INCLUDED
|
|
18
|
+
#define MP_POINT_H_INCLUDED
|
|
19
|
+
|
|
20
|
+
#include <algorithm> //std::for_each
|
|
21
|
+
#include <ostream> //std::ostream
|
|
22
|
+
#include <vector>
|
|
23
|
+
|
|
24
|
+
#include <gudhi/Debug_utils.h>
|
|
25
|
+
#include <gudhi/Multi_filtration/multi_filtration_utils.h>
|
|
26
|
+
|
|
27
|
+
namespace Gudhi {
|
|
28
|
+
namespace multi_persistence {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @class Point Point.h gudhi/Multi_persistence/Point.h
|
|
32
|
+
* @ingroup multi_persistence
|
|
33
|
+
*
|
|
34
|
+
* @brief Simple point class with possibility to translate and multiply coordinates.
|
|
35
|
+
*
|
|
36
|
+
* @tparam T Type of the coordinates of the point.
|
|
37
|
+
*/
|
|
38
|
+
template <typename T>
|
|
39
|
+
class Point
|
|
40
|
+
{
|
|
41
|
+
public:
|
|
42
|
+
using Container = std::vector<T>; /**< Type of coordinate container. */
|
|
43
|
+
|
|
44
|
+
using value_type = typename Container::value_type; /**< Type of coordinates. */
|
|
45
|
+
using allocator_type = typename Container::allocator_type; /**< Allocator type. */
|
|
46
|
+
using size_type = typename Container::size_type; /**< Size type. */
|
|
47
|
+
using difference_type = typename Container::difference_type; /**< Difference type. */
|
|
48
|
+
using reference = typename Container::reference; /**< Coordinate reference type. */
|
|
49
|
+
using const_reference = typename Container::const_reference; /**< Coordinate const reference type. */
|
|
50
|
+
using pointer = typename Container::pointer; /**< Coordinate pointer type. */
|
|
51
|
+
using iterator = typename Container::iterator; /**< Coordinate iterator type. */
|
|
52
|
+
using const_iterator = typename Container::const_iterator; /**< Coordinate const iterator type. */
|
|
53
|
+
using reverse_iterator = typename Container::reverse_iterator; /**< Coordinate reverse iterator type. */
|
|
54
|
+
using const_reverse_iterator = typename Container::const_reverse_iterator; /**< Coordinate reverse iterator type. */
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @brief Default constructor.
|
|
58
|
+
*/
|
|
59
|
+
Point() = default;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @brief Constructs a new point with given number of coordinates. All values are default initialized.
|
|
63
|
+
*/
|
|
64
|
+
explicit Point(size_type count) : coordinates_(count) {}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @brief Constructs a new point with given number of coordinates. All values are initialized with given value.
|
|
68
|
+
*/
|
|
69
|
+
Point(size_type count, const T &value) : coordinates_(count, value) {}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @brief Constructs a new point from the given range.
|
|
73
|
+
*
|
|
74
|
+
* @tparam InputIt Iterator type that must follow the condition of the corresponding vector constructor.
|
|
75
|
+
*/
|
|
76
|
+
template <class InputIt>
|
|
77
|
+
Point(InputIt first, InputIt last) : coordinates_(first, last)
|
|
78
|
+
{}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @brief Constructs a new point from the given range.
|
|
82
|
+
*/
|
|
83
|
+
Point(std::initializer_list<T> init) : coordinates_(init.begin(), init.end()) {}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @brief Constructs a new point by copying the given container.
|
|
87
|
+
*/
|
|
88
|
+
Point(const Container &init) : coordinates_(init) {}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* @brief Constructs a new point by moving the given container.
|
|
92
|
+
*/
|
|
93
|
+
Point(Container &&init) : coordinates_(std::move(init)) {}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @brief Assign copy operator.
|
|
97
|
+
*/
|
|
98
|
+
Point &operator=(std::initializer_list<value_type> ilist)
|
|
99
|
+
{
|
|
100
|
+
coordinates_ = Container(ilist.begin(), ilist.end());
|
|
101
|
+
return *this;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
operator std::vector<T>() const { return coordinates_; }
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @brief At operator.
|
|
108
|
+
*/
|
|
109
|
+
reference at(size_type pos) { return coordinates_.at(pos); }
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @brief At operator.
|
|
113
|
+
*/
|
|
114
|
+
const_reference at(size_type pos) const { return coordinates_.at(pos); }
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @brief operator[].
|
|
118
|
+
*/
|
|
119
|
+
reference operator[](size_type pos) { return coordinates_[pos]; }
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @brief operator[].
|
|
123
|
+
*/
|
|
124
|
+
const_reference operator[](size_type pos) const { return coordinates_[pos]; }
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @brief Front operator.
|
|
128
|
+
*/
|
|
129
|
+
reference front() { return coordinates_.front(); }
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @brief Front operator.
|
|
133
|
+
*/
|
|
134
|
+
const_reference front() const { return coordinates_.front(); }
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @brief Back operator.
|
|
138
|
+
*/
|
|
139
|
+
reference back() { return coordinates_.back(); }
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @brief Back operator.
|
|
143
|
+
*/
|
|
144
|
+
const_reference back() const { return coordinates_.back(); }
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* @brief Data operator.
|
|
148
|
+
*/
|
|
149
|
+
T *data() noexcept { return coordinates_.data(); }
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @brief Data operator.
|
|
153
|
+
*/
|
|
154
|
+
const T *data() const noexcept { return coordinates_.data(); }
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @brief begin.
|
|
158
|
+
*/
|
|
159
|
+
iterator begin() noexcept { return coordinates_.begin(); }
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @brief begin.
|
|
163
|
+
*/
|
|
164
|
+
const_iterator begin() const noexcept { return coordinates_.begin(); }
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @brief cbegin.
|
|
168
|
+
*/
|
|
169
|
+
const_iterator cbegin() const noexcept { return coordinates_.cbegin(); }
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @brief end.
|
|
173
|
+
*/
|
|
174
|
+
iterator end() noexcept { return coordinates_.end(); }
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @brief end.
|
|
178
|
+
*/
|
|
179
|
+
const_iterator end() const noexcept { return coordinates_.end(); }
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @brief cend.
|
|
183
|
+
*/
|
|
184
|
+
const_iterator cend() const noexcept { return coordinates_.cend(); }
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* @brief rbegin.
|
|
188
|
+
*/
|
|
189
|
+
reverse_iterator rbegin() noexcept { return coordinates_.rbegin(); }
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @brief rbegin.
|
|
193
|
+
*/
|
|
194
|
+
const_reverse_iterator rbegin() const noexcept { return coordinates_.rbegin(); }
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @brief crbegin.
|
|
198
|
+
*/
|
|
199
|
+
const_reverse_iterator crbegin() const noexcept { return coordinates_.crbegin(); }
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @brief rend.
|
|
203
|
+
*/
|
|
204
|
+
reverse_iterator rend() noexcept { return coordinates_.rend(); }
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @brief rend.
|
|
208
|
+
*/
|
|
209
|
+
const_reverse_iterator rend() const noexcept { return coordinates_.rend(); }
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @brief crend.
|
|
213
|
+
*/
|
|
214
|
+
const_reverse_iterator crend() const noexcept { return coordinates_.crend(); }
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* @brief Number of coordinates.
|
|
218
|
+
*/
|
|
219
|
+
size_type size() const noexcept { return coordinates_.size(); }
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @brief Swap operator.
|
|
223
|
+
*/
|
|
224
|
+
void swap(Point &other) noexcept(std::allocator_traits<allocator_type>::propagate_on_container_swap::value ||
|
|
225
|
+
std::allocator_traits<allocator_type>::is_always_equal::value)
|
|
226
|
+
{
|
|
227
|
+
coordinates_.swap(other.coordinates_);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @brief Swap operator.
|
|
232
|
+
*/
|
|
233
|
+
friend void swap(Point &p1, Point &p2) noexcept { p1.coordinates_.swap(p2.coordinates_); }
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @brief Outstream operator.
|
|
237
|
+
*/
|
|
238
|
+
friend std::ostream &operator<<(std::ostream &os, const Point<T> &point)
|
|
239
|
+
{
|
|
240
|
+
os << "[ ";
|
|
241
|
+
for (const T &p : point) os << p << " ";
|
|
242
|
+
os << " ]";
|
|
243
|
+
return os;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @brief Returns true if and only if all coordinates of the first argument are strictly smaller than the ones of
|
|
248
|
+
* the second argument.
|
|
249
|
+
*
|
|
250
|
+
* Note that this order is not total.
|
|
251
|
+
*/
|
|
252
|
+
friend bool operator<(const Point &a, const Point &b)
|
|
253
|
+
{
|
|
254
|
+
if (&a == &b) return false;
|
|
255
|
+
GUDHI_CHECK(a.size() == b.size(), "Cannot compare two points with different number of coordinates.");
|
|
256
|
+
bool isSame = true;
|
|
257
|
+
for (size_type i = 0U; i < a.size(); ++i) {
|
|
258
|
+
if (a[i] > b[i] || Gudhi::multi_filtration::_is_nan(a[i]) || Gudhi::multi_filtration::_is_nan(b[i])) return false;
|
|
259
|
+
if (isSame && a[i] != b[i]) isSame = false;
|
|
260
|
+
}
|
|
261
|
+
return !isSame;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @brief Returns true if and only if all coordinates of the first argument are smaller or equal to the ones of
|
|
266
|
+
* the second argument.
|
|
267
|
+
*
|
|
268
|
+
* Note that this order is not total.
|
|
269
|
+
*/
|
|
270
|
+
friend bool operator<=(const Point &a, const Point &b)
|
|
271
|
+
{
|
|
272
|
+
if (&a == &b) return true;
|
|
273
|
+
GUDHI_CHECK(a.size() == b.size(), "Cannot compare two points with different number of coordinates.");
|
|
274
|
+
for (size_type i = 0U; i < a.size(); ++i) {
|
|
275
|
+
if (a[i] > b[i] || Gudhi::multi_filtration::_is_nan(a[i]) || Gudhi::multi_filtration::_is_nan(b[i])) return false;
|
|
276
|
+
}
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @brief Returns true if and only if all coordinates of the first argument are strictly greater than the ones of
|
|
282
|
+
* the second argument.
|
|
283
|
+
*
|
|
284
|
+
* Note that this order is not total.
|
|
285
|
+
*/
|
|
286
|
+
friend bool operator>(const Point &a, const Point &b) { return b < a; }
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @brief Returns true if and only if all coordinates of the first argument are greater or equal to the ones of
|
|
290
|
+
* the second argument.
|
|
291
|
+
*
|
|
292
|
+
* Note that this order is not total.
|
|
293
|
+
*/
|
|
294
|
+
friend bool operator>=(const Point &a, const Point &b) { return b <= a; }
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* @brief Returns `true` if and only if all coordinates of both arguments are equal.
|
|
298
|
+
*/
|
|
299
|
+
friend bool operator==(const Point &a, const Point &b)
|
|
300
|
+
{
|
|
301
|
+
if (&a == &b) return true;
|
|
302
|
+
if (a.size() != b.size()) return false;
|
|
303
|
+
return a.coordinates_ == b.coordinates_;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* @brief Returns `true` if and only if \f$ a == b \f$ returns `false`.
|
|
308
|
+
*/
|
|
309
|
+
friend bool operator!=(const Point &a, const Point &b) { return !(a == b); }
|
|
310
|
+
|
|
311
|
+
// ARITHMETIC OPERATORS
|
|
312
|
+
|
|
313
|
+
// opposite
|
|
314
|
+
/**
|
|
315
|
+
* @brief Returns a filtration value such that an entry at index \f$ p \f$ is equal to \f$ -f(p) \f$.
|
|
316
|
+
*
|
|
317
|
+
* Used conventions:
|
|
318
|
+
* - \f$ -NaN = NaN \f$.
|
|
319
|
+
*
|
|
320
|
+
* @param f Value to opposite.
|
|
321
|
+
* @return The opposite of @p f.
|
|
322
|
+
*/
|
|
323
|
+
friend Point operator-(const Point &f)
|
|
324
|
+
{
|
|
325
|
+
Point result(f.coordinates_);
|
|
326
|
+
std::for_each(result.begin(), result.end(), [](T &v) { v = -v; });
|
|
327
|
+
return result;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// subtraction
|
|
331
|
+
/**
|
|
332
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) - val(p) \f$.
|
|
333
|
+
* Both points have to have the same dimension.
|
|
334
|
+
*
|
|
335
|
+
* Used conventions:
|
|
336
|
+
* - \f$ inf - inf = NaN \f$,
|
|
337
|
+
* - \f$ -inf - (-inf) = NaN \f$,
|
|
338
|
+
* - \f$ NaN - b = NaN \f$,
|
|
339
|
+
* - \f$ a - NaN = NaN \f$.
|
|
340
|
+
*
|
|
341
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
342
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
343
|
+
*
|
|
344
|
+
* @param f First element of the subtraction.
|
|
345
|
+
* @param val Second element of the subtraction.
|
|
346
|
+
*/
|
|
347
|
+
template <typename U = T>
|
|
348
|
+
friend Point operator-(Point f, const Point<U> &val)
|
|
349
|
+
{
|
|
350
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
351
|
+
f -= val;
|
|
352
|
+
return f;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) - val \f$.
|
|
357
|
+
*
|
|
358
|
+
* Used conventions:
|
|
359
|
+
* - \f$ inf - inf = NaN \f$,
|
|
360
|
+
* - \f$ -inf - (-inf) = NaN \f$,
|
|
361
|
+
* - \f$ NaN - b = NaN \f$,
|
|
362
|
+
* - \f$ a - NaN = NaN \f$.
|
|
363
|
+
*
|
|
364
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
365
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
366
|
+
*
|
|
367
|
+
* @param f First element of the subtraction.
|
|
368
|
+
* @param val Second element of the subtraction.
|
|
369
|
+
*/
|
|
370
|
+
friend Point operator-(Point f, const T &val)
|
|
371
|
+
{
|
|
372
|
+
f -= val;
|
|
373
|
+
return f;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ val - f(p) \f$.
|
|
378
|
+
*
|
|
379
|
+
* Used conventions:
|
|
380
|
+
* - \f$ inf - inf = NaN \f$,
|
|
381
|
+
* - \f$ -inf - (-inf) = NaN \f$,
|
|
382
|
+
* - \f$ NaN - b = NaN \f$,
|
|
383
|
+
* - \f$ a - NaN = NaN \f$.
|
|
384
|
+
*
|
|
385
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
386
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
387
|
+
*
|
|
388
|
+
* @param val First element of the subtraction.
|
|
389
|
+
* @param f Second element of the subtraction.
|
|
390
|
+
*/
|
|
391
|
+
friend Point operator-(const T &val, Point f)
|
|
392
|
+
{
|
|
393
|
+
f._apply_operation(val, [](T &valF, const T &valR) {
|
|
394
|
+
valF = -valF;
|
|
395
|
+
Gudhi::multi_filtration::_add(valF, valR);
|
|
396
|
+
});
|
|
397
|
+
return f;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) - val(p) \f$.
|
|
402
|
+
* Both points have to have the same dimension.
|
|
403
|
+
*
|
|
404
|
+
* Used conventions:
|
|
405
|
+
* - \f$ inf - inf = NaN \f$,
|
|
406
|
+
* - \f$ -inf - (-inf) = NaN \f$,
|
|
407
|
+
* - \f$ NaN - b = NaN \f$,
|
|
408
|
+
* - \f$ a - NaN = NaN \f$.
|
|
409
|
+
*
|
|
410
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
411
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
412
|
+
*
|
|
413
|
+
* @param f First element of the subtraction.
|
|
414
|
+
* @param val Second element of the subtraction.
|
|
415
|
+
*/
|
|
416
|
+
template <typename U = T>
|
|
417
|
+
friend Point &operator-=(Point &f, const Point<U> &val)
|
|
418
|
+
{
|
|
419
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
420
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_subtract(valF, valR); });
|
|
421
|
+
return f;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) - val \f$.
|
|
426
|
+
*
|
|
427
|
+
* Used conventions:
|
|
428
|
+
* - \f$ inf - inf = NaN \f$,
|
|
429
|
+
* - \f$ -inf - (-inf) = NaN \f$,
|
|
430
|
+
* - \f$ NaN - b = NaN \f$,
|
|
431
|
+
* - \f$ a - NaN = NaN \f$.
|
|
432
|
+
*
|
|
433
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
434
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
435
|
+
*
|
|
436
|
+
* @param f First element of the subtraction.
|
|
437
|
+
* @param val Second element of the subtraction.
|
|
438
|
+
*/
|
|
439
|
+
friend Point &operator-=(Point &f, const T &val)
|
|
440
|
+
{
|
|
441
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_subtract(valF, valR); });
|
|
442
|
+
return f;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// addition
|
|
446
|
+
/**
|
|
447
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) + val(p) \f$.
|
|
448
|
+
* Both points have to have the same dimension.
|
|
449
|
+
*
|
|
450
|
+
* Used conventions:
|
|
451
|
+
* - \f$ inf + (-inf) = NaN \f$,
|
|
452
|
+
* - \f$ -inf + inf = NaN \f$,
|
|
453
|
+
* - \f$ NaN + b = NaN \f$,
|
|
454
|
+
* - \f$ a + NaN = NaN \f$.
|
|
455
|
+
*
|
|
456
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
457
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
458
|
+
*
|
|
459
|
+
* @param f First element of the addition.
|
|
460
|
+
* @param val Second element of the addition.
|
|
461
|
+
*/
|
|
462
|
+
template <typename U = T>
|
|
463
|
+
friend Point operator+(Point f, const Point<U> &val)
|
|
464
|
+
{
|
|
465
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
466
|
+
f += val;
|
|
467
|
+
return f;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) + val \f$.
|
|
472
|
+
*
|
|
473
|
+
* Used conventions:
|
|
474
|
+
* - \f$ inf + (-inf) = NaN \f$,
|
|
475
|
+
* - \f$ -inf + inf = NaN \f$,
|
|
476
|
+
* - \f$ NaN + b = NaN \f$,
|
|
477
|
+
* - \f$ a + NaN = NaN \f$.
|
|
478
|
+
*
|
|
479
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
480
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
481
|
+
*
|
|
482
|
+
* @param f First element of the addition.
|
|
483
|
+
* @param val Second element of the addition.
|
|
484
|
+
*/
|
|
485
|
+
friend Point operator+(Point f, const T &val)
|
|
486
|
+
{
|
|
487
|
+
f += val;
|
|
488
|
+
return f;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ val + f(p) \f$.
|
|
493
|
+
*
|
|
494
|
+
* Used conventions:
|
|
495
|
+
* - \f$ inf + (-inf) = NaN \f$,
|
|
496
|
+
* - \f$ -inf + inf = NaN \f$,
|
|
497
|
+
* - \f$ NaN + b = NaN \f$,
|
|
498
|
+
* - \f$ a + NaN = NaN \f$.
|
|
499
|
+
*
|
|
500
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
501
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
502
|
+
*
|
|
503
|
+
* @param val First element of the addition.
|
|
504
|
+
* @param f Second element of the addition.
|
|
505
|
+
*/
|
|
506
|
+
friend Point operator+(const T &val, Point f)
|
|
507
|
+
{
|
|
508
|
+
f += val;
|
|
509
|
+
return f;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) + val(p) \f$.
|
|
514
|
+
* Both points have to have the same dimension.
|
|
515
|
+
*
|
|
516
|
+
* Used conventions:
|
|
517
|
+
* - \f$ inf + (-inf) = NaN \f$,
|
|
518
|
+
* - \f$ -inf + inf = NaN \f$,
|
|
519
|
+
* - \f$ NaN + b = NaN \f$,
|
|
520
|
+
* - \f$ a + NaN = NaN \f$.
|
|
521
|
+
*
|
|
522
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
523
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
524
|
+
*
|
|
525
|
+
* @param f First element of the addition.
|
|
526
|
+
* @param val Second element of the addition.
|
|
527
|
+
*/
|
|
528
|
+
template <typename U = T>
|
|
529
|
+
friend Point &operator+=(Point &f, const Point<U> &val)
|
|
530
|
+
{
|
|
531
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
532
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_add(valF, valR); });
|
|
533
|
+
return f;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) + val \f$.
|
|
538
|
+
*
|
|
539
|
+
* Used conventions:
|
|
540
|
+
* - \f$ inf + (-inf) = NaN \f$,
|
|
541
|
+
* - \f$ -inf + inf = NaN \f$,
|
|
542
|
+
* - \f$ NaN + b = NaN \f$,
|
|
543
|
+
* - \f$ a + NaN = NaN \f$.
|
|
544
|
+
*
|
|
545
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
546
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
547
|
+
*
|
|
548
|
+
* @param f First element of the addition.
|
|
549
|
+
* @param val Second element of the addition.
|
|
550
|
+
*/
|
|
551
|
+
friend Point &operator+=(Point &f, const T &val)
|
|
552
|
+
{
|
|
553
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_add(valF, valR); });
|
|
554
|
+
return f;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// multiplication
|
|
558
|
+
/**
|
|
559
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) * val(p) \f$.
|
|
560
|
+
* Both points have to have the same dimension.
|
|
561
|
+
*
|
|
562
|
+
* Used conventions:
|
|
563
|
+
* - \f$ inf * 0 = NaN \f$,
|
|
564
|
+
* - \f$ 0 * inf = NaN \f$,
|
|
565
|
+
* - \f$ -inf * 0 = NaN \f$,
|
|
566
|
+
* - \f$ 0 * (-inf) = NaN \f$,
|
|
567
|
+
* - \f$ NaN * b = NaN \f$,
|
|
568
|
+
* - \f$ a * NaN = NaN \f$.
|
|
569
|
+
*
|
|
570
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
571
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
572
|
+
*
|
|
573
|
+
* @param f First element of the multiplication.
|
|
574
|
+
* @param val Second element of the multiplication.
|
|
575
|
+
*/
|
|
576
|
+
template <typename U = T>
|
|
577
|
+
friend Point operator*(Point f, const Point<U> &val)
|
|
578
|
+
{
|
|
579
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
580
|
+
f *= val;
|
|
581
|
+
return f;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) * val \f$.
|
|
586
|
+
*
|
|
587
|
+
* Used conventions:
|
|
588
|
+
* - \f$ inf * 0 = NaN \f$,
|
|
589
|
+
* - \f$ 0 * inf = NaN \f$,
|
|
590
|
+
* - \f$ -inf * 0 = NaN \f$,
|
|
591
|
+
* - \f$ 0 * (-inf) = NaN \f$,
|
|
592
|
+
* - \f$ NaN * b = NaN \f$,
|
|
593
|
+
* - \f$ a * NaN = NaN \f$.
|
|
594
|
+
*
|
|
595
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
596
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
597
|
+
*
|
|
598
|
+
* @param f First element of the multiplication.
|
|
599
|
+
* @param val Second element of the multiplication.
|
|
600
|
+
*/
|
|
601
|
+
friend Point operator*(Point f, const T &val)
|
|
602
|
+
{
|
|
603
|
+
f *= val;
|
|
604
|
+
return f;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ val * f(p) \f$.
|
|
609
|
+
*
|
|
610
|
+
* Used conventions:
|
|
611
|
+
* - \f$ inf * 0 = NaN \f$,
|
|
612
|
+
* - \f$ 0 * inf = NaN \f$,
|
|
613
|
+
* - \f$ -inf * 0 = NaN \f$,
|
|
614
|
+
* - \f$ 0 * (-inf) = NaN \f$,
|
|
615
|
+
* - \f$ NaN * b = NaN \f$,
|
|
616
|
+
* - \f$ a * NaN = NaN \f$.
|
|
617
|
+
*
|
|
618
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
619
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
620
|
+
*
|
|
621
|
+
* @param val First element of the multiplication.
|
|
622
|
+
* @param f Second element of the multiplication.
|
|
623
|
+
*/
|
|
624
|
+
friend Point operator*(const T &val, Point f)
|
|
625
|
+
{
|
|
626
|
+
f *= val;
|
|
627
|
+
return f;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) * val(p) \f$.
|
|
632
|
+
* Both points have to have the same dimension.
|
|
633
|
+
*
|
|
634
|
+
* Used conventions:
|
|
635
|
+
* - \f$ inf * 0 = NaN \f$,
|
|
636
|
+
* - \f$ 0 * inf = NaN \f$,
|
|
637
|
+
* - \f$ -inf * 0 = NaN \f$,
|
|
638
|
+
* - \f$ 0 * (-inf) = NaN \f$,
|
|
639
|
+
* - \f$ NaN * b = NaN \f$,
|
|
640
|
+
* - \f$ a * NaN = NaN \f$.
|
|
641
|
+
*
|
|
642
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
643
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
644
|
+
*
|
|
645
|
+
* @param f First element of the multiplication.
|
|
646
|
+
* @param val Second element of the multiplication.
|
|
647
|
+
*/
|
|
648
|
+
template <typename U = T>
|
|
649
|
+
friend Point &operator*=(Point &f, const Point<U> &val)
|
|
650
|
+
{
|
|
651
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
652
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_multiply(valF, valR); });
|
|
653
|
+
return f;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) * val \f$.
|
|
658
|
+
*
|
|
659
|
+
* Used conventions:
|
|
660
|
+
* - \f$ inf * 0 = NaN \f$,
|
|
661
|
+
* - \f$ 0 * inf = NaN \f$,
|
|
662
|
+
* - \f$ -inf * 0 = NaN \f$,
|
|
663
|
+
* - \f$ 0 * (-inf) = NaN \f$,
|
|
664
|
+
* - \f$ NaN * b = NaN \f$,
|
|
665
|
+
* - \f$ a * NaN = NaN \f$.
|
|
666
|
+
*
|
|
667
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
668
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
669
|
+
*
|
|
670
|
+
* @param f First element of the multiplication.
|
|
671
|
+
* @param val Second element of the multiplication.
|
|
672
|
+
*/
|
|
673
|
+
friend Point &operator*=(Point &f, const T &val)
|
|
674
|
+
{
|
|
675
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_multiply(valF, valR); });
|
|
676
|
+
return f;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// division
|
|
680
|
+
/**
|
|
681
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) / val(p) \f$.
|
|
682
|
+
* Both points have to have the same dimension.
|
|
683
|
+
*
|
|
684
|
+
* Used conventions:
|
|
685
|
+
* - \f$ a / 0 = NaN \f$,
|
|
686
|
+
* - \f$ inf / inf = NaN \f$,
|
|
687
|
+
* - \f$ -inf / inf = NaN \f$,
|
|
688
|
+
* - \f$ inf / -inf = NaN \f$,
|
|
689
|
+
* - \f$ -inf / -inf = NaN \f$,
|
|
690
|
+
* - \f$ NaN / b = NaN \f$,
|
|
691
|
+
* - \f$ a / NaN = NaN \f$,
|
|
692
|
+
* - \f$ a / inf = 0 \f$,
|
|
693
|
+
* - \f$ a / -inf = 0 \f$.
|
|
694
|
+
*
|
|
695
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
696
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
697
|
+
*
|
|
698
|
+
* @param f First element of the division.
|
|
699
|
+
* @param val Second element of the division.
|
|
700
|
+
*/
|
|
701
|
+
template <typename U = T>
|
|
702
|
+
friend Point operator/(Point f, const Point<U> &val)
|
|
703
|
+
{
|
|
704
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
705
|
+
f /= val;
|
|
706
|
+
return f;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) / val \f$.
|
|
711
|
+
*
|
|
712
|
+
* Used conventions:
|
|
713
|
+
* - \f$ a / 0 = NaN \f$,
|
|
714
|
+
* - \f$ inf / inf = NaN \f$,
|
|
715
|
+
* - \f$ -inf / inf = NaN \f$,
|
|
716
|
+
* - \f$ inf / -inf = NaN \f$,
|
|
717
|
+
* - \f$ -inf / -inf = NaN \f$,
|
|
718
|
+
* - \f$ NaN / b = NaN \f$,
|
|
719
|
+
* - \f$ a / NaN = NaN \f$,
|
|
720
|
+
* - \f$ a / inf = 0 \f$,
|
|
721
|
+
* - \f$ a / -inf = 0 \f$.
|
|
722
|
+
*
|
|
723
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
724
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
725
|
+
*
|
|
726
|
+
* @param f First element of the division.
|
|
727
|
+
* @param val Second element of the division.
|
|
728
|
+
*/
|
|
729
|
+
friend Point operator/(Point f, const T &val)
|
|
730
|
+
{
|
|
731
|
+
f /= val;
|
|
732
|
+
return f;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* @brief Returns a filtration value such that an entry at index \f$ (p) \f$ is equal to \f$ val / f(p) \f$.
|
|
737
|
+
*
|
|
738
|
+
* Used conventions:
|
|
739
|
+
* - \f$ a / 0 = NaN \f$,
|
|
740
|
+
* - \f$ inf / inf = NaN \f$,
|
|
741
|
+
* - \f$ -inf / inf = NaN \f$,
|
|
742
|
+
* - \f$ inf / -inf = NaN \f$,
|
|
743
|
+
* - \f$ -inf / -inf = NaN \f$,
|
|
744
|
+
* - \f$ NaN / b = NaN \f$,
|
|
745
|
+
* - \f$ a / NaN = NaN \f$,
|
|
746
|
+
* - \f$ a / inf = 0 \f$,
|
|
747
|
+
* - \f$ a / -inf = 0 \f$.
|
|
748
|
+
*
|
|
749
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
750
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
751
|
+
*
|
|
752
|
+
* @param val First element of the division.
|
|
753
|
+
* @param f Second element of the division.
|
|
754
|
+
*/
|
|
755
|
+
friend Point operator/(const T &val, Point f)
|
|
756
|
+
{
|
|
757
|
+
f._apply_operation(val, [](T &valF, const T &valR) {
|
|
758
|
+
T tmp = valF;
|
|
759
|
+
valF = valR;
|
|
760
|
+
Gudhi::multi_filtration::_divide(valF, tmp);
|
|
761
|
+
});
|
|
762
|
+
return f;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) / val(p) \f$.
|
|
767
|
+
* Both points have to have the same dimension.
|
|
768
|
+
*
|
|
769
|
+
* Used conventions:
|
|
770
|
+
* - \f$ a / 0 = NaN \f$,
|
|
771
|
+
* - \f$ inf / inf = NaN \f$,
|
|
772
|
+
* - \f$ -inf / inf = NaN \f$,
|
|
773
|
+
* - \f$ inf / -inf = NaN \f$,
|
|
774
|
+
* - \f$ -inf / -inf = NaN \f$,
|
|
775
|
+
* - \f$ NaN / b = NaN \f$,
|
|
776
|
+
* - \f$ a / NaN = NaN \f$,
|
|
777
|
+
* - \f$ a / inf = 0 \f$,
|
|
778
|
+
* - \f$ a / -inf = 0 \f$.
|
|
779
|
+
*
|
|
780
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
781
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
782
|
+
*
|
|
783
|
+
* @param f First element of the division.
|
|
784
|
+
* @param val Second element of the division.
|
|
785
|
+
*/
|
|
786
|
+
template <typename U = T>
|
|
787
|
+
friend Point &operator/=(Point &f, const Point<U> &val)
|
|
788
|
+
{
|
|
789
|
+
GUDHI_CHECK(f.size() == val.size(), "Cannot translate point by a direction with different dimension.");
|
|
790
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_divide(valF, valR); });
|
|
791
|
+
return f;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* @brief Modifies the first parameter such that an entry at index \f$ (p) \f$ is equal to \f$ f(p) / val \f$.
|
|
796
|
+
*
|
|
797
|
+
* Used conventions:
|
|
798
|
+
* - \f$ a / 0 = NaN \f$,
|
|
799
|
+
* - \f$ inf / inf = NaN \f$,
|
|
800
|
+
* - \f$ -inf / inf = NaN \f$,
|
|
801
|
+
* - \f$ inf / -inf = NaN \f$,
|
|
802
|
+
* - \f$ -inf / -inf = NaN \f$,
|
|
803
|
+
* - \f$ NaN / b = NaN \f$,
|
|
804
|
+
* - \f$ a / NaN = NaN \f$,
|
|
805
|
+
* - \f$ a / inf = 0 \f$,
|
|
806
|
+
* - \f$ a / -inf = 0 \f$.
|
|
807
|
+
*
|
|
808
|
+
* All NaN values are represented by `std::numeric_limits<T>::quiet_NaN()` independently if
|
|
809
|
+
* `std::numeric_limits<T>::has_quiet_NaN` is true or not.
|
|
810
|
+
*
|
|
811
|
+
* @param f First element of the division.
|
|
812
|
+
* @param val Second element of the division.
|
|
813
|
+
*/
|
|
814
|
+
friend Point &operator/=(Point &f, const T &val)
|
|
815
|
+
{
|
|
816
|
+
f._apply_operation(val, [](T &valF, const T &valR) { Gudhi::multi_filtration::_divide(valF, valR); });
|
|
817
|
+
return f;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* @brief Plus infinity value of an entry of the filtration value.
|
|
822
|
+
*/
|
|
823
|
+
constexpr static const T T_inf = Gudhi::multi_filtration::MF_T_inf<T>;
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* @brief Minus infinity value of an entry of the filtration value.
|
|
827
|
+
*/
|
|
828
|
+
constexpr static const T T_m_inf = Gudhi::multi_filtration::MF_T_m_inf<T>;
|
|
829
|
+
|
|
830
|
+
private:
|
|
831
|
+
Container coordinates_; /**< Coordinates of the point. */
|
|
832
|
+
|
|
833
|
+
template <typename U = T, class F>
|
|
834
|
+
void _apply_operation(const Point<U> &range, F &&operate)
|
|
835
|
+
{
|
|
836
|
+
for (unsigned int p = 0; p < coordinates_.size(); ++p) {
|
|
837
|
+
std::forward<F>(operate)(coordinates_[p], range[p]);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
template <class F>
|
|
842
|
+
void _apply_operation(const T &val, F &&operate)
|
|
843
|
+
{
|
|
844
|
+
for (unsigned int i = 0; i < coordinates_.size(); ++i) {
|
|
845
|
+
std::forward<F>(operate)(coordinates_[i], val);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
|
|
850
|
+
} // namespace multi_persistence
|
|
851
|
+
} // namespace Gudhi
|
|
852
|
+
|
|
853
|
+
#endif // MP_POINT_H_INCLUDED
|