Sparse Conversion Functions#

This module holds all sparse conversion routines.

The sparse conversion routines describe operations on a matrix in sparse format to obtain a matrix in a different sparse format.

hipsparseXnnz()#

hipsparseStatus_t hipsparseSnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const float *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr)#
hipsparseStatus_t hipsparseDnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const double *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr)#
hipsparseStatus_t hipsparseCnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipComplex *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr)#
hipsparseStatus_t hipsparseZnnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipDoubleComplex *A, int lda, int *nnzPerRowColumn, int *nnzTotalDevHostPtr)#

This function computes the number of nonzero elements per row or column and the total number of nonzero elements in a dense matrix.

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXdense2csr()#

hipsparseStatus_t hipsparseSdense2csr(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const float *A, int ld, const int *nnz_per_rows, float *csr_val, int *csr_row_ptr, int *csr_col_ind)#
hipsparseStatus_t hipsparseDdense2csr(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const double *A, int ld, const int *nnz_per_rows, double *csr_val, int *csr_row_ptr, int *csr_col_ind)#
hipsparseStatus_t hipsparseCdense2csr(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipComplex *A, int ld, const int *nnz_per_rows, hipComplex *csr_val, int *csr_row_ptr, int *csr_col_ind)#
hipsparseStatus_t hipsparseZdense2csr(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipDoubleComplex *A, int ld, const int *nnz_per_rows, hipDoubleComplex *csr_val, int *csr_row_ptr, int *csr_col_ind)#

This function converts the matrix A in dense format into a sparse matrix in CSR format. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on nnz_per_row, which can be pre-computed with hipsparseXnnz(). It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXpruneDense2csr_bufferSize()#

