tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
DelayedSubsetSorted.hpp
Go to the documentation of this file.
1#ifndef TATAMI_DELAYED_SUBSET_SORTED_HPP
2#define TATAMI_DELAYED_SUBSET_SORTED_HPP
3
4#include "utils.hpp"
5#include "../base/Matrix.hpp"
6
7#include <algorithm>
8#include <numeric>
9#include <memory>
10#include <cstddef>
11
20namespace tatami {
21
25namespace DelayedSubsetSorted_internal {
26
27template<typename Index_>
28struct DenseParallelResults {
29 std::vector<Index_> collapsed;
30 std::vector<Index_> expansion;
31};
32
33template<typename Index_, class SubsetStorage_, class ToIndex_>
34DenseParallelResults<Index_> format_dense_parallel(const SubsetStorage_& indices, Index_ len, ToIndex_ to_index) {
35 DenseParallelResults<Index_> output;
36 output.expansion.reserve(len);
37 output.collapsed.reserve(len);
38
39 if (len) {
40 auto last = indices[to_index(0)];
41 output.expansion.push_back(1);
42 output.collapsed.push_back(last);
43
44 for (Index_ i = 1; i < len; ++i) {
45 auto current = indices[to_index(i)];
46 if (current == last) {
47 ++(output.expansion.back());
48 } else {
49 last = current;
50 output.expansion.push_back(1);
51 output.collapsed.push_back(last);
52 }
53 }
54 }
55
56 return output;
57}
58
59template<bool oracle_, typename Value_, typename Index_>
60class ParallelDense final : public DenseExtractor<oracle_, Value_, Index_> {
61public:
62 template<class SubsetStorage_>
63 ParallelDense(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, const Options& opt) {
64 auto processed = format_dense_parallel<Index_>(subset, subset.size(), [&](Index_ i) -> Index_ { return i; });
65 initialize(matrix, std::move(processed), subset.size(), row, std::move(oracle), opt);
66 }
67
68 template<class SubsetStorage_>
69 ParallelDense(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, Index_ block_start, Index_ block_length, const Options& opt) {
70 auto processed = format_dense_parallel<Index_>(subset, block_length, [&](Index_ i) -> Index_ { return i + block_start; });
71 initialize(matrix, std::move(processed), block_length, row, std::move(oracle), opt);
72 }
73
74 template<class SubsetStorage_>
75 ParallelDense(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, VectorPtr<Index_> indices_ptr, const Options& opt) {
76 const auto& indices = *indices_ptr;
77 auto processed = format_dense_parallel<Index_>(subset, indices.size(), [&](Index_ i) -> Index_ { return indices[i]; });
78 initialize(matrix, std::move(processed), indices.size(), row, std::move(oracle), opt);
79 }
80
81private:
82 void initialize(const Matrix<Value_, Index_>* mat, DenseParallelResults<Index_> processed, std::size_t extent, bool row, MaybeOracle<oracle_, Index_> oracle, const Options& opt) {
83 my_shift = extent - processed.collapsed.size();
84 my_ext = new_extractor<false, oracle_>(mat, row, std::move(oracle), std::move(processed.collapsed), opt);
85 my_expansion = std::move(processed.expansion);
86 }
87
88public:
89 const Value_* fetch(Index_ i, Value_* buffer) {
90 auto input = my_ext->fetch(i, buffer + my_shift);
91
92 // 'input' and 'buffer' may optionally point to overlapping arrays as long
93 // as 'buffer' precedes 'input'. The idea is that the expansion of values
94 // into 'buffer' will cause it to "catch up" to 'input' without clobbering
95 // any values in the latter. This assumes that 'input' has been shifted
96 // enough to make space for expansion; the required shift depends on the
97 // number of duplicates in 'expansion'.
98
99 auto copy = buffer;
100 for (auto e : my_expansion) {
101 // Once we've caught up, everything else must be a non-duplicate,
102 // otherwise we'd be clobbering as-yet-unread values from the input.
103 // So we might as well just quit at this point.
104 if (input == copy) {
105 break;
106 }
107
108 auto val = *input;
109 std::fill_n(copy, e, val);
110 ++input;
111 copy += e;
112 }
113
114 return buffer;
115 }
116
117private:
118 std::unique_ptr<DenseExtractor<oracle_, Value_, Index_> > my_ext;
119 std::vector<Index_> my_expansion;
120 std::size_t my_shift;
121};
122
123template<typename Index_>
124struct SparseParallelExpansion {
125 // This is a bit complicated to explain.
126 // Let 'x = start[i - offset]'.
127 // Let 'y = lengths[i - offset]'.
128 // Let 'z' denote any integer in '[x, x + y)'.
129 // Let 'f' be the selection-specific function such that 'f(a)' is the a-th element of the selection
130 // (i.e., 'a' for full selection, 'a + start' for block selection and 'subset[a]' for indexed selection).
131 // In which case, 'indices[f(z)]' is equal to 'i'.
132 // The general idea is that 'f(z)' can be used to fill the 'SparseRange::index' on output.
133 std::vector<Index_> start;
134 std::vector<Index_> length;
135
136 Index_ offset = 0;
137};
138
139template<typename Index_>
140struct SparseParallelResults {
141 std::vector<Index_> collapsed;
142 SparseParallelExpansion<Index_> expansion;
143};
144
145template<typename Index_, class SubsetStorage_, class ToIndex_>
146SparseParallelResults<Index_> format_sparse_parallel(const SubsetStorage_& indices, Index_ len, ToIndex_ to_index) {
147 SparseParallelResults<Index_> output;
148
149 if (len) {
150 output.collapsed.reserve(len);
151 auto first = indices[to_index(0)];
152
153 // 'start' and 'length' are vectors that enable look-up according to
154 // the indices of the underlying array. To avoid the need to allocate a
155 // vector of length equal to the underlying array's dimension, we only
156 // consider the extremes of 'indices'; we allocate the two vectors to
157 // have length equal to the range of 'indices'. The 'offset' defines
158 // the lower bound that must be subtracted from the array indices to
159 // get an index into 'start' or 'length'.
160 output.expansion.offset = first;
161 auto allocation = indices[to_index(len - 1)] - output.expansion.offset + 1;
162 output.expansion.start.resize(allocation);
163 output.expansion.length.resize(allocation);
164
165 Index_ lookup = 0;
166 output.expansion.start[0] = 0;
167 output.expansion.length[0] = 1;
168 output.collapsed.push_back(first);
169 auto last = first;
170
171 for (Index_ i = 1; i < len; ++i) {
172 auto current = indices[to_index(i)];
173 if (current == last) {
174 ++(output.expansion.length[lookup]);
175 continue;
176 }
177
178 lookup = current - output.expansion.offset;
179 output.expansion.start[lookup] = i;
180 output.expansion.length[lookup] = 1;
181 output.collapsed.push_back(current);
182 last = current;
183 }
184 }
185
186 return output;
187}
188
189template<bool oracle_, typename Value_, typename Index_>
190class ParallelSparseCore {
191public:
192 template<class SubsetStorage_, class ToIndex_>
193 ParallelSparseCore(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, std::size_t extent, bool row, MaybeOracle<oracle_, Index_> oracle, Options opt, ToIndex_ to_index) {
194 auto processed = format_sparse_parallel<Index_>(subset, extent, std::forward<ToIndex_>(to_index));
195 my_shift = extent - processed.collapsed.size();
196
197 my_needs_value = opt.sparse_extract_value;
198 my_needs_index = opt.sparse_extract_index;
199 opt.sparse_extract_index = true; // must extract the indices for proper my_expansion.
200 if (!my_needs_index) {
201 my_holding_ibuffer.reserve(processed.collapsed.size()); // need a holding space for indices if 'ibuffer' is not supplied.
202 }
203
204 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), std::move(processed.collapsed), opt);
205 my_expansion = std::move(processed.expansion);
206 }
207
208 template<class ToIndex_>
209 SparseRange<Value_, Index_> fetch(Index_ i, Value_* value_buffer, Index_* index_buffer, ToIndex_ to_index) {
210 // Shifting so that there's enough space for my_expansion, but only doing
211 // so if these pointers are guaranteed to be non-NULL.
212 auto vinit = (my_needs_value ? value_buffer + my_shift : NULL);
213 auto iinit = (my_needs_index ? index_buffer + my_shift : my_holding_ibuffer.data());
214 auto input = my_ext->fetch(i, vinit, iinit);
215
216 auto vcopy = value_buffer;
217 auto icopy = index_buffer;
218 Index_ count = 0;
219
220 auto vsrc = input.value;
221 bool replace_value = my_needs_value && vsrc != vcopy;
222
223 // Pointers in 'input' and the two 'buffer' pointers may optionally point
224 // to overlapping arrays as long as each 'buffer' pointer precede its
225 // corresponding pointer in 'input'. The idea is that the expansion of
226 // values into 'buffer' will cause it to "catch up" to 'input' without
227 // clobbering any values in the latter. This assumes that 'input' has been
228 // shift enough to make space for expansion; the required shift depends
229 // on the number of duplicates.
230 for (Index_ i = 0; i < input.number; ++i) {
231 auto eindex = input.index[i] - my_expansion.offset;
232 auto nexpand = my_expansion.length[eindex];
233 count += nexpand;
234
235 if (replace_value) {
236 auto v = *vsrc; // make a copy just in case 'vcopy' and 'input.value' overlap.
237 std::fill_n(vcopy, nexpand, v);
238 vcopy += nexpand;
239 ++vsrc;
240 replace_value = (vcopy != vsrc); // if we've caught up, there no need to do this replacement.
241 }
242
243 if (my_needs_index) {
244 auto sexpand = my_expansion.start[eindex];
245 for (Index_ e = 0; e < nexpand; ++e, ++icopy) {
246 *icopy = to_index(sexpand + e);
247 }
248 }
249 }
250
251 return SparseRange<Value_, Index_>(
252 count,
253 (my_needs_value ? value_buffer : NULL),
254 (my_needs_index ? index_buffer : NULL)
255 );
256 }
257
258private:
259 bool my_needs_value, my_needs_index;
260 std::unique_ptr<SparseExtractor<oracle_, Value_, Index_> > my_ext;
261 std::vector<Index_> my_holding_ibuffer;
262 SparseParallelExpansion<Index_> my_expansion;
263 std::size_t my_shift;
264};
265
266template<bool oracle_, typename Value_, typename Index_>
267class ParallelFullSparse final : public SparseExtractor<oracle_, Value_, Index_> {
268public:
269 template<class SubsetStorage_>
270 ParallelFullSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, const Options& opt) :
271 my_core(matrix, subset, subset.size(), row, std::move(oracle), opt, [](Index_ i) -> Index_ { return i; }) {}
272
273 SparseRange<Value_, Index_> fetch(Index_ i, Value_* value_buffer, Index_* index_buffer) {
274 return my_core.fetch(i, value_buffer, index_buffer, [](Index_ i) -> Index_ { return i; });
275 }
276
277private:
278 ParallelSparseCore<oracle_, Value_, Index_> my_core;
279};
280
281template<bool oracle_, typename Value_, typename Index_>
282class ParallelBlockSparse final : public SparseExtractor<oracle_, Value_, Index_> {
283public:
284 template<class SubsetStorage_>
285 ParallelBlockSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, Index_ block_start, Index_ block_length, const Options& opt) :
286 my_core(matrix, subset, block_length, row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return i + block_start; }),
287 my_block_start(block_start)
288 {}
289
290 SparseRange<Value_, Index_> fetch(Index_ i, Value_* value_buffer, Index_* index_buffer) {
291 return my_core.fetch(i, value_buffer, index_buffer, [&](Index_ i) -> Index_ { return i + my_block_start; });
292 }
293
294private:
295 ParallelSparseCore<oracle_, Value_, Index_> my_core;
296 Index_ my_block_start;
297};
298
299template<bool oracle_, typename Value_, typename Index_>
300class ParallelIndexSparse final : public SparseExtractor<oracle_, Value_, Index_> {
301public:
302 template<class SubsetStorage_>
303 ParallelIndexSparse(const Matrix<Value_, Index_>* matrix, const SubsetStorage_& subset, bool row, MaybeOracle<oracle_, Index_> oracle, VectorPtr<Index_> indices_ptr, const Options& opt) :
304 my_core(matrix, subset, indices_ptr->size(), row, std::move(oracle), opt, [&](Index_ i) -> Index_ { return indices_ptr->operator[](i); }),
305 my_indices_ptr(std::move(indices_ptr))
306 {}
307
308 SparseRange<Value_, Index_> fetch(Index_ i, Value_* value_buffer, Index_* index_buffer) {
309 const auto& indices = *my_indices_ptr;
310 return my_core.fetch(i, value_buffer, index_buffer, [&](Index_ i) -> Index_ { return indices[i]; });
311 }
312
313private:
314 ParallelSparseCore<oracle_, Value_, Index_> my_core;
315 VectorPtr<Index_> my_indices_ptr;
316};
317
318}
334template<typename Value_, typename Index_, class SubsetStorage_>
335class DelayedSubsetSorted final : public Matrix<Value_, Index_> {
336public:
345 DelayedSubsetSorted(std::shared_ptr<const Matrix<Value_, Index_> > matrix, SubsetStorage_ subset, bool by_row, bool check = true) :
346 my_matrix(std::move(matrix)), my_subset(std::move(subset)), my_by_row(by_row)
347 {
348 if (check) {
349 for (Index_ i = 1, end = my_subset.size(); i < end; ++i) {
350 if (my_subset[i] < my_subset[i-1]) {
351 throw std::runtime_error("my_subset should be sorted");
352 }
353 }
354 }
355 }
356
357private:
358 std::shared_ptr<const Matrix<Value_, Index_> > my_matrix;
359 SubsetStorage_ my_subset;
360 bool my_by_row;
361
362 Index_ get_mapping_dim() const {
363 if (my_by_row) {
364 return my_matrix->nrow();
365 } else {
366 return my_matrix->ncol();
367 }
368 }
369
370public:
371 Index_ nrow() const {
372 if (my_by_row) {
373 return my_subset.size();
374 } else {
375 return my_matrix->nrow();
376 }
377 }
378
379 Index_ ncol() const {
380 if (my_by_row) {
381 return my_matrix->ncol();
382 } else {
383 return my_subset.size();
384 }
385 }
386
387 bool is_sparse() const {
388 return my_matrix->is_sparse();
389 }
390
391 double is_sparse_proportion() const {
392 return my_matrix->is_sparse_proportion();
393 }
394
395 bool prefer_rows() const {
396 return my_matrix->prefer_rows();
397 }
398
399 double prefer_rows_proportion() const {
400 return my_matrix->prefer_rows_proportion();
401 }
402
403 bool uses_oracle(bool row) const {
404 return my_matrix->uses_oracle(row);
405 }
406
407 using Matrix<Value_, Index_>::dense_column;
408
409 using Matrix<Value_, Index_>::dense_row;
410
411 using Matrix<Value_, Index_>::sparse_column;
412
413 using Matrix<Value_, Index_>::sparse_row;
414
415 /********************
416 *** Myopic dense ***
417 ********************/
418private:
419 template<typename ... Args_>
420 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > populate_myopic_dense(bool row, Args_&& ... args) const {
421 if (row == my_by_row) {
422 return std::make_unique<subset_utils::MyopicPerpendicularDense<Value_, Index_, SubsetStorage_> >(my_matrix.get(), my_subset, row, std::forward<Args_>(args)...);
423 } else {
424 return std::make_unique<DelayedSubsetSorted_internal::ParallelDense<false, Value_, Index_> >(my_matrix.get(), my_subset, row, false, std::forward<Args_>(args)...);
425 }
426 }
427
428public:
429 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, const Options& opt) const {
430 return populate_myopic_dense(row, opt);
431 }
432
433 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, Index_ block_start, Index_ block_length, const Options& opt) const {
434 return populate_myopic_dense(row, block_start, block_length, opt);
435 }
436
437 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, VectorPtr<Index_> indices_ptr, const Options& opt) const {
438 return populate_myopic_dense(row, std::move(indices_ptr), opt);
439 }
440
441 /*********************
442 *** Myopic sparse ***
443 *********************/
444private:
445 template<DimensionSelectionType selection_, bool oracle_, typename ... Args_>
446 std::unique_ptr<SparseExtractor<oracle_, Value_, Index_> > populate_sparse(bool row, MaybeOracle<oracle_, Index_> oracle, Args_&& ... args) const {
447 if constexpr(selection_ == DimensionSelectionType::FULL) {
448 return std::make_unique<DelayedSubsetSorted_internal::ParallelFullSparse<oracle_, Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
449 } else if constexpr(selection_ == DimensionSelectionType::BLOCK) {
450 return std::make_unique<DelayedSubsetSorted_internal::ParallelBlockSparse<oracle_, Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
451 } else {
452 return std::make_unique<DelayedSubsetSorted_internal::ParallelIndexSparse<oracle_, Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
453 }
454 }
455
456 template<DimensionSelectionType selection_, typename ... Args_>
457 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > populate_myopic_sparse(bool row, Args_&& ... args) const {
458 if (row == my_by_row) {
459 return std::make_unique<subset_utils::MyopicPerpendicularSparse<Value_, Index_, SubsetStorage_> >(my_matrix.get(), my_subset, row, std::forward<Args_>(args)...);
460 } else {
461 return populate_sparse<selection_, false>(row, false, std::forward<Args_>(args)...);
462 }
463 }
464
465public:
466 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, const Options& opt) const {
467 return populate_myopic_sparse<DimensionSelectionType::FULL>(row, opt);
468 }
469
470 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, Index_ block_start, Index_ block_length, const Options& opt) const {
471 return populate_myopic_sparse<DimensionSelectionType::BLOCK>(row, block_start, block_length, opt);
472 }
473
474 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, VectorPtr<Index_> indices_ptr, const Options& opt) const {
475 return populate_myopic_sparse<DimensionSelectionType::INDEX>(row, std::move(indices_ptr), opt);
476 }
477
478 /**********************
479 *** Oracular dense ***
480 **********************/
481private:
482 template<typename ... Args_>
483 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > populate_oracular_dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, Args_&& ... args) const {
484 if (row == my_by_row) {
485 return std::make_unique<subset_utils::OracularPerpendicularDense<Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
486 } else {
487 return std::make_unique<DelayedSubsetSorted_internal::ParallelDense<true, Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
488 }
489 }
490
491public:
492 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
493 return populate_oracular_dense(row, std::move(oracle), opt);
494 }
495
496 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
497 return populate_oracular_dense(row, std::move(oracle), block_start, block_length, opt);
498 }
499
500 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
501 return populate_oracular_dense(row, std::move(oracle), std::move(indices_ptr), opt);
502 }
503
504 /***********************
505 *** Oracular sparse ***
506 ***********************/
507private:
508 template<DimensionSelectionType selection_, typename ... Args_>
509 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > populate_oracular_sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, Args_&& ... args) const {
510 if (row == my_by_row) {
511 return std::make_unique<subset_utils::OracularPerpendicularSparse<Value_, Index_> >(my_matrix.get(), my_subset, row, std::move(oracle), std::forward<Args_>(args)...);
512 } else {
513 return populate_sparse<selection_, true>(row, std::move(oracle), std::forward<Args_>(args)...);
514 }
515 }
516
517public:
518 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
519 return populate_oracular_sparse<DimensionSelectionType::FULL>(row, std::move(oracle), opt);
520 }
521
522 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
523 return populate_oracular_sparse<DimensionSelectionType::BLOCK>(row, std::move(oracle), block_start, block_length, opt);
524 }
525
526 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
527 return populate_oracular_sparse<DimensionSelectionType::INDEX>(row, std::move(oracle), std::move(indices_ptr), opt);
528 }
529};
530
531}
532
533#endif
Virtual class for a matrix of some numeric type.
Delayed subsetting of a matrix with sorted indices.
Definition DelayedSubsetSorted.hpp:335
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedSubsetSorted.hpp:496
double prefer_rows_proportion() const
Definition DelayedSubsetSorted.hpp:399
Index_ nrow() const
Definition DelayedSubsetSorted.hpp:371
bool prefer_rows() const
Definition DelayedSubsetSorted.hpp:395
DelayedSubsetSorted(std::shared_ptr< const Matrix< Value_, Index_ > > matrix, SubsetStorage_ subset, bool by_row, bool check=true)
Definition DelayedSubsetSorted.hpp:345
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedSubsetSorted.hpp:500
double is_sparse_proportion() const
Definition DelayedSubsetSorted.hpp:391
bool is_sparse() const
Definition DelayedSubsetSorted.hpp:387
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedSubsetSorted.hpp:470
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedSubsetSorted.hpp:433
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedSubsetSorted.hpp:474
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedSubsetSorted.hpp:522
bool uses_oracle(bool row) const
Definition DelayedSubsetSorted.hpp:403
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, const Options &opt) const
Definition DelayedSubsetSorted.hpp:429
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition DelayedSubsetSorted.hpp:492
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition DelayedSubsetSorted.hpp:518
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedSubsetSorted.hpp:437
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedSubsetSorted.hpp:526
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, const Options &opt) const
Definition DelayedSubsetSorted.hpp:466
Index_ ncol() const
Definition DelayedSubsetSorted.hpp:379
Virtual class for a matrix.
Definition Matrix.hpp:59
Predict future access requests on the target dimension.
Definition Oracle.hpp:23
Flexible representations for matrix data.
Definition Extractor.hpp:15
DimensionSelectionType
Definition Options.hpp:25
std::shared_ptr< const std::vector< Index_ > > VectorPtr
Definition Matrix.hpp:26
typename std::conditional< oracle_, std::shared_ptr< const Oracle< Index_ > >, bool >::type MaybeOracle
Definition new_extractor.hpp:20
typename std::conditional< oracle_, OracularDenseExtractor< Value_, Index_ >, MyopicDenseExtractor< Value_, Index_ > >::type DenseExtractor
Definition Extractor.hpp:273
Options for accessing data from a Matrix instance.
Definition Options.hpp:30