Commit c1b4f43d authored by Patrik Huber's avatar Patrik Huber

Changed Array::rsqrt() to sqrt().inverse() for older Eigen versions

Eigen only introduced rsqrt() in 3.3. Eventually, we'll switch back to rsqrt(), or even include Eigen directly under 3rdparty/.
parent 7eb619c2
...@@ -335,7 +335,7 @@ inline Eigen::MatrixXf unnormalise_pca_basis(const Eigen::MatrixXf& normalised_b ...@@ -335,7 +335,7 @@ inline Eigen::MatrixXf unnormalise_pca_basis(const Eigen::MatrixXf& normalised_b
{ {
using Eigen::MatrixXf; using Eigen::MatrixXf;
MatrixXf unnormalised_basis(normalised_basis.rows(), normalised_basis.cols()); // empty matrix with the same dimensions MatrixXf unnormalised_basis(normalised_basis.rows(), normalised_basis.cols()); // empty matrix with the same dimensions
Eigen::VectorXf one_over_sqrt_of_eigenvalues = eigenvalues.array().rsqrt(); Eigen::VectorXf one_over_sqrt_of_eigenvalues = eigenvalues.array().sqrt().inverse(); // Eigen added Array::rsqrt() in 3.3, switch back to that eventually
// De-normalise the basis: We multiply each eigenvector (i.e. each column) with 1 over the square root of its corresponding eigenvalue // De-normalise the basis: We multiply each eigenvector (i.e. each column) with 1 over the square root of its corresponding eigenvalue
for (int basis = 0; basis < normalised_basis.cols(); ++basis) { for (int basis = 0; basis < normalised_basis.cols(); ++basis) {
unnormalised_basis.col(basis) = normalised_basis.col(basis) * one_over_sqrt_of_eigenvalues(basis); unnormalised_basis.col(basis) = normalised_basis.col(basis) * one_over_sqrt_of_eigenvalues(basis);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment