RE: [eigen] Using Matrix<AutoDiff> in conjunction with Matrix<double>? |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
Hi,
thanks for the pointer.
the following extensions to AutoDiff seem to at least help somewhat:
// so we can print matrices of AutoDiffScalar template<typename DerType> struct significant_decimals_impl<AutoDiffScalar<DerType> > : significant_decimals_impl<typename DerType::Scalar> { };
// allows Matrix<AutoDiff<T>, 3, 1>.dot(Matrix<T, 3, 1>) template<typename DerType> struct conj_helper<Eigen::AutoDiffScalar<DerType>, typename DerType::Scalar, false, false> { EIGEN_STRONG_INLINE Eigen::AutoDiffScalar<DerType> pmul(const Eigen::AutoDiffScalar<DerType> &x, const typename DerType::Scalar &y) const { return x*y; } };
// allows Matrix<T, 3, 1>.dot(Matrix<AutoDiff<T>, 3, 1>) template<typename DerType> struct conj_helper<typename DerType::Scalar, Eigen::AutoDiffScalar<DerType>, false, false> { EIGEN_STRONG_INLINE Eigen::AutoDiffScalar<DerType> pmul(const typename DerType::Scalar &x, const Eigen::AutoDiffScalar<DerType> &y) const { return x*y; } }; The required promotion for using mixed types (e.g. AutoDiff<T> * Matrix<T> or Matrix<T> + Matrix<AutoDiff<T>>) is still missing.
Best regards Daniel Vollmer -------------------------- Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR) German Aerospace Center Institute of Aerodynamics and Flow Technology | Lilienthalplatz 7 | 38108 Braunschweig | Germany Daniel Vollmer | AS C²A²S²E www.DLR.de Von: Gael Guennebaud [gael.guennebaud@xxxxxxxxx]
Gesendet: Montag, 4. April 2016 11:42 An: eigen Betreff: Re: [eigen] Using Matrix<AutoDiff> in conjunction with Matrix<double>? Yes, adding such flexibility is desirable, and this issue has been identified a long time ago:
feel free to extend AutoDiffScalar and to propose a patch.
gael
On Thu, Mar 31, 2016 at 5:21 PM, <Daniel.Vollmer@xxxxxx> wrote:
Hi, |
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |