aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/src/AutoDiff
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-06-24 11:34:02 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-06-24 11:34:02 +0200
commitce90647fa58cd81c3561170947e2a507571b2e43 (patch)
tree82b86570f81869b6635ec12b5bdbcc7ff58cb2c9 /unsupported/Eigen/src/AutoDiff
parentfa39f81b48b4fb20410e788e39459ed448dc461d (diff)
Fix NumTraits<AutoDiff>
Diffstat (limited to 'unsupported/Eigen/src/AutoDiff')
-rwxr-xr-xunsupported/Eigen/src/AutoDiff/AutoDiffScalar.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
index 0abd12210..8e40569c1 100755
--- a/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
+++ b/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h
@@ -525,6 +525,23 @@ struct ScalarBinaryOpTraits<typename DerType::Scalar,AutoDiffScalar<DerType>, Bi
typedef AutoDiffScalar<DerType> ReturnType;
};
+
+// The following is an attempt to let Eigen's known about expression template, but that's more tricky!
+
+// template<typename DerType, typename BinOp>
+// struct ScalarBinaryOpTraits<AutoDiffScalar<DerType>,AutoDiffScalar<DerType>, BinOp>
+// {
+// enum { Defined = 1 };
+// typedef AutoDiffScalar<typename DerType::PlainObject> ReturnType;
+// };
+//
+// template<typename DerType1,typename DerType2, typename BinOp>
+// struct ScalarBinaryOpTraits<AutoDiffScalar<DerType1>,AutoDiffScalar<DerType2>, BinOp>
+// {
+// enum { Defined = 1 };//internal::is_same<typename DerType1::Scalar,typename DerType2::Scalar>::value };
+// typedef AutoDiffScalar<typename DerType1::PlainObject> ReturnType;
+// };
+
#define EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY(FUNC,CODE) \
template<typename DerType> \
inline const Eigen::AutoDiffScalar< \
@@ -645,9 +662,10 @@ template<typename DerType> struct NumTraits<AutoDiffScalar<DerType> >
: NumTraits< typename NumTraits<typename DerType::Scalar>::Real >
{
typedef AutoDiffScalar<Matrix<typename NumTraits<typename DerType::Scalar>::Real,DerType::RowsAtCompileTime,DerType::ColsAtCompileTime,
- DerType::Options, DerType::MaxRowsAtCompileTime, DerType::MaxColsAtCompileTime> > Real;
+ 0, DerType::MaxRowsAtCompileTime, DerType::MaxColsAtCompileTime> > Real;
typedef AutoDiffScalar<DerType> NonInteger;
typedef AutoDiffScalar<DerType> Nested;
+ typedef typename NumTraits<typename DerType::Scalar>::Literal Literal;
enum{
RequireInitialization = 1
};