Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- MKL clapack - leading dimension when data is in row-major order?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Michael_B_19

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-02-2011
05:30 PM

292 Views

MKL clapack - leading dimension when data is in row-major order?

Suppose I want to use the dtrtrs function to solve AX=B when A is triangular. Both A and B are stored in row-major order. In the parameter arguments, the routine asks for the leading dimensions of A and B (lda and ldb). This makes sense when matrices are in column-major order, but if they are in row-major, the number of rows in the array doesn't really tell the routing anything. Shouldn't I be reporting the trailing dimension (number of columns in the array) instead?

Thanks so much for your help.

Michael

1 Solution

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-03-2011
03:23 AM

292 Views

You are right ifyou have *N* columns in your matrix *A, *then*LDA=N* for row-major case.

In general leading dimension is equal to the number of elements in major dimension.Also it isequal to the distance in elements between two neighbor elements in a line of minor dimension.

Thusif you have no extra elements in your matrix with *M* rows and *N* columns, then:

- In row-major case: row *i*lays in memory right after row *i-1*and thus *LDA=N* - number of elements in row.

- In column-major case: column *i*lays in memory right after column *i-1*and thus *LDA=M* - number of elements in column.

If you refer to a submatrix ( *m *x *n* )then you use as leading dimension the number of elements in major dimension of the whole matrix (as above)while*m* and*n* in subroutine's inputparametersdescribes the size of the submatrix.

You are welcome.

Alexander.

Link Copied

2 Replies

Alexander_K_Intel3

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-03-2011
03:23 AM

293 Views

You are right ifyou have *N* columns in your matrix *A, *then*LDA=N* for row-major case.

In general leading dimension is equal to the number of elements in major dimension.Also it isequal to the distance in elements between two neighbor elements in a line of minor dimension.

Thusif you have no extra elements in your matrix with *M* rows and *N* columns, then:

- In row-major case: row *i*lays in memory right after row *i-1*and thus *LDA=N* - number of elements in row.

- In column-major case: column *i*lays in memory right after column *i-1*and thus *LDA=M* - number of elements in column.

If you refer to a submatrix ( *m *x *n* )then you use as leading dimension the number of elements in major dimension of the whole matrix (as above)while*m* and*n* in subroutine's inputparametersdescribes the size of the submatrix.

You are welcome.

Alexander.

Michael_B_19

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-03-2011
09:52 AM

292 Views

In any event, I now know what to do when using MKL. Thanks again.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.