dpnp.scipy.sparse.csr_matrix.check_format¶
method
- csr_matrix.check_format()[source]¶
Validate the CSR structure, raising
ValueErrorif invalid.oneMKL trusts
indptr/indicesand indexes the value array with them directly, so malformed input is an out-of-bounds device read rather than a clean error. The checks mirrorscipy.sparse.csr_matrix.check_format():indptr[0] == 0andindptrnon-decreasing,indptr[-1] <= nnz(a larger value reads pastdata),every column index within
[0, N).
Called once automatically before the oneMKL handle is built (see
_ensure_spmv_handle); the result is cached, so repeated matvecs on the same matrix re-validate nothing. Calling it directly is only needed to validate a matrix ahead of its first matvec.- Raises:
- ValueError
If the CSR structure is malformed.