tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
tatami::IndexSparsifiedWrapper< oracle_, Value_, Index_ > Class Template Reference

Wrap an indexed dense extractor in the sparse interface. More...

#include <SparsifiedWrapper.hpp>

Inherits SparseExtractor< oracle_, Value_, Index_ >.

Public Member Functions

 IndexSparsifiedWrapper (std::unique_ptr< DenseExtractor< oracle_, Value_, Index_ > > dense, VectorPtr< Index_ > indices_ptr, const Options &opt)
 
SparseRange< Value_, Index_fetch (Index_ i, Value_ *value_buffer, Index_ *index_buffer)
 

Detailed Description

template<bool oracle_, typename Value_, typename Index_>
class tatami::IndexSparsifiedWrapper< oracle_, Value_, Index_ >

Wrap an indexed dense extractor in the sparse interface.

This can be used to quickly implement the indexed sparse extraction methods for a dense Matrix subclass. The dense extraction is performed as usual and every value is treated as a structural non-zero; this wrapper just adds the associated indices to satisfy the sparse extraction interface.

Template Parameters
oracle_Whether an oracle is involved.
Value_Type of the matrix values.
Index_Type of the row/column indices.

Constructor & Destructor Documentation

◆ IndexSparsifiedWrapper()

template<bool oracle_, typename Value_ , typename Index_ >
tatami::IndexSparsifiedWrapper< oracle_, Value_, Index_ >::IndexSparsifiedWrapper ( std::unique_ptr< DenseExtractor< oracle_, Value_, Index_ > >  dense,
VectorPtr< Index_ indices_ptr,
const Options opt 
)
inline
Parameters
denseInstance of a dense extractor for an indexed subset of the non-target dimension. If oracle_ = true, this should be an instance of a MyopicDenseExtractor subclass; otherwise it should be an OracularDenseExtractor instance.
indices_ptrPointer to a vector of sorted and unique indices for the non-target dimension. Should be the same as that used to construct dense.
optOptions for extraction.

Member Function Documentation

◆ fetch()

template<bool oracle_, typename Value_ , typename Index_ >
SparseRange< Value_, Index_ > tatami::IndexSparsifiedWrapper< oracle_, Value_, Index_ >::fetch ( Index_  i,
Value_ value_buffer,
Index_ index_buffer 
)
inline
Parameters
iIndex of the element to extract on the target dimension, ignored if oracle_ = true.
[in,out]value_bufferSee MyopicSparseExtractor::fetch() or OracularSparseExtractor::fetch().
[in,out]index_bufferSee MyopicSparseExtractor::fetch() or OracularSparseExtractor::fetch().
Returns
Sparse output, see MyopicSparseExtractor::fetch() or OracularSparseExtractor::fetch().

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