mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-13 20:26:03 +08:00
Fix bug #561: remove useless sign macro
This commit is contained in:
parent
f82ee241ac
commit
03373f41cb
@ -532,11 +532,9 @@ inline AutoDiffScalar<DerType> (min)(const T& x, const AutoDiffScalar<DerType>&
|
|||||||
template<typename DerType, typename T>
|
template<typename DerType, typename T>
|
||||||
inline AutoDiffScalar<DerType> (max)(const T& x, const AutoDiffScalar<DerType>& y) { return (x > y ? x : y); }
|
inline AutoDiffScalar<DerType> (max)(const T& x, const AutoDiffScalar<DerType>& y) { return (x > y ? x : y); }
|
||||||
|
|
||||||
#define sign(x) x >= 0 ? 1 : -1 // required for abs function below
|
|
||||||
|
|
||||||
EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs,
|
EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs,
|
||||||
using std::abs;
|
using std::abs;
|
||||||
return ReturnType(abs(x.value()), x.derivatives() * (sign(x.value())));)
|
return ReturnType(abs(x.value()), x.derivatives() * (x.value()<0 ? -1 : 1) );)
|
||||||
|
|
||||||
EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs2,
|
EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs2,
|
||||||
using internal::abs2;
|
using internal::abs2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user