Mock a subsettable dense chunk for a CustomDenseChunkedMatrix
.
More...
#include <mock_dense_chunk.hpp>
|
template<typename Index_ > |
void | extract (bool row, Index_ target_start, Index_ target_length, Index_ non_target_start, Index_ non_target_length, Workspace &work, value_type *output, size_t stride) const |
|
template<typename Index_ > |
void | extract (bool row, Index_ target_start, Index_ target_length, const std::vector< Index_ > &non_target_indices, Workspace &work, value_type *output, size_t stride) const |
|
template<typename Index_ > |
void | extract (bool row, const std::vector< Index_ > &target_indices, Index_ non_target_start, Index_ non_target_length, Workspace &work, value_type *output, size_t stride) const |
|
template<typename Index_ > |
void | extract (bool row, const std::vector< Index_ > &target_indices, const std::vector< Index_ > &non_target_indices, Workspace &work, value_type *output, size_t stride) const |
|
Mock a subsettable dense chunk for a CustomDenseChunkedMatrix
.
Mock a subsettable dense chunk for use inside a CustomDenseChunkedMatrix
. Each chunk should represent a (possible compressed) 2-dimensional array of numeric values. The interface is smarter as it only extracts elements of interest along the target dimension. The elements of interest may be either a contiguous block or a indexed subset, as predicted for each chunk from the OracularSubsettedSlabCache
. This provides some opportunities for optimization if the chunk supports partial reads.
◆ value_type
Type of the value stored in this chunk. Implementations can use any numeric type.
◆ extract() [1/4]
Extract a contiguous block of the target dimension into an output buffer. For each element, this method will only extract a contiguous block of the non-target dimension.
- Template Parameters
-
- Parameters
-
| row | Whether to extract rows from the chunk, i.e., the rows are the target dimension. |
| target_start | Index of the start of the contiguous block of the target dimension to be extracted. If row = true , this is the first row, otherwise it is the first column. |
| target_length | Length of the contiguous block of 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 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. |
| work | Re-usable workspace for extraction from one or more chunks. |
[out] | output | Pointer to an output array of length no less than stride * target_length + non_target_length . |
| stride | Distance between corresponding values from consecutive target dimension elements when stored in output . This is guaranteed to be greater than or equal to non_target_length . |
If row = true
, we would extract a block of rows [target_start, target_start + length)
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 secondary. For a target dimension index target_start + p
and non-target dimension index non_target_start + i
, the value from the chunk should be stored in output[p * stride + i]
. This layout allows concatenation of multiple chunks into a single contiguous array for easier fetching in the CustomChunkedMatrix
.
Note that implementions of this method do not need to have the exact same template arguments as shown here, as long as the types can be deduced.
◆ extract() [2/4]
Extract a contiguous block of the target dimension into an output buffer. For each element, this method will only extract an indexed subset of the non-target dimension.
- Template Parameters
-
- Parameters
-
| 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 | 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. |
| work | Re-usable workspace for extraction from one or more chunks. |
[out] | output | Pointer to an output array of length no less than stride * (target_start + target_length) . |
| stride | Distance between corresponding values from consecutive target dimension elements when stored in output . This is guaranteed to be greater than or equal to non_target_indices.size() . |
If row = true
, we would extract a block of rows [target_start, target_start + length)
and a subset of columns in non_target_indices
; conversely, if row = false
, we would extract a block of columns as the target and a subset of rows instead. For a target dimension index p
and non-target dimension index non_target_indices[i]
, the value from the chunk should be stored in output[p * stride + i]
. This layout allows concatenation of multiple chunks into a single contiguous array for easier fetching in the CustomChunkedMatrix
.
Note that implementions of this method do not need to have the exact same template arguments as shown here, as long as the types can be deduced.
◆ extract() [3/4]
Extract an indexed subset of the target dimension into an output buffer. For each element, this method will only extract a contiguous block of the non-target dimension.
- Template Parameters
-
- Parameters
-
| 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. This is guaranteed to be non-empty with unique and sorted 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. |
| work | Re-usable workspace for extraction from one or more chunks. |
[out] | output | Pointer to an output array of length no less than stride * (target_indices.back() + 1) . |
| stride | Distance between corresponding values from consecutive target dimension elements when stored in output . This is guaranteed to be greater than or equal to non_target_length . |
If row = true
, we would extract a subset of rows in target_indices
and a block of columns [non_target_start, non_target_start + non_target_length)
, conversely, if row = false
, we would extract a subset of columns as the target and the block of rows as the secondary. For a target dimension index p
and non-target dimension index non_target_start + i
, the value from the chunk should be stored in output[p * stride + i]
. This layout allows concatenation of multiple chunks into a single contiguous array for easier fetching in the CustomChunkedMatrix
.
Note that implementions of this method do not need to have the exact same template arguments as shown here, as long as the types can be deduced.
◆ extract() [4/4]
Extract an indexed subset of the target dimension into an output buffer. For each element, this method will only extract an indexed subset of the non-target dimension.
- Template Parameters
-
- Parameters
-
| 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. |
| work | Re-usable workspace for extraction from one or more chunks. |
[out] | output | Pointer to an output array of length no less than stride * (target_indices.back() + 1) . |
| stride | Distance between corresponding values from consecutive target dimension elements when stored in output . This is guaranteed to be greater than or equal to non_target_indices.size() . |
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 extract a subset of columns as the target and the subset of rows as the secondary. For a target dimension index p
and non-target dimension index non_target_indices[i]
, the value from the chunk should be stored in output[p * stride + i]
. This layout allows concatenation of multiple chunks into a single contiguous array for easier fetching in the CustomChunkedMatrix
.
Note that implementions of this method do not need to have the exact same template arguments as shown here, as long as the types can be deduced.
◆ use_subset
Whether to extract a subset of elements on the target dimension. This should be set to false
, otherwise a MockSimpleDenseChunk
is expected.
The documentation for this class was generated from the following file: