A class that behaves like a vector of vectors, providing automatic row range checking.
More...
|
| | CrsMapUncompressed ()=default |
| | CrsMapUncompressed (std::initializer_list< SmallVector< DataType, N > > init_list) |
| | Constructs a CrsMapUncompressed object with an initializer list of SmallVector objects.
|
| constexpr auto | begin () |
| | Returns an iterator to the beginning of the map.
|
| constexpr auto | end () |
| | Returns an iterator to the end of the map.
|
| constexpr auto | begin () const |
| | Returns a constant iterator to the beginning of the map.
|
| constexpr auto | end () const |
| | Returns a constant iterator to the end of the map.
|
| constexpr const auto & | back () const |
| | Returns a constant reference to the last row of the map.
|
| constexpr auto & | back () |
| | Returns a reference to the last row of the map.
|
| constexpr void | resize (std::size_t new_size) |
| | Resizes the map to contain the specified number of SmallVector objects.
|
| constexpr const SmallVector< DataType, N > & | operator[] (std::size_t idx) const |
| | Accesses a SmallVector at the given index.
|
| constexpr SmallVector< DataType, N > & | operator[] (std::size_t idx) |
| | Accesses a SmallVector at the given index.
|
| constexpr void | push_back (const SmallVector< DataType, N > &value) |
| | Appends a copy of a SmallVector to the map.
|
| constexpr void | push_back (SmallVector< DataType, N > &&value) |
| | Appends an rvalue SmallVector to the map.
|
| template<class... Args> |
| constexpr void | emplace_back (Args &&... args) |
| SmallVector< DataType, N > & | getRow (std::size_t row_idx) |
| | Access a row of the matrix as a mutable reference.
|
| template<typename IndexType> |
| CrsMap< DataType, IndexType > | compress () const |
| | Compresses the uncompressed CrsMap into a compressed format.
|
| std::size_t | size () const |
| | Returns the number of rows in the matrix.
|
template<typename DataType, std::size_t N = 16>
class vulpes::datastructure::CrsMapUncompressed< DataType, N >
A class that behaves like a vector of vectors, providing automatic row range checking.
This class is designed to store (staggered) 2D data efficiently using a vector of SmallVector objects. It provides automatic range checking of the rows, ensuring valid access to the elements. A key performance improvement over a standard vector of vectors is the usage of coalescent memory for rows, up to a threshold specified by template parameter N. Each row is implemented as a SmallVector, which can dynamically switch between static and dynamic storage based on the size of the row.
- Template Parameters
-
| DataType | The type of data to be stored in the 2D structure. |
| N | The size threshold after which rows are stored dynamically. Defaults to 16. |
- Note
- : if the number of columns is fixed, it is better to use another datastucture.
template<typename DataType, std::size_t N = 16>
template<typename IndexType>
Compresses the uncompressed CrsMap into a compressed format.
Converts the uncompressed representation of the matrix (stored as a vector of SmallVector rows) into a compressed row storage (CRS) format. The resulting CrsMap contains the data and indices vectors, which represent the compressed matrix structure.
- Returns
- CrsMap<DataType> A compressed representation of the matrix in CRS format.