CGAL 6.1 - Homological Discrete Vector Fields
Loading...
Searching...
No Matches
CGAL::OSM Namespace Reference

Classes

class  Bitboard
 The class Bitboard implements an accelerating structure, derived from the chess community. More...
 
class  Sparse_chain
 The class Sparse_chain implements the concept SparseChain, that is, sparse vectors (encoding homological chains) optimized for topological computations. More...
 
class  Sparse_matrix
 The class Sparse_matrix implements the concept SparseMatrix, that is, sparse matrices optimized for topological computations. More...
 
class  Sub_sparse_matrix
 The class Sub_sparse_matrix is a technical class implementing the concept SparseMatrix together with a system of masks to partially screen matrices (and restrict computations to a subset of indices along their major direction). More...
 

Typedefs

typedef int ZCoefficient
 The default type for signed integers.
 

Functions

template<typename _CT >
Sparse_matrix< _CT, COLUMNoperator* (const Sparse_chain< _CT, COLUMN > &column, const Sparse_chain< _CT, ROW > &row)
 
template<typename _CT >
Sparse_matrix< _CT, ROWoperator% (const Sparse_chain< _CT, COLUMN > &column, const Sparse_chain< _CT, ROW > &row)
 
template<typename CoefficientType >
CoefficientType operator* (const Sparse_chain< CoefficientType, ROW > &row, const Sparse_chain< CoefficientType, COLUMN > &column)
 
template<typename _CT , int _CTF>
Sparse_chain< _CT, _CTF > operator/ (const Sparse_chain< _CT, _CTF > &chain, const std::vector< size_t > &indices)
 
template<typename _CT , int _CTF>
Sparse_chain< _CT, _CTF > operator/ (const Sparse_chain< _CT, _CTF > &chain, size_t index)
 
template<typename _CT >
bool operator== (const Sparse_chain< _CT, OSM::COLUMN > &chain, const Sparse_chain< _CT, OSM::COLUMN > &other)
 
template<typename _CT >
bool operator== (const Sparse_chain< _CT, OSM::ROW > &chain, const Sparse_chain< _CT, OSM::ROW > &other)
 
template<typename _CT >
bool operator== (const Sparse_chain< _CT, OSM::COLUMN > &chain, const Sparse_chain< _CT, OSM::ROW > &other)
 
