hipsparsesdense2csc Interface Reference

hipsparsesdense2csc Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsesdense2csc Interface Reference
hipfort_hipsparse::hipsparsesdense2csc Interface Reference

hipsparseXdense2csc functions convert the matrix A in dense format into a sparse matrix in CSC format. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsesdense2csc_ (handle, m, n, descr, a, ld, nnzpercolumn, cscval, cscrowind, csccolptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesdense2csc_rank_0 (handle, m, n, descr, a, ld, nnzpercolumn, cscval, cscrowind, csccolptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesdense2csc_rank_1 (handle, m, n, descr, a, ld, nnzpercolumn, cscval, cscrowind, csccolptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesdense2csc_full_rank (handle, m, n, descr, a, ld, nnzpercolumn, cscval, cscrowind, csccolptr)
 

Detailed Description

hipsparseXdense2csc functions convert the matrix A in dense format into a sparse matrix in CSC format.

Given a dense, column-ordered, matrix A with leading dimension ld, where ld>=m, hipsparseXdense2csc converts the matrix to a sparse CSC format matrix. All the parameters are assumed to have been preallocated by the user and the arrays are filled in based on number of non-zeros per row, which can be pre-computed with hipsparseSnnz "hipsparseXnnz()". Users can set the desired index base in the output CSC matrix by setting it in the hipsparseMatDescr_t. See hipsparseSetMatIndexBase().

As an example, if using index base zero (that is, the default) and the dense matrix:

\[ \begin{bmatrix} 1 & 0 & 0 & 2 \\% 3 & 4 & 0 & 0 \\% 5 & 0 & 6 & 7 \end{bmatrix} \]

where the A values have column ordering with leading dimension ld=m:

\[ \text{A} &= \begin{bmatrix} 1 & 3 & 5 & 0 & 4 & 0 & 0 & 0 & 6 & 2 & 0 & 7 \end{bmatrix} \\% \]

the conversion results in the CSC arrays:

\[ \begin{align} \text{cscRowInd} &= \begin{bmatrix} 0 & 1 & 2 & 1 & 2 & 0 & 2 \end{bmatrix} \\% \text{cscColPtr} &= \begin{bmatrix} 0 & 3 & 4 & 5 & 7 \end{bmatrix} \\% \text{cscVal} &= \begin{bmatrix} 1 & 3 & 5 & 4 & 6 & 2 & 7 \end{bmatrix} \\% \end{align} \]

This function works very similar to hipsparseSdense2csr "hipsparseXdense2csr()". See hipsparseSdense2csr() for a code example.

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.
Deprecated:
This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
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 is HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the hipsparseIndexBase_t.
[in]A- array of dimensions (ld, n).
[in]ld- leading dimension of dense array A. Must be at least m.
[in]nnzPerColumn- array of size n containing the number of non-zero elements per column.
[out]cscVal- array of nnz ( = cscColPtr[n] - cscColPtr[0] ) nonzero elements of matrix A.
[out]cscRowInd- integer array of nnz ( = cscColPtr[n] - cscColPtr[0] ) column indices of the non-zero elements of matrix A.
[out]cscColPtr- integer array of n+1 elements that contains the start of every column and the end of the last column plus one.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle is not initialized.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descr, A, nnzPerColumn, cscVal, cscColPtr, or cscRowInd is nullptr, m or n is negative, or ld is invalid.

Member Function/Subroutine Documentation

◆ hipsparsesdense2csc_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csc::hipsparsesdense2csc_ ( 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  nnzpercolumn,
type(c_ptr), value  cscval,
type(c_ptr), value  cscrowind,
type(c_ptr), value  csccolptr 
)

◆ hipsparsesdense2csc_full_rank()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csc::hipsparsesdense2csc_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  nnzpercolumn,
real(c_float), dimension(:), target  cscval,
integer(c_int), dimension(:), target  cscrowind,
integer(c_int), dimension(:), target  csccolptr 
)

◆ hipsparsesdense2csc_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csc::hipsparsesdense2csc_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  nnzpercolumn,
real(c_float), target  cscval,
integer(c_int), target  cscrowind,
integer(c_int), target  csccolptr 
)

◆ hipsparsesdense2csc_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesdense2csc::hipsparsesdense2csc_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  nnzpercolumn,
real(c_float), dimension(:), target  cscval,
integer(c_int), dimension(:), target  cscrowind,
integer(c_int), dimension(:), target  csccolptr 
)

The documentation for this interface was generated from the following file: