19#ifndef PM_MATRIX_DIM_HOLDER_H
20#define PM_MATRIX_DIM_HOLDER_H
26namespace persistence_matrix {
37 template <
typename Dimension>
55template <
typename Dimension>
77 : maxDim_(std::exchange(other.maxDim_, -1)){};
90 std::swap(maxDim_, other.maxDim_);
97 std::swap(matrix1.maxDim_, matrix2.maxDim_);
103 void update_up(Dimension dimension) {
104 if (maxDim_ == -1 || maxDim_ < dimension) maxDim_ = dimension;
117template <
typename Dimension>
127 : dimensions_(maximalDimension < 0 ? 0 : maximalDimension + 1, 0), maxDim_(maximalDimension) {
128 if (maxDim_ != -1) dimensions_[maxDim_] = 1;
136 : dimensions_(toCopy.dimensions_), maxDim_(toCopy.maxDim_){};
143 : dimensions_(std::move(other.dimensions_)), maxDim_(std::exchange(other.maxDim_, -1)){};
156 std::swap(maxDim_, other.maxDim_);
157 dimensions_.swap(other.dimensions_);
164 std::swap(matrix1.maxDim_, matrix2.maxDim_);
165 matrix1.dimensions_.swap(matrix2.dimensions_);
169 std::vector<unsigned int> dimensions_;
172 void update_up(
unsigned int dimension) {
173 if (dimensions_.size() <= dimension) dimensions_.resize(dimension + 1, 0);
174 ++(dimensions_[dimension]);
175 maxDim_ = dimensions_.size() - 1;
178 void update_down(
unsigned int dimension) {
179 --(dimensions_[dimension]);
180 while (!dimensions_.empty() && dimensions_.back() == 0) dimensions_.pop_back();
181 maxDim_ = dimensions_.size() - 1;
Class managing the maximal dimension of a cell represented in the inheriting matrix,...
Definition: matrix_dimension_holders.h:119
Matrix_all_dimension_holder(const Matrix_all_dimension_holder &toCopy)
Copy constructor.
Definition: matrix_dimension_holders.h:135
Matrix_all_dimension_holder(Matrix_all_dimension_holder &&other) noexcept
Move constructor.
Definition: matrix_dimension_holders.h:142
Dimension get_max_dimension() const
Returns the maximal dimension of a cell represented in the matrix.
Definition: matrix_dimension_holders.h:150
friend void swap(Matrix_all_dimension_holder &matrix1, Matrix_all_dimension_holder &matrix2)
Swap operator.
Definition: matrix_dimension_holders.h:163
Matrix_all_dimension_holder & operator=(Matrix_all_dimension_holder other)
Assign operator.
Definition: matrix_dimension_holders.h:155
Matrix_all_dimension_holder(Dimension maximalDimension=-1)
Default constructor. If a dimension is specified, stores it as the maximal value.
Definition: matrix_dimension_holders.h:126
Class managing the maximal dimension of a cell represented in the inheriting matrix,...
Definition: matrix_dimension_holders.h:57
Dimension get_max_dimension() const
Returns the maximal dimension of a cell represented in the matrix.
Definition: matrix_dimension_holders.h:84
Matrix_max_dimension_holder(Matrix_max_dimension_holder &&other) noexcept
Move constructor.
Definition: matrix_dimension_holders.h:76
Matrix_max_dimension_holder & operator=(const Matrix_max_dimension_holder &other)
Assign operator.
Definition: matrix_dimension_holders.h:89
friend void swap(Matrix_max_dimension_holder &matrix1, Matrix_max_dimension_holder &matrix2)
Swap operator.
Definition: matrix_dimension_holders.h:96
Matrix_max_dimension_holder(Dimension maximalDimension=-1)
Default constructor. If a dimension is specified, stores it as the maximal value.
Definition: matrix_dimension_holders.h:64
Matrix_max_dimension_holder(const Matrix_max_dimension_holder &toCopy)
Copy constructor.
Definition: matrix_dimension_holders.h:70
Gudhi namespace.
Definition: SimplicialComplexForAlpha.h:14
Empty structure. Inherited instead of Matrix_max_dimension_holder or Matrix_all_dimension_holder,...
Definition: matrix_dimension_holders.h:36