# rocsparse_spsm Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_spsm Interface Reference
hipfort_rocsparse::rocsparse_spsm Interface Reference

Sparse triangular system solve. More...

## Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_spsm_ (handle, trans_A, trans_B, alpha, matA, matB, matC, compute_type, alg, stage, buffer_size, temp_buffer)

## Detailed Description

Sparse triangular system solve.

rocsparse_spsm_solve solves a sparse triangular linear system of a sparse $$m \times m$$ matrix, defined in CSR or COO storage format, a dense solution matrix $$C$$ and the right-hand side $$B$$ that is multiplied by $$\alpha$$, such that

$op(A) \cdot C = \alpha \cdot op(B),$

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.$

and

$op(B) = \left\{ \begin{array}{ll} B, & \text{if trans_B == rocsparse_operation_none} \newline B^T, & \text{if trans_B == rocsparse_operation_transpose} \newline B^H, & \text{if trans_B == rocsparse_operation_conjugate_transpose} \end{array} \right.$

Note
SpSM requires three stages to complete. The first stage rocsparse_spsm_stage_buffer_size will return the size of the temporary storage buffer that is required for subsequent calls. The second stage rocsparse_spsm_stage_preprocess will preprocess data that would be saved in the temporary storage buffer. In the final stage rocsparse_spsm_stage_compute, the actual computation is performed.
If rocsparse_spsm_stage_auto is selected, rocSPARSE will automatically detect which stage is required based on the following indicators: If temp_buffer is equal to nullptr, the required buffer size will be returned. If buffer_size is equal to nullptr, analysis will be performed. Otherwise, the SpSM preprocess and the SpSM algorithm will be executed.
This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
Currently, only trans_A == rocsparse_operation_none and trans_A == rocsparse_operation_transpose is supported. Currently, only trans_B == rocsparse_operation_none and trans_B == rocsparse_operation_transpose is supported.
Parameters
 [in] handle handle to the rocsparse library context queue. [in] trans_A matrix operation type for the sparse matrix A. [in] trans_B matrix operation type for the dense matrix B. [in] alpha scalar $$\alpha$$. [in] matA sparse matrix descriptor. [in] matB dense matrix descriptor. [in,out] matC dense matrix descriptor. [in] compute_type floating point precision for the SpSM computation. [in] alg SpSM algorithm for the SpSM computation. [in] stage SpSM stage for the SpSM computation. [out] buffer_size number of bytes of the temporary storage buffer. [in] temp_buffer temporary 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 SpSM operation.
Return values
 rocsparse_status_success the operation completed successfully. rocsparse_status_invalid_handle the library context was not initialized. rocsparse_status_invalid_pointer alpha, matA, matB, matC, descr or buffer_size pointer is invalid. rocsparse_status_not_implemented trans_A, trans_B, compute_type, stage or alg is currently not supported.

## ◆ rocsparse_spsm_()

 integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_spsm::rocsparse_spsm_ ( type(c_ptr), value handle, integer(kind(rocsparse_operation_none)), value trans_A, integer(kind(rocsparse_operation_none)), value trans_B, type(c_ptr), value alpha, type(c_ptr), value matA, type(c_ptr), value matB, type(c_ptr), value matC, integer(kind(rocsparse_datatype_f32_r)), value compute_type, integer(kind(rocsparse_spsm_alg_default)), value alg, integer(kind(rocsparse_spsm_stage_auto)), value stage, integer(c_size_t) buffer_size, type(c_ptr), value temp_buffer )

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