hipsparseStatus_t hipsparseSpruneDense2csr_bufferSize(hipsparseHandle_t handle, int m, int n, const float *A, int lda, const float *threshold, const hipsparseMatDescr_t descr, const float *csrVal, const int *csrRowPtr, const int *csrColInd, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneDense2csr_bufferSize(hipsparseHandle_t handle, int m, int n, const double *A, int lda, const double *threshold, const hipsparseMatDescr_t descr, const double *csrVal, const int *csrRowPtr, const int *csrColInd, size_t *bufferSize)#

This function computes the the size of the user allocated temporary storage buffer used when converting and pruning a dense matrix to a CSR matrix.

hipsparseXpruneDense2csr_bufferSizeExt returns the size of the temporary storage buffer that is required by hipsparseXpruneDense2csrNnz() and hipsparseXpruneDense2csr(). The temporary storage buffer must be allocated by the user.

hipsparseXpruneDense2csrNnz()#

hipsparseStatus_t hipsparseSpruneDense2csrNnz(hipsparseHandle_t handle, int m, int n, const float *A, int lda, const float *threshold, const hipsparseMatDescr_t descr, int *csrRowPtr, int *nnzTotalDevHostPtr, void *buffer)#
hipsparseStatus_t hipsparseDpruneDense2csrNnz(hipsparseHandle_t handle, int m, int n, const double *A, int lda, const double *threshold, const hipsparseMatDescr_t descr, int *csrRowPtr, int *nnzTotalDevHostPtr, void *buffer)#

This function computes the number of nonzero elements per row and the total number of nonzero elements in a dense matrix once elements less than the threshold are pruned from the matrix.

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXpruneDense2csr()#

hipsparseStatus_t hipsparseSpruneDense2csr(hipsparseHandle_t handle, int m, int n, const float *A, int lda, const float *threshold, const hipsparseMatDescr_t descr, float *csrVal, const int *csrRowPtr, int *csrColInd, void *buffer)#
hipsparseStatus_t hipsparseDpruneDense2csr(hipsparseHandle_t handle, int m, int n, const double *A, int lda, const double *threshold, const hipsparseMatDescr_t descr, double *csrVal, const int *csrRowPtr, int *csrColInd, void *buffer)#

This function converts the matrix A in dense format into a sparse matrix in CSR format while pruning values that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user.

The user first allocates csrRowPtr to have m+1 elements and then calls hipsparseXpruneDense2csrNnz() which fills in the csrRowPtr array and stores the number of elements that are larger than the pruning threshold in nnzTotalDevHostPtr. The user then allocates csrColInd and csrVal to have size nnzTotalDevHostPtr and completes the conversion by calling hipsparseXpruneDense2csr(). A temporary storage buffer is used by both hipsparseXpruneDense2csrNnz() and hipsparseXpruneDense2csr() and must be allocated by the user and whose size is determined by hipsparseXpruneDense2csr_bufferSizeExt(). The routine hipsparseXpruneDense2csr() is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXpruneDense2csrByPercentage_bufferSize()#

hipsparseStatus_t hipsparseSpruneDense2csrByPercentage_bufferSize(hipsparseHandle_t handle, int m, int n, const float *A, int lda, float percentage, const hipsparseMatDescr_t descr, const float *csrVal, const int *csrRowPtr, const int *csrColInd, pruneInfo_t info, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneDense2csrByPercentage_bufferSize(hipsparseHandle_t handle, int m, int n, const double *A, int lda, double percentage, const hipsparseMatDescr_t descr, const double *csrVal, const int *csrRowPtr, const int *csrColInd, pruneInfo_t info, size_t *bufferSize)#

This function computes the size of the user allocated temporary storage buffer used when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls hipsparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls hipsparseXpruneDense2csrNnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling hipsparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by

\[ pos = ceil(m*n*(percentage/100)) - 1 pos = min(pos, m*n-1) pos = max(pos, 0) threshold = sorted_A[pos] \]
Once we have this threshold we prune values in the dense matrix A as in hipsparseXpruneDense2csr. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXpruneDense2csrByPercentage_bufferSizeExt()#

hipsparseStatus_t hipsparseSpruneDense2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle, int m, int n, const float *A, int lda, float percentage, const hipsparseMatDescr_t descr, const float *csrVal, const int *csrRowPtr, const int *csrColInd, pruneInfo_t info, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneDense2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle, int m, int n, const double *A, int lda, double percentage, const hipsparseMatDescr_t descr, const double *csrVal, const int *csrRowPtr, const int *csrColInd, pruneInfo_t info, size_t *bufferSize)#

This function computes the size of the user allocated temporary storage buffer used when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls hipsparseXpruneDense2csrByPercentage_bufferSizeExt which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls hipsparseXpruneDense2csrNnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling hipsparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by

\[ pos = ceil(m*n*(percentage/100)) - 1 pos = min(pos, m*n-1) pos = max(pos, 0) threshold = sorted_A[pos] \]
Once we have this threshold we prune values in the dense matrix A as in hipsparseXpruneDense2csr. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXpruneDense2csrNnzByPercentage()#

hipsparseStatus_t hipsparseSpruneDense2csrNnzByPercentage(hipsparseHandle_t handle, int m, int n, const float *A, int lda, float percentage, const hipsparseMatDescr_t descr, int *csrRowPtr, int *nnzTotalDevHostPtr, pruneInfo_t info, void *buffer)#
hipsparseStatus_t hipsparseDpruneDense2csrNnzByPercentage(hipsparseHandle_t handle, int m, int n, const double *A, int lda, double percentage, const hipsparseMatDescr_t descr, int *csrRowPtr, int *nnzTotalDevHostPtr, pruneInfo_t info, void *buffer)#

This function computes the number of nonzero elements per row and the total number of nonzero elements in a dense matrix when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls hipsparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls hipsparseXpruneDense2csrNnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling hipsparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by

\[ pos = ceil(m*n*(percentage/100)) - 1 pos = min(pos, m*n-1) pos = max(pos, 0) threshold = sorted_A[pos] \]
Once we have this threshold we prune values in the dense matrix A as in hipsparseXpruneDense2csr. The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXpruneDense2csrByPercentage()#

hipsparseStatus_t hipsparseSpruneDense2csrByPercentage(hipsparseHandle_t handle, int m, int n, const float *A, int lda, float percentage, const hipsparseMatDescr_t descr, float *csrVal, const int *csrRowPtr, int *csrColInd, pruneInfo_t info, void *buffer)#
hipsparseStatus_t hipsparseDpruneDense2csrByPercentage(hipsparseHandle_t handle, int m, int n, const double *A, int lda, double percentage, const hipsparseMatDescr_t descr, double *csrVal, const int *csrRowPtr, int *csrColInd, pruneInfo_t info, void *buffer)#

This function computes the number of nonzero elements per row and the total number of nonzero elements in a dense matrix when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls hipsparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls hipsparseXpruneDense2csrNnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling hipsparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by

\[ pos = ceil(m*n*(percentage/100)) - 1 pos = min(pos, m*n-1) pos = max(pos, 0) threshold = sorted_A[pos] \]
Once we have this threshold we prune values in the dense matrix A as in hipsparseXpruneDense2csr. The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXdense2csc()#

hipsparseStatus_t hipsparseSdense2csc(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const float *A, int ld, const int *nnz_per_columns, float *csc_val, int *csc_row_ind, int *csc_col_ptr)#
hipsparseStatus_t hipsparseDdense2csc(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const double *A, int ld, const int *nnz_per_columns, double *csc_val, int *csc_row_ind, int *csc_col_ptr)#
hipsparseStatus_t hipsparseCdense2csc(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipComplex *A, int ld, const int *nnz_per_columns, hipComplex *csc_val, int *csc_row_ind, int *csc_col_ptr)#
hipsparseStatus_t hipsparseZdense2csc(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipDoubleComplex *A, int ld, const int *nnz_per_columns, hipDoubleComplex *csc_val, int *csc_row_ind, int *csc_col_ptr)#

This function converts the matrix A in dense format into a sparse matrix in CSC format. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on nnz_per_columns, which can be pre-computed with hipsparseXnnz(). It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXcsr2dense()#

hipsparseStatus_t hipsparseScsr2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const float *csr_val, const int *csr_row_ptr, const int *csr_col_ind, float *A, int ld)#
hipsparseStatus_t hipsparseDcsr2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const double *csr_val, const int *csr_row_ptr, const int *csr_col_ind, double *A, int ld)#
hipsparseStatus_t hipsparseCcsr2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, hipComplex *A, int ld)#
hipsparseStatus_t hipsparseZcsr2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipDoubleComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, hipDoubleComplex *A, int ld)#

This function converts the sparse matrix in CSR format into a dense matrix. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXcsc2dense()#

hipsparseStatus_t hipsparseScsc2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const float *csc_val, const int *csc_row_ind, const int *csc_col_ptr, float *A, int ld)#
hipsparseStatus_t hipsparseDcsc2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const double *csc_val, const int *csc_row_ind, const int *csc_col_ptr, double *A, int ld)#
hipsparseStatus_t hipsparseCcsc2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipComplex *csc_val, const int *csc_row_ind, const int *csc_col_ptr, hipComplex *A, int ld)#
hipsparseStatus_t hipsparseZcsc2dense(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descr, const hipDoubleComplex *csc_val, const int *csc_row_ind, const int *csc_col_ptr, hipDoubleComplex *A, int ld)#

This function converts the sparse matrix in CSC format into a dense matrix. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXcsr2bsrNnz()#

