rocm.bindings.cyhipsparse#
2026-09-24
347 min read time
Applies to Linux and Windows
Advanced Micro Devices, Inc.
Cython declarations for the C-level interface. Use
cimport rocm.bindings.cyhipsparse from your Cython code to access
these declarations directly.
See also
The high-level Python API is documented at rocm.bindings.hipsparse.
# MIT License
#
# Copyright (c) 2021-2026 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This file has been autogenerated, do not modify.
from libc.stdint cimport *
ctypedef bint _Bool # bool is not a reserved keyword in C, _Bool is
from rocm.bindings.cyhip cimport *
cdef extern from "hipsparse/hipsparse.h":
cdef struct hipsparseBfloat16:
uint16_t data
cdef struct hipsparseFloat16:
uint16_t data
cdef struct bsrsv2Info:
pass
cdef struct bsrsm2Info:
pass
cdef struct bsrilu02Info:
pass
cdef struct bsric02Info:
pass
cdef struct csrsv2Info:
pass
cdef struct csrsm2Info:
pass
cdef struct csrilu02Info:
pass
cdef struct csric02Info:
pass
cdef struct csrgemm2Info:
pass
cdef struct pruneInfo:
pass
cdef struct csru2csrInfo:
pass
ctypedef void * hipsparseHandle_t
ctypedef void * hipsparseMatDescr_t
ctypedef void * hipsparseHybMat_t
ctypedef void * hipsparseColorInfo_t
ctypedef bsrsv2Info * bsrsv2Info_t
ctypedef bsrsm2Info * bsrsm2Info_t
ctypedef bsrilu02Info * bsrilu02Info_t
ctypedef bsric02Info * bsric02Info_t
ctypedef csrsv2Info * csrsv2Info_t
ctypedef csrsm2Info * csrsm2Info_t
ctypedef csrilu02Info * csrilu02Info_t
ctypedef csric02Info * csric02Info_t
ctypedef csrgemm2Info * csrgemm2Info_t
ctypedef pruneInfo * pruneInfo_t
ctypedef csru2csrInfo * csru2csrInfo_t
ctypedef enum hipsparseStatus_t:
HIPSPARSE_STATUS_SUCCESS
HIPSPARSE_STATUS_NOT_INITIALIZED
HIPSPARSE_STATUS_ALLOC_FAILED
HIPSPARSE_STATUS_INVALID_VALUE
HIPSPARSE_STATUS_ARCH_MISMATCH
HIPSPARSE_STATUS_MAPPING_ERROR
HIPSPARSE_STATUS_EXECUTION_FAILED
HIPSPARSE_STATUS_INTERNAL_ERROR
HIPSPARSE_STATUS_MATRIX_TYPE_NOT_SUPPORTED
HIPSPARSE_STATUS_ZERO_PIVOT
HIPSPARSE_STATUS_NOT_SUPPORTED
HIPSPARSE_STATUS_INSUFFICIENT_RESOURCES
ctypedef enum hipsparsePointerMode_t:
HIPSPARSE_POINTER_MODE_HOST
HIPSPARSE_POINTER_MODE_DEVICE
ctypedef enum hipsparseAction_t:
HIPSPARSE_ACTION_SYMBOLIC
HIPSPARSE_ACTION_NUMERIC
ctypedef enum hipsparseMatrixType_t:
HIPSPARSE_MATRIX_TYPE_GENERAL
HIPSPARSE_MATRIX_TYPE_SYMMETRIC
HIPSPARSE_MATRIX_TYPE_HERMITIAN
HIPSPARSE_MATRIX_TYPE_TRIANGULAR
ctypedef enum hipsparseFillMode_t:
HIPSPARSE_FILL_MODE_LOWER
HIPSPARSE_FILL_MODE_UPPER
ctypedef enum hipsparseDiagType_t:
HIPSPARSE_DIAG_TYPE_NON_UNIT
HIPSPARSE_DIAG_TYPE_UNIT
ctypedef enum hipsparseIndexBase_t:
HIPSPARSE_INDEX_BASE_ZERO
HIPSPARSE_INDEX_BASE_ONE
ctypedef enum hipsparseOperation_t:
HIPSPARSE_OPERATION_NON_TRANSPOSE
HIPSPARSE_OPERATION_TRANSPOSE
HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE
ctypedef enum hipsparseHybPartition_t:
HIPSPARSE_HYB_PARTITION_AUTO
HIPSPARSE_HYB_PARTITION_USER
HIPSPARSE_HYB_PARTITION_MAX
ctypedef enum hipsparseSolvePolicy_t:
HIPSPARSE_SOLVE_POLICY_NO_LEVEL
HIPSPARSE_SOLVE_POLICY_USE_LEVEL
ctypedef enum hipsparseSideMode_t:
HIPSPARSE_SIDE_LEFT
HIPSPARSE_SIDE_RIGHT
ctypedef enum hipsparseDirection_t:
HIPSPARSE_DIRECTION_ROW
HIPSPARSE_DIRECTION_COLUMN
ctypedef enum hipsparseCsr2CscAlg_t:
HIPSPARSE_CSR2CSC_ALG_DEFAULT
HIPSPARSE_CSR2CSC_ALG1
HIPSPARSE_CSR2CSC_ALG2
# \ingroup aux_module
# \brief Create a hipSPARSE handle.
#
# \details
# \p hipsparseCreate creates the hipSPARSE library context. It must be
# initialized before any other hipSPARSE API function is invoked and must be passed to
# all subsequent library function calls. The handle should be destroyed at the end
# using hipsparseDestroy().
cdef hipsparseStatus_t hipsparseCreate(void ** handle) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a hipSPARSE handle.
#
# \details
# \p hipsparseDestroy destroys the hipSPARSE library context and releases all
# resources used by the hipSPARSE library.
cdef hipsparseStatus_t hipsparseDestroy(void * handle) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Return the string representation of a hipSPARSE status's matching backend status enum name
#
# \details
# \p hipsparseGetErrorName takes a hipSPARSE status as input and first converts it to the matching backend
# status (either \p rocsparse_status or \p cusparseStatus_t). It then returns the string representation of this status
# enum name. If the status is not recognized, the function returns "Unrecognized status code".
#
# For example, \p hipsparseGetErrorName( \ref HIPSPARSE_STATUS_SUCCESS) on a system with a rocSPARSE backend will
# return \p rocsparse_status_success. On a system with a cuSPARSE backend this function would return
# \p CUSPARSE_STATUS_SUCCESS.
cdef const char * hipsparseGetErrorName(hipsparseStatus_t status) noexcept nogil
# \ingroup aux_module
# \brief Return the hipSPARSE status's matching backend status description as a string
#
# \details
# \p hipsparseGetErrorString takes a hipSPARSE status as input and first converts it to the matching backend
# status (either \p rocsparse_status or \p cusparseStatus_t). It then returns the string description of this status.
# If the status is not recognized, the function returns "Unrecognized status code".
cdef const char * hipsparseGetErrorString(hipsparseStatus_t status) noexcept nogil
# \ingroup aux_module
# \brief Get the hipSPARSE version.
#
# \details
# \p hipsparseGetVersion gets the hipSPARSE library version number.
# - patch = version % 100
# - minor = version / 100 % 1000
# - major = version / 100000
cdef hipsparseStatus_t hipsparseGetVersion(void * handle,int * version) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the hipSPARSE git revision.
#
# \details
# \p hipsparseGetGitRevision gets the hipSPARSE library git commit revision (SHA-1).
cdef hipsparseStatus_t hipsparseGetGitRevision(void * handle,char * rev) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Specify the user-defined HIP stream.
#
# \details
# \p hipsparseSetStream specifies the stream to be used by the hipSPARSE library
# context and all subsequent function calls.
cdef hipsparseStatus_t hipsparseSetStream(void * handle,hipStream_t streamId) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the current stream from the library context.
#
# \details
# \p hipsparseGetStream gets the hipSPARSE library context stream which is currently
# used for all subsequent function calls.
cdef hipsparseStatus_t hipsparseGetStream(void * handle,hipStream_t * streamId) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Specify the pointer mode.
#
# \details
# \p hipsparseSetPointerMode specifies the pointer mode to be used by the hipSPARSE
# library context and all subsequent function calls. By default, all values are passed
# by reference on the host. Valid pointer modes are \ref HIPSPARSE_POINTER_MODE_HOST
# or \ref HIPSPARSE_POINTER_MODE_DEVICE.
cdef hipsparseStatus_t hipsparseSetPointerMode(void * handle,hipsparsePointerMode_t mode) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the current pointer mode from the library context.
#
# \details
# \p hipsparseGetPointerMode gets the hipSPARSE library context pointer mode which
# is currently used for all subsequent function calls.
cdef hipsparseStatus_t hipsparseGetPointerMode(void * handle,hipsparsePointerMode_t * mode) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a matrix descriptor.
# \details
# \p hipsparseCreateMatDescr creates a matrix descriptor. It initializes
# \ref hipsparseMatrixType_t to \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# \ref hipsparseIndexBase_t to \ref HIPSPARSE_INDEX_BASE_ZERO. It should be destroyed
# at the end using hipsparseDestroyMatDescr().
cdef hipsparseStatus_t hipsparseCreateMatDescr(void ** descrA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a matrix descriptor.
#
# \details
# \p hipsparseDestroyMatDescr destroys a matrix descriptor and releases all
# resources used by the descriptor.
cdef hipsparseStatus_t hipsparseDestroyMatDescr(void * descrA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Copy a matrix descriptor.
# \details
# \p hipsparseCopyMatDescr copies a matrix descriptor. Both source and destination
# matrix descriptors must be initialized prior to calling \p hipsparseCopyMatDescr.
cdef hipsparseStatus_t hipsparseCopyMatDescr(void * dest,void *const src) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Specify the matrix type of a matrix descriptor.
#
# \details
# \p hipsparseSetMatType sets the matrix type of a matrix descriptor. Valid
# matrix types are \ref HIPSPARSE_MATRIX_TYPE_GENERAL,
# \ref HIPSPARSE_MATRIX_TYPE_SYMMETRIC, \ref HIPSPARSE_MATRIX_TYPE_HERMITIAN, or
# \ref HIPSPARSE_MATRIX_TYPE_TRIANGULAR.
cdef hipsparseStatus_t hipsparseSetMatType(void * descrA,hipsparseMatrixType_t type) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the matrix type of a matrix descriptor.
#
# \details
# \p hipsparseGetMatType returns the matrix type of a matrix descriptor.
cdef hipsparseMatrixType_t hipsparseGetMatType(void *const descrA) noexcept nogil
# \ingroup aux_module
# \brief Specify the matrix fill mode of a matrix descriptor.
#
# \details
# \p hipsparseSetMatFillMode sets the matrix fill mode of a matrix descriptor.
# Valid fill modes are \ref HIPSPARSE_FILL_MODE_LOWER or
# \ref HIPSPARSE_FILL_MODE_UPPER.
cdef hipsparseStatus_t hipsparseSetMatFillMode(void * descrA,hipsparseFillMode_t fillMode) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the matrix fill mode of a matrix descriptor.
#
# \details
# \p hipsparseGetMatFillMode returns the matrix fill mode of a matrix descriptor.
cdef hipsparseFillMode_t hipsparseGetMatFillMode(void *const descrA) noexcept nogil
# \ingroup aux_module
# \brief Specify the matrix diagonal type of a matrix descriptor.
#
# \details
# \p hipsparseSetMatDiagType sets the matrix diagonal type of a matrix
# descriptor. Valid diagonal types are \ref HIPSPARSE_DIAG_TYPE_UNIT or
# \ref HIPSPARSE_DIAG_TYPE_NON_UNIT.
cdef hipsparseStatus_t hipsparseSetMatDiagType(void * descrA,hipsparseDiagType_t diagType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the matrix diagonal type of a matrix descriptor.
#
# \details
# \p hipsparseGetMatDiagType returns the matrix diagonal type of a matrix
# descriptor.
cdef hipsparseDiagType_t hipsparseGetMatDiagType(void *const descrA) noexcept nogil
# \ingroup aux_module
# \brief Specify the index base of a matrix descriptor.
#
# \details
# \p hipsparseSetMatIndexBase sets the index base of a matrix descriptor. Valid
# options are \ref HIPSPARSE_INDEX_BASE_ZERO or \ref HIPSPARSE_INDEX_BASE_ONE.
cdef hipsparseStatus_t hipsparseSetMatIndexBase(void * descrA,hipsparseIndexBase_t base) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Get the index base of a matrix descriptor.
#
# \details
# \p hipsparseGetMatIndexBase returns the index base of a matrix descriptor.
cdef hipsparseIndexBase_t hipsparseGetMatIndexBase(void *const descrA) noexcept nogil
# \ingroup aux_module
# \brief Create a \p HYB matrix structure.
#
# \details
# \p hipsparseCreateHybMat creates a structure that holds the matrix in \p HYB
# storage format. It should be destroyed at the end using hipsparseDestroyHybMat().
cdef hipsparseStatus_t hipsparseCreateHybMat(void ** hybA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a \p HYB matrix structure.
#
# \details
# \p hipsparseDestroyHybMat destroys a \p HYB structure.
cdef hipsparseStatus_t hipsparseDestroyHybMat(void * hybA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a bsrsv2 info structure.
#
# \details
# \p hipsparseCreateBsrsv2Info creates a structure that holds the bsrsv2 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyBsrsv2Info().
cdef hipsparseStatus_t hipsparseCreateBsrsv2Info(bsrsv2Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a bsrsv2 info structure.
#
# \details
# \p hipsparseDestroyBsrsv2Info destroys a bsrsv2 info structure.
cdef hipsparseStatus_t hipsparseDestroyBsrsv2Info(bsrsv2Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a bsrsm2 info structure.
#
# \details
# \p hipsparseCreateBsrsm2Info creates a structure that holds the bsrsm2 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyBsrsm2Info().
cdef hipsparseStatus_t hipsparseCreateBsrsm2Info(bsrsm2Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a bsrsm2 info structure.
#
# \details
# \p hipsparseDestroyBsrsm2Info destroys a bsrsm2 info structure.
cdef hipsparseStatus_t hipsparseDestroyBsrsm2Info(bsrsm2Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a bsrilu02 info structure.
#
# \details
# \p hipsparseCreateBsrilu02Info creates a structure that holds the bsrilu02 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyBsrilu02Info().
cdef hipsparseStatus_t hipsparseCreateBsrilu02Info(bsrilu02Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a bsrilu02 info structure
#
# \details
# \p hipsparseDestroyBsrilu02Info destroys a bsrilu02 info structure.
cdef hipsparseStatus_t hipsparseDestroyBsrilu02Info(bsrilu02Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a bsric02 info structure.
#
# \details
# \p hipsparseCreateBsric02Info creates a structure that holds the bsric02 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyBsric02Info().
cdef hipsparseStatus_t hipsparseCreateBsric02Info(bsric02Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a bsric02 info structure.
#
# \details
# \p hipsparseDestroyBsric02Info destroys a bsric02 info structure.
cdef hipsparseStatus_t hipsparseDestroyBsric02Info(bsric02Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csrsv2 info structure.
#
# \details
# \p hipsparseCreateCsrsv2Info creates a structure that holds the csrsv2 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsrsv2Info().
cdef hipsparseStatus_t hipsparseCreateCsrsv2Info(csrsv2Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csrsv2 info structure.
#
# \details
# \p hipsparseDestroyCsrsv2Info destroys a csrsv2 info structure.
cdef hipsparseStatus_t hipsparseDestroyCsrsv2Info(csrsv2Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csrsm2 info structure.
#
# \details
# \p hipsparseCreateCsrsm2Info creates a structure that holds the csrsm2 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsrsm2Info().
cdef hipsparseStatus_t hipsparseCreateCsrsm2Info(csrsm2Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csrsm2 info structure.
#
# \details
# \p hipsparseDestroyCsrsm2Info destroys a csrsm2 info structure.
cdef hipsparseStatus_t hipsparseDestroyCsrsm2Info(csrsm2Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csrilu02 info structure.
#
# \details
# \p hipsparseCreateCsrilu02Info creates a structure that holds the csrilu02 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsrilu02Info().
cdef hipsparseStatus_t hipsparseCreateCsrilu02Info(csrilu02Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csrilu02 info structure.
#
# \details
# \p hipsparseDestroyCsrilu02Info destroys a csrilu02 info structure.
cdef hipsparseStatus_t hipsparseDestroyCsrilu02Info(csrilu02Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csric02 info structure.
#
# \details
# \p hipsparseCreateCsric02Info creates a structure that holds the csric02 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsric02Info().
cdef hipsparseStatus_t hipsparseCreateCsric02Info(csric02Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csric02 info structure.
#
# \details
# \p hipsparseDestroyCsric02Info destroys a csric02 info structure.
cdef hipsparseStatus_t hipsparseDestroyCsric02Info(csric02Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csru2csr info structure.
#
# \details
# \p hipsparseCreateCsru2csrInfo creates a structure that holds the csru2csr info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsru2csrInfo().
cdef hipsparseStatus_t hipsparseCreateCsru2csrInfo(csru2csrInfo_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csru2csr info structure.
#
# \details
# \p hipsparseDestroyCsru2csrInfo destroys a csru2csr info structure.
cdef hipsparseStatus_t hipsparseDestroyCsru2csrInfo(csru2csrInfo_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a color info structure.
#
# \details
# \p hipsparseCreateColorInfo creates a structure that holds the color info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyColorInfo().
cdef hipsparseStatus_t hipsparseCreateColorInfo(void ** info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a color info structure.
#
# \details
# \p hipsparseDestroyColorInfo destroys a color info structure.
cdef hipsparseStatus_t hipsparseDestroyColorInfo(void * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a csrgemm2 info structure.
#
# \details
# \p hipsparseCreateCsrgemm2Info creates a structure that holds the csrgemm2 info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyCsrgemm2Info().
cdef hipsparseStatus_t hipsparseCreateCsrgemm2Info(csrgemm2Info_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a csrgemm2 info structure.
#
# \details
# \p hipsparseDestroyCsrgemm2Info destroys a csrgemm2 info structure.
cdef hipsparseStatus_t hipsparseDestroyCsrgemm2Info(csrgemm2Info_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Create a prune info structure.
#
# \details
# \p hipsparseCreatePruneInfo creates a structure that holds the prune info data
# that is gathered during the analysis routines. It should be destroyed
# at the end using hipsparseDestroyPruneInfo().
cdef hipsparseStatus_t hipsparseCreatePruneInfo(pruneInfo_t * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup aux_module
# \brief Destroy a prune info structure
#
# \details
# \p hipsparseDestroyPruneInfo destroys a prune info structure.
cdef hipsparseStatus_t hipsparseDestroyPruneInfo(pruneInfo_t info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Scale a sparse vector and add it to a dense vector.
#
# \details
# \p hipsparseXaxpyi multiplies the sparse vector \f$x\f$ with scalar \f$\alpha\f$ and
# adds the result to the dense vector \f$y\f$, such that
#
# \f[
# y := y + \alpha \cdot x
# \f]
#
# \code{.c}
# for(i = 0; i < nnz; ++i)
# {
# y[xInd[i]] = y[xInd[i]] + alpha * xVal[i];
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully without modifying \p y.
# Duplicate indices in \p xInd will result in the corresponding values being added
# multiple times to the same location in \p y.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of vector \f$x\f$. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# xVal array of \p nnz elements containing the values of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[inout]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p nnz is negative,
# \p alpha, \p xVal, \p xInd, or \p y is nullptr when \p nnz is greater than zero,
# or \p idxBase is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
#
cdef hipsparseStatus_t hipsparseSaxpyi(void * handle,int nnz,const float * alpha,const float * xVal,const int * xInd,float * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDaxpyi(void * handle,int nnz,const double * alpha,const double * xVal,const int * xInd,double * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCaxpyi(void * handle,int nnz,const float2 * alpha,const float2 * xVal,const int * xInd,float2 * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZaxpyi(void * handle,int nnz,const double2 * alpha,const double2 * xVal,const int * xInd,double2 * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Compute the dot product of a complex conjugate sparse vector with a dense
# vector.
#
# \details
# \p hipsparseXdotci computes the dot product of the complex conjugate sparse vector
# \f$x\f$ with the dense vector \f$y\f$, such that
# \f[
# result := \bar{x}^H y
# \f]
#
# \code{.c}
# result = 0
# for(i = 0; i < nnz; ++i)
# {
# result += conj(xVal[i]) * y[xInd[i]];
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully with \p result set to zero.
#
# \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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of vector \f$x\f$. Must be non-negative.
# @param[in]
# xVal array of \p nnz values containing the elements of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[in]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[out]
# result pointer to the result, which can be host or device memory.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p result is nullptr, \p nnz is negative,
# \p xVal, \p xInd, or \p y is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED the buffer for the dot product reduction
# could not be allocated.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseCdotci(void * handle,int nnz,const float2 * xVal,const int * xInd,const float2 * y,float2 * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZdotci(void * handle,int nnz,const double2 * xVal,const int * xInd,const double2 * y,double2 * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Compute the dot product of a sparse vector with a dense vector.
#
# \details
# \p hipsparseXdoti computes the dot product of the sparse vector \f$x\f$ with the
# dense vector \f$y\f$, such that
# \f[
# result := y^T x
# \f]
#
# \code{.c}
# result = 0
# for(i = 0; i < nnz; ++i)
# {
# result += xVal[i] * y[xInd[i]];
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully with \p result set to zero.
#
# \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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of vector \f$x\f$. Must be non-negative.
# @param[in]
# xVal array of \p nnz values containing the elements of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[in]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[out]
# result pointer to the result, which can be host or device memory.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p result is nullptr, \p nnz is negative,
# \p xVal, \p xInd, or \p y is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED the buffer for the dot product reduction
# could not be allocated.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSdoti(void * handle,int nnz,const float * xVal,const int * xInd,const float * y,float * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDdoti(void * handle,int nnz,const double * xVal,const int * xInd,const double * y,double * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCdoti(void * handle,int nnz,const float2 * xVal,const int * xInd,const float2 * y,float2 * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZdoti(void * handle,int nnz,const double2 * xVal,const int * xInd,const double2 * y,double2 * result,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Gather elements from a dense vector and store them in a sparse vector.
#
# \details
# \p hipsparseXgthr gathers the elements that are listed in \p xInd from the dense
# vector \f$y\f$ and stores them in the sparse vector \f$x\f$.
#
# \code{.c}
# for(i = 0; i < nnz; ++i)
# {
# xVal[i] = y[xInd[i]];
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully without modifying \p xVal.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of \f$x\f$. Must be non-negative.
# @param[in]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[out]
# xVal array of \p nnz elements that will contain the gathered values of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p nnz is negative,
# \p y, \p xVal, or \p xInd is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
#
cdef hipsparseStatus_t hipsparseSgthr(void * handle,int nnz,const float * y,float * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgthr(void * handle,int nnz,const double * y,double * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgthr(void * handle,int nnz,const float2 * y,float2 * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgthr(void * handle,int nnz,const double2 * y,double2 * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Gather and zero out elements from a dense vector and store them in a sparse
# vector.
#
# \details
# \p hipsparseXgthrz gathers the elements that are listed in \p xInd from the dense
# vector \f$y\f$ and stores them in the sparse vector \f$x\f$. The gathered elements
# in \f$y\f$ are replaced by zero.
#
# \code{.c}
# for(i = 0; i < nnz; ++i)
# {
# xVal[i] = y[xInd[i]];
# y[xInd[i]] = 0;
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully without modifying \p xVal or \p y.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of \f$x\f$. Must be non-negative.
# @param[inout]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd. Gathered elements
# are set to zero.
# @param[out]
# xVal array of \p nnz elements that will contain the gathered values of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p nnz is negative,
# \p y, \p xVal, or \p xInd is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
#
cdef hipsparseStatus_t hipsparseSgthrz(void * handle,int nnz,float * y,float * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgthrz(void * handle,int nnz,double * y,double * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgthrz(void * handle,int nnz,float2 * y,float2 * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgthrz(void * handle,int nnz,double2 * y,double2 * xVal,const int * xInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Apply the Givens rotation to a dense and a sparse vector.
#
# \details
# \p hipsparseXroti applies the Givens rotation matrix \f$G\f$ to the sparse vector
# \f$x\f$ and the dense vector \f$y\f$, where
# \f[
# G = \begin{pmatrix} c & s \\ -s & c \end{pmatrix}
# \f]
#
# \code{.c}
# for(i = 0; i < nnz; ++i)
# {
# x_tmp = xVal[i];
# y_tmp = y[xInd[i]];
#
# xVal[i] = c * x_tmp + s * y_tmp;
# y[xInd[i]] = c * y_tmp - s * x_tmp;
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully without modifying \p xVal or \p y.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of \f$x\f$. Must be non-negative.
# @param[inout]
# xVal array of \p nnz elements containing the non-zero values of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[inout]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[in]
# c pointer to the cosine element of \f$G\f$, which can be on host or device.
# @param[in]
# s pointer to the sine element of \f$G\f$, which can be on host or device.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p c, or \p s is nullptr, \p nnz is negative,
# \p xVal, \p xInd, or \p y is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
#
cdef hipsparseStatus_t hipsparseSroti(void * handle,int nnz,float * xVal,const int * xInd,float * y,const float * c,const float * s,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDroti(void * handle,int nnz,double * xVal,const int * xInd,double * y,const double * c,const double * s,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level1_module
# \brief Scatter elements from a dense vector across a sparse vector.
#
# \details
# \p hipsparseXsctr scatters the elements that are listed in \p xInd from the sparse
# vector \f$x\f$ into the dense vector \f$y\f$. Indices of \f$y\f$ that are not listed
# in \p xInd remain unchanged.
#
# \code{.c}
# for(i = 0; i < nnz; ++i)
# {
# y[xInd[i]] = xVal[i];
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# If \p nnz is zero, the function returns successfully without modifying \p y.
# Duplicate indices in \p xInd will result in the last value being written to \p y.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# nnz number of non-zero entries of \f$x\f$. Must be non-negative.
# @param[in]
# xVal array of \p nnz elements containing the non-zero values of \f$x\f$.
# @param[in]
# xInd array of \p nnz elements containing the indices of the non-zero
# values of \f$x\f$.
# @param[inout]
# y array of values in dense format. Must be pre-allocated with sufficient
# size to accommodate all indices specified in \p xInd.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p nnz is negative,
# \p xVal, \p xInd, or \p y is nullptr when \p nnz is greater than zero, or \p idxBase
# is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
#
cdef hipsparseStatus_t hipsparseSsctr(void * handle,int nnz,const float * xVal,const int * xInd,float * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDsctr(void * handle,int nnz,const double * xVal,const int * xInd,double * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCsctr(void * handle,int nnz,const float2 * xVal,const int * xInd,float2 * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZsctr(void * handle,int nnz,const double2 * xVal,const int * xInd,double2 * y,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse matrix vector multiplication using the BSR storage format.
#
# \details
# \p hipsparseXbsrmv multiplies the scalar \f$\alpha\f$ with a sparse
# \f$m \times n\f$ matrix, defined in BSR storage format, and the dense vector \f$x\f$ and adds the
# result to the dense vector \f$y\f$ that is multiplied by the scalar \f$\beta\f$, such that
# \f[
# y := \alpha \cdot op(A) \cdot x + \beta \cdot y,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if trans == HIPSPARSE_OPERATION_NON_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and where \f$m = mb \times blockDim\f$ and \f$n= nb \times blockDim\f$.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix. Must be non-negative.
# @param[in]
# nb number of block columns of the sparse BSR matrix. Must be non-negative.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb elements containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix. Must be positive.
# @param[in]
# x array of \p nb*blockDim elements (\f$op(A) = A\f$) or \p mb*blockDim
# elements (\f$op(A) = A^T\f$ or \f$op(A) = A^H\f$).
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# y array of \p mb*blockDim elements (\f$op(A) = A\f$) or \p nb*blockDim
# elements (\f$op(A) = A^T\f$ or \f$op(A) = A^H\f$).
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p alpha, or \p beta is nullptr,
# \p mb, \p nb, or \p nnzb is negative, \p blockDim is less than or equal to zero, or
# \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA, \p x, or \p y is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p transA is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE
# or \ref hipsparseMatrixType_t is not \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrmv(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nb,int nnzb,const float * alpha,void *const descrA,const float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,const float * x,const float * beta,float * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrmv(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nb,int nnzb,const double * alpha,void *const descrA,const double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,const double * x,const double * beta,double * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrmv(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nb,int nnzb,const float2 * alpha,void *const descrA,const float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,const float2 * x,const float2 * beta,float2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrmv(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nb,int nnzb,const double2 * alpha,void *const descrA,const double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,const double2 * x,const double2 * beta,double2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXbsrsv2_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseSbsrsv2_analysis
# "hipsparseXbsrsv2_analysis()" or \ref hipsparseSbsrsv2_solve "hipsparseXbsrsv2_solve()"
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position,
# using the same index base as the BSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXbsrsv2_zeroPivot is a blocking function. It might negatively
# influence performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXbsrsv2_zeroPivot(void * handle,bsrsv2Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXbsrsv2_bufferSize returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseSbsrsv2_analysis "hipsparseXbsrsv2_analysis()" and
# \ref hipsparseSbsrsv2_solve "hipsparseXbsrsv2_solve()". The temporary storage buffer must
# be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnz containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSbsrsv2_analysis "hipsparseXbsrsv2_analysis()" and
# \ref hipsparseSbsrsv2_solve "hipsparseXbsrsv2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim,
# \p descr, \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA,
# \p info, or \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsv2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsv2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsv2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsv2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXbsrsv2_bufferSizeExt returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseSbsrsv2_analysis "hipsparseXbsrsv2_analysis()" and
# \ref hipsparseSbsrsv2_solve "hipsparseXbsrsv2_solve()". The temporary storage buffer must be
# allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnz containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSbsrsv2_analysis "hipsparseXbsrsv2_analysis()" and
# \ref hipsparseSbsrsv2_solve "hipsparseXbsrsv2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim,
# \p descr, \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA,
# \p info, or \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsv2_bufferSizeExt(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsv2_bufferSizeExt(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsv2_bufferSizeExt(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsv2_bufferSizeExt(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXbsrsv2_analysis performs the analysis step for \ref hipsparseSbsrsv2_solve
# "hipsparseXbsrsv2_solve()". It is expected that this function will be executed only once
# for a given matrix and particular operation type.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnz containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[out]
# info structure that holds the information collected during
# the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim,
# \p descrA, \p bsrSortedRowPtrA, \p bsrSortedColIndA, \p info, or
# \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsv2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,const float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsv2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,const double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsv2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,const float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsv2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,void *const descrA,const double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse triangular solve using the BSR storage format.
#
# \details
# \p hipsparseXbsrsv2_solve solves a sparse triangular linear system of a sparse
# \f$m \times m\f$ matrix, defined in BSR storage format, a dense solution vector
# \f$y\f$ and the right-hand side \f$x\f$ that is multiplied by \f$\alpha\f$, such that
# \f[
# op(A) \cdot y = \alpha \cdot x,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if trans == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if trans == HIPSPARSE_OPERATION_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# Performing the above operation requires three steps. First, the user calls
# \ref hipsparseSbsrsv2_bufferSize "hipsparseXbsrsv2_bufferSize()", which will determine the size of the required
# temporary storage buffer. The user then allocates this buffer and calls
# \ref hipsparseSbsrsv2_analysis "hipsparseXbsrsv2_analysis()", which will perform analysis on the sparse matrix
# \f$op(A)\f$. Finally, the user completes the computation by calling \p hipsparseXbsrsv2_solve. The buffer size,
# buffer allocation, and analysis only need to be called once for a given sparse matrix \f$op(A)\f$, while the
# computation stage can be repeatedly used with different \f$x\f$ and \f$y\f$ vectors. After all calls to
# \p hipsparseXbsrsv2_solve are complete, the temporary buffer can be deallocated.
#
# Solving a triangular system involves inverting the diagonal blocks. This means that if the sparse matrix is
# missing the diagonal block (referred to as a structural zero) or the diagonal block is not invertible (referred
# to as a numerical zero) then a solution is not possible. \p hipsparseXbsrsv2_solve tracks the location of the first
# zero pivot (either numerical or structural zero). The zero pivot status can be checked calling \ref hipsparseXbsrsv2_zeroPivot().
# If \ref hipsparseXbsrsv2_zeroPivot() returns \ref HIPSPARSE_STATUS_SUCCESS, then no zero pivot was found and therefore
# the matrix does not have a structural or numerical zero.
#
# The user can specify that the sparse matrix should be interpreted as having identity blocks on the diagonal by setting the diagonal
# type on the descriptor \p descrA to \ref HIPSPARSE_DIAG_TYPE_UNIT using \ref hipsparseSetMatDiagType. If
# \ref hipsparseDiagType_t == \ref HIPSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if the diagonal block \f$A_{j,j}\f$
# for some \f$j\f$ is not invertible.
#
# The sparse CSR matrix passed to \p hipsparseXbsrsv2_solve does not actually have to be a triangular matrix. Instead, the
# triangular upper or lower part of the sparse matrix is solved based on \ref hipsparseFillMode_t set on the descriptor
# \p descrA. If the fill mode is set to \ref HIPSPARSE_FILL_MODE_LOWER, then the lower triangular matrix is solved. If the
# fill mode is set to \ref HIPSPARSE_FILL_MODE_UPPER, then the upper triangular matrix is solved.
#
# \note
# The sparse BSR matrix has to be sorted.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE and
# \p transA == \ref HIPSPARSE_OPERATION_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnz containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# f array of \p m elements, holding the right-hand side.
# @param[out]
# x array of \p m elements, holding the solution.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim,
# \p descrA, \p alpha, \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA,
# \p f, or \p x is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsv2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,const float * alpha,void *const descrA,const float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,const float * f,float * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsv2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,const double * alpha,void *const descrA,const double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,const double * f,double * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsv2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,const float2 * alpha,void *const descrA,const float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,const float2 * f,float2 * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsv2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,int mb,int nnzb,const double2 * alpha,void *const descrA,const double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsv2Info_t info,const double2 * f,double2 * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse matrix vector multiplication with mask operation using the BSR storage format.
#
# \details
# \p hipsparseXbsrxmv multiplies the scalar \f$\alpha\f$ with a sparse
# \f$(mb \times \text{blockDim}) \times (nb \times \text{blockDim})\f$
# modified matrix, defined in BSR storage format, and the dense vector \f$x\f$ and adds the
# result to the dense vector \f$y\f$ that is multiplied by the scalar \f$\beta\f$,
# such that
# \f[
# y := \left( \alpha \cdot op(A) \cdot x + \beta \cdot y \right)\left( \text{mask} \right),
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if trans == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if trans == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if trans == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# The \f$\text{mask}\f$ is defined as an array of block row indices.
# The input sparse matrix is defined with a modified BSR storage format where the beginning and the end of each row
# is defined with two arrays, \p bsrRowPtr and \p bsr_end_ptr (both of size \p mb), rather the usual \p bsrRowPtr of size \p mb+1.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p trans == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported,
# and \p blockDim == 1 is not supported.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dir matrix storage of BSR blocks.
# @param[in]
# trans matrix operation type.
# @param[in]
# sizeOfMask number of updated block rows of the array \p y. Must be non-negative and
# not greater than \p mb.
# @param[in]
# mb number of block rows of the sparse BSR matrix. Must be non-negative.
# @param[in]
# nb number of block columns of the sparse BSR matrix. Must be non-negative.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descr descriptor of the sparse BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# bsrVal array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrMaskPtr array of \p sizeOfMask elements that give the indices of the updated block rows.
# @param[in]
# bsrRowPtr array of \p mb elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrEndPtr array of \p mb elements that point to the end of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrColInd array of \p nnzb elements containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix. Must be greater than 1.
# @param[in]
# x array of \p nb*blockDim elements (\f$op(A) = A\f$) or \p mb*blockDim
# elements (\f$op(A) = A^T\f$ or \f$op(A) = A^H\f$).
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# y array of \p mb*blockDim elements (\f$op(A) = A\f$) or \p nb*blockDim
# elements (\f$op(A) = A^T\f$ or \f$op(A) = A^H\f$).
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p alpha, or \p beta is nullptr,
# \p mb, \p nb, \p nnzb, or \p sizeOfMask is negative, \p sizeOfMask is greater than \p mb,
# \p blockDim is less than or equal to 1, or \p bsrVal, \p bsrMaskPtr, \p bsrRowPtr,
# \p bsrEndPtr, \p bsrColInd, \p x, or \p y is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p trans is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE,
# or \ref hipsparseMatrixType_t is not \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrxmv(void * handle,hipsparseDirection_t dir,hipsparseOperation_t trans,int sizeOfMask,int mb,int nb,int nnzb,const float * alpha,void *const descr,const float * bsrVal,const int * bsrMaskPtr,const int * bsrRowPtr,const int * bsrEndPtr,const int * bsrColInd,int blockDim,const float * x,const float * beta,float * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrxmv(void * handle,hipsparseDirection_t dir,hipsparseOperation_t trans,int sizeOfMask,int mb,int nb,int nnzb,const double * alpha,void *const descr,const double * bsrVal,const int * bsrMaskPtr,const int * bsrRowPtr,const int * bsrEndPtr,const int * bsrColInd,int blockDim,const double * x,const double * beta,double * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrxmv(void * handle,hipsparseDirection_t dir,hipsparseOperation_t trans,int sizeOfMask,int mb,int nb,int nnzb,const float2 * alpha,void *const descr,const float2 * bsrVal,const int * bsrMaskPtr,const int * bsrRowPtr,const int * bsrEndPtr,const int * bsrColInd,int blockDim,const float2 * x,const float2 * beta,float2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrxmv(void * handle,hipsparseDirection_t dir,hipsparseOperation_t trans,int sizeOfMask,int mb,int nb,int nnzb,const double2 * alpha,void *const descr,const double2 * bsrVal,const int * bsrMaskPtr,const int * bsrRowPtr,const int * bsrEndPtr,const int * bsrColInd,int blockDim,const double2 * x,const double2 * beta,double2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse matrix vector multiplication using the CSR storage format.
#
# \details
# \p hipsparseXcsrmv multiplies the scalar \f$\alpha\f$ with a sparse \f$m \times n\f$
# matrix, defined in CSR storage format, and the dense vector \f$x\f$ and adds the
# result to the dense vector \f$y\f$ that is multiplied by the scalar \f$\beta\f$,
# such that
# \f[
# y := \alpha \cdot op(A) \cdot x + \beta \cdot y,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \code{.c}
# for(i = 0; i < m; ++i)
# {
# y[i] = beta * y[i];
#
# for(j = csrRowPtr[i]; j < csrRowPtr[i + 1]; ++j)
# {
# y[i] = y[i] + alpha * csrVal[j] * x[csrColInd[j]];
# }
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
#
# \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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the sparse CSR matrix. Must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrix. Must be non-negative.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start
# of every row of the sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# x array of \p n elements (\f$op(A) == A\f$) or \p m elements
# (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# y array of \p m elements (\f$op(A) == A\f$) or \p n elements
# (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p alpha, or \p beta is nullptr,
# \p m, \p n, or \p nnz is negative, or \p csrSortedValA, \p csrSortedRowPtrA,
# \p csrSortedColIndA, \p x, or \p y is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t is not
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrmv(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * x,const float * beta,float * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrmv(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * x,const double * beta,double * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrmv(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * x,const float2 * beta,float2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrmv(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * x,const double2 * beta,double2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXcsrsv2_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during hipsparseScsrsv2_solve(),
# hipsparseDcsrsv2_solve(), hipsparseCcsrsv2_solve(), or hipsparseZcsrsv2_solve()
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position,
# using same index base as the CSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXcsrsv2_zeroPivot is a blocking function. It might negatively
# influence performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXcsrsv2_zeroPivot(void * handle,csrsv2Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXcsrsv2_bufferSize returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseScsrsv2_analysis "hipsparseScsrsv2_analysis()" and
# \ref hipsparseScsrsv2_solve "hipsparseXcsrsv2_solve()". The temporary storage buffer must
# be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsrsv2_analysis "hipsparseXcsrsv2_analysis()" and
# \ref hipsparseScsrsv2_solve "hipsparseXcsrsv2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsv2_bufferSize(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsv2_bufferSize(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsv2_bufferSize(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsv2_bufferSize(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXcsrsv2_bufferSizeExt returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseScsrsv2_analysis "hipsparseXcsrsv2_analysis()" and
# \ref hipsparseScsrsv2_solve "hipsparseScsrsv2_solve()". The temporary storage buffer must be
# allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsrsv2_analysis "hipsparseXcsrsv2_analysis()" and
# \ref hipsparseScsrsv2_solve "hipsparseXcsrsv2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsv2_bufferSizeExt(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsv2_bufferSizeExt(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsv2_bufferSizeExt(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsv2_bufferSizeExt(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXcsrsv2_analysis performs the analysis step for
# \ref hipsparseScsrsv2_solve "hipsparseXcsrsv2_solve()". It is expected that this
# function will be executed only once for a given matrix and particular operation
# type.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during
# the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descr,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBuffer is
# invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsv2_analysis(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsv2_analysis(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsv2_analysis(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsv2_analysis(void * handle,hipsparseOperation_t transA,int m,int nnz,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse triangular solve using the CSR storage format
#
# \details
# \p hipsparseXcsrsv2_solve solves a sparse triangular linear system of a sparse
# \f$m \times m\f$ matrix, defined in CSR storage format, a dense solution vector
# \f$y\f$, and the right-hand side \f$x\f$ that is multiplied by \f$\alpha\f$, such that
# \f[
# op(A) \cdot y = \alpha \cdot x,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if trans == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if trans == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if trans == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# Performing the above operation requires three steps. First, the user calls
# \ref hipsparseScsrsv2_bufferSize "hipsparseXcsrsv2_bufferSize()" (or
# \ref hipsparseScsrsv2_bufferSizeExt "hipsparseXcsrsv2_bufferSizeExt()") which will determine the size of the
# required temporary storage buffer. The user then allocates this buffer and calls
# \ref hipsparseScsrsv2_analysis "hipsparseXcsrsv2_analysis()" which will perform analysis on the sparse matrix
# \f$op(A)\f$. Finally, the user completes the computation by calling \p hipsparseXcsrsv2_solve. The buffer size,
# buffer allocation, and analysis only need to be called once for a given sparse matrix \f$op(A)\f$, while the
# computation stage can be repeatedly used with different \f$x\f$ and \f$y\f$ vectors. After all calls to
# \p hipsparseXcsrsv2_solve are complete, the temporary buffer can be deallocated.
#
# Solving a triangular system involves division by the diagonal elements. This means that if the sparse matrix is
# missing the diagonal entry (referred to as a structural zero) or the diagonal entry is zero (referred to as a numerical zero),
# then a division by zero would occur. \p hipsparseXcsrsv2_solve tracks the location of the first zero pivot (either numerical
# or structural zero). The zero pivot status can be checked by calling \ref hipsparseXcsrsv2_zeroPivot(). If
# \ref hipsparseXcsrsv2_zeroPivot() returns \ref HIPSPARSE_STATUS_SUCCESS, then no zero pivot was found and therefore
# the matrix does not have a structural or numerical zero.
#
# The user can specify that the sparse matrix should be interpreted as having ones on the diagonal by setting the diagonal type
# on the descriptor \p descrA to \ref HIPSPARSE_DIAG_TYPE_UNIT using \ref hipsparseSetMatDiagType. If
# \ref hipsparseDiagType_t == \ref HIPSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if \f$A_{j,j} = 0\f$ for
# some \f$j\f$.
#
# The sparse CSR matrix passed to \p hipsparseXcsrsv2_solve does not actually have to be a triangular matrix. Instead, the
# triangular upper or lower part of the sparse matrix is solved based on \ref hipsparseFillMode_t set on the descriptor
# \p descrA. If the fill mode is set to \ref HIPSPARSE_FILL_MODE_LOWER, then the lower triangular matrix is solved. If the
# fill mode is set to \ref HIPSPARSE_FILL_MODE_UPPER, then the upper triangular matrix is solved.
#
# \note
# The sparse CSR matrix has to be sorted. This can be achieved by calling
# hipsparseXcsrsort().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE and
# \p transA == \ref HIPSPARSE_OPERATION_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start
# of every row of the sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# f array of \p m elements, holding the right-hand side.
# @param[out]
# x array of \p m elements, holding the solution.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA,
# \p alpha, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA,
# \p f, or \p x is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsv2_solve(void * handle,hipsparseOperation_t transA,int m,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,const float * f,float * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsv2_solve(void * handle,hipsparseOperation_t transA,int m,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,const double * f,double * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsv2_solve(void * handle,hipsparseOperation_t transA,int m,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,const float2 * f,float2 * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsv2_solve(void * handle,hipsparseOperation_t transA,int m,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrsv2Info_t info,const double2 * f,double2 * x,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \details
# \p hipsparseXgemvi_bufferSize returns the size of the temporary storage buffer in bytes
# required by \ref hipsparseSgemvi "hipsparseXgemvi()". The temporary storage buffer must
# be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the dense matrix.
# @param[in]
# n number of columns of the dense matrix.
# @param[in]
# nnz number of non-zero entries in the sparse vector.
# @param[out]
# pBufferSizeInBytes temporary storage buffer size.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, or
# \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA != \ref HIPSPARSE_OPERATION_NON_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSgemvi_bufferSize(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgemvi_bufferSize(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgemvi_bufferSize(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgemvi_bufferSize(void * handle,hipsparseOperation_t transA,int m,int n,int nnz,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Dense matrix sparse vector multiplication
#
# \details
# \p hipsparseXgemvi multiplies the scalar \f$\alpha\f$ with a dense \f$m \times n\f$
# matrix \f$A\f$ and the sparse vector \f$x\f$ and adds the result to the dense vector
# \f$y\f$ that is multiplied by the scalar \f$\beta\f$, such that
# \f[
# y := \alpha \cdot op(A) \cdot x + \beta \cdot y,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# Performing the above operation involves two steps. First, the user calls
# \ref hipsparseSgemvi_bufferSize "hipsparseXgemvi_bufferSize()" to determine the size of
# the temporary storage buffer. Next, the user allocates this temporary buffer and passes it to
# \p hipsparseXgemvi to complete the computation. After all calls to \p hipsparseXgemvi are complete, the
# temporary storage buffer can be freed.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# m number of rows of the dense matrix.
# @param[in]
# n number of columns of the dense matrix.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# A pointer to the dense matrix.
# @param[in]
# lda leading dimension of the dense matrix.
# @param[in]
# nnz number of non-zero entries in the sparse vector.
# @param[in]
# x array of \p nnz elements containing the values of the sparse vector.
# @param[in]
# xInd array of \p nnz elements containing the indices of the sparse vector.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# y array of \p m elements (\f$op(A) == A\f$) or \p n elements
# (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
# @param[in]
# idxBase \ref HIPSPARSE_INDEX_BASE_ZERO or \ref HIPSPARSE_INDEX_BASE_ONE.
# @param[in]
# pBuffer temporary storage buffer.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p lda, \p nnz, \p alpha,
# \p A, \p x, \p xInd, \p beta, \p y, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA != \ref HIPSPARSE_OPERATION_NON_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSgemvi(void * handle,hipsparseOperation_t transA,int m,int n,const float * alpha,const float * A,int lda,int nnz,const float * x,const int * xInd,const float * beta,float * y,hipsparseIndexBase_t idxBase,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgemvi(void * handle,hipsparseOperation_t transA,int m,int n,const double * alpha,const double * A,int lda,int nnz,const double * x,const int * xInd,const double * beta,double * y,hipsparseIndexBase_t idxBase,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgemvi(void * handle,hipsparseOperation_t transA,int m,int n,const float2 * alpha,const float2 * A,int lda,int nnz,const float2 * x,const int * xInd,const float2 * beta,float2 * y,hipsparseIndexBase_t idxBase,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgemvi(void * handle,hipsparseOperation_t transA,int m,int n,const double2 * alpha,const double2 * A,int lda,int nnz,const double2 * x,const int * xInd,const double2 * beta,double2 * y,hipsparseIndexBase_t idxBase,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level2_module
# \brief Sparse matrix vector multiplication using the HYB storage format.
#
# \details
# \p hipsparseXhybmv multiplies the scalar \f$\alpha\f$ with a sparse \f$m \times n\f$
# matrix, defined in HYB storage format, and the dense vector \f$x\f$ and adds the
# result to the dense vector \f$y\f$ that is multiplied by the scalar \f$\beta\f$,
# such that
# \f[
# y := \alpha \cdot op(A) \cdot x + \beta \cdot y,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
#
# \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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix operation type.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse HYB matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# hybA matrix in HYB storage format.
# @param[in]
# x array of \p n elements (\f$op(A) == A\f$) or \p m elements
# (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# y array of \p m elements (\f$op(A) == A\f$) or \p n elements
# (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p alpha, \p beta, or \p hybA is nullptr,
# or \p x or \p y is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED the buffer could not be allocated.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p transA is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE
# or \ref hipsparseMatrixType_t is not \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseShybmv(void * handle,hipsparseOperation_t transA,const float * alpha,void *const descrA,void *const hybA,const float * x,const float * beta,float * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDhybmv(void * handle,hipsparseOperation_t transA,const double * alpha,void *const descrA,void *const hybA,const double * x,const double * beta,double * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseChybmv(void * handle,hipsparseOperation_t transA,const float2 * alpha,void *const descrA,void *const hybA,const float2 * x,const float2 * beta,float2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZhybmv(void * handle,hipsparseOperation_t transA,const double2 * alpha,void *const descrA,void *const hybA,const double2 * x,const double2 * beta,double2 * y) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse matrix dense matrix multiplication using the BSR storage format.
#
# \details
# \p hipsparseXbsrmm multiplies the scalar \f$\alpha\f$ with a sparse \f$m \times k\f$
# matrix \f$A\f$, defined in BSR storage format, and the column-oriented dense \f$k \times n\f$
# matrix \f$B\f$ and adds the result to the column-oriented dense \f$m \times n\f$ matrix \f$C\f$ that
# is multiplied by the scalar \f$\beta\f$, such that
# \f[
# C := \alpha \cdot op(A) \cdot op(B) + \beta \cdot C,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# \end{array}
# \right.
# \f]
# and
# \f[
# op(B) = \left* \begin{array}{ll}
# B, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# B^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# \end{array}
# \right.
# \f]
# and where \f$k = blockDim \times kb\f$ and \f$m = blockDim \times mb\f$.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks. Can be \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# transA matrix \f$A\f$ operation type. Currently, only \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
# @param[in]
# transB matrix \f$B\f$ operation type. Currently, only \ref HIPSPARSE_OPERATION_NON_TRANSPOSE and \ref HIPSPARSE_OPERATION_TRANSPOSE
# are supported.
# @param[in]
# mb number of block rows of the sparse BSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \f$op(B)\f$ and \f$C\f$. Must be non-negative.
# @param[in]
# kb number of block columns of the sparse BSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# bsrValA array of \p nnzb*blockDim*blockDim elements of the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix \f$A\f$.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse
# BSR matrix \f$A\f$.
# @param[in]
# blockDim size of the blocks in the sparse BSR matrix. Must be positive.
# @param[in]
# B array of dimension \p ldb*n (\f$op(B) == B\f$),
# \p ldb*k otherwise.
# @param[in]
# ldb leading dimension of \f$B\f$, must be at least \f$\max{(1, k)}\f$ (\f$ op(B) == B\f$) where \p k=blockDim*kb,
# \f$\max{(1, n)}\f$ otherwise.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# C array of dimension \p ldc*n.
# @param[in]
# ldc leading dimension of \f$C\f$, must be at least \f$\max{(1, m)}\f$ (\f$ op(A) == A\f$) where \p m=blockDim*mb,
# \f$\max{(1, k)}\f$ where \p k=blockDim*kb otherwise.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p alpha, or \p beta is nullptr,
# \p mb, \p n, \p kb, or \p nnzb is negative, \p ldb or \p ldc is invalid,
# \p blockDim is less than or equal to zero, or \p bsrValA, \p bsrRowPtrA, \p bsrColIndA,
# \p B, or \p C is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p transA is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE,
# \p transB is \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t is not \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrmm(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transB,int mb,int n,int kb,int nnzb,const float * alpha,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,const float * B,int ldb,const float * beta,float * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrmm(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transB,int mb,int n,int kb,int nnzb,const double * alpha,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,const double * B,int ldb,const double * beta,double * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrmm(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transB,int mb,int n,int kb,int nnzb,const float2 * alpha,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,const float2 * B,int ldb,const float2 * beta,float2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrmm(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transB,int mb,int n,int kb,int nnzb,const double2 * alpha,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,const double2 * B,int ldb,const double2 * beta,double2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \details
# \p hipsparseXbsrsm2_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseSbsrsm2_analysis "hipsparseXbsrsm2_analysis()"
# or \ref hipsparseSbsrsm2_solve "hipsparseXbsrsm2_solve()" computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$
# is stored in \p position, using the same index base as the BSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXbsrsm2_zeroPivot is a blocking function. It might negatively
# influence performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXbsrsm2_zeroPivot(void * handle,bsrsm2Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \details
# \p hipsparseXbsrsm2_buffer_size returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseSbsrsm2_analysis "hipsparseXbsrsm2_analysis()" and
# \ref hipsparseSbsrsm2_solve "hipsparseXbsrsm2_solve()". The temporary storage buffer must
# be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transX matrix \f$X\f$ operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(X)\f$.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix \f$A\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSbsrsm2_analysis "hipsparseXbsrsm2_analysis()" and
# \ref hipsparseSbsrsm2_solve "hipsparseXbsrsm2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nrhs, \p nnzb, \p blockDim,
# \p descrA, \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA, \p info, or
# \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transX == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsm2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsm2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsm2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsm2_bufferSize(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse triangular system solve using the BSR storage format.
#
# \details
# \p hipsparseXbsrsm2_analysis performs the analysis step for \ref hipsparseSbsrsm2_solve
# "hipsparseXbsrsm2_solve()". It is expected that this function will be executed only once
# for a given matrix and particular operation type.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transX matrix \f$X\f$ operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(X)\f$.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix \f$A\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrSortedColIndA array of \p nnzb containing the block column indices of the sparse
# BSR matrix \f$A\f$.
# @param[in]
# blockDim block dimension of the sparse BSR matrix \f$A\f$.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nrhs, \p nnzb,
# \p blockDim, \p descrA, \p bsrSortedValA, \p bsrSortedRowPtrA,
# \p bsrSortedColIndA, \p info, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transX == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsm2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,const float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsm2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,const double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsm2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,const float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsm2_analysis(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,void *const descrA,const double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse triangular system solve using the BSR storage format.
#
# \details
# \p hipsparseXbsrsm2_solve solves a sparse triangular linear system of a sparse
# \f$m \times m\f$ matrix, defined in BSR storage format, a column-oriented dense solution matrix
# \f$X\f$ and the column-oriented dense right-hand side matrix \f$B\f$ that is multiplied by \f$\alpha\f$,
# such that
# \f[
# op(A) \cdot op(X) = \alpha \cdot op(B),
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# ,
# \f[
# op(B) = \left* \begin{array}{ll}
# B, & \text{if transX == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# B^T, & \text{if transX == HIPSPARSE_OPERATION_TRANSPOSE} \\
# B^H, & \text{if transX == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and
# \f[
# op(X) = \left* \begin{array}{ll}
# X, & \text{if transX == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# X^T, & \text{if transX == HIPSPARSE_OPERATION_TRANSPOSE} \\
# X^H, & \text{if transX == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and where \f$m = blockDim \times mb\f$.
#
# Note that, as indicated above, the operation type of both \f$op(B)\f$ and \f$op(X)\f$ is specified by the
# \p transX parameter and that the operation type of \f$B\f$ and \f$X\f$ must match. For example, if \f$op(B)=B\f$, then
# \f$op(X)=X\f$. Likewise, if \f$op(B)=B^T\f$, then \f$op(X)=X^T\f$.
#
# Given that the sparse matrix \f$A\f$ is a square matrix, its size is \f$m \times m\f$ regardless of
# whether \f$A\f$ is transposed or not. The size of the column-oriented dense matrices \f$B\f$ and \f$X\f$
# depends on the value of \p transX:
#
# \f[
# op(B) = \left* \begin{array}{ll}
# ldb \times nrhs, \text{ } ldb \ge m, & \text{if transX == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transX == HIPSPARSE_OPERATION_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transX == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and
# \f[
# op(X) = \left* \begin{array}{ll}
# ldb \times nrhs, \text{ } ldb \ge m, & \text{if transX == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transX == HIPSPARSE_OPERATION_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transX == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \p hipsparseXbsrsm2_solve requires a user-allocated temporary buffer. Its size is returned by
# \ref hipsparseSbsrsm2_bufferSize "hipsparseXbsrsm2_bufferSize()". The size of the required buffer is larger
# when \p transA equals \ref HIPSPARSE_OPERATION_TRANSPOSE or \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE and
# when \p transX is \ref HIPSPARSE_OPERATION_NON_TRANSPOSE. The subsequent solve will also be faster when \f$A\f$ is
# non-transposed and \f$B\f$ is transposed (or conjugate transposed). For example, instead of solving:
#
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c}
# a_{00} & a_{01} \\
# a_{10} & a_{11}
# \end{array} &
# \begin{array}{c c}
# 0 & 0 \\
# 0 & 0
# \end{array} \\
# \hline
# \begin{array}{c c}
# a_{20} & a_{21} \\
# a_{30} & a_{31}
# \end{array} &
# \begin{array}{c c}
# a_{22} & a_{23} \\
# a_{32} & a_{33}
# \end{array} \\
# \end{array}
# \right]
# \cdot
# \begin{bmatrix}
# x_{00} & x_{01} \\
# x_{10} & x_{11} \\
# x_{20} & x_{21} \\
# x_{30} & x_{31} \\
# \end{bmatrix}
# =
# \begin{bmatrix}
# b_{00} & b_{01} \\
# b_{10} & b_{11} \\
# b_{20} & b_{21} \\
# b_{30} & b_{31} \\
# \end{bmatrix}
# \f]
#
# Consider solving:
#
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c}
# a_{00} & a_{01} \\
# a_{10} & a_{11}
# \end{array} &
# \begin{array}{c c}
# 0 & 0 \\
# 0 & 0
# \end{array} \\
# \hline
# \begin{array}{c c}
# a_{20} & a_{21} \\
# a_{30} & a_{31}
# \end{array} &
# \begin{array}{c c}
# a_{22} & a_{23} \\
# a_{32} & a_{33}
# \end{array} \\
# \end{array}
# \right]
# \cdot
# \begin{bmatrix}
# x_{00} & x_{10} & x_{20} & x_{30} \\
# x_{01} & x_{11} & x_{21} & x_{31}
# \end{bmatrix}^{T}
# =
# \begin{bmatrix}
# b_{00} & b_{10} & b_{20} & b_{30} \\
# b_{01} & b_{11} & b_{21} & b_{31}
# \end{bmatrix}^{T}
# \f]
#
# After the temporary storage buffer has been allocated, analysis meta data is required. It can be obtained
# by hipsparseSbsrsm2_analysis "hipsparseXbsrsm2_analysis()". The triangular solve is completed by calling
# \p hipsparseXbsrsm2_solve, and after all solves are performed, the temporary storage buffer allocated by the
# user can be freed.
#
# Solving a triangular system involves inverting the diagonal blocks. This means that if the sparse matrix is
# missing the diagonal block (referred to as a structural zero) or the diagonal block is not invertible (referred
# to as a numerical zero), then a solution is not possible. \p hipsparseXbsrsm2_solve tracks the location of the first
# zero pivot (either numerical or structural zero). The zero pivot status can be checked by calling \ref hipsparseXbsrsm2_zeroPivot().
# If \ref hipsparseXbsrsm2_zeroPivot() returns \ref HIPSPARSE_STATUS_SUCCESS, then no zero pivot was found and therefore
# the matrix does not have a structural or numerical zero.
#
# The user can specify that the sparse matrix should be interpreted as having identity blocks on the diagonal by setting the diagonal
# type on the descriptor \p descrA to \ref HIPSPARSE_DIAG_TYPE_UNIT using \ref hipsparseSetMatDiagType. If
# \ref hipsparseDiagType_t == \ref HIPSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if the diagonal block \f$A_{j,j}\f$
# for some \f$j\f$ is not invertible.
#
# The sparse CSR matrix passed to \p hipsparseXbsrsm2_solve does not actually have to be a triangular matrix. Instead, the
# triangular upper or lower part of the sparse matrix is solved based on \ref hipsparseFillMode_t set on the descriptor
# \p descrA. If the fill mode is set to \ref HIPSPARSE_FILL_MODE_LOWER, then the lower triangular matrix is solved. If the
# fill mode is set to \ref HIPSPARSE_FILL_MODE_UPPER, then the upper triangular matrix is solved.
#
# \note
# The sparse BSR matrix has to be sorted.
#
# \note
# Operation type of B and X must match if \f$op(B)=B, op(X)=X\f$.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA != \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE and
# \p transX != \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA matrix storage of BSR blocks.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transX matrix \f$X\f$ operation type.
# @param[in]
# mb number of block rows of the sparse BSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(X)\f$.
# @param[in]
# nnzb number of non-zero blocks of the sparse BSR matrix \f$A\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse BSR matrix \f$A\f$.
# @param[in]
# bsrSortedValA array of \p nnzb blocks of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of
# the sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb containing the block column indices of the sparse
# BSR matrix.
# @param[in]
# blockDim block dimension of the sparse BSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# B rhs matrix B with leading dimension \p ldb.
# @param[in]
# ldb leading dimension of rhs matrix \f$B\f$.
# @param[out]
# X solution matrix X with leading dimension \p ldx.
# @param[in]
# ldx leading dimension of solution matrix \f$X\f$.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nrhs, \p nnzb, \p blockDim,
# \p alpha, \p descrA, \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA,
# \p B, \p X \p info, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transX == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrsm2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,const float * alpha,void *const descrA,const float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,const float * B,int ldb,float * X,int ldx,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrsm2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,const double * alpha,void *const descrA,const double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,const double * B,int ldb,double * X,int ldx,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrsm2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,const float2 * alpha,void *const descrA,const float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,const float2 * B,int ldb,float2 * X,int ldx,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrsm2_solve(void * handle,hipsparseDirection_t dirA,hipsparseOperation_t transA,hipsparseOperation_t transX,int mb,int nrhs,int nnzb,const double2 * alpha,void *const descrA,const double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrsm2Info_t info,const double2 * B,int ldb,double2 * X,int ldx,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse matrix dense matrix multiplication using the CSR storage format.
#
# \details
# \p hipsparseXcsrmm multiplies the scalar \f$\alpha\f$ with a sparse \f$m \times k\f$
# matrix \f$A\f$, defined in CSR storage format, and the column-oriented dense \f$k \times n\f$
# matrix \f$B\f$ and adds the result to the column-oriented dense \f$m \times n\f$ matrix \f$C\f$ that
# is multiplied by the scalar \f$\beta\f$, such that
# \f[
# C := \alpha \cdot op(A) \cdot B + \beta \cdot C,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \code{.c}
# for(i = 0; i < ldc; ++i)
# {
# for(j = 0; j < n; ++j)
# {
# C[i][j] = beta * C[i][j];
#
# for(k = csrRowPtr[i]; k < csrRowPtr[i + 1]; ++k)
# {
# C[i][j] += alpha * csrVal[k] * B[csrColInd[k]][j];
# }
# }
# }
# \endcode
#
# \note
# 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \f$op(B)\f$ and \f$C\f$. Must be non-negative.
# @param[in]
# k number of columns of the sparse CSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix \f$A\f$.
# @param[in]
# B array of dimension \p ldb*n (\f$op(B) == B\f$),
# \p ldb*k otherwise.
# @param[in]
# ldb leading dimension of \f$B\f$, must be at least \f$\max{(1, k)}\f$
# (\f$op(B) == B\f$), \f$\max{(1, n)}\f$ otherwise.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# C array of dimension \p ldc*n.
# @param[in]
# ldc leading dimension of \f$C\f$, must be at least \f$\max{(1, m)}\f$
# (\f$op(A) == A\f$), \f$\max{(1, k)}\f$ otherwise.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p alpha, or \p beta is nullptr,
# \p m, \p n, \p k, or \p nnz is negative, \p ldb or \p ldc is invalid, or
# \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p B, or \p C is nullptr.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t is not
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrmm(void * handle,hipsparseOperation_t transA,int m,int n,int k,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * B,int ldb,const float * beta,float * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrmm(void * handle,hipsparseOperation_t transA,int m,int n,int k,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * B,int ldb,const double * beta,double * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrmm(void * handle,hipsparseOperation_t transA,int m,int n,int k,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * B,int ldb,const float2 * beta,float2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrmm(void * handle,hipsparseOperation_t transA,int m,int n,int k,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * B,int ldb,const double2 * beta,double2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse matrix dense matrix multiplication using the CSR storage format.
#
# \details
# \p hipsparseXcsrmm2 multiplies the scalar \f$\alpha\f$ with a sparse \f$m \times k\f$
# matrix \f$A\f$, defined in CSR storage format, and the column-oriented dense \f$k \times n\f$
# matrix \f$B\f$ and adds the result to the column-oriented dense \f$m \times n\f$ matrix \f$C\f$ that
# is multiplied by the scalar \f$\beta\f$, such that
# \f[
# C := \alpha \cdot op(A) \cdot op(B) + \beta \cdot C,
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and
# \f[
# op(B) = \left* \begin{array}{ll}
# B, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# B^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# B^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \code{.c}
# for(i = 0; i < ldc; ++i)
# {
# for(j = 0; j < n; ++j)
# {
# C[i][j] = beta * C[i][j];
#
# for(k = csrRowPtr[i]; k < csrRowPtr[i + 1]; ++k)
# {
# C[i][j] += alpha * csrVal[k] * B[csrColInd[k]][j];
# }
# }
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$A\f$.
# @param[in]
# n number of columns of the dense matrix \f$op(B)\f$ and \f$C\f$.
# @param[in]
# k number of columns of the sparse CSR matrix \f$A\f$.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix \f$A\f$.
# @param[in]
# B array of dimension \p ldb*n (\f$op(B) == B\f$),
# \p ldb*k otherwise.
# @param[in]
# ldb leading dimension of \f$B\f$. Must be at least \f$\max{(1, k)}\f$
# (\f$op(B) == B\f$), \f$\max{(1, n)}\f$ otherwise.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# C array of dimension \p ldc*n.
# @param[in]
# ldc leading dimension of \f$C\f$. Must be at least \f$\max{(1, m)}\f$
# (\f$op(A) == A\f$), \f$\max{(1, k)}\f$ otherwise.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p k, \p nnz, \p ldb, \p ldc,
# \p descrA, \p alpha, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA,
# \p B, \p beta, or \p C is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrmm2(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * B,int ldb,const float * beta,float * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrmm2(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * B,int ldb,const double * beta,double * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrmm2(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * B,int ldb,const float2 * beta,float2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrmm2(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * B,int ldb,const double2 * beta,double2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \details
# \p hipsparseXcsrsm2_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseScsrsm2_analysis
# "hipsparseXcsrsm2_analysis()" or \ref hipsparseScsrsm2_solve "hipsparseXcsrsm2_solve()"
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position,
# using the same index base as the CSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXcsrsm2_zeroPivot is a blocking function. It might negatively
# influence performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXcsrsm2_zeroPivot(void * handle,csrsm2Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \details
# \p hipsparseXcsrsm2_bufferSizeExt returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseScsrsm2_analysis "hipsparseXcsrsm2_analysis()"
# and \ref hipsparseScsrsm2_solve "hipsparseXcsrsm2_solve()". The temporary storage buffer
# must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo algorithm to use.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(B)\f$.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix \f$A\f$.
# @param[in]
# B array of \p m \f$\times\f$ \p nrhs elements of the rhs matrix \f$B\f$.
# @param[in]
# ldb leading dimension of rhs matrix \f$B\f$.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsrsm2_analysis "hipsparseXcsrsm2_analysis()" and
# \ref hipsparseScsrsm2_solve "hipsparseXcsrsm2_solve()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nrhs, \p nnz, \p alpha,
# \p descrA, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p B,
# \p info, or \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transB == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsm2_bufferSizeExt(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsm2_bufferSizeExt(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsm2_bufferSizeExt(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsm2_bufferSizeExt(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \details
# \p hipsparseXcsrsm2_analysis performs the analysis step for \ref hipsparseScsrsm2_solve
# "hipsparseXcsrsm2_solve()". It is expected that this function will be executed only once
# for a given matrix and particular operation type.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo algorithm to use.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(B)\f$.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix \f$A\f$.
# @param[in]
# B array of \p m \f$\times\f$ \p nrhs elements of the rhs matrix \f$B\f$.
# @param[in]
# ldb leading dimension of rhs matrix \f$B\f$.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nrhs, \p nnz, \p alpha,
# \p descrA, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p B,
# \p info, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transB == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsm2_analysis(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsm2_analysis(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsm2_analysis(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsm2_analysis(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Sparse triangular system solve using the CSR storage format
#
# \details
# \p hipsparseXcsrsm2_solve solves a sparse triangular linear system of a sparse
# \f$m \times m\f$ matrix, defined in CSR storage format, a column-oriented dense solution matrix
# \f$X\f$, and the column-oriented dense right-hand side matrix \f$B\f$ that is multiplied by \f$\alpha\f$, such that
# \f[
# op(A) \cdot op(X) = \alpha \cdot op(B),
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# ,
# \f[
# op(B) = \left* \begin{array}{ll}
# B, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# B^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# B^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and
# \f[
# op(X) = \left* \begin{array}{ll}
# X, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# X^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# X^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# The solution is performed in-place, meaning that the matrix \f$B\f$ is overwritten with the solution
# \f$X\f$ after calling \p hipsparseXcsrsm2_solve. Given that the sparse matrix \f$A\f$ is a square matrix, its
# size is \f$m \times m\f$ regardless of whether \f$A\f$ is transposed or not. The size of the column-oriented dense
# matrices \f$B\f$ and \f$X\f$ depend on the value of \p transB
#
# \f[
# op(B)/op(X) = \left* \begin{array}{ll}
# ldb \times nrhs, \text{ } ldb \ge m, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# ldb \times m, \text{ } ldb \ge nrhs, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# \p hipsparseXcsrsm2_solve requires a user-allocated temporary buffer. Its size is returned by
# \ref hipsparseScsrsm2_bufferSizeExt "hipsparseXcsrsm2_bufferSizeExt()". The size of the required buffer is
# larger when \p transA equals \ref HIPSPARSE_OPERATION_TRANSPOSE or \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE
# and when \p transB is \ref HIPSPARSE_OPERATION_NON_TRANSPOSE. The subsequent solve will also be faster when \f$A\f$
# is non-transposed and \f$B\f$ is transposed (or conjugate transposed). For example, instead of solving:
#
# \f[
# \begin{bmatrix}
# a_{00} & 0 & 0 \\
# a_{10} & a_{11} & 0 \\
# a_{20} & a_{21} & a_{22} \\
# \end{bmatrix}
# \cdot
# \begin{bmatrix}
# x_{00} & x_{01} \\
# x_{10} & x_{11} \\
# x_{20} & x_{21} \\
# \end{bmatrix}
# =
# \begin{bmatrix}
# b_{00} & b_{01} \\
# b_{10} & b_{11} \\
# b_{20} & b_{21} \\
# \end{bmatrix}
# \f]
#
# Consider solving:
#
# \f[
# \begin{bmatrix}
# a_{00} & 0 & 0 \\
# a_{10} & a_{11} & 0 \\
# a_{20} & a_{21} & a_{22}
# \end{bmatrix}
# \cdot
# \begin{bmatrix}
# x_{00} & x_{10} & x_{20} \\
# x_{01} & x_{11} & x_{21}
# \end{bmatrix}^{T}
# =
# \begin{bmatrix}
# b_{00} & b_{10} & b_{20} \\
# b_{01} & b_{11} & b_{21}
# \end{bmatrix}^{T}
# \f]
#
# After the temporary storage buffer has been allocated, analysis meta data is required. It can be obtained by
# \ref hipsparseScsrsm2_analysis "hipsparseXcsrsm2_analysis()". The triangular solve is completed by calling
# \p hipsparseXcsrsm2_solve. After all solves are performed, the temporary storage buffer allocated by the
# user can be freed.
#
# Solving a triangular system involves division by the diagonal elements. This means that if the sparse matrix is
# missing the diagonal entry (referred to as a structural zero) or the diagonal entry is zero (referred to as a numerical zero),
# then a division by zero would occur. \p hipsparseXcsrsm2_solve tracks the location of the first zero pivot (either numerical
# or structural zero). The zero pivot status can be checked by calling \ref hipsparseXcsrsm2_zeroPivot(). If
# \ref hipsparseXcsrsm2_zeroPivot() returns \ref HIPSPARSE_STATUS_SUCCESS, then no zero pivot was found and therefore
# the matrix does not have a structural or numerical zero.
#
# The user can specify that the sparse matrix should be interpreted as having ones on the diagonal by setting the diagonal type
# on the descriptor \p descrA to \ref HIPSPARSE_DIAG_TYPE_UNIT using \ref hipsparseSetMatDiagType. If
# \ref hipsparseDiagType_t == \ref HIPSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if \f$A_{j,j} = 0\f$ for
# some \f$j\f$.
#
# The sparse CSR matrix passed to \p hipsparseXcsrsm2_solve does not actually have to be a triangular matrix. Instead, the
# triangular upper or lower part of the sparse matrix is solved based on the \ref hipsparseFillMode_t setting on the descriptor
# \p descrA. If the fill mode is set to \ref HIPSPARSE_FILL_MODE_LOWER, then the lower triangular matrix is solved. If the
# fill mode is set to \ref HIPSPARSE_FILL_MODE_UPPER, then the upper triangular matrix is solved.
#
# \note
# The sparse CSR matrix has to be sorted. This can be achieved by calling
# hipsparseXcsrsort().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \p transA != \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE and
# \p transB != \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo algorithm to use.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$A\f$.
# @param[in]
# nrhs number of columns of the dense matrix \f$op(B)\f$.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix \f$A\f$.
# @param[inout]
# B array of \p m \f$\times\f$ \p nrhs elements of the rhs matrix \f$B\f$.
# @param[in]
# ldb leading dimension of rhs matrix \f$B\f$.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or
# \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nrhs, \p nnz, \p alpha,
# \p descrA, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p B,
# \p info, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE,
# \p transB == \ref HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrsm2_solve(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float * alpha,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,float * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrsm2_solve(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double * alpha,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,double * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrsm2_solve(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const float2 * alpha,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,float2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrsm2_solve(void * handle,int algo,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int nrhs,int nnz,const double2 * alpha,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,double2 * B,int ldb,csrsm2Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup level3_module
# \brief Dense matrix sparse matrix multiplication using the CSC storage format.
#
# \details
# \p hipsparseXgemmi multiplies the scalar \f$\alpha\f$ with a dense column-oriented \f$m \times k\f$
# matrix \f$A\f$ and the sparse \f$k \times n\f$ matrix \f$B\f$, defined in CSC
# storage format, and adds the result to the dense column-oriented \f$m \times n\f$ matrix \f$C\f$ that
# is multiplied by the scalar \f$\beta\f$, such that
# \f[
# C := \alpha \cdot A \cdot B + \beta \cdot C
# \f]
#
# \note
# 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 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \f$A\f$. Must be non-negative.
# @param[in]
# n number of columns of the sparse CSC matrix \f$op(B)\f$ and \f$C\f$. Must be non-negative.
# @param[in]
# k number of columns of the dense matrix \f$A\f$. Must be non-negative.
# @param[in]
# nnz number of non-zero entries of the sparse CSC matrix \f$B\f$. Must be non-negative.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# A array of dimension \f$lda \times k\f$ (\f$op(A) == A\f$) or
# \f$lda \times m\f$ (\f$op(A) == A^T\f$ or \f$op(A) == A^H\f$).
# @param[in]
# lda leading dimension of \f$A\f$, must be at least \f$m\f$
# (\f$op(A) == A\f$) or \f$k\f$ (\f$op(A) == A^T\f$ or
# \f$op(A) == A^H\f$).
# @param[in]
# cscValB array of \p nnz elements of the sparse CSC matrix \f$B\f$.
# @param[in]
# cscColPtrB array of \p n+1 elements that point to the start of every column of the
# sparse CSC matrix \f$B\f$.
# @param[in]
# cscRowIndB array of \p nnz elements containing the column indices of the sparse CSC
# matrix \f$B\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[inout]
# C array of dimension \f$ldc \times n\f$ that holds the values of \f$C\f$.
# @param[in]
# ldc leading dimension of \f$C\f$, must be at least \f$m\f$.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p alpha or \p beta is nullptr,
# \p m, \p n, \p k, or \p nnz is negative, \p lda or \p ldc is invalid, or
# \p A, \p cscValB, \p cscColPtrB, \p cscRowIndB, or \p C is nullptr.
#
cdef hipsparseStatus_t hipsparseSgemmi(void * handle,int m,int n,int k,int nnz,const float * alpha,const float * A,int lda,const float * cscValB,const int * cscColPtrB,const int * cscRowIndB,const float * beta,float * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgemmi(void * handle,int m,int n,int k,int nnz,const double * alpha,const double * A,int lda,const double * cscValB,const int * cscColPtrB,const int * cscRowIndB,const double * beta,double * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgemmi(void * handle,int m,int n,int k,int nnz,const float2 * alpha,const float2 * A,int lda,const float2 * cscValB,const int * cscColPtrB,const int * cscRowIndB,const float2 * beta,float2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgemmi(void * handle,int m,int n,int k,int nnz,const double2 * alpha,const double2 * A,int lda,const double2 * cscValB,const int * cscColPtrB,const int * cscRowIndB,const double2 * beta,double2 * C,int ldc) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgeamNnz computes the total CSR non-zero elements and the CSR row
# offsets that point to the start of every row of the sparse CSR matrix of the
# resulting matrix \f$C\f$. It is assumed that \p csrRowPtrC has been allocated with
# size \p m+1. The desired index base in the output CSR matrix is set in the
# \ref hipsparseMatDescr_t. See \ref hipsparseSetMatIndexBase().
#
# For a full code example, see \ref hipsparseScsrgeam().
#
# \note
# As indicated, \p nnzTotalDevHostPtr can point to either host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# \deprecated
# This function is deprecated and will be removed in a future release.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$. Must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$. Must be non-negative.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$. Must be non-negative.
# @param[in]
# csrRowPtrB array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# nnzTotalDevHostPtr pointer to the number of non-zero entries of the sparse CSR
# matrix \f$C\f$. \p nnzTotalDevHostPtr can be a host or device pointer.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p descrB, or \p descrC is nullptr,
# \p m, \p n, \p nnzA, or \p nnzB is negative, or \p csrRowPtrA, \p csrColIndA, \p csrRowPtrB,
# \p csrColIndB, \p csrRowPtrC, or \p nnzTotalDevHostPtr is nullptr.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t is not
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcsrgeamNnz(void * handle,int m,int n,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \brief Sparse matrix sparse matrix addition using the CSR storage format.
#
# \details
# \p hipsparseXcsrgeam multiplies the scalar \f$\alpha\f$ with the sparse
# \f$m \times n\f$ matrix \f$A\f$, defined in CSR storage format, multiplies the
# scalar \f$\beta\f$ with the sparse \f$m \times n\f$ matrix \f$B\f$, defined in CSR
# storage format, and adds both resulting matrices to obtain the sparse
# \f$m \times n\f$ matrix \f$C\f$, defined in CSR storage format, such that
# \f[
# C := \alpha \cdot A + \beta \cdot B.
# \f]
#
# This computation involves a multi-step process. First, the user must allocate \p csrRowPtrC
# to have size \p m+1. The user then calls \ref hipsparseXcsrgeamNnz, which fills in the \p csrRowPtrC
# array and computes the total number of non-zeros in \f$C\f$, \p nnzC. The user then allocates both
# arrays \p csrColIndC and \p csrValC to have size \p nnzC and calls \p hipsparseXcsrgeam to complete
# the computation. The desired index base in the output CSR matrix \f$C\f$ is set in the
# \ref hipsparseMatDescr_t \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note Both scalars \f$\alpha\f$ and \f$beta\f$ have to be valid.
# \note Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# \note 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 and will be removed in a future release.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrValA array of \p nnzA elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrValB array of \p nnzB elements of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrRowPtrB array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of elements of the sparse CSR matrix \f$C\f$.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# csrColIndC array of elements containing the column indices of the
# sparse CSR matrix \f$C\f$.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p nnzB,
# \p alpha, \p descrA, \p csrValA, \p csrRowPtrA, \p csrColIndA, \p beta,
# \p descrB, \p csrValB, \p csrRowPtrB, \p csrColIndB, \p descrC, \p csrValC,
# \p csrRowPtrC, or \p csrColIndC is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgeam(void * handle,int m,int n,const float * alpha,void *const descrA,int nnzA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * beta,void *const descrB,int nnzB,const float * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,float * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgeam(void * handle,int m,int n,const double * alpha,void *const descrA,int nnzA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * beta,void *const descrB,int nnzB,const double * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,double * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgeam(void * handle,int m,int n,const float2 * alpha,void *const descrA,int nnzA,const float2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float2 * beta,void *const descrB,int nnzB,const float2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,float2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgeam(void * handle,int m,int n,const double2 * alpha,void *const descrA,int nnzA,const double2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double2 * beta,void *const descrB,int nnzB,const double2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,double2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgeam2_bufferSizeExt returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseXcsrgeam2Nnz() and \ref hipsparseScsrgeam2
# "hipsparseXcsrgeam2()". The temporary storage buffer must be allocated by the user.
#
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedValA array of \p nnzA elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedValB array of \p nnzB elements of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedRowPtrB array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrSortedValC array of elements of the sparse CSR matrix \f$C\f$.
# @param[in]
# csrSortedRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# csrSortedColIndC array of elements containing the column indices of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseXcsrgeam2Nnz() and \ref hipsparseScsrgeam2 "hipsparseXcsrgeam2()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p nnzB,
# \p alpha, \p descrA, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA,
# \p beta, \p descrB, \p csrSortedValB, \p csrSortedRowPtrB, \p csrSortedColIndB,
# \p descrC, \p csrSortedValC, \p csrSortedRowPtrC, \p csrSortedColIndC, or
# \p pBufferSizeInBytes is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgeam2_bufferSizeExt(void * handle,int m,int n,const float * alpha,void *const descrA,int nnzA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * beta,void *const descrB,int nnzB,const float * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,const float * csrSortedValC,const int * csrSortedRowPtrC,const int * csrSortedColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgeam2_bufferSizeExt(void * handle,int m,int n,const double * alpha,void *const descrA,int nnzA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * beta,void *const descrB,int nnzB,const double * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,const double * csrSortedValC,const int * csrSortedRowPtrC,const int * csrSortedColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgeam2_bufferSizeExt(void * handle,int m,int n,const float2 * alpha,void *const descrA,int nnzA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * beta,void *const descrB,int nnzB,const float2 * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,const float2 * csrSortedValC,const int * csrSortedRowPtrC,const int * csrSortedColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgeam2_bufferSizeExt(void * handle,int m,int n,const double2 * alpha,void *const descrA,int nnzA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * beta,void *const descrB,int nnzB,const double2 * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,const double2 * csrSortedValC,const int * csrSortedRowPtrC,const int * csrSortedColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgeam2Nnz computes the total CSR non-zero elements and the CSR row
# offsets that point to the start of every row of the sparse CSR matrix of the
# resulting matrix \f$C\f$. It is assumed that \p csrRowPtrC has been allocated with
# size \p m+1. The required buffer size can be obtained by
# \ref hipsparseScsrgeam2_bufferSizeExt "hipsparseXcsrgeam2_bufferSizeExt()". The
# desired index base in the output CSR matrix \f$C\f$ is set in the \ref hipsparseMatDescr_t
# \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note
# As indicated, \p nnzTotalDevHostPtr can point to either host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedRowPtrB array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrSortedRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# nnzTotalDevHostPtr pointer to the number of non-zero entries of the sparse CSR
# matrix \f$C\f$. \p nnzTotalDevHostPtr can be a host or device pointer.
# @param[in]
# workspace temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p nnzB,
# \p descrA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p descrB, \p csrSortedRowPtrB,
# \p csrSortedColIndB, \p descrC, \p csrSortedRowPtrC, or \p nnzTotalDevHostPtr is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcsrgeam2Nnz(void * handle,int m,int n,void *const descrA,int nnzA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,void *const descrB,int nnzB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,int * csrSortedRowPtrC,int * nnzTotalDevHostPtr,void * workspace) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \brief Sparse matrix sparse matrix addition using the CSR storage format.
#
# \details
# \p hipsparseXcsrgeam2 multiplies the scalar \f$\alpha\f$ with the sparse
# \f$m \times n\f$ matrix \f$A\f$, defined in CSR storage format, multiplies the
# scalar \f$\beta\f$ with the sparse \f$m \times n\f$ matrix \f$B\f$, defined in CSR
# storage format, and adds both resulting matrices to obtain the sparse
# \f$m \times n\f$ matrix \f$C\f$, defined in CSR storage format, such that
# \f[
# C := \alpha \cdot A + \beta \cdot B.
# \f]
#
# This computation involves a multi-step process. First, the user must call
# \ref hipsparseScsrgeam2_bufferSizeExt "hipsparseXcsrgeam2_bufferSizeExt()" to determine the
# required user allocated temporary buffer size. The user then allocates this buffer and also allocates
# \p csrRowPtrC to have size \p m+1. Both the temporary storage buffer and \p csrRowPtrC array are then
# passed to \ref hipsparseXcsrgeam2Nnz, which fills in the \p csrRowPtrC array and computes the total
# number of non-zeros in \f$C\f$, \p nnzC. The user then allocates both arrays \p csrColIndC and \p csrValC to have
# size \p nnzC and calls \p hipsparseXcsrgeam2 to complete the computation. The desired index base in
# the output CSR matrix \f$C\f$ is set in the \ref hipsparseMatDescr_t \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note Both scalars \f$\alpha\f$ and \f$beta\f$ have to be valid.
# \note Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# \note This function is non-blocking and executed asynchronously with respect to the
# host. It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrices \f$A\f$, \f$B\f$, and \f$C\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedValA array of \p nnzA elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# csrSortedColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedValB array of \p nnzB elements of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedRowPtrB array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# csrSortedColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrSortedValC array of elements of the sparse CSR matrix \f$C\f$.
# @param[in]
# csrSortedRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# csrSortedColIndC array of elements containing the column indices of the
# sparse CSR matrix \f$C\f$.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p nnzB,
# \p alpha, \p descrA, \p csrSortedValA, \p csrSortedRowPtrA, \p csrSortedColIndA, \p beta,
# \p descrB, \p csrSortedValB, \p csrSortedRowPtrB, \p csrSortedColIndB, \p descrC, \p csrSortedValC,
# \p csrSortedRowPtrC, \p csrSortedColIndC, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgeam2(void * handle,int m,int n,const float * alpha,void *const descrA,int nnzA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float * beta,void *const descrB,int nnzB,const float * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,float * csrSortedValC,int * csrSortedRowPtrC,int * csrSortedColIndC,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgeam2(void * handle,int m,int n,const double * alpha,void *const descrA,int nnzA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double * beta,void *const descrB,int nnzB,const double * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,double * csrSortedValC,int * csrSortedRowPtrC,int * csrSortedColIndC,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgeam2(void * handle,int m,int n,const float2 * alpha,void *const descrA,int nnzA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const float2 * beta,void *const descrB,int nnzB,const float2 * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,float2 * csrSortedValC,int * csrSortedRowPtrC,int * csrSortedColIndC,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgeam2(void * handle,int m,int n,const double2 * alpha,void *const descrA,int nnzA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,const double2 * beta,void *const descrB,int nnzB,const double2 * csrSortedValB,const int * csrSortedRowPtrB,const int * csrSortedColIndB,void *const descrC,double2 * csrSortedValC,int * csrSortedRowPtrC,int * csrSortedColIndC,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgemmNnz computes the total CSR non-zero elements and the CSR row
# offsets that point to the start of every row of the sparse CSR matrix of the
# resulting multiplied matrix \f$C\f$. It is assumed that \p csrRowPtrC has been allocated
# with size \p m+1. The desired index base in the output CSR matrix \f$C\f$ is set in the
# \ref hipsparseMatDescr_t \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note
# As indicated, \p nnzTotalDevHostPtr can point to either host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# For matrix products with more than 8192 intermediate products per
# row, an additional temporary storage buffer is allocated by the algorithm.
#
# \note
# Currently, only \p transA == \p transB == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is
# supported.
#
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# \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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$op(A)\f$ and \f$C\f$. Must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrix \f$op(B)\f$ and
# \f$C\f$. Must be non-negative.
# @param[in]
# k number of columns of the sparse CSR matrix \f$op(A)\f$ and number of
# rows of the sparse CSR matrix \f$op(B)\f$. Must be non-negative.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$. Must be non-negative.
# @param[in]
# csrRowPtrA array of \p m+1 elements (\f$op(A) == A\f$, \p k+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(A)\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$. Must be non-negative.
# @param[in]
# csrRowPtrB array of \p k+1 elements (\f$op(B) == B\f$, \p m+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(B)\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[inout]
# nnzTotalDevHostPtr pointer to the number of non-zero entries of the sparse CSR
# matrix \f$C\f$. \p nnzTotalDevHostPtr can be a host or device pointer.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p descrB, or \p descrC is nullptr,
# \p m, \p n, \p k, \p nnzA, or \p nnzB is negative, or \p csrRowPtrA, \p csrColIndA,
# \p csrRowPtrB, \p csrColIndB, \p csrRowPtrC, or \p nnzTotalDevHostPtr is nullptr.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \p transA is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE,
# \p transB is not \ref HIPSPARSE_OPERATION_NON_TRANSPOSE, or
# \ref hipsparseMatrixType_t is not \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcsrgemmNnz(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \brief Sparse matrix and sparse matrix multiplication using the CSR storage format.
#
# \details
# \p hipsparseXcsrgemm multiplies the sparse \f$m \times k\f$ matrix \f$op(A)\f$, defined in
# CSR storage format, with the sparse \f$k \times n\f$ matrix \f$op(B)\f$, defined in CSR
# storage format, and stores the result in the sparse \f$m \times n\f$ matrix \f$C\f$,
# defined in CSR storage format, such that
# \f[
# C := op(A) \cdot op(B),
# \f]
# with
# \f[
# op(A) = \left* \begin{array}{ll}
# A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\
# A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
# and
# \f[
# op(B) = \left* \begin{array}{ll}
# B, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\
# B^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\
# B^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE}
# \end{array}
# \right.
# \f]
#
# This computation involves a multi-step process. First, the user must allocate \p csrRowPtrC
# to have size \p m+1. The user then calls \ref hipsparseXcsrgemmNnz, which fills in the \p csrRowPtrC
# array and computes the total number of non-zeros in C, \p nnzC. The user then allocates both
# arrays \p csrColIndC and \p csrValC to have size \p nnzC and calls \p hipsparseXcsrgemm to complete
# the computation. The desired index base in the output CSR matrix C is set in the
# \ref hipsparseMatDescr_t \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note Currently, only \p transA == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
# \note Currently, only \p transB == \ref HIPSPARSE_OPERATION_NON_TRANSPOSE is supported.
# \note Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# \note This function is non-blocking and executed asynchronously with respect to the
# host. It can return before the actual computation has finished.
# \note For matrix products with more than 4096 non-zero entries per
# row, an additional temporary storage buffer is allocated by the algorithm.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# transA matrix \f$A\f$ operation type.
# @param[in]
# transB matrix \f$B\f$ operation type.
# @param[in]
# m number of rows of the sparse CSR matrix \f$op(A)\f$ and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrix \f$op(B)\f$ and
# \f$C\f$.
# @param[in]
# k number of columns of the sparse CSR matrix \f$op(A)\f$ and number of
# rows of the sparse CSR matrix \f$op(B)\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrValA array of \p nnzA elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrRowPtrA array of \p m+1 elements (\f$op(A) == A\f$, \p k+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(A)\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrValB array of \p nnzB elements of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrRowPtrB array of \p k+1 elements (\f$op(B) == B\f$, \p m+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(B)\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnzC elements of the sparse CSR matrix \f$C\f$.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# csrColIndC array of \p nnzC elements containing the column indices of the
# sparse CSR matrix \f$C\f$.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p k, \p nnzA, \p nnzB,
# \p descrA, \p csrValA, \p csrRowPtrA, \p csrColIndA, \p descrB, \p csrValB,
# \p csrRowPtrB, \p csrColIndB, \p descrC, \p csrValC, \p csrRowPtrC, or \p csrColIndC
# is invalid.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED additional buffer for long rows could not be
# allocated.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \p transA != \ref HIPSPARSE_OPERATION_NON_TRANSPOSE,
# \p transB != \ref HIPSPARSE_OPERATION_NON_TRANSPOSE, or
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgemm(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,void *const descrA,int nnzA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const float * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,float * csrValC,const int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgemm(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,void *const descrA,int nnzA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const double * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,double * csrValC,const int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgemm(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,void *const descrA,int nnzA,const float2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const float2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,float2 * csrValC,const int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgemm(void * handle,hipsparseOperation_t transA,hipsparseOperation_t transB,int m,int n,int k,void *const descrA,int nnzA,const double2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const double2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,void *const descrC,double2 * csrValC,const int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgemm2_bufferSizeExt returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseXcsrgemm2Nnz() and \ref hipsparseScsrgemm2
# "hipsparseXcsrgemm2()". The temporary storage buffer must be allocated by the user.
#
# \note
# For matrix products with more than 4096 non-zero entries per row,
# an additional temporary storage buffer is allocated by the algorithm.
#
# \note
# For matrix products with more than 8192 intermediate products per
# row, an additional temporary storage buffer is allocated by the algorithm.
#
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix \f$op(A)\f$ and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrix \f$op(B)\f$ and
# \f$C\f$.
# @param[in]
# k number of columns of the sparse CSR matrix \f$op(A)\f$ and number of
# rows of the sparse CSR matrix \f$op(B)\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrRowPtrA array of \p m+1 elements (\f$op(A) == A\f$, \p k+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(A)\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrRowPtrB array of \p k+1 elements (\f$op(B) == B\f$, \p m+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(B)\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[in]
# descrD descriptor of the sparse CSR matrix \f$D\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzD number of non-zero entries of the sparse CSR matrix \f$D\f$.
# @param[in]
# csrRowPtrD array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$D\f$.
# @param[in]
# csrColIndD array of \p nnzD elements containing the column indices of the sparse
# CSR matrix \f$D\f$.
# @param[inout]
# info structure that holds meta data for the sparse CSR matrix \f$C\f$.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseXcsrgemm2Nnz(), hipsparseScsrgemm2(), hipsparseDcsrgemm2(),
# hipsparseCcsrgemm2(), and hipsparseZcsrgemm2().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p k, \p nnzA, \p nnzB, \p nnz_D,
# \p alpha, \p beta, \p descrA, \p csrRowPtrA, \p csrColIndA, \p descrB, \p csrRowPtrB,
# \p csrColIndB, \p descrD, \p csrRowPtrD, \p csrColIndD, \p info, or \p pBufferSizeInBytes
# is invalid.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgemm2_bufferSizeExt(void * handle,int m,int n,int k,const float * alpha,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,const float * beta,void *const descrD,int nnzD,const int * csrRowPtrD,const int * csrColIndD,csrgemm2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgemm2_bufferSizeExt(void * handle,int m,int n,int k,const double * alpha,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,const double * beta,void *const descrD,int nnzD,const int * csrRowPtrD,const int * csrColIndD,csrgemm2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgemm2_bufferSizeExt(void * handle,int m,int n,int k,const float2 * alpha,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,const float2 * beta,void *const descrD,int nnzD,const int * csrRowPtrD,const int * csrColIndD,csrgemm2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgemm2_bufferSizeExt(void * handle,int m,int n,int k,const double2 * alpha,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,const double2 * beta,void *const descrD,int nnzD,const int * csrRowPtrD,const int * csrColIndD,csrgemm2Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \details
# \p hipsparseXcsrgemm2Nnz computes the total CSR non-zero elements and the CSR row
# offsets that point to the start of every row of the sparse CSR matrix of the
# resulting multiplied matrix \f$C\f$. It is assumed that \p csrRowPtrC has been allocated
# with size \p m+1. The required buffer size can be obtained by
# \ref hipsparseScsrgemm2_bufferSizeExt "hipsparseXcsrgemm2_bufferSizeExt()". The desired
# index base in the output CSR matrix \f$C\f$ is set in the \ref hipsparseMatDescr_t \p descrC.
# See \ref hipsparseSetMatIndexBase().
#
# \note
# As indicated, \p nnzTotalDevHostPtr can point to either host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# For matrix products with more than 8192 intermediate products per
# row, an additional temporary storage buffer is allocated by the algorithm.
#
# \note
# Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix \f$op(A)\f$ and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrix \f$op(B)\f$ and
# \f$C\f$.
# @param[in]
# k number of columns of the sparse CSR matrix \f$op(A)\f$ and number of
# rows of the sparse CSR matrix \f$op(B)\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrRowPtrA array of \p m+1 elements (\f$op(A) == A\f$, \p k+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(A)\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrRowPtrB array of \p k+1 elements (\f$op(B) == B\f$, \p m+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(B)\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# descrD descriptor of the sparse CSR matrix \f$D\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzD number of non-zero entries of the sparse CSR matrix \f$D\f$.
# @param[in]
# csrRowPtrD array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$D\f$.
# @param[in]
# csrColIndD array of \p nnzD elements containing the column indices of the sparse
# CSR matrix \f$D\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# nnzTotalDevHostPtr pointer to the number of non-zero entries of the sparse CSR
# matrix \f$C\f$.
# @param[in]
# info structure that holds meta data for the sparse CSR matrix \f$C\f$.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned
# by hipsparseScsrgemm2_bufferSizeExt(), hipsparseDcsrgemm2_bufferSizeExt(),
# hipsparseZcsrgemm2_bufferSizeExt(), or hipsparseZcsrgemm2_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p k, \p nnzA, \p nnzB, \p nnzD,
# \p descrA, \p csrRowPtrA, \p csrColIndA, \p descrB, \p csrRowPtrB, \p csrColIndB,
# \p descrD, \p csrRowPtrD, \p csrColIndD, \p descrC, \p csrRowPtrC, \p nnzTotalDevHostPtr,
# \p info, or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED additional buffer for long rows could not be
# allocated.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcsrgemm2Nnz(void * handle,int m,int n,int k,void *const descrA,int nnzA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const int * csrRowPtrB,const int * csrColIndB,void *const descrD,int nnzD,const int * csrRowPtrD,const int * csrColIndD,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr,const csrgemm2Info_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup extra_module
# \brief Sparse matrix and sparse matrix multiplication using CSR storage format
#
# \details
# \p hipsparseXcsrgemm2 multiplies the scalar \f$\alpha\f$ with the sparse
# \f$m \times k\f$ matrix \f$A\f$, defined in CSR storage format, and the sparse
# \f$k \times n\f$ matrix \f$B\f$, defined in CSR storage format, and adds the result
# to the sparse \f$m \times n\f$ matrix \f$D\f$ that is multiplied by \f$\beta\f$. The
# final result is stored in the sparse \f$m \times n\f$ matrix \f$C\f$, defined in CSR
# storage format, such
# that
# \f[
# C := \alpha \cdot A \cdot B + \beta \cdot D
# \f]
#
# This computation involves a multi-step process. First, the user must call
# \ref hipsparseScsrgemm2_bufferSizeExt "hipsparseXcsrgemm2_bufferSizeExt()" to
# determine the required user-allocated temporary buffer size. The user then allocates this
# buffer and also allocates \p csrRowPtrC to have size \p m+1. Both the temporary storage
# buffer and \p csrRowPtrC array are then passed to \ref hipsparseXcsrgemm2Nnz, which fills
# in the \p csrRowPtrC array and computes the total number of nonzeros in \f$C\f$, \p nnzC.
# The user then allocates both arrays \p csrColIndC and \p csrValC to have size \p nnzC and
# calls \p hipsparseXcsrgemm2 to complete the computation. The desired index base in the output
# CSR matrix \f$C\f$ is set in the \ref hipsparseMatDescr_t \p descrC. See \ref hipsparseSetMatIndexBase().
#
# \note If \f$\alpha == 0\f$, then \f$C = \beta \cdot D\f$ will be computed.
# \note If \f$\beta == 0\f$, then \f$C = \alpha \cdot A \cdot B\f$ will be computed.
# \note \f$\alpha == beta == 0\f$ is invalid.
# \note Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# \note This function is non-blocking and executed asynchronously with respect to the
# host. It can return before the actual computation has finished.
# \note For matrix products with more than 4096 non-zero entries per
# row, an additional temporary storage buffer is allocated by the algorithm.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix \f$op(A)\f$ and \f$C\f$.
# @param[in]
# n number of columns of the sparse CSR matrix \f$op(B)\f$ and
# \f$C\f$.
# @param[in]
# k number of columns of the sparse CSR matrix \f$op(A)\f$ and number of
# rows of the sparse CSR matrix \f$op(B)\f$.
# @param[in]
# alpha scalar \f$\alpha\f$.
# @param[in]
# descrA descriptor of the sparse CSR matrix \f$A\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzA number of non-zero entries of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrValA array of \p nnzA elements of the sparse CSR matrix \f$A\f$.
# @param[in]
# csrRowPtrA array of \p m+1 elements (\f$op(A) == A\f$, \p k+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(A)\f$.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the
# sparse CSR matrix \f$A\f$.
# @param[in]
# descrB descriptor of the sparse CSR matrix \f$B\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzB number of non-zero entries of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrValB array of \p nnzB elements of the sparse CSR matrix \f$B\f$.
# @param[in]
# csrRowPtrB array of \p k+1 elements (\f$op(B) == B\f$, \p m+1 otherwise)
# that point to the start of every row of the sparse CSR matrix
# \f$op(B)\f$.
# @param[in]
# csrColIndB array of \p nnzB elements containing the column indices of the
# sparse CSR matrix \f$B\f$.
# @param[in]
# beta scalar \f$\beta\f$.
# @param[in]
# descrD descriptor of the sparse CSR matrix \f$D\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# nnzD number of non-zero entries of the sparse CSR matrix \f$D\f$.
# @param[in]
# csrValD array of \p nnzD elements of the sparse CSR matrix \f$D\f$.
# @param[in]
# csrRowPtrD array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$D\f$.
# @param[in]
# csrColIndD array of \p nnzD elements containing the column indices of the
# sparse CSR matrix \f$D\f$.
# @param[in]
# descrC descriptor of the sparse CSR matrix \f$C\f$. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnzC elements of the sparse CSR matrix \f$C\f$.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix \f$C\f$.
# @param[out]
# csrColIndC array of \p nnzC elements containing the column indices of the
# sparse CSR matrix \f$C\f$.
# @param[in]
# info structure that holds meta data for the sparse CSR matrix \f$C\f$.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned
# by hipsparseScsrgemm2_bufferSizeExt(), hipsparseDcsrgemm2_bufferSizeExt(),
# hipsparseCcsrgemm2_bufferSizeExt(), or hipsparseZcsrgemm2_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p k, \p nnzA, \p nnzB,
# \p nnzD, \p alpha, \p beta, \p descrA, \p csrValA, \p csrRowPtrA, \p csrColIndA,
# \p descrB, \p csrValB, \p csrRowPtrB, \p csrColIndB, \p descrD, \p csrValD,
# \p csrRowPtrD, \p csrColIndD, \p csrValC, \p csrRowPtrC, \p csrColIndC, \p info,
# or \p pBuffer is invalid.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED additional buffer for long rows could not be
# allocated.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsrgemm2(void * handle,int m,int n,int k,const float * alpha,void *const descrA,int nnzA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const float * csrValB,const int * csrRowPtrB,const int * csrColIndB,const float * beta,void *const descrD,int nnzD,const float * csrValD,const int * csrRowPtrD,const int * csrColIndD,void *const descrC,float * csrValC,const int * csrRowPtrC,int * csrColIndC,const csrgemm2Info_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrgemm2(void * handle,int m,int n,int k,const double * alpha,void *const descrA,int nnzA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const double * csrValB,const int * csrRowPtrB,const int * csrColIndB,const double * beta,void *const descrD,int nnzD,const double * csrValD,const int * csrRowPtrD,const int * csrColIndD,void *const descrC,double * csrValC,const int * csrRowPtrC,int * csrColIndC,const csrgemm2Info_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrgemm2(void * handle,int m,int n,int k,const float2 * alpha,void *const descrA,int nnzA,const float2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const float2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,const float2 * beta,void *const descrD,int nnzD,const float2 * csrValD,const int * csrRowPtrD,const int * csrColIndD,void *const descrC,float2 * csrValC,const int * csrRowPtrC,int * csrColIndC,const csrgemm2Info_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrgemm2(void * handle,int m,int n,int k,const double2 * alpha,void *const descrA,int nnzA,const double2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,void *const descrB,int nnzB,const double2 * csrValB,const int * csrRowPtrB,const int * csrColIndB,const double2 * beta,void *const descrD,int nnzD,const double2 * csrValD,const int * csrRowPtrD,const int * csrColIndD,void *const descrC,double2 * csrValC,const int * csrRowPtrC,int * csrColIndC,const csrgemm2Info_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsric02_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseSbsric02_analysis
# "hipsparseXbsric02_analysis()" or \ref hipsparseSbsric02 "hipsparseXbsric02()" computation.
# The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position, using the same index
# base as the BSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note
# If a zero pivot is found, \p position=j means that either the diagonal block \p A(j,j)
# is missing (structural zero) or the diagonal block \p A(j,j) is not positive definite
# (numerical zero).
#
# \note \p hipsparseXbsric02_zeroPivot is a blocking function. It might negatively influence
# performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXbsric02_zeroPivot(void * handle,bsric02Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsric02_bufferSize returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseSbsric02_analysis "hipsparseXbsric02_analysis()"
# and \ref hipsparseSbsric02 "hipsparseXbsric02()". The temporary storage buffer must be
# allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW
# or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix. Must be non-negative.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix. Must be non-negative.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrValA array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix. Must be positive, which is between 1 and m where \p m=mb*blockDim.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSbsric02_analysis(), hipsparseDbsric02_analysis(),
# hipsparseCbsric02_analysis(), hipsparseZbsric02_analysis(),
# hipsparseSbsric02(), hipsparseDbsric02(), hipsparseCbsric02(),
# and hipsparseZbsric02().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p bsrValA, \p bsrRowPtrA,
# \p bsrColIndA, \p info, or \p pBufferSizeInBytes is nullptr, \p mb, or \p nnzb is negative,
# or \p blockDim is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsric02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsric02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsric02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsric02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsric02_analysis performs the analysis step for \ref hipsparseSbsric02
# "hipsparseXbsric02()". It is expected that this function will be executed only once
# for a given matrix and particular operation type.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW or by
# \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrValA array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between 1 and m where \p m=mb*blockDim.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim, \p descrA,
# \p bsrValA, \p bsrRowPtrA, \p bsrColIndA, \p info, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsric02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsric02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsric02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsric02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Incomplete Cholesky factorization with 0 fill-ins and no pivoting using the BSR
# storage format.
#
# \details
# \p hipsparseXbsric02 computes the incomplete Cholesky factorization with 0 fill-ins
# and no pivoting of a sparse \f$mb \times mb\f$ BSR matrix \f$A\f$, such that
# \f[
# A \approx LL^T
# \f]
#
# Computing the above incomplete Cholesky factorization requires three steps to complete. First,
# the user determines the size of the required temporary storage buffer by calling
# \ref hipsparseSbsric02_bufferSize "hipsparseXbsric02_bufferSize()". After this buffer size has been determined,
# the user allocates the buffer and passes it to \ref hipsparseSbsric02_analysis "hipsparseXbsric02_analysis()".
# This will perform analysis on the sparsity pattern of the matrix. Finally, the user calls \p hipsparseXbsric02
# to perform the actual factorization. The calculation of the buffer size and the analysis of the sparse matrix
# only need to be performed once for a given sparsity pattern, while the factorization can be repeatedly applied
# to multiple matrices having the same sparsity pattern. After all calls to \p hipsparseXbsric02 are complete,
# the temporary buffer can be deallocated.
#
# \p hipsparseXbsric02 requires a user-allocated temporary buffer. Its size is returned
# by \ref hipsparseSbsric02_bufferSize "hipsparseXbsric02_bufferSize()". Furthermore,
# analysis meta data is required. It can be obtained by \ref hipsparseSbsric02_analysis
# "hipsparseXbsric02_analysis()". \p hipsparseXbsric02 reports the first zero pivot
# (either numerical or structural zero). The zero pivot status can be obtained by calling
# \ref hipsparseXbsric02_zeroPivot().
#
# \p hipsparseXbsric02 reports the first zero pivot (either numerical or structural zero).
# The zero pivot status can be obtained by calling \ref hipsparseXbsric02_zeroPivot().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW or by
# \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[inout]
# bsrValA array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between 1 and m where \p m=mb*blockDim.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim, \p descrA,
# \p bsrValA, \p bsrRowPtrA, or \p bsrColIndA pointer is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsric02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsric02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsric02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsric02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,bsric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsrilu02_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseSbsrilu02_analysis
# "hipsparseXbsrilu02_analysis()" or \ref hipsparseSbsrilu02 "hipsparseXbsrilu02()"
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position,
# using the same index base as the BSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note
# If a zero pivot is found, \p position \f$=j\f$ means that either the diagonal block
# \f$A_{j,j}\f$ is missing (structural zero) or the diagonal block \f$A_{j,j}\f$ is not
# invertible (numerical zero).
#
# \note \p hipsparseXbsrilu02_zeroPivot is a blocking function. It might negatively influence
# performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXbsrilu02_zeroPivot(void * handle,bsrilu02Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsrilu02_numericBoost enables the user to replace a numerical value in
# an incomplete LU factorization. \p tol is used to determine whether a numerical value
# is replaced by \p boost_val, such that \f$A_{j,j} = \text{boost_val}\f$ if
# \f$\text{tol} \ge \left|A_{j,j}\right|\f$.
#
# \note The boost value is enabled by setting \p enable_boost to 1 or disabled by
# setting \p enable_boost to 0.
#
# \note \p tol and \p boost_val can be in host or device memory.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# enable_boost enable/disable numeric boost.
# @param[in]
# tol tolerance to determine whether a numerical value is replaced or not.
# @param[in]
# boost_val boost value to replace a numerical value.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, \p tol, or \p boost_val is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSbsrilu02_numericBoost(void * handle,bsrilu02Info_t info,int enable_boost,double * tol,float * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrilu02_numericBoost(void * handle,bsrilu02Info_t info,int enable_boost,double * tol,double * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrilu02_numericBoost(void * handle,bsrilu02Info_t info,int enable_boost,double * tol,float2 * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrilu02_numericBoost(void * handle,bsrilu02Info_t info,int enable_boost,double * tol,double2 * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsrilu02_bufferSize returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseSbsrilu02_analysis "hipsparseXbsrilu02_analysis()"
# and \ref hipsparseSbsrilu02 "hipsparseXbsrilu02()". The temporary storage buffer must be
# allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW
# or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between 1 and m where \p m=mb*blockDim.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSbsrilu02_analysis(), hipsparseDbsrilu02_analysis(),
# hipsparseCbsrilu02_analysis(), hipsparseZbsrilu02_analysis(),
# hipsparseSbsrilu02(), hipsparseDbsrilu02(), hipsparseCbsrilu02(),
# and hipsparseZbsrilu02().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim, \p descrA,
# \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA, \p info, or
# \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrilu02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrilu02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrilu02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrilu02_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXbsrilu02_analysis performs the analysis step for \ref hipsparseSbsrilu02
# "hipsparseXbsrilu02()". It is expected that this function will be executed only once
# for a given matrix.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specified whether to count non-zero elements by
# \ref HIPSPARSE_DIRECTION_ROW or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[in]
# bsrSortedValA array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between 1 and m where \p m=mb*blockDim.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim, \p descrA,
# \p bsrSortedValA, \p bsrSortedRowPtrA, \p bsrSortedColIndA, \p info, or \p pBuffer pointer
# is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrilu02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrilu02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrilu02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrilu02_analysis(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double2 * bsrSortedValA,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Incomplete LU factorization with 0 fill-ins and no pivoting using the BSR storage
# format.
#
# \details
# \p hipsparseXbsrilu02 computes the incomplete LU factorization with 0 fill-ins and no
# pivoting of a sparse \f$mb \times mb\f$ BSR matrix \f$A\f$, such that
# \f[
# A \approx LU
# \f]
#
# Computing the above incomplete LU factorization requires three steps to complete. First,
# the user determines the size of the required temporary storage buffer by calling
# \ref hipsparseSbsrilu02_bufferSize "hipsparseXbsrilu02_bufferSize()". After this buffer size
# has been determined, the user allocates the buffer and passes it to
# \ref hipsparseSbsrilu02_analysis "hipsparseXbsrilu02_analysis()". This will perform analysis on
# the sparsity pattern of the matrix. Finally, the user calls \p hipsparseXbsrilu02 to perform the
# actual factorization. The calculation of the buffer size and the analysis of the sparse matrix
# only need to be performed once for a given sparsity pattern, while the factorization can be
# repeatedly applied to multiple matrices having the same sparsity pattern. After all calls to
# \ref hipsparseSbsrilu02 "hipsparseXbsrilu02()" are complete, the temporary buffer can be deallocated.
#
# \p hipsparseXbsrilu02 reports the first zero pivot (either numerical or structural zero).
# The zero pivot status can be obtained by calling \ref hipsparseXbsrilu02_zeroPivot().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specified whether to count non-zero elements by
# \ref HIPSPARSE_DIRECTION_ROW or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix.
# @param[in]
# nnzb number of non-zero block entries of the sparse BSR matrix.
# @param[in]
# descrA descriptor of the sparse BSR matrix.
# @param[inout]
# bsrSortedValA_valM array of length \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrSortedRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrSortedColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between 1 and m where \p m=mb*blockDim.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nnzb, \p blockDim, \p descrA,
# \p bsrSortedValA_valM, \p bsrSortedRowPtrA, or \p bsrSortedColIndA pointer is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseSbsrilu02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float * bsrSortedValA_valM,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsrilu02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double * bsrSortedValA_valM,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsrilu02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,float2 * bsrSortedValA_valM,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsrilu02(void * handle,hipsparseDirection_t dirA,int mb,int nnzb,void *const descrA,double2 * bsrSortedValA_valM,const int * bsrSortedRowPtrA,const int * bsrSortedColIndA,int blockDim,bsrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsric02_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseScsric02_analysis
# "hipsparseXcsric02_analysis()" or \ref hipsparseScsric02 "hipsparseXcsric02()"
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position,
# using the same index base as the CSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXcsric02_zeroPivot is a blocking function. It might negatively influence
# performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXcsric02_zeroPivot(void * handle,csric02Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsric02_bufferSize returns the size of the temporary storage buffer in bytes
# that is required by \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()" and
# \ref hipsparseScsric02 "hipsparseXcsric02()". The temporary storage buffer must be allocated
# by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()" and
# \ref hipsparseScsric02 "hipsparseXcsric02()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes pointer is
# invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsric02_bufferSize(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsric02_bufferSize(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsric02_bufferSize(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsric02_bufferSize(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsric02_bufferSizeExt returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()"
# and \ref hipsparseScsric02 "hipsparseXcsric02()". The temporary storage buffer must be
# allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()" and
# \ref hipsparseScsric02 "hipsparseXcsric02()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes pointer is
# invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsric02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsric02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsric02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsric02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsric02_analysis performs the analysis step for \ref hipsparseScsric02
# "hipsparseXcsric02()".
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during
# the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsric02_analysis(void * handle,int m,int nnz,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsric02_analysis(void * handle,int m,int nnz,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsric02_analysis(void * handle,int m,int nnz,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsric02_analysis(void * handle,int m,int nnz,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Incomplete Cholesky factorization with 0 fill-ins and no pivoting using the CSR
# storage format.
#
# \details
# \p hipsparseXcsric02 computes the incomplete Cholesky factorization with 0 fill-ins
# and no pivoting of a sparse \f$m \times m\f$ CSR matrix \f$A\f$, such that
# \f[
# A \approx LL^T
# \f]
# where the lower triangular matrix \f$L\f$ is computed using:
# \f[
# L_{ij} = \left* \begin{array}{ll}
# \sqrt{A_{jj} - \sum_{k=0}^{j-1}(L_{jk})^{2}}, & \text{if i == j} \\
# \frac{1}{L_{jj}}(A_{jj} - \sum_{k=0}^{j-1}L_{ik} \times L_{jk}), & \text{if i > j}
# \end{array}
# \right.
# \f]
# for each entry found in the CSR matrix \f$A\f$.
#
# Computing the above incomplete Cholesky factorization requires three steps to complete. First,
# the user determines the size of the required temporary storage buffer by calling
# \ref hipsparseScsric02_bufferSize "hipsparseXcsric02_bufferSize()". After this buffer size has been determined,
# the user allocates the buffer and passes it to \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()".
# This will perform analysis on the sparsity pattern of the matrix. Finally, the user calls \p hipsparseScsric02,
# \p hipsparseDcsric02, \p hipsparseCcsric02, or \p hipsparseZcsric02 to perform the actual factorization. The calculation
# of the buffer size and the analysis of the sparse matrix only need to be performed once for a given sparsity pattern,
# while the factorization can be repeatedly applied to multiple matrices having the same sparsity pattern. After all calls
# to \ref hipsparseScsric02 "hipsparseXcsric02()" are complete, the temporary buffer can be deallocated.
#
# When computing the Cholesky factorization, it is possible that \f$L_{jj} == 0\f$, which would result in a division by zero.
# This could occur from either \f$A_{jj}\f$ not existing in the sparse CSR matrix (referred to as a structural zero) or because
# \f$A_{jj} - \sum_{k=0}^{j-1}(L_{jk})^{2} == 0\f$ (referred to as a numerical zero). For example, running the Cholesky
# factorization on the following matrix:
# \f[
# \begin{bmatrix}
# 2 & 1 & 0 \\
# 1 & 2 & 1 \\
# 0 & 1 & 2
# \end{bmatrix}
# \f]
# results in a successful Cholesky factorization, however running with the matrix:
# \f[
# \begin{bmatrix}
# 2 & 1 & 0 \\
# 1 & 1/2 & 1 \\
# 0 & 1 & 2
# \end{bmatrix}
# \f]
# results in a numerical zero because:
# \f[
# \begin{array}{ll}
# L_{00} &= \sqrt{2} \\
# L_{10} &= \frac{1}{\sqrt{2}} \\
# L_{11} &= \sqrt{\frac{1}{2} - (\frac{1}{\sqrt{2}})^2}
# &= 0
# \end{array}
# \f]
# The user can detect the presence of a structural zero by calling \ref hipsparseXcsric02_zeroPivot() after
# \ref hipsparseScsric02_analysis "hipsparseXcsric02_analysis()" and/or the presence of a structural or
# numerical zero by calling \ref hipsparseXcsric02_zeroPivot() after \ref hipsparseScsric02 "hipsparseXcsric02()":
# \code{.c}
# hipsparseDcsric02(handle,
# m,
# nnz,
# descrM,
# csrVal,
# csrRowPtr,
# csrColInd,
# info,
# HIPSPARSE_SOLVE_POLICY_USE_LEVEL,
# buffer);
#
# // Check for zero pivot
# if(CUSPARSE_STATUS_ZERO_PIVOT == hipsparseXcsric02_zeroPivot(handle, info, &position))
# {
# printf("L has structural and/or numerical zero at L(%d,%d)\n", position, position);
# }
# \endcode
# In both cases, \ref hipsparseXcsric02_zeroPivot() will report the first zero pivot (either numerical or structural)
# found. See the full example below. The user can also set the diagonal type to be \f$1\f$ using \ref hipsparseSetMatDiagType(),
# which will interpret the matrix \f$A\f$ as having ones on its diagonal (even if no non-zero exists in the sparsity pattern).
#
# \p hipsparseXcsric02 computes the Cholesky factorization inplace meaning that the values array \p csrSortedValA_valM of the \f$A\f$
# matrix is overwritten with the \f$L\f$ matrix stored in the lower triangular part of \f$A\f$:
#
# \f[
# \begin{align}
# \begin{bmatrix}
# a_{00} & a_{01} & a_{02} \\
# a_{10} & a_{11} & a_{12} \\
# a_{20} & a_{21} & a_{22}
# \end{bmatrix}
# \rightarrow
# \begin{bmatrix}
# l_{00} & a_{01} & a_{02} \\
# l_{10} & l_{11} & a_{12} \\
# l_{20} & l_{21} & l_{22}
# \end{bmatrix}
# \end{align}
# \f]
# The row pointer array \p csrSortedRowPtrA and the column indices array \p csrSortedColIndA remain the same for \f$A\f$ and the
# output as the incomplete factorization does not generate new non-zeros in the output which do not already exist in \f$A\f$.
#
# The performance of computing Cholesky factorization with hipSPARSE greatly depends on the sparsity pattern
# the the matrix \f$A\f$, because this is what determines the amount of parallelism available.
#
# \note
# The sparse CSR matrix has to be sorted. This can be achieved by calling
# \ref hipsparseXcsrsort().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[inout]
# csrSortedValA_valM array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start
# of every row of the sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA_valM,
# \p csrSortedRowPtrA, or \p csrSortedColIndA pointer is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsric02(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsric02(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsric02(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsric02(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csric02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsrilu02_zeroPivot returns \ref HIPSPARSE_STATUS_ZERO_PIVOT if either a
# structural or numerical zero has been found during \ref hipsparseScsrilu02 "hipsparseXcsrilu02()"
# computation. The first zero pivot \f$j\f$ at \f$A_{j,j}\f$ is stored in \p position, using the same
# index base as the CSR matrix.
#
# \p position can be in host or device memory. If no zero pivot has been found,
# \p position is set to -1 and \ref HIPSPARSE_STATUS_SUCCESS is returned instead.
#
# \note \p hipsparseXcsrilu02_zeroPivot is a blocking function. It might negatively influence
# performance.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[inout]
# position pointer to zero pivot \f$j\f$, which can be in host or device memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, or \p position is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
cdef hipsparseStatus_t hipsparseXcsrilu02_zeroPivot(void * handle,csrilu02Info_t info,int * position) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsrilu02_numericBoost enables the user to replace a numerical value in
# an incomplete LU factorization. \p tol is used to determine whether a numerical value
# is replaced by \p boost_val, such that \f$A_{j,j} = \text{boost_val}\f$ if
# \f$\text{tol} \ge \left|A_{j,j}\right|\f$.
#
# \note The boost value is enabled by setting \p enable_boost to 1 or disabled by
# setting \p enable_boost to 0.
#
# \note \p tol and \p boost_val can be in host or device memory.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# enable_boost enable/disable numeric boost.
# @param[in]
# tol tolerance to determine whether a numerical value is replaced or not.
# @param[in]
# boost_val boost value to replace a numerical value.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p info, \p tol, or \p boost_val is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseScsrilu02_numericBoost(void * handle,csrilu02Info_t info,int enable_boost,double * tol,float * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrilu02_numericBoost(void * handle,csrilu02Info_t info,int enable_boost,double * tol,double * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrilu02_numericBoost(void * handle,csrilu02Info_t info,int enable_boost,double * tol,float2 * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrilu02_numericBoost(void * handle,csrilu02Info_t info,int enable_boost,double * tol,double2 * boost_val) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsrilu02_bufferSize returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()"
# and \ref hipsparseScsrilu02 "hipsparseXcsrilu02()". The temporary storage buffer
# must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()" and
# \ref hipsparseScsrilu02 "hipsparseXcsrilu02()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes pointer
# is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseScsrilu02_bufferSize(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrilu02_bufferSize(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrilu02_bufferSize(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrilu02_bufferSize(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsrilu02_bufferSizeExt returns the size of the temporary storage buffer
# in bytes that is required by \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()"
# and \ref hipsparseScsrilu02 "hipsparseXcsrilu02()". The temporary storage buffer
# must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during the analysis step.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()" and
# \ref hipsparseScsrilu02 "hipsparseXcsrilu02()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBufferSizeInBytes pointer
# is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseScsrilu02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrilu02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrilu02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrilu02_bufferSizeExt(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXcsrilu02_analysis performs the analysis step for \ref hipsparseScsrilu02
# "hipsparseXcsrilu02()". It is expected that this function will be executed only once for
# a given matrix and particular operation type.
#
# \note
# If the matrix sparsity pattern changes, the gathered information will become invalid.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[in]
# csrSortedValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# info structure that holds the information collected during
# the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA,
# \p csrSortedRowPtrA, \p csrSortedColIndA, \p info, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseScsrilu02_analysis(void * handle,int m,int nnz,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrilu02_analysis(void * handle,int m,int nnz,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrilu02_analysis(void * handle,int m,int nnz,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrilu02_analysis(void * handle,int m,int nnz,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Incomplete LU factorization with 0 fill-ins and no pivoting using the CSR
# storage format.
#
# \details
# \p hipsparseXcsrilu02 computes the incomplete LU factorization with 0 fill-ins and no
# pivoting of a sparse \f$m \times m\f$ CSR matrix \f$A\f$, such that
# \f[
# A \approx LU
# \f]
# where the lower triangular matrix \f$L\f$ and the upper triangular matrix \f$U\f$ are computed using:
# \f[
# \begin{array}{ll}
# L_{ij} = \frac{1}{U_{jj}}(A_{ij} - \sum_{k=0}^{j-1}L_{ik} \times U_{kj}), & \text{if i > j} \\
# U_{ij} = (A_{ij} - \sum_{k=0}^{j-1}L_{ik} \times U_{kj}), & \text{if i <= j}
# \end{array}
# \f]
# for each entry found in the CSR matrix \f$A\f$.
#
# Computing the above incomplete \f$LU\f$ factorization requires three steps to complete. First,
# the user determines the size of the required temporary storage buffer by calling
# \ref hipsparseScsrilu02_bufferSize "hipsparseXcsrilu02_bufferSize()". After this buffer size has been determined,
# the user allocates the buffer and passes it to \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()".
# This will perform analysis on the sparsity pattern of the matrix. Finally, the user calls \p hipsparseScsrilu02,
# \p hipsparseDcsrilu02, \p hipsparseCcsrilu02, or \p hipsparseZcsrilu02 to perform the actual factorization. The calculation
# of the buffer size and the analysis of the sparse matrix only need to be performed once for a given sparsity pattern,
# while the factorization can be repeatedly applied to multiple matrices having the same sparsity pattern. After all calls
# to \ref hipsparseScsrilu02 "hipsparseXcsrilu02()" are complete, the temporary buffer can be deallocated.
#
# When computing the \f$LU\f$ factorization, it is possible that \f$U_{jj} == 0\f$ which would result in a division by zero.
# This could occur from either \f$A_{jj}\f$ not existing in the sparse CSR matrix (referred to as a structural zero) or because
# \f$A_{ij} - \sum_{k=0}^{j-1}L_{ik} \times U_{kj} == 0\f$ (referred to as a numerical zero). For example, running the
# \f$LU\f$ factorization on the following matrix:
# \f[
# \begin{bmatrix}
# 2 & 1 & 0 \\
# 1 & 2 & 1 \\
# 0 & 1 & 2
# \end{bmatrix}
# \f]
# results in a successful \f$LU\f$ factorization. However, running with the matrix:
# \f[
# \begin{bmatrix}
# 2 & 1 & 0 \\
# 1 & 1/2 & 1 \\
# 0 & 1 & 2
# \end{bmatrix}
# \f]
# results in a numerical zero because:
# \f[
# \begin{array}{ll}
# U_{00} &= 2 \\
# U_{01} &= 1 \\
# L_{10} &= \frac{1}{2} \\
# U_{11} &= \frac{1}{2} - \frac{1}{2}
# &= 0
# \end{array}
# \f]
# The user can detect the presence of a structural zero by calling \ref hipsparseXcsrilu02_zeroPivot() after
# \ref hipsparseScsrilu02_analysis "hipsparseXcsrilu02_analysis()" and/or the presence of a structural or
# numerical zero by calling \ref hipsparseXcsrilu02_zeroPivot() after \ref hipsparseScsrilu02 "hipsparseXcsrilu02()".
# In both cases, \ref hipsparseXcsrilu02_zeroPivot() will report the first zero pivot (either numerical or structural)
# found. See the example below. The user can also set the diagonal type to be \f$1\f$ using \ref hipsparseSetMatDiagType(),
# which will interpret the matrix \f$A\f$ as having ones on its diagonal (even if no nonzero exists in the sparsity pattern).
#
# \p hipsparseXcsrilu02 computes the \f$LU\f$ factorization inplace, meaning that the values array \p csrSortedValA_valM of the \f$A\f$
# matrix is overwritten with the \f$L\f$ matrix stored in the strictly lower triangular part of \f$A\f$ and the \f$U\f$ matrix
# stored in the upper part of \f$A\f$:
#
# \f[
# \begin{align}
# \begin{bmatrix}
# a_{00} & a_{01} & a_{02} \\
# a_{10} & a_{11} & a_{12} \\
# a_{20} & a_{21} & a_{22}
# \end{bmatrix}
# \rightarrow
# \begin{bmatrix}
# u_{00} & u_{01} & u_{02} \\
# l_{10} & u_{11} & u_{12} \\
# l_{20} & l_{21} & u_{22}
# \end{bmatrix}
# \end{align}
# \f]
# The row pointer array \p csrSortedRowPtrA and the column indices array \p csrSortedColIndA remain the same for \f$A\f$ and \f$LU\f$ as
# the incomplete factorization does not generate new non-zeros in \f$LU\f$ which do not already exist in \f$A\f$.
#
# The performance of computing \f$LU\f$ factorization with hipSPARSE greatly depends on the sparsity pattern
# of the matrix \f$A\f$, because this is what determines the amount of parallelism available.
#
# \note
# The sparse CSR matrix has to be sorted. This can be achieved by calling
# \ref hipsparseXcsrsort().
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix.
# @param[inout]
# csrSortedValA_valM array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start
# of every row of the sparse CSR matrix.
# @param[in]
# csrSortedColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# info structure that holds the information collected during the analysis step.
# @param[in]
# policy \ref HIPSPARSE_SOLVE_POLICY_NO_LEVEL or \ref HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p nnz, \p descrA, \p csrSortedValA_valM,
# \p csrSortedRowPtrA, or \p csrSortedColIndA pointer is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseScsrilu02(void * handle,int m,int nnz,void *const descrA,float * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrilu02(void * handle,int m,int nnz,void *const descrA,double * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrilu02(void * handle,int m,int nnz,void *const descrA,float2 * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrilu02(void * handle,int m,int nnz,void *const descrA,double2 * csrSortedValA_valM,const int * csrSortedRowPtrA,const int * csrSortedColIndA,csrilu02Info_t info,hipsparseSolvePolicy_t policy,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXgpsvInterleavedBatch_bufferSizeExt returns the size of the temporary storage
# buffer in bytes that is required by \ref hipsparseSgpsvInterleavedBatch "hipsparseXgpsvInterleavedBatch()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo algorithm to solve the linear system.
# @param[in]
# m size of the pentadiagonal linear system.
# @param[in]
# ds lower diagonal (distance 2) of the pentadiagonal system. The first two entries
# must be zero.
# @param[in]
# dl lower diagonal of the pentadiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the pentadiagonal system.
# @param[in]
# du upper diagonal of the pentadiagonal system. The last entry must be zero.
# @param[in]
# dw upper diagonal (distance 2) of the pentadiagonal system. The last two entries
# must be zero.
# @param[in]
# x Dense array of right-hand sides with dimension \p batchCount by \p m.
# @param[in]
# batchCount The number of systems to solve.
# @param[out]
# pBufferSizeInBytes Number of bytes of the temporary storage buffer required.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p alg, \p batchCount, \p ds, \p dl,
# \p d, \p du, \p dw, \p x, or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgpsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const float * ds,const float * dl,const float * d,const float * du,const float * dw,const float * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgpsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const double * ds,const double * dl,const double * d,const double * du,const double * dw,const double * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgpsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const float2 * ds,const float2 * dl,const float2 * d,const float2 * du,const float2 * dw,const float2 * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgpsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const double2 * ds,const double2 * dl,const double2 * d,const double2 * du,const double2 * dw,const double2 * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Interleaved batch pentadiagonal solver
#
# \details
# \p hipsparseXgpsvInterleavedBatch solves a batch of pentadiagonal linear systems
# \f[
# P^{i}*x^{i} = x^{i}
# \f]
# where for each batch \f$i=0\ldots\f$ \p batchCount, \f$P^{i}\f$ is a sparse pentadiagonal matrix and
# \f$x^{i}\f$ is a dense right-hand side vector. All of the pentadiagonal matrices, \f$P^{i}\f$, are
# packed in an interleaved fashion into five vectors: \p ds for the lowest diagonals, \p dl for the lower
# diagonals, \p d for the main diagonals, \p du for the upper diagonals, and \p dw for the highest digaonals.
# See below for a description of the interleaved memory pattern.
#
# Solving the batched pentadiagonal system involves two steps. First, the user calls
# \ref hipsparseSgpsvInterleavedBatch_bufferSizeExt "hipsparseSgpsvInterleavedBatch_bufferSizeExt()"
# to determine the size of the required temporary storage buffer. Once determined, the user allocates
# this buffer and passes it to \ref hipsparseSgpsvInterleavedBatch "hipsparseXgpsvInterleavedBatch()"
# to perform the actual solve. The \f$x^{i}\f$ vectors, which initially stores the right-hand side values, are
# overwritten with the solution after the call to
# \ref hipsparseSgpsvInterleavedBatch "hipsparseXgpsvInterleavedBatch()".
#
# Unlike the strided batch routines, which write each batch matrix one after the other in memory, the interleaved
# routines write the batch matrices such that each element from each matrix is written consecutively one after
# the other. For example, consider the following batch matrices:
#
# \f[
# \begin{bmatrix}
# t^{0}_{00} & t^{0}_{01} & t^{0}_{02} \\
# t^{0}_{10} & t^{0}_{11} & t^{0}_{12} \\
# t^{0}_{20} & t^{0}_{21} & t^{0}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{1}_{00} & t^{1}_{01} & t^{1}_{02} \\
# t^{1}_{10} & t^{1}_{11} & t^{1}_{12} \\
# t^{1}_{20} & t^{1}_{21} & t^{1}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{2}_{00} & t^{2}_{01} & t^{2}_{02} \\
# t^{2}_{10} & t^{2}_{11} & t^{2}_{12} \\
# t^{2}_{20} & t^{2}_{21} & t^{2}_{22}
# \end{bmatrix}
# \f]
#
# In interleaved format, the highest, higher, lowest, lower, and diagonal arrays would look like:
# \f[
# \begin{align}
# \text{lowest} &= \begin{bmatrix} 0 & 0 & 0 & 0 & 0 & 0 & t^{0}_{20} & t^{1}_{20} & t^{2}_{20} \end{bmatrix} \\
# \text{lower} &= \begin{bmatrix} 0 & 0 & 0 & t^{0}_{10} & t^{1}_{10} & t^{1}_{10} & t^{0}_{21} & t^{1}_{21} & t^{2}_{21} \end{bmatrix} \\
# \text{diagonal} &= \begin{bmatrix} t^{0}_{00} & t^{1}_{00} & t^{2}_{00} & t^{0}_{11} & t^{1}_{11} & t^{2}_{11} & t^{0}_{22} & t^{1}_{22} & t^{2}_{22} \end{bmatrix} \\
# \text{higher} &= \begin{bmatrix} t^{0}_{01} & t^{1}_{01} & t^{2}_{01} & t^{0}_{12} & t^{1}_{12} & t^{2}_{12} & 0 & 0 & 0 \end{bmatrix} \\
# \text{highest} &= \begin{bmatrix} t^{0}_{02} & t^{1}_{02} & t^{2}_{02} & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \\
# \end{align}
# \f]
# For the lowest array, the first \p 2*batchCount entries are zero, and for the lower array, the first \p batchCount entries are zero.
# For the upper array, the last \p batchCount entries are zero, and for the highest array, the last \p 2*batchCount entries are zero.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo algorithm to solve the linear system.
# @param[in]
# m size of the pentadiagonal linear system.
# @param[inout]
# ds lower diagonal (distance 2) of the pentadiagonal system. The first two entries
# must be zero.
# @param[inout]
# dl lower diagonal of the pentadiagonal system. The first entry must be zero.
# @param[inout]
# d main diagonal of the pentadiagonal system.
# @param[inout]
# du upper diagonal of the pentadiagonal system. The last entry must be zero.
# @param[inout]
# dw upper diagonal (distance 2) of the pentadiagonal system. The last two entries
# must be zero.
# @param[inout]
# x Dense array of right-hand-sides with dimension \p batchCount by \p m.
# @param[in]
# batchCount The number of systems to solve.
# @param[in]
# pBuffer Temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p alg, \p batchCount, \p ds,
# \p dl, \p d, \p du, \p dw, \p x, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgpsvInterleavedBatch(void * handle,int algo,int m,float * ds,float * dl,float * d,float * du,float * dw,float * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgpsvInterleavedBatch(void * handle,int algo,int m,double * ds,double * dl,double * d,double * du,double * dw,double * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgpsvInterleavedBatch(void * handle,int algo,int m,float2 * ds,float2 * dl,float2 * d,float2 * du,float2 * dw,float2 * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgpsvInterleavedBatch(void * handle,int algo,int m,double2 * ds,double2 * dl,double2 * d,double2 * du,double2 * dw,double2 * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseSgtsv2_bufferSizeExt returns the size of the temporary storage buffer
# that is required by \ref hipsparseSgtsv2 "hipsparseXgtsv2()". The temporary
# storage buffer must be allocated by the user.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# This routine supports execution in a hipGraph context.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system. Must be at least 2.
# @param[in]
# n number of columns in the dense matrix B. Must be non-negative.
# @param[in]
# dl lower diagonal of the tridiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last entry must be zero.
# @param[in]
# B dense matrix of size ( \p ldb, \p n ).
# @param[in]
# ldb leading dimension of B. Must satisfy \p ldb >= max(1, m).
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSgtsv2 "hipsparseXgtsv2()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p dl, \p d, \p du, \p B, or
# \p pBufferSizeInBytes is nullptr, \p m is less than 2, \p n is negative,
# or \p ldb is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2_bufferSizeExt(void * handle,int m,int n,const float * dl,const float * d,const float * du,const float * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2_bufferSizeExt(void * handle,int m,int n,const double * dl,const double * d,const double * du,const double * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2_bufferSizeExt(void * handle,int m,int n,const float2 * dl,const float2 * d,const float2 * du,const float2 * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2_bufferSizeExt(void * handle,int m,int n,const double2 * dl,const double2 * d,const double2 * du,const double2 * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Tridiagonal solver with pivoting
#
# \details
# \p hipsparseXgtsv2 solves a tridiagonal system for multiple right-hand sides using pivoting
# \f[
# T*B = B
# \f]
# where \f$T\f$ is a sparse tridiagonal matrix and \f$B\f$ is a dense \f$ldb \times n\f$ matrix storing the
# right-hand side vectors in column order. The tridiagonal matrix \f$T\f$ is defined by three vectors: \p dl
# for the lower diagonal, \p d for the main diagonal, and \p du for the upper diagonal.
#
# Solving the tridiagonal system involves two steps. First, the user calls
# \ref hipsparseSgtsv2_bufferSizeExt "hipsparseXgtsv2_bufferSizeExt()" to determine the size of the required
# temporary storage buffer. After this is determined, the user allocates the buffer and passes it to
# \ref hipsparseSgtsv2 "hipsparseXgtsv2()" to perform the actual solve. The \f$B\f$ dense matrix, which initially
# stores the \p n right-hand side vectors, is overwritten with the \p n solution vectors after the call to
# \ref hipsparseSgtsv2 "hipsparseXgtsv2()".
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# \note
# This routine supports execution in a hipGraph context.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system (must be >= 2).
# @param[in]
# n number of columns in the dense matrix B.
# @param[in]
# dl lower diagonal of the tridiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last entry must be zero.
# @param[inout]
# B Dense matrix of size ( \p ldb, \p n ).
# @param[in]
# ldb Leading dimension of B. Must satisfy \p ldb >= max(1, m).
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p ldb, \p dl, \p d,
# \p du, \p B, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2(void * handle,int m,int n,const float * dl,const float * d,const float * du,float * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2(void * handle,int m,int n,const double * dl,const double * d,const double * du,double * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2(void * handle,int m,int n,const float2 * dl,const float2 * d,const float2 * du,float2 * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2(void * handle,int m,int n,const double2 * dl,const double2 * d,const double2 * du,double2 * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXgtsvInterleavedBatch_bufferSizeExt returns the size of the temporary storage
# buffer in bytes that is required by \ref hipsparseSgtsvInterleavedBatch "hipsparseXgtsvInterleavedBatch()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo Algorithm to use when solving tridiagonal systems. Options are Thomas ( \p algo=0 ),
# LU ( \p algo=1 ), or QR ( \p algo=2 ). The Thomas algorithm is the fastest but is not
# stable, while LU and QR are slower but are stable.
# @param[in]
# m size of the tridiagonal linear system.
# @param[in]
# dl lower diagonal of the tridiagonal system. The first element of the lower diagonal must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last element of the upper diagonal must be zero.
# @param[inout]
# x Dense array of right-hand sides with dimension \p batchCount by \p m.
# @param[in]
# batchCount The number of systems to solve.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSgtsvInterleavedBatch "hipsparseSgtsvInterleavedBatch()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p batchCount, \p dl, \p d, \p du,
# \p x, or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const float * dl,const float * d,const float * du,const float * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const double * dl,const double * d,const double * du,const double * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const float2 * dl,const float2 * d,const float2 * du,const float2 * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsvInterleavedBatch_bufferSizeExt(void * handle,int algo,int m,const double2 * dl,const double2 * d,const double2 * du,const double2 * x,int batchCount,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Interleaved batch tridiagonal solver.
#
# \details
# \p hipsparseXgtsvInterleavedBatch solves a batched tridiagonal linear system
# \f[
# T^{i}*x^{i} = x^{i}
# \f]
# where for each batch \f$i=0\ldots\f$ \p batchCount, \f$T^{i}\f$ is a sparse tridiagonal matrix and
# \f$x^{i}\f$ is a dense right-hand side vector. All of the tridiagonal matrices, \f$T^{i}\f$, are
# packed in an interleaved fashion into three vectors: \p dl for the lower diagonals, \p d for the main
# diagonals, and \p du for the upper diagonals. See below for a description of the interleaved
# memory pattern.
#
# Solving the batched tridiagonal system involves two steps. First, the user calls
# \ref hipsparseSgtsvInterleavedBatch_bufferSizeExt "hipsparseXgtsvInterleavedBatch_bufferSizeExt()"
# to determine the size of the required temporary storage buffer. Once determined, the user allocates
# this buffer and passes it to \ref hipsparseSgtsvInterleavedBatch "hipsparseXgtsvInterleavedBatch()"
# to perform the actual solve. The \f$x^{i}\f$ vectors, which initially stores the right-hand side values, are
# overwritten with the solution after the call to
# \ref hipsparseSgtsvInterleavedBatch "hipsparseXgtsvInterleavedBatch()".
#
# The user can specify different algorithms for \p hipsparseXgtsvInterleavedBatch
# to use. Options are Thomas ( \p algo=0 ),
# LU ( \p algo=1 ), or QR ( \p algo=2 ).
#
# Unlike the strided batch routines, which write each batch matrix one after the other in memory, the interleaved
# routines write the batch matrices such that each element from each matrix is written consecutively one after
# the other. For example, consider the following batch matrices:
#
# \f[
# \begin{bmatrix}
# t^{0}_{00} & t^{0}_{01} & 0 \\
# t^{0}_{10} & t^{0}_{11} & t^{0}_{12} \\
# 0 & t^{0}_{21} & t^{0}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{1}_{00} & t^{1}_{01} & 0 \\
# t^{1}_{10} & t^{1}_{11} & t^{1}_{12} \\
# 0 & t^{1}_{21} & t^{1}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{2}_{00} & t^{2}_{01} & 0 \\
# t^{2}_{10} & t^{2}_{11} & t^{2}_{12} \\
# 0 & t^{2}_{21} & t^{2}_{22}
# \end{bmatrix}
# \f]
#
# In interleaved format, the upper, lower, and diagonal arrays would look like:
# \f[
# \begin{align}
# \text{lower} &= \begin{bmatrix} 0 & 0 & 0 & t^{0}_{10} & t^{1}_{10} & t^{1}_{10} & t^{0}_{21} & t^{1}_{21} & t^{2}_{21} \end{bmatrix} \\
# \text{diagonal} &= \begin{bmatrix} t^{0}_{00} & t^{1}_{00} & t^{2}_{00} & t^{0}_{11} & t^{1}_{11} & t^{2}_{11} & t^{0}_{22} & t^{1}_{22} & t^{2}_{22} \end{bmatrix} \\
# \text{upper} &= \begin{bmatrix} t^{0}_{01} & t^{1}_{01} & t^{2}_{01} & t^{0}_{12} & t^{1}_{12} & t^{2}_{12} & 0 & 0 & 0 \end{bmatrix} \\
# \end{align}
# \f]
# For the lower array, the first \p batchCount entries are zero, and for the upper array, the last \p batchCount
# entries are zero.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# algo Algorithm to use when solving tridiagonal systems. Options are Thomas ( \p algo=0 ),
# LU ( \p algo=1 ), or QR ( \p algo=2 ). The Thomas algorithm is the fastest but is not
# stable, while LU and QR are slower but are stable.
# @param[in]
# m size of the tridiagonal linear system.
# @param[inout]
# dl lower diagonal of the tridiagonal system. The first element of the lower diagonal must be zero.
# @param[inout]
# d main diagonal of the tridiagonal system.
# @param[inout]
# du upper diagonal of the tridiagonal system. The last element of the upper diagonal must be zero.
# @param[inout]
# x Dense array of right-hand sides with dimension \p batchCount by \p m.
# @param[in]
# batchCount The number of systems to solve.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p batchCount, \p dl, \p d,
# \p du, \p x, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsvInterleavedBatch(void * handle,int algo,int m,float * dl,float * d,float * du,float * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsvInterleavedBatch(void * handle,int algo,int m,double * dl,double * d,double * du,double * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsvInterleavedBatch(void * handle,int algo,int m,float2 * dl,float2 * d,float2 * du,float2 * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsvInterleavedBatch(void * handle,int algo,int m,double2 * dl,double2 * d,double2 * du,double2 * x,int batchCount,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXgtsv2_nopivot_bufferSizeExt returns the size of the temporary storage
# buffer in bytes that is required by \ref hipsparseSgtsv2_nopivot "hipsparseXgtsv2_nopivot()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system. Must be >= 2.
# @param[in]
# n number of columns in the dense matrix B. Must be non-negative.
# @param[in]
# dl lower diagonal of the tridiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last entry must be zero.
# @param[in]
# B Dense matrix of size ( \p ldb, \p n ).
# @param[in]
# ldb Leading dimension of B. Must satisfy \p ldb >= max(1, m).
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSgtsv2_nopivot "hipsparseXgtsv2_nopivot()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p dl, \p d, \p du, \p B, or
# \p pBufferSizeInBytes is nullptr, \p m is less than 2, \p n is negative,
# or \p ldb is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2_nopivot_bufferSizeExt(void * handle,int m,int n,const float * dl,const float * d,const float * du,const float * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2_nopivot_bufferSizeExt(void * handle,int m,int n,const double * dl,const double * d,const double * du,const double * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2_nopivot_bufferSizeExt(void * handle,int m,int n,const float2 * dl,const float2 * d,const float2 * du,const float2 * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2_nopivot_bufferSizeExt(void * handle,int m,int n,const double2 * dl,const double2 * d,const double2 * du,const double2 * B,int ldb,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Tridiagonal solver (no pivoting)
#
# \details
# \p hipsparseXgtsv2_nopivot solves a tridiagonal linear system for multiple right-hand sides without pivoting
# \f[
# T*B = B
# \f]
# where \f$T\f$ is a sparse tridiagonal matrix and \f$B\f$ is a dense \f$ldb \times n\f$ matrix storing the
# right-hand side vectors in column order. The tridiagonal matrix \f$T\f$ is defined by three vectors: \p dl
# for the lower diagonal, \p d for the main diagonal, and \p du for the upper diagonal.
#
# Solving the tridiagonal system with multiple right-hand sides without pivoting involves two steps. First,
# the user calls \ref hipsparseSgtsv2_nopivot_bufferSizeExt "hipsparseXgtsv2_nopivot_bufferSizeExt()"
# to determine the size of the required temporary storage buffer. Once determined, the user allocates this
# buffer and passes it to \ref hipsparseSgtsv2_nopivot "hipsparseXgtsv2_nopivot()" to perform the actual
# solve. The \f$B\f$ dense matrix, which initially stores the \p n right-hand side vectors, is overwritten
# with the \p n solution vectors after the call to \ref hipsparseSgtsv2_nopivot "hipsparseXgtsv2_nopivot()".
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system (must be >= 2).
# @param[in]
# n number of columns in the dense matrix B.
# @param[in]
# dl lower diagonal of the tridiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last entry must be zero.
# @param[inout]
# B Dense matrix of size ( \p ldb, \p n ).
# @param[in]
# ldb Leading dimension of B. Must satisfy \p ldb >= max(1, m).
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p ldb, \p dl, \p d,
# \p du, \p B, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2_nopivot(void * handle,int m,int n,const float * dl,const float * d,const float * du,float * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2_nopivot(void * handle,int m,int n,const double * dl,const double * d,const double * du,double * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2_nopivot(void * handle,int m,int n,const float2 * dl,const float2 * d,const float2 * du,float2 * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2_nopivot(void * handle,int m,int n,const double2 * dl,const double2 * d,const double2 * du,double2 * B,int ldb,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \details
# \p hipsparseXgtsv2StridedBatch_bufferSizeExt returns the size of the temporary storage
# buffer in bytes that is required by \ref hipsparseSgtsv2StridedBatch "hipsparseXgtsv2StridedBatch()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system.
# @param[in]
# dl lower diagonal of the tridiagonal system where the ith system lower diagonal starts at
# \p dl+batchStride*i.
# @param[in]
# d main diagonal of the tridiagonal system where the ith system diagonal starts at
# \p d+batchStride*i.
# @param[in]
# du upper diagonal of the tridiagonal system where the ith system upper diagonal starts at
# \p du+batchStride*i.
# @param[inout]
# x Dense array of right-hand sides where the ith right-hand side starts at \p x+batchStride*i.
# @param[in]
# batchCount The number of systems to solve.
# @param[in]
# batchStride The number of elements that separate each system, which must satisfy \p batchStride >= m.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseSgtsv2StridedBatch "hipsparseXgtsv2StridedBatch()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p batchCount, \p batchStride, \p dl,
# \p d, \p du, \p x, or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2StridedBatch_bufferSizeExt(void * handle,int m,const float * dl,const float * d,const float * du,const float * x,int batchCount,int batchStride,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2StridedBatch_bufferSizeExt(void * handle,int m,const double * dl,const double * d,const double * du,const double * x,int batchCount,int batchStride,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2StridedBatch_bufferSizeExt(void * handle,int m,const float2 * dl,const float2 * d,const float2 * du,const float2 * x,int batchCount,int batchStride,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2StridedBatch_bufferSizeExt(void * handle,int m,const double2 * dl,const double2 * d,const double2 * du,const double2 * x,int batchCount,int batchStride,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup precond_module
# \brief Strided batch tridiagonal solver (no pivoting).
#
# \details
# \p hipsparseXgtsv2StridedBatch solves a batched tridiagonal linear system
# \f[
# T^{i}*x^{i} = x^{i}
# \f]
# where for each batch \f$i=0\ldots\f$ \p batchCount, \f$T^{i}\f$ is a sparse tridiagonal matrix and
# \f$x^{i}\f$ is a dense right-hand side vector. All of the tridiagonal matrices, \f$T^{i}\f$, are
# packed one after the other into three vectors: \p dl for the lower diagonals, \p d for the main
# diagonals, and \p du for the upper diagonals. See below for a description of the strided
# memory pattern.
#
# Solving the batched tridiagonal system involves two steps. First, the user calls
# \ref hipsparseSgtsv2StridedBatch_bufferSizeExt "hipsparseXgtsv2StridedBatch_bufferSizeExt()"
# to determine the size of the required temporary storage buffer. After this is determined, the user allocates
# this buffer and passes it to \ref hipsparseSgtsv2StridedBatch "hipsparseXgtsv2StridedBatch()"
# to perform the actual solve. The \f$x^{i}\f$ vectors, which initially stores the right-hand side values, are
# overwritten with the solution after the call to
# \ref hipsparseSgtsv2StridedBatch "hipsparseXgtsv2StridedBatch()".
#
# The strided batch routines write each batch matrix one after the other in memory. For example, consider
# the following batch matrices:
#
# \f[
# \begin{bmatrix}
# t^{0}_{00} & t^{0}_{01} & 0 \\
# t^{0}_{10} & t^{0}_{11} & t^{0}_{12} \\
# 0 & t^{0}_{21} & t^{0}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{1}_{00} & t^{1}_{01} & 0 \\
# t^{1}_{10} & t^{1}_{11} & t^{1}_{12} \\
# 0 & t^{1}_{21} & t^{1}_{22}
# \end{bmatrix}
# \begin{bmatrix}
# t^{2}_{00} & t^{2}_{01} & 0 \\
# t^{2}_{10} & t^{2}_{11} & t^{2}_{12} \\
# 0 & t^{2}_{21} & t^{2}_{22}
# \end{bmatrix}
# \f]
#
# In strided format, the upper, lower, and diagonal arrays would look like:
# \f[
# \begin{align}
# \text{lower} &= \begin{bmatrix} 0 & t^{0}_{10} & t^{0}_{21} & 0 & t^{1}_{10} & t^{1}_{21} & 0 & t^{2}_{10} & t^{2}_{21} \end{bmatrix} \\
# \text{diagonal} &= \begin{bmatrix} t^{0}_{00} & t^{0}_{11} & t^{0}_{22} & t^{1}_{00} & t^{1}_{11} & t^{1}_{22} & t^{2}_{00} & t^{2}_{11} & t^{2}_{22} \end{bmatrix} \\
# \text{upper} &= \begin{bmatrix} t^{0}_{01} & t^{0}_{12} & 0 & t^{1}_{01} & t^{1}_{12} & 0 & t^{2}_{01} & t^{2}_{12} & 0 \end{bmatrix} \\
# \end{align}
# \f]
# For the lower array, for each batch \p i, the \p i*batchStride entries are zero, and for the upper array, the
# \p i*batchStride+batchStride-1 entries are zero.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m size of the tridiagonal linear system (must be >= 2).
# @param[in]
# dl lower diagonal of the tridiagonal system. The first entry must be zero.
# @param[in]
# d main diagonal of the tridiagonal system.
# @param[in]
# du upper diagonal of the tridiagonal system. The last entry must be zero.
# @param[inout]
# x Dense array of right-hand sides where the ith right-hand side starts at \p x+batchStride*i.
# @param[in]
# batchCount The number of systems to solve.
# @param[in]
# batchStride The number of elements that separate each system, which must satisfy \p batchStride >= m.
# @param[in]
# pBuffer temporary storage buffer allocated by the user.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p batchCount, \p batchStride, \p dl, \p d,
# \p du, \p x, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgtsv2StridedBatch(void * handle,int m,const float * dl,const float * d,const float * du,float * x,int batchCount,int batchStride,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgtsv2StridedBatch(void * handle,int m,const double * dl,const double * d,const double * du,double * x,int batchCount,int batchStride,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgtsv2StridedBatch(void * handle,int m,const float2 * dl,const float2 * d,const float2 * du,float2 * x,int batchCount,int batchStride,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgtsv2StridedBatch(void * handle,int m,const double2 * dl,const double2 * d,const double2 * du,double2 * x,int batchCount,int batchStride,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse BSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXbsr2csr converts a BSR matrix into a CSR matrix. It is assumed
# that \p csrValC, \p csrColIndC, and \p csrRowPtrC are allocated. Allocation size
# for \p csrRowPtrC is computed by the number of block rows multiplied by the block
# dimension plus one. Allocation for \p csrValC and \p 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:
# \f[
# \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]
# \f]
#
# The resulting CSR matrix row pointer, column indices, and values arrays are:
# \f[
# \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}
# \f]
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse BSR matrix, which must be non-negative.
# @param[in]
# nb number of block columns in the sparse BSR matrix, which must be non-negative.
# @param[in]
# descrA descriptor of the sparse BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# bsrValA array of \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# blockDim size of the blocks in the sparse BSR matrix. Must be positive.
# @param[in]
# descrC descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnzb*blockDim*blockDim elements containing the values of the sparse CSR matrix.
# @param[out]
# csrRowPtrC array of \p m+1 where \p m=mb*blockDim elements that point to the start of every row of the
# sparse CSR matrix.
# @param[out]
# csrColIndC array of \p nnzb*blockDim*blockDim elements containing the column indices of the sparse CSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p descrC, \p bsrValA,
# \p bsrRowPtrA, \p bsrColIndA, \p csrValC, \p csrRowPtrC, or \p csrColIndC is nullptr,
# \p mb or \p nb is negative, or \p blockDim is invalid.
#
cdef hipsparseStatus_t hipsparseSbsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,void *const descrC,float * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDbsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,void *const descrC,double * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCbsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,void *const descrC,float2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZbsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int blockDim,void *const descrC,double2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse COO matrix into a sparse CSR matrix.
#
# \details
# \p 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 and that all arrays have been allocated
# prior to calling \p hipsparseXcoo2csr.
#
# For example, given the COO row indices array:
# \f[
# \begin{align}
# \text{cooRowInd} &= \begin{bmatrix} 0 & 0 & 1 & 2 & 2 & 4 & 4 & 4 \end{bmatrix}
# \end{align}
# \f]
#
# the resulting CSR row pointer array after calling \p hipsparseXcoo2csr is:
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 3 & 5 & 8 \end{bmatrix}
# \end{align}
# \f]
#
# \note This function 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. In this case, 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 can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# cooRowInd array of \p nnz elements containing the row indices of the sparse COO
# matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix. Must be non-negative.
# @param[in]
# m number of rows of the sparse CSR matrix. Must be non-negative.
# @param[out]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p m or \p nnz is negative,
# \p cooRowInd or \p csrRowPtr is nullptr when \p nnz is greater than zero, or
# \p idxBase is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
cdef hipsparseStatus_t hipsparseXcoo2csr(void * handle,const int * cooRowInd,int nnz,int m,int * csrRowPtr,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse COO matrix.
#
# \details
# \p hipsparseXcoosort_bufferSizeExt returns the size of the temporary storage buffer
# in bytes required by \ref hipsparseXcoosortByRow() and \ref hipsparseXcoosortByColumn().
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse COO matrix.
# @param[in]
# n number of columns of the sparse COO matrix.
# @param[in]
# nnz number of non-zero entries of the sparse COO matrix.
# @param[in]
# cooRows array of \p nnz elements containing the row indices of the sparse
# COO matrix.
# @param[in]
# cooCols array of \p nnz elements containing the column indices of the sparse
# COO matrix.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseXcoosortByRow() and hipsparseXcoosortByColumn().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p cooRows,
# \p cooCols, or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
cdef hipsparseStatus_t hipsparseXcoosort_bufferSizeExt(void * handle,int m,int n,int nnz,const int * cooRows,const int * cooCols,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse COO matrix by row.
#
# \details
# \p hipsparseXcoosortByRow sorts a matrix in COO format by row. The sorted
# permutation vector \p P can be used to obtain sorted \p cooVal array. In this
# case, \p P must be initialized as the identity permutation. See
# \ref hipsparseCreateIdentityPermutation(). To apply the permutation vector to the COO
# values, see \ref hipsparseSgthr "hipsparseXgthr()".
#
# \p hipsparseXcoosortByRow requires an extra temporary storage buffer that must be
# allocated by the user. The storage buffer size can be determined by
# \ref hipsparseXcoosort_bufferSizeExt().
#
# \note
# \p P can be \p NULL if a sorted permutation vector is not required.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse COO matrix.
# @param[in]
# n number of columns of the sparse COO matrix.
# @param[in]
# nnz number of non-zero entries of the sparse COO matrix.
# @param[inout]
# cooRows array of \p nnz elements containing the row indices of the sparse
# COO matrix.
# @param[inout]
# cooCols array of \p nnz elements containing the column indices of the sparse
# COO matrix.
# @param[inout]
# P array of \p nnz integers containing the unsorted map indices. Can be
# \p NULL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseXcoosort_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p cooRows,
# \p cooCols, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
cdef hipsparseStatus_t hipsparseXcoosortByRow(void * handle,int m,int n,int nnz,int * cooRows,int * cooCols,int * P,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse COO matrix by column.
#
# \details
# \p hipsparseXcoosortByColumn sorts a matrix in COO format by column. The sorted
# permutation vector \p P can be used to obtain the sorted \p cooVal array. In this
# case, \p P must be initialized as the identity permutation. See
# \ref hipsparseCreateIdentityPermutation(). To apply the permutation vector to the COO
# values, see \ref hipsparseSgthr "hipsparseXgthr()".
#
# \p hipsparseXcoosortByColumn requires an extra temporary storage buffer that must be
# allocated by the user. The storage buffer size can be determined by
# \ref hipsparseXcoosort_bufferSizeExt().
#
# \note
# \p P can be \p NULL if a sorted permutation vector is not required.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse COO matrix.
# @param[in]
# n number of columns of the sparse COO matrix.
# @param[in]
# nnz number of non-zero entries of the sparse COO matrix.
# @param[inout]
# cooRows array of \p nnz elements containing the row indices of the sparse
# COO matrix.
# @param[inout]
# cooCols array of \p nnz elements containing the column indices of the sparse
# COO matrix.
# @param[inout]
# P array of \p nnz integers containing the unsorted map indices. Can be
# \p NULL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseXcoosort_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p cooRows,
# \p cooCols, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
cdef hipsparseStatus_t hipsparseXcoosortByColumn(void * handle,int m,int n,int nnz,int * cooRows,int * cooCols,int * P,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Create the identity map.
#
# \details
# \p hipsparseCreateIdentityPermutation stores the identity map in \p p, such that
# \f$p = 0:1:(n-1)\f$.
#
# \code{.c}
# for(i = 0; i < n; ++i)
# {
# p[i] = i;
# }
# \endcode
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPASRE library context queue.
# @param[in]
# n size of the map \p p.
# @param[out]
# p array of \p n integers containing the map.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p n, or \p p pointer is invalid.
cdef hipsparseStatus_t hipsparseCreateIdentityPermutation(void * handle,int n,int * p) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXcsc2dense functions convert the sparse matrix in CSC format into a dense matrix.
#
# \details
# Given the input CSC matrix of size \p mxn, the routine writes the matrix to the dense array \p A such
# that \p A has leading dimension \p ld and is column ordered. This means that \p A has size \p ldxn where
# \p ld>=m. All the parameters are assumed to have been preallocated by the user. If the input CSC matrix
# has index base of one, it must be set in the \ref hipsparseMatDescr_t. See \ref hipsparseSetMatIndexBase()
# prior to calling \p hipsparseXcsc2dense.
#
# For example, consider the sparse CSC matrix:
# \f[
# \begin{align}
# \text{cscRowInd} &= \begin{bmatrix} 0 & 1 & 2 & 1 & 2 & 0 & 2 \end{bmatrix} \\
# \text{cscColPtr} &= \begin{bmatrix} 0 & 3 & 4 & 5 & 7 \end{bmatrix} \\
# \text{cscVal} &= \begin{bmatrix} 1 & 3 & 5 & 4 & 6 & 2 & 7 \end{bmatrix} \\
# \end{align}
# \f]
#
# \p hipsparseXcsc2dense is used to convert to the dense matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# where the values in the \p A array are column ordered:
# \f[
# \text{A} &= \begin{bmatrix} 1 & 3 & 5 & 0 & 4 & 0 & 0 & 0 & 6 & 2 & 0 & 7 \end{bmatrix} \\
# \f]
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the application
# on the host before the entire result is ready.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# cscVal array of nnz ( = \p cscColPtr[n] - \p cscColPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# cscRowInd integer array of nnz ( = \p cscColPtr[n] - \p cscColPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[in]
# cscColPtr integer array of \p n+1 elements that contains the start of every column and the end of the last column plus one.
# @param[out]
# A array of dimensions (\p ld, \p n).
# @param[in]
# ld leading dimension of dense array \p A. Must be at least \p m.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p cscVal, \p cscColPtr,
# \p cscRowInd, or \p A is nullptr, \p m or \p n is negative, or \p ld is invalid.
#
cdef hipsparseStatus_t hipsparseScsc2dense(void * handle,int m,int n,void *const descr,const float * cscVal,const int * cscRowInd,const int * cscColPtr,float * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsc2dense(void * handle,int m,int n,void *const descr,const double * cscVal,const int * cscRowInd,const int * cscColPtr,double * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsc2dense(void * handle,int m,int n,void *const descr,const float2 * cscVal,const int * cscRowInd,const int * cscColPtr,float2 * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsc2dense(void * handle,int m,int n,void *const descr,const double2 * cscVal,const int * cscRowInd,const int * cscColPtr,double2 * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse CSC matrix.
#
# \details
# \p 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSC matrix.
# @param[in]
# n number of columns of the sparse CSC matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSC matrix.
# @param[in]
# cscColPtr array of \p n+1 elements that point to the start of every column of
# the sparse CSC matrix.
# @param[in]
# cscRowInd array of \p nnz elements containing the row indices of the sparse
# CSC matrix.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseXcscsort().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p cscColPtr, \p cscRowInd, or
# \p pBufferSizeInBytes pointer is invalid.
cdef hipsparseStatus_t hipsparseXcscsort_bufferSizeExt(void * handle,int m,int n,int nnz,const int * cscColPtr,const int * cscRowInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse CSC matrix
#
# \details
# \p hipsparseXcscsort sorts a matrix in CSC format. The sorted permutation vector
# \p P can be used to obtain sorted \p cscVal array. In this case, \p P must be
# initialized as the identity permutation. See \ref hipsparseCreateIdentityPermutation(). To
# apply the permutation vector to the CSC values, see \ref hipsparseSgthr
# "hipsparseXgthr()".
#
# \p hipsparseXcscsort requires extra temporary storage buffer that must be allocated by
# the user. The storage buffer size can be determined by \ref hipsparseXcscsort_bufferSizeExt().
#
# \note
# \p P can be \p NULL if a sorted permutation vector is not required.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSC matrix.
# @param[in]
# n number of columns of the sparse CSC matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSC matrix.
# @param[in]
# descrA descriptor of the sparse CSC matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# cscColPtr array of \p n+1 elements that point to the start of every column of
# the sparse CSC matrix.
# @param[inout]
# cscRowInd array of \p nnz elements containing the row indices of the sparse
# CSC matrix.
# @param[inout]
# P array of \p nnz integers containing the unsorted map indices. Can be
# \p NULL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseXcscsort_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p descrA, \p cscColPtr,
# \p cscRowInd, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcscsort(void * handle,int m,int n,int nnz,void *const descrA,const int * cscColPtr,int * cscRowInd,int * P,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the number of non-zero block columns per row and the total number of non-zero blocks in a sparse
# BSR matrix, given a sparse CSR matrix as input.
#
# \details
# Consider the matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7 \\
# 1 & 2 & 3 & 4
# \end{bmatrix}
# \f]
#
# stored as a sparse CSR matrix. This function computes both the BSR row pointer array as well as the total number
# of non-zero blocks that results when converting the CSR matrix to the BSR format. Assuming a block dimension of 2,
# the above matrix, after conversion to the BSR format, looks like:
#
# \f[
# \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]
# \f]
#
# and the resulting BSR row pointer array and total non-zero blocks after \p hipsparseXcsr2bsrNnz has been called
# looks like:
#
# \f[
# \begin{align}
# \text{bsrRowPtrC} &= \begin{bmatrix} 0 & 2 & 4 \end{bmatrix} \\
# \text{bsrNnzb} &= 4
# \end{align}
# \f]
#
# In general, when converting a CSR matrix of size \p m x \p n to a BSR matrix, the resulting BSR matrix will have size
# \p mb x \p nb where \p mb and \p nb equal:
#
# \f[
# \begin{align}
# \text{mb} &= \text{(m - 1) / blockDim + 1} \\
# \text{nb} &= \text{(n - 1) / blockDim + 1}
# \end{align}
# \f]
#
# In particular, it can be the case that \p blockDim does not divide evenly into \p m and/or \p n. In these cases, the
# CSR matrix is expanded in size to fit full BSR blocks. For example, using the original CSR matrix and block
# dimension 3 instead of 2, the function \p hipsparseXcsr2bsrNnz computes the BSR row pointer array and total number of
# non-zero blocks for the BSR matrix:
#
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c c}
# 1 & 0 & 0 \\
# 3 & 4 & 0 \\
# 5 & 0 & 6
# \end{array} &
# \begin{array}{c c c}
# 2 & 0 & 0 \\
# 0 & 0 & 0 \\
# 7 & 0 & 0
# \end{array} \\
# \hline
# \begin{array}{c c c}
# 1 & 2 & 3 \\
# 0 & 0 & 0 \\
# 0 & 0 & 0
# \end{array} &
# \begin{array}{c c c}
# 4 & 0 & 0 \\
# 0 & 0 & 0 \\
# 0 & 0 & 0
# \end{array} \\
# \end{array}
# \right]
# \f]
#
# See hipsparseScsr2bsr() for a full code example.
#
# \note
# The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW or by
# \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows of the sparse CSR matrix. Must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix. Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrRowPtrA integer array containing \p m+1 elements that points to the start of each row of the CSR matrix.
# @param[in]
# csrColIndA integer array of the column indices for each non-zero element in the CSR matrix.
# @param[in]
# blockDim the block dimension of the BSR matrix, which is between \f$1\f$ and \f$\min(m, n)\f$.
# @param[in]
# descrC descriptor of the sparse BSR matrix. Currently, only \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# bsrRowPtrC integer array containing \p mb+1 elements that point to the start of each block row of the BSR matrix.
# @param[out]
# bsrNnzb total number of non-zero elements in device or host memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p blockDim, \p csrRowPtrA, \p csrColIndA,
# \p bsrRowPtrC, or \p bsrNnzb pointer is invalid.
cdef hipsparseStatus_t hipsparseXcsr2bsrNnz(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const int * csrRowPtrA,const int * csrColIndA,int blockDim,void *const descrC,int * bsrRowPtrC,int * bsrNnzb) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse BSR matrix.
#
# \details
# \p hipsparseXcsr2bsr completes the conversion of a CSR matrix into a BSR matrix.
# It is assumed that \p bsrValC, \p bsrColIndC, and \p bsrRowPtrC are allocated. The
# allocation size for \p bsrRowPtr is computed as \p mb+1, where \p mb is the number of
# block rows in the BSR matrix defined as:
#
# \f[
# \begin{align}
# \text{mb} &= \text{(m - 1) / blockDim + 1}
# \end{align}
# \f]
#
# The allocation size for \p bsrColIndC, that is, \p bsrNnzb, is computed using
# \ref hipsparseXcsr2bsrNnz(), which also fills the \p bsrRowPtrC array. The allocation size
# for \p bsrValC is then equal to:
#
# \f[
# \text{bsrNnzb * blockDim * blockDim}
# \f]
#
# For example, given the CSR matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7 \\
# 1 & 2 & 3 & 4
# \end{bmatrix}
# \f]
#
# The resulting BSR matrix using block dimension 2 would look like:
# \f[
# \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]
# \f]
#
# The call to \ref hipsparseXcsr2bsrNnz results in the BSR row pointer array:
# \f[
# \begin{align}
# \text{bsrRowPtrC} &= \begin{bmatrix} 0 & 2 & 4 \end{bmatrix} \\
# \end{align}
# \f]
#
# and the call to \p hipsparseXcsr2bsr completes the conversion resulting in the BSR column indices and values arrays:
# \f[
# \begin{align}
# \text{bsrColIndC} &= \begin{bmatrix} 0 & 1 & 0 & 1 \end{bmatrix} \\
# \text{bsrValC} &= \begin{bmatrix} 1 & 0 & 3 & 4 & 0 & 2 & 0 & 0 & 5 & 0 & 1 & 2 & 6 & 7 & 3 & 4 \end{bmatrix} \\
# \end{align}
# \f]
#
# The \p dirA parameter determines the order of the BSR block values. The example above uses row order. Using column ordering
# would result instead in the BSR values array:
#
# \f[
# \text{bsrValC} &= \begin{bmatrix} 1 & 3 & 0 & 4 & 0 & 0 & 2 & 0 & 5 & 1 & 0 & 2 & 6 & 3 & 7 & 4 \end{bmatrix} \\
# \f]
#
# \note
# \p hipsparseXcsr2bsr requires extra temporary storage that is allocated internally if
# \p blockDim > 16.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnz elements containing the values of the sparse CSR matrix.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColIndA array of \p nnz elements containing the column indices of the sparse CSR matrix.
# @param[in]
# blockDim size of the blocks in the sparse BSR matrix.
# @param[in]
# descrC descriptor of the sparse BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# bsrValC array of \p nnzb*blockDim*blockDim containing the values of the sparse BSR matrix.
# @param[out]
# bsrRowPtrC array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[out]
# bsrColIndC array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p blockDim, \p bsrValC, \p bsrRowPtrC,
# \p bsrColIndC, \p csrValA, \p csrRowPtrA, or \p csrColIndA pointer is invalid.
#
cdef hipsparseStatus_t hipsparseScsr2bsr(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,int blockDim,void *const descrC,float * bsrValC,int * bsrRowPtrC,int * bsrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2bsr(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,int blockDim,void *const descrC,double * bsrValC,int * bsrRowPtrC,int * bsrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2bsr(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const float2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,int blockDim,void *const descrC,float2 * bsrValC,int * bsrRowPtrC,int * bsrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2bsr(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const double2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,int blockDim,void *const descrC,double2 * bsrValC,int * bsrRowPtrC,int * bsrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse COO matrix.
#
# \details
# \p hipsparseXcsr2coo converts the CSR array containing the row offsets that point
# to the start of every row into a COO array of row indices. All arrays are assumed
# to be allocated by the user prior to calling \p hipsparseXcsr2coo.
#
# For example, given the CSR row pointer array (assuming zero index base):
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 1 & 3 & 4 \end{bmatrix}
# \end{align}
# \f]
#
# Calling \p hipsparseXcsr2coo results in the COO row indices array:
# \f[
# \begin{align}
# \text{cooRowInd} &= \begin{bmatrix} 0 & 1 & 1 & 2 \end{bmatrix}
# \end{align}
# \f]
#
# \note
# This function 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 can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row
# of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix. Must be non-negative.
# @param[in]
# m number of rows of the sparse CSR matrix. Must be non-negative.
# @param[out]
# cooRowInd array of \p nnz elements containing the row indices of the sparse COO
# matrix.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p m or, \p nnz is negative,
# \p csrRowPtr or \p cooRowInd is nullptr when \p nnz is greater than zero, or
# \p idxBase is neither \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
cdef hipsparseStatus_t hipsparseXcsr2coo(void * handle,const int * csrRowPtr,int nnz,int m,int * cooRowInd,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse CSC matrix.
#
# \details
# \p hipsparseXcsr2csc converts a CSR matrix into a CSC matrix. \p hipsparseXcsr2csc
# can also be used to convert a CSC matrix into a CSR matrix. \p copyValues decides
# whether \p cscSortedVal is being filled during conversion (\ref HIPSPARSE_ACTION_NUMERIC)
# or not (\ref HIPSPARSE_ACTION_SYMBOLIC).
#
# For example given the matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# Represented using the sparse CSR format as:
# \f[
# \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}
# \f]
#
# this function converts it to the sparse CSC format:
# \f[
# \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}
# \f]
#
# The CSC arrays \p cscSortedRowInd, \p cscSortedColPtr, and \p cscSortedVal must be allocated by the
# user prior to calling \p hipsparseXcsr2csc().
#
# \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 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix, which must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrix, which must be non-negative.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix, which must be non-negative.
# @param[in]
# csrSortedVal array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColInd array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# cscSortedVal array of \p nnz elements of the sparse CSC matrix.
# @param[out]
# cscSortedRowInd array of \p nnz elements containing the row indices of the sparse CSC
# matrix.
# @param[out]
# cscSortedColPtr array of \p n+1 elements that point to the start of every column of the
# sparse CSC matrix.
# @param[in]
# copyValues \ref HIPSPARSE_ACTION_SYMBOLIC or \ref HIPSPARSE_ACTION_NUMERIC.
# @param[in]
# idxBase index base. \ref HIPSPARSE_INDEX_BASE_ZERO for zero-based indexing or
# \ref HIPSPARSE_INDEX_BASE_ONE for one-based indexing.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle is nullptr, \p m, \p n, or \p nnz is negative,
# \p csrSortedVal, \p csrSortedRowPtr, \p csrSortedColInd, \p cscSortedVal, \p cscSortedRowInd,
# or \p cscSortedColPtr is nullptr when \p nnz is greater than zero, \p copyValues is neither
# \ref HIPSPARSE_ACTION_SYMBOLIC nor \ref HIPSPARSE_ACTION_NUMERIC, or \p idxBase is neither
# \ref HIPSPARSE_INDEX_BASE_ZERO nor \ref HIPSPARSE_INDEX_BASE_ONE.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
#
cdef hipsparseStatus_t hipsparseScsr2csc(void * 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2csc(void * 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2csc(void * handle,int m,int n,int nnz,const float2 * csrSortedVal,const int * csrSortedRowPtr,const int * csrSortedColInd,float2 * cscSortedVal,int * cscSortedRowInd,int * cscSortedColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2csc(void * handle,int m,int n,int nnz,const double2 * csrSortedVal,const int * csrSortedRowPtr,const int * csrSortedColInd,double2 * cscSortedVal,int * cscSortedRowInd,int * cscSortedColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief This function computes the size of the user-allocated temporary storage buffer used
# when converting a sparse CSR matrix into a sparse CSC matrix.
#
# \details
# \p hipsparseCsr2cscEx2_bufferSize calculates the required user allocated temporary buffer needed
# by \ref hipsparseCsr2cscEx2 to convert a CSR matrix into a CSC matrix. \ref hipsparseCsr2cscEx2
# can also be used to convert a CSC matrix into a CSR matrix. \p copyValues decides
# whether \p cscVal is being filled during conversion (\ref HIPSPARSE_ACTION_NUMERIC)
# or not (\ref 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 can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# csrVal array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColInd array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# cscVal array of \p nnz elements of the sparse CSC matrix.
# @param[in]
# cscColPtr array of \p n+1 elements that point to the start of every column of the
# sparse CSC matrix.
# @param[in]
# cscRowInd array of \p nnz elements containing the row indices of the sparse
# CSC matrix.
# @param[in]
# valType The data type of the values arrays \p csrVal and \p cscVal. Can be HIP_R_32F,
# HIP_R_64F, HIP_C_32F, or HIP_C_64F.
# @param[in]
# copyValues \ref HIPSPARSE_ACTION_SYMBOLIC or \ref HIPSPARSE_ACTION_NUMERIC.
# @param[in]
# idxBase \ref HIPSPARSE_INDEX_BASE_ZERO or \ref HIPSPARSE_INDEX_BASE_ONE.
# @param[in]
# alg HIPSPARSE_CSR2CSC_ALG_DEFAULT, HIPSPARSE_CSR2CSC_ALG1, or HIPSPARSE_CSR2CSC_ALG2.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseCsr2cscEx2().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p csrRowPtr, \p csrColInd, or
# \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
cdef hipsparseStatus_t hipsparseCsr2cscEx2_bufferSize(void * 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 * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse CSC matrix.
#
# \details
# \p hipsparseCsr2cscEx2 converts a CSR matrix into a CSC matrix. \p hipsparseCsr2cscEx2
# can also be used to convert a CSC matrix into a CSR matrix. \p copyValues decides
# whether \p cscVal is being filled during conversion (\ref HIPSPARSE_ACTION_NUMERIC)
# or not (\ref 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 can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# csrVal array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColInd array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# cscVal array of \p nnz elements of the sparse CSC matrix.
# @param[in]
# cscColPtr array of \p n+1 elements that point to the start of every column of the
# sparse CSC matrix.
# @param[in]
# cscRowInd array of \p nnz elements containing the row indices of the sparse
# CSC matrix.
# @param[in]
# valType The data type of the values arrays \p csrVal and \p cscVal. Can be HIP_R_32F,
# HIP_R_64F, HIP_C_32F, or HIP_C_64F.
# @param[in]
# copyValues \ref HIPSPARSE_ACTION_SYMBOLIC or \ref HIPSPARSE_ACTION_NUMERIC.
# @param[in]
# idxBase \ref HIPSPARSE_INDEX_BASE_ZERO or \ref HIPSPARSE_INDEX_BASE_ONE.
# @param[in]
# alg HIPSPARSE_CSR2CSC_ALG_DEFAULT, HIPSPARSE_CSR2CSC_ALG1 or HIPSPARSE_CSR2CSC_ALG2.
# @param[in]
# buffer temporary storage buffer allocated by the user. The size is returned by
# hipsparseCsr2cscEx2_bufferSize().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p csrRowPtr, \p csrColInd, or
# \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
cdef hipsparseStatus_t hipsparseCsr2cscEx2(void * 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) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a compressed sparse CSR matrix.
#
# \details
# \p 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 \p tol:
#
# \f[
# C(i,j) = A(i, j) \text{ if |A(i, j)| > tol}
# \f]
#
# The user must first call \ref hipsparseSnnz_compress "hipsparseXnnz_compress()" to determine the number
# of non-zeros per row as well as the total number of non-zeros that will exist in resulting compressed CSR
# matrix. The user then uses this information to allocate the column indices array \p csrColIndC and the
# values array \p csrValC. The user then calls \p hipsparseXcsr2csr_compress to complete the conversion.
#
# \note
# In the case of complex matrices, only the magnitude of the real part of \p tol is used.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# descrA matrix descriptor for the CSR matrix.
# @param[in]
# csrValA array of \p nnzA elements of the sparse CSR matrix.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# uncompressed sparse CSR matrix.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the uncompressed
# sparse CSR matrix.
# @param[in]
# nnzA number of elements in the column indices and values arrays of the uncompressed
# sparse CSR matrix.
# @param[in]
# nnzPerRow array of length \p m containing the number of entries that will be kept per row in
# the final compressed CSR matrix.
# @param[out]
# csrValC array of \p nnzC elements of the compressed sparse CSC matrix.
# @param[out]
# csrRowPtrC array of \p m+1 elements that point to the start of every column of the compressed
# sparse CSR matrix.
# @param[out]
# csrColIndC array of \p nnzC elements containing the row indices of the compressed
# sparse CSR matrix.
# @param[in]
# tol the non-negative tolerance used for compression. If \p tol is complex, then only the magnitude
# of the real part is used. Entries in the input uncompressed CSR array that are below the tolerance
# are removed in the output compressed CSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p tol, \p csrValA, \p csrRowPtrA,
# \p csrColIndA, \p csrValC, \p csrRowPtrC, \p csrColIndC, or \p nnzPerRow pointer is invalid.
#
cdef hipsparseStatus_t hipsparseScsr2csr_compress(void * handle,int m,int n,void *const descrA,const float * csrValA,const int * csrColIndA,const int * csrRowPtrA,int nnzA,const int * nnzPerRow,float * csrValC,int * csrColIndC,int * csrRowPtrC,float tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2csr_compress(void * handle,int m,int n,void *const descrA,const double * csrValA,const int * csrColIndA,const int * csrRowPtrA,int nnzA,const int * nnzPerRow,double * csrValC,int * csrColIndC,int * csrRowPtrC,double tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2csr_compress(void * handle,int m,int n,void *const descrA,const float2 * csrValA,const int * csrColIndA,const int * csrRowPtrA,int nnzA,const int * nnzPerRow,float2 * csrValC,int * csrColIndC,int * csrRowPtrC,float2 tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2csr_compress(void * handle,int m,int n,void *const descrA,const double2 * csrValA,const int * csrColIndA,const int * csrRowPtrA,int nnzA,const int * nnzPerRow,double2 * csrValC,int * csrColIndC,int * csrRowPtrC,double2 tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function converts the sorted CSR format to the unsorted CSR format. The required
# temporary storage has to be allocated by the user.
#
cdef hipsparseStatus_t hipsparseScsr2csru(void * handle,int m,int n,int nnz,void *const descrA,float * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2csru(void * handle,int m,int n,int nnz,void *const descrA,double * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2csru(void * handle,int m,int n,int nnz,void *const descrA,float2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2csru(void * handle,int m,int n,int nnz,void *const descrA,double2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXcsr2dense functions convert the sparse matrix in CSR format into a dense matrix.
#
# \details
# Given the input CSR matrix of size \p mxn, the routine writes the matrix to the dense array \p A such
# that \p A has leading dimension \p ld and is column ordered. This means that \p A has size \p ldxn where
# \p ld>=m. All the parameters are assumed to have been preallocated by the user. If the input CSR matrix
# has index base of one, it must be set in the \ref hipsparseMatDescr_t. See \ref hipsparseSetMatIndexBase()
# prior to calling \p hipsparseXcsr2dense.
#
# For example, consider the sparse CSR matrix:
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 4 & 7 \end{bmatrix} \\
# \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 0 & 1 & 0 & 2 & 3 \end{bmatrix} \\
# \text{csrVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \end{bmatrix} \\
# \end{align}
# \f]
#
# \p hipsparseXcsr2dense is used to convert to the dense matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# where the values in the \p A array are column ordered:
# \f[
# \text{A} &= \begin{bmatrix} 1 & 3 & 5 & 0 & 4 & 0 & 0 & 0 & 6 & 2 & 0 & 7 \end{bmatrix} \\
# \f]
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the application
# on the host before the entire result is ready.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# descr the descriptor of the dense matrix \p A, the supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[in]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[out]
# A array of dimensions (\p ld, \p n).
# @param[in]
# ld leading dimension of dense array \p A. Must be at least \p m.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p csrVal, \p csrRowPtr,
# \p csrColInd, or \p A is nullptr, \p m or \p n is negative, or \p ld is invalid.
#
cdef hipsparseStatus_t hipsparseScsr2dense(void * handle,int m,int n,void *const descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,float * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2dense(void * handle,int m,int n,void *const descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,double * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2dense(void * handle,int m,int n,void *const descr,const float2 * csrVal,const int * csrRowPtr,const int * csrColInd,float2 * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2dense(void * handle,int m,int n,void *const descr,const double2 * csrVal,const int * csrRowPtr,const int * csrColInd,double2 * A,int ld) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse GEBSR matrix.
#
# \details
# \p hipsparseXcsr2gebsr_bufferSize returns the size of the temporary buffer that
# is required by \ref hipsparseXcsr2gebsrNnz and \ref hipsparseScsr2gebsr "hipsparseXcsr2gebsr()".
# After the temporary buffer size has been determined, it must be allocated by the user prior
# to calling \ref hipsparseXcsr2gebsrNnz and \ref hipsparseScsr2gebsr "hipsparseXcsr2gebsr()".
#
# See hipsparseScsr2gebsr() for a complete code example.
#
# \note
# The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dir direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW
# or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# csr_descr descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrVal array of \p nnz elements containing the values of the sparse CSR matrix.
# @param[in]
# csrRowPtr integer array containing \p m+1 elements that point to the start of each row of the CSR matrix.
# @param[in]
# csrColInd integer array of the column indices for each non-zero element in the CSR matrix.
# @param[in]
# rowBlockDim the row block dimension of the general BSR matrix. Between 1 and \p m.
# @param[in]
# colBlockDim the col block dimension of the general BSR matrix. Between 1 and \p n.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by \ref hipsparseXcsr2gebsrNnz()
# and \ref hipsparseScsr2gebsr "hipsparseXcsr2gebsr()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p rowBlockDim, \p colBlockDim, \p csrVal,
# \p csrRowPtr, \p csrColInd, or \p pBufferSizeInBytes pointer is invalid.
#
cdef hipsparseStatus_t hipsparseScsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const float2 * csrVal,const int * csrRowPtr,const int * csrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const double2 * csrVal,const int * csrRowPtr,const int * csrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the number of non-zero block columns per row and the total number of non-zero blocks in a sparse
# GEBSR matrix given a sparse CSR matrix as input.
#
# \details
# This is the second step in converting a CSR matrix to a GEBSR matrix. The user must first call
# \ref hipsparseScsr2gebsr_bufferSize "hipsparseXcsr2gebsr_bufferSize()" to determine the size of
# the required temporary storage buffer. The user then allocates this buffer as well as the
# \p bsrRowPtr array ( size \p mb+1 ) and passes both to \p hipsparseXcsr2gebsrNnz(). This second
# step then computes the number of non-zero block columns per row and the total number of non-zero blocks.
#
# In general, when converting a CSR matrix of size \p m x \p n to a GEBSR matrix, the resulting GEBSR matrix will have size
# \p mb x \p nb, where \p mb and \p nb equal:
# \f[
# \begin{align}
# \text{mb} &= \text{(m - 1) / rowBlockDim + 1} \\
# \text{nb} &= \text{(n - 1) / colBlockDim + 1}
# \end{align}
# \f]
#
# For example, given a matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 & 4 & 0 \\
# 3 & 4 & 0 & 0 & 5 & 1 \\
# 5 & 0 & 6 & 7 & 6 & 2
# \end{bmatrix}
# \f]
#
# represented in CSR format with the arrays:
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 3 & 7 & 12 \end{bmatrix} \\
# \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 4 & 0 & 1 & 4 & 5 & 0 & 2 & 3 & 4 & 5 \end{bmatrix} \\
# \text{csrVal} &= \begin{bmatrix} 1 & 2 & 4 & 3 & 4 & 5 & 1 & 5 & 6 & 7 & 6 & 2 \end{bmatrix}
# \end{align}
# \f]
#
# the \p bsrRowPtr array and total non-zero block count will be filled with:
# \f[
# \begin{align}
# \text{bsrRowPtr} &= \begin{bmatrix} 0 & 3 \end{bmatrix} \\
# \text{*bsrNnzDevhost} &= 3
# \end{align}
# \f]
#
# after calling \p hipsparseXcsr2gebsrNnz with \p rowBlockDim=3 and \p colBlockDim=2.
#
# \note
# As indicated, \p bsrNnzDevhost can point either to host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
#
# It might be the case that \p rowBlockDim does not divide evenly into \p m and/or that \p colBlockDim does not divide
# evenly into \p n. In these cases, the CSR matrix is expanded in size to fit full GEBSR blocks. For example,
# using the original CSR matrix but this time with \p rowBlockDim=2 and \p colBlockDim=3, the function
# \p hipsparseXcsr2gebsrNnz computes the GEBSR row pointer array and total number of non-zero blocks for the GEBSR matrix:
#
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c c}
# 1 & 0 & 0 \\
# 3 & 4 & 0
# \end{array} &
# \begin{array}{c c c}
# 2 & 4 & 0 \\
# 0 & 5 & 1
# \end{array} \\
# \hline
# \begin{array}{c c c}
# 5 & 0 & 6 \\
# 0 & 0 & 0
# \end{array} &
# \begin{array}{c c c}
# 7 & 6 & 2 \\
# 0 & 0 & 0
# \end{array}
# \end{array}
# \right]
# \f]
#
# See hipsparseScsr2gebsr() for a full code example.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dir direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW or by
# \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# csr_descr descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrRowPtr integer array containing \p m+1 elements that point to the start of each row of the CSR matrix.
# @param[in]
# csrColInd integer array of the column indices for each non-zero element in the CSR matrix.
# @param[in]
# bsr_descr descriptor of the sparse general BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# bsrRowPtr integer array containing \p mb+1 elements that point to the start of each block row of the general BSR matrix.
#
# @param[in]
# rowBlockDim the row block dimension of the general BSR matrix, which is between \f$1\f$ and \f$\min(m, n)\f$.
#
# @param[in]
# colBlockDim the col block dimension of the general BSR matrix, which is between \f$1\f$ and \f$\min(m, n)\f$.
#
# @param[out]
# bsrNnzDevhost total number of non-zero elements in device or host memory.
#
# @param[in]
# pbuffer buffer allocated by the user whose size is determined by calling \ref hipsparseScsr2gebsr_bufferSize
# "hipsparseXcsr2gebsr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p rowBlockDim, \p colBlockDim, \p csrRowPtr,
# \p csrColInd, \p bsrRowPtr, or \p bsrNnzDevhost pointer is invalid.
cdef hipsparseStatus_t hipsparseXcsr2gebsrNnz(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const int * csrRowPtr,const int * csrColInd,void *const bsr_descr,int * bsrRowPtr,int rowBlockDim,int colBlockDim,int * bsrNnzDevhost,void * pbuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse GEBSR matrix.
#
# \details
# \p hipsparseXcsr2gebsr converts a CSR matrix into a GEBSR matrix. It is assumed
# that \p bsrVal, \p bsrColInd, and \p bsrRowPtr are allocated. Allocation size
# for \p bsrRowPtr is computed as \p mb+1, where \p mb is the number of block rows in
# the GEBSR matrix. The number of non-zero blocks in the resulting GEBSR matrix
# is computed using \ref hipsparseXcsr2gebsrNnz, which also fills in \p bsrRowPtr.
#
# In more detail, \p hipsparseXcsr2gebsr is the third and final step of the conversion from CSR to GEBSR.
# The user first determines the size of the required user-allocated temporary storage buffer using
# \ref hipsparseScsr2gebsr_bufferSize "hipsparseXcsr2gebsr_bufferSize()". The user then allocates this buffer
# as well as the row pointer array \p bsrRowPtr with size \p mb+1, where \p mb is the number of block rows
# in the GEBSR matrix and \p nb is the number of block columns in GEBSR matrix:
#
# \f[
# \begin{align}
# \text{mb} &= \text{(m - 1) / rowBlockDim + 1} \\
# \text{nb} &= \text{(n - 1) / colBlockDim + 1}
# \end{align}
# \f]
#
# Both the temporary storage buffer and the GEBSR row pointer array are then passed to \ref hipsparseXcsr2gebsrNnz,
# which fills the GEBSR row pointer array \p bsrRowPtr and also computes the number of non-zero blocks,
# \p bsrNnzDevhost, that will exist in the GEBSR matrix. The user then allocates both the GEBSR column indices array
# \p bsrColInd with size \p bsrNnzDevhost as well as the GEBSR values array \p bsrVal with size
# \p bsrNnzDevhost*rowBlockDim*colBlockDim. Finally, with all arrays allocated, the conversion is completed by calling
# \p hipsparseXcsr2gebsr.
#
# For example, assuming the matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 & 4 & 0 \\
# 3 & 4 & 0 & 0 & 5 & 1 \\
# 5 & 0 & 6 & 7 & 6 & 2
# \end{bmatrix}
# \f]
#
# represented in CSR format with the arrays:
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 3 & 7 & 12 \end{bmatrix} \\
# \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 4 & 0 & 1 & 4 & 5 & 0 & 2 & 3 & 4 & 5 \end{bmatrix} \\
# \text{csrVal} &= \begin{bmatrix} 1 & 2 & 4 & 3 & 4 & 5 & 1 & 5 & 6 & 7 & 6 & 2 \end{bmatrix}
# \end{align}
# \f]
#
# then using \p rowBlockDim=3 and \p colBlockDim=2, the final GEBSR matrix is:
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c}
# 1 & 0 \\
# 3 & 4 \\
# 3 & 0
# \end{array} &
# \begin{array}{c c}
# 0 & 2 \\
# 0 & 0 \\
# 6 & 7
# \end{array} &
# \begin{array}{c c}
# 4 & 0 \\
# 5 & 1 \\
# 6 & 2
# \end{array}
# \end{array}
# \right]
# \f]
#
# and is represented with the arrays:
# \f[
# \begin{align}
# \text{bsrRowPtr} &= \begin{bmatrix} 0 & 3 \end{bmatrix} \\
# \text{bsrColInd} &= \begin{bmatrix} 0 & 1 & 2 \end{bmatrix} \\
# \text{bsrVal} &= \begin{bmatrix} 1 & 0 & 3 & 4 & 3 & 0 & 0 & 2 & 0 & 0 & 6 & 7 & 4 & 0 & 5 & 1 & 6 & 2 \end{bmatrix}
# \end{align}
# \f]
#
# The above example assumes that the blocks are row ordered. If instead the blocks are column ordered, the \p bsrVal arrays
# become:
# \f[
# \begin{align}
# \text{bsrVal} &= \begin{bmatrix} 1 & 3 & 3 & 0 & 4 & 0 & 0 & 0 & 6 & 2 & 0 & 7 & 4 & 5 & 6 & 0 & 1 & 2 \end{bmatrix}
# \end{align}
# \f]
#
# The block order direction is determined by \p dir.
#
# It might be the case that \p rowBlockDim does not divide evenly into \p m and/or that \p colBlockDim does not divide
# evenly into \p n. In these cases, the CSR matrix is expanded in size to fit full GEBSR blocks. For example,
# using the original CSR matrix but this time with \p rowBlockDim=2 and \p colBlockDim=3, the resulting GEBSR matrix
# would look like:
#
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c c}
# 1 & 0 & 0 \\
# 3 & 4 & 0
# \end{array} &
# \begin{array}{c c c}
# 2 & 4 & 0 \\
# 0 & 5 & 1
# \end{array} \\
# \hline
# \begin{array}{c c c}
# 5 & 0 & 6 \\
# 0 & 0 & 0
# \end{array} &
# \begin{array}{c c c}
# 7 & 6 & 2 \\
# 0 & 0 & 0
# \end{array}
# \end{array}
# \right]
# \f]
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dir the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# csr_descr descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrVal array of \p nnz elements containing the values of the sparse CSR matrix.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColInd array of \p nnz elements containing the column indices of the sparse CSR matrix.
# @param[in]
# bsr_descr descriptor of the sparse BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# bsrVal array of \p nnzb* \p rowBlockDim* \p colBlockDim containing the values of the sparse BSR matrix.
# @param[out]
# bsrRowPtr array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[out]
# bsrColInd array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# rowBlockDim row size of the blocks in the sparse general BSR matrix.
# @param[in]
# colBlockDim col size of the blocks in the sparse general BSR matrix.
# @param[in]
# pbuffer buffer allocated by the user. The buffer size is determined by calling \ref hipsparseScsr2gebsr_bufferSize
# "hipsparseXcsr2gebsr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p rowBlockDim, \p colBlockDim, \p bsrVal,
# \p bsrRowPtr, \p bsrColInd, \p csrVal, \p csrRowPtr, or \p csrColInd pointer is invalid.
#
cdef hipsparseStatus_t hipsparseScsr2gebsr(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,void *const bsr_descr,float * bsrVal,int * bsrRowPtr,int * bsrColInd,int rowBlockDim,int colBlockDim,void * pbuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2gebsr(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,void *const bsr_descr,double * bsrVal,int * bsrRowPtr,int * bsrColInd,int rowBlockDim,int colBlockDim,void * pbuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2gebsr(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const float2 * csrVal,const int * csrRowPtr,const int * csrColInd,void *const bsr_descr,float2 * bsrVal,int * bsrRowPtr,int * bsrColInd,int rowBlockDim,int colBlockDim,void * pbuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2gebsr(void * handle,hipsparseDirection_t dir,int m,int n,void *const csr_descr,const double2 * csrVal,const int * csrRowPtr,const int * csrColInd,void *const bsr_descr,double2 * bsrVal,int * bsrRowPtr,int * bsrColInd,int rowBlockDim,int colBlockDim,void * pbuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse CSR matrix into a sparse HYB matrix.
#
# \details
# \p hipsparseXcsr2hyb converts a CSR matrix into a HYB matrix. It is assumed
# that \p hyb has been initialized with \ref 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 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix, which must be non-negative.
# @param[in]
# n number of columns of the sparse CSR matrix, which must be non-negative.
# @param[in]
# descrA descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrSortedValA array containing the values of the sparse CSR matrix.
# @param[in]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrSortedColIndA array containing the column indices of the sparse CSR matrix.
# @param[out]
# hybA sparse matrix in HYB format.
# @param[in]
# userEllWidth width of the ELL part of the HYB matrix (only required if
# \p partitionType == \ref HIPSPARSE_HYB_PARTITION_USER). Must be non-negative.
# @param[in]
# partitionType \ref HIPSPARSE_HYB_PARTITION_AUTO (recommended),
# \ref HIPSPARSE_HYB_PARTITION_USER, or
# \ref HIPSPARSE_HYB_PARTITION_MAX.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p hybA, \p csrSortedValA,
# \p csrSortedRowPtrA, or \p csrSortedColIndA is nullptr, \p m or \p n is negative, or
# \p userEllWidth or \p partitionType is invalid.
# \retval HIPSPARSE_STATUS_ALLOC_FAILED the buffer for the HYB matrix could not be allocated.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseScsr2hyb(void * handle,int m,int n,void *const descrA,const float * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,void * hybA,int userEllWidth,hipsparseHybPartition_t partitionType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsr2hyb(void * handle,int m,int n,void *const descrA,const double * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,void * hybA,int userEllWidth,hipsparseHybPartition_t partitionType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsr2hyb(void * handle,int m,int n,void *const descrA,const float2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,void * hybA,int userEllWidth,hipsparseHybPartition_t partitionType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsr2hyb(void * handle,int m,int n,void *const descrA,const double2 * csrSortedValA,const int * csrSortedRowPtrA,const int * csrSortedColIndA,void * hybA,int userEllWidth,hipsparseHybPartition_t partitionType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse CSR matrix.
#
# \details
# \p 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColInd array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# \ref hipsparseXcsrsort().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p csrRowPtr, \p csrColInd, or
# \p pBufferSizeInBytes pointer is invalid.
cdef hipsparseStatus_t hipsparseXcsrsort_bufferSizeExt(void * handle,int m,int n,int nnz,const int * csrRowPtr,const int * csrColInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Sort a sparse CSR matrix.
#
# \details
# \p hipsparseXcsrsort sorts a matrix in CSR format. The sorted permutation vector
# \p P can be used to obtain the sorted \p csrVal array. In this case, \p P must be
# initialized as the identity permutation. See \ref hipsparseCreateIdentityPermutation(). To
# apply the permutation vector to the CSR values, see \ref hipsparseSgthr
# "hipsparseXgthr()".
#
# \p hipsparseXcsrsort requires extra temporary storage buffer that must be allocated by
# the user. The storage buffer size can be determined by hipsparseXcsrsort_bufferSizeExt().
#
# \note
# \p P can be \p NULL if a sorted permutation vector is not required.
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# n number of columns of the sparse CSR matrix.
# @param[in]
# nnz number of non-zero entries of the sparse CSR matrix.
# @param[in]
# descrA descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[inout]
# csrColInd array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[inout]
# P array of \p nnz integers containing the unsorted map indices. Can be
# \p NULL.
# @param[in]
# pBuffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseXcsrsort_bufferSizeExt().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnz, \p descrA, \p csrRowPtr,
# \p csrColInd, or \p pBuffer pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED
# \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
cdef hipsparseStatus_t hipsparseXcsrsort(void * handle,int m,int n,int nnz,void *const descrA,const int * csrRowPtr,int * csrColInd,int * P,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function calculates the amount of temporary storage in bytes required for
# \p hipsparseXcsru2csr() and \p hipsparseXcsr2csru().
#
cdef hipsparseStatus_t hipsparseScsru2csr_bufferSizeExt(void * handle,int m,int n,int nnz,float * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsru2csr_bufferSizeExt(void * handle,int m,int n,int nnz,double * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsru2csr_bufferSizeExt(void * handle,int m,int n,int nnz,float2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsru2csr_bufferSizeExt(void * handle,int m,int n,int nnz,double2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function converts the unsorted CSR format to the sorted CSR format. The required
# temporary storage has to be allocated by the user.
#
cdef hipsparseStatus_t hipsparseScsru2csr(void * handle,int m,int n,int nnz,void *const descrA,float * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsru2csr(void * handle,int m,int n,int nnz,void *const descrA,double * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsru2csr(void * handle,int m,int n,int nnz,void *const descrA,float2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsru2csr(void * handle,int m,int n,int nnz,void *const descrA,double2 * csrVal,const int * csrRowPtr,int * csrColInd,csru2csrInfo_t info,void * pBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXdense2csc functions convert the matrix \p A in dense format into a sparse matrix in CSC format.
#
# \details
# Given a dense, column-ordered, matrix \p A with leading dimension \p ld, where \p ld>=m,
# \p hipsparseXdense2csc converts the matrix to a sparse CSC format matrix.
# All the parameters are assumed to have been preallocated by the user and the arrays
# are filled in based on number of non-zeros per row, which can be pre-computed with
# \ref hipsparseSnnz "hipsparseXnnz()". Users can set the desired index base in the output CSC
# matrix by setting it in the \ref hipsparseMatDescr_t. See \ref hipsparseSetMatIndexBase().
#
# As an example, if using index base zero (that is, the default) and the dense
# matrix:
#
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# where the \p A values have column ordering with leading dimension \p ld=m:
# \f[
# \text{A} &= \begin{bmatrix} 1 & 3 & 5 & 0 & 4 & 0 & 0 & 0 & 6 & 2 & 0 & 7 \end{bmatrix} \\
# \f]
#
# the conversion results in the CSC arrays:
#
# \f[
# \begin{align}
# \text{cscRowInd} &= \begin{bmatrix} 0 & 1 & 2 & 1 & 2 & 0 & 2 \end{bmatrix} \\
# \text{cscColPtr} &= \begin{bmatrix} 0 & 3 & 4 & 5 & 7 \end{bmatrix} \\
# \text{cscVal} &= \begin{bmatrix} 1 & 3 & 5 & 4 & 6 & 2 & 7 \end{bmatrix} \\
# \end{align}
# \f]
#
# This function works very similar to \ref hipsparseSdense2csr "hipsparseXdense2csr()".
# See hipsparseSdense2csr() for a code example.
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the
# application on the host before the entire result is ready.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 11.0+) and will be
# removed in CUDA 12.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# A array of dimensions (\p ld, \p n).
# @param[in]
# ld leading dimension of dense array \p A. Must be at least \p m.
# @param[in]
# nnzPerColumn array of size \p n containing the number of non-zero elements per column.
# @param[out]
# cscVal array of nnz ( = \p cscColPtr[n] - \p cscColPtr[0] ) nonzero elements of matrix \p A.
# @param[out]
# cscRowInd integer array of nnz ( = \p cscColPtr[n] - \p cscColPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[out]
# cscColPtr integer array of \p n+1 elements that contains the start of every column and the end of the last column plus one.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p A, \p nnzPerColumn, \p cscVal,
# \p cscColPtr, or \p cscRowInd is nullptr, \p m or \p n is negative, or \p ld is invalid.
#
cdef hipsparseStatus_t hipsparseSdense2csc(void * handle,int m,int n,void *const descr,const float * A,int ld,const int * nnzPerColumn,float * cscVal,int * cscRowInd,int * cscColPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDdense2csc(void * handle,int m,int n,void *const descr,const double * A,int ld,const int * nnzPerColumn,double * cscVal,int * cscRowInd,int * cscColPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCdense2csc(void * handle,int m,int n,void *const descr,const float2 * A,int ld,const int * nnzPerColumn,float2 * cscVal,int * cscRowInd,int * cscColPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZdense2csc(void * handle,int m,int n,void *const descr,const double2 * A,int ld,const int * nnzPerColumn,double2 * cscVal,int * cscRowInd,int * cscColPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXdense2csr converts the matrix \p A in dense format into a sparse matrix in CSR format.
#
# \details
# Given a dense, column-ordered matrix \p A with leading dimension \p ld where \p ld>=m,
# \p hipsparseXdense2csr converts the matrix to a sparse CSR format matrix. All the parameters
# are assumed to have been pre-allocated by the user and the arrays are filled in based on the number
# of non-zeros per row, which can be pre-computed with \ref hipsparseSnnz "hipsparseXnnz()". The
# desired index base in the output CSR matrix is set in the \ref hipsparseMatDescr_t. See
# \ref hipsparseSetMatIndexBase().
#
# As an example, if using index base zero (which is the default) and the dense
# matrix:
#
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# The conversion results in the CSR arrays:
#
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 4 & 7 \end{bmatrix} \\
# \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 0 & 1 & 0 & 2 & 3 \end{bmatrix} \\
# \text{csrVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7 \end{bmatrix} \\
# \end{align}
# \f]
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the
# application on the host before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# A array of dimensions (\p ld, \p n).
# @param[in]
# ld leading dimension of dense array \p A, which must be at least \p m.
# @param[in]
# nnzPerRow array of size \p m containing the number of non-zero elements per row.
# @param[out]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[out]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[out]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descr, \p A, \p nnzPerRow, \p csrVal,
# \p csrRowPtr, or \p csrColInd is nullptr, \p m or \p n is negative, or \p ld is invalid.
#
cdef hipsparseStatus_t hipsparseSdense2csr(void * handle,int m,int n,void *const descr,const float * A,int ld,const int * nnzPerRow,float * csrVal,int * csrRowPtr,int * csrColInd) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDdense2csr(void * handle,int m,int n,void *const descr,const double * A,int ld,const int * nnzPerRow,double * csrVal,int * csrRowPtr,int * csrColInd) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCdense2csr(void * handle,int m,int n,void *const descr,const float2 * A,int ld,const int * nnzPerRow,float2 * csrVal,int * csrRowPtr,int * csrColInd) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZdense2csr(void * handle,int m,int n,void *const descr,const double2 * A,int ld,const int * nnzPerRow,double2 * csrVal,int * csrRowPtr,int * csrColInd) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse GEBSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXgebsr2csr converts a GEBSR matrix into a CSR matrix. It is assumed
# that \p csrValC, \p csrColIndC, and \p csrRowPtrC are already allocated prior to
# calling \p hipsparseXgebsr2csr. Allocation size for \p csrRowPtrC equals
# \p m+1 where:
#
# \f[
# \begin{align}
# \text{m} &= \text{mb * rowBlockDim} \\
# \text{n} &= \text{nb * colBlockDim}
# \end{align}
# \f]
#
# Allocation size for \p csrValC and \p csrColIndC is computed by the the number of blocks in the GEBSR
# matrix, \p nnzb, multiplied by the product of the block dimensions, that is, \p nnz=nnzb*rocBlockDim*colBlockDim.
#
# For example, given the GEBSR matrix:
# \f[
# \left[
# \begin{array}{c | c | c}
# \begin{array}{c c}
# 6 & 2 \\
# 1 & 4 \\
# 5 & 4
# \end{array} &
# \begin{array}{c c}
# 0 & 3 \\
# 5 & 0 \\
# 0 & 7
# \end{array} &
# \begin{array}{c c}
# 0 & 0 \\
# 0 & 0 \\
# 0 & 0
# \end{array} \\
# \hline
# \begin{array}{c c}
# 0 & 0 \\
# 0 & 0 \\
# 0 & 0
# \end{array} &
# \begin{array}{c c}
# 3 & 0 \\
# 0 & 0 \\
# 0 & 7
# \end{array} &
# \begin{array}{c c}
# 2 & 2 \\
# 4 & 3 \\
# 1 & 4
# \end{array} \\
# \end{array}
# \right]
# \f]
#
# \note
# This function is non-blocking and executed asynchronously with respect to the host.
# It can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows in the sparse general BSR matrix.
# @param[in]
# nb number of block columns in the sparse general BSR matrix.
# @param[in]
# descrA descriptor of the sparse general BSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# bsrValA array of \p nnzb*rowBlockDim*colBlockDim containing the values of the sparse BSR matrix.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse BSR matrix.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse BSR matrix.
# @param[in]
# rowBlockDim row size of the blocks in the sparse general BSR matrix.
# @param[in]
# colBlockDim column size of the blocks in the sparse general BSR matrix.
# @param[in]
# descrC descriptor of the sparse CSR matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnzb*rowBlockDim*colBlockDim elements containing the values of the sparse CSR matrix.
# @param[out]
# csrRowPtrC array of \p m+1 where \p m=mb*rowBlockDim elements that point to the start of every row of the
# sparse CSR matrix.
# @param[out]
# csrColIndC array of \p nnzb*block_dim*block_dim elements containing the column indices of the sparse CSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p block_dim, \p bsrValA,
# \p bsrRowPtrA, \p bsrColIndA, \p csrValC, \p csrRowPtrC, or \p csrColIndC pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSgebsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDim,int colBlockDim,void *const descrC,float * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgebsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDim,int colBlockDim,void *const descrC,double * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgebsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDim,int colBlockDim,void *const descrC,float2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgebsr2csr(void * handle,hipsparseDirection_t dirA,int mb,int nb,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDim,int colBlockDim,void *const descrC,double2 * csrValC,int * csrRowPtrC,int * csrColIndC) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse GEBSR matrix into a sparse GEBSC matrix.
#
# \details
# \p hipsparseXgebsr2gebsc_bufferSize returns the size of the temporary storage buffer
# required by \ref hipsparseSgebsr2gebsc "hipsparseXgebsr2gebsc()". This is the first step
# in converting a sparse matrix in GEBSR format to a sparse matrix in GEBSC format. After
# the size of the temporary storage buffer has been determined, it must be allocated by the user.
#
# See hipsparseSgebsr2gebsc() for a complete code example.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# mb number of rows of the sparse General BSR matrix.
# @param[in]
# nb number of columns of the sparse General BSR matrix.
# @param[in]
# nnzb number of non-zero entries of the sparse General BSR matrix.
# @param[in]
# bsrVal array of \p nnzb*rowBlockDim*colBlockDim containing the values of the sparse General
# BSR matrix.
# @param[in]
# bsrRowPtr array of \p mb+1 elements that point to the start of every row of the
# sparse General BSR matrix.
# @param[in]
# bsrColInd array of \p nnzb elements containing the column indices of the sparse
# General BSR matrix.
# @param[in]
# rowBlockDim row size of the blocks in the sparse General BSR matrix.
# @param[in]
# colBlockDim column size of the blocks in the sparse General BSR matrix.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSgebsr2gebsc(), hipsparseDgebsr2gebsc(), hipsparseCgebsr2gebsc(), and
# hipsparseZgebsr2gebsc().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p nnzb, \p bsrRowPtr, \p bsrColInd,
# or \p pBufferSizeInBytes pointer is invalid.
# \retval rocsparse_status_internal_error an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgebsr2gebsc_bufferSize(void * handle,int mb,int nb,int nnzb,const float * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgebsr2gebsc_bufferSize(void * handle,int mb,int nb,int nnzb,const double * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgebsr2gebsc_bufferSize(void * handle,int mb,int nb,int nnzb,const float2 * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgebsr2gebsc_bufferSize(void * handle,int mb,int nb,int nnzb,const double2 * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse GEBSR matrix into a sparse GEBSC matrix
#
# \details
# \p hipsparseXgebsr2gebsc converts a GEBSR matrix into a GEBSC matrix. \p hipsparseXgebsr2gebsc
# can also be used to convert a GEBSC matrix into a GEBSR matrix. \p copyValues decides
# whether \p bscVal is being filled during conversion (\ref HIPSPARSE_ACTION_NUMERIC)
# or not (\ref HIPSPARSE_ACTION_SYMBOLIC).
#
# \p hipsparseXgebsr2gebsc requires extra temporary storage buffer that has to be allocated
# by the user. Storage buffer size can be determined by \ref hipsparseSgebsr2gebsc_bufferSize
# "hipsparseXgebsr2gebsc_bufferSize()".
#
# For example, given the GEBSR matrix:
# \f[
# \left[
# \begin{array}{c | c}
# \begin{array}{c c}
# 1 & 2 \\
# 3 & 4 \\
# 6 & 0
# \end{array} &
# \begin{array}{c c}
# 0 & 2 \\
# 0 & 0 \\
# 3 & 4
# \end{array} \\
# \hline
# \begin{array}{c c}
# 5 & 0 \\
# 1 & 2 \\
# 3 & 4
# \end{array} &
# \begin{array}{c c}
# 6 & 7 \\
# 3 & 4 \\
# 3 & 4
# \end{array} \\
# \end{array}
# \right]
# \f]
#
# represented with the arrays:
# \f[
# \begin{align}
# \text{bsrRowPtr} &= \begin{bmatrix} 0 & 2 & 4 \end{bmatrix} \\
# \text{bsrColInd} &= \begin{bmatrix} 0 & 1 & 0 & 1 \end{bmatrix} \\
# \text{bsrVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 6 & 0 & 0 & 2 & 0 & 0 & 3 & 4 & 5 & 0 & 1 & 2 & 3 & 4 & 6 & 7 & 3 & 4 & 3 & 4 \end{bmatrix}
# \end{align}
# \f]
#
# this function converts the matrix to GEBSC format:
# \f[
# \begin{align}
# \text{bscRowInd} &= \begin{bmatrix} 0 & 1 & 0 & 1 \end{bmatrix} \\
# \text{bscColPtr} &= \begin{bmatrix} 0 & 2 & 4 \end{bmatrix} \\
# \text{bscVal} &= \begin{bmatrix} 1 & 2 & 3 & 4 & 6 & 0 & 5 & 0 & 1 & 2 & 3 & 4 & 0 & 2 & 0 & 0 & 3 & 4 & 6 & 7 & 3 & 4 & 3 & 4 \end{bmatrix}
# \end{align}
# \f]
#
# The GEBSC arrays \p bscRowInd, \p bscColPtr, and \p bscVal must be allocated by the user prior
# to calling \p hipsparseXgebsr2gebsc(). The \p bscRowInd array has size \p nnzb, the \p bscColPtr
# array has size \p nb+1, and the \p bscVal array has size \p nnzb*rowBlockDim*colBlockDim.
#
# \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 can return before the actual computation has finished.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# mb number of rows of the sparse general BSR matrix.
# @param[in]
# nb number of columns of the sparse general BSR matrix.
# @param[in]
# nnzb number of non-zero entries of the sparse general BSR matrix.
# @param[in]
# bsrVal array of \p nnzb * \p rowBlockDim * \p colBlockDim elements of the sparse general BSR matrix.
# @param[in]
# bsrRowPtr array of \p m+1 elements that point to the start of every row of the
# sparse general BSR matrix.
# @param[in]
# bsrColInd array of \p nnz elements containing the column indices of the sparse
# general BSR matrix.
# @param[in]
# rowBlockDim row size of the blocks in the sparse general BSR matrix.
# @param[in]
# colBlockDim col size of the blocks in the sparse general BSR matrix.
# @param[out]
# bscVal array of \p nnz elements of the sparse BSC matrix.
# @param[out]
# bscRowInd array of \p nnz elements containing the row indices of the sparse BSC
# matrix.
# @param[out]
# bscColPtr array of \p n+1 elements that point to the start of every column of the
# sparse BSC matrix.
# @param[in]
# copyValues \ref HIPSPARSE_ACTION_SYMBOLIC or \ref HIPSPARSE_ACTION_NUMERIC.
# @param[in]
# idxBase \ref HIPSPARSE_INDEX_BASE_ZERO or \ref HIPSPARSE_INDEX_BASE_ONE.
# @param[in]
# temp_buffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseSgebsr2gebsc_bufferSize "hipsparseXgebsr2gebsc_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p nnzb, \p bsrVal,
# \p bsrRowPtr, \p bsrColInd, \p bscVal, \p bscRowInd, \p bscColPtr, or
# \p temp_buffer pointer is invalid.
# \retval HIPSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSgebsr2gebsc(void * handle,int mb,int nb,int nnzb,const float * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,float * bscVal,int * bscRowInd,int * bscColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase,void * temp_buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgebsr2gebsc(void * handle,int mb,int nb,int nnzb,const double * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,double * bscVal,int * bscRowInd,int * bscColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase,void * temp_buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgebsr2gebsc(void * handle,int mb,int nb,int nnzb,const float2 * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,float2 * bscVal,int * bscRowInd,int * bscColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase,void * temp_buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgebsr2gebsc(void * handle,int mb,int nb,int nnzb,const double2 * bsrVal,const int * bsrRowPtr,const int * bsrColInd,int rowBlockDim,int colBlockDim,double2 * bscVal,int * bscRowInd,int * bscColPtr,hipsparseAction_t copyValues,hipsparseIndexBase_t idxBase,void * temp_buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the the size of the user-allocated temporary storage buffer used when converting a sparse
# GEBSR matrix to another sparse GEBSR matrix.
#
# \details
# \p hipsparseXgebsr2gebsr_bufferSize returns the size of the temporary storage buffer that is required by
# \ref hipsparseXgebsr2gebsrNnz() and \ref hipsparseSgebsr2gebsr "hipsparseXgebsr2gebsr()". The temporary storage
# buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nb number of block columns of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nnzb number of blocks in the general BSR sparse matrix \f$A\f$.
# @param[in]
# descrA the descriptor of the general BSR sparse matrix \f$A\f$. The supported matrix type is
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# bsrValA array of \p nnzb*rowBlockDimA*colBlockDimA containing the values of the sparse general BSR matrix \f$A\f$.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse general BSR matrix \f$A\f$.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse general BSR matrix \f$A\f$.
# @param[in]
# rowBlockDimA row size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# colBlockDimA column size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# rowBlockDimC row size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[in]
# colBlockDimC column size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by hipsparseXgebsr2gebsrNnz(),
# hipsparseSgebsr2gebsr(), hipsparseDgebsr2gebsr(), hipsparseCgebsr2gebsr(), and
# hipsparseZgebsr2gebsr().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p nnzb, \p rowBlockDimA, \p colBlockDimA,
# \p rowBlockDimC, \p colBlockDimC, \p bsrRowPtrA, \p bsrColIndA, \p descrA, or \p pBufferSizeInBytes pointer
# is invalid.
#
cdef hipsparseStatus_t hipsparseSgebsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,int rowBlockDimC,int colBlockDimC,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgebsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,int rowBlockDimC,int colBlockDimC,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgebsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,int rowBlockDimC,int colBlockDimC,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgebsr2gebsr_bufferSize(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,int rowBlockDimC,int colBlockDimC,int * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief This function is used when converting a GEBSR sparse matrix \f$A\f$ to another GEBSR sparse matrix \f$C\f$.
# Specifically, this function determines the number of non-zero blocks that will exist in \f$C\f$ (stored using either a host
# or device pointer) and computes the row pointer array for \f$C\f$.
#
# \details
# The routine supports asynchronous execution.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nb number of block columns of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nnzb number of blocks in the general BSR sparse matrix \f$A\f$.
# @param[in]
# descrA the descriptor of the general BSR sparse matrix \f$A\f$. The supported matrix type is
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse general BSR matrix \f$A\f$.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse general BSR matrix \p A.
# @param[in]
# rowBlockDimA row size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# colBlockDimA column size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# descrC the descriptor of the general BSR sparse matrix \f$C\f$. The supported matrix type is
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# bsrRowPtrC array of \p mbC+1 elements that point to the start of every block row of the
# sparse general BSR matrix \f$C\f$ where \p mbC = ( \p m+rowBlockDimC-1 ) / \p rowBlockDimC.
# @param[in]
# rowBlockDimC row size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[in]
# colBlockDimC column size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[out]
# nnzTotalDevHostPtr total number of non-zero blocks in general BSR sparse matrix \f$C\f$, stored using device or host memory.
# @param[out]
# buffer buffer allocated by the user. The size is determined by calling \ref hipsparseSgebsr2gebsr_bufferSize
# "hipsparseXgebsr2gebsr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p nnzb, \p rowBlockDimA, \p colBlockDimA, \p rowBlockDimC,
# \p colBlockDimC, \p bsrRowPtrA, \p bsrColIndA, \p bsrRowPtrC, \p descrA, \p descrC, \p buffer pointer is invalid.
cdef hipsparseStatus_t hipsparseXgebsr2gebsrNnz(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,void *const descrC,int * bsrRowPtrC,int rowBlockDimC,int colBlockDimC,int * nnzTotalDevHostPtr,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function converts the GEBSR sparse matrix \f$A\f$ to another GEBSR sparse matrix \f$C\f$.
#
# \details
# The conversion uses three steps. First, the user calls \ref 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 \p mbC+1 integers for the row
# pointer array for \f$C\f$ where:
# \f[
# \begin{align}
# \text{mbC} &= \text{(m - 1) / rowBlockDimC + 1} \\
# \text{nbC} &= \text{(n - 1) / colBlockDimC + 1}
# \end{align}
# \f]
# The user then calls hipsparseXgebsr2gebsrNnz() to fill in the row pointer array for \f$C\f$ ( \p bsrRowPtrC ) and
# determine the number of non-zero blocks that will exist in \f$C\f$. Finally, the user allocates space for the column
# indices array of \f$C\f$ to have \p nnzbC elements and space for the values array of \f$C\f$ to have
# \p nnzbC*rowBlockDimC*colBlockDimC and then calls \p hipsparseXgebsr2gebsr to complete the conversion.
#
# It could be the case that \p rowBlockDimC does not divide evenly into \p m or \p colBlockDim does not divide evenly
# into \p 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 \p rowBlockDimA=2, \p colBlockDimA=3) looks like:
#
# \f[
# \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]
# \f]
#
# then if the user specifies \p rowBlockDimC=3 and \p colBlockDimC=2, the output GEBSR matrix C would be:
#
# \f[
# \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]
# \f]
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA the storage format of the blocks, \ref HIPSPARSE_DIRECTION_ROW or \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# mb number of block rows of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nb number of block columns of the general BSR sparse matrix \f$A\f$.
# @param[in]
# nnzb number of blocks in the general BSR sparse matrix \f$A\f$.
# @param[in]
# descrA the descriptor of the general BSR sparse matrix \f$A\f$. The supported matrix type is
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# bsrValA array of \p nnzb*rowBlockDimA*colBlockDimA containing the values of the sparse general BSR matrix \f$A\f$.
# @param[in]
# bsrRowPtrA array of \p mb+1 elements that point to the start of every block row of the
# sparse general BSR matrix \f$A\f$.
# @param[in]
# bsrColIndA array of \p nnzb elements containing the block column indices of the sparse general BSR matrix \f$A\f$.
# @param[in]
# rowBlockDimA row size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# colBlockDimA column size of the blocks in the sparse general BSR matrix \f$A\f$.
# @param[in]
# descrC the descriptor of the general BSR sparse matrix \f$C\f$. The supported matrix type is
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL and any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# bsrValC array of \p nnzbC*rowBlockDimC*colBlockDimC containing the values of the sparse general BSR matrix \f$C\f$.
# @param[in]
# bsrRowPtrC array of \p mbC+1 elements that point to the start of every block row of the
# sparse general BSR matrix \f$C\f$.
# @param[in]
# bsrColIndC array of \p nnzbC elements containing the block column indices of the sparse general BSR matrix \f$C\f$.
# @param[in]
# rowBlockDimC row size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[in]
# colBlockDimC column size of the blocks in the sparse general BSR matrix \f$C\f$.
# @param[out]
# buffer buffer allocated by the user. The size is determined by calling \ref hipsparseSgebsr2gebsr_bufferSize
# "hipsparseXgebsr2gebsr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p mb, \p nb, \p nnzb, \p rowBlockDimA, \p colBlockDimA,
# \p rowBlockDimC, \p colBlockDimC, \p bsrRowPtrA, \p bsrColIndA, \p bsrValA, \p bsrRowPtrC, \p bsrColIndC,
# \p bsrValC, \p descrA, \p descrC, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSgebsr2gebsr(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const float * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,void *const descrC,float * bsrValC,int * bsrRowPtrC,int * bsrColIndC,int rowBlockDimC,int colBlockDimC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDgebsr2gebsr(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const double * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,void *const descrC,double * bsrValC,int * bsrRowPtrC,int * bsrColIndC,int rowBlockDimC,int colBlockDimC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCgebsr2gebsr(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const float2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,void *const descrC,float2 * bsrValC,int * bsrRowPtrC,int * bsrColIndC,int rowBlockDimC,int colBlockDimC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZgebsr2gebsr(void * handle,hipsparseDirection_t dirA,int mb,int nb,int nnzb,void *const descrA,const double2 * bsrValA,const int * bsrRowPtrA,const int * bsrColIndA,int rowBlockDimA,int colBlockDimA,void *const descrC,double2 * bsrValC,int * bsrRowPtrC,int * bsrColIndC,int rowBlockDimC,int colBlockDimC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert a sparse HYB matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXhyb2csr converts a HYB matrix into a CSR matrix.
#
# \note
# 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.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# descrA descriptor of the sparse HYB matrix. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# hybA sparse matrix in HYB format.
# @param[out]
# csrSortedValA array containing the values of the sparse CSR matrix.
# @param[out]
# csrSortedRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[out]
# csrSortedColIndA array containing the column indices of the sparse CSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p hybA, \p csrSortedValA,
# \p csrSortedRowPtrA, or \p csrSortedColIndA is nullptr.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
# \retval HIPSPARSE_STATUS_NOT_SUPPORTED \ref hipsparseMatrixType_t != \ref HIPSPARSE_MATRIX_TYPE_GENERAL.
#
cdef hipsparseStatus_t hipsparseShyb2csr(void * handle,void *const descrA,void *const hybA,float * csrSortedValA,int * csrSortedRowPtrA,int * csrSortedColIndA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDhyb2csr(void * handle,void *const descrA,void *const hybA,double * csrSortedValA,int * csrSortedRowPtrA,int * csrSortedColIndA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseChyb2csr(void * handle,void *const descrA,void *const hybA,float2 * csrSortedValA,int * csrSortedRowPtrA,int * csrSortedColIndA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZhyb2csr(void * handle,void *const descrA,void *const hybA,double2 * csrSortedValA,int * csrSortedRowPtrA,int * csrSortedColIndA) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXnnz computes the number of non-zero elements per row or column and the total
# number of non-zero elements in a dense matrix.
#
# \details
# For example, given the dense matrix:
# \f[
# \begin{bmatrix}
# 1 & 0 & 0 & 2 \\
# 3 & 4 & 0 & 0 \\
# 5 & 0 & 6 & 7
# \end{bmatrix}
# \f]
#
# using \p dirA == \ref HIPSPARSE_DIRECTION_ROW results in:
# \f[
# \begin{align}
# \text{nnzPerRowColumn} &= \begin{bmatrix} 2 & 2 & 3 \end{bmatrix} \\
# \text{nnzTotalDevHostPtr} &= 7
# \end{align}
# \f]
#
# while using \p dirA == \ref HIPSPARSE_DIRECTION_COLUMN results in:
# \f[
# \begin{align}
# \text{nnzPerRowColumn} &= \begin{bmatrix} 3 & 1 & 1 & 2 \end{bmatrix} \\
# \text{nnzTotalDevHostPtr} &= 7
# \end{align}
# \f]
#
# The array \p nnzPerRowColumn must be allocated by the user before calling \p hipsparseXnnz and
# has length equal to \p m if \p dirA == \ref HIPSPARSE_DIRECTION_ROW or \p n if
# \p dirA == \ref HIPSPARSE_DIRECTION_COLUMN.
#
# For a complete code example showing its usage, see the example found with hipsparseSdense2csr().
#
# \note
# As indicated, \p nnzTotalDevHostPtr can point either to host or device memory. This is controlled
# by setting the pointer mode. See \ref hipsparseSetPointerMode().
#
# \note
# The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# dirA direction that specifies whether to count non-zero elements by \ref HIPSPARSE_DIRECTION_ROW
# or by \ref HIPSPARSE_DIRECTION_COLUMN.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# descrA the descriptor of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A. Must be at least \p m.
# @param[out]
# nnzPerRowColumn array of size \p m or \p n containing the number of non-zero elements per row or column, respectively.
# @param[out]
# nnzTotalDevHostPtr total number of non-zero elements in device or host memory.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p A, \p nnzPerRowColumn,
# or \p nnzTotalDevHostPtr is nullptr, \p m or \p n is negative, or \p lda is invalid.
#
cdef hipsparseStatus_t hipsparseSnnz(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const float * A,int lda,int * nnzPerRowColumn,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnnz(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const double * A,int lda,int * nnzPerRowColumn,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCnnz(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const float2 * A,int lda,int * nnzPerRowColumn,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZnnz(void * handle,hipsparseDirection_t dirA,int m,int n,void *const descrA,const double2 * A,int lda,int * nnzPerRowColumn,int * nnzTotalDevHostPtr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# This function is used as the first step in converting a CSR matrix to a compressed CSR matrix.
#
# \details
# 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.
#
# Given an input sparse matrix \f$A\f$ in CSR format, the resulting compressed sparse CSR matrix \f$C\f$ is
# computed using:
# \f[
# C(i,j) = A(i, j) \text{ if |A(i, j)| > tol}
# \f]
#
# The user first allocates \p nnzPerRow with size \p m elements, then calls \p hipsparseXnnz_compress.
# The function fills in the \p nnzPerRow array and sets the total number of non-zeros found in \p nnzC.
#
# See hipsparseScsr2csr_compress() for a full code example.
#
# \note
# In the case of complex matrices, only the magnitude of the real part of \p tol is used.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the sparse CSR matrix.
# @param[in]
# descrA the descriptor of the sparse CSR matrix.
# @param[in]
# csrValA array of \p nnzA elements of the sparse CSR matrix.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# uncompressed sparse CSR matrix.
# @param[out]
# nnzPerRow array of length \p m containing the number of entries that will be kept per row in
# the final compressed CSR matrix.
# @param[out]
# nnzC number of elements in the column indices and values arrays of the compressed
# sparse CSR matrix. Can be either host or device pointer.
# @param[in]
# tol the non-negative tolerance used for compression. If \p tol is complex, then only the magnitude
# of the real part is used. Entries in the input uncompressed CSR array that are below the tolerance
# are removed in output compressed CSR matrix.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p tol, \p csrValA, \p csrRowPtrA, \p nnzPerRow, or \p nnzC
# pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSnnz_compress(void * handle,int m,void *const descrA,const float * csrValA,const int * csrRowPtrA,int * nnzPerRow,int * nnzC,float tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnnz_compress(void * handle,int m,void *const descrA,const double * csrValA,const int * csrRowPtrA,int * nnzPerRow,int * nnzC,double tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCnnz_compress(void * handle,int m,void *const descrA,const float2 * csrValA,const int * csrRowPtrA,int * nnzPerRow,int * nnzC,float2 tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZnnz_compress(void * handle,int m,void *const descrA,const double2 * csrValA,const int * csrRowPtrA,int * nnzPerRow,int * nnzC,double2 tol) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csr_bufferSize returns the size of the temporary buffer that
# is required by \p hipsparseXpruneCsr2csrNnz and \p hipsparseXpruneCsr2csr. The
# temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# threshold pointer to the non-negative pruning threshold, which can exist in either host or device memory.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValC array of \p nnzC elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[in]
# csrColIndC array of \p nnzC elements containing the column indices of the sparse CSR matrix C.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by hipsparseSpruneCsr2csrNnz(),
# hipsparseDpruneCsr2csrNnz(), hipsparseSpruneCsr2csr(), and hipsparseDpruneCsr2csr().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csr_bufferSize(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * threshold,void *const descrC,const float * csrValC,const int * csrRowPtrC,const int * csrColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csr_bufferSize(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * threshold,void *const descrC,const double * csrValC,const int * csrRowPtrC,const int * csrColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune sparse a CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csr_bufferSizeExt returns the size of the temporary buffer that
# is required by \ref hipsparseSpruneCsr2csrNnz "hipsparseXpruneCsr2csrNnz()" and
# \ref hipsparseSpruneCsr2csr "hipsparseXpruneCsr2csr()". The temporary storage buffer
# must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# threshold pointer to the non-negative pruning threshold, which can exist in either host or device memory.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValC array of \p nnzC elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[in]
# csrColIndC array of \p nnzC elements containing the column indices of the sparse CSR matrix C.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by hipsparseSpruneCsr2csrNnz(),
# hipsparseDpruneCsr2csrNnz(), hipsparseSpruneCsr2csr(), and hipsparseDpruneCsr2csr().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csr_bufferSizeExt(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * threshold,void *const descrC,const float * csrValC,const int * csrRowPtrC,const int * csrColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csr_bufferSizeExt(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * threshold,void *const descrC,const double * csrValC,const int * csrRowPtrC,const int * csrColIndC,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune sparse a CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csrNnz computes the number of non-zero elements per row and the total
# number of non-zero elements in a sparse CSR matrix after elements less than the threshold are
# pruned from the matrix.
#
# \note The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# threshold pointer to the non-negative pruning threshold which can exist in either host or device memory.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[out]
# nnzTotalDevHostPtr total number of nonzero elements in device or host memory.
# @param[out]
# buffer buffer allocated by the user whose size is determined by calling \ref hipsparseSpruneCsr2csr_bufferSize
# "hipsparseXpruneCsr2csr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p threshold, \p descrA,
# \p descrC, \p csrValA, \p csrRowPtrA, \p csrColIndA, \p csrRowPtrC, \p nnzTotalDevHostPtr,
# or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csrNnz(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * threshold,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csrNnz(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * threshold,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# 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 preallocated by the user.
# The user first calls \ref hipsparseSpruneCsr2csr_bufferSize "hipsparseXpruneCsr2csr_bufferSize()" to
# determine the size of the buffer used by \ref hipsparseSpruneCsr2csrNnz "hipsparseXpruneCsr2csrNnz()"
# and \p hipsparseXpruneCsr2csr(), which the user then allocates. The user then allocates \p csrRowPtrC to
# have \p m+1 elements and then calls hipsparseXpruneCsr2csrNnz(), which fills in the \p csrRowPtrC array
# and stores the number of elements that are larger than the pruning \p threshold in \p nnzTotalDevHostPtr.
# The user then calls \p hipsparseXpruneCsr2csr() to complete the conversion. This function is executed asynchronously
# with respect to the host and can return control to the application on the host before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# threshold pointer to the non-negative pruning threshold which can exist in either host or device memory.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnzC elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[out]
# csrColIndC array of \p nnzC elements containing the column indices of the sparse CSR matrix C.
# @param[in]
# buffer buffer allocated by the user whose size is determined by calling \ref hipsparseSpruneCsr2csr_bufferSize
# "hipsparseXpruneCsr2csr_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p threshold, \p descrA, \p descrC, \p csrValA,
# \p csrRowPtrA, \p csrcolindA, \p csrvalC, \p csrrowptrC, \p csrcolIndC, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csr(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * threshold,void *const descrC,float * csrValC,const int * csrRowPtrC,int * csrColIndC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csr(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * threshold,void *const descrC,double * csrValC,const int * csrRowPtrC,int * csrColIndC,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csrByPercentage_bufferSize returns the size of the temporary buffer that
# is required by \ref hipsparseSpruneCsr2csrNnzByPercentage "hipsparseXpruneCsr2csrNnzByPercentage()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValC array of \p nnzC elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[in]
# csrColIndC array of \p nnzC elements containing the column indices of the sparse CSR matrix C.
# @param[in]
# info prune info structure.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by hipsparseSpruneCsr2csrNnzByPercentage(),
# hipsparseDpruneCsr2csrNnzByPercentage(), hipsparseSpruneCsr2csrByPercentage(),
# and hipsparseDpruneCsr2csrByPercentage().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage_bufferSize(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,float percentage,void *const descrC,const float * csrValC,const int * csrRowPtrC,const int * csrColIndC,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage_bufferSize(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,double percentage,void *const descrC,const double * csrValC,const int * csrRowPtrC,const int * csrColIndC,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csrByPercentage_bufferSizeExt returns the size of the temporary buffer that
# is required by \ref hipsparseSpruneCsr2csrNnzByPercentage "hipsparseXpruneCsr2csrNnzByPercentage()".
# The temporary storage buffer must be allocated by the user.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValC array of \p nnzC elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[in]
# csrColIndC array of \p nnzC elements containing the column indices of the sparse CSR matrix C.
# @param[in]
# info prune info structure.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by hipsparseSpruneCsr2csrNnzByPercentage(),
# hipsparseDpruneCsr2csrNnzByPercentage(), hipsparseSpruneCsr2csrByPercentage(),
# and hipsparseDpruneCsr2csrByPercentage().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage_bufferSizeExt(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,float percentage,void *const descrC,const float * csrValC,const int * csrRowPtrC,const int * csrColIndC,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage_bufferSizeExt(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,double percentage,void *const descrC,const double * csrValC,const int * csrRowPtrC,const int * csrColIndC,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# \p hipsparseXpruneCsr2csrNnzByPercentage computes the number of non-zero elements per row and the total
# number of non-zero elements in a sparse CSR matrix after elements less than the threshold are
# pruned from the matrix.
#
# \note The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[out]
# nnzTotalDevHostPtr total number of non-zero elements in device or host memory.
# @param[in]
# info prune info structure.
# @param[out]
# buffer buffer allocated by the user whose size is determined by calling
# \ref hipsparseSpruneCsr2csrByPercentage_bufferSize "hipsparseXpruneCsr2csrByPercentage_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p percentage, \p descrA, \p descrC,
# \p info, \p csrValA, \p csrRowPtrA, \p csrColIndA, \p csrRowPtrC, \p nnzTotalDevHostPtr, or \p buffer
# pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csrNnzByPercentage(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,float percentage,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csrNnzByPercentage(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,double percentage,void *const descrC,int * csrRowPtrC,int * nnzTotalDevHostPtr,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.
#
# \details
# 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 preallocated by the user.
# The user first calls \ref hipsparseSpruneCsr2csr_bufferSize "hipsparseXpruneCsr2csr_bufferSize()" to
# determine the size of the buffer used by \ref hipsparseSpruneCsr2csrNnz "hipsparseXpruneCsr2csrNnz()" and
# \p hipsparseXpruneCsr2csr(), which the user then allocates. The user then allocates \p csrRowPtrC to have
# \p m+1 elements and then calls \ref hipsparseSpruneCsr2csrNnz "hipsparseXpruneCsr2csrNnz()" which fills
# in the \p csrRowPtrC array and stores the number of elements that are larger than the pruning \p threshold
# in \p nnzTotalDevHostPtr. The user then calls \p hipsparseXpruneCsr2csr() to complete the conversion. The function
# is executed asynchronously with respect to the host and can return control to the application on the host
# before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows in the sparse CSR matrix.
# @param[in]
# n number of columns in the sparse CSR matrix.
# @param[in]
# nnzA number of non-zeros in the sparse CSR matrix A.
# @param[in]
# descrA descriptor of the sparse CSR matrix A. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[in]
# csrValA array of \p nnzA elements containing the values of the sparse CSR matrix A.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix A.
# @param[in]
# csrColIndA array of \p nnzA elements containing the column indices of the sparse CSR matrix A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descrC descriptor of the sparse CSR matrix C. Currently, only
# \ref HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
# @param[out]
# csrValC array of \p nnz_C elements containing the values of the sparse CSR matrix C.
# @param[in]
# csrRowPtrC array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix C.
# @param[out]
# csrColIndC array of \p nnz_C elements containing the column indices of the sparse CSR matrix C.
# @param[in]
# info prune info structure.
# @param[in]
# buffer buffer allocated by the user whose size is determined by calling
# \ref hipsparseSpruneCsr2csrByPercentage_bufferSize "hipsparseXpruneCsr2csrByPercentage_bufferSize()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p nnzA, \p percentage, \p descrA, \p descrC, \p info,
# \p csrValA, \p csrRowPtrA, \p csrColIndA, \p csrValC, \p csrRowPtrC, \p csrColIndC, or \p buffer pointer is
# invalid.
#
cdef hipsparseStatus_t hipsparseSpruneCsr2csrByPercentage(void * handle,int m,int n,int nnzA,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,float percentage,void *const descrC,float * csrValC,const int * csrRowPtrC,int * csrColIndC,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneCsr2csrByPercentage(void * handle,int m,int n,int nnzA,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,double percentage,void *const descrC,double * csrValC,const int * csrRowPtrC,int * csrColIndC,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXpruneDense2csr_bufferSize computes the the size of the user-allocated temporary storage buffer
# used when converting a dense matrix to a pruned CSR matrix.
#
# \details
# Specifically given an input dense column-ordered matrix A, with leading dimension \p lda, where \p lda>=m,
# the resulting pruned sparse CSR matrix C is computed using:
# \f[
# |C(i,j)| = A(i, j) \text{ if |A(i, j)| > threshold}
# \f]
#
# The first step in this conversion is to determine the required user-allocated buffer size
# using \p hipsparseXpruneDense2csr_bufferSize() that will be passed to the subsequent steps of the conversion.
# After the buffer size has been determined, the user must allocate it. This user-allocated buffer is then passed
# to \ref hipsparseSpruneDense2csrNnz "hipsparseXpruneDense2csrNnz()" and \ref hipsparseSpruneDense2csr
# "hipsparseXpruneDense2csr()" to complete the conversion. The user is responsible for then freeing the buffer after
# the conversion has been completed.
#
# See hipsparseSpruneDense2csr() for a full code example.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A. Must be non-negative.
# @param[in]
# n number of columns of the dense matrix \p A. Must be non-negative.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A. Must be at least \p m.
# @param[in]
# threshold pointer to the pruning non-negative threshold, which can exist in either host or device memory.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL
# and any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[in]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSpruneDense2csrNnz(), hipsparseDpruneDense2csrNnz(),
# hipsparseSpruneDense2csr(), and hipsparseDpruneDense2csr().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle or \p pBufferSizeInBytes is nullptr,
# or \p m or \p n is negative.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csr_bufferSize(void * handle,int m,int n,const float * A,int lda,const float * threshold,void *const descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csr_bufferSize(void * handle,int m,int n,const double * A,int lda,const double * threshold,void *const descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpruneDense2csr_bufferSizeExt(void * handle,int m,int n,const float * A,int lda,const float * threshold,void *const descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csr_bufferSizeExt(void * handle,int m,int n,const double * A,int lda,const double * threshold,void *const descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXpruneDense2csrNnz computes the number of non-zero elements per row and the total
# number of non-zero elements in a dense matrix after the elements less than the (non-negative) threshold are
# pruned from the matrix.
#
# \details
# Given an input dense column ordered matrix \p A, with leading dimension \p lda where \p lda>=m,
# the resulting pruned sparse CSR matrix \f$C\f$ is computed using:
# \f[
# |C(i,j)| = A(i, j) \text{ if |A(i, j)| > threshold}
# \f]
#
# First, the user must determine the size of the required temporary buffer using the routine
# \ref hipsparseSpruneDense2csr_bufferSize "hipsparseXpruneDense2csr_bufferSize()" and then allocate it. Next,
# the user allocates \p csrRowPtr with size \p m+1. Then the function passes both the temporary storage buffer and
# \p csrRowPtr to \p hipsparseXpruneDense2csrNnz to determine the total number of non-zeros that
# will exist in the sparse CSR matrix C (after pruning has been performed on \p A ) as well as fill the output CSR
# row pointer array \p csrRowPtr.
#
# For example, given the dense matrix:
#
# \f[
# \begin{bmatrix}
# 6 & 2 & 3 & 7 \\
# 5 & 6 & 7 & 8 \\
# 5 & 4 & 8 & 1
# \end{bmatrix}
# \f]
#
# and the \p threshold value 5, the resulting matrix after pruning is:
#
# \f[
# \begin{bmatrix}
# 6 & 0 & 0 & 7 \\
# 0 & 6 & 7 & 8 \\
# 0 & 0 & 8 & 0
# \end{bmatrix}
# \f]
#
# and the corresponding row pointer array and non-zero count:
#
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 5 & 6 \end{bmatrix} \\
# \text{nnzTotalDevHostPtr} &= 6
# \end{align}
# \f]
#
# The above example assumes a zero index base for the output CSR matrix. Users can set the desired index base
# in the output CSR matrix by setting it in the \ref hipsparseMatDescr_t. See \ref hipsparseSetMatIndexBase().
#
# For a full code example on how to use this routine, see hipsparseSpruneDense2csr().
#
# \note
# The routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of the dense array \p A.
# @param[in]
# threshold pointer to the pruning non-negative threshold, which can exist in either host or device memory.
# @param[in]
# descr the descriptor of the dense matrix \p A.
# @param[out]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[out]
# nnzTotalDevHostPtr total number of non-zero elements in device or host memory.
# @param[out]
# buffer buffer allocated by the user whose size is determined by calling
# \ref hipsparseSpruneDense2csr_bufferSize "hipsparseXpruneDense2csr_bufferSize()" or
# \ref hipsparseSpruneDense2csr_bufferSizeExt "hipsparseXpruneDense2csr_bufferSizeExt()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p lda, \p A, \p threshold, \p descr, \p csrRowPtr,
# \p nnzTotalDevHostPtr, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csrNnz(void * handle,int m,int n,const float * A,int lda,const float * threshold,void *const descr,int * csrRowPtr,int * nnzTotalDevHostPtr,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csrNnz(void * handle,int m,int n,const double * A,int lda,const double * threshold,void *const descr,int * csrRowPtr,int * nnzTotalDevHostPtr,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXpruneDense2csr converts the matrix \p A in dense format into a sparse matrix in CSR format,
# while pruning values that are less than the (non-negative) threshold. All the parameters are assumed
# to have been pre-allocated by the user.
#
# \details
# Given an input dense column ordered matrix \p A, with leading dimension \p lda, where \p lda>=m,
# the resulting pruned sparse CSR matrix C is computed using:
# \f[
# |C(i,j)| = A(i, j) \text{ if |A(i, j)| > threshold}
# \f]
#
# The user first calls \ref hipsparseSpruneDense2csr_bufferSize "hipsparseXpruneDense2csr_bufferSize()" to
# determine the size of the required user-allocated temporary storage buffer. The user then allocates this
# buffer. Next, the user allocates \p csrRowPtr to have \p m+1 elements and then calls
# \ref hipsparseSpruneDense2csrNnz "hipsparseXpruneDense2csrNnz()", which fills in the \p csrRowPtr array
# and stores the number of elements that are larger than the pruning \p threshold in \p nnzTotalDevHostPtr.
# The user then allocates \p csrColInd and \p csrVal to have size \p nnzTotalDevHostPtr and completes the
# conversion by calling \p hipsparseXpruneDense2csr().
#
# For example, performing these steps with the dense input matrix \p A :
# \f[
# \begin{bmatrix}
# 6 & 2 & 3 & 7 \\
# 5 & 6 & 7 & 8 \\
# 5 & 4 & 8 & 1
# \end{bmatrix}
# \f]
#
# and the \p threshold value 5, results in the pruned matrix C:
#
# \f[
# \begin{bmatrix}
# 6 & 0 & 0 & 7 \\
# 0 & 6 & 7 & 8 \\
# 0 & 0 & 8 & 0
# \end{bmatrix}
# \f]
#
# and corresponding CSR row, column, and values arrays:
#
# \f[
# \begin{align}
# \text{csrRowPtr} &= \begin{bmatrix} 0 & 2 & 5 & 6 \end{bmatrix} \\
# \text{csrColInd} &= \begin{bmatrix} 0 & 3 & 1 & 2 & 3 & 2 \end{bmatrix} \\
# \text{csrVal} &= \begin{bmatrix} 6 & 7 & 6 & 7 & 8 & 8 \end{bmatrix} \\
# \end{align}
# \f]
#
# \note
# The routine \p hipsparseXpruneDense2csr() is executed asynchronously with respect to the host and can
# return control to the application on the host before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A.
# @param[in]
# threshold pointer to the non-negative pruning threshold, which can exist in either host or device memory.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL
# and any valid value of the \ref hipsparseIndexBase_t.
# @param[out]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[out]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
#
# @param[in]
# buffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseSpruneDense2csr_bufferSize "hipsparseXpruneDense2csr_bufferSize()" or
# \ref hipsparseSpruneDense2csr_bufferSizeExt "hipsparseXpruneDense2csr_bufferSizeExt()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p lda, \p A, \p descr, \p threshold, \p csrVal,
# \p csrRowPtr, \p csrColInd, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csr(void * handle,int m,int n,const float * A,int lda,const float * threshold,void *const descr,float * csrVal,const int * csrRowPtr,int * csrColInd,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csr(void * handle,int m,int n,const double * A,int lda,const double * threshold,void *const descr,double * csrVal,const int * csrRowPtr,int * csrColInd,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# \p hipsparseXpruneDense2csrByPercentage_bufferSize functions convert the size of the user-allocated temporary
# storage buffer used when converting a dense matrix to a pruned CSR matrix where the pruning is done
# based on a \p percentage.
#
# \details
# When converting and pruning a dense matrix \p A to a CSR matrix by percentage, the
# following steps are performed. First, the user calls
# \p hipsparseXpruneDense2csrByPercentage_bufferSize, which determines the size of the
# temporary storage buffer. After this is determined, this buffer must be allocated by the user.
# Next, the user allocates the \p csrRowPtr array to have \p m+1 elements and calls
# \ref hipsparseSpruneDense2csrNnzByPercentage "hipsparseXpruneDense2csrNnzByPercentage()".
# Finally, the user finishes the conversion by allocating the \p csrColInd and \p csrVal arrays
# (whose size is determined by the value at \p nnzTotalDevHostPtr) and calling
# \ref hipsparseSpruneDense2csrByPercentage "hipsparseXpruneDense2csrByPercentage()".
#
# The pruning by \p percentage works by first sorting the absolute values of the dense
# matrix \p A. Users can then determine a position in this sorted array by
# \f[
# pos = ceil(m \cdot n \cdot (percentage/100)) - 1 \\
# pos = \min(pos, m \cdot n-1) \\
# pos = \max(pos, 0) \\
# threshold = sorted_A[pos]
# \f]
#
# After the user has this threshold, they can prune values in the dense matrix \p A, as in
# \ref hipsparseSpruneDense2csr "hipsparseXpruneDense2csr()".
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the
# application on the host before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) nonzero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[in]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[in]
# info prune information structure.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSpruneDense2csrNnzByPercentage() and hipsparseDpruneDense2csrNnzByPercentage().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE the \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csrByPercentage_bufferSize(void * handle,int m,int n,const float * A,int lda,float percentage,void *const descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csrByPercentage_bufferSize(void * handle,int m,int n,const double * A,int lda,double percentage,void *const descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the size of the user-allocated temporary storage buffer used
# when converting and pruning by \p percentage a dense matrix to a CSR matrix.
#
# \details
# When converting and pruning a dense matrix \p A to a CSR matrix by \p percentage, the
# following steps are performed. First, the user calls
# \p hipsparseXpruneDense2csrByPercentage_bufferSizeExt, which determines the size of the
# temporary storage buffer. After this is determined, this buffer must be allocated by the user.
# Next, the user allocates the \p csrRowPtr array to have \p m+1 elements and calls
# \ref hipsparseSpruneDense2csrNnzByPercentage "hipsparseXpruneDense2csrNnzByPercentage()".
# Finally, the user finishes the conversion by allocating the \p csrColInd and \p csrVal arrays
# (whose size is determined by the value at \p nnzTotalDevHostPtr) and calling
# \ref hipsparseSpruneDense2csrByPercentage "hipsparseXpruneDense2csrByPercentage()".
#
# The pruning by \p percentage works by first sorting the absolute values of the dense
# matrix \p A. Users can then determine a position in this sorted array by
# \f[
# pos = ceil(m \cdot n \cdot (percentage/100)) - 1 \\
# pos = \min(pos, m \cdot n-1) \\
# pos = \max(pos, 0) \\
# threshold = sorted_A[pos]
# \f]
#
# After users have this threshold, they can prune values in the dense matrix \p A, as in
# \ref hipsparseSpruneDense2csr "hipsparseXpruneDense2csr()".
#
# \note
# This function is executed asynchronously with respect to the host and can return control to the
# application on the host before the entire result is ready.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[in]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[in]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[in]
# info prune information structure.
# @param[out]
# pBufferSizeInBytes number of bytes of the temporary storage buffer required by
# hipsparseSpruneDense2csrNnzByPercentage() and hipsparseDpruneDense2csrNnzByPercentage().
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE the \p handle or \p pBufferSizeInBytes pointer is invalid.
# \retval HIPSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csrByPercentage_bufferSizeExt(void * handle,int m,int n,const float * A,int lda,float percentage,void *const descr,const float * csrVal,const int * csrRowPtr,const int * csrColInd,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csrByPercentage_bufferSizeExt(void * handle,int m,int n,const double * A,int lda,double percentage,void *const descr,const double * csrVal,const int * csrRowPtr,const int * csrColInd,pruneInfo_t info,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the number of non-zero elements per row and the total number of
# non-zero elements in a dense matrix when converting and pruning by \p percentage a dense
# matrix to a CSR matrix.
#
# \details
# When converting and pruning a dense matrix \p A to a CSR matrix by \p percentage, the
# following steps are performed. First, the user calls
# \ref hipsparseSpruneDense2csrByPercentage_bufferSize "hipsparseXpruneDense2csrByPercentage_bufferSize()",
# which determines the size of the temporary storage buffer. After this is determined, this buffer must be allocated
# by the user. Next, the user allocates the \p csrRowPtr array to have \p m+1 elements and calls
# \p hipsparseXpruneDense2csrNnzByPercentage. Finally, the user finishes the conversion
# by allocating the \p csrColInd and \p csrVal arrays (which have a size determined by the value
# at \p nnzTotalDevHostPtr) and calling \ref hipsparseSpruneDense2csrByPercentage
# "hipsparseXpruneDense2csrByPercentage()".
#
# The pruning by \p percentage works by first sorting the absolute values of the dense
# matrix \p A. Users can then determine a position in this sorted array by
# \f[
# pos = ceil(m \cdot n \cdot (percentage/100)) - 1 \\
# pos = \min(pos, m \cdot n-1) \\
# pos = \max(pos, 0) \\
# threshold = sorted_A[pos]
# \f]
#
# After users have this threshold, they can prune values in the dense matrix \p A, as in
# \ref hipsparseSpruneDense2csr "hipsparseXpruneDense2csr()".
#
# \note
# This routine supports asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descr the descriptor of the dense matrix \p A.
# @param[out]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[out]
# nnzTotalDevHostPtr total number of non-zero elements in device or host memory.
# @param[in]
# info prune information structure
# @param[out]
# buffer buffer allocated by the user whose size is determined by calling
# \ref hipsparseSpruneDense2csrByPercentage_bufferSize "hipsparseXpruneDense2csrByPercentage_bufferSize()"
# or \ref hipsparseSpruneDense2csrByPercentage_bufferSizeExt "hipsparseXpruneDense2csrByPercentage_bufferSizeExt()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p lda, \p percentage, \p A, \p descr, \p info, \p csrRowPtr,
# \p nnzTotalDevHostPtr, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csrNnzByPercentage(void * handle,int m,int n,const float * A,int lda,float percentage,void *const descr,int * csrRowPtr,int * nnzTotalDevHostPtr,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csrNnzByPercentage(void * handle,int m,int n,const double * A,int lda,double percentage,void *const descr,int * csrRowPtr,int * nnzTotalDevHostPtr,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup conv_module
# \brief
# This function computes the number of non-zero elements per row and the total number of
# non-zero elements in a dense matrix when converting and pruning by \p percentage a dense
# matrix to a CSR matrix.
#
# \details
# When converting and pruning a dense matrix \p A to a CSR matrix by \p percentage, the
# following steps are performed. First, the user calls \ref hipsparseSpruneDense2csrByPercentage_bufferSize
# "hipsparseXpruneDense2csrByPercentage_bufferSize()", which determines the size of the
# temporary storage buffer. After this is determined, this buffer must be allocated by the user.
# Next, the user allocates the \p csrRowPtr array to have \p m+1 elements and calls
# \ref hipsparseSpruneDense2csrNnzByPercentage "hipsparseXpruneDense2csrNnzByPercentage()". Finally, the
# user finishes the conversion by allocating the \p csrColInd and \p csrVal arrays (which have a size
# determined by the value at \p nnzTotalDevHostPtr) and calling \p hipsparseXpruneDense2csrByPercentage.
#
# The pruning by \p percentage works by first sorting the absolute values of the dense
# matrix \p A. Users can then determine a position in this sorted array by
# \f[
# pos = ceil(m \ cdot n \cdot (percentage/100)) - 1 \\
# pos = \min(pos, m \cdot n-1) \\
# pos = \max(pos, 0) \\
# threshold = sorted_A[pos]
# \f]
#
# After users have this threshold, they can prune values in the dense matrix \p A, as in
# \ref hipsparseSpruneDense2csr "hipsparseXpruneDense2csr()".
#
# \note
# This routine support asynchronous execution if the pointer mode is set to device.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of the dense matrix \p A.
# @param[in]
# n number of columns of the dense matrix \p A.
# @param[in]
# A array of dimensions (\p lda, \p n).
# @param[in]
# lda leading dimension of dense array \p A.
# @param[in]
# percentage \p percentage>=0 and \p percentage<=100.
# @param[in]
# descr the descriptor of the dense matrix \p A. The supported matrix type is \ref HIPSPARSE_MATRIX_TYPE_GENERAL and
# any valid value of the \ref hipsparseIndexBase_t.
# @param[out]
# csrVal array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) non-zero elements of matrix \p A.
# @param[in]
# csrRowPtr integer array of \p m+1 elements that contains the start of every row and the end of the last row plus one.
# @param[out]
# csrColInd integer array of nnz ( = \p csrRowPtr[m] - \p csrRowPtr[0] ) column indices of the non-zero elements of matrix \p A.
# @param[in]
# info prune information structure
# @param[in]
# buffer temporary storage buffer allocated by the user. The size is returned by
# \ref hipsparseSpruneDense2csrByPercentage_bufferSize "hipsparseXpruneDense2csrByPercentage_bufferSize()" or
# \ref hipsparseSpruneDense2csrByPercentage_bufferSizeExt "hipsparseXpruneDense2csrByPercentage_bufferSizeExt()".
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p m, \p n, \p lda, \p percentage, \p A, \p descr, \p info, \p csrVal,
# \p csrRowPtr, \p csrColInd, or \p buffer pointer is invalid.
#
cdef hipsparseStatus_t hipsparseSpruneDense2csrByPercentage(void * handle,int m,int n,const float * A,int lda,float percentage,void *const descr,float * csrVal,const int * csrRowPtr,int * csrColInd,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDpruneDense2csrByPercentage(void * handle,int m,int n,const double * A,int lda,double percentage,void *const descr,double * csrVal,const int * csrRowPtr,int * csrColInd,pruneInfo_t info,void * buffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
# \ingroup reordering_module
# \brief Coloring of the adjacency graph of the matrix \f$A\f$ stored in the CSR format.
#
# \details
# \p hipsparseXcsrcolor performs the coloring of the undirected graph represented by the (symmetric) sparsity
# pattern of the matrix \f$A\f$ stored in CSR format. Graph coloring is a way of coloring the nodes of a graph
# such that no two adjacent nodes are of the same color. The \p fractionToColor is a parameter to only color
# a given percentage of the graph nodes. The remaining uncolored nodes receive distinct new colors. The optional
# \p reordering array is a permutation array that groups unknowns of the same color. The matrix \f$A\f$
# must be stored as a general matrix with a symmetric sparsity pattern, and if the matrix \f$A\f$ is non-symmetric,
# then the user is responsible to provide the symmetric part \f$\frac{A+A^T}{2}\f$.
#
# \deprecated
# This function is deprecated when using the CUDA backend (CUDA 12.0+) and will be
# removed in CUDA 13.0. This deprecation does not apply to the ROCm backend.
#
# @param[in]
# handle handle to the hipSPARSE library context queue.
# @param[in]
# m number of rows of sparse matrix \f$A\f$. Must be non-negative.
# @param[in]
# nnz number of non-zero entries of sparse matrix \f$A\f$. Must be non-negative.
# @param[in]
# descrA sparse matrix descriptor.
# @param[in]
# csrValA array of \p nnz elements of the sparse CSR matrix.
# @param[in]
# csrRowPtrA array of \p m+1 elements that point to the start of every row of the
# sparse CSR matrix.
# @param[in]
# csrColIndA array of \p nnz elements containing the column indices of the sparse
# CSR matrix.
# @param[in]
# fractionToColor fraction of nodes to be colored, which should be in the interval \f$[0.0,1.0]\f$. For example, \f$0.8\f$ implies that
# \f$80\f$ percent of nodes will be colored.
# @param[out]
# ncolors resulting number of distinct colors.
# @param[out]
# coloring resulting mapping of colors.
# @param[out]
# reordering optional resulting reordering permutation if \p reordering is a non-null pointer.
# @param[inout]
# info structure that holds the information collected during the coloring algorithm.
#
# \retval HIPSPARSE_STATUS_SUCCESS the operation completed successfully.
# \retval HIPSPARSE_STATUS_NOT_INITIALIZED \p handle is not initialized.
# \retval HIPSPARSE_STATUS_INVALID_VALUE \p handle, \p descrA, \p fractionToColor,
# \p ncolors, \p coloring, or \p info is nullptr, \p m or \p nnz is negative, or
# \p csrValA, \p csrRowPtrA, or \p csrColIndA is nullptr when \p nnz is greater than zero.
#
cdef hipsparseStatus_t hipsparseScsrcolor(void * handle,int m,int nnz,void *const descrA,const float * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * fractionToColor,int * ncolors,int * coloring,int * reordering,void * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDcsrcolor(void * handle,int m,int nnz,void *const descrA,const double * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * fractionToColor,int * ncolors,int * coloring,int * reordering,void * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCcsrcolor(void * handle,int m,int nnz,void *const descrA,const float2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,const float * fractionToColor,int * ncolors,int * coloring,int * reordering,void * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseZcsrcolor(void * handle,int m,int nnz,void *const descrA,const double2 * csrValA,const int * csrRowPtrA,const int * csrColIndA,const double * fractionToColor,int * ncolors,int * coloring,int * reordering,void * info) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef extern from "hipsparse/hipsparse.h":
ctypedef void * hipsparseSpVecDescr_t
ctypedef void * hipsparseDnVecDescr_t
cdef struct hipsparseSpMatDescr_st:
pass
ctypedef hipsparseSpMatDescr_st * hipsparseSpMatDescr_t
ctypedef void * hipsparseDnMatDescr_t
ctypedef const void * hipsparseConstSpVecDescr_t
ctypedef const void * hipsparseConstDnVecDescr_t
ctypedef const hipsparseSpMatDescr_st * hipsparseConstSpMatDescr_t
ctypedef const void * hipsparseConstDnMatDescr_t
cdef struct hipsparseSpGEMMDescr:
pass
cdef struct hipsparseSpSVDescr:
pass
cdef struct hipsparseSpSMDescr:
pass
ctypedef hipsparseSpGEMMDescr * hipsparseSpGEMMDescr_t
ctypedef hipsparseSpSVDescr * hipsparseSpSVDescr_t
ctypedef hipsparseSpSMDescr * hipsparseSpSMDescr_t
ctypedef enum hipsparseFormat_t:
HIPSPARSE_FORMAT_CSR
HIPSPARSE_FORMAT_CSC
HIPSPARSE_FORMAT_COO
HIPSPARSE_FORMAT_COO_AOS
HIPSPARSE_FORMAT_BLOCKED_ELL
HIPSPARSE_FORMAT_SLICED_ELL
HIPSPARSE_FORMAT_BSR
ctypedef enum hipsparseOrder_t:
HIPSPARSE_ORDER_COLUMN
HIPSPARSE_ORDER_COL
HIPSPARSE_ORDER_ROW
ctypedef enum hipsparseIndexType_t:
HIPSPARSE_INDEX_16U
HIPSPARSE_INDEX_32I
HIPSPARSE_INDEX_64I
ctypedef enum hipsparseSpMVAlg_t:
HIPSPARSE_MV_ALG_DEFAULT
HIPSPARSE_COOMV_ALG
HIPSPARSE_CSRMV_ALG1
HIPSPARSE_CSRMV_ALG2
HIPSPARSE_SPMV_ALG_DEFAULT
HIPSPARSE_SPMV_COO_ALG1
HIPSPARSE_SPMV_CSR_ALG1
HIPSPARSE_SPMV_CSR_ALG2
HIPSPARSE_SPMV_COO_ALG2
HIPSPARSE_SPMV_SELL_ALG1
HIPSPARSE_SPMV_CSR_ALG3
HIPSPARSE_SPMV_BSR_ALG1
ctypedef enum hipsparseSpMMAlg_t:
HIPSPARSE_MM_ALG_DEFAULT
HIPSPARSE_COOMM_ALG1
HIPSPARSE_COOMM_ALG2
HIPSPARSE_COOMM_ALG3
HIPSPARSE_CSRMM_ALG1
HIPSPARSE_SPMM_ALG_DEFAULT
HIPSPARSE_SPMM_COO_ALG1
HIPSPARSE_SPMM_COO_ALG2
HIPSPARSE_SPMM_COO_ALG3
HIPSPARSE_SPMM_COO_ALG4
HIPSPARSE_SPMM_CSR_ALG1
HIPSPARSE_SPMM_CSR_ALG2
HIPSPARSE_SPMM_CSR_ALG3
HIPSPARSE_SPMM_BLOCKED_ELL_ALG1
HIPSPARSE_SPMM_BSR_ALG1
ctypedef enum hipsparseSparseToDenseAlg_t:
HIPSPARSE_SPARSETODENSE_ALG_DEFAULT
ctypedef enum hipsparseDenseToSparseAlg_t:
HIPSPARSE_DENSETOSPARSE_ALG_DEFAULT
ctypedef enum hipsparseSDDMMAlg_t:
HIPSPARSE_SDDMM_ALG_DEFAULT
ctypedef enum hipsparseSpSVAlg_t:
HIPSPARSE_SPSV_ALG_DEFAULT
ctypedef enum hipsparseSpSMAlg_t:
HIPSPARSE_SPSM_ALG_DEFAULT
ctypedef enum hipsparseSpMatAttribute_t:
HIPSPARSE_SPMAT_FILL_MODE
HIPSPARSE_SPMAT_DIAG_TYPE
ctypedef enum hipsparseSpGEMMAlg_t:
HIPSPARSE_SPGEMM_DEFAULT
HIPSPARSE_SPGEMM_CSR_ALG_DETERMINISTIC
HIPSPARSE_SPGEMM_CSR_ALG_NONDETERMINISTIC
HIPSPARSE_SPGEMM_ALG1
HIPSPARSE_SPGEMM_ALG2
HIPSPARSE_SPGEMM_ALG3
cdef hipsparseStatus_t hipsparseCreateSpVec(void ** spVecDescr,int64_t size,int64_t nnz,void * indices,void * values,hipsparseIndexType_t idxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstSpVec(const void ** spVecDescr,int64_t size,int64_t nnz,const void * indices,const void * values,hipsparseIndexType_t idxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDestroySpVec(const void * spVecDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVecGet(void *const spVecDescr,int64_t * size,int64_t * nnz,void ** indices,void ** values,hipsparseIndexType_t * idxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstSpVecGet(const void * spVecDescr,int64_t * size,int64_t * nnz,const void ** indices,const void ** values,hipsparseIndexType_t * idxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVecGetIndexBase(const void *const spVecDescr,hipsparseIndexBase_t * idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVecGetValues(void *const spVecDescr,void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstSpVecGetValues(const void * spVecDescr,const void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVecSetValues(void * spVecDescr,void * values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateCoo(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,void * cooRowInd,void * cooColInd,void * cooValues,hipsparseIndexType_t cooIdxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstCoo(hipsparseConstSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,const void * cooRowInd,const void * cooColInd,const void * cooValues,hipsparseIndexType_t cooIdxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateCooAoS(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,void * cooInd,void * cooValues,hipsparseIndexType_t cooIdxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateCsr(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,void * csrRowOffsets,void * csrColInd,void * csrValues,hipsparseIndexType_t csrRowOffsetsType,hipsparseIndexType_t csrColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstCsr(hipsparseConstSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,const void * csrRowOffsets,const void * csrColInd,const void * csrValues,hipsparseIndexType_t csrRowOffsetsType,hipsparseIndexType_t csrColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateCsc(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,void * cscColOffsets,void * cscRowInd,void * cscValues,hipsparseIndexType_t cscColOffsetsType,hipsparseIndexType_t cscRowIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstCsc(hipsparseConstSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,const void * cscColOffsets,const void * cscRowInd,const void * cscValues,hipsparseIndexType_t cscColOffsetsType,hipsparseIndexType_t cscRowIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateBlockedEll(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t ellBlockSize,int64_t ellCols,void * ellColInd,void * ellValue,hipsparseIndexType_t ellIdxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstBlockedEll(hipsparseConstSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t ellBlockSize,int64_t ellCols,const void * ellColInd,const void * ellValue,hipsparseIndexType_t ellIdxType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateSlicedEll(hipsparseSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,int64_t sellValuesSize,int64_t sliceSize,void * sellSliceOffsets,void * sellColInd,void * sellValues,hipsparseIndexType_t sellSliceOffsetsType,hipsparseIndexType_t sellColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstSlicedEll(hipsparseConstSpMatDescr_t * spMatDescr,int64_t rows,int64_t cols,int64_t nnz,int64_t sellValuesSize,int64_t sliceSize,const void * sellSliceOffsets,const void * sellColInd,const void * sellValues,hipsparseIndexType_t sellSliceOffsetsType,hipsparseIndexType_t sellColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateBsr(hipsparseSpMatDescr_t * spMatDescr,int64_t mb,int64_t nb,int64_t nnzb,int64_t rowBlockDim,int64_t colBlockDim,void * bsrRowPtr,void * bsrColInd,void * bsrValues,hipsparseIndexType_t bsrRowPtrType,hipsparseIndexType_t bsrColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType,hipsparseOrder_t order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstBsr(hipsparseConstSpMatDescr_t * spMatDescr,int64_t mb,int64_t nb,int64_t nnzb,int64_t rowBlockDim,int64_t colBlockDim,const void * bsrRowPtr,const void * bsrColInd,const void * bsrValues,hipsparseIndexType_t bsrRowPtrType,hipsparseIndexType_t bsrColIndType,hipsparseIndexBase_t idxBase,hipDataType valueType,hipsparseOrder_t order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDestroySpMat(hipsparseConstSpMatDescr_t spMatDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCooGet(const hipsparseSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,void ** cooRowInd,void ** cooColInd,void ** cooValues,hipsparseIndexType_t * idxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstCooGet(hipsparseConstSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,const void ** cooRowInd,const void ** cooColInd,const void ** cooValues,hipsparseIndexType_t * idxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCooAoSGet(const hipsparseSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,void ** cooInd,void ** cooValues,hipsparseIndexType_t * idxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCsrGet(const hipsparseSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,void ** csrRowOffsets,void ** csrColInd,void ** csrValues,hipsparseIndexType_t * csrRowOffsetsType,hipsparseIndexType_t * csrColIndType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstCsrGet(hipsparseConstSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,const void ** csrRowOffsets,const void ** csrColInd,const void ** csrValues,hipsparseIndexType_t * csrRowOffsetsType,hipsparseIndexType_t * csrColIndType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCscGet(const hipsparseSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,void ** cscColOffsets,void ** cscRowInd,void ** cscValues,hipsparseIndexType_t * cscColOffsetsType,hipsparseIndexType_t * cscRowIndType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstCscGet(hipsparseConstSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz,const void ** cscColOffsets,const void ** cscRowInd,const void ** cscValues,hipsparseIndexType_t * cscColOffsetsType,hipsparseIndexType_t * cscRowIndType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseBlockedEllGet(const hipsparseSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * ellBlockSize,int64_t * ellCols,void ** ellColInd,void ** ellValue,hipsparseIndexType_t * ellIdxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstBlockedEllGet(hipsparseConstSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * ellBlockSize,int64_t * ellCols,const void ** ellColInd,const void ** ellValue,hipsparseIndexType_t * ellIdxType,hipsparseIndexBase_t * idxBase,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCsrSetPointers(hipsparseSpMatDescr_t spMatDescr,void * csrRowOffsets,void * csrColInd,void * csrValues) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCscSetPointers(hipsparseSpMatDescr_t spMatDescr,void * cscColOffsets,void * cscRowInd,void * cscValues) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCooSetPointers(hipsparseSpMatDescr_t spMatDescr,void * cooRowInd,void * cooColInd,void * cooValues) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseBlockedEllSetPointers(hipsparseSpMatDescr_t spMatDescr,void * ellColInd,void * ellValue) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetSize(hipsparseConstSpMatDescr_t spMatDescr,int64_t * rows,int64_t * cols,int64_t * nnz) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetFormat(hipsparseConstSpMatDescr_t spMatDescr,hipsparseFormat_t * format) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetIndexBase(hipsparseConstSpMatDescr_t spMatDescr,hipsparseIndexBase_t * idxBase) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetValues(hipsparseSpMatDescr_t spMatDescr,void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstSpMatGetValues(hipsparseConstSpMatDescr_t spMatDescr,const void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatSetValues(hipsparseSpMatDescr_t spMatDescr,void * values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetStridedBatch(hipsparseConstSpMatDescr_t spMatDescr,int * batchCount) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatSetStridedBatch(hipsparseSpMatDescr_t spMatDescr,int batchCount) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCooSetStridedBatch(hipsparseSpMatDescr_t spMatDescr,int batchCount,int64_t batchStride) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCsrSetStridedBatch(hipsparseSpMatDescr_t spMatDescr,int batchCount,int64_t offsetsBatchStride,int64_t columnsValuesBatchStride) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatGetAttribute(hipsparseConstSpMatDescr_t spMatDescr,hipsparseSpMatAttribute_t attribute,void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMatSetAttribute(hipsparseSpMatDescr_t spMatDescr,hipsparseSpMatAttribute_t attribute,const void * data,size_t dataSize) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateDnVec(void ** dnVecDescr,int64_t size,void * values,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstDnVec(const void ** dnVecDescr,int64_t size,const void * values,hipDataType valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDestroyDnVec(const void * dnVecDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnVecGet(void *const dnVecDescr,int64_t * size,void ** values,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstDnVecGet(const void * dnVecDescr,int64_t * size,const void ** values,hipDataType * valueType) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnVecGetValues(void *const dnVecDescr,void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstDnVecGetValues(const void * dnVecDescr,const void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnVecSetValues(void * dnVecDescr,void * values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateDnMat(void ** dnMatDescr,int64_t rows,int64_t cols,int64_t ld,void * values,hipDataType valueType,hipsparseOrder_t order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseCreateConstDnMat(const void ** dnMatDescr,int64_t rows,int64_t cols,int64_t ld,const void * values,hipDataType valueType,hipsparseOrder_t order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDestroyDnMat(const void * dnMatDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnMatGet(void *const dnMatDescr,int64_t * rows,int64_t * cols,int64_t * ld,void ** values,hipDataType * valueType,hipsparseOrder_t * order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstDnMatGet(const void * dnMatDescr,int64_t * rows,int64_t * cols,int64_t * ld,const void ** values,hipDataType * valueType,hipsparseOrder_t * order) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnMatGetValues(void *const dnMatDescr,void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseConstDnMatGetValues(const void * dnMatDescr,const void ** values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnMatSetValues(void * dnMatDescr,void * values) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnMatGetStridedBatch(const void * dnMatDescr,int * batchCount,int64_t * batchStride) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDnMatSetStridedBatch(void * dnMatDescr,int batchCount,int64_t batchStride) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseAxpby(void * handle,const void * alpha,const void * vecX,const void * beta,void * vecY) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDenseToSparse_bufferSize(void * handle,const void * matA,hipsparseSpMatDescr_t matB,hipsparseDenseToSparseAlg_t alg,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDenseToSparse_analysis(void * handle,const void * matA,hipsparseSpMatDescr_t matB,hipsparseDenseToSparseAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseDenseToSparse_convert(void * handle,const void * matA,hipsparseSpMatDescr_t matB,hipsparseDenseToSparseAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseGather(void * handle,const void * vecY,void * vecX) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseRot(void * handle,const void * c_coeff,const void * s_coeff,void * vecX,void * vecY) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseScatter(void * handle,const void * vecX,void * vecY) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSDDMM_bufferSize(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,const void * A,const void * B,const void * beta,hipsparseSpMatDescr_t C,hipDataType computeType,hipsparseSDDMMAlg_t alg,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSDDMM_preprocess(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,const void * A,const void * B,const void * beta,hipsparseSpMatDescr_t C,hipDataType computeType,hipsparseSDDMMAlg_t alg,void * tempBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSDDMM(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,const void * A,const void * B,const void * beta,hipsparseSpMatDescr_t C,hipDataType computeType,hipsparseSDDMMAlg_t alg,void * tempBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSparseToDense_bufferSize(void * handle,hipsparseConstSpMatDescr_t matA,void * matB,hipsparseSparseToDenseAlg_t alg,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSparseToDense(void * handle,hipsparseConstSpMatDescr_t matA,void * matB,hipsparseSparseToDenseAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMM_createDescr(hipsparseSpGEMMDescr_t * descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMM_destroyDescr(hipsparseSpGEMMDescr_t descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMM_workEstimation(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,const void * beta,hipsparseSpMatDescr_t matC,hipDataType computeType,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr,size_t * bufferSize1,void * externalBuffer1) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMM_compute(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,const void * beta,hipsparseSpMatDescr_t matC,hipDataType computeType,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr,size_t * bufferSize2,void * externalBuffer2) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMM_copy(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,const void * beta,hipsparseSpMatDescr_t matC,hipDataType computeType,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMMreuse_workEstimation(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,hipsparseSpMatDescr_t matC,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr,size_t * bufferSize1,void * externalBuffer1) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMMreuse_nnz(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,hipsparseSpMatDescr_t matC,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr,size_t * bufferSize2,void * externalBuffer2,size_t * bufferSize3,void * externalBuffer3,size_t * bufferSize4,void * externalBuffer4) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMMreuse_copy(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,hipsparseSpMatDescr_t matC,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr,size_t * bufferSize5,void * externalBuffer5) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpGEMMreuse_compute(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,hipsparseConstSpMatDescr_t matB,const void * beta,hipsparseSpMatDescr_t matC,hipDataType computeType,hipsparseSpGEMMAlg_t alg,hipsparseSpGEMMDescr_t spgemmDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMM_bufferSize(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,const void * beta,void *const matC,hipDataType computeType,hipsparseSpMMAlg_t alg,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMM_preprocess(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,const void * beta,void *const matC,hipDataType computeType,hipsparseSpMMAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMM(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,const void * beta,void *const matC,hipDataType computeType,hipsparseSpMMAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMV_bufferSize(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * vecX,const void * beta,void *const vecY,hipDataType computeType,hipsparseSpMVAlg_t alg,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMV_preprocess(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * vecX,const void * beta,void *const vecY,hipDataType computeType,hipsparseSpMVAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpMV(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * vecX,const void * beta,void *const vecY,hipDataType computeType,hipsparseSpMVAlg_t alg,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_createDescr(hipsparseSpSMDescr_t * descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_destroyDescr(hipsparseSpSMDescr_t descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_bufferSize(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,void *const matC,hipDataType computeType,hipsparseSpSMAlg_t alg,hipsparseSpSMDescr_t spsmDescr,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_analysis(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,void *const matC,hipDataType computeType,hipsparseSpSMAlg_t alg,hipsparseSpSMDescr_t spsmDescr,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_solve(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,void *const matC,hipDataType computeType,hipsparseSpSMAlg_t alg,hipsparseSpSMDescr_t spsmDescr,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSM_solve_ex(void * handle,hipsparseOperation_t opA,hipsparseOperation_t opB,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * matB,void *const matC,hipDataType computeType,hipsparseSpSMAlg_t alg,hipsparseSpSMDescr_t spsmDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSV_createDescr(hipsparseSpSVDescr_t * descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSV_destroyDescr(hipsparseSpSVDescr_t descr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSV_bufferSize(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * x,void *const y,hipDataType computeType,hipsparseSpSVAlg_t alg,hipsparseSpSVDescr_t spsvDescr,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSV_analysis(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * x,void *const y,hipDataType computeType,hipsparseSpSVAlg_t alg,hipsparseSpSVDescr_t spsvDescr,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpSV_solve(void * handle,hipsparseOperation_t opA,const void * alpha,hipsparseConstSpMatDescr_t matA,const void * x,void *const y,hipDataType computeType,hipsparseSpSVAlg_t alg,hipsparseSpSVDescr_t spsvDescr) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVV_bufferSize(void * handle,hipsparseOperation_t opX,const void * vecX,const void * vecY,void * result,hipDataType computeType,size_t * pBufferSizeInBytes) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef hipsparseStatus_t hipsparseSpVV(void * handle,hipsparseOperation_t opX,const void * vecX,const void * vecY,void * result,hipDataType computeType,void * externalBuffer) except? HIPSPARSE_STATUS_INTERNAL_ERROR nogil
cdef bint __hipsparse_has_symbol(const char* name) noexcept nogil