12 #include <Eigen/CXX11/Tensor> 17 template <
int DataLayout>
27 template <
int DataLayout>
34 for (
int i = 0;
i < 5; ++
i) {
35 sum += tensor1(
i,
i,
i);
45 for (
int i = 0;
i < 7; ++
i) {
46 sum += tensor2(
i,
i,
i,
i,
i);
52 template <
int DataLayout>
61 for (
int i = 0;
i < 5; ++
i) {
63 for (
int j = 0;
j < 3; ++
j) {
64 sum += tensor1(
j,
i,
j);
76 for (
int i = 0;
i < 5; ++
i) {
77 for (
int j = 0;
j < 5; ++
j) {
79 for (
int k = 0; k < 7; ++k) {
80 sum += tensor2(
i,
j, k, k);
91 for (
int i = 0;
i < 7; ++
i) {
92 for (
int j = 0;
j < 7; ++
j) {
94 for (
int k = 0; k < 5; ++k) {
95 sum += tensor2(k, k,
i,
j);
108 for (
int i = 0;
i < 7; ++
i) {
109 for (
int j = 0;
j < 7; ++
j) {
111 for (
int k = 0; k < 3; ++k) {
112 sum += tensor3(k,
i, k,
j, k);
126 for (
int i = 0;
i < 3; ++
i) {
127 for (
int j = 0;
j < 4; ++
j) {
128 for (
int k = 0; k < 5; ++k) {
130 for (
int l = 0;
l < 7; ++
l) {
131 sum += tensor4(
i,
l,
j,
l, k);
140 template<
int DataLayout>
146 result = result.constant(1.0
f) - tensor.trace(dims);
151 for (
int i = 0;
i < 2; ++
i) {
152 for (
int j = 0;
j < 5; ++
j) {
154 for (
int k = 0; k < 3; ++k) {
155 sum += tensor(
i, k,
j, k);
EIGEN_DECLARE_TEST(cxx11_tensor_trace)
static void test_0D_trace()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rank() const
static void test_trace_in_expr()
static const Line3 l(Rot3(), 1, 1)
#define VERIFY_IS_EQUAL(a, b)
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
#define CALL_SUBTEST(FUNC)
static void test_simple_trace()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index dimension(std::size_t n) const
static void test_all_dimensions_trace()