hipsparsesnnz_compress Interface Reference

hipsparsesnnz_compress Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsesnnz_compress Interface Reference
hipfort_hipsparse::hipsparsesnnz_compress Interface Reference

This function is used as the first step in converting a CSR matrix to a compressed CSR matrix. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsesnnz_compress_ (handle, m, descra, csrvala, csrrowptra, nnzperrow, nnzc, tol)
 
integer(kind(hipsparse_status_success)) function hipsparsesnnz_compress_rank_0 (handle, m, descra, csrvala, csrrowptra, nnzperrow, nnzc, tol)
 
integer(kind(hipsparse_status_success)) function hipsparsesnnz_compress_rank_1 (handle, m, descra, csrvala, csrrowptra, nnzperrow, nnzc, tol)
 

Detailed Description

This function is used as the first step in converting a CSR matrix to a compressed CSR matrix.

Given a sparse CSR matrix and a non-negative tolerance, this function computes how many entries would be left in each row of the matrix if elements less than the tolerance were removed. It also computes the total number of remaining elements in the matrix.

Given an input sparse matrix \(A\) in CSR format, the resulting compressed sparse CSR matrix \(C\) is computed using:

\[ C(i,j) = A(i, j) \text{ if |A(i, j)| > tol} \]

The user first allocates nnzPerRow with size m elements, then calls hipsparseXnnz_compress. The function fills in the nnzPerRow array and sets the total number of non-zeros found in nnzC.

See hipsparseScsr2csr_compress() for a full code example.

Note
In the case of complex matrices, only the magnitude of the real part of tol is used.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]m- number of rows of the sparse CSR matrix.
[in]descrA- the descriptor of the sparse CSR matrix.
[in]csrValA- array of nnzA elements of the sparse CSR matrix.
[in]csrRowPtrA- array of m+1 elements that point to the start of every row of the uncompressed sparse CSR matrix.
[out]nnzPerRow- array of length m containing the number of entries that will be kept per row in the final compressed CSR matrix.
[out]nnzC- number of elements in the column indices and values arrays of the compressed sparse CSR matrix. Can be either host or device pointer.
[in]tol- the non-negative tolerance used for compression. If tol is complex, then only the magnitude of the real part is used. Entries in the input uncompressed CSR array that are below the tolerance are removed in output compressed CSR matrix.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, m, n, tol, csrValA, csrRowPtrA, nnzPerRow, or nnzC pointer is invalid.

Member Function/Subroutine Documentation

◆ hipsparsesnnz_compress_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz_compress::hipsparsesnnz_compress_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
type(c_ptr), value  descra,
type(c_ptr), value  csrvala,
type(c_ptr), value  csrrowptra,
type(c_ptr), value  nnzperrow,
type(c_ptr), value  nnzc,
real(c_float), value  tol 
)

◆ hipsparsesnnz_compress_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz_compress::hipsparsesnnz_compress_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
type(c_ptr)  descra,
real(c_float), target  csrvala,
integer(c_int), target  csrrowptra,
integer(c_int), target  nnzperrow,
integer(c_int), target  nnzc,
real(c_float)  tol 
)

◆ hipsparsesnnz_compress_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesnnz_compress::hipsparsesnnz_compress_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
type(c_ptr)  descra,
real(c_float), dimension(:), target  csrvala,
integer(c_int), dimension(:), target  csrrowptra,
integer(c_int), dimension(:), target  nnzperrow,
integer(c_int), dimension(:), target  nnzc,
real(c_float)  tol 
)

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