diff options
author | Gael Guennebaud <g.gael@free.fr> | 2011-05-14 22:38:41 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2011-05-14 22:38:41 +0200 |
commit | d4fd298fbbc5546ee1a1ddfa462e7dc5445c912f (patch) | |
tree | 1c2e929ee2112c5e722ab92389c43c510e3cb3f7 /unsupported/Eigen/src/AutoDiff | |
parent | 9a06055870cef8fd55b7b1cc19096465058a85c8 (diff) |
Autodiff: fix scalr - active_scalar
Diffstat (limited to 'unsupported/Eigen/src/AutoDiff')
-rw-r--r-- | unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 4fc003d63..371160c24 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -221,9 +221,11 @@ class AutoDiffScalar return AutoDiffScalar<DerType&>(m_value - b, m_derivatives); } - friend inline const AutoDiffScalar<DerType&> operator-(const Scalar& a, const AutoDiffScalar& b) + friend inline const AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const DerType> > + operator-(const Scalar& a, const AutoDiffScalar& b) { - return AutoDiffScalar<DerType&>(a - b.value(), b.derivatives()); + return AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const DerType> > + (a - b.value(), -b.derivatives()); } template<typename OtherDerType> |