- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are indices in the Intel MKL BLAS and LAPACK function zero-based or one-based. For example the function idamax I think returns a zero-based argument with MKL CBLAS. However, my experience with Netlib was that this returned a one based index. There are also other functions such as dsyevx that require index arguments and I don't know whether these should be one-based or zero-based.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Philip,
BLAS level 1 based CBLAS is 0 based indexing and LAPACK and LAPACKE are 1 based indexing.
--Vipin
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The original portable versions of BLAS and Lapack were written in Fortran, and therefore used the traditional 1-based indices of the language. Later, vendor-enhanced versions were supplied in pre-built library form, the sources of some routines written perhaps in assembler or C, but not released to the public. As C gained popularity, CBLAS and C-Lapack were born, and provided 0-based indices as the default or an option.
As of now, in calls to a library routine that is described as suitable for calling from C,C++,C# and Fortran, it is generally safe to call using 1-base indices. If the library is meant only for use with C/C++/C#, 0-base should be used. A tell-tale sign that a routine can be called with 0-base or 1-base is the presence of an extra (compared to the original BLAS/Lapack version) subroutine argument to specify the type of indexing used. If a library routine does not contain any integer arrays as dummy arguments, it is safe to assume that either 0- or 1-based arrays can be used, because in this case all internally used indices serve only to enable computing the offset from the array base, which is the same whichever convention is used.
Note that the situation is more complicated and your choices more restricted when one or more routine arguments are arrays of rank higher than 1.
When integer arrays containing indices of real array elements are routine arguments (such as an array of pivot indices for matrix factorization, or the iA, jA parts of a CSR or CSC compact matrix) are passed as subroutine arguments, in addition to the 0/1 base question of the integer size (32-bit or 64-bit) becomes a factor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Philip,
BLAS level 1 based CBLAS is 0 based indexing and LAPACK and LAPACKE are 1 based indexing.
--Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
cblas_izamax() seems to be returning 0-based indexes.
However, MKL online documentation seems to be claiming 1-based indexes:
https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/562204
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yakub, could you give the link to this part of online documentation to check this?
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page