This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.

rocsparse_spmv Interface Reference

rocsparse_spmv Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_spmv Interface Reference
hipfort_rocsparse::rocsparse_spmv Interface Reference

Sparse matrix vector multiplication. More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_spmv_ (handle, trans, alpha, mat, x, beta, y, compute_type, alg, buffer_size, temp_buffer)
 

Detailed Description

Sparse matrix vector multiplication.

rocsparse_spmv multiplies the scalar \(\alpha\) with a sparse \(m \times n\) matrix 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} \newline A^T, & \text{if trans == rocsparse_operation_transpose} \newline A^H, & \text{if trans == rocsparse_operation_conjugate_transpose} \end{array} \right. \]

Note
This function writes the required allocation size (in bytes) to buffer_size and returns without performing the SpMV operation, when a nullptr is passed for temp_buffer.
This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
Parameters
[in]handlehandle to the rocsparse library context queue.
[in]transmatrix operation type.
[in]alphascalar \(\alpha\).
[in]matmatrix descriptor.
[in]xvector descriptor.
[in]betascalar \(\beta\).
[in,out]yvector descriptor.
[in]compute_typefloating point precision for the SpMV computation.
[in]algSpMV algorithm for the SpMV computation.
[out]buffer_sizenumber of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
[in]temp_buffertemporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpMV operation.
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_pointeralpha, mat, x, beta, y or buffer_size pointer is invalid.
rocsparse_status_not_implementedcompute_type or alg is currently not supported.

Member Function/Subroutine Documentation

◆ rocsparse_spmv_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_spmv::rocsparse_spmv_ ( type(c_ptr), value  handle,
integer(kind(rocsparse_operation_none)), value  trans,
type(c_ptr), value  alpha,
type(c_ptr), value  mat,
type(c_ptr), value  x,
type(c_ptr), value  beta,
type(c_ptr), value  y,
integer(kind(rocsparse_datatype_f32_r)), value  compute_type,
integer(kind(rocsparse_spmv_alg_default)), value  alg,
integer(c_size_t)  buffer_size,
type(c_ptr), value  temp_buffer 
)

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