hipsparseStatus_t hipsparseXcsr2bsrNnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const int *csrRowPtrA, const int *csrColIndA, int blockDim, const hipsparseMatDescr_t descrC, int *bsrRowPtrC, int *bsrNnzb)#

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse BSR matrix given a sparse CSR matrix as input.

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXcsr2bsr()#

hipsparseStatus_t hipsparseScsr2bsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, int blockDim, const hipsparseMatDescr_t descrC, float *bsrValC, int *bsrRowPtrC, int *bsrColIndC)#
hipsparseStatus_t hipsparseDcsr2bsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, int blockDim, const hipsparseMatDescr_t descrC, double *bsrValC, int *bsrRowPtrC, int *bsrColIndC)#
hipsparseStatus_t hipsparseCcsr2bsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, int blockDim, const hipsparseMatDescr_t descrC, hipComplex *bsrValC, int *bsrRowPtrC, int *bsrColIndC)#
hipsparseStatus_t hipsparseZcsr2bsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int m, int n, const hipsparseMatDescr_t descrA, const hipDoubleComplex *csrValA, const int *csrRowPtrA, const int *csrColIndA, int blockDim, const hipsparseMatDescr_t descrC, hipDoubleComplex *bsrValC, int *bsrRowPtrC, int *bsrColIndC)#

Convert a sparse CSR matrix into a sparse BSR matrix.

hipsparseXcsr2bsr converts a CSR matrix into a BSR matrix. It is assumed, that bsr_val, bsr_col_ind and bsr_row_ptr are allocated. Allocation size for bsr_row_ptr is computed as mb+1 where mb is the number of block rows in the BSR matrix. Allocation size for bsr_val and bsr_col_ind is computed using csr2bsr_nnz() which also fills in bsr_row_ptr.

hipsparseXcsr2bsr requires extra temporary storage that is allocated internally if block_dim>16

hipsparseXnnz_compress()#

hipsparseStatus_t hipsparseSnnz_compress(hipsparseHandle_t handle, int m, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, int *nnzPerRow, int *nnzC, float tol)#
hipsparseStatus_t hipsparseDnnz_compress(hipsparseHandle_t handle, int m, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, int *nnzPerRow, int *nnzC, double tol)#
hipsparseStatus_t hipsparseCnnz_compress(hipsparseHandle_t handle, int m, const hipsparseMatDescr_t descrA, const hipComplex *csrValA, const int *csrRowPtrA, int *nnzPerRow, int *nnzC, hipComplex tol)#
hipsparseStatus_t hipsparseZnnz_compress(hipsparseHandle_t handle, int m, const hipsparseMatDescr_t descrA, const hipDoubleComplex *csrValA, const int *csrRowPtrA, int *nnzPerRow, int *nnzC, hipDoubleComplex tol)#

Given a sparse CSR matrix and a non-negative tolerance, this function computes how many entries would be left in each row of the matrix if elements less than the tolerance were removed. It also computes the total number of remaining elements in the matrix.

hipsparseXcsr2coo()#

hipsparseStatus_t hipsparseXcsr2coo(hipsparseHandle_t handle, const int *csrRowPtr, int nnz, int m, int *cooRowInd, hipsparseIndexBase_t idxBase)#

Convert a sparse CSR matrix into a sparse COO matrix.

hipsparseXcsr2coo converts the CSR array containing the row offsets, that point to the start of every row, into a COO array of row indices.

Note

It can also be used to convert a CSC array containing the column offsets into a COO array of column indices.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2csc()#

hipsparseStatus_t hipsparseScsr2csc(hipsparseHandle_t handle, int m, int n, int nnz, const float *csrSortedVal, const int *csrSortedRowPtr, const int *csrSortedColInd, float *cscSortedVal, int *cscSortedRowInd, int *cscSortedColPtr, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase)#
hipsparseStatus_t hipsparseDcsr2csc(hipsparseHandle_t handle, int m, int n, int nnz, const double *csrSortedVal, const int *csrSortedRowPtr, const int *csrSortedColInd, double *cscSortedVal, int *cscSortedRowInd, int *cscSortedColPtr, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase)#
hipsparseStatus_t hipsparseCcsr2csc(hipsparseHandle_t handle, int m, int n, int nnz, const hipComplex *csrSortedVal, const int *csrSortedRowPtr, const int *csrSortedColInd, hipComplex *cscSortedVal, int *cscSortedRowInd, int *cscSortedColPtr, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase)#
hipsparseStatus_t hipsparseZcsr2csc(hipsparseHandle_t handle, int m, int n, int nnz, const hipDoubleComplex *csrSortedVal, const int *csrSortedRowPtr, const int *csrSortedColInd, hipDoubleComplex *cscSortedVal, int *cscSortedRowInd, int *cscSortedColPtr, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase)#

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. copy_values decides whether csc_val is being filled during conversion (HIPSPARSE_ACTION_NUMERIC) or not (HIPSPARSE_ACTION_SYMBOLIC).

Note

The resulting matrix can also be seen as the transpose of the input matrix.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2cscEx2_bufferSize()#

hipsparseStatus_t hipsparseCsr2cscEx2_bufferSize(hipsparseHandle_t handle, int m, int n, int nnz, const void *csrVal, const int *csrRowPtr, const int *csrColInd, void *cscVal, int *cscColPtr, int *cscRowInd, hipDataType valType, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase, hipsparseCsr2CscAlg_t alg, size_t *bufferSize)#

This function computes the size of the user allocated temporary storage buffer used when converting a sparse CSR matrix into a sparse CSC matrix.

