hipsparsesgebsr2gebsr Interface Reference#
This function converts the GEBSR sparse matrix \(A\) to another GEBSR sparse matrix \(C\). More...
Public Member Functions | |
| integer(kind(hipsparse_status_success)) function | hipsparsesgebsr2gebsr_ (handle, dira, mb, nb, nnzb, descra, bsrvala, bsrrowptra, bsrcolinda, rowblockdima, colblockdima, descrc, bsrvalc, bsrrowptrc, bsrcolindc, rowblockdimc, colblockdimc, buffer) |
| integer(kind(hipsparse_status_success)) function | hipsparsesgebsr2gebsr_rank_0 (handle, dira, mb, nb, nnzb, descra, bsrvala, bsrrowptra, bsrcolinda, rowblockdima, colblockdima, descrc, bsrvalc, bsrrowptrc, bsrcolindc, rowblockdimc, colblockdimc, buffer) |
| integer(kind(hipsparse_status_success)) function | hipsparsesgebsr2gebsr_rank_1 (handle, dira, mb, nb, nnzb, descra, bsrvala, bsrrowptra, bsrcolinda, rowblockdima, colblockdima, descrc, bsrvalc, bsrrowptrc, bsrcolindc, rowblockdimc, colblockdimc, buffer) |
Detailed Description
This function converts the GEBSR sparse matrix \(A\) to another GEBSR sparse matrix \(C\).
The conversion uses three steps. First, the user calls hipsparseSgebsr2gebsr_bufferSize "hipsparseXgebsr2gebsr_bufferSize()" to determine the size of the required temporary storage buffer. The user then allocates this buffer. Secondly, the user then allocates mbC+1 integers for the row pointer array for \(C\) where:
\[ \begin{align} \text{mbC} &= \text{(m - 1) / rowBlockDimC + 1} \\% \text{nbC} &= \text{(n - 1) / colBlockDimC + 1} \end{align} \]
The user then calls hipsparseXgebsr2gebsrNnz() to fill in the row pointer array for \(C\) ( bsrRowPtrC ) and determine the number of non-zero blocks that will exist in \(C\). Finally, the user allocates space for the column indices array of \(C\) to have nnzbC elements and space for the values array of \(C\) to have nnzbC*rowBlockDimC*colBlockDimC and then calls hipsparseXgebsr2gebsr to complete the conversion.
It could be the case that rowBlockDimC does not divide evenly into m or colBlockDim does not divide evenly into n. In these cases, the GEBSR matrix is expanded in size to fit full GEBSR blocks. For example, if the original GEBSR matrix A (using rowBlockDimA=2, colBlockDimA=3) looks like:
\[ \left[ \begin{array}{c | c} \begin{array}{c c c} 1 & 0 & 0 \\% 3 & 4 & 0 \end{array} & \begin{array}{c c c} 2 & 0 & 0 \\% 4 & 5 & 6 \end{array} \\% \hline \begin{array}{c c c} 1 & 2 & 3 \\% 1 & 2 & 0 \end{array} & \begin{array}{c c c} 4 & 0 & 0 \\% 3 & 0 & 1 \end{array} \\% \end{array} \right] \]
then if the user specifies rowBlockDimC=3 and colBlockDimC=2, the output GEBSR matrix C would be:
\[ \left[ \begin{array}{c | c | c} \begin{array}{c c} 1 & 0 \\% 3 & 4 \\% 1 & 2 \end{array} & \begin{array}{c c} 0 & 2 \\% 0 & 4 \\% 3 & 4 \end{array} & \begin{array}{c c} 0 & 0 \\% 5 & 6 \\% 0 & 0 \end{array} \\% \hline \begin{array}{c c} 1 & 2 \\% 0 & 0 \\% 0 & 0 \end{array} & \begin{array}{c c} 0 & 3 \\% 0 & 0 \\% 0 & 0 \end{array} & \begin{array}{c c} 0 & 1 \\% 0 & 0 \\% 0 & 0 \end{array} \\% \end{array} \right] \]
- Parameters
-
[in] handle - handle to the hipSPARSE library context queue. [in] dirA - the storage format of the blocks, HIPSPARSE_DIRECTION_ROWorHIPSPARSE_DIRECTION_COLUMN.[in] mb - number of block rows of the general BSR sparse matrix \(A\). [in] nb - number of block columns of the general BSR sparse matrix \(A\). [in] nnzb - number of blocks in the general BSR sparse matrix \(A\). [in] descrA - the descriptor of the general BSR sparse matrix \(A\). The supported matrix type is HIPSPARSE_MATRIX_TYPE_GENERALand also any valid value of thehipsparseIndexBase_t.[in] bsrValA - array of nnzb*rowBlockDimA*colBlockDimAcontaining the values of the sparse general BSR matrix \(A\).[in] bsrRowPtrA - array of mb+1elements that point to the start of every block row of the sparse general BSR matrix \(A\).[in] bsrColIndA - array of nnzbelements containing the block column indices of the sparse general BSR matrix \(A\).[in] rowBlockDimA - row size of the blocks in the sparse general BSR matrix \(A\). [in] colBlockDimA - column size of the blocks in the sparse general BSR matrix \(A\). [in] descrC - the descriptor of the general BSR sparse matrix \(C\). The supported matrix type is HIPSPARSE_MATRIX_TYPE_GENERALand any valid value of thehipsparseIndexBase_t.[in] bsrValC - array of nnzbC*rowBlockDimC*colBlockDimCcontaining the values of the sparse general BSR matrix \(C\).[in] bsrRowPtrC - array of mbC+1elements that point to the start of every block row of the sparse general BSR matrix \(C\).[in] bsrColIndC - array of nnzbCelements containing the block column indices of the sparse general BSR matrix \(C\).[in] rowBlockDimC - row size of the blocks in the sparse general BSR matrix \(C\). [in] colBlockDimC - column size of the blocks in the sparse general BSR matrix \(C\). [out] buffer - buffer allocated by the user. The size is determined by calling hipsparseSgebsr2gebsr_bufferSize"hipsparseXgebsr2gebsr_bufferSize()".
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,mb,nb,nnzb,rowBlockDimA,colBlockDimA,rowBlockDimC,colBlockDimC,bsrRowPtrA,bsrColIndA,bsrValA,bsrRowPtrC,bsrColIndC,bsrValC,descrA,descrC, orbufferpointer is invalid.
Member Function/Subroutine Documentation
◆ hipsparsesgebsr2gebsr_()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesgebsr2gebsr::hipsparsesgebsr2gebsr_ | ( | type(c_ptr), value | handle, |
| integer(kind(hipsparse_direction_row)), value | dira, | ||
| integer(c_int), value | mb, | ||
| integer(c_int), value | nb, | ||
| integer(c_int), value | nnzb, | ||
| type(c_ptr), value | descra, | ||
| type(c_ptr), value | bsrvala, | ||
| type(c_ptr), value | bsrrowptra, | ||
| type(c_ptr), value | bsrcolinda, | ||
| integer(c_int), value | rowblockdima, | ||
| integer(c_int), value | colblockdima, | ||
| type(c_ptr), value | descrc, | ||
| type(c_ptr), value | bsrvalc, | ||
| type(c_ptr), value | bsrrowptrc, | ||
| type(c_ptr), value | bsrcolindc, | ||
| integer(c_int), value | rowblockdimc, | ||
| integer(c_int), value | colblockdimc, | ||
| type(c_ptr), value | buffer | ||
| ) |
◆ hipsparsesgebsr2gebsr_rank_0()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesgebsr2gebsr::hipsparsesgebsr2gebsr_rank_0 | ( | type(c_ptr) | handle, |
| integer(kind(hipsparse_direction_row)) | dira, | ||
| integer(c_int) | mb, | ||
| integer(c_int) | nb, | ||
| integer(c_int) | nnzb, | ||
| type(c_ptr) | descra, | ||
| real(c_float), target | bsrvala, | ||
| integer(c_int), target | bsrrowptra, | ||
| integer(c_int), target | bsrcolinda, | ||
| integer(c_int) | rowblockdima, | ||
| integer(c_int) | colblockdima, | ||
| type(c_ptr) | descrc, | ||
| real(c_float), target | bsrvalc, | ||
| integer(c_int), target | bsrrowptrc, | ||
| integer(c_int), target | bsrcolindc, | ||
| integer(c_int) | rowblockdimc, | ||
| integer(c_int) | colblockdimc, | ||
| type(c_ptr) | buffer | ||
| ) |
◆ hipsparsesgebsr2gebsr_rank_1()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsesgebsr2gebsr::hipsparsesgebsr2gebsr_rank_1 | ( | type(c_ptr) | handle, |
| integer(kind(hipsparse_direction_row)) | dira, | ||
| integer(c_int) | mb, | ||
| integer(c_int) | nb, | ||
| integer(c_int) | nnzb, | ||
| 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) | rowblockdima, | ||
| integer(c_int) | colblockdima, | ||
| type(c_ptr) | descrc, | ||
| real(c_float), dimension(:), target | bsrvalc, | ||
| integer(c_int), dimension(:), target | bsrrowptrc, | ||
| integer(c_int), dimension(:), target | bsrcolindc, | ||
| integer(c_int) | rowblockdimc, | ||
| integer(c_int) | colblockdimc, | ||
| type(c_ptr) | buffer | ||
| ) |
The documentation for this interface was generated from the following file: