mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -13,9 +13,8 @@
|
||||
|
||||
using Eigen::Tensor;
|
||||
|
||||
static void test_simple_swap()
|
||||
{
|
||||
Tensor<float, 3, ColMajor> tensor(2,3,7);
|
||||
static void test_simple_swap() {
|
||||
Tensor<float, 3, ColMajor> tensor(2, 3, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
Tensor<float, 3, RowMajor> tensor2 = tensor.swap_layout();
|
||||
@@ -26,19 +25,17 @@ static void test_simple_swap()
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
for (int k = 0; k < 7; ++k) {
|
||||
VERIFY_IS_EQUAL(tensor(i,j,k), tensor2(k,j,i));
|
||||
VERIFY_IS_EQUAL(tensor(i, j, k), tensor2(k, j, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void test_swap_as_lvalue()
|
||||
{
|
||||
Tensor<float, 3, ColMajor> tensor(2,3,7);
|
||||
static void test_swap_as_lvalue() {
|
||||
Tensor<float, 3, ColMajor> tensor(2, 3, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
Tensor<float, 3, RowMajor> tensor2(7,3,2);
|
||||
Tensor<float, 3, RowMajor> tensor2(7, 3, 2);
|
||||
tensor2.swap_layout() = tensor;
|
||||
VERIFY_IS_EQUAL(tensor.dimension(0), tensor2.dimension(2));
|
||||
VERIFY_IS_EQUAL(tensor.dimension(1), tensor2.dimension(1));
|
||||
@@ -47,15 +44,13 @@ static void test_swap_as_lvalue()
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
for (int k = 0; k < 7; ++k) {
|
||||
VERIFY_IS_EQUAL(tensor(i,j,k), tensor2(k,j,i));
|
||||
VERIFY_IS_EQUAL(tensor(i, j, k), tensor2(k, j, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_layout_swap)
|
||||
{
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_layout_swap) {
|
||||
CALL_SUBTEST(test_simple_swap());
|
||||
CALL_SUBTEST(test_swap_as_lvalue());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user