I encountered this error while I was trying to solve linear least square problem, ||Ax-b||. Trying to solve ((-1)b) to get x vector. MATLAB solves it like (A\b) and gives the correct answer.
I have properly followed the procedure given in
But when I am trying to use this subroutine (SGELSD) with my matrix A and B, which are of size (135x135) and (135x6) respectively, it throws the above mentioned error. My A matrix is singular, as its determinant is zero.
Matlab solves these ||Ax-b||, and gives the correct answer, so A and B matrix are good. I am reading these two matrices (A and b) in my fortran code.
Sorry for such a long post!!!!!!!!!
Please edit your post and remove the lines with the matrix contents, since they are useless at this point and some readers may find it annoying to scroll through thousands of lines that contain no interesting content.
If you simply used the example code without increasing the value of LWMAX above 1000, the GELSD call would likely fail for a 135 X 135 matrix. You should read the documentation of GELSD and issue a correct call instead of simply reusing example code.
In fact, a call to the Lapack95 interface routine would avoid this issue completely, since the calculation and allocation of workspace arrays would then be done automatically.
MODERATOR: Please consider moving this thread to the MKL forum.