|
tatami
C++ API for different matrix representations
|
Delayed subsetting to a contiguous block. More...
#include <DelayedSubsetBlock.hpp>


Public Member Functions | |
| DelayedSubsetBlock (std::shared_ptr< const Matrix< Value_, Index_ > > matrix, const Index_ subset_start, const Index_ subset_length, const bool by_row) | |
| Index_ | nrow () const |
| Index_ | ncol () const |
| bool | is_sparse () const |
| double | is_sparse_proportion () const |
| bool | prefer_rows () const |
| double | prefer_rows_proportion () const |
| bool | uses_oracle (const bool row) const |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, const Options &opt) const |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, const Index_ block_start, const Index_ block_length, const Options &opt) const |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const |
| std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > | sparse (const bool row, const Options &opt) const |
| std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > | sparse (const bool row, const Index_ block_start, const Index_ block_length, const Options &opt) const |
| std::unique_ptr< MyopicSparseExtractor< Value_, Index_ > > | sparse (const bool row, VectorPtr< Index_ > indices_ptr, const Options &opt) const |
| std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > | dense (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const |
| std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > | dense (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Index_ block_start, const Index_ block_length, const Options &opt) const |
| std::unique_ptr< OracularDenseExtractor< Value_, Index_ > > | dense (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const |
| std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > | sparse (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Options &opt) const |
| std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > | sparse (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, const Index_ block_start, const Index_ block_length, const Options &opt) const |
| std::unique_ptr< OracularSparseExtractor< Value_, Index_ > > | sparse (const bool row, std::shared_ptr< const Oracle< Index_ > > oracle, VectorPtr< Index_ > indices_ptr, const Options &opt) const |
Public Member Functions inherited from tatami::Matrix< Value_, Index_ > | |
Additional Inherited Members | |
Public Types inherited from tatami::Matrix< Value_, Index_ > | |
| typedef Value_ | value_type |
| typedef Index_ | index_type |
Delayed subsetting to a contiguous block.
Implements delayed subsetting (i.e., slicing) of a matrix to a single contiguous block of rows or columns. This is a specialized implementation that is more efficient than the tatami::DelayedSubset class. This operation is "delayed" in that it is only evaluated when data is extracted from the matrix.
| Value_ | Type of matrix value. |
| Index_ | Integer type for the row/column indices. |
|
inline |
| matrix | Pointer to the underlying (pre-subset) matrix. |
| subset_start | Index of the start of the block. This should be a row index if by_row = true and a column index otherwise. |
| subset_length | Length of the block, in terms of the number of rows (if by_row = true) or columns (otherwise). |
| by_row | Whether to apply the subset to the rows. If false, the subset is applied to the columns. |
|
inlinevirtual |
It is expected that the number of rows can be represented by a std::size_t without overflow, even if Index_ is of a larger size. This is implied by the fact that MyopicDenseExtractor::fetch() and friends accept a pointer for their buffer arguments; the length of the array referenced by these pointers (possibly equal to the number of rows) must fit in a std::size_t.
Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
It is expected that the number of columns can be represented by a std::size_t without overflow, even if Index_ is of a larger size. This is implied by the fact that MyopicDenseExtractor::fetch() and friends accept a pointer for their buffer arguments; the length of the array referenced by these pointers (possibly equal to the number of rows) must fit in a std::size_t.
Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
This can be used to choose between dense and sparse outputs.
Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
This is defined as the proportion of matrix elements that lie within sparse submatrices. It is intended for use in Matrix representations that consist of combinations of multiple submatrices (e.g., DelayedBind), allowing them to derive a suitable value for is_sparse() based on whether most of its submatrices are sparse. (A more granular approach would be to report the density of structural non-zero elements, but this may not be known by all representations at construction time.)
Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
true, row-wise extraction is preferred; if false, column-wise extraction is preferred. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
The return value of this method is the (approximate) proportion of matrix elements that lie within submatrices that prefer row-level access. It is useful for determining the return value of prefer_rows() in combined matrices consisting of both row- and column-preferred submatrices. In such cases, the net preference can be determined based on the combined size of the submatrices for each preference. (A more granular approach would be to report the iteration cost on each dimension, but this is difficult to estimate.)
Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
The return value of this method indicates whether callers should construct an oracle for use in ExtractorBase::set_oracle(). If false, callers should not bother to pass an oracle as it will be ignored.
| row | Row access if true, column access otherwise. |
tatami::Extractor classes make use of oracle predictions for row (if row = true) or column access (otherwise). Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves the full extent of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves a contiguous block of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| block_start | Index of the column (if row = true) or row (otherwise) at the start of the block. This should be non-negative and less than the respective number of columns/rows. (For a matrix with zero columns/rows, block_start may also be zero.) |
| block_length | Number of columns (if row = true) or rows (otherwise) in the block. This should be non-negative and block_start + block_length should be no greater than the number of columns/rows. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves an indexed subset of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| indices_ptr | Pointer to a vector of sorted and unique column indices (if row = true) or row indices (otherwise). Each entry should be non-negative and less than the respective number of columns/rows. This should be non-NULL. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves the full extent of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| opt | Options for extraction. |
row = true) or columns (otherwise) in sparse form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves a contiguous block of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| block_start | Index of the column (if row = true) or row (otherwise) at the start of the block. This should be non-negative and less than the respective number of columns/rows. (For a matrix with zero columns/rows, block_start may also be zero.) |
| block_length | Number of columns (if row = true) or rows (otherwise) in the block. This should be non-negative and block_start + block_length should be no greater than the number of columns/rows. |
| opt | Options for extraction. |
row = true) or column (otherwise) in sparse form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an extractor that retrieves an indexed subset of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| indices_ptr | Pointer to a vector of sorted and unique column indices (if row = true) or row indices (otherwise). Each entry should be non-negative and less than the respective number of columns/rows. This should be non-NULL. |
| opt | Options for extraction. |
row = true) or column (otherwise) in sparse form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves the full extent of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| opt | Options for extraction. |
row = true) or columns (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves a contiguous block of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| block_start | Index of the column (if row = true) or row (otherwise) at the start of the block. This should be non-negative and less than the respective number of columns/rows. (For a matrix with zero columns/rows, block_start may also be zero.) |
| block_length | Number of columns (if row = true) or rows (otherwise) in the block. This should be non-negative and block_start + block_length should be no greater than the number of columns/rows. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves an indexed subset of the non-target dimension in dense form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| indices_ptr | Pointer to a vector of sorted and unique column indices (if row = true) or row indices (otherwise). Each entry should be non-negative and less than the respective number of columns/rows. This should not be NULL. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves the full extent of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| opt | Options for extraction. |
row = true) or columns (otherwise) in sparse form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves a contiguous block of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| block_start | Index of the column (if row = true) or row (otherwise) at the start of the block. This should be non-negative and less than the respective number of columns/rows. (For a matrix with zero columns/rows, block_start may also be zero.) |
| block_length | Number of columns (if row = true) or rows (otherwise) in the block. This should be non-negative and block_start + block_length should be no greater than the number of columns/rows. |
| opt | Options for extraction. |
row = true) or column (otherwise) in dense form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.
|
inlinevirtual |
Create an oracle-aware extractor that retrieves an indexed subset of the non-target dimension in sparse form.
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| oracle | An oracle supplying predictions of the next requested row (if row = true) or column (otherwise). |
| indices_ptr | Pointer to a vector of sorted and unique column indices (if row = true) or row indices (otherwise). Each entry should be non-negative and less than the respective number of columns/rows. This should not be NULL. |
| opt | Options for extraction. |
row = true) or column (otherwise) in sparse form. This should not outlive the parent Matrix from which it was created. Implements tatami::Matrix< Value_, Index_ >.