hipsparseCsr2cscEx2_bufferSize calculates the required user allocated temporary buffer needed by hipsparseCsr2cscEx2 to convert a CSR matrix into a CSC matrix. hipsparseCsr2cscEx2 can also be used to convert a CSC matrix into a CSR matrix. copy_values decides whether csc_val is being filled during conversion (HIPSPARSE_ACTION_NUMERIC) or not (HIPSPARSE_ACTION_SYMBOLIC).

Note

The resulting matrix can also be seen as the transpose of the input matrix.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2cscEx2()#

hipsparseStatus_t hipsparseCsr2cscEx2(hipsparseHandle_t handle, int m, int n, int nnz, const void *csrVal, const int *csrRowPtr, const int *csrColInd, void *cscVal, int *cscColPtr, int *cscRowInd, hipDataType valType, hipsparseAction_t copyValues, hipsparseIndexBase_t idxBase, hipsparseCsr2CscAlg_t alg, void *buffer)#

Convert a sparse CSR matrix into a sparse CSC matrix.

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

Note

The resulting matrix can also be seen as the transpose of the input matrix.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2hyb()#

hipsparseStatus_t hipsparseScsr2hyb(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const float *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, hipsparseHybMat_t hybA, int userEllWidth, hipsparseHybPartition_t partitionType)#
hipsparseStatus_t hipsparseDcsr2hyb(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const double *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, hipsparseHybMat_t hybA, int userEllWidth, hipsparseHybPartition_t partitionType)#
hipsparseStatus_t hipsparseCcsr2hyb(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const hipComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, hipsparseHybMat_t hybA, int userEllWidth, hipsparseHybPartition_t partitionType)#
hipsparseStatus_t hipsparseZcsr2hyb(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const hipDoubleComplex *csrSortedValA, const int *csrSortedRowPtrA, const int *csrSortedColIndA, hipsparseHybMat_t hybA, int userEllWidth, hipsparseHybPartition_t partitionType)#

Convert a sparse CSR matrix into a sparse HYB matrix.

hipsparseXcsr2hyb converts a CSR matrix into a HYB matrix. It is assumed that hyb has been initialized with hipsparseCreateHybMat().

Note

This function requires a significant amount of storage for the HYB matrix, depending on the matrix structure.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXgebsr2gebsc_bufferSize()#

hipsparseStatus_t hipsparseSgebsr2gebsc_bufferSize(hipsparseHandle_t handle, int mb, int nb, int nnzb, const float *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseDgebsr2gebsc_bufferSize(hipsparseHandle_t handle, int mb, int nb, int nnzb, const double *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseCgebsr2gebsc_bufferSize(hipsparseHandle_t handle, int mb, int nb, int nnzb, const hipComplex *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseZgebsr2gebsc_bufferSize(hipsparseHandle_t handle, int mb, int nb, int nnzb, const hipDoubleComplex *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#

Convert a sparse GEneral BSR matrix into a sparse GEneral BSC matrix.

hipsparseXgebsr2gebsc_bufferSize returns the size of the temporary storage buffer required by hipsparseXgebsr2gebsc(). The temporary storage buffer must be allocated by the user.

hipsparseXgebsr2gebsc()#

hipsparseStatus_t hipsparseSgebsr2gebsc(hipsparseHandle_t handle, int mb, int nb, int nnzb, const float *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, float *bsc_val, int *bsc_row_ind, int *bsc_col_ptr, hipsparseAction_t copy_values, hipsparseIndexBase_t idx_base, void *temp_buffer)#
hipsparseStatus_t hipsparseDgebsr2gebsc(hipsparseHandle_t handle, int mb, int nb, int nnzb, const double *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, double *bsc_val, int *bsc_row_ind, int *bsc_col_ptr, hipsparseAction_t copy_values, hipsparseIndexBase_t idx_base, void *temp_buffer)#
hipsparseStatus_t hipsparseCgebsr2gebsc(hipsparseHandle_t handle, int mb, int nb, int nnzb, const hipComplex *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, hipComplex *bsc_val, int *bsc_row_ind, int *bsc_col_ptr, hipsparseAction_t copy_values, hipsparseIndexBase_t idx_base, void *temp_buffer)#
hipsparseStatus_t hipsparseZgebsr2gebsc(hipsparseHandle_t handle, int mb, int nb, int nnzb, const hipDoubleComplex *bsr_val, const int *bsr_row_ptr, const int *bsr_col_ind, int row_block_dim, int col_block_dim, hipDoubleComplex *bsc_val, int *bsc_row_ind, int *bsc_col_ptr, hipsparseAction_t copy_values, hipsparseIndexBase_t idx_base, void *temp_buffer)#

Convert a sparse GEneral BSR matrix into a sparse GEneral BSC matrix.

hipsparseXgebsr2gebsc converts a GEneral BSR matrix into a GEneral BSC matrix. hipsparseXgebsr2gebsc can also be used to convert a GEneral BSC matrix into a GEneral BSR matrix. copy_values decides whether bsc_val is being filled during conversion (HIPSPARSE_ACTION_NUMERIC) or not (HIPSPARSE_ACTION_SYMBOLIC).

hipsparseXgebsr2gebsc requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by hipsparseXgebsr2gebsc_bufferSize().

Note

The resulting matrix can also be seen as the transpose of the input matrix.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2gebsr_bufferSize()#

hipsparseStatus_t hipsparseScsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const float *csr_val, const int *csr_row_ptr, const int *csr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseDcsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const double *csr_val, const int *csr_row_ptr, const int *csr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseCcsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const hipComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#
hipsparseStatus_t hipsparseZcsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const hipDoubleComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, int row_block_dim, int col_block_dim, size_t *p_buffer_size)#

hipsparseXcsr2gebsr_bufferSize returns the size of the temporary buffer that is required by hipsparseXcsr2gebcsrNnz and hipsparseXcsr2gebcsr. The temporary storage buffer must be allocated by the user.

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse GEneral BSR matrix given a sparse CSR matrix as input.

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXcsr2gebsrNnz()#

hipsparseStatus_t hipsparseXcsr2gebsrNnz(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const int *csr_row_ptr, const int *csr_col_ind, const hipsparseMatDescr_t bsr_descr, int *bsr_row_ptr, int row_block_dim, int col_block_dim, int *bsr_nnz_devhost, void *p_buffer)#

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse GEneral BSR matrix given a sparse CSR matrix as input.

hipsparseXcsr2gebsr()#

hipsparseStatus_t hipsparseScsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const float *csr_val, const int *csr_row_ptr, const int *csr_col_ind, const hipsparseMatDescr_t bsr_descr, float *bsr_val, int *bsr_row_ptr, int *bsr_col_ind, int row_block_dim, int col_block_dim, void *p_buffer)#
hipsparseStatus_t hipsparseDcsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const double *csr_val, const int *csr_row_ptr, const int *csr_col_ind, const hipsparseMatDescr_t bsr_descr, double *bsr_val, int *bsr_row_ptr, int *bsr_col_ind, int row_block_dim, int col_block_dim, void *p_buffer)#
hipsparseStatus_t hipsparseCcsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const hipComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, const hipsparseMatDescr_t bsr_descr, hipComplex *bsr_val, int *bsr_row_ptr, int *bsr_col_ind, int row_block_dim, int col_block_dim, void *p_buffer)#
hipsparseStatus_t hipsparseZcsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dir, int m, int n, const hipsparseMatDescr_t csr_descr, const hipDoubleComplex *csr_val, const int *csr_row_ptr, const int *csr_col_ind, const hipsparseMatDescr_t bsr_descr, hipDoubleComplex *bsr_val, int *bsr_row_ptr, int *bsr_col_ind, int row_block_dim, int col_block_dim, void *p_buffer)#

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

