|
| integer(c_int) function | hipsparsescsrgeam_ (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgeam_typed (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgeam_rank_0 (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgeam_rank_0_devptr (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgeam_rank_1 (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgeam_rank_1_devptr (handle, m, n, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, beta, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| |
Sparse matrix sparse matrix addition using the CSR storage format.
hipsparseXcsrgeam multiplies the scalar \(\alpha\) with the sparse \(m \times n\) matrix \(A\), defined in CSR storage format, multiplies the scalar \(\beta\) with the sparse \(m \times n\) matrix \(B\), defined in CSR storage format, and adds both resulting matrices to obtain the sparse \(m \times n\) matrix \(C\), defined in CSR storage format, such that
\[
C := \alpha \cdot A + \beta \cdot B.
\]
This computation involves a multi-step process. First, the user must allocate csrRowPtrC to have size m+1. The user then calls hipsparseXcsrgeamNnz, which fills in the csrRowPtrC array and computes the total number of non-zeros in \(C\), nnzC. The user then allocates both arrays csrColIndC and csrValC to have size nnzC and calls hipsparseXcsrgeam to complete the computation. The desired index base in the output CSR matrix \(C\) is set in the hipsparseMatDescr_t descrC. See hipsparseSetMatIndexBase().
- Note
- Both scalars \(\alpha\) and \(beta\) have to be valid.
-
Currently, only
HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
-
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
- Deprecated:
- This function is deprecated and will be removed in a future release.
- Parameters
-
| [in] | handle | - handle to the hipSPARSE library context queue. |
| [in] | m | - number of rows of the sparse CSR matrices \(A\), \(B\), and \(C\). |
| [in] | n | - number of columns of the sparse CSR matrices \(A\), \(B\), and \(C\). |
| [in] | alpha | - scalar \(\alpha\). |
| [in] | descrA | - descriptor of the sparse CSR matrix \(A\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported. |
| [in] | nnzA | - number of non-zero entries of the sparse CSR matrix \(A\). |
| [in] | csrValA | - array of nnzA elements of the sparse CSR matrix \(A\). |
| [in] | csrRowPtrA | - array of m+1 elements that point to the start of every row of the sparse CSR matrix \(A\). |
| [in] | csrColIndA | - array of nnzA elements containing the column indices of the sparse CSR matrix \(A\). |
| [in] | beta | - scalar \(\beta\). |
| [in] | descrB | - descriptor of the sparse CSR matrix \(B\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported. |
| [in] | nnzB | - number of non-zero entries of the sparse CSR matrix \(B\). |
| [in] | csrValB | - array of nnzB elements of the sparse CSR matrix \(B\). |
| [in] | csrRowPtrB | - array of m+1 elements that point to the start of every row of the sparse CSR matrix \(B\). |
| [in] | csrColIndB | - array of nnzB elements containing the column indices of the sparse CSR matrix \(B\). |
| [in] | descrC | - descriptor of the sparse CSR matrix \(C\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported. |
| [out] | csrValC | - array of elements of the sparse CSR matrix \(C\). |
| [in] | csrRowPtrC | - array of m+1 elements that point to the start of every row of the sparse CSR matrix \(C\). |
| [out] | csrColIndC | - array of elements containing the column indices of the sparse CSR matrix \(C\). |
- Return values
-
| HIPSPARSE_STATUS_SUCCESS | the operation completed successfully. |
| HIPSPARSE_STATUS_INVALID_VALUE | handle, m, n, nnzA, nnzB, alpha, descrA, csrValA, csrRowPtrA, csrColIndA, beta, descrB, csrValB, csrRowPtrB, csrColIndB, descrC, csrValC, csrRowPtrC, or csrColIndC is invalid. |
| HIPSPARSE_STATUS_NOT_SUPPORTED | hipsparseMatrixType_t != HIPSPARSE_MATRIX_TYPE_GENERAL. |