rocsparse_sellmv Interface Reference

rocsparse_sellmv Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_sellmv Interface Reference
hipfort_rocsparse::rocsparse_sellmv Interface Reference

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

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_sellmv_ (handle, trans, m, n, alpha, descr, ell_val, ell_col_ind, ell_width, x, beta, y)
 
integer(kind(rocsparse_status_success)) function rocsparse_sellmv_rank_0 (handle, trans, m, n, alpha, descr, ell_val, ell_col_ind, ell_width, x, beta, y)
 
integer(kind(rocsparse_status_success)) function rocsparse_sellmv_rank_1 (handle, trans, m, n, alpha, descr, ell_val, ell_col_ind, ell_width, x, beta, y)
 

Detailed Description

Sparse matrix vector multiplication using the ELL storage format.

rocsparse_ellmv multiplies the scalar \(\alpha\) with a sparse \(m \times n\) matrix, defined in ELL 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. \]

for(i = 0; i < m; ++i)
{
y[i] = beta * y[i];
for(p = 0; p < ell_width; ++p)
{
idx = p * m + i;
if((ell_col_ind[idx] >= 0) && (ell_col_ind[idx] < n))
{
y[i] = y[i] + alpha * ell_val[idx] * x[ell_col_ind[idx]];
}
}
}
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 ELL matrix.
[in]n- number of columns of the sparse ELL matrix.
[in]alpha- scalar \(\alpha\).
[in]descr- descriptor of the sparse ELL matrix. Currently, only rocsparse_matrix_type_general is supported.
[in]ell_val- array that contains the elements of the sparse ELL matrix. Padded elements should be zero.
[in]ell_col_ind- array that contains the column indices of the sparse ELL matrix. Padded column indices should be -1.
[in]ell_width- number of non-zero elements per row of the sparse ELL 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 ell_width is invalid.
rocsparse_status_invalid_pointerdescr, alpha, ell_val, ell_col_ind, x, beta, or y pointer is invalid.
rocsparse_status_not_implementedrocsparse_matrix_type != rocsparse_matrix_type_general.
Example
This example performs a sparse matrix vector multiplication in ELL format. It also shows how to convert from CSR to ELL format.

Member Function/Subroutine Documentation

◆ rocsparse_sellmv_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sellmv::rocsparse_sellmv_ ( type(c_ptr), value  handle,
integer(kind(rocsparse_operation_none)), value  trans,
integer(c_int), value  m,
integer(c_int), value  n,
real(c_float)  alpha,
type(c_ptr), value  descr,
type(c_ptr), value  ell_val,
type(c_ptr), value  ell_col_ind,
integer(c_int), value  ell_width,
type(c_ptr), value  x,
real(c_float)  beta,
type(c_ptr), value  y 
)

◆ rocsparse_sellmv_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sellmv::rocsparse_sellmv_rank_0 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), target  ell_val,
integer(c_int), target  ell_col_ind,
integer(c_int)  ell_width,
real(c_float), target  x,
real(c_float)  beta,
real(c_float), target  y 
)

◆ rocsparse_sellmv_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sellmv::rocsparse_sellmv_rank_1 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), dimension(:), target  ell_val,
integer(c_int), dimension(:), target  ell_col_ind,
integer(c_int)  ell_width,
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: