Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -13,10 +13,9 @@
using Eigen::Tensor;
template<int DataLayout>
static void test_simple_striding()
{
Tensor<float, 4, DataLayout> tensor(2,3,5,7);
template <int DataLayout>
static void test_simple_striding() {
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
tensor.setRandom();
array<ptrdiff_t, 4> strides;
strides[0] = 1;
@@ -36,7 +35,7 @@ static void test_simple_striding()
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 7; ++l) {
VERIFY_IS_EQUAL(tensor(i,j,k,l), no_stride(i,j,k,l));
VERIFY_IS_EQUAL(tensor(i, j, k, l), no_stride(i, j, k, l));
}
}
}
@@ -58,18 +57,16 @@ static void test_simple_striding()
for (int j = 0; j < 1; ++j) {
for (int k = 0; k < 3; ++k) {
for (int l = 0; l < 3; ++l) {
VERIFY_IS_EQUAL(tensor(2*i,4*j,2*k,3*l), stride(i,j,k,l));
VERIFY_IS_EQUAL(tensor(2 * i, 4 * j, 2 * k, 3 * l), stride(i, j, k, l));
}
}
}
}
}
template<int DataLayout>
static void test_striding_as_lvalue()
{
Tensor<float, 4, DataLayout> tensor(2,3,5,7);
template <int DataLayout>
static void test_striding_as_lvalue() {
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
tensor.setRandom();
array<ptrdiff_t, 4> strides;
strides[0] = 2;
@@ -84,7 +81,7 @@ static void test_striding_as_lvalue()
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 7; ++l) {
VERIFY_IS_EQUAL(tensor(i,j,k,l), result(2*i,4*j,2*k,3*l));
VERIFY_IS_EQUAL(tensor(i, j, k, l), result(2 * i, 4 * j, 2 * k, 3 * l));
}
}
}
@@ -102,16 +99,14 @@ static void test_striding_as_lvalue()
for (int j = 0; j < 3; ++j) {
for (int k = 0; k < 5; ++k) {
for (int l = 0; l < 7; ++l) {
VERIFY_IS_EQUAL(tensor(i,j,k,l), result2(2*i,4*j,2*k,3*l));
VERIFY_IS_EQUAL(tensor(i, j, k, l), result2(2 * i, 4 * j, 2 * k, 3 * l));
}
}
}
}
}
EIGEN_DECLARE_TEST(cxx11_tensor_striding)
{
EIGEN_DECLARE_TEST(cxx11_tensor_striding) {
CALL_SUBTEST(test_simple_striding<ColMajor>());
CALL_SUBTEST(test_simple_striding<RowMajor>());
CALL_SUBTEST(test_striding_as_lvalue<ColMajor>());