hipsparsesnnz Interface Reference

hipsparsesnnz Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsesnnz Interface Reference
hipfort_hipsparse::hipsparsesnnz Interface Reference

hipsparseXnnz computes the number of non-zero elements per row or column and the total number of non-zero elements in a dense matrix. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsesnnz_ (handle, dira, m, n, descra, a, lda, nnzperrowcolumn, nnztotaldevhostptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesnnz_rank_0 (handle, dira, m, n, descra, a, lda, nnzperrowcolumn, nnztotaldevhostptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesnnz_rank_1 (handle, dira, m, n, descra, a, lda, nnzperrowcolumn, nnztotaldevhostptr)
 
integer(kind(hipsparse_status_success)) function hipsparsesnnz_full_rank (handle, dira, m, n, descra, a, lda, nnzperrowcolumn, nnztotaldevhostptr)
 

Detailed Description

hipsparseXnnz computes the number of non-zero elements per row or column and the total number of non-zero elements in a dense matrix.

For example, given the dense matrix:

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

using dirA == HIPSPARSE_DIRECTION_ROW results in:

\[ \begin{align} \text{nnzPerRowColumn} &= \begin{bmatrix} 2 & 2 & 3 \end{bmatrix} \\% \text{nnzTotalDevHostPtr} &= 7 \end{align} \]

while using dirA == HIPSPARSE_DIRECTION_COLUMN results in:

\[ \begin{align} \text{nnzPerRowColumn} &= \begin{bmatrix} 3 & 1 & 1 & 2 \end{bmatrix} \\% \text{nnzTotalDevHostPtr} &= 7 \end{align} \]

The array nnzPerRowColumn must be allocated by the user before calling hipsparseXnnz and has length equal to m if dirA == HIPSPARSE_DIRECTION_ROW or n if dirA == HIPSPARSE_DIRECTION_COLUMN.

For a complete code example showing its usage, see the example found with hipsparseSdense2csr().

Note
As indicated, nnzTotalDevHostPtr can point either to host or device memory. This is controlled by setting the pointer mode. See hipsparseSetPointerMode().
The routine supports asynchronous execution if the pointer mode is set to device.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]dirA- direction that specifies whether to count non-zero elements by HIPSPARSE_DIRECTION_ROW or by HIPSPARSE_DIRECTION_COLUMN.
[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]descrA- the descriptor of the dense matrix A.
[in]A- array of dimensions (lda, n).
[in]lda- leading dimension of dense array A. Must be at least m.
[out]nnzPerRowColumn- array of size m or n containing the number of non-zero elements per row or column, respectively.
[out]nnzTotalDevHostPtr- total number of non-zero elements in device or host memory.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle is not initialized.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descrA, A, nnzPerRowColumn, or nnzTotalDevHostPtr is nullptr, m or n is negative, or lda is invalid.

Member Function/Subroutine Documentation

◆ hipsparsesnnz_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz::hipsparsesnnz_ ( type(c_ptr), value  handle,
integer(kind(hipsparse_direction_row)), value  dira,
integer(c_int), value  m,
integer(c_int), value  n,
type(c_ptr), value  descra,
type(c_ptr), value  a,
integer(c_int), value  lda,
type(c_ptr), value  nnzperrowcolumn,
integer(c_int)  nnztotaldevhostptr 
)

◆ hipsparsesnnz_full_rank()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz::hipsparsesnnz_full_rank ( type(c_ptr)  handle,
integer(kind(hipsparse_direction_row))  dira,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  descra,
real(c_float), dimension(:,:), target  a,
integer(c_int)  lda,
integer(c_int), dimension(:), target  nnzperrowcolumn,
integer(c_int)  nnztotaldevhostptr 
)

◆ hipsparsesnnz_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz::hipsparsesnnz_rank_0 ( type(c_ptr)  handle,
integer(kind(hipsparse_direction_row))  dira,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  descra,
real(c_float), target  a,
integer(c_int)  lda,
integer(c_int), target  nnzperrowcolumn,
integer(c_int)  nnztotaldevhostptr 
)

◆ hipsparsesnnz_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz::hipsparsesnnz_rank_1 ( type(c_ptr)  handle,
integer(kind(hipsparse_direction_row))  dira,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  descra,
real(c_float), dimension(:), target  a,
integer(c_int)  lda,
integer(c_int), dimension(:), target  nnzperrowcolumn,
integer(c_int)  nnztotaldevhostptr 
)

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