This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 636 - Eigen/src/Eigenvalues/EigenSolver.h should pass Scalar typename to cdiv explicitly
Summary: Eigen/src/Eigenvalues/EigenSolver.h should pass Scalar typename to cdiv expli...
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: unspecified
Hardware: All All
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-29 05:58 UTC by Thad Hughes
Modified: 2019-12-04 12:31 UTC (History)
4 users (show)



Attachments

Description Thad Hughes 2013-07-29 05:58:16 UTC
For example, I think you should write this:

std::complex<Scalar> cc = cdiv<Scalar>(-ra,-sa,w,q);

Instead of this:

std::complex<Scalar> cc = cdiv(-ra,-sa,w,q);

There is one place in the file where it is done correctly, other places where it is not.

The reason is that if Scalar is a type that uses expression templates -ra is not necessarily the same type as w, so the type inference when invoking cdiv does not work correctly.
Comment 1 Thad Hughes 2013-07-29 06:08:21 UTC
To be clear, I'm suggesting this patch:

@@ -518,7 +518,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
           l = i;
           if (m_eivalues.coeff(i).imag() == RealScalar(0))
           {
-            std::complex<Scalar> cc = cdiv(-ra,-sa,w,q);
+            std::complex<Scalar> cc = cdiv<Scalar>(-ra,-sa,w,q);
             m_matT.coeffRef(i,n-1) = internal::real(cc);
             m_matT.coeffRef(i,n) = internal::imag(cc);
           }
@@ -532,7 +532,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
             if ((vr == 0.0) && (vi == 0.0))
               vr = eps * norm * (internal::abs(w) + internal::abs(q) + internal::abs(x) + internal::abs(y) + internal::abs(lastw));
 
-	    std::complex<Scalar> cc = cdiv(x*lastra-lastw*ra+q*sa,x*lastsa-lastw*sa-q*ra,vr,vi);
+	    std::complex<Scalar> cc = cdiv<Scalar>(x*lastra-lastw*ra+q*sa,x*lastsa-lastw*sa-q*ra,vr,vi);
             m_matT.coeffRef(i,n-1) = internal::real(cc);
             m_matT.coeffRef(i,n) = internal::imag(cc);
             if (internal::abs(x) > (internal::abs(lastw) + internal::abs(q)))
@@ -542,7 +542,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
             }
             else
             {
-              cc = cdiv(-lastra-y*m_matT.coeff(i,n-1),-lastsa-y*m_matT.coeff(i,n),lastw,q);
+              cc = cdiv<Scalar>(-lastra-y*m_matT.coeff(i,n-1),-lastsa-y*m_matT.coeff(i,n),lastw,q);
               m_matT.coeffRef(i+1,n-1) = internal::real(cc);
               m_matT.coeffRef(i+1,n) = internal::imag(cc);
             }
Comment 2 Nobody 2019-12-04 12:31:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/636.

Note You need to log in before you can comment on or make changes to this bug.