aoclsparse_spmm() - 5.2 English - 68552

AOCL API Guide (68552)

Document ID
68552
Release Date
2025-12-29
Version
5.2 English
aoclsparse_status aoclsparse_spmm(aoclsparse_operation opA, const aoclsparse_matrix A, const aoclsparse_matrix B, aoclsparse_matrix *C)#

Sparse matrix Sparse matrix multiplication for real and complex datatypes.

aoclsparse_?spmm multiplies two sparse matrices in CSR storage format. The result is stored in a newly allocated sparse matrix in CSR format, such that

\[\begin{split}C = op(A) \cdot B, \text{ with } op(A) = \left\{ \begin{array}{ll} A, & \text{ if } {\bf\mathsf{opA}} = \text{aoclsparse}\_\text{operation}\_\text{none} \\ A^T, & \text{ if } {\bf\mathsf{opA}} = \text{aoclsparse}\_\text{operation}\_\text{transpose} \\ A^H, & \text{ if } {\bf\mathsf{opA}} = \text{aoclsparse}\_\text{operation}\_\text{conjugate}\_\text{transpose} \end{array} \right.\end{split}\]
where \(A\) is a \(m \times k\) matrix , \(B\) is a \(k \times n\) matrix, resulting in \(m \times n\) matrix \(C\), for opA = aoclsparse_operation_none. \(A\) is a \(k \times m\) matrix when opA = aoclsparse_operation_transpose or aoclsparse_operation_conjugate_transpose
Parameters:
  • opA[in] matrix \(A\) operation type.

  • A[in] sparse CSR matrix \(A\).

  • B[in] sparse CSR matrix \(B\).

  • *C[out] Pointer to sparse CSR matrix \(C\) . Matrix \(C\) arrays will always have zero-based indexing, irrespective of matrix \(A\) or matrix \(B\) being one-based or zero-based indexing. The column indices of the output matrix in CSR format can appear unsorted.

Return values:
  • aoclsparse_status_success – the operation completed successfully.

  • aoclsparse_status_invalid_pointerA, B, C is invalid.

  • aoclsparse_status_invalid_size – input size parameters contain an invalid value.

  • aoclsparse_status_invalid_value – input parameters contain an invalid value.

  • aoclsparse_status_wrong_typeA and B matrix data types do not match.

  • aoclsparse_status_memory_error – Memory allocation failure.

  • aoclsparse_status_not_implemented – Input matrices A or B is not in CSR format