tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
ConsecutiveOracle.hpp
Go to the documentation of this file.
1#ifndef TATAMI_CONSECUTIVE_ORACLE_HPP
2#define TATAMI_CONSECUTIVE_ORACLE_HPP
3
4#include "../base/Oracle.hpp"
5#include <numeric>
6
13namespace tatami {
14
20template<typename Index_>
21class ConsecutiveOracle : public Oracle<Index_> {
22public:
27 ConsecutiveOracle(Index_ start, Index_ length) : my_offset(start), my_length(length) {}
28
29 size_t total() const {
30 return my_length;
31 }
32
33 Index_ get(size_t i) const {
34 return my_offset + i;
35 }
36
37private:
38 Index_ my_offset;
39 size_t my_length;
40};
41
42}
43
44#endif
Predict future accesses along a consecutive sequence.
Definition ConsecutiveOracle.hpp:21
Index_ get(size_t i) const
Definition ConsecutiveOracle.hpp:33
size_t total() const
Definition ConsecutiveOracle.hpp:29
ConsecutiveOracle(Index_ start, Index_ length)
Definition ConsecutiveOracle.hpp:27
Predict future access requests on the target dimension.
Definition Oracle.hpp:21
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