diff options
author | Gael Guennebaud <g.gael@free.fr> | 2016-07-27 14:52:48 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2016-07-27 14:52:48 +0200 |
commit | 8972323c088350200fd9e799238081aa37c2342a (patch) | |
tree | 4e49bb6e9c4e1a22473eb9ad98058273dc4d9667 /unsupported/Eigen/src/AutoDiff | |
parent | 5d94dc85e5b8c88497d60448d4367dafbca72690 (diff) |
Big 1261: add missing max(ADS,ADS) overload (same for min)
Diffstat (limited to 'unsupported/Eigen/src/AutoDiff')
-rwxr-xr-x | unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 98e0e3b73..2db4d8c3b 100755 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -562,6 +562,15 @@ inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::Plain typedef AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> ADS; return (x > y ? ADS(x) : ADS(y)); } +template<typename DerType> +inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (min)(const AutoDiffScalar<DerType>& x, const AutoDiffScalar<DerType>& y) { + return (x.value() < y.value() ? x : y); +} +template<typename DerType> +inline AutoDiffScalar<typename Eigen::internal::remove_all<DerType>::type::PlainObject> (max)(const AutoDiffScalar<DerType>& x, const AutoDiffScalar<DerType>& y) { + return (x.value() >= y.value() ? x : y); +} + EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(abs, using std::abs; |