- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've some small square matrices (so around 100x100) that are sparse. I want to use the LAPACK functions to compute the inverse. To do this, I've tried to use the function dgetrf (in C++). But always the info return value is > 0. I've checked the matrix, but it has no zero values on the diagonals. Because the matrix is square, I can use n=m=lda for the input parameters. Is it right? Is there any trouble known when using sparse matrices with LAPACK? I've also check the matrices in Matlab, they are non-singular.
Thanks for any hints,
Thomas
Thanks for any hints,
Thomas
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - thomasdd
Quoting - Melvin
Can you post some example code so that I can see what you are doing?
int n = 4, m = 4, lda = 4;
int ipiv = 0, info = 0;
double matrix[16] = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
dgetrf(&m, &n, matrix, &lda, &ipiv, &info);
std::cout << "INFO = " << info << std::endl;
In this case, info is 4! Is there anything wrong in the call of dgetrf?
Thomas
Thomas,
ipiv is the array, but not integer
the dimention at least max(1,min(m,n)), therefore for your case ipiv[4].
Please refer to the mkl's reference manual.
--Gennady
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - thomasdd
I've some small square matrices (so around 100x100) that are sparse. I want to use the LAPACK functions to compute the inverse. To do this, I've tried to use the function dgetrf (in C++). But always the info return value is > 0. I've checked the matrix, but it has no zero values on the diagonals. Because the matrix is square, I can use n=m=lda for the input parameters. Is it right? Is there any trouble known when using sparse matrices with LAPACK? I've also check the matrices in Matlab, they are non-singular.
Thanks for any hints,
Thomas
Thanks for any hints,
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Melvin
Can you post some example code so that I can see what you are doing?
int n = 4, m = 4, lda = 4;
int ipiv = 0, info = 0;
double matrix[16] = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
dgetrf(&m, &n, matrix, &lda, &ipiv, &info);
std::cout << "INFO = " << info << std::endl;
In this case, info is 4! Is there anything wrong in the call of dgetrf?
Thomas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - thomasdd
Quoting - Melvin
Can you post some example code so that I can see what you are doing?
int n = 4, m = 4, lda = 4;
int ipiv = 0, info = 0;
double matrix[16] = {1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1};
dgetrf(&m, &n, matrix, &lda, &ipiv, &info);
std::cout << "INFO = " << info << std::endl;
In this case, info is 4! Is there anything wrong in the call of dgetrf?
Thomas
Thomas,
ipiv is the array, but not integer
the dimention at least max(1,min(m,n)), therefore for your case ipiv[4].
Please refer to the mkl's reference manual.
--Gennady
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Gennady Fedorov (Intel)
Thomas,
ipiv is the array, but not integer
the dimention at least max(1,min(m,n)), therefore for your case ipiv[4].
Please refer to the mkl's reference manual.
--Gennady
Thomas

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