diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-05-28 10:14:38 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-05-28 10:14:38 -0700 |
commit | 0e5fed74e7ab6f55ff5d4a0fcf88b0e18991e4e8 (patch) | |
tree | fb8600cca46058014f79aa0f89d84ef937963a88 /unsupported/Eigen/CXX11/src | |
parent | f13b3d4433bca0670fd57e41808d331b1ddfb1d8 (diff) |
Worked around some constexpr related bugs in nvcc 7
Diffstat (limited to 'unsupported/Eigen/CXX11/src')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h | 2 | ||||
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h | 28 |
2 files changed, 18 insertions, 12 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h index eed0a9f05..620b6a8cb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h @@ -10,7 +10,7 @@ #ifndef EIGEN_CXX11_TENSOR_TENSOR_INDEX_LIST_H #define EIGEN_CXX11_TENSOR_TENSOR_INDEX_LIST_H -#ifdef EIGEN_HAS_CONSTEXPR +#if defined(EIGEN_HAS_CONSTEXPR) && defined(EIGEN_HAS_VARIADIC_TEMPLATES) namespace Eigen { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h index de5747905..95116aaee 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h @@ -53,28 +53,34 @@ struct preserve_inner_most_dims { static const bool value = false; }; -#ifdef EIGEN_HAS_CONSTEXPR +#if defined(EIGEN_HAS_CONSTEXPR) && defined(EIGEN_HAS_VARIADIC_TEMPLATES) template <typename ReducedDims, int NumTensorDims> struct are_inner_most_dims<ReducedDims, NumTensorDims, ColMajor>{ - static const bool value = indices_statically_known_to_increase<ReducedDims>()() && - index_statically_eq<ReducedDims>()(0, 0) && - index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value-1, array_size<ReducedDims>::value-1); + static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>()(); + static const bool tmp2 = index_statically_eq<ReducedDims>()(0, 0); + static const bool tmp3 = index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value-1, array_size<ReducedDims>::value-1); + static const bool value = tmp1 & tmp2 & tmp3; }; template <typename ReducedDims, int NumTensorDims> struct are_inner_most_dims<ReducedDims, NumTensorDims, RowMajor>{ - static const bool value = indices_statically_known_to_increase<ReducedDims>()() && - index_statically_eq<ReducedDims>()(0, NumTensorDims - array_size<ReducedDims>::value) && - index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1); + static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>()(); + static const bool tmp2 = index_statically_eq<ReducedDims>()(0, NumTensorDims - array_size<ReducedDims>::value); + static const bool tmp3 = index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1); + static const bool value = tmp1 & tmp2 & tmp3; + }; template <typename ReducedDims, int NumTensorDims> struct preserve_inner_most_dims<ReducedDims, NumTensorDims, ColMajor>{ - static const bool value = indices_statically_known_to_increase<ReducedDims>()() && - index_statically_gt<ReducedDims>()(0, 0); + static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>()(); + static const bool tmp2 = index_statically_gt<ReducedDims>()(0, 0); + static const bool value = tmp1 & tmp2; + }; template <typename ReducedDims, int NumTensorDims> struct preserve_inner_most_dims<ReducedDims, NumTensorDims, RowMajor>{ - static const bool value = indices_statically_known_to_increase<ReducedDims>()() && - index_statically_lt<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1); + static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>()(); + static const bool tmp2 = index_statically_lt<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1); + static const bool value = tmp1 & tmp2; }; #endif |