Workspace for extracting data from a CustomSparseChunkedMatrixManager
.
More...
#include <CustomSparseChunkedMatrix.hpp>
|
virtual void | extract (Index_ chunk_row_id, Index_ chunk_column_id, bool row, Index_ target_start, Index_ target_length, Index_ non_target_start, Index_ non_target_length, const std::vector< ChunkValue_ * > &output_values, const std::vector< Index_ * > &output_indices, Index_ *output_number, Index_ shift)=0 |
|
virtual void | extract (Index_ chunk_row_id, Index_ chunk_column_id, bool row, Index_ target_start, Index_ target_length, const std::vector< Index_ > &non_target_indices, const std::vector< ChunkValue_ * > &output_values, const std::vector< Index_ * > &output_indices, Index_ *output_number, Index_ shift)=0 |
|
virtual void | extract (Index_ chunk_row_id, Index_ chunk_column_id, bool row, const std::vector< Index_ > &target_indices, Index_ non_target_start, Index_ non_target_length, const std::vector< ChunkValue_ * > &output_values, const std::vector< Index_ * > &output_indices, Index_ *output_number, Index_ shift)=0 |
|
virtual void | extract (Index_ chunk_row_id, Index_ chunk_column_id, bool row, const std::vector< Index_ > &target_indices, const std::vector< Index_ > &non_target_indices, const std::vector< ChunkValue_ * > &output_values, const std::vector< Index_ * > &output_indices, Index_ *output_number, Index_ shift)=0 |
|
template<typename ChunkValue_, typename Index_>
class tatami_chunked::CustomSparseChunkedMatrixWorkspace< ChunkValue_, Index_ >
Workspace for extracting data from a CustomSparseChunkedMatrixManager
.
- Template Parameters
-
ChunkValue_ | Numeric type of the data values in each chunk. |
Index_ | Integer type for the row/column indices of the CustomSparseChunkedMatrix . |
◆ extract() [1/4]
template<typename ChunkValue_ , typename Index_ >
virtual void tatami_chunked::CustomSparseChunkedMatrixWorkspace< ChunkValue_, Index_ >::extract |
( |
Index_ | chunk_row_id, |
|
|
Index_ | chunk_column_id, |
|
|
bool | row, |
|
|
Index_ | target_start, |
|
|
Index_ | target_length, |
|
|
Index_ | non_target_start, |
|
|
Index_ | non_target_length, |
|
|
const std::vector< ChunkValue_ * > & | output_values, |
|
|
const std::vector< Index_ * > & | output_indices, |
|
|
Index_ * | output_number, |
|
|
Index_ | shift ) |
|
pure virtual |
- Parameters
-
| chunk_row_id | Row of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| chunk_column_id | Column of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| row | Whether to extract rows from the chunk, i.e., the rows are the target dimension. |
| target_start | Index of the first element on the target dimension to be extracted. If row = true , this is the first row, otherwise it is the first column. |
| target_length | Number of elements on the target dimension to be extracted. If row = true , this is the number of rows, otherwise it is the number of columns. This is guaranteed to be positive. |
| non_target_start | Index of the start of the continguous block of the non-target dimension to be extracted. If row = true , this is the first column, otherwise it is the first row. |
| non_target_length | Length of the contiguous block of the non-target dimension to be extracted. If row = true , this is the number of columns, otherwise it is the number of rows. This is guaranteed to be positive. |
[out] | output_values | Vector of pointers in which to store the values of non-zero elements. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no values should be stored. |
[out] | output_indices | Vector of vectors in which to store the indices of the non-zero elements along the non-target dimension. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no indices should be stored. |
[in,out] | output_number | Pointer to an array of length equal to the extent of the target dimension. Each entry i specifies the number of non-zero elements that are already present in output_values[i] and output_indices[i] . |
| shift | Shift to be added to the chunk's reported indices when storing them in output_indices . |
Given a chunk of interest, this method extracts a contiguous block of rows/columns. If row = true
, we consider a block of rows [target_start, target_start + target_length) * and a block of columns
[non_target_start, non_target_start + non_target_length); conversely, if
row = false, we would consider a block of target columns and a block of non-target rows. For a target dimension element
p, the values of non-zero elements from the requested non-target block should be stored at
output_values[p] + output_number[p]. The non-target indices for those non-zero elements should be increased by
shiftand stored at
output_indices[p] + output_number[p]in ascending order.
output_number[p]` should then be increased by the number of non-zero entries stored in this manner.
- Storing the non-zero values from the
output_number[p]
-th element onwards (and shifting their indices) allows interleaving of data from multiple chunks. This ensures that the values/indices from the same target dimension element are contiguous for easier fetching in the CustomSparseChunkedMatrix
.
p
should lie in [target_start, target_start + target_length)
, not [0, target_length)
. This difference is deliberate and enables easy extraction of the target dimension element of interest.
◆ extract() [2/4]
template<typename ChunkValue_ , typename Index_ >
virtual void tatami_chunked::CustomSparseChunkedMatrixWorkspace< ChunkValue_, Index_ >::extract |
( |
Index_ | chunk_row_id, |
|
|
Index_ | chunk_column_id, |
|
|
bool | row, |
|
|
Index_ | target_start, |
|
|
Index_ | target_length, |
|
|
const std::vector< Index_ > & | non_target_indices, |
|
|
const std::vector< ChunkValue_ * > & | output_values, |
|
|
const std::vector< Index_ * > & | output_indices, |
|
|
Index_ * | output_number, |
|
|
Index_ | shift ) |
|
pure virtual |
- Parameters
-
| chunk_row_id | Row of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| chunk_column_id | Column of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| row | Whether to extract rows from the chunk, i.e., the rows are the target dimension. |
| target_start | Index of the first element on the target dimension to be extracted. If row = true , this is the first row, otherwise it is the first column. |
| target_length | Number of elements on the target dimension to be extracted. If row = true , this is the number of rows, otherwise it is the number of columns. This is guaranteed to be positive. |
| non_target_indices | Indexed subset of the non-target dimension to be extracted. If row = true , these are column indices, otherwise these are row indices. This is guaranteed to be non-empty with unique and sorted indices. |
[out] | output_values | Vector of pointers in which to store the values of non-zero elements. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no values should be stored. |
[out] | output_indices | Vector of vectors in which to store the indices of the non-zero elements along the non-target dimension. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no indices should be stored. |
[in,out] | output_number | Pointer to an array of length equal to the extent of the target dimension. Each entry i specifies the number of non-zero elements that are already present in output_values[i] and output_indices[i] . |
| shift | Shift to be added to the chunk's reported indices when storing them in output_indices . |
Given a chunk of interest, this method extracts a contiguous block along the target dimension and an indexed subset along the non-target dimension. If row = true
, we consider a block of rows [target_start, target_start + target_length)
and a subset of columns non_target_indices
; conversely, if row = false
, we would extract data for all columns and a subset of rows. For a target dimension element p
, the values of non-zero elements from the requested non-target subset should be stored at output_values[p] + output_number[p]
. The non-target indices for those non-zero elements should be increased by shift
and stored at output_indices[p] + output_number[p]
in ascending order. output_number[p]
should then be increased by the number of non-zero entries stored in this manner.
- Storing the non-zero values from the
output_number[p]
-th element onwards (and shifting their indices) allows interleaving of data from multiple chunks. This ensures that the values/indices from the same target dimension element are contiguous for easier fetching in the CustomSparseChunkedMatrix
.
p
should lie in [target_start, target_start + target_length)
, not [0, target_length)
. This difference is deliberate and enables easy extraction of the target dimension element of interest.
◆ extract() [3/4]
template<typename ChunkValue_ , typename Index_ >
virtual void tatami_chunked::CustomSparseChunkedMatrixWorkspace< ChunkValue_, Index_ >::extract |
( |
Index_ | chunk_row_id, |
|
|
Index_ | chunk_column_id, |
|
|
bool | row, |
|
|
const std::vector< Index_ > & | target_indices, |
|
|
Index_ | non_target_start, |
|
|
Index_ | non_target_length, |
|
|
const std::vector< ChunkValue_ * > & | output_values, |
|
|
const std::vector< Index_ * > & | output_indices, |
|
|
Index_ * | output_number, |
|
|
Index_ | shift ) |
|
pure virtual |
- Parameters
-
| chunk_row_id | Row of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| chunk_column_id | Column of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| row | Whether to extract rows from the chunk, i.e., the rows are the target dimension. |
| target_indices | Indices of the elements of the target dimension to be extracted. If row = true , these are row indices, otherwise these are column indices. |
| non_target_start | Index of the start of the contiguous block of the non-target dimension to be extracted. If row = true , this is the first column, otherwise it is the first row. |
| non_target_length | Length of the contiguous block of the non-target dimension to be extracted. If row = true , this is the number of columns, otherwise it is the number of rows. This is guaranteed to be positive. |
[out] | output_values | Vector of pointers in which to store the values of non-zero elements. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no values should be stored. |
[out] | output_indices | Vector of vectors in which to store the indices of the non-zero elements along the non-target dimension. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no indices should be stored. |
[in,out] | output_number | Pointer to an array of length equal to the extent of the target dimension. Each entry i specifies the number of non-zero elements that are already present in output_values[i] and output_indices[i] . |
| shift | Shift to be added to the chunk's reported indices when storing them in output_indices . |
Given a chunk of interest, this method extracts an indexed subset along the target dimension and a contiguous block along the non-target dimension. If row = true
, we consider a subset of rows target_indices
and a block of columns [non_target_start, non_target_start + non_target_length)
; conversely, if row = false
, we would extract a block of columns as the target and the block of rows as the non_target. For a target dimension element p
, the values of non-zero elements from the requested non-target block should be stored at output_values[p] + output_number[p]
. The non-target indices for those non-zero elements should be increased by shift
and stored at output_indices[p] + output_number[p]
in ascending order. output_number[p]
should then be increased by the number of non-zero entries stored in this manner.
- Storing the non-zero values from the
output_number[p]
-th element onwards (and shifting their indices) allows interleaving of data from multiple chunks. This ensures that the values/indices from the same target dimension element are contiguous for easier fetching in the CustomSparseChunkedMatrix
.
p
should be a value in target_indices
, not [0, target_indices.size())
. This difference is deliberate and enables easy extraction of the target dimension element of interest.
◆ extract() [4/4]
template<typename ChunkValue_ , typename Index_ >
virtual void tatami_chunked::CustomSparseChunkedMatrixWorkspace< ChunkValue_, Index_ >::extract |
( |
Index_ | chunk_row_id, |
|
|
Index_ | chunk_column_id, |
|
|
bool | row, |
|
|
const std::vector< Index_ > & | target_indices, |
|
|
const std::vector< Index_ > & | non_target_indices, |
|
|
const std::vector< ChunkValue_ * > & | output_values, |
|
|
const std::vector< Index_ * > & | output_indices, |
|
|
Index_ * | output_number, |
|
|
Index_ | shift ) |
|
pure virtual |
- Parameters
-
| chunk_row_id | Row of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| chunk_column_id | Column of the chunk grid containing the chunk of interest. This considers the grid of chunks that is obtained by partitioning each dimension of the matrix. |
| row | Whether to extract rows from the chunk, i.e., the rows are the target dimension. |
| target_indices | Indices of the elements on the target dimension to be extracted. If row = true , these are row indices, otherwise these are column indices. This is guaranteed to be non-empty with unique and sorted indices. |
| non_target_indices | Indices of the elements on the non-target dimension to be extracted. If row = true , these are column indices, otherwise these are row indices. This is guaranteed to be non-empty with unique and sorted indices. |
[out] | output_values | Vector of pointers in which to store the values of non-zero elements. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no values should be stored. |
[out] | output_indices | Vector of vectors in which to store the indices of the non-zero elements along the non-target dimension. This has length equal to the extent of the target dimension for this chunk. Each pointer corresponds to an element of the target dimension and refers to an array of length no less than the extent of the non-target dimension of the chunk. Alternatively, this vector may be empty, in which case no indices should be stored. |
[in,out] | output_number | Pointer to an array of length equal to the extent of the target dimension. Each entry i specifies the number of non-zero elements that are already present in output_values[i] and output_indices[i] . |
| shift | Shift to be added to the chunk's reported indices when storing them in output_indices . |
Given a chunk of interest, this method extracts data for an indexed subset of rows/columns. If row = true
, we would extract a subset of rows in target_indices
and a subset columns in non_target_indices
. conversely, if row = false
, we would consider a subset of target columns and a subset of non-target rows. For a target dimension element p
, the values of non-zero elements from the requested non-target subset should be stored at output_values[p] + output_number[p]
. The non-target indices for those non-zero elements should be increased by shift
and stored at output_indices[p] + output_number[p]
in ascending order. output_number[p]
should then be increased by the number of non-zero entries stored in this manner.
- Storing the non-zero values from the
output_number[p]
-th element onwards (and shifting their indices) allows interleaving of data from multiple chunks. This ensures that the values/indices from the same target dimension element are contiguous for easier fetching in the CustomSparseChunkedMatrix
.
p
should be a value in target_indices
, not [0, target_indices.size())
. This difference is deliberate and enables easy extraction of the target dimension element of interest.
The documentation for this class was generated from the following file: