rocsparse_sprune_dense2csr Interface Reference

rocsparse_sprune_dense2csr Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_sprune_dense2csr Interface Reference
hipfort_rocsparse::rocsparse_sprune_dense2csr Interface Reference

Convert and prune dense matrix \(A\) into a sparse CSR matrix \(C\). More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_sprune_dense2csr_ (handle, m, n, a, lda, threshold, descr, csr_val, csr_row_ptr, csr_col_ind, temp_buffer)
 
integer(kind(rocsparse_status_success)) function rocsparse_sprune_dense2csr_rank_0 (handle, m, n, a, lda, threshold, descr, csr_val, csr_row_ptr, csr_col_ind, temp_buffer)
 
integer(kind(rocsparse_status_success)) function rocsparse_sprune_dense2csr_rank_1 (handle, m, n, a, lda, threshold, descr, csr_val, csr_row_ptr, csr_col_ind, temp_buffer)
 
integer(kind(rocsparse_status_success)) function rocsparse_sprune_dense2csr_full_rank (handle, m, n, a, lda, threshold, descr, csr_val, csr_row_ptr, csr_col_ind, temp_buffer)
 

Detailed Description

Convert and prune dense matrix \(A\) into a sparse CSR matrix \(C\).

This function converts the dense matrix \(A\) into a sparse CSR matrix \(C\) by pruning values in \(A\) that are less than a threshold.

The conversion involves three steps. First, call rocsparse_Xprune_dense2csr_buffer_size() to determine the size of the temporary storage buffer. Allocate this buffer as well as the array csr_row_ptr to have m+1 elements. Then call rocsparse_Xprune_dense2csr_nnz(), which fills in the csr_row_ptr array and stores the number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. Now that the number of non-zeros larger than the pruning threshold is known, use this information to allocate the csr_col_ind and csr_val arrays and then call rocsparse_prune_dense2csr to complete the conversion. After the conversion is complete, the temporary storage buffer can be freed.

Note
This function is blocking with respect to the host.
This routine does not support execution in a hipGraph context.
Parameters
[in]handle- handle to the rocSPARSE library context queue.
[in]m- number of rows of the dense matrix A.
[in]n- number of columns of the dense matrix A.
[in]A- array of dimensions (lda, n).
[in]lda- leading dimension of dense array A.
[in]threshold- pointer to the non-negative pruning threshold, which can exist in either host or device memory.
[in]descr- the descriptor of the dense matrix A. The supported matrix type is rocsparse_matrix_type_general and also any valid value of the rocsparse_index_base.
[out]csr_val- array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) non-zero elements of matrix A.
[in]csr_row_ptr- integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
[out]csr_col_ind- integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
[in]temp_buffer- temporary storage buffer allocated by the user. The size is returned by rocsparse_Xprune_dense2csr_buffer_size().
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizem, n, or lda is invalid.
rocsparse_status_invalid_pointerA, descr, threshold, csr_val, csr_row_ptr, csr_col_ind, or temp_buffer pointer is invalid.
Example

Member Function/Subroutine Documentation

◆ rocsparse_sprune_dense2csr_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_dense2csr::rocsparse_sprune_dense2csr_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
type(c_ptr), value  a,
integer(c_int), value  lda,
real(c_float)  threshold,
type(c_ptr), value  descr,
type(c_ptr), value  csr_val,
type(c_ptr), value  csr_row_ptr,
type(c_ptr), value  csr_col_ind,
type(c_ptr), value  temp_buffer 
)

◆ rocsparse_sprune_dense2csr_full_rank()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_dense2csr::rocsparse_sprune_dense2csr_full_rank ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), dimension(:,:), target  a,
integer(c_int)  lda,
real(c_float)  threshold,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csr_val,
integer(c_int), dimension(:), target  csr_row_ptr,
integer(c_int), dimension(:), target  csr_col_ind,
type(c_ptr)  temp_buffer 
)

◆ rocsparse_sprune_dense2csr_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_dense2csr::rocsparse_sprune_dense2csr_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), target  a,
integer(c_int)  lda,
real(c_float)  threshold,
type(c_ptr)  descr,
real(c_float), target  csr_val,
integer(c_int), target  csr_row_ptr,
integer(c_int), target  csr_col_ind,
type(c_ptr)  temp_buffer 
)

◆ rocsparse_sprune_dense2csr_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sprune_dense2csr::rocsparse_sprune_dense2csr_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float), dimension(:), target  a,
integer(c_int)  lda,
real(c_float)  threshold,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csr_val,
integer(c_int), dimension(:), target  csr_row_ptr,
integer(c_int), dimension(:), target  csr_col_ind,
type(c_ptr)  temp_buffer 
)

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