diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-07-22 10:31:21 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2014-07-22 10:31:21 -0700 |
commit | f7bb7ee3f36474163da7c7f6f88306d553238df2 (patch) | |
tree | dd0e52469be4a31ee7b27a24d811ace100ffb21e | |
parent | 40bb98e76acbe6e077903e15896c100ee6cced39 (diff) |
Fixed the assignment operator of the Tensor and TensorMap classes.
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 11 | ||||
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorMap.h | 9 |
2 files changed, 19 insertions, 1 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index 09601fc7d..547bb74d1 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -229,6 +229,17 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_> > EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Tensor& operator=(const Tensor& other) + { + // FIXME: we need to resize the tensor to fix the dimensions of the other. + // Unfortunately this isn't possible yet when the rhs is an expression. + // resize(other.dimensions()); + typedef TensorAssignOp<Tensor, const Tensor> Assign; + Assign assign(*this, other); + internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice()); + return *this; + } template<typename OtherDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor& operator=(const OtherDerived& other) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h index c97135b63..417717b90 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h @@ -241,9 +241,16 @@ template<typename PlainObjectType, int Options_> class TensorMap : public Tensor } #endif + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self& operator=(const Self& other) + { + typedef TensorAssignOp<Self, const Self> Assign; + Assign assign(*this, other); + internal::TensorExecutor<const Assign, DefaultDevice>::run(assign, DefaultDevice()); + return *this; + } template<typename OtherDerived> - EIGEN_DEVICE_FUNC + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Self& operator=(const OtherDerived& other) { typedef TensorAssignOp<Self, const OtherDerived> Assign; |