Loading...
Searching...
No Matches
chain_column_extra_properties.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_CHAIN_COLUMN_PROP_H
#define PM_CHAIN_COLUMN_PROP_H
#include <utility> //std::swap
namespace Gudhi {
namespace persistence_matrix {
struct Dummy_chain_properties
{
Dummy_chain_properties([[maybe_unused]] int pivot = 0, [[maybe_unused]] int pair = 0) {}
friend void swap([[maybe_unused]] Dummy_chain_properties& col1, [[maybe_unused]] Dummy_chain_properties& col2) {}
};
template <class Master_matrix>
class Chain_column_extra_properties
{
public:
using Index = typename Master_matrix::Index;
using ID_index = typename Master_matrix::ID_index;
Chain_column_extra_properties()
: pivot_(Master_matrix::template get_null_value<ID_index>()),
pairedColumn_(Master_matrix::template get_null_value<Index>()) {}
Chain_column_extra_properties(ID_index pivot)
: pivot_(pivot), pairedColumn_(Master_matrix::template get_null_value<Index>()) {}
Chain_column_extra_properties(ID_index pivot, Index pair) : pivot_(pivot), pairedColumn_(pair) {}
Chain_column_extra_properties(const Chain_column_extra_properties& col)
: pivot_(col.pivot_), pairedColumn_(col.pairedColumn_) {}
Chain_column_extra_properties(Chain_column_extra_properties&& col)
: pivot_(std::exchange(col.pivot_, Master_matrix::template get_null_value<ID_index>())),
pairedColumn_(std::exchange(col.pairedColumn_, Master_matrix::template get_null_value<Index>())) {}
Index get_paired_chain_index() const { return pairedColumn_; }
bool is_paired() const { return pairedColumn_ != Master_matrix::template get_null_value<Index>(); }
void assign_paired_chain(Index other_col) { pairedColumn_ = other_col; }
void unassign_paired_chain() { pairedColumn_ = Master_matrix::template get_null_value<Index>(); };
Chain_column_extra_properties& operator=(const Chain_column_extra_properties& other) {
pivot_ = other.pivot_;
pairedColumn_ = other.pairedColumn_;
return *this;
}
friend void swap(Chain_column_extra_properties& col1, Chain_column_extra_properties& col2) {
std::swap(col1.pivot_, col2.pivot_);
std::swap(col1.pairedColumn_, col2.pairedColumn_);
}
protected:
ID_index get_pivot() const { return pivot_; }
void swap_pivots(Chain_column_extra_properties& other) { std::swap(pivot_, other.pivot_); }
private:
ID_index pivot_;
Index pairedColumn_;
};
} // namespace persistence_matrix
} // namespace Gudhi
#endif // PM_CHAIN_COLUMN_PROP_H
Gudhi::persistence_matrix::Chain_column_extra_properties::Chain_column_extra_properties
Chain_column_extra_properties(ID_index pivot, Index pair)
Constructor setting the pivot and the pair at the given values.
Definition chain_column_extra_properties.h:85
Gudhi::persistence_matrix::Chain_column_extra_properties::assign_paired_chain
void assign_paired_chain(Index other_col)
Sets the value of the pair.
Definition chain_column_extra_properties.h:122
Gudhi::persistence_matrix::Chain_column_extra_properties::unassign_paired_chain
void unassign_paired_chain()
Un-pairs a column.
Definition chain_column_extra_properties.h:126
Gudhi::persistence_matrix::Chain_column_extra_properties::is_paired
bool is_paired() const
Indicates if the column is paired or not.
Definition chain_column_extra_properties.h:116
Gudhi::persistence_matrix::Chain_column_extra_properties::get_paired_chain_index
Index get_paired_chain_index() const
Returns null index if the column is not paired, the MatIdx of the pair otherwise.
Definition chain_column_extra_properties.h:109
Gudhi::persistence_matrix::Chain_column_extra_properties::Chain_column_extra_properties
Chain_column_extra_properties(const Chain_column_extra_properties &col)
Copy constructor.
Definition chain_column_extra_properties.h:91
Gudhi::persistence_matrix::Chain_column_extra_properties::Chain_column_extra_properties
Chain_column_extra_properties(ID_index pivot)
Constructor setting the pivot at the given value and the pair to null index (i.e. not paired).
Definition chain_column_extra_properties.h:76
Gudhi::persistence_matrix::Chain_column_extra_properties::swap
friend void swap(Chain_column_extra_properties &col1, Chain_column_extra_properties &col2)
Swap operator.
Definition chain_column_extra_properties.h:139
Gudhi::persistence_matrix::Chain_column_extra_properties::Index
typename Master_matrix::Index Index
Definition chain_column_extra_properties.h:59
Gudhi::persistence_matrix::Chain_column_extra_properties::operator=
Chain_column_extra_properties & operator=(const Chain_column_extra_properties &other)
Assign operator.
Definition chain_column_extra_properties.h:131
Gudhi::persistence_matrix::Chain_column_extra_properties::ID_index
typename Master_matrix::ID_index ID_index
Definition chain_column_extra_properties.h:60
Gudhi::persistence_matrix::Chain_column_extra_properties::Chain_column_extra_properties
Chain_column_extra_properties(Chain_column_extra_properties &&col)
Move constructor.
Definition chain_column_extra_properties.h:98
Gudhi::persistence_matrix::Chain_column_extra_properties::Chain_column_extra_properties
Chain_column_extra_properties()
Default constructor. Sets the pivot and pair to null index, which means "not existing".
Definition chain_column_extra_properties.h:66
Gudhi::persistence_matrix
Persistence matrix namespace.
Definition FieldOperators.h:18
Gudhi
Gudhi namespace.
Definition SimplicialComplexForAlpha.h:14
std
STL namespace.