From a34a216e82290eb78e7afe7539976f1650ccbd76 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 12 May 2011 23:40:19 +0200 Subject: [PATCH] AutoDiff: add one missing operator- version --- unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 1a797d560..4fc003d63 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -216,6 +216,11 @@ class AutoDiffScalar return *this; } + inline const AutoDiffScalar operator-(const Scalar& b) const + { + return AutoDiffScalar(m_value - b, m_derivatives); + } + friend inline const AutoDiffScalar operator-(const Scalar& a, const AutoDiffScalar& b) { return AutoDiffScalar(a - b.value(), b.derivatives());