From f8e7b9590d2ab7030180bc9fdb93e45f8aef3469 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Mon, 26 Oct 2015 10:47:37 -0700 Subject: [PATCH 1/3] Fixed compilation error triggered by gcc 4.7 --- unsupported/test/cxx11_tensor_fft.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/unsupported/test/cxx11_tensor_fft.cpp b/unsupported/test/cxx11_tensor_fft.cpp index 4aefcc79c..0f6e09106 100644 --- a/unsupported/test/cxx11_tensor_fft.cpp +++ b/unsupported/test/cxx11_tensor_fft.cpp @@ -67,14 +67,14 @@ static void test_fft_complex_input_golden() { array fft; fft[0] = 0; - Tensor, 1, ColMajor, long> forward_output_both_parts = input.template fft(fft); - Tensor, 1, ColMajor, long> reverse_output_both_parts = input.template fft(fft); + Tensor, 1, ColMajor, long> forward_output_both_parts = input.fft(fft); + Tensor, 1, ColMajor, long> reverse_output_both_parts = input.fft(fft); - Tensor forward_output_real_part = input.template fft(fft); - Tensor reverse_output_real_part = input.template fft(fft); + Tensor forward_output_real_part = input.fft(fft); + Tensor reverse_output_real_part = input.fft(fft); - Tensor forward_output_imag_part = input.template fft(fft); - Tensor reverse_output_imag_part = input.template fft(fft); + Tensor forward_output_imag_part = input.fft(fft); + Tensor reverse_output_imag_part = input.fft(fft); VERIFY_IS_EQUAL(forward_output_both_parts.dimension(0), input.dimension(0)); VERIFY_IS_EQUAL(reverse_output_both_parts.dimension(0), input.dimension(0)); @@ -124,14 +124,14 @@ static void test_fft_real_input_golden() { array fft; fft[0] = 0; - Tensor, 1, ColMajor, long> forward_output_both_parts = input.template fft(fft); - Tensor, 1, ColMajor, long> reverse_output_both_parts = input.template fft(fft); + Tensor, 1, ColMajor, long> forward_output_both_parts = input.fft(fft); + Tensor, 1, ColMajor, long> reverse_output_both_parts = input.fft(fft); - Tensor forward_output_real_part = input.template fft(fft); - Tensor reverse_output_real_part = input.template fft(fft); + Tensor forward_output_real_part = input.fft(fft); + Tensor reverse_output_real_part = input.fft(fft); - Tensor forward_output_imag_part = input.template fft(fft); - Tensor reverse_output_imag_part = input.template fft(fft); + Tensor forward_output_imag_part = input.fft(fft); + Tensor reverse_output_imag_part = input.fft(fft); VERIFY_IS_EQUAL(forward_output_both_parts.dimension(0), input.dimension(0)); VERIFY_IS_EQUAL(reverse_output_both_parts.dimension(0), input.dimension(0)); From a3e144727cf0b1cc63dc1cf9a356ecb3ddd9f95f Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Mon, 26 Oct 2015 10:48:11 -0700 Subject: [PATCH 2/3] Fixed compilation warning --- unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h index dbc8c2ca9..62f5ff923 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h @@ -204,7 +204,7 @@ struct TensorEvaluator, D buf[i] = MakeComplex::value>()(m_impl.coeff(i)); } - for (int i = 0; i < m_fft.size(); ++i) { + for (size_t i = 0; i < m_fft.size(); ++i) { int dim = m_fft[i]; eigen_assert(dim >= 0 && dim < NumDims); Index line_len = m_dimensions[dim]; From 9f721384e080067e05ee1fd165e33aa9c77f25b7 Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Mon, 26 Oct 2015 11:21:27 -0700 Subject: [PATCH 3/3] Added support for empty dimensions --- .../Eigen/CXX11/src/Tensor/TensorDimensions.h | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index d6ec62a74..89e28bdb5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -52,8 +52,8 @@ struct fixed_size_tensor_index_linearization_helper static inline Index run(array const& indices, const Dimensions& dimensions) { - return array_get(indices) + - dget::value * + return array_get(indices) + + dget::value * fixed_size_tensor_index_linearization_helper::run(indices, dimensions); } }; @@ -62,10 +62,9 @@ template struct fixed_size_tensor_index_linearization_helper { template EIGEN_DEVICE_FUNC - static inline Index run(array const& indices, - const Dimensions&) + static inline Index run(array const&, const Dimensions&) { - return array_get(indices); + return 0; } }; @@ -135,11 +134,11 @@ struct Sizes : internal::numeric_list { template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfColMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfRowMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, *static_cast(this)); } }; @@ -222,11 +221,11 @@ template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfColMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *reinterpret_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, *reinterpret_cast(this)); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t IndexOfRowMajor(const array& indices) const { - return internal::fixed_size_tensor_index_linearization_helper::run(indices, *reinterpret_cast(this)); + return internal::fixed_size_tensor_index_linearization_helper::run(indices, *reinterpret_cast(this)); } }; @@ -402,22 +401,22 @@ template -struct sizes_match_up_to_dim { - static inline bool run(Dims1&, Dims2&) { +struct sizes_match_below_dim { + static inline bool run(Dims1& dims1, Dims2& dims2) { return false; } }; template -struct sizes_match_up_to_dim { +struct sizes_match_below_dim { static inline bool run(Dims1& dims1, Dims2& dims2) { - return (array_get(dims1) == array_get(dims2)) & - sizes_match_up_to_dim::run(dims1, dims2); + return (array_get(dims1) == array_get(dims2)) & + sizes_match_below_dim::run(dims1, dims2); } }; template -struct sizes_match_up_to_dim { - static inline bool run(Dims1& dims1, Dims2& dims2) { - return (array_get<0>(dims1) == array_get<0>(dims2)); +struct sizes_match_below_dim { + static inline bool run(Dims1&, Dims2&) { + return true; } }; @@ -426,7 +425,7 @@ struct sizes_match_up_to_dim { template bool dimensions_match(Dims1& dims1, Dims2& dims2) { - return internal::sizes_match_up_to_dim::value-1, internal::array_size::value-1>::run(dims1, dims2); + return internal::sizes_match_below_dim::value, internal::array_size::value>::run(dims1, dims2); } } // end namespace Eigen