gtsam
3rdparty
Eigen
unsupported
test
cxx11_tensor_lvalue.cpp
Go to the documentation of this file.
1
// This file is part of Eigen, a lightweight C++ template library
2
// for linear algebra.
3
//
4
// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
5
//
6
// This Source Code Form is subject to the terms of the Mozilla
7
// Public License v. 2.0. If a copy of the MPL was not distributed
8
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
10
#include "
main.h
"
11
12
#include <Eigen/CXX11/Tensor>
13
14
using
Eigen::Tensor
;
15
using
Eigen::RowMajor
;
16
17
18
static
void
test_compound_assignment
()
19
{
20
Tensor<float, 3>
mat1
(2,3,7);
21
Tensor<float, 3>
mat2(2,3,7);
22
Tensor<float, 3>
mat3(2,3,7);
23
24
mat1.
setRandom
();
25
mat2.
setRandom
();
26
mat3 =
mat1
;
27
mat3 += mat2;
28
29
for
(
int
i
= 0;
i
< 2; ++
i
) {
30
for
(
int
j
= 0;
j
< 3; ++
j
) {
31
for
(
int
k = 0; k < 7; ++k) {
32
VERIFY_IS_APPROX
(mat3(
i
,
j
,k),
mat1
(
i
,
j
,k) + mat2(
i
,
j
,k));
33
}
34
}
35
}
36
}
37
38
39
EIGEN_DECLARE_TEST
(cxx11_tensor_lvalue)
40
{
41
CALL_SUBTEST
(
test_compound_assignment
());
42
}
Eigen::TensorBase< Tensor< Scalar_, NumIndices_, Options_, IndexType_ > >::setRandom
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor< Scalar_, NumIndices_, Options_, IndexType_ > & setRandom()
Definition:
TensorBase.h:996
mat1
MatrixXd mat1(size, size)
main.h
VERIFY_IS_APPROX
#define VERIFY_IS_APPROX(a, b)
Definition:
integer_types.cpp:15
test_compound_assignment
static void test_compound_assignment()
Definition:
cxx11_tensor_lvalue.cpp:18
CALL_SUBTEST
#define CALL_SUBTEST(FUNC)
Definition:
main.h:399
Eigen::RowMajor
Definition:
Constants.h:321
EIGEN_DECLARE_TEST
EIGEN_DECLARE_TEST(cxx11_tensor_lvalue)
Definition:
cxx11_tensor_lvalue.cpp:39
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
Eigen::Tensor
The tensor class.
Definition:
Tensor.h:63
gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:07