mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
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
This commit is contained in:
parent
4fd5d1477b
commit
54a0a9c9dd
@ -51,7 +51,7 @@ void conjugate_gradient(const MatrixType& mat, const Rhs& rhs, Dest& x,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();
|
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();
|
RealScalar residualNorm2 = residual.squaredNorm();
|
||||||
if (residualNorm2 < threshold)
|
if (residualNorm2 < threshold)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user