|
| | CompressedSparseMatrix (const Index_ nrow, const Index_ ncol, ValueStorage_ values, IndexStorage_ indices, PointerStorage_ pointers, const bool csr, const CompressedSparseMatrixOptions &options) |
| |
| 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) const |
| |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, const Options &) const |
| |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, const Index_ block_start, const Index_ block_length, const Options &) const |
| |
| std::unique_ptr< MyopicDenseExtractor< Value_, Index_ > > | dense (const bool row, VectorPtr< Index_ > indices_ptr, const Options &) 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 |
| |
template<typename Value_, typename Index_, class ValueStorage_, class IndexStorage_, class PointerStorage_>
class tatami::CompressedSparseMatrix< Value_, Index_, ValueStorage_, IndexStorage_, PointerStorage_ >
Compressed sparse matrix representation.
- Template Parameters
-
| Value_ | Type of the matrix values. |
| Index_ | Type of the row/column indices. |
| ValueStorage_ | Vector class used to store the matrix values internally. This does not necessarily have to contain Value_, as long as the type is convertible to Value_. Methods should be available for size(), begin(), end() and []. If a method is available for data() that returns a const Value_*, it will also be used. |
| IndexStorage_ | Vector class used to store the row/column indices internally. This does not necessarily have to contain Index_, as long as the type is convertible to Index_. Methods should be available for size(), begin(), end() and []. If a method is available for data() that returns a const Index_*, it will also be used. |
| PointerStorage_ | Vector class used to store the column/row index pointers. Methods should be available for size(), begin(), end() and []. |
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
- Returns
- Number of rows.
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
- Returns
- Number of columns.
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
- Returns
- Approximate proportion of the matrix that is sparse.
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
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.)
- Returns
- Approximate proportion of the matrix that prefers row-level access.
Implements tatami::Matrix< Value_, Index_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
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.
- Parameters
-
| row | Row access if true, column access otherwise. |
- Returns
- Whether this matrix's
tatami::Extractor classes make use of oracle predictions for row (if row = true) or column access (otherwise).
Implements tatami::Matrix< Value_, Index_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves the full extent of the non-target dimension in dense form.
- Parameters
-
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| opt | Options for extraction. |
- Returns
- Object for extracting each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves a contiguous block of the non-target dimension in dense form.
- Parameters
-
| 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. |
- Returns
- Object for extracting a contiguous block from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves an indexed subset of the non-target dimension in dense form.
- Parameters
-
| 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. |
- Returns
- Object for extracting an indexed subset from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves the full extent of the non-target dimension in sparse form.
- Parameters
-
| row | Whether to create a row-wise extractor, i.e., the rows are the target dimension. |
| opt | Options for extraction. |
- Returns
- Object for extracting each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves a contiguous block of the non-target dimension in sparse form.
- Parameters
-
| 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. |
- Returns
- Object for extracting a contiguous block from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an extractor that retrieves an indexed subset of the non-target dimension in sparse form.
- Parameters
-
| 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. |
- Returns
- Object for extracting an indexed subset from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves the full extent of the non-target dimension in dense form.
- Parameters
-
| 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. |
- Returns
- Object for extracting each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves a contiguous block of the non-target dimension in dense form.
- Parameters
-
| 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. |
- Returns
- Object for extracting a contiguous block from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves an indexed subset of the non-target dimension in dense form.
- Parameters
-
| 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. |
- Returns
- Object for extracting an indexed subset from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves the full extent of the non-target dimension in sparse form.
- Parameters
-
| 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. |
- Returns
- Object for extracting each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves a contiguous block of the non-target dimension in sparse form.
- Parameters
-
| 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. |
- Returns
- Object for extracting a contiguous block from each row (if
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_ >.
template<typename Value_ , typename Index_ , class ValueStorage_ , class IndexStorage_ , class PointerStorage_ >
Create an oracle-aware extractor that retrieves an indexed subset of the non-target dimension in sparse form.
- Parameters
-
| 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. |
- Returns
- Object for extracting an indexed subset from each row (if
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_ >.