|
tatami_chunked
Helpers to create custom chunked tatami matrices
|
Factory for sparse slabs. More...
#include <SparseSlabFactory.hpp>
Classes | |
| struct | Slab |
| Sparse slab. More... | |
Public Member Functions | |
| SparseSlabFactory (Index_ target_dim, Index_ non_target_dim, std::size_t slab_size, Index_ max_slabs, bool needs_value, bool needs_index) | |
| SparseSlabFactory (Index_ target_dim, Index_ non_target_dim, Index_ max_slabs, bool needs_value, bool needs_index) | |
| SparseSlabFactory (Index_ target_dim, Index_ non_target_dim, const SlabCacheStats< Index_ > &stats, bool needs_value, bool needs_index) | |
| Slab | create () |
Factory for sparse slabs.
An instance of this class allocates two memory pools (for values and indices) during its construction. Each slab simply contains pointers into this pool at regular offsets. The idea is to allocate large blocks for caching in, e.g., LruSlabCache, improving performance by avoiding repeated requests to the allocator. This also reduces fragmentation that could increase memory usage beyond the expected cache size.
| Value_ | Type of the data in each slab. |
| Index_ | Integer type of the dimension extent and the type of the indices in each slab. This should also be the type of the maximum number of slabs required to span the relevant dimension, see the template parameter of the same name in SlabCacheStats. |
| Count_ | Integer type for counting structural non-zeros. This should be large enough to store the extent of the non-target dimension of the slab. |
|
inline |
| target_dim | Extent of the target dimension of the slab, i.e., the dimension that is indexed into. |
| non_target_dim | Extent of the non-target dimension of the slab. |
| slab_size | Size of the slab. This should be equal to the product of target_dim and non_target_dim. |
| max_slabs | Maximum number of slabs. |
| needs_value | Whether the values of the structural non-zeros should be cached. |
| needs_index | Whether the indices of the structural non-zeros should be cached. |
|
inline |
Overload that computes slab_size automatically.
| target_dim | Extent of the target dimension of the slab. |
| non_target_dim | Extent of the non-target dimension of the slab. |
| max_slabs | Maximum number of slabs. |
| needs_value | Whether the values of the structural non-zeros should be cached. |
| needs_index | Whether the indices of the structural non-zeros should be cached. |
|
inline |
Overload that takes the relevant statistics from a SlabCacheStats object.
| target_dim | Extent of the target dimension of the slab. |
| non_target_dim | Extent of the non-target dimension of the slab. |
| stats | Slab statistics, computed from target_dim and non_target_dim. |
| needs_value | Whether the values of the structural non-zeros should be cached. |
| needs_index | Whether the indices of the structural non-zeros should be cached. |
|
inline |
Create a new slab, i.e., designate a portion of each memory pool for use through the returned pointers. This should not be called more than max_slabs times.