template<typename _CT >
bool operator== (const Sparse_chain< _CT, OSM::ROW > &chain, const Sparse_chain< _CT, OSM::COLUMN > &other)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMNoperator* (const Sparse_matrix< _CT, COLUMN > &first, const Sparse_matrix< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMNoperator* (const Sparse_matrix< _CT, ROW > &first, const Sparse_matrix< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMNoperator* (const Sparse_matrix< _CT, COLUMN > &first, const Sparse_matrix< _CT, ROW > &second)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMNoperator* (const Sparse_matrix< _CT, ROW > &first, const Sparse_matrix< _CT, ROW > &second)
 
template<typename _CT >
Sparse_chain< _CT, COLUMNoperator* (const Sparse_matrix< _CT, COLUMN > &first, const Sparse_chain< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_chain< _CT, COLUMNoperator* (const Sparse_matrix< _CT, ROW > &first, const Sparse_chain< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_chain< _CT, ROWoperator* (const Sparse_chain< _CT, ROW > &first, const Sparse_matrix< _CT, ROW > &second)
 
template<typename _CT >
Sparse_chain< _CT, ROWoperator* (const Sparse_chain< _CT, ROW > &first, const Sparse_matrix< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_matrix< _CT, ROWoperator% (const Sparse_matrix< _CT, COLUMN > &first, const Sparse_matrix< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_matrix< _CT, ROWoperator% (const Sparse_matrix< _CT, ROW > &first, const Sparse_matrix< _CT, COLUMN > &second)
 
template<typename _CT >
Sparse_matrix< _CT, ROWoperator% (const Sparse_matrix< _CT, COLUMN > &first, const Sparse_matrix< _CT, ROW > &second)
 
template<typename _CT >
Sparse_matrix< _CT, ROWoperator% (const Sparse_matrix< _CT, ROW > &first, const Sparse_matrix< _CT, ROW > &second)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMN > & operator+= (Sparse_matrix< _CT, COLUMN > &matrix, const Sparse_matrix< _CT, ROW > &other)
 
template<typename _CT >
Sparse_matrix< _CT, ROW > & operator+= (Sparse_matrix< _CT, ROW > &matrix, const Sparse_matrix< _CT, COLUMN > &other)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMN > & operator-= (Sparse_matrix< _CT, COLUMN > &matrix, const Sparse_matrix< _CT, ROW > &other)
 
template<typename _CT >
Sparse_matrix< _CT, ROW > & operator-= (Sparse_matrix< _CT, ROW > &matrix, const Sparse_matrix< _CT, COLUMN > &other)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMN > & operator*= (Sparse_matrix< _CT, COLUMN > &matrix, const Sparse_matrix< _CT, COLUMN > &other)
 
template<typename _CT >
Sparse_matrix< _CT, ROW > & operator*= (Sparse_matrix< _CT, ROW > &matrix, const Sparse_matrix< _CT, ROW > &other)
 
template<typename _CT >
Sparse_matrix< _CT, COLUMN > & operator*= (Sparse_matrix< _CT, COLUMN > &matrix, const Sparse_matrix< _CT, ROW > &other)
 
template<typename _CT >
Sparse_matrix< _CT, ROW > & operator*= (Sparse_matrix< _CT, ROW > &matrix, const Sparse_matrix< _CT, COLUMN > &other)
 
template<typename _CT >
Sparse_chain< _CT, COLUMNget_column (const Sparse_matrix< _CT, COLUMN > &matrix, size_t index)
 
template<typename _CT >
Sparse_chain< _CT, COLUMNget_column (const Sparse_matrix< _CT, ROW > &matrix, size_t index)
 
template<typename _CT >
Sparse_chain< _CT, ROWget_row (const Sparse_matrix< _CT, COLUMN > &matrix, size_t index)
 
template<typename _CT >
Sparse_chain< _CT, ROWget_row (const Sparse_matrix< _CT, ROW > &matrix, size_t index)
 
template<typename _CT >
const Sparse_chain< _CT, COLUMN > & cget_column (const Sparse_matrix< _CT, COLUMN > &matrix, size_t index)
 
template<typename _CT >
const Sparse_chain< _CT, ROW > & cget_row (const Sparse_matrix< _CT, ROW > &matrix, const size_t index)
 
template<typename _CT >
void set_column (Sparse_matrix< _CT, COLUMN > &matrix, size_t index, const Sparse_chain< _CT, COLUMN > &chain)
 
template<typename _CT >
void set_column (Sparse_matrix< _CT, ROW > &matrix, size_t index, const Sparse_chain< _CT, COLUMN > &chain)
 
template<typename _CT >
void set_row (Sparse_matrix< _CT, COLUMN > &matrix, size_t index, const Sparse_chain< _CT, ROW > &chain)
 
template<typename _CT >
void set_row (Sparse_matrix< _CT, ROW > &matrix, size_t index, const Sparse_chain< _CT, ROW > &chain)
 
template<typename _CT , int _CTF>
void set_coef (Sparse_matrix< _CT, _CTF > &matrix, size_t i, size_t j, const _CT d)
 
template<typename _CT , int _CTF>
_CT get_coef (const Sparse_matrix< _CT, _CTF > &matrix, size_t i, size_t j)
 
template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & del_column (Sparse_matrix< _CT, _CTF > &matrix, size_t index)
 
template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & del_row (Sparse_matrix< _CT, _CTF > &matrix, size_t index)
 
template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & del_coef (Sparse_matrix< _CT, _CTF > &matrix, size_t i, size_t j)
 
template<typename _CT >
std::ostream & write_matrix (const Sparse_matrix< _CT, OSM::COLUMN > &M, std::ostream &out)
 
template<typename _CT >
std::ostream & write_matrix (const Sparse_matrix< _CT, OSM::ROW > &M, std::ostream &out)
 
template<typename _CT >
std::istream & read_matrix (Sparse_matrix< _CT, OSM::COLUMN > &M, std::istream &in)
 
template<typename _CT >
std::istream & read_matrix (Sparse_matrix< _CT, OSM::ROW > &M, std::istream &in)
 
template<typename _CT >
bool operator== (const Sparse_matrix< _CT, OSM::COLUMN > &matrix, const Sparse_matrix< _CT, OSM::COLUMN > &other)
 
template<typename _CT >
bool operator== (const Sparse_matrix< _CT, OSM::ROW > &matrix, const Sparse_matrix< _CT, OSM::ROW > &other)
 
template<typename _CT >
bool operator== (const Sparse_matrix< _CT, OSM::ROW > &matrix, const Sparse_matrix< _CT, OSM::COLUMN > &other)
 
template<typename _CT >
bool operator== (const Sparse_matrix< _CT, OSM::COLUMN > &matrix, const Sparse_matrix< _CT, OSM::ROW > &other)
 

Variables

const int COLUMN = 0b01
 Chain type flag for column chain.
 
const int ROW = 0b10
 Chain type flag for row chain.
 
const size_t size_t_maxvalue = std::numeric_limits<size_t>::max()
 
const int tab64 [64]
 
const int index64 [64]
 

Function Documentation

◆ cget_column()

template<typename _CT >
const Sparse_chain< _CT, COLUMN > & CGAL::OSM::cget_column ( const Sparse_matrix< _CT, COLUMN > &  matrix,
size_t  index 
)

Constant time get.

Warning
The matrix will perform boundary check.
Parameters
[in]matrixThe matrix considered.
[in]indexThe column index.
Returns
A constant reference over the column stored at given index.
Examples
HDVF/example_matrix_chain.cpp.

◆ cget_row()

template<typename _CT >
const Sparse_chain< _CT, ROW > & CGAL::OSM::cget_row ( const Sparse_matrix< _CT, ROW > &  matrix,
const size_t  index 
)

Constant time get.

Warning
The matrix will perform boundary check.
Parameters
[in]matrixThe matrix considered.
[in]indexThe row index.
Returns
A const reference over the row stored at given index.

◆ del_coef()

template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & CGAL::OSM::del_coef ( Sparse_matrix< _CT, _CTF > &  matrix,
size_t  i,
size_t  j 
)

Removes coefficient at row i and column j.

Parameters
[in]matrixReference on the matrix to modify.
[in]iIndex of the row
[in]jIndex of the column
Returns
The modified matrix representing the result.

◆ del_column()

template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & CGAL::OSM::del_column ( Sparse_matrix< _CT, _CTF > &  matrix,
size_t  index 
)

Removes column of index index whatever the ChainTypeFlag of the matrix. For column matrices, it just comes to the \= operator and for row matrices, it entails a traversal of the matrix.

Parameters
[in]matrixReference on the matrix to modify.
[in]indexThe index to remove.
Returns
The modified matrix representing the result.

◆ del_row()

template<typename _CT , int _CTF>
Sparse_matrix< _CT, _CTF > & CGAL::OSM::del_row ( Sparse_matrix< _CT, _CTF > &  matrix,
size_t  index 
)

Removes row of index index whatever the ChainTypeFlag of the matrix. For row matrices, it just comes to the \= operator and for column matrices, it entails a traversal of the matrix.

Parameters
[in]matrixReference on the matrix to modify.
[in]indexThe index to remove.
Returns
The modified matrix representing the result.

◆ get_coef()

template<typename _CT , int _CTF>
_CT CGAL::OSM::get_coef ( const Sparse_matrix< _CT, _CTF > &  matrix,
size_t  i,
size_t  j 
)

Returns the coefficient on row i and column j of the matrix.

Warning
The matrix will perform boundary check.
Parameters
[in]matrixConstant reference on the matrix.
[in]iThe row index.
[in]jThe column index.
Returns
The value of the given coefficient.

◆ operator%()

template<typename _CT >
Sparse_matrix< _CT, ROW > CGAL::OSM::operator% ( const Sparse_chain< _CT, COLUMN > &  column,
const Sparse_chain< _CT, ROW > &  row 
)

Generate a row-based matrix from the matrix multiplication and return it.

Precondition
Chains must have the same CoefficientType.
Warning
Will raise an error if chains do not have the same CoefficientType.
Parameters
[in]columnThe column chain.
[in]rowThe row chain.
Returns
The result of the matrix multiplication, row-based.

◆ operator*()

template<typename _CT >
Sparse_matrix< _CT, COLUMN > CGAL::OSM::operator* ( const Sparse_chain< _CT, COLUMN > &  column,
const Sparse_chain< _CT, ROW > &  row 
)

Generate a column-based matrix from the matrix multiplication and return it.

Precondition
Chains must have the same CoefficientType.
Warning
Will raise an error if chains do not have the same CoefficientType.
Parameters
[in]columnThe column chain.
[in]rowThe row chain.
Returns
The result of the matrix multiplication, column-based.

◆ operator/() [1/2]

template<typename _CT , int _CTF>
Sparse_chain< _CT, _CTF > CGAL::OSM::operator/ ( const Sparse_chain< _CT, _CTF > &  chain,
const std::vector< size_t > &  indices 
)

Return a new chain where all coefficients of indices provided in the vector are removed.

Note
Will return a copy of the chain if indices is empty.
Parameters
[in]chainThe chain to process.
[in]indicesThe indexes to remove.
Returns
A new chain representing the result.

◆ operator/() [2/2]

template<typename _CT , int _CTF>
Sparse_chain< _CT, _CTF > CGAL::OSM::operator/ ( const Sparse_chain< _CT, _CTF > &  chain,
size_t  index 
)

Return a new chain where the coefficients at a given index is removed.

Parameters
[in]chainThe chain to process.
[in]indexThe index to remove.

◆ set_coef()

template<typename _CT , int _CTF>
void CGAL::OSM::set_coef ( Sparse_matrix< _CT, _CTF > &  matrix,
size_t  i,
size_t  j,
const _CT  d 
)

Assign the scalar d to the coefficient on row i and column j.

Warning
The matrix will perform boundary check.
Parameters
[in]matrixReference on the matrix to modify.
[in]iThe row index.
[in]jThe column index.
[in]dThe value.
Examples
HDVF/example_matrix_chain.cpp.

Variable Documentation

◆ index64

const int CGAL::OSM::index64[64]
Initial value:
= {
0, 47, 1, 56, 48, 27, 2, 60,
57, 49, 41, 37, 28, 16, 3, 61,
54, 58, 35, 52, 50, 42, 21, 44,
38, 32, 29, 23, 17, 11, 4, 62,
46, 55, 26, 59, 40, 36, 15, 53,
34, 51, 20, 43, 31, 22, 10, 45,
25, 39, 14, 33, 19, 30, 9, 24,
13, 18, 8, 12, 7, 6, 5, 63
}

◆ tab64

const int CGAL::OSM::tab64[64]
Initial value:
= {
63, 0, 58, 1, 59, 47, 53, 2,
60, 39, 48, 27, 54, 33, 42, 3,
61, 51, 37, 40, 49, 18, 28, 20,
55, 30, 34, 11, 43, 14, 22, 4,
62, 57, 46, 52, 38, 26, 32, 41,
50, 36, 17, 19, 29, 10, 13, 21,
56, 45, 25, 31, 35, 16, 9, 12,
44, 24, 15, 8, 23, 7, 6, 5
}