1#ifndef TATAMI_DELAYED_UNARY_ISOMETRIC_OPERATION_H
2#define TATAMI_DELAYED_UNARY_ISOMETRIC_OPERATION_H
4#include "../../base/Matrix.hpp"
5#include "../../utils/copy.hpp"
6#include "../../utils/new_extractor.hpp"
7#include "../depends_utils.hpp"
37template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
41 const Matrix<InputValue_, Index_>* matrix,
42 const Operation_& operation,
44 MaybeOracle<oracle_, Index_> oracle,
46 my_operation(operation),
48 my_oracle(oracle, my_operation, row),
49 my_extent(row ? matrix->ncol() : matrix->nrow()),
50 my_ext(
new_extractor<false, oracle_>(matrix, row, std::move(oracle), opt))
52 if constexpr(!same_value) {
53 my_holding_buffer.resize(my_extent);
58 const Operation_& my_operation;
61 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
64 std::unique_ptr<DenseExtractor<oracle_, InputValue_, Index_> > my_ext;
66 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
67 typename std::conditional<!same_value, std::vector<InputValue_>,
bool>::type my_holding_buffer;
70 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
71 if constexpr(same_value) {
72 auto ptr = my_ext->fetch(i, buffer);
73 copy_n(ptr, my_extent, buffer);
74 my_operation.dense(my_row, my_oracle.get(i),
static_cast<Index_
>(0), my_extent, buffer, buffer);
76 auto ptr = my_ext->fetch(i, my_holding_buffer.data());
77 my_operation.dense(my_row, my_oracle.get(i),
static_cast<Index_
>(0), my_extent, ptr, buffer);
83template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
87 const Matrix<InputValue_, Index_>* matrix,
88 const Operation_& operation,
90 MaybeOracle<oracle_, Index_> oracle,
94 my_operation(operation),
96 my_oracle(oracle, my_operation, row),
97 my_block_start(block_start),
98 my_block_length(block_length),
99 my_ext(
new_extractor<false, oracle_>(matrix, row, std::move(oracle), block_start, block_length, opt))
101 if constexpr(!same_value) {
102 my_holding_buffer.resize(my_block_length);
107 const Operation_& my_operation;
110 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
111 Index_ my_block_start, my_block_length;
113 std::unique_ptr<DenseExtractor<oracle_, InputValue_, Index_> > my_ext;
115 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
116 typename std::conditional<!same_value, std::vector<InputValue_>,
bool>::type my_holding_buffer;
119 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
120 if constexpr(same_value) {
121 auto ptr = my_ext->fetch(i, buffer);
122 copy_n(ptr, my_block_length, buffer);
123 my_operation.dense(my_row, my_oracle.get(i), my_block_start, my_block_length, buffer, buffer);
125 auto ptr = my_ext->fetch(i, my_holding_buffer.data());
126 my_operation.dense(my_row, my_oracle.get(i), my_block_start, my_block_length, ptr, buffer);
132template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
136 const Matrix<InputValue_, Index_>* matrix,
137 const Operation_& operation,
139 MaybeOracle<oracle_, Index_> oracle,
140 VectorPtr<Index_> indices_ptr,
141 const Options& opt) :
142 my_operation(operation),
144 my_oracle(oracle, my_operation, row),
145 my_indices_ptr(indices_ptr),
146 my_ext(
new_extractor<false, oracle_>(matrix, row, std::move(oracle), std::move(indices_ptr), opt))
148 if constexpr(!same_value) {
149 my_holding_buffer.resize(my_indices_ptr->size());
154 const Operation_& my_operation;
157 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
158 VectorPtr<Index_> my_indices_ptr;
160 std::unique_ptr<DenseExtractor<oracle_, InputValue_, Index_> > my_ext;
162 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
163 typename std::conditional<!same_value, std::vector<InputValue_>,
bool>::type my_holding_buffer;
166 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
167 const auto& indices = *my_indices_ptr;
168 if constexpr(same_value) {
169 auto ptr = my_ext->fetch(i, buffer);
170 copy_n(ptr, indices.size(), buffer);
171 my_operation.dense(my_row, my_oracle.get(i), indices, buffer, buffer);
173 auto ptr = my_ext->fetch(i, my_holding_buffer.data());
174 my_operation.dense(my_row, my_oracle.get(i), indices, ptr, buffer);
191template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
195 const Matrix<InputValue_, Index_>* matrix,
196 const Operation_& operation,
198 MaybeOracle<oracle_, Index_> oracle,
200 my_operation(operation),
202 my_oracle(oracle, my_operation, row),
203 my_extent(row ? matrix->ncol() : matrix->nrow()),
204 my_vbuffer(my_extent),
205 my_ibuffer(my_extent)
207 opt.sparse_extract_value =
true;
208 opt.sparse_extract_index =
true;
209 my_ext = new_extractor<true, oracle_>(matrix, my_row, std::move(oracle), opt);
211 if constexpr(!same_value) {
212 my_result_vbuffer.resize(my_extent);
217 const Operation_& my_operation;
220 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
223 std::vector<InputValue_> my_vbuffer;
224 std::vector<Index_> my_ibuffer;
225 std::unique_ptr<SparseExtractor<oracle_, InputValue_, Index_> > my_ext;
227 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
228 typename std::conditional<!same_value, std::vector<OutputValue_>,
bool>::type my_result_vbuffer;
231 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
232 auto vbuffer = my_vbuffer.data();
233 auto range = my_ext->fetch(i, vbuffer, my_ibuffer.data());
235 i = my_oracle.get(i);
236 if constexpr(same_value) {
237 copy_n(range.value, range.number, vbuffer);
238 my_operation.sparse(my_row, i, range.number, vbuffer, range.index, vbuffer);
240 my_operation.sparse(my_row, i, range.number, range.value, range.index, my_result_vbuffer.data());
244 if (range.number < my_extent) {
245 std::fill_n(buffer, my_extent, my_operation.template fill<OutputValue_, InputValue_>(my_row, i));
248 if constexpr(same_value) {
249 for (Index_ i = 0; i < range.number; ++i) {
250 buffer[range.index[i]] = vbuffer[i];
253 for (Index_ i = 0; i < range.number; ++i) {
254 buffer[range.index[i]] = my_result_vbuffer[i];
262template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
266 const Matrix<InputValue_, Index_>* matrix,
267 const Operation_& operation,
269 MaybeOracle<oracle_, Index_> oracle,
273 my_operation(operation),
275 my_oracle(oracle, my_operation, row),
276 my_block_start(block_start),
277 my_block_length(block_length),
278 my_vbuffer(block_length),
279 my_ibuffer(block_length)
281 opt.sparse_extract_value =
true;
282 opt.sparse_extract_index =
true;
283 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), block_start, block_length, opt);
285 if constexpr(!same_value) {
286 my_result_vbuffer.resize(my_block_length);
291 const Operation_& my_operation;
294 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
295 Index_ my_block_start, my_block_length;
297 std::vector<InputValue_> my_vbuffer;
298 std::vector<Index_> my_ibuffer;
299 std::unique_ptr<SparseExtractor<oracle_, InputValue_, Index_> > my_ext;
301 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
302 typename std::conditional<!same_value, std::vector<OutputValue_>,
bool>::type my_result_vbuffer;
305 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
306 auto vbuffer = my_vbuffer.data();
307 auto range = my_ext->fetch(i, vbuffer, my_ibuffer.data());
309 i = my_oracle.get(i);
310 if constexpr(same_value) {
311 copy_n(range.value, range.number, vbuffer);
312 my_operation.sparse(my_row, i, range.number, vbuffer, range.index, vbuffer);
314 my_operation.sparse(my_row, i, range.number, range.value, range.index, my_result_vbuffer.data());
318 if (range.number < my_block_length) {
319 std::fill_n(buffer, my_block_length, my_operation.template fill<OutputValue_, InputValue_>(my_row, i));
322 if constexpr(same_value) {
323 for (Index_ i = 0; i < range.number; ++i) {
324 buffer[range.index[i] - my_block_start] = vbuffer[i];
327 for (Index_ i = 0; i < range.number; ++i) {
328 buffer[range.index[i] - my_block_start] = my_result_vbuffer[i];
336template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
340 const Matrix<InputValue_, Index_>* matrix,
341 const Operation_& operation,
343 MaybeOracle<oracle_, Index_> oracle,
344 VectorPtr<Index_> indices_ptr,
346 my_operation(operation),
348 my_oracle(oracle, my_operation, row)
350 opt.sparse_extract_value =
true;
351 opt.sparse_extract_index =
true;
353 const auto& indices = *indices_ptr;
354 my_extent = indices.size();
355 my_vbuffer.resize(my_extent);
356 my_ibuffer.resize(my_extent);
362 my_remapping_offset = indices.front();
363 my_remapping.resize(indices.back() - my_remapping_offset + 1);
364 for (Index_ i = 0; i < my_extent; ++i) {
365 my_remapping[indices[i] - my_remapping_offset] = i;
369 my_ext = new_extractor<true, oracle_>(matrix, my_row, std::move(oracle), std::move(indices_ptr), opt);
371 if constexpr(!same_value) {
372 my_result_vbuffer.resize(my_extent);
377 const Operation_& my_operation;
380 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
383 std::vector<InputValue_> my_vbuffer;
384 std::vector<Index_> my_ibuffer;
386 std::vector<Index_> my_remapping;
387 Index_ my_remapping_offset = 0;
388 std::unique_ptr<SparseExtractor<oracle_, InputValue_, Index_> > my_ext;
390 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
391 typename std::conditional<!same_value, std::vector<OutputValue_>,
bool>::type my_result_vbuffer;
394 const OutputValue_* fetch(Index_ i, OutputValue_* buffer) {
395 auto vbuffer = my_vbuffer.data();
396 auto range = my_ext->fetch(i, vbuffer, my_ibuffer.data());
398 i = my_oracle.get(i);
399 if constexpr(same_value) {
400 copy_n(range.value, range.number, vbuffer);
401 my_operation.sparse(my_row, i, range.number, vbuffer, range.index, vbuffer);
403 my_operation.sparse(my_row, i, range.number, range.value, range.index, my_result_vbuffer.data());
407 if (range.number < my_extent) {
408 std::fill_n(buffer, my_extent, my_operation.template fill<OutputValue_, InputValue_>(my_row, i));
411 if constexpr(same_value) {
412 for (Index_ i = 0; i < range.number; ++i) {
413 buffer[my_remapping[range.index[i] - my_remapping_offset]] = vbuffer[i];
416 for (Index_ i = 0; i < range.number; ++i) {
417 buffer[my_remapping[range.index[i] - my_remapping_offset]] = my_result_vbuffer[i];
432template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
436 const Matrix<InputValue_, Index_>* matrix,
437 const Operation_& operation,
439 MaybeOracle<oracle_, Index_> oracle,
440 const Options& opt) :
441 my_operation(operation),
443 my_oracle(oracle, my_operation, row),
444 my_ext(
new_extractor<true, oracle_>(matrix, row, std::move(oracle), opt))
446 initialize(opt, row ? matrix->ncol() : matrix->nrow());
450 const Matrix<InputValue_, Index_>* matrix,
451 const Operation_& operation,
453 MaybeOracle<oracle_, Index_> oracle,
456 const Options& opt) :
457 my_operation(operation),
459 my_oracle(oracle, my_operation, row),
460 my_ext(
new_extractor<true, oracle_>(matrix, row, std::move(oracle), block_start, block_length, opt))
462 initialize(opt, block_length);
466 const Matrix<InputValue_, Index_>* matrix,
467 const Operation_& operation,
469 MaybeOracle<oracle_, Index_> oracle,
470 VectorPtr<Index_> indices_ptr,
471 const Options& opt) :
472 my_operation(operation),
474 my_oracle(oracle, my_operation, row)
476 initialize(opt, indices_ptr->size());
479 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), std::move(indices_ptr), opt);
483 const Operation_& my_operation;
486 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
488 std::unique_ptr<SparseExtractor<oracle_, InputValue_, Index_> > my_ext;
490 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
491 typename std::conditional<!same_value, std::vector<InputValue_>,
bool>::type my_holding_vbuffer;
493 void initialize(
const Options& opt,
size_t extent) {
494 if constexpr(!same_value) {
495 if (opt.sparse_extract_value) {
496 my_holding_vbuffer.resize(extent);
502 SparseRange<OutputValue_, Index_> fetch(Index_ i, OutputValue_* value_buffer, Index_* index_buffer) {
503 if constexpr(same_value) {
504 auto raw = my_ext->fetch(i, value_buffer, index_buffer);
506 copy_n(raw.value, raw.number, value_buffer);
507 my_operation.sparse(my_row, my_oracle.get(i), raw.number, value_buffer, raw.index, value_buffer);
508 raw.value = value_buffer;
512 auto raw = my_ext->fetch(i, my_holding_vbuffer.data(), index_buffer);
514 SparseRange<OutputValue_, Index_> output(raw.number);
515 output.index = raw.index;
517 my_operation.sparse(my_row, my_oracle.get(i), raw.number, raw.value, raw.index, value_buffer);
518 output.value = value_buffer;
533template<
bool oracle_,
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
537 const Matrix<InputValue_, Index_>* matrix,
538 const Operation_& operation,
540 MaybeOracle<oracle_, Index_> oracle,
542 my_operation(operation),
544 my_oracle(oracle, my_operation, row)
546 initialize(opt, row ? matrix->ncol() : matrix->nrow());
547 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), opt);
551 const Matrix<InputValue_, Index_>* matrix,
552 const Operation_& operation,
554 MaybeOracle<oracle_, Index_> oracle,
558 my_operation(operation),
560 my_oracle(oracle, my_operation, row)
562 initialize(opt, block_length);
563 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), block_start, block_length, opt);
567 const Matrix<InputValue_, Index_>* matrix,
568 const Operation_& operation,
570 MaybeOracle<oracle_, Index_> oracle,
571 VectorPtr<Index_> indices_ptr,
573 my_operation(operation),
575 my_oracle(oracle, my_operation, row)
577 initialize(opt, indices_ptr->size());
578 my_ext = new_extractor<true, oracle_>(matrix, row, std::move(oracle), std::move(indices_ptr), opt);
582 void initialize(Options& opt,
size_t extent) {
583 my_report_value = opt.sparse_extract_value;
584 my_report_index = opt.sparse_extract_index;
588 if (my_report_value) {
589 opt.sparse_extract_index =
true;
594 if (!my_report_index) {
595 my_ibuffer.resize(extent);
599 if constexpr(!same_value) {
600 if (my_report_value) {
601 my_holding_vbuffer.resize(extent);
607 const Operation_& my_operation;
610 DelayedIsometricOperation_internal::MaybeOracleDepends<oracle_, Operation_, Index_> my_oracle;
612 bool my_report_value, my_report_index;
613 std::vector<Index_> my_ibuffer;
615 std::unique_ptr<SparseExtractor<oracle_, InputValue_, Index_> > my_ext;
617 static constexpr bool same_value = std::is_same<OutputValue_, InputValue_>::value;
618 typename std::conditional<!same_value, std::vector<InputValue_>,
bool>::type my_holding_vbuffer;
621 SparseRange<OutputValue_, Index_> fetch(Index_ i, OutputValue_* value_buffer, Index_* index_buffer) {
622 auto iptr = my_report_index ? index_buffer : my_ibuffer.data();
624 if constexpr(same_value) {
625 auto raw = my_ext->fetch(i, value_buffer, iptr);
626 if (my_report_value) {
627 copy_n(raw.value, raw.number, value_buffer);
628 my_operation.sparse(my_row, my_oracle.get(i), raw.number, value_buffer, raw.index, value_buffer);
629 raw.value = value_buffer;
631 if (!my_report_index) {
637 auto raw = my_ext->fetch(i, my_holding_vbuffer.data(), iptr);
638 SparseRange<OutputValue_, Index_> output(raw.number, NULL, (my_report_index ? raw.index : NULL));
639 if (my_report_value) {
640 my_operation.sparse(my_row, my_oracle.get(i), raw.number, raw.value, raw.index, value_buffer);
641 output.value = value_buffer;
671template<
typename OutputValue_,
typename InputValue_,
typename Index_,
class Operation_>
682 std::shared_ptr<const Matrix<InputValue_, Index_> > my_matrix;
687 return my_matrix->nrow();
691 return my_matrix->ncol();
695 if constexpr(!Operation_::is_basic) {
696 if (my_operation.is_sparse()) {
697 return my_matrix->is_sparse();
704 if constexpr(!Operation_::is_basic) {
705 if (my_operation.is_sparse()) {
706 return my_matrix->is_sparse_proportion();
713 return my_matrix->prefer_rows();
717 return my_matrix->prefer_rows_proportion();
721 return my_matrix->uses_oracle(
row);
732 template<
bool oracle_>
734 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseBasicFull<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
735 my_matrix.get(), my_operation,
row, std::move(
oracle),
opt
739 template<
bool oracle_>
741 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseBasicBlock<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
746 template<
bool oracle_>
748 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseBasicIndex<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
753 template<
bool oracle_>
755 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseExpandedFull<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
756 my_matrix.get(), my_operation,
row, std::move(
oracle),
opt
760 template<
bool oracle_>
762 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseExpandedBlock<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
767 template<
bool oracle_>
769 return std::make_unique<DelayedUnaryIsometricOperation_internal::DenseExpandedIndex<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
775 std::unique_ptr<DenseExtractor<oracle_, OutputValue_, Index_> > dense_internal(
bool row,
Args_&& ...
args)
const {
776 if constexpr(!Operation_::is_basic) {
777 if (my_matrix->is_sparse()) {
778 if (DelayedIsometricOperation_internal::can_dense_expand(my_operation,
row)) {
788 std::unique_ptr<MyopicDenseExtractor<OutputValue_, Index_> >
dense(
bool row,
const Options&
opt)
const {
806 return std::make_unique<FullSparsifiedWrapper<oracle_, OutputValue_, Index_> >(
808 (
row ? my_matrix->ncol() : my_matrix->nrow()),
815 return std::make_unique<BlockSparsifiedWrapper<oracle_, OutputValue_, Index_> >(
825 return std::make_unique<IndexSparsifiedWrapper<oracle_, OutputValue_, Index_> >(
834 if constexpr(!Operation_::is_basic) {
835 if (my_operation.is_sparse() && my_matrix->is_sparse()) {
836 if (DelayedIsometricOperation_internal::needs_sparse_indices(my_operation,
row)) {
837 return std::make_unique<DelayedUnaryIsometricOperation_internal::SparseNeedsIndices<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
842 std::forward<Args_>(
args)...
846 return std::make_unique<DelayedUnaryIsometricOperation_internal::SparseSimple<oracle_, OutputValue_, InputValue_, Index_, Operation_> >(
851 std::forward<Args_>(
args)...
861 std::unique_ptr<MyopicSparseExtractor<OutputValue_, Index_> >
sparse(
bool row,
const Options&
opt)
const {
919template<
typename OutputValue_ =
double,
typename InputValue_,
typename Index_,
class Operation_>
921 typedef typename std::remove_reference<Operation_>::type
Operation2_;
929template<
typename OutputValue_ =
double,
typename InputValue_,
typename Index_,
class Operation_>
931 typedef typename std::remove_reference<Operation_>::type
Operation2_;
936template<
typename ...
Args_>
941template<
typename OutputValue_,
typename Index_,
class Operation_>
Delayed isometric operation on a single matrix.
Definition DelayedUnaryIsometricOperation.hpp:672
std::unique_ptr< OracularDenseExtractor< OutputValue_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:877
std::unique_ptr< OracularSparseExtractor< OutputValue_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:897
std::unique_ptr< OracularDenseExtractor< OutputValue_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:885
DelayedUnaryIsometricOperation(std::shared_ptr< const Matrix< InputValue_, Index_ > > matrix, Operation_ operation)
Definition DelayedUnaryIsometricOperation.hpp:678
Index_ nrow() const
Definition DelayedUnaryIsometricOperation.hpp:686
std::unique_ptr< MyopicSparseExtractor< OutputValue_, Index_ > > sparse(bool row, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:865
std::unique_ptr< MyopicSparseExtractor< OutputValue_, Index_ > > sparse(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:869
double prefer_rows_proportion() const
Definition DelayedUnaryIsometricOperation.hpp:716
Index_ ncol() const
Definition DelayedUnaryIsometricOperation.hpp:690
std::unique_ptr< MyopicDenseExtractor< OutputValue_, Index_ > > dense(bool row, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:792
std::unique_ptr< MyopicSparseExtractor< OutputValue_, Index_ > > sparse(bool row, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:861
std::unique_ptr< MyopicDenseExtractor< OutputValue_, Index_ > > dense(bool row, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:788
std::unique_ptr< OracularSparseExtractor< OutputValue_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:893
std::unique_ptr< MyopicDenseExtractor< OutputValue_, Index_ > > dense(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:796
std::unique_ptr< OracularDenseExtractor< OutputValue_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:881
bool prefer_rows() const
Definition DelayedUnaryIsometricOperation.hpp:712
bool is_sparse() const
Definition DelayedUnaryIsometricOperation.hpp:694
double is_sparse_proportion() const
Definition DelayedUnaryIsometricOperation.hpp:703
std::unique_ptr< OracularSparseExtractor< OutputValue_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition DelayedUnaryIsometricOperation.hpp:901
bool uses_oracle(bool row) const
Definition DelayedUnaryIsometricOperation.hpp:720
Virtual class for a matrix.
Definition Matrix.hpp:59
Predict future access requests on the target dimension.
Definition Oracle.hpp:21
Flexible representations for matrix data.
Definition Extractor.hpp:15
typename std::conditional< oracle_, OracularDenseExtractor< Value_, Index_ >, MyopicDenseExtractor< Value_, Index_ > >::type DenseExtractor
Definition Extractor.hpp:273
std::shared_ptr< Matrix< OutputValue_, Index_ > > make_DelayedUnaryIsometricOperation(std::shared_ptr< const Matrix< InputValue_, Index_ > > matrix, Operation_ operation)
Definition DelayedUnaryIsometricOperation.hpp:920
typename std::conditional< oracle_, OracularSparseExtractor< Value_, Index_ >, MyopicSparseExtractor< Value_, Index_ > >::type SparseExtractor
Definition Extractor.hpp:284
typename std::conditional< oracle_, std::shared_ptr< const Oracle< Index_ > >, bool >::type MaybeOracle
Definition new_extractor.hpp:20
Value_ * copy_n(const Value_ *input, Size_ n, Value_ *output)
Definition copy.hpp:25
std::shared_ptr< const std::vector< Index_ > > VectorPtr
Definition Matrix.hpp:26
auto new_extractor(const Matrix< Value_, Index_ > *ptr, bool row, MaybeOracle< oracle_, Index_ > oracle, Args_ &&... args)
Definition new_extractor.hpp:42
auto consecutive_extractor(const Matrix< Value_, Index_ > *mat, bool row, Index_ iter_start, Index_ iter_length, Args_ &&... args)
Definition consecutive_extractor.hpp:35
Options for accessing data from a Matrix instance.
Definition Options.hpp:30