From 2b2fcc9460b0d541172e951a9059be4d982d44d0 Mon Sep 17 00:00:00 2001 From: Thomas Capricelli Date: Fri, 29 Jan 2010 08:59:25 +0100 Subject: [PATCH] erm.... using nxn is the actual purpose of this variant, fix this. --- .../Eigen/src/NonLinearOptimization/LevenbergMarquardt.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h index 7457c688e..49b63bed8 100644 --- a/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +++ b/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h @@ -417,7 +417,12 @@ LevenbergMarquardt::minimizeOptimumStorageInit( wa1.resize(n); wa2.resize(n); wa3.resize(n); wa4.resize(m); fvec.resize(m); - fjac.resize(m, n); + // Only R is stored in fjac. Q is only used to compute 'qtf', which is + // Q.transpose()*rhs. qtf will be updated using givens rotation, + // instead of storing them in Q. + // The purpose it to only use a nxn matrix, instead of mxn here, so + // that we can handle cases where m>>n : + fjac.resize(n, n); if (mode != 2) diag.resize(n); assert( (mode!=2 || diag.size()==n) || "When using mode==2, the caller must provide a valid 'diag'");