diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-06-29 14:04:15 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-06-29 14:04:15 -0700 |
commit | f0ce85b757ce237d763d7751bda61901e78d5dc8 (patch) | |
tree | 8d463b14daa68ea6e624c61e5cac612ed23d89d2 /unsupported/Eigen/CXX11/src/Tensor/Tensor.h | |
parent | 670c71d906a4f0adc7edf266c996183ae8e4a2cc (diff) |
Improved support for fixed size tensors
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/Tensor.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index 4dbdbfb3e..24953ec94 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -375,6 +375,28 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp resize(dims); } +#ifndef EIGEN_EMULATE_CXX11_META_H + template <typename std::ptrdiff_t... Indices> + EIGEN_DEVICE_FUNC + void resize(const Sizes<Indices...>& dimensions) { + array<Index, NumIndices> dims; + for (int i = 0; i < NumIndices; ++i) { + dims[i] = dimensions[i]; + } + resize(dims); + } +#else + template <std::size_t V1, std::size_t V2, std::size_t V3, std::size_t V4, std::size_t V5> + EIGEN_DEVICE_FUNC + void resize(const Sizes<V1, V2, V3, V4, V5>& dimensions) { + array<Index, NumIndices> dims; + for (int i = 0; i < NumIndices; ++i) { + dims[i] = dimensions[i]; + } + resize(dims); + } +#endif + protected: bool checkIndexRange(const array<Index, NumIndices>& indices) const |