tatami_chunked
Helpers to create custom chunked tatami matrices
|
Oracle-aware cache for slabs, plus subsets. More...
#include <OracularSubsettedSlabCache.hpp>
Public Member Functions | |
OracularSubsettedSlabCache (std::shared_ptr< const tatami::Oracle< Index_ > > oracle, size_t max_slabs) | |
OracularSubsettedSlabCache (const OracularSubsettedSlabCache &)=delete | |
OracularSubsettedSlabCache & | operator= (const OracularSubsettedSlabCache &)=delete |
Index_ | next () |
template<class Ifunction_ , class Cfunction_ , class Pfunction_ > | |
std::pair< const Slab_ *, Index_ > | next (Ifunction_ identify, Cfunction_ create, Pfunction_ populate) |
size_t | get_max_slabs () const |
size_t | get_num_slabs () const |
Oracle-aware cache for slabs, plus subsets.
Id_ | Type of slab identifier, typically integer. |
Index_ | Type of row/column index produced by the oracle. |
Slab_ | Class for a single slab. |
Implement an oracle-aware cache for slab subsets. Each slab is defined as the set of chunks required to read an element of the target dimension (or a contiguous block/indexed subset thereof) from a tatami::Matrix
. This cache is similar to the OracularSlabCache
except that it remembers the subset of elements on the target dimension that were requested for each slab. Slab extractors can use this information to optimize slab loading by ignoring unneeded elements.
|
inline |
oracle | Pointer to an tatami::Oracle to be used for predictions. |
max_slabs | Maximum number of slabs to store. |
|
delete |
Deleted as the cache holds persistent pointers.
|
delete |
Deleted as the cache holds persistent pointers.
|
inline |
This method is intended to be called when num_slabs = 0
, to provide callers with the oracle predictions for non-cached extraction of data. Calls to this method should not be intermingled with calls to its overload below; the latter should only be called when max_slabs > 0
.
|
inline |
Fetch the next slab according to the stream of predictions provided by the tatami::Oracle
. This method should only be called if num_slabs > 0
in the constructor; otherwise, no slabs are actually available and cannot be returned.
Ifunction_ | Function to identify the slab containing each predicted row/column. |
Cfunction_ | Function to create a new slab. |
Pfunction_ | Function to populate zero, one or more slabs with their contents. |
identify | Function that accepts an i , an Index_ containing the predicted index of a single element on the target dimension. This should return a pair containing:
|
create | Function that accepts no arguments and returns a Slab_ object with sufficient memory to hold a slab's contents when used in populate() . This may also return a default-constructed Slab_ object if the allocation is done dynamically per slab in populate() . |
populate | Function that accepts a std::vector<std::tuple<Id_, Slab_*, const OracularSubsettedSlabCacheSelectionDetails<Index_>*> >& specifying the slabs to be populated. The first Id_ element of each tuple contains the slab identifier, i.e., the first element returned by the identify function. The second Slab_* element specifies the object which to store the contents of the slab. The third OracularSubsettedSlabCacheSelectionDetails<Index_>* element contains information about the desired subset of elements on the target dimension of the slab. This function should iterate over the vector and populate the desired subset of each slab. The vector is guaranteed to be non-empty but is not guaranteed to be sorted. |
|
inline |
|
inline |