XLPack 7.0
Python API Reference Manual
Loading...
Searching...
No Matches

◆ csr_check()

def csr_check ( m  ,
n  ,
val  ,
rowptr  ,
colind  ,
result   
)

Check sparse matrix (CSR)

Purpose
This routine checks the sparse matrix in CSR format. Use separate routine csx_check_sym to check symmetry.
Returns
info (int)
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid.
= 1: Empty row(s) found.(*)
= 2: Row(s) with unsorted column indices found.(*)
= 4: Diagonal element(s) with zero values (val = 0) found.(*)
= 8: Invalid column index(es) found.(*)
(*) Sum of these codes will be returned (e.g. 15 = 1 + 2 + 4 + 8 indicates that all four cases were detected).
= 16: The value of ptr[0] is invalid.
= 17: The value of (ptr[m] - ptr[0]) is invalid.
= 18: the value(s) of ptr[i](i > 0) are invalid.
Parameters
[in]mNumber of rows of the matrix. (m >= 0) (if m = 0, returns without computation)
[in]nNumber of columns of the matrix. (n >= 0) (if n = 0, returns without computation)
[in]valNumpy ndarray (1-dimensional, float, nnz)
Values of nonzero elements of input matrix (where nnz is the number of nonzero elements).
[in]rowptrNumpy ndarray (1-dimensional, int32, m + 1)
Row pointers of input matrix.
[in]colindNumpy ndarray (1-dimensional, int32, nnz)
Column indices of input matrix (where nnz is the number of nonzero elements).
[out]resultNumpy ndarray (1-dimensional, int32, 11)
Check result (valid for 0 <= info <= 15).
result[0]: Indexing of rowptr and colind (0 or 1).
result[1]: Number of nonzero elements.
result[2]: Number of nonzero elements in lower triangular part.
result[3]: Number of nonzero elements in upper triangular part.
result[4]: Number of nonzero diagonal elements.
result[5]: Number of elements with zero values (val[i] = 0).
result[6]: Number of diagonal elements with zero values (val[i] = 0).
result[7]: Number of empty rows.
result(8): Number of rows with unsorted column indices.
result[9]: Number of invaid column indices.
result[10]: Symmetry (1 if symmetric matrix, 0 otherwise).