rocsparse_scsr2csr_compress Interface Reference

rocsparse_scsr2csr_compress Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_scsr2csr_compress Interface Reference
hipfort_rocsparse::rocsparse_scsr2csr_compress Interface Reference

Convert a sparse CSR matrix into a compressed sparse CSR matrix. More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_scsr2csr_compress_ (handle, m, n, descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, nnz_a, nnz_per_row, csr_val_c, csr_row_ptr_c, csr_col_ind_c, tol)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsr2csr_compress_rank_0 (handle, m, n, descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, nnz_a, nnz_per_row, csr_val_c, csr_row_ptr_c, csr_col_ind_c, tol)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsr2csr_compress_rank_1 (handle, m, n, descr_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, nnz_a, nnz_per_row, csr_val_c, csr_row_ptr_c, csr_col_ind_c, tol)
 

Detailed Description

Convert a sparse CSR matrix into a compressed sparse CSR matrix.

rocsparse_csr2csr_compress converts a CSR matrix into a compressed CSR matrix by removing entries in the input CSR matrix that are below a non-negative threshold tol.

Compressing a CSR matrix involves two steps. First, use rocsparse_Xnnz_compress() to determine how many entries will be in the final compressed CSR matrix. Then call rocsparse_csr2csr_compress to finish the compression and fill in the column indices and values arrays of the compressed CSR matrix.

Note
In the case of complex matrices, only the magnitude of the real part of tol is used.
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 sparse CSR matrix.
[in]n- number of columns of the sparse CSR matrix.
[in]descr_A- matrix descriptor for the CSR matrix.
[in]csr_val_A- array of nnz_A elements of the sparse CSR matrix.
[in]csr_row_ptr_A- array of m+1 elements that point to the start of every row of the uncompressed sparse CSR matrix.
[in]csr_col_ind_A- array of nnz_A elements containing the column indices of the uncompressed sparse CSR matrix.
[in]nnz_A- number of elements in the column indices and values arrays of the uncompressed sparse CSR matrix.
[in]nnz_per_row- array of length m containing the number of entries that will be kept per row in the final compressed CSR matrix.
[out]csr_val_C- array of nnz_C elements of the compressed sparse CSC matrix.
[out]csr_row_ptr_C- array of m+1 elements that point to the start of every column of the compressed sparse CSR matrix.
[out]csr_col_ind_C- array of nnz_C elements containing the row indices of the compressed sparse CSR matrix.
[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 the output-compressed CSR matrix.
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizem, n, or nnz_A is invalid.
rocsparse_status_invalid_valuetol is invalid.
rocsparse_status_invalid_pointercsr_val_A, csr_row_ptr_A, csr_col_ind_A, csr_val_C, csr_row_ptr_C, csr_col_ind_C, or nnz_per_row pointer is invalid.
Example
This example demonstrates how to compress a CSR matrix.

Member Function/Subroutine Documentation

◆ rocsparse_scsr2csr_compress_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsr2csr_compress::rocsparse_scsr2csr_compress_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
type(c_ptr), value  descr_a,
type(c_ptr), value  csr_val_a,
type(c_ptr), value  csr_row_ptr_a,
type(c_ptr), value  csr_col_ind_a,
integer(c_int), value  nnz_a,
type(c_ptr), value  nnz_per_row,
type(c_ptr), value  csr_val_c,
type(c_ptr), value  csr_row_ptr_c,
type(c_ptr), value  csr_col_ind_c,
real(c_float), value  tol 
)

◆ rocsparse_scsr2csr_compress_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsr2csr_compress::rocsparse_scsr2csr_compress_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  descr_a,
real(c_float), target  csr_val_a,
integer(c_int), target  csr_row_ptr_a,
integer(c_int), target  csr_col_ind_a,
integer(c_int)  nnz_a,
integer(c_int), target  nnz_per_row,
real(c_float), target  csr_val_c,
integer(c_int), target  csr_row_ptr_c,
integer(c_int), target  csr_col_ind_c,
real(c_float)  tol 
)

◆ rocsparse_scsr2csr_compress_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsr2csr_compress::rocsparse_scsr2csr_compress_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
type(c_ptr)  descr_a,
real(c_float), dimension(:), target  csr_val_a,
integer(c_int), dimension(:), target  csr_row_ptr_a,
integer(c_int), dimension(:), target  csr_col_ind_a,
integer(c_int)  nnz_a,
integer(c_int), dimension(:), target  nnz_per_row,
real(c_float), dimension(:), target  csr_val_c,
integer(c_int), dimension(:), target  csr_row_ptr_c,
integer(c_int), dimension(:), target  csr_col_ind_c,
real(c_float)  tol 
)

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