hipsparseXcsr2gebsr converts a CSR matrix into a GEneral BSR matrix. It is assumed, that bsr_val, bsr_col_ind and bsr_row_ptr are allocated. Allocation size for bsr_row_ptr is computed as mb+1 where mb is the number of block rows in the GEneral BSR matrix. Allocation size for bsr_val and bsr_col_ind is computed using csr2gebsr_nnz() which also fills in bsr_row_ptr.

hipsparseXbsr2csr()#

hipsparseStatus_t hipsparseSbsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const float *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int blockDim, const hipsparseMatDescr_t descrC, float *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseDbsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const double *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int blockDim, const hipsparseMatDescr_t descrC, double *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseCbsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const hipComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int blockDim, const hipsparseMatDescr_t descrC, hipComplex *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseZbsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const hipDoubleComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int blockDim, const hipsparseMatDescr_t descrC, hipDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC)#

Convert a sparse BSR matrix into a sparse CSR matrix.

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

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXgebsr2csr()#

hipsparseStatus_t hipsparseSgebsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const float *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDim, int colBlockDim, const hipsparseMatDescr_t descrC, float *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseDgebsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const double *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDim, int colBlockDim, const hipsparseMatDescr_t descrC, double *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseCgebsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const hipComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDim, int colBlockDim, const hipsparseMatDescr_t descrC, hipComplex *csrValC, int *csrRowPtrC, int *csrColIndC)#
hipsparseStatus_t hipsparseZgebsr2csr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, const hipsparseMatDescr_t descrA, const hipDoubleComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDim, int colBlockDim, const hipsparseMatDescr_t descrC, hipDoubleComplex *csrValC, int *csrRowPtrC, int *csrColIndC)#

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

hipsparseXgebsr2csr converts a BSR matrix into a CSR matrix. It is assumed, that csr_val, csr_col_ind and csr_row_ptr are allocated. Allocation size for csr_row_ptr is computed by the number of block rows multiplied by the block dimension plus one. Allocation for csr_val and csr_col_ind is computed by the the number of blocks in the BSR matrix multiplied by the product of the block dimensions.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsr2csr_compress()#

hipsparseStatus_t hipsparseScsr2csr_compress(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrColIndA, const int *csrRowPtrA, int nnzA, const int *nnzPerRow, float *csrValC, int *csrColIndC, int *csrRowPtrC, float tol)#
hipsparseStatus_t hipsparseDcsr2csr_compress(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrColIndA, const int *csrRowPtrA, int nnzA, const int *nnzPerRow, double *csrValC, int *csrColIndC, int *csrRowPtrC, double tol)#
hipsparseStatus_t hipsparseCcsr2csr_compress(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const hipComplex *csrValA, const int *csrColIndA, const int *csrRowPtrA, int nnzA, const int *nnzPerRow, hipComplex *csrValC, int *csrColIndC, int *csrRowPtrC, hipComplex tol)#
hipsparseStatus_t hipsparseZcsr2csr_compress(hipsparseHandle_t handle, int m, int n, const hipsparseMatDescr_t descrA, const hipDoubleComplex *csrValA, const int *csrColIndA, const int *csrRowPtrA, int nnzA, const int *nnzPerRow, hipDoubleComplex *csrValC, int *csrColIndC, int *csrRowPtrC, hipDoubleComplex tol)#

Convert a sparse CSR matrix into a compressed sparse CSR matrix.

hipsparseXcsr2csr_compress converts a CSR matrix into a compressed CSR matrix by removing entries in the input CSR matrix that are below a non-negative threshold tol

Note

In the case of complex matrices only the magnitude of the real part of tol is used.

hipsparseXpruneCsr2csr_bufferSize()#

