diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-04-22 11:14:58 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-04-22 11:14:58 -0700 |
commit | 91359e1d0acf74bd586900849c4ab94c117c138f (patch) | |
tree | 8011a3348c60e16faeab2770c9547ad6b1194a92 /unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | |
parent | 8838ed39f49bc1eb44efbcf13946132611a3132f (diff) |
Added the ability to generate a tensor from a custom user defined 'generator'. This simplifies the creation of constant tensors initialized using specific regular patterns.
Created a gaussian window generator as a first use case.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorBase.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorBase.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index d44060258..c7cfbfce0 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -57,6 +57,13 @@ class TensorBase<Derived, ReadOnlyAccessors> return nullaryExpr(gen); } + // Tensor generation + template <typename Generator> EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const TensorGeneratorOp<Generator, const Derived> + generate(const Generator& generator) const { + return TensorGeneratorOp<Generator, const Derived>(derived(), generator); + } + // Generic unary operation support. template <typename CustomUnaryOp> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const TensorCwiseUnaryOp<CustomUnaryOp, const Derived> |