Merged in jkflying/eigen-fix-scaling (pull request PR-302)

Make scaling work with non-square matrices
This commit is contained in:
Gael Guennebaud 2017-11-10 10:11:36 +00:00
commit fc45324380

View File

@ -104,12 +104,18 @@ class IterScaling
for (int i = 0; i < m; ++i) for (int i = 0; i < m; ++i)
{ {
Dr(i) = std::sqrt(Dr(i)); Dr(i) = std::sqrt(Dr(i));
}
for (int i = 0; i < n; ++i)
{
Dc(i) = std::sqrt(Dc(i)); Dc(i) = std::sqrt(Dc(i));
} }
// Save the scaling factors // Save the scaling factors
for (int i = 0; i < m; ++i) for (int i = 0; i < m; ++i)
{ {
m_left(i) /= Dr(i); m_left(i) /= Dr(i);
}
for (int i = 0; i < n; ++i)
{
m_right(i) /= Dc(i); m_right(i) /= Dc(i);
} }
// Scale the rows and the columns of the matrix // Scale the rows and the columns of the matrix