pub fn csr_to_csc<T: DataTypeLike>(
ctx: &Context,
row_count: usize,
col_count: usize,
nonzero_count: usize,
csr_values: &DeviceMemory<T>,
csr_row_offsets: &DeviceMemory<i32>,
csr_column_indices: &DeviceMemory<i32>,
csc_values: &mut DeviceMemory<T>,
csc_column_offsets: &mut DeviceMemory<i32>,
csc_row_indices: &mut DeviceMemory<i32>,
action: Action,
index_base: IndexBase,
algorithm: CsrToCscAlgorithm,
external_buffer: &mut DeviceMemory<u8>,
) -> Result<()>Expand description
Converts a sparse matrix in CSR format into a sparse matrix in CSC format. The resulting matrix can also be seen as the transpose of the original sparse matrix. This can also convert a matrix in CSC format into a matrix in CSR format.
This operation requires extra storage proportional to nonzero_count.
It always produces the same matrix values in the destination format.
The operation executes asynchronously with respect to the host and may return before the result is ready.
csr_to_csc_buffer_size returns the size of the workspace needed by csr_to_csc.
Pass a buffer of this size to csr_to_csc.
If nonzero_count is 0, then the CSR column indices, CSR values, CSC
values, and CSC row indices may be zero-length buffers.
In this case, all CSC column pointers are initialized to the configured index base.
If m or n is 0, the pointers are not checked and the operation succeeds with Ok.
csr_to_csc supports the following data types:
X/Y | Notes |
|---|---|
DataType::I8 | |
DataType::F16 | |
DataType::Bf16 | |
DataType::F32 | |
DataType::F64 | |
DataType::ComplexF16 | Deprecated. |
DataType::ComplexBf16 | Deprecated. |
DataType::ComplexF32 | |
DataType::ComplexF64 |
csr_to_csc supports the following algorithms (CsrToCscAlgorithm):
| Algorithm | Notes |
|---|---|
CsrToCscAlgorithm::Default | Default algorithm. |
| Action | Notes |
|---|---|
Action::Symbolic | Compute the structure of the CSC output matrix (offset, row indices). |
Action::Numeric | Compute the structure of the CSC output matrix and copy the values. |
csr_to_csc has the following properties:
- Requires no extra storage.
- Supports asynchronous execution.
csr_to_csc supports the following optimizations:
- CUDA graph capture.
- Hardware Memory Compression.