Require Eigen >= 3.3 to define ScalarBinaryOpTraits in Jet.

- ScalarBinaryOpTraits was introduced in Eigen 3.3, and thus breaks
  compilation of Ceres for Eigen versions < 3.3.
- Reported as issue #252 by AustinDeric:
  https://github.com/ceres-solver/ceres-solver/issues/252

Change-Id: Ie9b7dace17709c348b18b297f2d5306b054ce4b0
This commit is contained in:
Alex Stewart
2017-02-13 16:12:09 +00:00
parent 5365ad8aa6
commit c1ebbfc79b
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -878,11 +878,13 @@ struct NumTraits<ceres::Jet<T, N> > {
};
};
#if EIGEN_VERSION_AT_LEAST(3, 3, 0)
// Specifying the return type of binary operations between Jets and scalar types
// allows you to perform matrix/array operations with Eigen matrices and arrays
// such as addition, subtraction, multiplication, and division where one Eigen
// matrix/array is of type Jet and the other is a scalar type. This improves
// performance by using the optimized scalar-to-Jet binary operations.
// performance by using the optimized scalar-to-Jet binary operations but
// is only available on Eigen versions >= 3.3
template <typename BinaryOp, typename T, int N>
struct ScalarBinaryOpTraits<ceres::Jet<T, N>, T, BinaryOp> {
typedef ceres::Jet<T, N> ReturnType;
@@ -891,6 +893,7 @@ template <typename BinaryOp, typename T, int N>
struct ScalarBinaryOpTraits<T, ceres::Jet<T, N>, BinaryOp> {
typedef ceres::Jet<T, N> ReturnType;
};
#endif // EIGEN_VERSION_AT_LEAST(3, 3, 0)
} // namespace Eigen