aoclsparse_?sp2md() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
aoclsparse_status aoclsparse_ssp2md(const aoclsparse_operation opA, const aoclsparse_mat_descr descrA, const aoclsparse_matrix A, const aoclsparse_operation opB, const aoclsparse_mat_descr descrB, const aoclsparse_matrix B, const float alpha, const float beta, float *C, const aoclsparse_order layout, const aoclsparse_int ldc)#
aoclsparse_status aoclsparse_dsp2md(const aoclsparse_operation opA, const aoclsparse_mat_descr descrA, const aoclsparse_matrix A, const aoclsparse_operation opB, const aoclsparse_mat_descr descrB, const aoclsparse_matrix B, const double alpha, const double beta, double *C, const aoclsparse_order layout, const aoclsparse_int ldc)#
aoclsparse_status aoclsparse_csp2md(const aoclsparse_operation opA, const aoclsparse_mat_descr descrA, const aoclsparse_matrix A, const aoclsparse_operation opB, const aoclsparse_mat_descr descrB, const aoclsparse_matrix B, aoclsparse_float_complex alpha, aoclsparse_float_complex beta, aoclsparse_float_complex *C, const aoclsparse_order layout, const aoclsparse_int ldc)#
aoclsparse_status aoclsparse_zsp2md(const aoclsparse_operation opA, const aoclsparse_mat_descr descrA, const aoclsparse_matrix A, const aoclsparse_operation opB, const aoclsparse_mat_descr descrB, const aoclsparse_matrix B, aoclsparse_double_complex alpha, aoclsparse_double_complex beta, aoclsparse_double_complex *C, const aoclsparse_order layout, const aoclsparse_int ldc)#

A variant of matrix multiplication of two sparse matrices stored in the CSR storage format. The output matrix is stored in a dense format. Supports operations on both sparse matrices.

aoclsparse_?sp2md multiplies a sparse matrix \(A\) and a sparse matrix \(B\), both stored in the CSR storage format, and saves the result in a dense matrix \(C\), such that

\[ C := \alpha \cdot op(A) \cdot op(B) + \beta \cdot C, \]
with
\[\begin{split} op(A) = \left\{ \begin{array}{ll} A, & \text{if opA} = \text{aoclsparse\_operation\_none} \\ A^T, & \text{if opA} = \text{aoclsparse\_operation\_transpose} \\ A^H, & \text{if opA} = \text{aoclsparse\_operation\_conjugate\_transpose} \end{array} \right. \end{split}\]
and
\[\begin{split} op(B) = \left\{ \begin{array}{ll} B, & \text{if opB} = \text{aoclsparse\_operation\_none} \\ B^T, & \text{if opB} = \text{aoclsparse\_operation\_transpose} \\ B^H, & \text{if opB} = \text{aoclsparse\_operation\_conjugate\_transpose} \end{array} \right. \end{split}\]
Parameters:
  • opA[in] Operation to perform on matrix \(A\).

  • descrA[in] Descriptor of A. Only aoclsparse_matrix_type_general is supported at present. As a consequence, all other parameters within the descriptor are ignored.

  • A[in] Matrix structure containing sparse matrix \(A\) of size \(m \times k\).

  • opB[in] Operation to perform on matrix \(B\).

  • descrB[in] Descriptor of B. Only aoclsparse_matrix_type_general is supported at present. As a consequence, all other parameters within the descriptor are ignored.

  • B[in] Matrix structure containing sparse matrix \(B\) of size \(k \times n\) if op is aoclsparse_operation_none otherwise of size \(m \times n\).

  • alpha[in] Value of \( \alpha\).

  • beta[in] Value of \( \beta\).

  • C[inout] Dense output matrix \(C\).

  • layout[in] Ordering of the dense output matrix: valid values are aoclsparse_order_row and aoclsparse_order_column.

  • ldc[in] Leading dimension of \(C\), e.g., for C stored in aoclsparse_order_row, ldc must be at least \(\max{(1, m)}\) ( \(op(A) = A\)) or \(\max{(1, k)}\) ( \(op(A) = A^T\) or \(op(A) = A^H\)).

Return values:
  • aoclsparse_status_success – The operation completed successfully.

  • aoclsparse_status_invalid_sizem, n, k, nnz or ldc is not valid.

  • aoclsparse_status_invalid_pointerA, B or C pointer is not valid.

  • aoclsparse_status_wrong_typeaoclsparse_matrix_data_type does not match the precision type.

  • aoclsparse_status_not_implemented – aoclsparse_matrix_format_type is not aoclsparse_csr_mat.

  • aoclsparse_status_internal_error – An internal error occurred.