tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
tatami::OracularDenseExtractor< Value_, Index_ > Class Template Referenceabstract

Extract an element of the target dimension in dense form with an oracle. More...

#include <Extractor.hpp>

Inheritance diagram for tatami::OracularDenseExtractor< Value_, Index_ >:

Public Member Functions

const Value_ * next (Value_ *buffer)
 
virtual const Value_ * fetch (Index_ i, Value_ *buffer)=0
 

Detailed Description

template<typename Value_, typename Index_>
class tatami::OracularDenseExtractor< Value_, Index_ >

Extract an element of the target dimension in dense form with an oracle.

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

Member Function Documentation

◆ next()

template<typename Value_ , typename Index_ >
const Value_ * tatami::OracularDenseExtractor< Value_, Index_ >::next ( Value_ * buffer)
inline

buffer may not necessarily be filled upon extraction if a pointer can be returned to the underlying data store. This can be checked by comparing the returned pointer to buffer; if they are the same, buffer has been filled.

Parameters
[out]bufferPointer to an array of length no less than N, where N is defined as described for MyopicDenseExtractor::fetch().
Returns
Pointer to an array containing the contents of the next element of the target dimension, as predicted by the Oracle used to construct this instance. This is guaranteed to be filled with N values.
If the returned pointer is equal to buffer, this means that buffer has been filled with the contents of the i-th dimension element.
If the returned pointer is not equal to buffer, it should refer to another array of length N. This array should be valid for the lifetime of the Matrix object used to construct this OracularDenseExtractor. Similarly, the contents should not change for the lifetime of the Matrix. In this situation, no guarantees are provided for the contents of buffer.

◆ fetch()

template<typename Value_ , typename Index_ >
virtual const Value_ * tatami::OracularDenseExtractor< Value_, Index_ >::fetch ( Index_ i,
Value_ * buffer )
pure virtual

This method is intended for subclass developers only. It has the same signature as MyopicDenseExtractor::fetch(), which makes it easier to define MyopicDenseExtractor and OracularDenseExtractor subclasses from a single template class. Implementations of this method are expected to ignore i. Most users should just use next() instead.

Parameters
iIgnored, only provided for consistency with MyopicDenseExtractor::fetch(),
[out]bufferPointer to an array of length no less than N, where N is defined as described for MyopicDenseExtractor::fetch().
Returns
Pointer to an array containing the contents of the next dimension element, see next() for more details.

Implemented in tatami::PseudoOracularDenseExtractor< Value_, Index_ >.


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