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

solving underdetermined system and LAPACKE_dormqr error

Azua_Garcia__Giovann
672 Views
Hello,

Trying to do the same as in Matlab (snippet below) but using MKL produces at the point of doing the Q'*b with LAPACKE_dormqr "MKL ERROR: Parameter 10 (ldb) was incorrect on entry to cblas_dtrsm". Is it a valid case trying to solve underdetermined systems with MKL? I know this doesn't make a lot of sense i.e. infinite solutions but Matlab is quite robust in that respect.

I managed to get the append column QR update bit working green unit tests yippiiiii :) and this underdetermined system was a border case test which results in the MKL error above.

Thanks in advance,
Best regards,
Giovanni

>> A =[9.572000e-01 1.419000e-01 7.922000e-01 3.570000e-02 6.555000e-01;
4.854000e-01 4.218000e-01 9.595000e-01 8.491000e-01 1.712000e-01;
8.003000e-01 9.157000e-01 6.557000e-01 9.340000e-01 7.060000e-01]

A =

0.9572 0.1419 0.7922 0.0357 0.6555
0.4854 0.4218 0.9595 0.8491 0.1712
0.8003 0.9157 0.6557 0.9340 0.7060

>> b = [0.0318; 0.2769; 0.0462]

b =

0.0318
0.2769
0.0462

>> A\\b

ans =

0
0
0.2745
0.0739
-0.2872
0 Kudos
1 Reply
mecej4
Honored Contributor III
672 Views
If you have an undetermined system, with A an m X n matrix, rank(A) = m < n, and you want the minimum norm solution, you can use the LQ factorization. See the MKL Reference Manual under LAPACK Routines: Least Squares and Eigenvalue Problems. To obtain such a solution in Matlab, you would type in

pinv(A)*b

There is an example, dgelqfx.f, and associated input data dgelqfx.d, in the MKL examples/lapack directory. With this code, but your data above, I get the minimum norm solution as

-0.0540
-0.0954
0.2668
0.1395
-0.1821

which agrees with the result from the Matlab calculation pinv(A)*b.

If you want help with a problem with calling MKL, at a minimum you have to show the routine invocation and the declarations of the routine arguments. It would be better to post a complete example, if feasible.
0 Kudos
Reply