rocsparse_scsrgeam Interface Reference

rocsparse_scsrgeam Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_scsrgeam Interface Reference
hipfort_rocsparse::rocsparse_scsrgeam Interface Reference

Sparse matrix sparse matrix addition using the CSR storage format. More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_scsrgeam_ (handle, m, n, alpha, descr_a, nnz_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, beta, descr_b, nnz_b, csr_val_b, csr_row_ptr_b, csr_col_ind_b, descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsrgeam_rank_0 (handle, m, n, alpha, descr_a, nnz_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, beta, descr_b, nnz_b, csr_val_b, csr_row_ptr_b, csr_col_ind_b, descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsrgeam_rank_1 (handle, m, n, alpha, descr_a, nnz_a, csr_val_a, csr_row_ptr_a, csr_col_ind_a, beta, descr_b, nnz_b, csr_val_b, csr_row_ptr_b, csr_col_ind_b, descr_c, csr_val_c, csr_row_ptr_c, csr_col_ind_c)
 

Detailed Description

Sparse matrix sparse matrix addition using the CSR storage format.

rocsparse_csrgeam multiplies the scalar \(\alpha\) with the sparse \(m \times n\) matrix \(A\), defined in CSR storage format, multiplies the scalar \(\beta\) with the sparse \(m \times n\) matrix \(B\), defined in CSR storage format, and adds both resulting matrices to obtain the sparse \(m \times n\) matrix \(C\), defined in CSR storage format, such that

\[ C := \alpha \cdot A + \beta \cdot B. \]

It is assumed that csr_row_ptr_C has already been filled and that csr_val_C and csr_col_ind_C are allocated by the user. csr_row_ptr_C and the allocation size of csr_col_ind_C and csr_val_C is defined by the number of non-zero elements of the sparse CSR matrix C. Both can be obtained by rocsparse_csrgeam_nnz().

Note
Both scalars \(\alpha\) and \(beta\) have to be valid.
Currently, only rocsparse_matrix_type_general is supported.
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 \(A\), \(B\), and \(C\).
[in]n- number of columns of the sparse CSR matrix \(A\), \(B\), and \(C\).
[in]alpha- scalar \(\alpha\).
[in]descr_A- descriptor of the sparse CSR matrix \(A\). Currently, only rocsparse_matrix_type_general is supported.
[in]nnz_A- number of non-zero entries of the sparse CSR matrix \(A\).
[in]csr_val_A- array of nnz_A elements of the sparse CSR matrix \(A\).
[in]csr_row_ptr_A- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(A\).
[in]csr_col_ind_A- array of nnz_A elements containing the column indices of the sparse CSR matrix \(A\).
[in]beta- scalar \(\beta\).
[in]descr_B- descriptor of the sparse CSR matrix \(B\). Currently, only rocsparse_matrix_type_general is supported.
[in]nnz_B- number of non-zero entries of the sparse CSR matrix \(B\).
[in]csr_val_B- array of nnz_B elements of the sparse CSR matrix \(B\).
[in]csr_row_ptr_B- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(B\).
[in]csr_col_ind_B- array of nnz_B elements containing the column indices of the sparse CSR matrix \(B\).
[in]descr_C- descriptor of the sparse CSR matrix \(C\). Currently, only rocsparse_matrix_type_general is supported.
[out]csr_val_C- array of elements of the sparse CSR matrix \(C\).
[in]csr_row_ptr_C- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(C\).
[out]csr_col_ind_C- array of elements containing the column indices of the sparse CSR matrix \(C\).
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizem, n, nnz_A, or nnz_B is invalid.
rocsparse_status_invalid_pointeralpha, descr_A, csr_val_A, csr_row_ptr_A, csr_col_ind_A, beta, descr_B, csr_val_B, csr_row_ptr_B, csr_col_ind_B, descr_C, csr_val_C, csr_row_ptr_C, or csr_col_ind_C is invalid.
rocsparse_status_not_implementedrocsparse_matrix_type != rocsparse_matrix_type_general.
Example
This example adds two CSR matrices.

Member Function/Subroutine Documentation

◆ rocsparse_scsrgeam_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrgeam::rocsparse_scsrgeam_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
real(c_float)  alpha,
type(c_ptr), value  descr_a,
integer(c_int), value  nnz_a,
type(c_ptr), value  csr_val_a,
type(c_ptr), value  csr_row_ptr_a,
type(c_ptr), value  csr_col_ind_a,
real(c_float)  beta,
type(c_ptr), value  descr_b,
integer(c_int), value  nnz_b,
type(c_ptr), value  csr_val_b,
type(c_ptr), value  csr_row_ptr_b,
type(c_ptr), value  csr_col_ind_b,
type(c_ptr), value  descr_c,
type(c_ptr), value  csr_val_c,
type(c_ptr), value  csr_row_ptr_c,
type(c_ptr), value  csr_col_ind_c 
)

◆ rocsparse_scsrgeam_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrgeam::rocsparse_scsrgeam_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descr_a,
integer(c_int)  nnz_a,
real(c_float), target  csr_val_a,
integer(c_int), target  csr_row_ptr_a,
integer(c_int), target  csr_col_ind_a,
real(c_float)  beta,
type(c_ptr)  descr_b,
integer(c_int)  nnz_b,
real(c_float), target  csr_val_b,
integer(c_int), target  csr_row_ptr_b,
integer(c_int), target  csr_col_ind_b,
type(c_ptr)  descr_c,
real(c_float), target  csr_val_c,
integer(c_int), target  csr_row_ptr_c,
integer(c_int), target  csr_col_ind_c 
)

◆ rocsparse_scsrgeam_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrgeam::rocsparse_scsrgeam_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descr_a,
integer(c_int)  nnz_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,
real(c_float)  beta,
type(c_ptr)  descr_b,
integer(c_int)  nnz_b,
real(c_float), dimension(:), target  csr_val_b,
integer(c_int), dimension(:), target  csr_row_ptr_b,
integer(c_int), dimension(:), target  csr_col_ind_b,
type(c_ptr)  descr_c,
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 
)

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