18 #ifndef PM_MATRIX_DIM_HOLDER_H
19 #define PM_MATRIX_DIM_HOLDER_H
25 namespace persistence_matrix {
35 template <
typename dimension_type>
51 template <
typename dimension_type>
73 : maxDim_(std::exchange(other.maxDim_, -1)){};
86 std::swap(maxDim_, other.maxDim_);
93 std::swap(matrix1.maxDim_, matrix2.maxDim_);
97 dimension_type maxDim_;
99 void update_up(dimension_type dimension) {
100 if (maxDim_ == -1 || maxDim_ < dimension) maxDim_ = dimension;
113 template <
typename dimension_type>
123 : dimensions_(maximalDimension < 0 ? 0 : maximalDimension + 1, 0), maxDim_(maximalDimension) {
124 if (maxDim_ != -1) dimensions_[maxDim_] = 1;
132 : dimensions_(toCopy.dimensions_), maxDim_(toCopy.maxDim_){};
139 : dimensions_(std::move(other.dimensions_)), maxDim_(std::exchange(other.maxDim_, -1)){};
152 std::swap(maxDim_, other.maxDim_);
153 dimensions_.swap(other.dimensions_);
160 std::swap(matrix1.maxDim_, matrix2.maxDim_);
161 matrix1.dimensions_.swap(matrix2.dimensions_);
165 std::vector<unsigned int> dimensions_;
166 dimension_type maxDim_;
168 void update_up(
unsigned int dimension) {
169 if (dimensions_.size() <= dimension) dimensions_.resize(dimension + 1, 0);
170 ++(dimensions_[dimension]);
171 maxDim_ = dimensions_.size() - 1;
174 void update_down(
unsigned int dimension) {
175 --(dimensions_[dimension]);
176 while (!dimensions_.empty() && dimensions_.back() == 0) dimensions_.pop_back();
177 maxDim_ = dimensions_.size() - 1;
Class managing the maximal dimension of a face represented in the inheritating matrix,...
Definition: matrix_dimension_holders.h:115
Matrix_all_dimension_holder & operator=(Matrix_all_dimension_holder other)
Assign operator.
Definition: matrix_dimension_holders.h:151
Matrix_all_dimension_holder(const Matrix_all_dimension_holder &toCopy)
Copy constructor.
Definition: matrix_dimension_holders.h:131
dimension_type get_max_dimension() const
Returns the maximal dimension of a face represented in the matrix.
Definition: matrix_dimension_holders.h:146
friend void swap(Matrix_all_dimension_holder &matrix1, Matrix_all_dimension_holder &matrix2)
Swap operator.
Definition: matrix_dimension_holders.h:159
Matrix_all_dimension_holder(Matrix_all_dimension_holder &&other) noexcept
Move constructor.
Definition: matrix_dimension_holders.h:138
Matrix_all_dimension_holder(dimension_type maximalDimension=-1)
Default constructor. If a dimension is specified, stores it as the maximal value.
Definition: matrix_dimension_holders.h:122
Class managing the maximal dimension of a face represented in the inheritating matrix,...
Definition: matrix_dimension_holders.h:53
Matrix_max_dimension_holder & operator=(const Matrix_max_dimension_holder &other)
Assign operator.
Definition: matrix_dimension_holders.h:85
friend void swap(Matrix_max_dimension_holder &matrix1, Matrix_max_dimension_holder &matrix2)
Swap operator.
Definition: matrix_dimension_holders.h:92
Matrix_max_dimension_holder(dimension_type maximalDimension=-1)
Default constructor. If a dimension is specified, stores it as the maximal value.
Definition: matrix_dimension_holders.h:60
Matrix_max_dimension_holder(Matrix_max_dimension_holder &&other) noexcept
Move constructor.
Definition: matrix_dimension_holders.h:72
Matrix_max_dimension_holder(const Matrix_max_dimension_holder &toCopy)
Copy constructor.
Definition: matrix_dimension_holders.h:66
dimension_type get_max_dimension() const
Returns the maximal dimension of a face represented in the matrix.
Definition: matrix_dimension_holders.h:80
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inheritated instead of Matrix_max_dimension_holder or Matrix_all_dimension_holder,...
Definition: matrix_dimension_holders.h:34