hipsparsescsr2csc Interface Reference

hipsparsescsr2csc Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsescsr2csc Interface Reference
hipfort_hipsparse::hipsparsescsr2csc Interface Reference

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

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsescsr2csc_ (handle, m, n, nnz, csrsortedval, csrsortedrowptr, csrsortedcolind, cscsortedval, cscsortedrowind, cscsortedcolptr, copyvalues, idxbase)
 
integer(kind(hipsparse_status_success)) function hipsparsescsr2csc_rank_0 (handle, m, n, nnz, csrsortedval, csrsortedrowptr, csrsortedcolind, cscsortedval, cscsortedrowind, cscsortedcolptr, copyvalues, idxbase)
 
integer(kind(hipsparse_status_success)) function hipsparsescsr2csc_rank_1 (handle, m, n, nnz, csrsortedval, csrsortedrowptr, csrsortedcolind, cscsortedval, cscsortedrowind, cscsortedcolptr, copyvalues, idxbase)
 

Detailed Description

Convert a sparse CSR matrix into a sparse CSC matrix.

hipsparseXcsr2csc converts a CSR matrix into a CSC matrix. hipsparseXcsr2csc can also be used to convert a CSC matrix into a CSR matrix. copyValues decides whether cscSortedVal is being filled during conversion (HIPSPARSE_ACTION_NUMERIC) or not (HIPSPARSE_ACTION_SYMBOLIC).

For example given the matrix:

\[ \begin{bmatrix} 1 & 0 & 0 & 2 \\% 3 & 4 & 0 & 0 \\% 5 & 0 & 6 & 7 \end{bmatrix} \]

Represented using the sparse CSR format as:

\[ \begin{align} \text{csrSortedRowPtr} &= \begin{bmatrix} 0 & 2 & 4 & 7 \end{bmatrix} \\% \text{csrSortedColInd} &= \begin{bmatrix} 0 & 3 & 0 & 1 & 0 & 2 & 3 \end{bmatrix} \\% \text{csrSortedVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \end{bmatrix} \end{align} \]

this function converts it to the sparse CSC format:

\[ \begin{align} \text{cscSortedRowInd} &= \begin{bmatrix} 0 & 1 & 2 & 1 & 2 & 0 & 2 \end{bmatrix} \\% \text{cscSortedColPtr} &= \begin{bmatrix} 0 & 3 & 4 & 5 & 7 \end{bmatrix} \\% \text{cscSortedVal} &= \begin{bmatrix} 1 & 3 & 5 & 4 & 6 & 2 & 7 \end{bmatrix} \end{align} \]

The CSC arrays cscSortedRowInd, cscSortedColPtr, and cscSortedVal must be allocated by the user prior to calling hipsparseXcsr2csc().

Note
The resulting matrix can also be seen as the transpose of the input matrix.
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
Deprecated:
This function is deprecated when using the CUDA backend (CUDA 10.0+) and will be removed in CUDA 11.0. This deprecation does not apply to the ROCm backend.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]m- number of rows of the sparse CSR matrix, which must be non-negative.
[in]n- number of columns of the sparse CSR matrix, which must be non-negative.
[in]nnz- number of non-zero entries of the sparse CSR matrix, which must be non-negative.
[in]csrSortedVal- array of nnz elements of the sparse CSR matrix.
[in]csrSortedRowPtr- array of m+1 elements that point to the start of every row of the sparse CSR matrix.
[in]csrSortedColInd- array of nnz elements containing the column indices of the sparse CSR matrix.
[out]cscSortedVal- array of nnz elements of the sparse CSC matrix.
[out]cscSortedRowInd- array of nnz elements containing the row indices of the sparse CSC matrix.
[out]cscSortedColPtr- array of n+1 elements that point to the start of every column of the sparse CSC matrix.
[in]copyValues- HIPSPARSE_ACTION_SYMBOLIC or HIPSPARSE_ACTION_NUMERIC.
[in]idxBase- index base. HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_NOT_INITIALIZEDhandle is not initialized.
HIPSPARSE_STATUS_INVALID_VALUEhandle is nullptr, m, n, or nnz is negative, csrSortedVal, csrSortedRowPtr, csrSortedColInd, cscSortedVal, cscSortedRowInd, or cscSortedColPtr is nullptr when nnz is greater than zero, copyValues is neither HIPSPARSE_ACTION_SYMBOLIC nor HIPSPARSE_ACTION_NUMERIC, or idxBase is neither HIPSPARSE_INDEX_BASE_ZERO nor HIPSPARSE_INDEX_BASE_ONE.
HIPSPARSE_STATUS_ARCH_MISMATCHthe device is not supported.
HIPSPARSE_STATUS_INTERNAL_ERRORan internal error occurred.

Member Function/Subroutine Documentation

◆ hipsparsescsr2csc_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsr2csc::hipsparsescsr2csc_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
integer(c_int), value  nnz,
type(c_ptr), value  csrsortedval,
type(c_ptr), value  csrsortedrowptr,
type(c_ptr), value  csrsortedcolind,
type(c_ptr), value  cscsortedval,
type(c_ptr), value  cscsortedrowind,
type(c_ptr), value  cscsortedcolptr,
integer(kind(hipsparse_action_symbolic)), value  copyvalues,
integer(kind(hipsparse_index_base_zero)), value  idxbase 
)

◆ hipsparsescsr2csc_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsr2csc::hipsparsescsr2csc_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  nnz,
real(c_float), target  csrsortedval,
integer(c_int), target  csrsortedrowptr,
integer(c_int), target  csrsortedcolind,
real(c_float), target  cscsortedval,
integer(c_int), target  cscsortedrowind,
integer(c_int), target  cscsortedcolptr,
integer(kind(hipsparse_action_symbolic))  copyvalues,
integer(kind(hipsparse_index_base_zero))  idxbase 
)

◆ hipsparsescsr2csc_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsr2csc::hipsparsescsr2csc_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  nnz,
real(c_float), dimension(:), target  csrsortedval,
integer(c_int), dimension(:), target  csrsortedrowptr,
integer(c_int), dimension(:), target  csrsortedcolind,
real(c_float), dimension(:), target  cscsortedval,
integer(c_int), dimension(:), target  cscsortedrowind,
integer(c_int), dimension(:), target  cscsortedcolptr,
integer(kind(hipsparse_action_symbolic))  copyvalues,
integer(kind(hipsparse_index_base_zero))  idxbase 
)

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