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

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

#include <Extractor.hpp>

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

Public Member Functions

SparseRange< Value_, Index_fetch (Value_ *value_buffer, Index_ *index_buffer)
 
virtual SparseRange< Value_, Index_fetch (Index_ i, Value_ *value_buffer, Index_ *index_buffer)=0
 

Detailed Description

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

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

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

Member Function Documentation

◆ fetch() [1/2]

SparseRange< Value_, Index_ > tatami::OracularSparseExtractor< Value_, Index_ >::fetch ( Value_ value_buffer,
Index_ index_buffer 
)
inline

value_buffer may not necessarily be filled upon extraction if a pointer can be returned to the underlying data store. This be checked by comparing the returned SparseRange::value pointer to value_buffer; if they are the same, value_buffer has been filled with SparseRange::number values. The same applies for index_buffer and the returned SparseRange::index pointer.

If Options::sparse_extract_value was set to false during construction of this instance, value_buffer is ignored and SparseRange::value is set to NULL in the output. Similarly, if Options::sparse_extract_index was set to false during construction of this instance, index_buffer is ignored and SparseRange::index is set to NULL in the output.

Parameters
[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 element of the target dimension, as predicted by the Oracle used to construct this instance.

◆ fetch() [2/2]

virtual SparseRange< Value_, Index_ > tatami::OracularSparseExtractor< Value_, Index_ >::fetch ( Index_  i,
Value_ value_buffer,
Index_ index_buffer 
)
pure virtual

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.

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


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