From bbe717fa2f9fe4828c845b27f4a7d4bb77fffdb2 Mon Sep 17 00:00:00 2001 From: Julian Kent Date: Fri, 3 Mar 2017 12:58:51 +0100 Subject: [PATCH] Make scaling work with non-square matrices --- unsupported/Eigen/src/IterativeSolvers/Scaling.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/unsupported/Eigen/src/IterativeSolvers/Scaling.h b/unsupported/Eigen/src/IterativeSolvers/Scaling.h index d113e6e90..9b3eb53e0 100644 --- a/unsupported/Eigen/src/IterativeSolvers/Scaling.h +++ b/unsupported/Eigen/src/IterativeSolvers/Scaling.h @@ -104,12 +104,18 @@ class IterScaling for (int i = 0; i < m; ++i) { Dr(i) = std::sqrt(Dr(i)); + } + for (int i = 0; i < n; ++i) + { Dc(i) = std::sqrt(Dc(i)); } // Save the scaling factors for (int i = 0; i < m; ++i) { m_left(i) /= Dr(i); + } + for (int i = 0; i < n; ++i) + { m_right(i) /= Dc(i); } // Scale the rows and the columns of the matrix