Developer Reference for Intel® oneAPI Math Kernel Library for C
Interface Considerations
Array Indices and Offsets
The Legacy Sparse BLAS Level 2 and Level 3 routines have varying support for one-based and zero-based indexing:
mkl_?csradd and mkl_?csrmultcsr support only one-based indexing
mkl_?dnscsr supports both one-based and zero-based indexing (controlled by the job parameter)
Indexing Convention:
One-based indexing: Array indices and offsets start at 1 (Fortran convention)
Zero-based indexing: Array indices and offsets start at 0 (C convention)
Example: A 5-element array with values {1.0, 5.0, 7.0, 8.0, 9.0}
One-based indexing:
Index: 1 2 3 4 5
Value: 1.0 5.0 7.0 8.0 9.0
Zero-based indexing:
Index: 0 1 2 3 4
Value: 1.0 5.0 7.0 8.0 9.0
For detailed descriptions of sparse matrix storage formats, see Sparse Matrix Storage Formats in the Appendix “Linear Solvers Basics”.
CSR Format Parameters
For mkl_?dnscsr, which supports both indexing modes, the sparse matrix indexing mode affects the values stored in the ia array. The array indexing itself follows the language convention (Fortran: 1-based, C: 0-based).
Parameter |
One-based Indexing Mode |
Zero-based Indexing Mode |
|---|---|---|
ia |
Array of length m + 1, where ia[i] for i = 0,..., m-1 contains the position of the first non-zero element in row i+1. ia[m] equals nnz + 1. |
Array of length m + 1, where ia[i] for i = 0,..., m-1 contains the position of the first non-zero element in row i. ia[m] equals nnz. |