hipsparseStatus_t hipsparseSpruneCsr2csr_bufferSize(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *threshold, const hipsparseMatDescr_t descrC, const float *csrValC, const int *csrRowPtrC, const int *csrColIndC, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneCsr2csr_bufferSize(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, const double *threshold, const hipsparseMatDescr_t descrC, const double *csrValC, const int *csrRowPtrC, const int *csrColIndC, size_t *bufferSize)#

Convert and prune sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csr_bufferSize returns the size of the temporary buffer that is required by hipsparseXpruneCsr2csrNnz and hipsparseXpruneCsr2csr. The temporary storage buffer must be allocated by the user.

hipsparseXpruneCsr2csr_bufferSizeExt()#

hipsparseStatus_t hipsparseSpruneCsr2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *threshold, const hipsparseMatDescr_t descrC, const float *csrValC, const int *csrRowPtrC, const int *csrColIndC, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneCsr2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, const double *threshold, const hipsparseMatDescr_t descrC, const double *csrValC, const int *csrRowPtrC, const int *csrColIndC, size_t *bufferSize)#

Convert and prune sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csr_bufferSizeExt returns the size of the temporary buffer that is required by hipsparseXpruneCsr2csrNnz and hipsparseXpruneCsr2csr. The temporary storage buffer must be allocated by the user.

hipsparseXpruneCsr2csrNnz()#

hipsparseStatus_t hipsparseSpruneCsr2csrNnz(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *threshold, const hipsparseMatDescr_t descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, void *buffer)#
hipsparseStatus_t hipsparseDpruneCsr2csrNnz(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, const double *threshold, const hipsparseMatDescr_t descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, void *buffer)#

Convert and prune sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csrNnz computes the number of nonzero elements per row and the total number of nonzero elements in a sparse CSR matrix once elements less than the threshold are pruned from the matrix.

Note

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXpruneCsr2csr()#

hipsparseStatus_t hipsparseSpruneCsr2csr(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, const float *threshold, const hipsparseMatDescr_t descrC, float *csrValC, const int *csrRowPtrC, int *csrColIndC, void *buffer)#
hipsparseStatus_t hipsparseDpruneCsr2csr(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, const double *threshold, const hipsparseMatDescr_t descrC, double *csrValC, const int *csrRowPtrC, int *csrColIndC, void *buffer)#

Convert and prune sparse CSR matrix into a sparse CSR matrix.

This function converts the sparse CSR matrix A into a sparse CSR matrix C by pruning values in A that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user. The user first calls hipsparseXpruneCsr2csr_bufferSize() to determine the size of the buffer used by hipsparseXpruneCsr2csrNnz() and hipsparseXpruneCsr2csr() which the user then allocates. The user then allocates csr_row_ptr_C to have m+1 elements and then calls hipsparseXpruneCsr2csrNnz() which fills in the csr_row_ptr_C array stores then number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. The user then calls hipsparseXpruneCsr2csr() to complete the conversion. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXpruneCsr2csrByPercentage_bufferSize()#

hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage_bufferSize(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, float percentage, const hipsparseMatDescr_t descrC, const float *csrValC, const int *csrRowPtrC, const int *csrColIndC, pruneInfo_t info, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage_bufferSize(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, double percentage, const hipsparseMatDescr_t descrC, const double *csrValC, const int *csrRowPtrC, const int *csrColIndC, pruneInfo_t info, size_t *bufferSize)#

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csrByPercentage_bufferSize returns the size of the temporary buffer that is required by hipsparseXpruneCsr2csrNnzByPercentage. The temporary storage buffer must be allocated by the user.

hipsparseXpruneCsr2csrByPercentage_bufferSizeExt()#

hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, float percentage, const hipsparseMatDescr_t descrC, const float *csrValC, const int *csrRowPtrC, const int *csrColIndC, pruneInfo_t info, size_t *bufferSize)#
hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, double percentage, const hipsparseMatDescr_t descrC, const double *csrValC, const int *csrRowPtrC, const int *csrColIndC, pruneInfo_t info, size_t *bufferSize)#

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csrByPercentage_bufferSizeExt returns the size of the temporary buffer that is required by hipsparseXpruneCsr2csrNnzByPercentage. The temporary storage buffer must be allocated by the user.

hipsparseXpruneCsr2csrNnzByPercentage()#

hipsparseStatus_t hipsparseSpruneCsr2csrNnzByPercentage(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, float percentage, const hipsparseMatDescr_t descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, pruneInfo_t info, void *buffer)#
hipsparseStatus_t hipsparseDpruneCsr2csrNnzByPercentage(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, double percentage, const hipsparseMatDescr_t descrC, int *csrRowPtrC, int *nnzTotalDevHostPtr, pruneInfo_t info, void *buffer)#

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

hipsparseXpruneCsr2csrNnzByPercentage computes the number of nonzero elements per row and the total number of nonzero elements in a sparse CSR matrix once elements less than the threshold are pruned from the matrix.

Note

The routine does support asynchronous execution if the pointer mode is set to device.

hipsparseXpruneCsr2csrByPercentage()#

hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const float *csrValA, const int *csrRowPtrA, const int *csrColIndA, float percentage, const hipsparseMatDescr_t descrC, float *csrValC, const int *csrRowPtrC, int *csrColIndC, pruneInfo_t info, void *buffer)#
hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage(hipsparseHandle_t handle, int m, int n, int nnzA, const hipsparseMatDescr_t descrA, const double *csrValA, const int *csrRowPtrA, const int *csrColIndA, double percentage, const hipsparseMatDescr_t descrC, double *csrValC, const int *csrRowPtrC, int *csrColIndC, pruneInfo_t info, void *buffer)#

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

