mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user