diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 2f2992997..a878b221f 100644 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -178,11 +178,11 @@ class AutoDiffScalar } template - inline const AutoDiffScalar,DerType,typename internal::remove_all::type> > + inline const AutoDiffScalar,const DerType,const typename internal::remove_all::type> > operator+(const AutoDiffScalar& other) const { internal::make_coherent(m_derivatives, other.derivatives()); - return AutoDiffScalar,DerType,typename internal::remove_all::type> >( + return AutoDiffScalar,const DerType,const typename internal::remove_all::type> >( m_value + other.value(), m_derivatives + other.derivatives()); } @@ -196,11 +196,11 @@ class AutoDiffScalar } template - inline const AutoDiffScalar, DerType,typename internal::remove_all::type> > + inline const AutoDiffScalar, const DerType,const typename internal::remove_all::type> > operator-(const AutoDiffScalar& other) const { internal::make_coherent(m_derivatives, other.derivatives()); - return AutoDiffScalar, DerType,typename internal::remove_all::type> >( + return AutoDiffScalar, const DerType,const typename internal::remove_all::type> >( m_value - other.value(), m_derivatives - other.derivatives()); } @@ -214,26 +214,26 @@ class AutoDiffScalar } template - inline const AutoDiffScalar, DerType> > + inline const AutoDiffScalar, const DerType> > operator-() const { - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( -m_value, -m_derivatives); } - inline const AutoDiffScalar, DerType> > + inline const AutoDiffScalar, const DerType> > operator*(const Scalar& other) const { - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( m_value * other, (m_derivatives * other)); } - friend inline const AutoDiffScalar, DerType> > + friend inline const AutoDiffScalar, const DerType> > operator*(const Scalar& other, const AutoDiffScalar& a) { - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( a.value() * other, a.derivatives() * other); } @@ -254,18 +254,18 @@ class AutoDiffScalar // a.derivatives() * other); // } - inline const AutoDiffScalar, DerType> > + inline const AutoDiffScalar, const DerType> > operator/(const Scalar& other) const { - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( m_value / other, (m_derivatives * (Scalar(1)/other))); } - friend inline const AutoDiffScalar, DerType> > + friend inline const AutoDiffScalar, const DerType> > operator/(const Scalar& other, const AutoDiffScalar& a) { - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( other / a.value(), a.derivatives() * (-Scalar(1)/other)); } @@ -288,16 +288,16 @@ class AutoDiffScalar template inline const AutoDiffScalar, - CwiseBinaryOp, - CwiseUnaryOp, DerType>, - CwiseUnaryOp, typename internal::remove_all::type > > > > + const CwiseBinaryOp, + const CwiseUnaryOp, const DerType>, + const CwiseUnaryOp, const typename internal::remove_all::type > > > > operator/(const AutoDiffScalar& other) const { internal::make_coherent(m_derivatives, other.derivatives()); return AutoDiffScalar, - CwiseBinaryOp, - CwiseUnaryOp, DerType>, - CwiseUnaryOp, typename internal::remove_all::type > > > >( + const CwiseBinaryOp, + const CwiseUnaryOp, const DerType>, + const CwiseUnaryOp, const typename internal::remove_all::type > > > >( m_value / other.value(), ((m_derivatives * other.value()) - (m_value * other.derivatives())) * (Scalar(1)/(other.value()*other.value()))); @@ -305,14 +305,14 @@ class AutoDiffScalar template inline const AutoDiffScalar, - CwiseUnaryOp, DerType>, - CwiseUnaryOp, typename internal::remove_all::type> > > + const CwiseUnaryOp, const DerType>, + const CwiseUnaryOp, const typename internal::remove_all::type> > > operator*(const AutoDiffScalar& other) const { internal::make_coherent(m_derivatives, other.derivatives()); - return AutoDiffScalar, - CwiseUnaryOp, DerType>, - CwiseUnaryOp, typename internal::remove_all::type > > >( + return AutoDiffScalar, + const CwiseUnaryOp, const DerType>, + const CwiseUnaryOp, const typename internal::remove_all::type > > >( m_value * other.value(), (m_derivatives * other.value()) + (m_value * other.derivatives())); } @@ -475,11 +475,11 @@ struct scalar_product_traits,T> #define EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(FUNC,CODE) \ template \ - inline const Eigen::AutoDiffScalar::type>::Scalar>, typename Eigen::internal::remove_all::type> > \ + inline const Eigen::AutoDiffScalar::type>::Scalar>, const typename Eigen::internal::remove_all::type> > \ FUNC(const Eigen::AutoDiffScalar& x) { \ using namespace Eigen; \ typedef typename internal::traits::type>::Scalar Scalar; \ - typedef AutoDiffScalar, typename internal::remove_all::type> > ReturnType; \ + typedef AutoDiffScalar, const typename internal::remove_all::type> > ReturnType; \ CODE; \ } @@ -506,12 +506,12 @@ namespace std return ReturnType(std::log(x.value()),x.derivatives() * (Scalar(1)/x.value()));) template - inline const Eigen::AutoDiffScalar::Scalar>, DerType> > + inline const Eigen::AutoDiffScalar::Scalar>, const DerType> > pow(const Eigen::AutoDiffScalar& x, typename Eigen::internal::traits::Scalar y) { using namespace Eigen; typedef typename internal::traits::Scalar Scalar; - return AutoDiffScalar, DerType> >( + return AutoDiffScalar, const DerType> >( std::pow(x.value(),y), x.derivatives() * (y * std::pow(x.value(),y-1))); }