This function converts the sparse CSR matrix A into a sparse CSR matrix C by pruning values in A that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user. The user first calls hipsparseXpruneCsr2csr_bufferSize() to determine the size of the buffer used by hipsparseXpruneCsr2csrNnz() and hipsparseXpruneCsr2csr() which the user then allocates. The user then allocates csr_row_ptr_C to have m+1 elements and then calls hipsparseXpruneCsr2csrNnz() which fills in the csr_row_ptr_C array stores then number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. The user then calls hipsparseXpruneCsr2csr() to complete the conversion. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

hipsparseXhyb2csr()#

hipsparseStatus_t hipsparseShyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, float *csrSortedValA, int *csrSortedRowPtrA, int *csrSortedColIndA)#
hipsparseStatus_t hipsparseDhyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, double *csrSortedValA, int *csrSortedRowPtrA, int *csrSortedColIndA)#
hipsparseStatus_t hipsparseChyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, hipComplex *csrSortedValA, int *csrSortedRowPtrA, int *csrSortedColIndA)#
hipsparseStatus_t hipsparseZhyb2csr(hipsparseHandle_t handle, const hipsparseMatDescr_t descrA, const hipsparseHybMat_t hybA, hipDoubleComplex *csrSortedValA, int *csrSortedRowPtrA, int *csrSortedColIndA)#

Convert a sparse HYB matrix into a sparse CSR matrix.

hipsparseXhyb2csr converts a HYB matrix into a CSR matrix.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcoo2csr()#

hipsparseStatus_t hipsparseXcoo2csr(hipsparseHandle_t handle, const int *cooRowInd, int nnz, int m, int *csrRowPtr, hipsparseIndexBase_t idxBase)#

Convert a sparse COO matrix into a sparse CSR matrix.

hipsparseXcoo2csr converts the COO array containing the row indices into a CSR array of row offsets, that point to the start of every row. It is assumed that the COO row index array is sorted.

Note

It can also be used, to convert a COO array containing the column indices into a CSC array of column offsets, that point to the start of every column. Then, it is assumed that the COO column index array is sorted, instead.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseCreateIdentityPermutation()#

hipsparseStatus_t hipsparseCreateIdentityPermutation(hipsparseHandle_t handle, int n, int *p)#

Create the identity map.

hipsparseCreateIdentityPermutation stores the identity map in p, such that \(p = 0:1:(n-1)\).

for(i = 0; i < n; ++i)
{
    p[i] = i;
}

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcsrsort_bufferSizeExt()#

hipsparseStatus_t hipsparseXcsrsort_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, const int *csrRowPtr, const int *csrColInd, size_t *pBufferSizeInBytes)#

Sort a sparse CSR matrix.

hipsparseXcsrsort_bufferSizeExt returns the size of the temporary storage buffer in bytes required by hipsparseXcsrsort(). The temporary storage buffer must be allocated by the user.

hipsparseXcsrsort()#

hipsparseStatus_t hipsparseXcsrsort(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, const int *csrRowPtr, int *csrColInd, int *P, void *pBuffer)#

Sort a sparse CSR matrix.

hipsparseXcsrsort sorts a matrix in CSR format. The sorted permutation vector perm can be used to obtain sorted csr_val array. In this case, perm must be initialized as the identity permutation, see hipsparseCreateIdentityPermutation().

hipsparseXcsrsort requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by hipsparseXcsrsort_bufferSizeExt().

Note

perm can be NULL if a sorted permutation vector is not required.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcscsort_bufferSizeExt()#

hipsparseStatus_t hipsparseXcscsort_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, const int *cscColPtr, const int *cscRowInd, size_t *pBufferSizeInBytes)#

Sort a sparse CSC matrix.

hipsparseXcscsort_bufferSizeExt returns the size of the temporary storage buffer in bytes required by hipsparseXcscsort(). The temporary storage buffer must be allocated by the user.

hipsparseXcscsort()#

hipsparseStatus_t hipsparseXcscsort(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, const int *cscColPtr, int *cscRowInd, int *P, void *pBuffer)#

Sort a sparse CSC matrix.

hipsparseXcscsort sorts a matrix in CSC format. The sorted permutation vector perm can be used to obtain sorted csc_val array. In this case, perm must be initialized as the identity permutation, see hipsparseCreateIdentityPermutation().

hipsparseXcscsort requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by hipsparseXcscsort_bufferSizeExt().

Note

perm can be NULL if a sorted permutation vector is not required.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcoosort_bufferSizeExt()#

hipsparseStatus_t hipsparseXcoosort_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, const int *cooRows, const int *cooCols, size_t *pBufferSizeInBytes)#

Sort a sparse COO matrix.

hipsparseXcoosort_bufferSizeExt returns the size of the temporary storage buffer in bytes required by hipsparseXcoosort(). The temporary storage buffer must be allocated by the user.

hipsparseXcoosortByRow()#

hipsparseStatus_t hipsparseXcoosortByRow(hipsparseHandle_t handle, int m, int n, int nnz, int *cooRows, int *cooCols, int *P, void *pBuffer)#

Sort a sparse COO matrix by row.

hipsparseXcoosortByRow sorts a matrix in COO format by row. The sorted permutation vector perm can be used to obtain sorted coo_val array. In this case, perm must be initialized as the identity permutation, see hipsparseCreateIdentityPermutation().

hipsparseXcoosortByRow requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by hipsparseXcoosort_bufferSizeExt().

Note

perm can be NULL if a sorted permutation vector is not required.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXcoosortByColumn()#

hipsparseStatus_t hipsparseXcoosortByColumn(hipsparseHandle_t handle, int m, int n, int nnz, int *cooRows, int *cooCols, int *P, void *pBuffer)#

Sort a sparse COO matrix by column.

