leading dimension?

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

leading dimension?

Postby jwwalker » Tue Jul 11, 2006 12:59 pm

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?

Postby buttari » Tue Jul 11, 2006 2:26 pm

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

Postby jwwalker » Tue Jul 11, 2006 2:46 pm

Yes, that makes sense, thanks.
jwwalker
 
Posts: 6
Joined: Mon Jul 10, 2006 6:18 pm
Location: San Diego, CA


Return to User Discussion

Who is online

Users browsing this forum: No registered users and 5 guests

cron