Indices in IPIV array for LU related functions

Post here if you have a question about LAPACK or ScaLAPACK algorithm or data format

Indices in IPIV array for LU related functions

Postby jgpallero » Mon Jan 06, 2014 2:57 pm

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
jgpallero
 
Posts: 24
Joined: Thu Jul 29, 2010 2:29 pm
Location: Madrid, Spain

Re: Indices in IPIV array for LU related functions

Postby admin » Sat Jan 11, 2014 2:00 pm

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
admin
Site Admin
 
Posts: 608
Joined: Wed Dec 08, 2004 7:07 pm

Re: Indices in IPIV array for LU related functions

Postby jgpallero » Sat Jan 11, 2014 2:18 pm

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
jgpallero
 
Posts: 24
Joined: Thu Jul 29, 2010 2:29 pm
Location: Madrid, Spain

Re: Indices in IPIV array for LU related functions

Postby Julien Langou » Sun Jan 12, 2014 12:29 am

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.
Julien Langou
 
Posts: 821
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Re: Indices in IPIV array for LU related functions

Postby Julien Langou » Sun Jan 12, 2014 12:30 am

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
Julien Langou
 
Posts: 821
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA


Return to Algorithm / Data

Who is online

Users browsing this forum: No registered users and 3 guests