tatami_chunked
Helpers to create custom chunked tatami matrices
Loading...
Searching...
No Matches
tatami_chunked::SlabCacheStats< MaxSlabs_ > Struct Template Reference

Statistics for slab caching. More...

#include <SlabCacheStats.hpp>

Public Member Functions

template<typename Index_ , typename TargetNumSlabs_ >
 SlabCacheStats (Index_ target_length, Index_ non_target_length, TargetNumSlabs_ target_num_slabs, std::size_t cache_size_in_elements, bool require_minimum_cache)
 
template<typename Index_ , typename TargetNumSlabs_ >
 SlabCacheStats (Index_ target_length, Index_ non_target_length, TargetNumSlabs_ target_num_slabs, std::size_t cache_size_in_bytes, std::size_t element_size, bool require_minimum_cache)
 

Public Attributes

std::size_t slab_size_in_elements
 
MaxSlabs_ max_slabs_in_cache
 

Detailed Description

template<typename MaxSlabs_>
struct tatami_chunked::SlabCacheStats< MaxSlabs_ >

Statistics for slab caching.

This computes the slab size and the number of slabs to be cached, given the dimensions of the slab and the cache size in bytes. The assumption is that all slabs are of the same shape, partitioning the matrix into regular intervals along the target dimension. Developers should check out CustomDenseChunkedMatrix for some usage examples.

Template Parameters
MaxSlabs_Integer type of the maximum number of slabs.

Constructor & Destructor Documentation

◆ SlabCacheStats() [1/2]

template<typename MaxSlabs_ >
template<typename Index_ , typename TargetNumSlabs_ >
tatami_chunked::SlabCacheStats< MaxSlabs_ >::SlabCacheStats ( Index_ target_length,
Index_ non_target_length,
TargetNumSlabs_ target_num_slabs,
std::size_t cache_size_in_elements,
bool require_minimum_cache )
inline
Template Parameters
Index_Integer type of the dimension extents.
TargetNumSlabs_Integer type of the number of slabs along the target dimension.
Parameters
target_lengthLength of the target dimension of each slab. For example, if we were iterating through rows of a matrix, target_length would be the number of rows spanned by each slab.
non_target_lengthLength of the non-target dimension of each slab. For example, if we were iterating through matrix rows, the non_target_length would be the number of columns spanned by each slab.
target_num_slabsNumber of slabs required to span the full extent of the target dimension of the matrix. This is used as an upper bound on the value of max_slabs_in_cache. For example, if we were iterating through matrix rows, the target_num_slabs would be the number of slabs required to span all rows of the matrix.
cache_size_in_elementsTotal size of the cache, in terms of the number of data elements.
require_minimum_cacheWhether to enforce a minimum size of the cache for efficient extraction of consecutive dimension elements, even if it exceeds cache_size_in_elements.

◆ SlabCacheStats() [2/2]

template<typename MaxSlabs_ >
template<typename Index_ , typename TargetNumSlabs_ >
tatami_chunked::SlabCacheStats< MaxSlabs_ >::SlabCacheStats ( Index_ target_length,
Index_ non_target_length,
TargetNumSlabs_ target_num_slabs,
std::size_t cache_size_in_bytes,
std::size_t element_size,
bool require_minimum_cache )
inline
Template Parameters
Index_Integer type of the dimension extents.
TargetNumSlabs_Integer type of the number of slabs along the target dimension.
Parameters
target_lengthLength of the target dimension of each slab. For example, if we were iterating through rows of a matrix, target_length would be the number of rows spanned by each slab.
non_target_lengthLength of the non-target dimension of each slab. For example, if we were iterating through matrix rows, the non_target_length would be the number of columns spanned by each slab.
target_num_slabsNumber of slabs required to span the full extent of the target dimension of the matrix. This is used as an upper bound on the value of max_slabs_in_cache. For example, if we were iterating through matrix rows, the target_num_slabs would be the number of slabs required to span all rows of the matrix.
cache_size_in_bytesTotal size of the cache, in terms of the number of bytes.
element_sizeSize of each data element in the cache, in bytes. This may be zero, e.g., when neither the value nor the index are required during sparse extraction.
require_minimum_cacheWhether to enforce a minimum size of the cache for efficient extraction of consecutive dimension elements, even if it exceeds cache_size_in_bytes.

Member Data Documentation

◆ slab_size_in_elements

template<typename MaxSlabs_ >
std::size_t tatami_chunked::SlabCacheStats< MaxSlabs_ >::slab_size_in_elements

Size of each slab, in terms of the number of data elements.

◆ max_slabs_in_cache

template<typename MaxSlabs_ >
MaxSlabs_ tatami_chunked::SlabCacheStats< MaxSlabs_ >::max_slabs_in_cache

Number of slabs that can fit in the cache. This is used as max_slabs in LruSlabCache, OracularSlabCache and friends.


The documentation for this struct was generated from the following file: