tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
tatami
utils
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
12
namespace
tatami
{
13
23
template
<
typename
Value_,
typename
Index_>
24
struct
PseudoOracularDenseExtractor
:
public
OracularDenseExtractor
<Value_, Index_> {
29
PseudoOracularDenseExtractor
(std::shared_ptr<
const
Oracle<Index_>
>
oracle
, std::unique_ptr<
MyopicDenseExtractor<Value_, Index_>
>
ext
) :
30
my_oracle(
std
::
move
(
oracle
)), my_ext(
std
::
move
(
ext
)) {}
31
32
const
Value_
*
fetch
(
Index_
,
Value_
*
buffer
) {
33
auto
i
= my_oracle->get(my_used++);
34
return
my_ext->fetch(
i
,
buffer
);
35
}
36
37
private
:
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
52
template
<
typename
Value_,
typename
Index_>
53
struct
PseudoOracularSparseExtractor
:
public
OracularSparseExtractor
<Value_, Index_> {
58
PseudoOracularSparseExtractor
(std::shared_ptr<
const
Oracle<Index_>
>
oracle
, std::unique_ptr<
MyopicSparseExtractor<Value_, Index_>
>
ext
) :
59
my_oracle(
std
::
move
(
oracle
)), my_ext(
std
::
move
(
ext
)) {}
60
61
SparseRange<Value_, Index_>
fetch
(
Index_
,
Value_
*
value_buffer
,
Index_
*
index_buffer
) {
62
auto
i
= my_oracle->get(my_used++);
63
return
my_ext->fetch(
i
,
value_buffer
,
index_buffer
);
64
}
65
66
private
:
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
tatami::MyopicDenseExtractor
Extract an element of the target dimension in dense form without an oracle.
Definition
Extractor.hpp:24
tatami::MyopicSparseExtractor
Extract an element of the target dimension in sparse form without an oracle.
Definition
Extractor.hpp:140
tatami::Oracle
Predict future access requests on the target dimension.
Definition
Oracle.hpp:21
tatami::OracularDenseExtractor
Extract an element of the target dimension in dense form with an oracle.
Definition
Extractor.hpp:72
tatami::OracularSparseExtractor
Extract an element of the target dimension in sparse form with an oracle.
Definition
Extractor.hpp:193
tatami
Flexible representations for matrix data.
Definition
Extractor.hpp:15
tatami::consecutive_extractor
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition
consecutive_extractor.hpp:35
tatami::PseudoOracularDenseExtractor
Mimic the OracularDenseExtractor interface.
Definition
PseudoOracularExtractor.hpp:24
tatami::PseudoOracularDenseExtractor::PseudoOracularDenseExtractor
PseudoOracularDenseExtractor(std::shared_ptr< const Oracle< Index_ > > oracle, std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > ext)
Definition
PseudoOracularExtractor.hpp:29
tatami::PseudoOracularDenseExtractor::fetch
const Value_ * fetch(Index_, Value_ *buffer)
Definition
PseudoOracularExtractor.hpp:32
tatami::PseudoOracularSparseExtractor
Mimic the OracularSparseExtractor interface.
Definition
PseudoOracularExtractor.hpp:53
tatami::PseudoOracularSparseExtractor::PseudoOracularSparseExtractor
PseudoOracularSparseExtractor(std::shared_ptr< const Oracle< Index_ > > oracle, std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > ext)
Definition
PseudoOracularExtractor.hpp:58
tatami::PseudoOracularSparseExtractor::fetch
SparseRange< Value_, Index_ > fetch(Index_, Value_ *value_buffer, Index_ *index_buffer)
Definition
PseudoOracularExtractor.hpp:61
tatami::SparseRange
A range of a sparse vector.
Definition
SparseRange.hpp:32
Generated by
1.9.8