Open discussion regarding features, bugs, issues, vendors, etc.

I can't believe this isn't a FAQ, so it must be pretty dumb... Why on earth would the "leading dimension" of a matrix not be the same as its number of rows?
jwwalker

Posts: 6
Joined: Mon Jul 10, 2006 6:18 pm
Location: San Diego, CA

### Re: leading dimension?

jwwalker wrote:I can't believe this isn't a FAQ, so it must be pretty dumb... Why on earth would the "leading dimension" of a matrix not be the same as its number of rows?

Suppose that you have a matrix A of size 100x100 which is stored in an array 100x100. In this case LDA is the same as N. Now suppose that you want to work only on the submatrix A(91:100 , 1:100); in this case the number of rows is 10 but LDA=100. Assuming the fortran column-major ordering (which is the case in LAPACK), the LDA is used to define the distance in memory between elements of two consecutive columns which have the same row index. If you call B = A(91:100 , 1:100) then B(1,1) and B(1,2) are 100 memory locations far from each other.
If you want to have an idea of the importance of LDA try to take a look inside the LAPACK routines.
Makes sense?

alfredo
buttari

Posts: 51
Joined: Tue Jul 11, 2006 2:11 pm

Yes, that makes sense, thanks.
jwwalker

Posts: 6
Joined: Mon Jul 10, 2006 6:18 pm
Location: San Diego, CA