19#ifndef PM_MATRIX_DIM_HOLDER_H
20#define PM_MATRIX_DIM_HOLDER_H
35struct Dummy_matrix_dimension_holder {
36 template <
typename Dimension>
37 Dummy_matrix_dimension_holder([[maybe_unused]] Dimension maximalDimension)
40 friend void swap([[maybe_unused]] Dummy_matrix_dimension_holder& d1,
41 [[maybe_unused]] Dummy_matrix_dimension_holder& d2)
noexcept
56template <
typename Dimension>
78 : maxDim_(std::exchange(other.maxDim_, -1)) {};
99 if (
this == &other)
return *
this;
101 maxDim_ = std::exchange(other.maxDim_, -1);
110 std::swap(matrix1.maxDim_, matrix2.maxDim_);
114 void _update_up(Dimension dimension)
116 if (maxDim_ == -1 || maxDim_ < dimension) maxDim_ = dimension;
119 void _reset() { maxDim_ = -1; }
134template <
typename Dimension>
144 : dimensions_(maximalDimension < 0 ? 0 : maximalDimension + 1, 0), maxDim_(maximalDimension)
146 if (maxDim_ != -1) dimensions_[maxDim_] = 1;
161 : dimensions_(std::move(other.dimensions_)), maxDim_(std::exchange(other.maxDim_, -1)) {};
182 if (
this == &other)
return *
this;
184 dimensions_ = std::move(other.dimensions_);
185 maxDim_ = std::exchange(other.maxDim_, -1);
194 std::swap(matrix1.maxDim_, matrix2.maxDim_);
195 matrix1.dimensions_.swap(matrix2.dimensions_);
199 void _update_up(
unsigned int dimension)
201 if (dimensions_.size() <= dimension) dimensions_.resize(dimension + 1, 0);
202 ++(dimensions_[dimension]);
203 maxDim_ = dimensions_.size() - 1;
206 void _update_down(
unsigned int dimension)
208 --(dimensions_[dimension]);
209 while (!dimensions_.empty() && dimensions_.back() == 0) dimensions_.pop_back();
210 maxDim_ = dimensions_.size() - 1;
220 std::vector<unsigned int> dimensions_;
Class managing the maximal dimension of a cell represented in the inheriting matrix,...
Definition matrix_dimension_holders.h:136
Matrix_all_dimension_holder & operator=(Matrix_all_dimension_holder &&other) noexcept
Move assign operator.
Definition matrix_dimension_holders.h:180
Matrix_all_dimension_holder & operator=(const Matrix_all_dimension_holder &other)=default
Assign operator.
Matrix_all_dimension_holder(Matrix_all_dimension_holder &&other) noexcept
Move constructor.
Definition matrix_dimension_holders.h:160
friend void swap(Matrix_all_dimension_holder &matrix1, Matrix_all_dimension_holder &matrix2) noexcept
Swap operator.
Definition matrix_dimension_holders.h:192
Dimension get_max_dimension() const
Returns the maximal dimension of a cell represented in the matrix.
Definition matrix_dimension_holders.h:170
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:143
Matrix_all_dimension_holder(const Matrix_all_dimension_holder &toCopy)=default
Copy constructor.
Class managing the maximal dimension of a cell represented in the inheriting matrix,...
Definition matrix_dimension_holders.h:58
Dimension get_max_dimension() const
Returns the maximal dimension of a cell represented in the matrix.
Definition matrix_dimension_holders.h:87
Matrix_max_dimension_holder & operator=(const Matrix_max_dimension_holder &other)=default
Assign operator.
Matrix_max_dimension_holder(Matrix_max_dimension_holder &&other) noexcept
Move constructor.
Definition matrix_dimension_holders.h:77
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:65
friend void swap(Matrix_max_dimension_holder &matrix1, Matrix_max_dimension_holder &matrix2) noexcept
Swap operator.
Definition matrix_dimension_holders.h:108
Matrix_max_dimension_holder & operator=(Matrix_max_dimension_holder &&other) noexcept
Move assign operator.
Definition matrix_dimension_holders.h:97
Matrix_max_dimension_holder(const Matrix_max_dimension_holder &toCopy)=default
Copy constructor.
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14