hipsparseXcoosortByColumn sorts a matrix in COO format by column. The sorted permutation vector perm can be used to obtain sorted coo_val array. In this case, perm must be initialized as the identity permutation, see hipsparseCreateIdentityPermutation().

hipsparseXcoosortByColumn requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by hipsparseXcoosort_bufferSizeExt().

Note

perm can be NULL if a sorted permutation vector is not required.

Note

This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

hipsparseXgebsr2gebsr_bufferSize()#

hipsparseStatus_t hipsparseSgebsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const float *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, int rowBlockDimC, int colBlockDimC, int *bufferSize)#
hipsparseStatus_t hipsparseDgebsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const double *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, int rowBlockDimC, int colBlockDimC, int *bufferSize)#
hipsparseStatus_t hipsparseCgebsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const hipComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, int rowBlockDimC, int colBlockDimC, int *bufferSize)#
hipsparseStatus_t hipsparseZgebsr2gebsr_bufferSize(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const hipDoubleComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, int rowBlockDimC, int colBlockDimC, int *bufferSize)#

This function computes the the size of the user allocated temporary storage buffer used when converting a sparse general BSR matrix to another sparse general BSR matrix.

hipsparseXgebsr2gebsr_bufferSize returns the size of the temporary storage buffer that is required by hipsparseXgebsr2gebsrNnz() and hipsparseXgebsr2gebsr(). The temporary storage buffer must be allocated by the user.

hipsparseXgebsr2gebsrNnz()#

hipsparseStatus_t hipsparseXgebsr2gebsrNnz(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, const hipsparseMatDescr_t descrC, int *bsrRowPtrC, int rowBlockDimC, int colBlockDimC, int *nnzTotalDevHostPtr, void *buffer)#

This function is used when converting a general BSR sparse matrix A to another general BSR sparse matrix C. Specifically, this function determines the number of non-zero blocks that will exist in C (stored using either a host or device pointer), and computes the row pointer array for C.

The routine does support asynchronous execution.

hipsparseXgebsr2gebsr()#

hipsparseStatus_t hipsparseSgebsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const float *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, const hipsparseMatDescr_t descrC, float *bsrValC, int *bsrRowPtrC, int *bsrColIndC, int rowBlockDimC, int colBlockDimC, void *buffer)#
hipsparseStatus_t hipsparseDgebsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const double *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, const hipsparseMatDescr_t descrC, double *bsrValC, int *bsrRowPtrC, int *bsrColIndC, int rowBlockDimC, int colBlockDimC, void *buffer)#
hipsparseStatus_t hipsparseCgebsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const hipComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, const hipsparseMatDescr_t descrC, hipComplex *bsrValC, int *bsrRowPtrC, int *bsrColIndC, int rowBlockDimC, int colBlockDimC, void *buffer)#
hipsparseStatus_t hipsparseZgebsr2gebsr(hipsparseHandle_t handle, hipsparseDirection_t dirA, int mb, int nb, int nnzb, const hipsparseMatDescr_t descrA, const hipDoubleComplex *bsrValA, const int *bsrRowPtrA, const int *bsrColIndA, int rowBlockDimA, int colBlockDimA, const hipsparseMatDescr_t descrC, hipDoubleComplex *bsrValC, int *bsrRowPtrC, int *bsrColIndC, int rowBlockDimC, int colBlockDimC, void *buffer)#

This function converts the general BSR sparse matrix A to another general BSR sparse matrix C.

The conversion uses three steps. First, the user calls hipsparseXgebsr2gebsr_bufferSize() to determine the size of the required temporary storage buffer. The user then allocates this buffer. Secondly, the user then allocates mb_C+1 integers for the row pointer array for C where mb_C=(m+row_block_dim_C-1)/row_block_dim_C. The user then calls hipsparseXgebsr2gebsrNnz() to fill in the row pointer array for C ( bsr_row_ptr_C ) and determine the number of non-zero blocks that will exist in C. Finally, the user allocates space for the colimn indices array of C to have nnzb_C elements and space for the values array of C to have nnzb_C*roc_block_dim_C*col_block_dim_C and then calls hipsparseXgebsr2gebsr() to complete the conversion.

hipsparseXcsru2csr_bufferSizeExt()#

hipsparseStatus_t hipsparseScsru2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, float *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, size_t *pBufferSizeInBytes)#
hipsparseStatus_t hipsparseDcsru2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, double *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, size_t *pBufferSizeInBytes)#
hipsparseStatus_t hipsparseCcsru2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, hipComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, size_t *pBufferSizeInBytes)#
hipsparseStatus_t hipsparseZcsru2csr_bufferSizeExt(hipsparseHandle_t handle, int m, int n, int nnz, hipDoubleComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, size_t *pBufferSizeInBytes)#

This function calculates the amount of temporary storage in bytes required for hipsparseXcsru2csr() and hipsparseXcsr2csru().

hipsparseXcsru2csr()#

hipsparseStatus_t hipsparseScsru2csr(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, float *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseDcsru2csr(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, double *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseCcsru2csr(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, hipComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseZcsru2csr(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, hipDoubleComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#

This function converts unsorted CSR format to sorted CSR format. The required temporary storage has to be allocated by the user.

hipsparseXcsr2csru()#

hipsparseStatus_t hipsparseScsr2csru(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, float *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseDcsr2csru(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, double *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseCcsr2csru(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, hipComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#
hipsparseStatus_t hipsparseZcsr2csru(hipsparseHandle_t handle, int m, int n, int nnz, const hipsparseMatDescr_t descrA, hipDoubleComplex *csrVal, const int *csrRowPtr, int *csrColInd, csru2csrInfo_t info, void *pBuffer)#

This function converts sorted CSR format to unsorted CSR format. The required temporary storage has to be allocated by the user.