|
| | CrsMap (const std::vector< std::vector< DataType > > &data) |
| | CrsMap (const std::vector< DataType > &data, const std::vector< IndexType > &indices) |
| | Construct a CrsMap with the provided data and index arrays.
|
| template<class Archive> |
| void | serialize (Archive &ar, const unsigned int) |
| | CrsMap (std::vector< DataType > &&data, std::vector< IndexType > &&indices) |
| | Constructor that initializes a CrsMap by moving the provided data and indices.
|
| | CrsMap ()=default |
| | Default constructor.
|
| MutableRowView | getRow (IndexType row_idx) |
| | Get a mutable view over a row.
|
| ConstRowView | getRow (IndexType row_idx) const |
| | Get a constant view over a row.
|
| ConstRowView | operator[] (IndexType row_idx) const |
| | Access a row using the subscript operator (constant version).
|
| MutableRowView | operator[] (IndexType row_idx) |
| | Access a row using the subscript operator (mutable version).
|
| const DataType & | operator() (IndexType row_idx, IndexType col_idx) const |
| | Access an element in the CRS map by row and column index (constant version).
|
| DataType & | operator() (IndexType row_idx, IndexType col_idx) |
| | Access an element in the CRS map by row and column index (mutable version).
|
| IndexType | size () const |
| | Get the number of rows in the CRS map.
|
| auto | slice (const std::vector< IndexType > &subindices) const |
| | Get a CrsMap with the rows of the passed indexes.
|
| auto | permute (const std::vector< IndexType > &perm, const std::vector< IndexType > &perm_inv) const |
| | Get a CrsMap obtained by applying a permutation to this instance.
|
| void | remove (const DataType &value_to_remove) |
| | Remove in-place all entries with a certain value.
|
| void | pushBack (const std::vector< DataType > &row) |
| const auto & | data () const |
| | Constant accessor to the data buffer.
|
| const auto & | indices () const |
| | Constant accessor to the indices buffer.
|
| auto & | data () |
| | Accessor to the data buffer.
|
| auto & | indices () |
| | Accessor to the indices buffer.
|
template<typename DataType, typename IndexType, IndexType RowSize = IndexType(-1)>
class vulpes::datastructure::CrsMap< DataType, IndexType, RowSize >
- Template Parameters
-
| DataType | The type of data to be stored in the CRS map. |
| IndexType | The type used for indices in the CRS map. |
| RowSize | Size of each row. If set to -1, the row size is dynamic. |
This class represents a Compressed Row Storage (CRS) structure, which works like a vector of vectors for efficient storage. If DataType is a std::pair<IndexType, double>, it models a CRS matrix. The row size can either be fixed or dynamic based on the RowSize template argument.
template<typename DataType, typename IndexType, IndexType RowSize = IndexType(-1)>
Constructor that initializes a CrsMap by moving the provided data and indices.
This constructor takes ownership of the provided data and indices vectors by moving them into the internal storage. This allows efficient initialization without copying the vectors, especially when compressing a CrsMapUncompressed
- Parameters
-
| data | A rvalue reference to a vector containing the data elements, typically representing non-zero values in a compressed row storage (CRS) format. The vector will be moved into the internal storage. |
| indices | A rvalue reference to a vector containing the row indices in the CRS format. The vector will be moved into the internal storage. |
- Note
- After calling this constructor, the passed data and indices vectors will be in a valid but unspecified state, as their contents will have been moved into the CrsMap instance.
template<typename DataType, typename IndexType, IndexType RowSize = IndexType(-1)>
Access an element in the CRS map by row and column index (mutable version).
This method allows mutable access to an element in the compressed row storage (CRS) matrix using both row and column indices. The access pattern differs based on whether the row size is fixed or dynamic.
- Parameters
-
| row_idx | The index of the row. |
| col_idx | The index of the column within the specified row. |
- Returns
- Mutable reference to the element at the specified row and column.
template<typename DataType, typename IndexType, IndexType RowSize = IndexType(-1)>
Access an element in the CRS map by row and column index (constant version).
This method allows access to an element in the compressed row storage (CRS) matrix using both row and column indices. The access pattern differs based on whether the row size is fixed or dynamic.
- Parameters
-
| row_idx | The index of the row. |
| col_idx | The index of the column within the specified row. |
- Returns
- Constant reference to the element at the specified row and column.