diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 86851eca4..7ca87b8cc 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -171,7 +171,7 @@ template class ComplexEigenSolver void compute(const MatrixType& matrix); protected: - MatrixType m_eivec; + EigenvectorType m_eivec; EigenvalueType m_eivalues; bool m_isInitialized; }; @@ -195,21 +195,21 @@ void ComplexEigenSolver::compute(const MatrixType& matrix) m_eivec.setZero(); - Scalar d2, z; + Complex d2, z; RealScalar norm = matrix.norm(); // compute the (normalized) eigenvectors for(int k=n-1 ; k>=0 ; k--) { d2 = schur.matrixT().coeff(k,k); - m_eivec.coeffRef(k,k) = Scalar(1.0,0.0); + m_eivec.coeffRef(k,k) = Complex(1.0,0.0); for(int i=k-1 ; i>=0 ; i--) { m_eivec.coeffRef(i,k) = -schur.matrixT().coeff(i,k); if(k-i-1>0) m_eivec.coeffRef(i,k) -= (schur.matrixT().row(i).segment(i+1,k-i-1) * m_eivec.col(k).segment(i+1,k-i-1)).value(); z = schur.matrixT().coeff(i,i) - d2; - if(z==Scalar(0)) + if(z==Complex(0)) ei_real_ref(z) = eps * norm; m_eivec.coeffRef(i,k) = m_eivec.coeff(i,k) / z; diff --git a/Eigen/src/Eigenvalues/ComplexSchur.h b/Eigen/src/Eigenvalues/ComplexSchur.h index 366114d5e..7b20a6621 100644 --- a/Eigen/src/Eigenvalues/ComplexSchur.h +++ b/Eigen/src/Eigenvalues/ComplexSchur.h @@ -158,8 +158,8 @@ void ComplexSchur::compute(const MatrixType& matrix, bool skipU) // TODO skip Q if skipU = true HessenbergDecomposition hess(matrix); - m_matT = hess.matrixH(); - if(!skipU) m_matU = hess.matrixQ(); + m_matT = hess.matrixH().template cast(); + if(!skipU) m_matU = hess.matrixQ().template cast(); // Reduce the Hessenberg matrix m_matT to triangular form by QR iteration. @@ -221,7 +221,7 @@ void ComplexSchur::compute(const MatrixType& matrix, bool skipU) // compute the shift kappa as one of the eigenvalues of the 2x2 // diagonal block on the bottom of the active submatrix - Matrix t = m_matT.template block<2,2>(iu-1,iu-1); + Matrix t = m_matT.template block<2,2>(iu-1,iu-1); sf = t.cwiseAbs().sum(); t /= sf; // the normalization by sf is to avoid under/overflow diff --git a/test/eigensolver_complex.cpp b/test/eigensolver_complex.cpp index fa052a9ae..4e973c877 100644 --- a/test/eigensolver_complex.cpp +++ b/test/eigensolver_complex.cpp @@ -61,5 +61,6 @@ void test_eigensolver_complex() CALL_SUBTEST_1( eigensolver(Matrix4cf()) ); CALL_SUBTEST_2( eigensolver(MatrixXcd(14,14)) ); CALL_SUBTEST_3( eigensolver(Matrix, 1, 1>()) ); + CALL_SUBTEST_4( eigensolver(Matrix3f()) ); } }