14 #include <Eigen/Dense> 15 #include <Eigen/CXX11/Tensor> 20 template <
int DataLayout>
23 #ifdef EIGEN_HAS_SFINAE 27 using NormalIndex = DSizes<ptrdiff_t, 4>;
28 using CustomIndex = std::map<ptrdiff_t, ptrdiff_t>;
34 NormalIndex coeff(1,2,4,1);
36 VERIFY_IS_EQUAL(tensor.
coeff(coeffC), tensor.
coeff(coeff));
42 template <
int DataLayout>
45 #ifdef EIGEN_HAS_SFINAE 49 using NormalIndex = DSizes<ptrdiff_t, 4>;
50 using CustomIndex = Matrix<unsigned int, 4, 1>;
51 CustomIndex coeffC(1,2,4,1);
52 NormalIndex coeff(1,2,4,1);
54 VERIFY_IS_EQUAL(tensor.
coeff(coeffC), tensor.
coeff(coeff));
60 template <
int DataLayout>
63 #ifdef EIGEN_HAS_SFINAE 67 DSizes<ptrdiff_t, 4> coeff(1,2,4,1);
69 VERIFY_IS_EQUAL(tensor.
coeff({1,2,4,1}), tensor.
coeff(coeff));
75 template <
int DataLayout>
78 #ifdef EIGEN_HAS_SFINAE 82 DSizes<ptrdiff_t, 4> coeff(1,2,4,1);
83 Sizes<1,2,4,1> coeffC;
85 VERIFY_IS_EQUAL(tensor.
coeff(coeffC), tensor.
coeff(coeff));
92 test_map_as_index<ColMajor>();
93 test_map_as_index<RowMajor>();
94 test_matrix_as_index<ColMajor>();
95 test_matrix_as_index<RowMajor>();
96 test_varlist_as_index<ColMajor>();
97 test_varlist_as_index<RowMajor>();
98 test_sizes_as_index<ColMajor>();
99 test_sizes_as_index<RowMajor>();
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(const array< Index, NumIndices > &indices)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
static void test_matrix_as_index()
static void test_sizes_as_index()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(const array< Index, NumIndices > &indices) const
static void test_varlist_as_index()
static void test_map_as_index()
void test_cxx11_tensor_custom_index()