diff options
author | Bernardo Bahia Monteiro <bbahia@umich.edu> | 2020-03-29 18:53:18 -0400 |
---|---|---|
committer | Bernardo Bahia Monteiro <bbahia@umich.edu> | 2020-03-29 19:44:12 -0400 |
commit | 54a0a9c9dd83aad42e79238ec8f0932b2a5e7881 (patch) | |
tree | 88faa8db5290939e2382fa6a579a769a3d0db732 | |
parent | 4fd5d1477b221fc7daf2b7f1c7e4ee4f04ceaced (diff) |
Bugfix: conjugate_gradient did not compile with lazy-evaluated RealScalar
The error generated by the compiler was:
no matching function for call to 'maxi'
RealScalar threshold = numext::maxi(tol*tol*rhsNorm2,considerAsZero);
The important part in the following notes was:
candidate template ignored: deduced conflicting
types for parameter 'T'"
('codi::Multiply11<...>' vs. 'codi::ActiveReal<...>')
EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y)
I am using CoDiPack to provide the RealScalar type.
This bug was introduced in bc000deaa Fix conjugate-gradient for very small rhs
-rw-r--r-- | Eigen/src/IterativeLinearSolvers/ConjugateGradient.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h b/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h index 96e8b9f8a..5d8c6b433 100644 --- a/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +++ b/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h @@ -51,7 +51,7 @@ void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x, return; } const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)(); - RealScalar threshold = numext::maxi(tol*tol*rhsNorm2,considerAsZero); + RealScalar threshold = numext::maxi(RealScalar(tol*tol*rhsNorm2),considerAsZero); RealScalar residualNorm2 = residual.squaredNorm(); if (residualNorm2 < threshold) { |