tatami_chunked
Helpers to create custom chunked tatami matrices
Loading...
Searching...
No Matches
tatami_chunked::CustomDenseChunkedMatrixWorkspace< ChunkValue_, Index_ > Class Template Referenceabstract

Workspace for extracting data from a CustomDenseChunkedMatrixManager. More...

#include <CustomDenseChunkedMatrix.hpp>

Public Member Functions

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, ChunkValue_ *output, Index_ stride)=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, ChunkValue_ *output, Index_ stride)=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, ChunkValue_ *output, Index_ stride)=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, ChunkValue_ *output, Index_ stride)=0
 

Detailed Description

template<typename ChunkValue_, typename Index_>
class tatami_chunked::CustomDenseChunkedMatrixWorkspace< ChunkValue_, Index_ >

Workspace for extracting data from a CustomDenseChunkedMatrixManager.

Template Parameters
ChunkValue_Numeric type of the data values in each chunk.
Index_Integer type of the row/column indices of the CustomDenseChunkedMatrix.

Member Function Documentation

◆ extract() [1/4]

template<typename ChunkValue_ , typename Index_ >
virtual void tatami_chunked::CustomDenseChunkedMatrixWorkspace< 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,
ChunkValue_ * output,
Index_ stride )
pure virtual
Parameters
chunk_row_idRow 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_idColumn 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.
rowWhether to extract rows from the chunk, i.e., the rows are the target dimension.
target_startIndex 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_lengthNumber 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_startIndex 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_lengthLength 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]outputPointer to an output array of length no less than stride * P, where P is the number of rows (if row = true) or columns (otherwise) in this chunk.
strideDistance between corresponding values from adjacent elements of the target dimension when they are being stored in output. This is guaranteed to be greater than or equal to non_target_length.

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, ifrow = false, we would consider a block of target columns and a block of non-target rows. For a target dimension indexpand non-target dimension indexnon_target_start + q, the value from the chunk should be stored inoutput[p * stride + q]`.

  • The stride allows interleaving of multiple chunks into a single array where values from the same target dimension element are contiguous. This enables easier fetching in the CustomDenseChunkedMatrix.
  • p should lie in [target_start, target_start + target_length), whereas q should lie in [0, non_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::CustomDenseChunkedMatrixWorkspace< 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,
ChunkValue_ * output,
Index_ stride )
pure virtual
Parameters
chunk_row_idRow 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_idColumn 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.
rowWhether to extract rows from the chunk, i.e., the rows are the target dimension.
target_startIndex 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_lengthNumber 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_indicesIndexed 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]outputPointer to an output array of length no less than stride * P, where P is the number of rows (if row = true) or columns (otherwise) in this chunk.
strideDistance 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().

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 index p and non-target dimension index non_target_indices[q], the value from the chunk should be stored in output[p * stride + q].

  • The stride allows interleaving of multiple chunks into a single array where values from the same target dimension element are contiguous. This enables easier fetching in the CustomDenseChunkedMatrix.
  • p should lie in [target_start, target_start + target_length), whereas q should lie in [0, non_target_indices.size()). 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::CustomDenseChunkedMatrixWorkspace< 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,
ChunkValue_ * output,
Index_ stride )
pure virtual
Parameters
chunk_row_idRow 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_idColumn 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.
rowWhether to extract rows from the chunk, i.e., the rows are the target dimension.
target_indicesIndices of the elements of the target dimension to be extracted. If row = true, these are row indices, otherwise these are column indices.
non_target_startIndex 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_lengthLength 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]outputPointer to an output array of length no less than stride * target_length + non_target_length.
strideDistance 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.

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 index p and non-target dimension index non_target_start + q, the value from the chunk should be stored in output[p * stride + q].

  • The stride allows interleaving of multiple chunks into a single array where values from the same target dimension element are contiguous. This enables easier fetching in the CustomDenseChunkedMatrix.
  • p should be a value in target_indices, whereas q should lie in [0, non_target_length). 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::CustomDenseChunkedMatrixWorkspace< 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,
ChunkValue_ * output,
Index_ stride )
pure virtual
Parameters
chunk_row_idRow 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_idColumn 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.
rowWhether to extract rows from the chunk, i.e., the rows are the target dimension.
target_indicesIndices 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_indicesIndices 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]outputPointer to an output array of length no less than stride * (target_indices.back() + 1).
strideDistance 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().

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 index p and non-target dimension index non_target_indices[q], the value from the chunk should be stored in output[p * stride + q].

  • The stride allows interleaving of multiple chunks into a single array where values from the same target dimension element are contiguous. This enables easier fetching in the CustomDenseChunkedMatrix.
  • p should be a value in target_indices whereas q should lie in [0, non_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: