hipsparsesdense2csr Interface Reference#
hipsparseXdense2csr converts the matrix A in dense format into a sparse matrix in CSR format.
More...
Public Member Functions | |
| integer(kind(hipsparse_status_success)) function | hipsparsesdense2csr_ (handle, m, n, descr, a, ld, nnzperrow, csrval, csrrowptr, csrcolind) |
| integer(kind(hipsparse_status_success)) function | hipsparsesdense2csr_rank_0 (handle, m, n, descr, a, ld, nnzperrow, csrval, csrrowptr, csrcolind) |
| integer(kind(hipsparse_status_success)) function | hipsparsesdense2csr_rank_1 (handle, m, n, descr, a, ld, nnzperrow, csrval, csrrowptr, csrcolind) |
| integer(kind(hipsparse_status_success)) function | hipsparsesdense2csr_full_rank (handle, m, n, descr, a, ld, nnzperrow, csrval, csrrowptr, csrcolind) |
Detailed Description
hipsparseXdense2csr converts the matrix A in dense format into a sparse matrix in CSR format.
Given a dense, column-ordered matrix A with leading dimension ld where ld>=m, hipsparseXdense2csr converts the matrix to a sparse CSR format matrix. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on the number of non-zeros per row, which can be pre-computed with hipsparseSnnz "hipsparseXnnz()". The desired index base in the output CSR matrix is set in the hipsparseMatDescr_t. See hipsparseSetMatIndexBase().
As an example, if using index base zero (which is the default) and the dense matrix:
\[ \begin{bmatrix} 1 & 0 & 0 & 2 \\% 3 & 4 & 0 & 0 \\% 5 & 0 & 6 & 7 \end{bmatrix} \]
The conversion results in the CSR arrays:
\[ \begin{align} \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 4 & 7 \end{bmatrix} \\% \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 0 & 1 & 0 & 2 & 3 \end{bmatrix} \\% \text{csrVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \end{bmatrix} \\% \end{align} \]
- Note
- This function is executed asynchronously with respect to the host and can return control to the application on the host before the entire result is ready.
- Parameters
-
[in] handle - handle to the hipSPARSE library context queue. [in] m - number of rows of the dense matrix A. Must be non-negative.[in] n - number of columns of the dense matrix A. Must be non-negative.[in] descr - the descriptor of the dense matrix A. The supported matrix type isHIPSPARSE_MATRIX_TYPE_GENERALand any valid value of thehipsparseIndexBase_t.[in] A - array of dimensions ( ld,n).[in] ld - leading dimension of dense array A, which must be at leastm.[in] nnzPerRow - array of size mcontaining the number of non-zero elements per row.[out] csrVal - array of nnz ( = csrRowPtr[m] -csrRowPtr[0] ) non-zero elements of matrixA.[out] csrRowPtr - integer array of m+1elements that contains the start of every row and the end of the last row plus one.[out] csrColInd - integer array of nnz ( = csrRowPtr[m] -csrRowPtr[0] ) column indices of the non-zero elements of matrixA.
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_NOT_INITIALIZED handleis not initialized.HIPSPARSE_STATUS_INVALID_VALUE handle,descr,A,nnzPerRow,csrVal,csrRowPtr, orcsrColIndis nullptr,mornis negative, orldis invalid.
Member Function/Subroutine Documentation
◆ hipsparsesdense2csr_()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csr::hipsparsesdense2csr_ | ( | type(c_ptr), value | handle, |
| integer(c_int), value | m, | ||
| integer(c_int), value | n, | ||
| type(c_ptr), value | descr, | ||
| type(c_ptr), value | a, | ||
| integer(c_int), value | ld, | ||
| type(c_ptr), value | nnzperrow, | ||
| type(c_ptr), value | csrval, | ||
| type(c_ptr), value | csrrowptr, | ||
| type(c_ptr), value | csrcolind | ||
| ) |
◆ hipsparsesdense2csr_full_rank()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csr::hipsparsesdense2csr_full_rank | ( | type(c_ptr) | handle, |
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| type(c_ptr) | descr, | ||
| real(c_float), dimension(:,:), target | a, | ||
| integer(c_int) | ld, | ||
| integer(c_int), dimension(:), target | nnzperrow, | ||
| real(c_float), dimension(:), target | csrval, | ||
| integer(c_int), dimension(:), target | csrrowptr, | ||
| integer(c_int), dimension(:), target | csrcolind | ||
| ) |
◆ hipsparsesdense2csr_rank_0()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csr::hipsparsesdense2csr_rank_0 | ( | type(c_ptr) | handle, |
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| type(c_ptr) | descr, | ||
| real(c_float), target | a, | ||
| integer(c_int) | ld, | ||
| integer(c_int), target | nnzperrow, | ||
| real(c_float), target | csrval, | ||
| integer(c_int), target | csrrowptr, | ||
| integer(c_int), target | csrcolind | ||
| ) |
◆ hipsparsesdense2csr_rank_1()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csr::hipsparsesdense2csr_rank_1 | ( | type(c_ptr) | handle, |
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| type(c_ptr) | descr, | ||
| real(c_float), dimension(:), target | a, | ||
| integer(c_int) | ld, | ||
| integer(c_int), dimension(:), target | nnzperrow, | ||
| real(c_float), dimension(:), target | csrval, | ||
| integer(c_int), dimension(:), target | csrrowptr, | ||
| integer(c_int), dimension(:), target | csrcolind | ||
| ) |
The documentation for this interface was generated from the following file: