rocsparse_sbsrgeam Interface Reference

rocsparse_sbsrgeam Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_sbsrgeam Interface Reference
hipfort_rocsparse::rocsparse_sbsrgeam Interface Reference

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

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_sbsrgeam_ (handle, dir, mb, nb, block_dim, alpha, descr_a, nnzb_a, bsr_val_a, bsr_row_ptr_a, bsr_col_ind_a, beta, descr_b, nnzb_b, bsr_val_b, bsr_row_ptr_b, bsr_col_ind_b, descr_c, bsr_val_c, bsr_row_ptr_c, bsr_col_ind_c)
 

Detailed Description

Sparse matrix sparse matrix addition using the BSR storage format.

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

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

It is assumed that bsr_row_ptr_C has already been filled and that bsr_val_C and bsr_col_ind_C are allocated by the user. bsr_row_ptr_C and the allocation size of bsr_col_ind_C and bsr_val_C is defined by the number of non-zero block elements of the sparse BSR matrix C. Both can be obtained by rocsparse_bsrgeam_nnzb().

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]dir- direction that specifies whether to count non-zero elements by rocsparse_direction_row or by rocsparse_direction_column in the BSR matrices \(A\), \(B\), and \(C\).
[in]mb- number of rows of the sparse BSR matrix \(A\), \(B\), and \(C\).
[in]nb- number of columns of the sparse BSR matrix \(A\), \(B\), and \(C\).
[in]block_dim- the block dimension of the BSR matrix \(A\). Between 1 and m where m=mb*block_dim.
[in]alpha- scalar \(\alpha\).
[in]descr_A- descriptor of the sparse CSR matrix \(A\). Currently, only rocsparse_matrix_type_general is supported.
[in]nnzb_A- number of non-zero block entries of the sparse BSR matrix \(A\).
[in]bsr_val_A- array of nnzb_A block elements of the sparse BSR matrix \(A\).
[in]bsr_row_ptr_A- array of mb+1 block elements that point to the start of every block row of the sparse BSR matrix \(A\).
[in]bsr_col_ind_A- array of nnzb_A block elements containing the block column indices of the sparse BSR matrix \(A\).
[in]beta- scalar \(\beta\).
[in]descr_B- descriptor of the sparse BSR matrix \(B\). Currently, only rocsparse_matrix_type_general is supported.
[in]nnzb_B- number of non-zero block entries of the sparse BSR matrix \(B\).
[in]bsr_val_B- array of nnzb_B block elements of the sparse BSR matrix \(B\).
[in]bsr_row_ptr_B- array of mb+1 block elements that point to the start of every block row of the sparse BSR matrix \(B\).
[in]bsr_col_ind_B- array of nnzb_B block elements containing the block column indices of the sparse BSR matrix \(B\).
[in]descr_C- descriptor of the sparse BSR matrix \(C\). Currently, only rocsparse_matrix_type_general is supported.
[out]bsr_val_C- array of block elements of the sparse BSR matrix \(C\).
[in]bsr_row_ptr_C- array of mb+1 block elements that point to the start of every block row of the sparse BSR matrix \(C\).
[out]bsr_col_ind_C- array of block elements containing the block column indices of the sparse BSR matrix \(C\).
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizemb, nb, nnzb_A, or nnzb_B is invalid.
rocsparse_status_invalid_pointeralpha, descr_A, bsr_val_A, bsr_row_ptr_A, bsr_col_ind_A, beta, descr_B, bsr_val_B, bsr_row_ptr_B, bsr_col_ind_B, descr_C, csr_val_C, bsr_row_ptr_C, or bsr_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_sbsrgeam_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sbsrgeam::rocsparse_sbsrgeam_ ( type(c_ptr), value  handle,
integer(kind(rocsparse_direction_row)), value  dir,
integer(c_int), value  mb,
integer(c_int), value  nb,
integer(c_int), value  block_dim,
real(c_float)  alpha,
type(c_ptr), value  descr_a,
integer(c_int), value  nnzb_a,
type(c_ptr), value  bsr_val_a,
type(c_ptr), value  bsr_row_ptr_a,
type(c_ptr), value  bsr_col_ind_a,
real(c_float)  beta,
type(c_ptr), value  descr_b,
integer(c_int), value  nnzb_b,
type(c_ptr), value  bsr_val_b,
type(c_ptr), value  bsr_row_ptr_b,
type(c_ptr), value  bsr_col_ind_b,
type(c_ptr), value  descr_c,
type(c_ptr), value  bsr_val_c,
type(c_ptr), value  bsr_row_ptr_c,
type(c_ptr), value  bsr_col_ind_c 
)

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