TensorEval are now typed on the device: this will make it possible to use partial template specialization to optimize the strategy of each evaluator for each device type.

Started work on partial evaluations.
This commit is contained in:
Benoit Steiner
2014-06-10 09:14:44 -07:00
parent a77458a8ff
commit 925fb6b937
9 changed files with 129 additions and 102 deletions

View File

@@ -198,19 +198,25 @@ class TensorBase<Derived, ReadOnlyAccessors>
}
// Coefficient-wise ternary operators.
template<typename ThenDerived, typename ElseDerived>
inline const TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>
template<typename ThenDerived, typename ElseDerived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>
select(const ThenDerived& thenTensor, const ElseDerived& elseTensor) const {
return TensorSelectOp<const Derived, const ThenDerived, const ElseDerived>(derived(), thenTensor.derived(), elseTensor.derived());
}
// Morphing operators (slicing tbd).
template <typename NewDimensions>
inline const TensorReshapingOp<const Derived, const NewDimensions>
template <typename NewDimensions> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const TensorReshapingOp<const Derived, const NewDimensions>
reshape(const NewDimensions& newDimensions) const {
return TensorReshapingOp<const Derived, const NewDimensions>(derived(), newDimensions);
}
// Force the evaluation of the expression.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const TensorForcedEvalOp<const Derived> eval() const {
return TensorForcedEvalOp<const Derived>(derived());
}
protected:
template <typename OtherDerived, int AccessLevel> friend class TensorBase;
EIGEN_DEVICE_FUNC