- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Qustion about the function:
dgetrs( trans, n, nrhs, a, lda, ipiv, b, ldb, info )
In the MKL Manual ,the ldb is the the first dimension of b,and ldb>=max(1,n),but when I used it in Vs2008I found
the ldb is the column of b
The example:
double A[9] = { 1, 1, 1,
2, 1, 1,
1, 2, 1};
double B[3] = { 3, 4, 6};
info1=LAPACKE_dgetrf(LAPACK_ROW_MAJOR,3,3,&(A[0]),3, &(ipiv[0]) );
info2 = LAPACKE_dgetrs(LAPACK_ROW_MAJOR,'N',3,1,&(A[0]),3,&(ipiv[0]),&(B[0]),1);
this is right,
but if I change the ldb to 3,
info2 = LAPACKE_dgetrs(LAPACK_ROW_MAJOR,'N',3,1,&(A[0]),3,&(ipiv[0]),&(B[0]),3);
it is wrong,
I wonder to know if the manual is wrong,or I don't understand the manual.
Thank's a lot
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a common source of confusion. Fortran and C store multidimensional arrays differently, and the manual attempts to cover the argument descriptions for the Fortran and C interfaces simultaneously.
Secondly, if you use one-dimensional arrays for matrices (which should be two-dimensional arrays), you need to understand the mapping correctly, or you will run into errors of the type that you saw.
The argument in question should be equal to the number of declared/allocated columns of B for the LapackE call, and the number of declared/allocated rows of B for the Fortran call.
Secondly, if you use one-dimensional arrays for matrices (which should be two-dimensional arrays), you need to understand the mapping correctly, or you will run into errors of the type that you saw.
The argument in question should be equal to the number of declared/allocated columns of B for the LapackE call, and the number of declared/allocated rows of B for the Fortran call.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your help!

Reply
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