Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6975 Discussions

Intel MKL ERROR: Parameter 12 was incorrect on entry to SGELSD

pankaj_p_
Novice
989 Views

Hello all,

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 

https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_examples/dgelsd_ex.f.htm

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!!!!!!!!!

Thanks
 

0 Kudos
1 Reply
mecej4
Honored Contributor III
989 Views

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.

0 Kudos
Reply