Loading...
Searching...
No Matches
column_dimension_holder.h
Go to the documentation of this file.
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): Hannah Schreiber
*
* Copyright (C) 2022-24 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/
#ifndef PM_COLUMN_DIM_HOLDER_H
#define PM_COLUMN_DIM_HOLDER_H
#include <utility> //std::swap
namespace Gudhi {
namespace persistence_matrix {
struct Dummy_dimension_holder
{
Dummy_dimension_holder() {}
template <typename Dimension>
Dummy_dimension_holder([[maybe_unused]] Dimension dim) {}
friend void swap([[maybe_unused]] Dummy_dimension_holder& col1, [[maybe_unused]] Dummy_dimension_holder& col2) {}
};
template <class Master_matrix>
struct Column_dimension_holder
{
using Dimension = typename Master_matrix::Dimension;
Column_dimension_holder()
: dim_(Master_matrix::Option_list::is_of_boundary_type ? 0
: Master_matrix::template get_null_value<Dimension>()) {}
Column_dimension_holder(Dimension dim) : dim_(dim) {}
Column_dimension_holder(const Column_dimension_holder& col) : dim_(col.dim_) {}
Column_dimension_holder(Column_dimension_holder&& col)
: dim_(std::exchange(col.dim_, Master_matrix::template get_null_value<Dimension>())) {}
Dimension get_dimension() const { return dim_; }
Column_dimension_holder& operator=(const Column_dimension_holder& other) {
dim_ = other.dim_;
return *this;
}
friend void swap(Column_dimension_holder& col1, Column_dimension_holder& col2) { std::swap(col1.dim_, col2.dim_); }
protected:
void swap_dimension(Column_dimension_holder& other) { std::swap(dim_, other.dim_); }
private:
Dimension dim_;
};
} // namespace persistence_matrix
} // namespace Gudhi
#endif // PM_COLUMN_DIM_HOLDER_H
Gudhi::persistence_matrix
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
std
STL namespace.
Gudhi::persistence_matrix::Column_dimension_holder
Class managing the dimension access of a column.
Definition column_dimension_holder.h:51
Gudhi::persistence_matrix::Column_dimension_holder::operator=
Column_dimension_holder & operator=(const Column_dimension_holder &other)
Assign operator.
Definition column_dimension_holder.h:91
Gudhi::persistence_matrix::Column_dimension_holder::Dimension
typename Master_matrix::Dimension Dimension
Definition column_dimension_holder.h:52
Gudhi::persistence_matrix::Column_dimension_holder::swap
friend void swap(Column_dimension_holder &col1, Column_dimension_holder &col2)
Swap operator.
Definition column_dimension_holder.h:98
Gudhi::persistence_matrix::Column_dimension_holder::Column_dimension_holder
Column_dimension_holder(const Column_dimension_holder &col)
Copy constructor.
Definition column_dimension_holder.h:72
Gudhi::persistence_matrix::Column_dimension_holder::Column_dimension_holder
Column_dimension_holder(Column_dimension_holder &&col)
Move constructor.
Definition column_dimension_holder.h:78
Gudhi::persistence_matrix::Column_dimension_holder::Column_dimension_holder
Column_dimension_holder()
Default constructor. Sets the dimension to 0 for boundary matrices and to null index for chain matric...
Definition column_dimension_holder.h:58
Gudhi::persistence_matrix::Column_dimension_holder::get_dimension
Dimension get_dimension() const
Returns the dimension of the column.
Definition column_dimension_holder.h:86
Gudhi::persistence_matrix::Column_dimension_holder::Column_dimension_holder
Column_dimension_holder(Dimension dim)
Constructor setting the dimension to the given value.
Definition column_dimension_holder.h:66