Solve Ax = b
. Real double. A
is overdetermined Mx2 with M >> 2. b
is Mx1. I've run a ton of data against mldivide
, and the results are excellent. I wrote a mex routine with MKL LAPACKE_dgels
and it's nowhere near as good. The results have a ton of noise and the underlying signal is barely there. I checked the routine against the MKL example results first. I've searched through the mldivide
doc (flowchart) and the SO questions. All I found is Matlab uses QR factorization for overdetermined rectangular.
What should I try next? Am I using the wrong LAPACK routine? Please help guide me in the right direction.
Update: To within E-15 floating point difference on the solution vector, Intel MKL LAPACKE_dgels has the same result as Matlab mldivide for real double overdetermined (rectangular) problems. As far as I can tell, this is the QR method used.
Beware the residuals returned from this dgels. They do not equate to b - Ax. Many of them are close to this value, whereas some are far from it.
include/armadillo_bits/glue_solve_meat.hpp
describes a call tostatus = auxlib::solve_approx_fast()
and a call toauxlib::solve_approx_svd()
if status is false.solve_approx_fast()
callslapack::gels
andauxlib::solve_approx_svd()
callslapack::gelsd()
. The return parameter of dgels become positive if a null pivot is found, thus preventing the system from being solved. The fact that it is always zero is consistent with a good conditioning of your matrix. Congratulations for having solved your problem yourself!