tatami
C++ API for different matrix representations
Loading...
Searching...
No Matches
Matrix.hpp
Go to the documentation of this file.
1#ifndef TATAMI_MATRIX_H
2#define TATAMI_MATRIX_H
3
4#include "Extractor.hpp"
5#include "Options.hpp"
6#include "Oracle.hpp"
7#include <algorithm>
8#include <numeric>
9#include <memory>
10
17namespace tatami {
18
25template<typename Index_>
26using VectorPtr = std::shared_ptr<const std::vector<Index_> >;
27
58template <typename Value_, typename Index_ = int>
59class Matrix {
60public:
64 Matrix() = default;
65 Matrix(const Matrix&) = default;
66 Matrix& operator=(const Matrix&) = default;
67 Matrix(Matrix&&) = default;
68 Matrix& operator=(Matrix&&) = default;
69 virtual ~Matrix() = default;
77 typedef Value_ value_type;
78
82 typedef Index_ index_type;
83
84 /*******************************
85 **** Basic virtual methods ****
86 *******************************/
87public:
91 virtual Index_ nrow() const = 0;
92
96 virtual Index_ ncol() const = 0;
97
103 virtual bool is_sparse() const = 0;
104
108 // Back-compatibility only.
109 bool sparse() const {
110 return is_sparse();
111 }
112
113 bool sparse_proportion() const {
114 return is_sparse_proportion();
115 }
128 virtual double is_sparse_proportion() const = 0;
129
134 virtual bool prefer_rows() const = 0;
135
144 virtual double prefer_rows_proportion() const = 0;
145
153 virtual bool uses_oracle(bool row) const = 0;
154
155 /******************************
156 **** Myopic dense methods ****
157 ******************************/
158public:
166 virtual std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, const Options& opt) const = 0;
167
177 virtual std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, Index_ block_start, Index_ block_length, const Options& opt) const = 0;
178
188 virtual std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense(bool row, VectorPtr<Index_> indices_ptr, const Options& opt) const = 0;
189
190public: // ==== Convenience methods ====
197 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(const Options& opt) const {
198 return dense(true, opt);
199 }
200
209 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(Index_ block_start, Index_ block_length, const Options& opt) const {
210 return dense(true, block_start, block_length, opt);
211 }
212
221 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(VectorPtr<Index_> indices_ptr, const Options& opt) const {
222 return dense(true, std::move(indices_ptr), opt);
223 }
224
232 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(std::vector<Index_> indices, const Options& opt) const {
233 return dense_row(std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
234 }
235
242 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(const Options& opt) const {
243 return dense(false, opt);
244 }
245
254 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(Index_ block_start, Index_ block_length, const Options& opt) const {
255 return dense(false, block_start, block_length, opt);
256 }
257
266 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(VectorPtr<Index_> indices_ptr, const Options& opt) const {
267 return dense(false, std::move(indices_ptr), opt);
268 }
269
277 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(std::vector<Index_> indices, const Options& opt) const {
278 return dense_column(std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
279 }
280
281public: // ==== Default option overloads ====
287 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row() const {
288 return dense_row(Options());
289 }
290
298 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(Index_ block_start, Index_ block_length) const {
299 return dense_row(block_start, block_length, Options());
300 }
301
309 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(VectorPtr<Index_> indices_ptr) const {
310 return dense_row(std::move(indices_ptr), Options());
311 }
312
319 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_row(std::vector<Index_> indices) const {
320 return dense_row(std::move(indices), Options());
321 }
322
328 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column() const {
329 return dense_column(Options());
330 }
331
339 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(Index_ block_start, Index_ block_length) const {
340 return dense_column(block_start, block_length, Options());
341 }
342
350 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(VectorPtr<Index_> indices_ptr) const {
351 return dense_column(std::move(indices_ptr), Options());
352 }
353
360 std::unique_ptr<MyopicDenseExtractor<Value_, Index_> > dense_column(std::vector<Index_> indices) const {
361 return dense_column(std::move(indices), Options());
362 }
363
364 /******************************
365 **** Myopic sparse access ****
366 ******************************/
367public:
375 virtual std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, const Options& opt) const = 0;
376
386 virtual std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, Index_ block_start, Index_ block_length, const Options& opt) const = 0;
387
397 virtual std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse(bool row, VectorPtr<Index_> indices_ptr, const Options& opt) const = 0;
398
399public: // ==== Convenience methods ====
406 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(const Options& opt) const {
407 return sparse(true, opt);
408 }
409
418 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(Index_ block_start, Index_ block_length, const Options& opt) const {
419 return sparse(true, block_start, block_length, opt);
420 }
421
430 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(VectorPtr<Index_> indices_ptr, const Options& opt) const {
431 return sparse(true, std::move(indices_ptr), opt);
432 }
433
441 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(std::vector<Index_> indices, const Options& opt) const {
442 return sparse_row(std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
443 }
444
451 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(const Options& opt) const {
452 return sparse(false, opt);
453 }
454
463 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(Index_ block_start, Index_ block_length, const Options& opt) const {
464 return sparse(false, block_start, block_length, opt);
465 }
466
475 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(VectorPtr<Index_> indices_ptr, const Options& opt) const {
476 return sparse(false, std::move(indices_ptr), opt);
477 }
478
486 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(std::vector<Index_> indices, const Options& opt) const {
487 return sparse_column(std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
488 }
489
490public: // ==== Default option overloads ====
496 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row() const {
497 return sparse_row(Options());
498 }
499
507 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(Index_ block_start, Index_ block_length) const {
508 return sparse_row(block_start, block_length, Options());
509 }
510
518 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(VectorPtr<Index_> indices_ptr) const {
519 return sparse_row(std::move(indices_ptr), Options());
520 }
521
528 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_row(std::vector<Index_> indices) const {
529 return sparse_row(std::move(indices), Options());
530 }
531
537 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column() const {
538 return sparse_column(Options());
539 }
540
548 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(Index_ block_start, Index_ block_length) const {
549 return sparse_column(block_start, block_length, Options());
550 }
551
559 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(VectorPtr<Index_> indices_ptr) const {
560 return sparse_column(std::move(indices_ptr), Options());
561 }
562
569 std::unique_ptr<MyopicSparseExtractor<Value_, Index_> > sparse_column(std::vector<Index_> indices) const {
570 return sparse_column(std::move(indices), Options());
571 }
572
573 /*******************************
574 **** Oracular dense access ****
575 *******************************/
576public:
585 virtual std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const = 0;
586
597 virtual 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 = 0;
598
609 virtual std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense(bool row, std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const = 0;
610
611public: // ==== Convenience methods ====
619 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
620 return dense(true, std::move(oracle), opt);
621 }
622
632 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
633 return dense(true, std::move(oracle), block_start, block_length, opt);
634 }
635
645 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
646 return dense(true, std::move(oracle), std::move(indices_ptr), opt);
647 }
648
657 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices, const Options& opt) const {
658 return dense_row(std::move(oracle), std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
659 }
660
668 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
669 return dense(false, std::move(oracle), opt);
670 }
671
681 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
682 return dense(false, std::move(oracle), block_start, block_length, opt);
683 }
684
694 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
695 return dense(false, std::move(oracle), std::move(indices_ptr), opt);
696 }
697
706 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices, const Options& opt) const {
707 return dense_column(std::move(oracle), std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
708 }
709
710public: // ==== Default option overloads ====
717 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle) const {
718 return dense_row(std::move(oracle), Options());
719 }
720
729 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length) const {
730 return dense_row(std::move(oracle), block_start, block_length, Options());
731 }
732
741 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr) const {
742 return dense_row(std::move(oracle), std::move(indices_ptr), Options());
743 }
744
752 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_row(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices) const {
753 return dense_row(std::move(oracle), std::move(indices), Options());
754 }
755
762 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle) const {
763 return dense_column(std::move(oracle), Options());
764 }
765
774 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length) const {
775 return dense_column(std::move(oracle), block_start, block_length, Options());
776 }
777
786 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr) const {
787 return dense_column(std::move(oracle), std::move(indices_ptr), Options());
788 }
789
797 std::unique_ptr<OracularDenseExtractor<Value_, Index_> > dense_column(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices) const {
798 return dense_column(std::move(oracle), std::move(indices), Options());
799 }
800
801 /*********************************
802 **** Oracular sparse methods ****
803 *********************************/
804public:
813 virtual std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const = 0;
814
825 virtual 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 = 0;
826
837 virtual std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse(bool row, std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const = 0;
838
839public: // ==== Convenience methods ====
847 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
848 return sparse(true, std::move(oracle), opt);
849 }
850
860 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
861 return sparse(true, std::move(oracle), block_start, block_length, opt);
862 }
863
872 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
873 return sparse(true, std::move(oracle), std::move(indices_ptr), opt);
874 }
875
884 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices, const Options& opt) const {
885 return sparse_row(std::move(oracle), std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
886 }
887
895 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, const Options& opt) const {
896 return sparse(false, std::move(oracle), opt);
897 }
898
908 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length, const Options& opt) const {
909 return sparse(false, std::move(oracle), block_start, block_length, opt);
910 }
911
921 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr, const Options& opt) const {
922 return sparse(false, std::move(oracle), std::move(indices_ptr), opt);
923 }
924
933 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices, const Options& opt) const {
934 return sparse_column(std::move(oracle), std::make_shared<std::vector<Index_> >(std::move(indices)), opt);
935 }
936
937public: // ==== Default option overloads ====
944 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle) const {
945 return sparse_row(std::move(oracle), Options());
946 }
947
956 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length) const {
957 return sparse_row(std::move(oracle), block_start, block_length, Options());
958 }
959
967 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr) const {
968 return sparse_row(std::move(oracle), std::move(indices_ptr), Options());
969 }
970
978 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_row(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices) const {
979 return sparse_row(std::move(oracle), std::move(indices), Options());
980 }
981
988 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle) const {
989 return sparse_column(std::move(oracle), Options());
990 }
991
1000 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, Index_ block_start, Index_ block_length) const {
1001 return sparse_column(std::move(oracle), block_start, block_length, Options());
1002 }
1003
1011 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, VectorPtr<Index_> indices_ptr) const {
1012 return sparse_column(std::move(oracle), std::move(indices_ptr), Options());
1013 }
1014
1022 std::unique_ptr<OracularSparseExtractor<Value_, Index_> > sparse_column(std::shared_ptr<const Oracle<Index_> > oracle, std::vector<Index_> indices) const {
1023 return sparse_column(std::move(oracle), std::move(indices), Options());
1024 }
1025};
1026
1031
1032}
1033
1034#endif
Virtual classes for extracting matrix data.
Options for data access.
Oracle for data access.
Virtual class for a matrix.
Definition Matrix.hpp:59
virtual std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const =0
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle) const
Definition Matrix.hpp:762
virtual std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, const Options &opt) const =0
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(const Options &opt) const
Definition Matrix.hpp:197
virtual Index_ ncol() const =0
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:681
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition Matrix.hpp:895
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:729
virtual double prefer_rows_proportion() const =0
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(std::vector< Index_ > indices) const
Definition Matrix.hpp:528
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:741
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:309
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:774
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:786
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:209
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(std::vector< Index_ > indices) const
Definition Matrix.hpp:319
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:967
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:921
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:884
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:339
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(const Options &opt) const
Definition Matrix.hpp:242
virtual 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 =0
virtual std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const =0
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:221
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row() const
Definition Matrix.hpp:287
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:486
virtual std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense(bool row, Index_ block_start, Index_ block_length, const Options &opt) const =0
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:548
virtual Index_ nrow() const =0
virtual std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const =0
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:232
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:908
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:706
virtual std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const =0
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices) const
Definition Matrix.hpp:978
Value_ value_type
Definition Matrix.hpp:77
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices) const
Definition Matrix.hpp:797
virtual std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const =0
virtual bool uses_oracle(bool row) const =0
virtual bool prefer_rows() const =0
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices) const
Definition Matrix.hpp:752
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(std::vector< Index_ > indices) const
Definition Matrix.hpp:360
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle) const
Definition Matrix.hpp:988
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition Matrix.hpp:668
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:266
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_column(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:694
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:350
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:1011
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:1000
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition Matrix.hpp:847
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:254
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:475
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle) const
Definition Matrix.hpp:717
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column() const
Definition Matrix.hpp:328
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const
Definition Matrix.hpp:619
virtual double is_sparse_proportion() const =0
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_row(Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:298
virtual 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 =0
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column() const
Definition Matrix.hpp:537
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:645
virtual std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse(bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const =0
virtual bool is_sparse() const =0
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:430
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle) const
Definition Matrix.hpp:944
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:518
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:632
std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > dense_column(std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:277
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:933
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:507
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_column(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices) const
Definition Matrix.hpp:1022
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:463
std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > dense_row(std::shared_ptr< const Oracle< Index_ > > oracle, std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:657
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:418
Index_ index_type
Definition Matrix.hpp:82
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(VectorPtr< Index_ > indices_ptr) const
Definition Matrix.hpp:559
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length) const
Definition Matrix.hpp:956
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(std::vector< Index_ > indices) const
Definition Matrix.hpp:569
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_column(const Options &opt) const
Definition Matrix.hpp:451
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row() const
Definition Matrix.hpp:496
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, Index_ block_start, Index_ block_length, const Options &opt) const
Definition Matrix.hpp:860
virtual std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, Index_ block_start, Index_ block_length, const Options &opt) const =0
virtual std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse(bool row, const Options &opt) const =0
std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > sparse_row(std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const
Definition Matrix.hpp:872
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(std::vector< Index_ > indices, const Options &opt) const
Definition Matrix.hpp:441
std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > sparse_row(const Options &opt) const
Definition Matrix.hpp:406
Predict future access requests on the target dimension.
Definition Oracle.hpp:21
Flexible representations for matrix data.
Definition Extractor.hpp:15
std::shared_ptr< const std::vector< Index_ > > VectorPtr
Definition Matrix.hpp:26
Options for accessing data from a Matrix instance.
Definition Options.hpp:30