hipsparsesbsr2csr Interface Reference

hipsparsesbsr2csr Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsesbsr2csr Interface Reference
hipfort_hipsparse::hipsparsesbsr2csr Interface Reference

Convert a sparse BSR matrix into a sparse CSR matrix. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsesbsr2csr_ (handle, dira, mb, nb, descra, bsrvala, bsrrowptra, bsrcolinda, blockdim, descrc, csrvalc, csrrowptrc, csrcolindc)
 
integer(kind(hipsparse_status_success)) function hipsparsesbsr2csr_rank_0 (handle, dira, mb, nb, descra, bsrvala, bsrrowptra, bsrcolinda, blockdim, descrc, csrvalc, csrrowptrc, csrcolindc)
 
integer(kind(hipsparse_status_success)) function hipsparsesbsr2csr_rank_1 (handle, dira, mb, nb, descra, bsrvala, bsrrowptra, bsrcolinda, blockdim, descrc, csrvalc, csrrowptrc, csrcolindc)
 

Detailed Description

Convert a sparse BSR matrix into a sparse CSR matrix.

hipsparseXbsr2csr converts a BSR matrix into a CSR matrix. It is assumed that csrValC, csrColIndC, and csrRowPtrC are allocated. Allocation size for csrRowPtrC is computed by the number of block rows multiplied by the block dimension plus one. Allocation for csrValC and csrColInd is computed by the number of blocks in the BSR matrix multiplied by the block dimension squared.

For example, given the BSR matrix using block dimension 2:

\[ \left[ \begin{array}{c | c} \begin{array}{c c} 1 & 0 \\% 3 & 4 \end{array} & \begin{array}{c c} 0 & 2 \\% 0 & 0 \end{array} \\% \hline \begin{array}{c c} 5 & 0 \\% 1 & 2 \end{array} & \begin{array}{c c} 6 & 7 \\% 3 & 4 \end{array} \\% \end{array} \right] \]

The resulting CSR matrix row pointer, column indices, and values arrays are:

\[ \begin{align} \text{csrRowPtrC} &= \begin{bmatrix} 0 & 4 & 8 & 12 & 16 \end{bmatrix} \\% \text{csrColIndC} &= \begin{bmatrix} 0 & 1 & 2 & 3 & 0 & 1 & 2 & 3 & 0 & 1 & 2 & 3 & 0 & 1 & 2 & 3 \end{bmatrix} \\% \text{csrValC} &= \begin{bmatrix} 1 & 0 & 0 & 2 & 3 & 4 & 0 & 0 & 5 & 0 & 6 & 7 & 1 & 2 & 3 & 4 \end{bmatrix} \\% \end{align} \]

Note
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]dirA- the storage format of the blocks, HIPSPARSE_DIRECTION_ROW or HIPSPARSE_DIRECTION_COLUMN.
[in]mb- number of block rows in the sparse BSR matrix, which must be non-negative.
[in]nb- number of block columns in the sparse BSR matrix, which must be non-negative.
[in]descrA- descriptor of the sparse BSR matrix. Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[in]bsrValA- array of nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
[in]bsrRowPtrA- array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
[in]bsrColIndA- array of nnzb elements containing the block column indices of the sparse BSR matrix.
[in]blockDim- size of the blocks in the sparse BSR matrix. Must be positive.
[in]descrC- descriptor of the sparse CSR matrix. Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[out]csrValC- array of nnzb*blockDim*blockDim elements containing the values of the sparse CSR matrix.
[out]csrRowPtrC- array of m+1 where m=mb*blockDim elements that point to the start of every row of the sparse CSR matrix.
[out]csrColIndC- array of nnzb*blockDim*blockDim elements containing the column indices of the sparse CSR matrix.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle is not initialized.
HIPSPARSE_STATUS_INVALID_VALUEhandle, descrA, descrC, bsrValA, bsrRowPtrA, bsrColIndA, csrValC, csrRowPtrC, or csrColIndC is nullptr, mb or nb is negative, or blockDim is invalid.

Member Function/Subroutine Documentation

◆ hipsparsesbsr2csr_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesbsr2csr::hipsparsesbsr2csr_ ( type(c_ptr), value  handle,
integer(kind(hipsparse_direction_row)), value  dira,
integer(c_int), value  mb,
integer(c_int), value  nb,
type(c_ptr), value  descra,
type(c_ptr), value  bsrvala,
type(c_ptr), value  bsrrowptra,
type(c_ptr), value  bsrcolinda,
integer(c_int), value  blockdim,
type(c_ptr), value  descrc,
type(c_ptr), value  csrvalc,
type(c_ptr), value  csrrowptrc,
type(c_ptr), value  csrcolindc 
)

◆ hipsparsesbsr2csr_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesbsr2csr::hipsparsesbsr2csr_rank_0 ( type(c_ptr)  handle,
integer(kind(hipsparse_direction_row))  dira,
integer(c_int)  mb,
integer(c_int)  nb,
type(c_ptr)  descra,
real(c_float), target  bsrvala,
integer(c_int), target  bsrrowptra,
integer(c_int), target  bsrcolinda,
integer(c_int)  blockdim,
type(c_ptr)  descrc,
real(c_float), target  csrvalc,
integer(c_int), target  csrrowptrc,
integer(c_int), target  csrcolindc 
)

◆ hipsparsesbsr2csr_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesbsr2csr::hipsparsesbsr2csr_rank_1 ( type(c_ptr)  handle,
integer(kind(hipsparse_direction_row))  dira,
integer(c_int)  mb,
integer(c_int)  nb,
type(c_ptr)  descra,
real(c_float), dimension(:), target  bsrvala,
integer(c_int), dimension(:), target  bsrrowptra,
integer(c_int), dimension(:), target  bsrcolinda,
integer(c_int)  blockdim,
type(c_ptr)  descrc,
real(c_float), dimension(:), target  csrvalc,
integer(c_int), dimension(:), target  csrrowptrc,
integer(c_int), dimension(:), target  csrcolindc 
)

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