tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
PseudoOracularExtractor.hpp
Go to the documentation of this file.
1#ifndef TATAMI_PSEUDO_ORACULAR_EXTRACTOR_HPP
2#define TATAMI_PSEUDO_ORACULAR_EXTRACTOR_HPP
3
4#include "../base/Matrix.hpp"
5#include "../base/Extractor.hpp"
6
12namespace tatami {
13
23template<typename Value_, typename Index_>
30 my_oracle(std::move(oracle)), my_ext(std::move(ext)) {}
31
33 auto i = my_oracle->get(my_used++);
34 return my_ext->fetch(i, buffer);
35 }
36
37private:
38 std::shared_ptr<const Oracle<Index_> > my_oracle;
39 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > my_ext;
40 size_t my_used = 0;
41};
42
52template<typename Value_, typename Index_>
59 my_oracle(std::move(oracle)), my_ext(std::move(ext)) {}
60
62 auto i = my_oracle->get(my_used++);
63 return my_ext->fetch(i, value_buffer, index_buffer);
64 }
65
66private:
67 std::shared_ptr<const Oracle<Index_> > my_oracle;
68 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > my_ext;
69 size_t my_used = 0;
70};
71
72}
73
74#endif
Extract an element of the target dimension in dense form without an oracle.
Definition Extractor.hpp:24
Extract an element of the target dimension in sparse form without an oracle.
Definition Extractor.hpp:140
Predict future access requests on the target dimension.
Definition Oracle.hpp:21
Extract an element of the target dimension in dense form with an oracle.
Definition Extractor.hpp:72
Extract an element of the target dimension in sparse form with an oracle.
Definition Extractor.hpp:193
Flexible representations for matrix data.
Definition Extractor.hpp:15
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition consecutive_extractor.hpp:35
Mimic the OracularDenseExtractor interface.
Definition PseudoOracularExtractor.hpp:24
PseudoOracularDenseExtractor(std::shared_ptr< const Oracle< Index_ > > oracle, std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > ext)
Definition PseudoOracularExtractor.hpp:29
const Value_ * fetch(Index_, Value_ *buffer)
Definition PseudoOracularExtractor.hpp:32
Mimic the OracularSparseExtractor interface.
Definition PseudoOracularExtractor.hpp:53
PseudoOracularSparseExtractor(std::shared_ptr< const Oracle< Index_ > > oracle, std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > ext)
Definition PseudoOracularExtractor.hpp:58
SparseRange< Value_, Index_ > fetch(Index_, Value_ *value_buffer, Index_ *index_buffer)
Definition PseudoOracularExtractor.hpp:61
A range of a sparse vector.
Definition SparseRange.hpp:32