Page 1 of 1
Indices in IPIV array for LU related functions

Posted:
Mon Jan 06, 2014 2:57 pm
by jgpallero
Hello,
All LU (and also QR with column pivoting) related LAPACK functions has as an argument an array IPIV that stores the indices of row (columns for QR) permutations. In LAPACKE, are the indices of this array 0-based or 1-based, as in Fortran?, i.e., an index for the first row , is stored as 0 or as 1?
Thanks
Re: Indices in IPIV array for LU related functions

Posted:
Sat Jan 11, 2014 2:00 pm
by admin
The address of the pointer given will always be the first memory address.
So if you give ipiv as argument of the function
- Code: Select all
info = LAPACKE_dgesv( LAPACK_ROW_MAJOR, n, nrhs, A, lda, ipiv, b, ldb );
with iliv defined as:
- Code: Select all
lapack_int *ipiv;
ipiv = (lapack_int *)malloc(n*sizeof(lapack_int)) ;
Your IPIV values are going to be store from ipiv[0] to ipiv[n-1]
Hope it helps
Julie
Re: Indices in IPIV array for LU related functions

Posted:
Sat Jan 11, 2014 2:18 pm
by jgpallero
Sorry, probably my explanation was not so clear. I mean the indices stored in IPIV as the rows to permute, i.e, it the second row is involved in one permutation, are the value 2 or 1 stored in IPIV? Using Fortran LAPACK, number 2 is stored. And using LAPACKE, 2 or 1?
Thanks
Re: Indices in IPIV array for LU related functions

Posted:
Sun Jan 12, 2014 12:29 am
by Julien Langou
IPIV is based on row indexex ranging from 1 to N whether you use the LAPACK Fortran Interface or the LAPACKE C Interface. Cheers, Julien.
Re: Indices in IPIV array for LU related functions

Posted:
Sun Jan 12, 2014 12:30 am
by Julien Langou
if the second row is involved in one permutation, are the value 2 or 1 stored in IPIV? Using Fortran LAPACK, number 2 is stored. And using LAPACKE, 2 or 1?
2