10 #ifndef EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H 11 #define EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H 13 #if EIGEN_HAS_VARIADIC_TEMPLATES 15 #include <initializer_list> 26 template <
typename Derived,
int N>
28 typedef std::initializer_list<
29 typename Initializer<Derived,
N - 1>::InitList> InitList;
31 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
33 const InitList& vals) {
36 (*indices)[traits<Derived>::NumDimensions -
N] = i++;
42 template <
typename Derived>
43 struct Initializer<Derived, 1> {
46 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
48 const InitList& vals) {
52 (*indices)[traits<Derived>::NumDimensions - 1] = i++;
53 tensor.coeffRef(*indices) =
v;
58 template <
typename Derived>
59 struct Initializer<Derived, 0> {
62 static void run(TensorEvaluator<Derived, DefaultDevice>& tensor,
65 tensor.coeffRef(0) =
v;
70 template <
typename Derived,
int N>
71 void initialize_tensor(TensorEvaluator<Derived, DefaultDevice>& tensor,
72 const typename Initializer<Derived, traits<Derived>::NumDimensions>::InitList& vals) {
74 Initializer<Derived, traits<Derived>::NumDimensions>
::run(tensor, &indices, vals);
80 #endif // EIGEN_HAS_VARIADIC_TEMPLATES 82 #endif // EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H
Namespace containing all symbols from the Eigen library.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
void run(Expr &expr, Dev &dev)