CGAL 6.1 - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType > Class Template Reference

#include <CGAL/HDVF/Filtration_core.h>

Inherited by CGAL::HDVF::Filtration_lower_star< CoefficientType, ComplexType, DegreeType >.

Definition

template<typename CoefficientType, typename ComplexType, typename DegreeType>
class CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >

The class Filtration_core implements data structures and methods required by the Filtration concept.

By definition, a filtration over a chain complex K is a sequence of sub complexes \(\{K_t\,;\, t\in[d_1, \ldots, d_N]\}\), where \(d_i\) are scalars, such that:

  • \(\forall d\leqslant d'\), \(K_d\subseteq K_{d'}\).
  • \(|K_{d_{i+1}}| = |K_{d_{i}}|+1\).
    • As a consequence, any cell \(\sigma\in K\), is "added" at a given time \(i\) and the corresponding \(d_i\) is called its degree (denoted by \(\mathrm{deg}(\sigma)\)).
  • \(K_{d_1}\) is an empty complex.
  • \(K_{d_N} = K\).
  • For any cell \(\sigma\in K\), if \(\tau\) is a proper face of \(\sigma\), then \(\mathrm{deg}(\tau)\leqslant \mathrm{deg}(\sigma)\).

In consequence, a filtration associated to a complex K:

  • maps each cell to a scalar called its degree
  • orders the cells of K (each cell has a unique index along the filtration called time along the filtration) such that:
    • the index of a cell is larger that the indices of its faces,
    • the degree map is increasing along the filtration.

The class Filtration_core provides elementary constructors and methods used in derived filtrations.

Is model of
Filtration
Template Parameters
CoefficientTypea model of the Ring concept (ring used for homology computation).
ComplexTypea model of the AbstractChainComplex concept (type of the underlying chain complex).
DegreeTypethe scalar type of degrees.

Classes

struct  FiltrationIterValue
 Type of value returned by the iterator. More...
 
struct  iterator
 Iterator over a filtration. More...
 

Public Types

typedef std::pair< std::size_t, int > CellDim
 Type for indexing uniquely a cell.
 

Public Member Functions

 Filtration_core (const ComplexType &K)
 Filtration_core default constructor.
 
 Filtration_core (const ComplexType &K, const std::vector< CellDim > &filtration, const std::vector< DegreeType > &deg)
 Constructor from a vector of cells (ordering of cells) and an associated vector of degrees.
 
 Filtration_core (const Filtration_core &f)
 Constructor by copy.
 
iterator begin ()
 Iterator to the beginning of the filtration.
 
iterator end ()
 Iterator to the ending of the filtration.
 
std::size_t get_filtration_size () const
 Gets the filtration size.
 
CellDim get_cell_dim (std::size_t i) const
 Gets the cell (that is cell index and dimension) at the index i of the filtration.
 
DegreeType get_degree (std::size_t i) const
 Gets the degree of the ith element of the filtration.
 
vector< vector< std::size_t > > export_filtration () const
 Exports the filtration time indices.
 
bool is_valid_filtration () const
 Checks if a filtration is valid.
 

Protected Types

typedef OSM::Sparse_matrix< CoefficientType, OSM::COLUMNCMatrix
 Type of column-major sparse matrices.
 
typedef OSM::Sparse_matrix< CoefficientType, OSM::ROWRMatrix
 Type of row-major sparse matrices.
 
typedef OSM::Sparse_chain< CoefficientType, OSM::COLUMNCChain
 Type of column-major chains.
 
typedef OSM::Sparse_chain< CoefficientType, OSM::ROWRChain
 Type of row-major chains.
 

Protected Member Functions

void build_filtration_structure ()
 

Protected Attributes

const ComplexType & _K
 Constant reference to the underlying chain complex.
 
std::vector< CellDim_filtration
 Vector of cells of the filtration (full ordering of cells).
 
std::vector< DegreeType > _deg
 Vector of degrees of cells along the filtration.
 
std::map< CellDim, std::size_t > _cell_to_t
 Map from cells to their index in the filtration.
 

Friends

template<typename CoefT , typename ComplexT , typename DegT , typename FiltrT >
class Hdvf_persistence
 
std::ostream & operator<< (std::ostream &out, const Filtration_core &f)
 Overload of the <<operator for filtrations.
 

Member Typedef Documentation

◆ CellDim

template<typename CoefficientType , typename ComplexType , typename DegreeType >
typedef std::pair<std::size_t, int> CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::CellDim

Type for indexing uniquely a cell.

  • First element of the pair: index of the cell.
  • Second element of the pair: dimension of the cell.

Constructor & Destructor Documentation

◆ Filtration_core() [1/3]

template<typename CoefficientType , typename ComplexType , typename DegreeType >
CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::Filtration_core ( const ComplexType &  K)

Filtration_core default constructor.

Builds an "empty" filtration with K as underlying chain complex.

Parameters
[in]KA chain complex (a model of AbstractChainComplex), the underlying chain complex of the filtration.

◆ Filtration_core() [2/3]

template<typename CoefficientType , typename ComplexType , typename DegreeType >
CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::Filtration_core ( const ComplexType &  K,
const std::vector< CellDim > &  filtration,
const std::vector< DegreeType > &  deg 
)

Constructor from a vector of cells (ordering of cells) and an associated vector of degrees.

The constructor check that the filtration is valid (a cell is introduced in the filtration after its faces and the degree vector is increasing) and throw an exception if not.

Parameters
[in]KA chain complex (a model of AbstractChainComplex), the underlying chain complex of the filtration.
[in]filtrationAn ordering of the cells of K encoded as a vector of its cells.
[in]degThe (increasing) vector of cells degrees.

◆ Filtration_core() [3/3]

template<typename CoefficientType , typename ComplexType , typename DegreeType >
CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::Filtration_core ( const Filtration_core< CoefficientType, ComplexType, DegreeType > &  f)

Constructor by copy.

Builds a Filtration_core by copy from another.

Parameters
[in]fAn initial Filtration_core.

Member Function Documentation

◆ begin()

template<typename CoefficientType , typename ComplexType , typename DegreeType >
iterator CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::begin ( )

Iterator to the beginning of the filtration.

Returns
The iterator to the beginning of the filtration.

◆ end()

template<typename CoefficientType , typename ComplexType , typename DegreeType >
iterator CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::end ( )

Iterator to the ending of the filtration.

Returns
The iterator to the ending of the filtration.

◆ export_filtration()

template<typename CoefficientType , typename ComplexType , typename DegreeType >
vector< vector< std::size_t > > CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::export_filtration ( ) const

Exports the filtration time indices.

The method exports the time index of every cells in each dimension.

Returns
A vector containing, for each dimension, the vector of labels by cell index.

◆ is_valid_filtration()

template<typename CoefficientType , typename ComplexType , typename DegreeType >
bool CGAL::HDVF::Filtration_core< CoefficientType, ComplexType, DegreeType >::is_valid_filtration

Checks if a filtration is valid.

Checks that cells are ordered in increasing degrees and all cells have indices larger than their faces.

Returns
true if the filtration is valid, false otherwise