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

Mimic the OracularSparseExtractor interface. More...

#include <PseudoOracularExtractor.hpp>

Inheritance diagram for tatami::PseudoOracularSparseExtractor< Value_, Index_ >:
Inheritance graph
[legend]
Collaboration diagram for tatami::PseudoOracularSparseExtractor< Value_, Index_ >:
Collaboration graph
[legend]

Public Member Functions

 PseudoOracularSparseExtractor (std::shared_ptr< const Oracle< Index_ > > oracle, std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > ext)
 
SparseRange< Value_, Index_fetch (Index_, Value_ *value_buffer, Index_ *index_buffer)
 
- Public Member Functions inherited from tatami::OracularSparseExtractor< Value_, Index_ >
SparseRange< Value_, Index_fetch (Value_ *value_buffer, Index_ *index_buffer)
 

Detailed Description

template<typename Value_, typename Index_>
struct tatami::PseudoOracularSparseExtractor< Value_, Index_ >

Mimic the OracularSparseExtractor interface.

Template Parameters
Value_Data value type, should be numeric.
Index_Row/column index type, should be integer.

This is used to quickly implement the sparse extraction methods for a Matrix subclass that does not benefit from an Oracle. Specifically, the oracle is used to generate a prediction that is passed to an oracle-unaware MyopicSparseExtractor. This allows Matrix subclasses to satisfy the sparse oracle-aware extraction interface without much effort.

Constructor & Destructor Documentation

◆ PseudoOracularSparseExtractor()

tatami::PseudoOracularSparseExtractor< Value_, Index_ >::PseudoOracularSparseExtractor ( std::shared_ptr< const Oracle< Index_ > >  oracle,
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > >  ext 
)
inline
Parameters
oracleThe oracle.
extA sparse extractor to extract dimension elements according to ora.

Member Function Documentation

◆ fetch()

SparseRange< Value_, Index_ > tatami::PseudoOracularSparseExtractor< Value_, Index_ >::fetch ( Index_  i,
Value_ value_buffer,
Index_ index_buffer 
)
inlinevirtual

This overload is intended for developers only. It introduces the i argument so that the signature is the same as that of MyopicSparseExtractor::fetch(). This makes it easier to define MyopicSparseExtractor and OracularSparseExtractor subclasses from a single template, avoiding code duplication that would otherwise occur when defining methods with and without i. Of course, implementations are expected to ignore i in oracle-aware extraction.

Other than the extra i argument, all other behaviors of the two overloads are the same. To avoid confusion, most users should just use the fetch() overload that does not accept i, given that the value of i is never actually used.

Parameters
iIgnored, only provided for consistency with MyopicSparseExtractor::fetch().
[out]value_bufferPointer to an array with enough space for at least N values, where N is defined as described for MyopicDenseExtractor::fetch().
[out]index_bufferPointer to an array with enough space for at least N indices, where N is defined as described for MyopicDenseExtractor::fetch().
Returns
A SparseRange object describing the contents of the next dimension element, as predicted by the Oracle used to construct this instance.

Implements tatami::OracularSparseExtractor< Value_, Index_ >.


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