From c334eece4413b1542c40c1c06336f42c2aeb3e76 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 29 Jul 2021 18:02:04 +0000 Subject: [PATCH] _DerType -> DerivativeType as underscore-followed-by-caps is a reserved identifier (cherry picked from commit f357283d3128a6253af09705155ce4f9f113e3c8) --- .../Eigen/src/AutoDiff/AutoDiffScalar.h | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h index 0ef159e30..0f166e35f 100755 --- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h @@ -26,11 +26,11 @@ void make_coherent(const A& a, const B&b) make_coherent_impl::run(a.const_cast_derived(), b.const_cast_derived()); } -template struct auto_diff_special_op; +template struct auto_diff_special_op; } // end namespace internal -template class AutoDiffScalar; +template class AutoDiffScalar; template inline AutoDiffScalar MakeAutoDiffScalar(const typename NewDerType::Scalar& value, const NewDerType &der) { @@ -38,16 +38,16 @@ inline AutoDiffScalar MakeAutoDiffScalar(const typename NewDerType:: } /** \class AutoDiffScalar - * \brief A scalar type replacement with automatic differentation capability + * \brief A scalar type replacement with automatic differentiation capability * - * \param _DerType the vector type used to store/represent the derivatives. The base scalar type + * \param DerivativeType the vector type used to store/represent the derivatives. The base scalar type * as well as the number of derivatives to compute are determined from this type. * Typical choices include, e.g., \c Vector4f for 4 derivatives, or \c VectorXf * if the number of derivatives is not known at compile time, and/or, the number * of derivatives is large. - * Note that _DerType can also be a reference (e.g., \c VectorXf&) to wrap a + * Note that DerivativeType can also be a reference (e.g., \c VectorXf&) to wrap a * existing vector into an AutoDiffScalar. - * Finally, _DerType can also be any Eigen compatible expression. + * Finally, DerivativeType can also be any Eigen compatible expression. * * This class represents a scalar value while tracking its respective derivatives using Eigen's expression * template mechanism. @@ -63,17 +63,17 @@ inline AutoDiffScalar MakeAutoDiffScalar(const typename NewDerType:: * */ -template +template class AutoDiffScalar : public internal::auto_diff_special_op - <_DerType, !internal::is_same::type>::Scalar, - typename NumTraits::type>::Scalar>::Real>::value> + ::type>::Scalar, + typename NumTraits::type>::Scalar>::Real>::value> { public: typedef internal::auto_diff_special_op - <_DerType, !internal::is_same::type>::Scalar, - typename NumTraits::type>::Scalar>::Real>::value> Base; - typedef typename internal::remove_all<_DerType>::type DerType; + ::type>::Scalar, + typename NumTraits::type>::Scalar>::Real>::value> Base; + typedef typename internal::remove_all::type DerType; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real Real; @@ -382,16 +382,16 @@ class AutoDiffScalar namespace internal { -template -struct auto_diff_special_op<_DerType, true> -// : auto_diff_scalar_op<_DerType, typename NumTraits::Real, +template +struct auto_diff_special_op +// : auto_diff_scalar_op::Real, // is_same::Real>::value> { - typedef typename remove_all<_DerType>::type DerType; + typedef typename remove_all::type DerType; typedef typename traits::Scalar Scalar; typedef typename NumTraits::Real Real; -// typedef auto_diff_scalar_op<_DerType, typename NumTraits::Real, +// typedef auto_diff_scalar_op::Real, // is_same::Real>::value> Base; // using Base::operator+; @@ -401,8 +401,8 @@ struct auto_diff_special_op<_DerType, true> // using Base::operator*; // using Base::operator*=; - const AutoDiffScalar<_DerType>& derived() const { return *static_cast*>(this); } - AutoDiffScalar<_DerType>& derived() { return *static_cast*>(this); } + const AutoDiffScalar& derived() const { return *static_cast*>(this); } + AutoDiffScalar& derived() { return *static_cast*>(this); } inline const AutoDiffScalar operator+(const Real& other) const @@ -410,12 +410,12 @@ struct auto_diff_special_op<_DerType, true> return AutoDiffScalar(derived().value() + other, derived().derivatives()); } - friend inline const AutoDiffScalar operator+(const Real& a, const AutoDiffScalar<_DerType>& b) + friend inline const AutoDiffScalar operator+(const Real& a, const AutoDiffScalar& b) { return AutoDiffScalar(a + b.value(), b.derivatives()); } - inline AutoDiffScalar<_DerType>& operator+=(const Real& other) + inline AutoDiffScalar& operator+=(const Real& other) { derived().value() += other; return derived(); @@ -431,22 +431,22 @@ struct auto_diff_special_op<_DerType, true> } friend inline const AutoDiffScalar >, DerType>::Type > - operator*(const Real& other, const AutoDiffScalar<_DerType>& a) + operator*(const Real& other, const AutoDiffScalar& a) { return AutoDiffScalar >, DerType>::Type >( a.value() * other, a.derivatives() * other); } - inline AutoDiffScalar<_DerType>& operator*=(const Scalar& other) + inline AutoDiffScalar& operator*=(const Scalar& other) { *this = *this * other; return derived(); } }; -template -struct auto_diff_special_op<_DerType, false> +template +struct auto_diff_special_op { void operator*() const; void operator-() const;