rocsparse_scoomv Interface Reference

rocsparse_scoomv Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_scoomv Interface Reference
hipfort_rocsparse::rocsparse_scoomv Interface Reference

Sparse matrix vector multiplication using the COO storage format. More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_scoomv_ (handle, trans, m, n, nnz, alpha, descr, coo_val, coo_row_ind, coo_col_ind, x, beta, y)
 
integer(kind(rocsparse_status_success)) function rocsparse_scoomv_rank_0 (handle, trans, m, n, nnz, alpha, descr, coo_val, coo_row_ind, coo_col_ind, x, beta, y)
 
integer(kind(rocsparse_status_success)) function rocsparse_scoomv_rank_1 (handle, trans, m, n, nnz, alpha, descr, coo_val, coo_row_ind, coo_col_ind, x, beta, y)
 

Detailed Description

Sparse matrix vector multiplication using the COO storage format.

rocsparse_coomv multiplies the scalar \(\alpha\) with a sparse \(m \times n\) matrix, defined in COO storage format, and the dense vector \(x\) and adds the result to the dense vector \(y\) that is multiplied by the scalar \(\beta\), such that

\[ y := \alpha \cdot op(A) \cdot x + \beta \cdot y, \]

with

\[ op(A) = \left\{ \begin{array}{ll} A, & \text{if trans == rocsparse_operation_none} \\% A^T, & \text{if trans == rocsparse_operation_transpose} \\% A^H, & \text{if trans == rocsparse_operation_conjugate_transpose} \end{array} \right. \]

The COO matrix has to be sorted by row indices. This can be achieved by using rocsparse_coosort_by_row().

for(i = 0; i < m; ++i)
{
y[i] = beta * y[i];
}
for(i = 0; i < nnz; ++i)
{
y[coo_row_ind[i]] += alpha * coo_val[i] * x[coo_col_ind[i]];
}
Note
This function does not produce deterministic results when A is transposed.
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
This routine supports execution in a hipGraph context.
Parameters
[in]handle- handle to the rocSPARSE library context queue.
[in]trans- matrix operation type.
[in]m- number of rows of the sparse COO matrix.
[in]n- number of columns of the sparse COO matrix.
[in]nnz- number of non-zero entries of the sparse COO matrix.
[in]alpha- scalar \(\alpha\).
[in]descr- descriptor of the sparse COO matrix. Currently, only rocsparse_matrix_type_general is supported.
[in]coo_val- array of nnz elements of the sparse COO matrix.
[in]coo_row_ind- array of nnz elements containing the row indices of the sparse COO matrix.
[in]coo_col_ind- array of nnz elements containing the column indices of the sparse COO matrix.
[in]x- array of n elements ( \(op(A) = A\)) or m elements ( \(op(A) = A^T\) or \(op(A) = A^H\)).
[in]beta- scalar \(\beta\).
[in,out]y- array of m elements ( \(op(A) = A\)) or n elements ( \(op(A) = A^T\) or \(op(A) = A^H\)).
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizem, n, or nnz is invalid.
rocsparse_status_invalid_pointerdescr, alpha, coo_val, coo_row_ind, coo_col_ind, x, beta, or y pointer is invalid.
rocsparse_status_arch_mismatchthe device is not supported.
rocsparse_status_not_implementedrocsparse_matrix_type != rocsparse_matrix_type_general.
Example
This example performs a sparse matrix vector multiplication in COO format.

Member Function/Subroutine Documentation

◆ rocsparse_scoomv_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scoomv::rocsparse_scoomv_ ( type(c_ptr), value  handle,
integer(kind(rocsparse_operation_none)), value  trans,
integer(c_int), value  m,
integer(c_int), value  n,
integer(c_int), value  nnz,
real(c_float)  alpha,
type(c_ptr), value  descr,
type(c_ptr), value  coo_val,
type(c_ptr), value  coo_row_ind,
type(c_ptr), value  coo_col_ind,
type(c_ptr), value  x,
real(c_float)  beta,
type(c_ptr), value  y 
)

◆ rocsparse_scoomv_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scoomv::rocsparse_scoomv_rank_0 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), target  coo_val,
integer(c_int), target  coo_row_ind,
integer(c_int), target  coo_col_ind,
real(c_float), target  x,
real(c_float)  beta,
real(c_float), target  y 
)

◆ rocsparse_scoomv_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scoomv::rocsparse_scoomv_rank_1 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), dimension(:), target  coo_val,
integer(c_int), dimension(:), target  coo_row_ind,
integer(c_int), dimension(:), target  coo_col_ind,
real(c_float), dimension(:), target  x,
real(c_float)  beta,
real(c_float), dimension(:), target  y 
)

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