tatami_test
Utilities for testing tatami libraries
Loading...
Searching...
No Matches
ForcedOracleWrapper.hpp
Go to the documentation of this file.
1#ifndef TATAMI_TEST_FORCED_ORACLE_WRAPPER_HPP
2#define TATAMI_TEST_FORCED_ORACLE_WRAPPER_HPP
3
4#include <algorithm>
5#include <memory>
6
9
10#include "utils.hpp"
11
17namespace tatami_test {
18
29template<typename Value_, typename Index_>
30class ForcedOracleWrapper final : public tatami::Matrix<Value_, Index_> {
31public:
36 ForcedOracleWrapper(std::shared_ptr<const tatami::Matrix<Value_, Index_> > matrix) : my_matrix(std::move(matrix)) {}
37
38private:
39 std::shared_ptr<const tatami::Matrix<Value_, Index_> > my_matrix;
40
41public:
42 Index_ nrow() const {
43 return my_matrix->nrow();
44 }
45
46 Index_ ncol() const {
47 return my_matrix->ncol();
48 }
49
50 bool is_sparse() const {
51 return my_matrix->is_sparse();
52 }
53
54 double is_sparse_proportion() const {
55 return my_matrix->is_sparse_proportion();
56 }
57
58 bool prefer_rows() const {
59 return my_matrix->prefer_rows();
60 }
61
62 double prefer_rows_proportion() const {
63 return my_matrix->prefer_rows_proportion();
64 }
65
66 bool uses_oracle(bool) const {
67 return true;
68 }
69
70public:
71 std::unique_ptr<tatami::MyopicDenseExtractor<Value_, Index_> > dense(
72 const bool row,
73 const tatami::Options& opt
74 ) const {
75 return my_matrix->dense(row, opt);
76 }
77
78 std::unique_ptr<tatami::MyopicDenseExtractor<Value_, Index_> > dense(
79 const bool row,
80 Index_ bs,
81 Index_ bl,
82 const tatami::Options& opt
83 ) const {
84 return my_matrix->dense(row, bs, bl, opt);
85 }
86
87 std::unique_ptr<tatami::MyopicDenseExtractor<Value_, Index_> > dense(
88 bool row,
90 const tatami::Options& opt
91 ) const {
92 return my_matrix->dense(row, std::move(idx), opt);
93 }
94
95public:
96 std::unique_ptr<tatami::MyopicSparseExtractor<Value_, Index_> > sparse(
97 const bool row,
98 const tatami::Options& opt
99 ) const {
100 return my_matrix->sparse(row, opt);
101 }
102
103 std::unique_ptr<tatami::MyopicSparseExtractor<Value_, Index_> > sparse(
104 const bool row,
105 const Index_ bs,
106 const Index_ bl,
107 const tatami::Options& opt
108 ) const {
109 return my_matrix->sparse(row, bs, bl, opt);
110 }
111
112 std::unique_ptr<tatami::MyopicSparseExtractor<Value_, Index_> > sparse(
113 const bool row,
115 const tatami::Options& opt
116 ) const {
117 return my_matrix->sparse(row, std::move(idx), opt);
118 }
119
120public:
121 std::unique_ptr<tatami::OracularDenseExtractor<Value_, Index_> > dense(
122 const bool row,
123 std::shared_ptr<const tatami::Oracle<Index_> > ora,
124 const tatami::Options& opt
125 ) const {
126 return my_matrix->dense(row, std::move(ora), opt);
127 }
128
129 std::unique_ptr<tatami::OracularDenseExtractor<Value_, Index_> > dense(
130 const bool row,
131 std::shared_ptr<const tatami::Oracle<Index_> > ora,
132 const Index_ bs,
133 const Index_ bl,
134 const tatami::Options& opt
135 ) const {
136 return my_matrix->dense(row, std::move(ora), bs, bl, opt);
137 }
138
139 std::unique_ptr<tatami::OracularDenseExtractor<Value_, Index_> > dense(
140 const bool row,
141 std::shared_ptr<const tatami::Oracle<Index_> > ora,
143 const tatami::Options& opt
144 ) const {
145 return my_matrix->dense(row, std::move(ora), std::move(idx), opt);
146 }
147
148public:
149 std::unique_ptr<tatami::OracularSparseExtractor<Value_, Index_> > sparse(
150 const bool row,
151 std::shared_ptr<const tatami::Oracle<Index_> > ora,
152 const tatami::Options& opt
153 ) const {
154 return my_matrix->sparse(row, std::move(ora), opt);
155 }
156
157 std::unique_ptr<tatami::OracularSparseExtractor<Value_, Index_> > sparse(
158 const bool row,
159 std::shared_ptr<const tatami::Oracle<Index_> > ora,
160 const Index_ bs,
161 const Index_ bl,
162 const tatami::Options& opt
163 ) const {
164 return my_matrix->sparse(row, std::move(ora), bs, bl, opt);
165 }
166
167 std::unique_ptr<tatami::OracularSparseExtractor<Value_, Index_> > sparse(
168 const bool row,
169 std::shared_ptr<const tatami::Oracle<Index_> > ora,
171 const tatami::Options& opt
172 ) const {
173 return my_matrix->sparse(row, std::move(ora), std::move(idx), opt);
174 }
175};
176
177}
178
179#endif
Force oracular extraction.
Definition ForcedOracleWrapper.hpp:30
ForcedOracleWrapper(std::shared_ptr< const tatami::Matrix< Value_, Index_ > > matrix)
Definition ForcedOracleWrapper.hpp:36
Utilities for testing tatami libraries.
Definition create_indexed_subset.hpp:16
std::shared_ptr< const std::vector< Index_ > > VectorPtr
Miscellaneous utilities.