mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
fix: issue 2481: LDLT produce wrong results with AutoDiffScalar
This commit is contained in:
committed by
Antonio Sánchez
parent
477eb7f630
commit
e99163e732
@@ -715,6 +715,23 @@ template<typename DerType> struct NumTraits<AutoDiffScalar<DerType> >
|
||||
};
|
||||
};
|
||||
|
||||
namespace internal {
|
||||
template<typename DerivativeType>
|
||||
struct is_identically_zero_impl<AutoDiffScalar<DerivativeType>> {
|
||||
static inline bool run(const AutoDiffScalar<DerivativeType>& s)
|
||||
{
|
||||
const DerivativeType& derivatives = s.derivatives();
|
||||
for(int i=0; i<derivatives.size(); ++i)
|
||||
{
|
||||
if(!numext::is_exactly_zero(derivatives[i]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return numext::is_exactly_zero(s.value());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
Reference in New Issue
Block a user