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
@@ -16,10 +16,8 @@
|
||||
|
||||
using Eigen::Tensor;
|
||||
|
||||
|
||||
template <int DataLayout>
|
||||
static void test_map_as_index()
|
||||
{
|
||||
static void test_map_as_index() {
|
||||
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
@@ -30,56 +28,49 @@ static void test_map_as_index()
|
||||
coeffC[1] = 2;
|
||||
coeffC[2] = 4;
|
||||
coeffC[3] = 1;
|
||||
NormalIndex coeff(1,2,4,1);
|
||||
NormalIndex coeff(1, 2, 4, 1);
|
||||
|
||||
VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff));
|
||||
}
|
||||
|
||||
|
||||
template <int DataLayout>
|
||||
static void test_matrix_as_index()
|
||||
{
|
||||
static void test_matrix_as_index() {
|
||||
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
using NormalIndex = DSizes<ptrdiff_t, 4>;
|
||||
using CustomIndex = Matrix<unsigned int, 4, 1>;
|
||||
CustomIndex coeffC(1,2,4,1);
|
||||
NormalIndex coeff(1,2,4,1);
|
||||
CustomIndex coeffC(1, 2, 4, 1);
|
||||
NormalIndex coeff(1, 2, 4, 1);
|
||||
|
||||
VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff));
|
||||
}
|
||||
|
||||
|
||||
template <int DataLayout>
|
||||
static void test_varlist_as_index()
|
||||
{
|
||||
static void test_varlist_as_index() {
|
||||
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
DSizes<ptrdiff_t, 4> coeff(1,2,4,1);
|
||||
DSizes<ptrdiff_t, 4> coeff(1, 2, 4, 1);
|
||||
|
||||
VERIFY_IS_EQUAL(tensor.coeff({1,2,4,1}), tensor.coeff(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeffRef({1,2,4,1}), tensor.coeffRef(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeff({1, 2, 4, 1}), tensor.coeff(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeffRef({1, 2, 4, 1}), tensor.coeffRef(coeff));
|
||||
}
|
||||
|
||||
|
||||
template <int DataLayout>
|
||||
static void test_sizes_as_index()
|
||||
{
|
||||
static void test_sizes_as_index() {
|
||||
Tensor<float, 4, DataLayout> tensor(2, 3, 5, 7);
|
||||
tensor.setRandom();
|
||||
|
||||
DSizes<ptrdiff_t, 4> coeff(1,2,4,1);
|
||||
Sizes<1,2,4,1> coeffC;
|
||||
DSizes<ptrdiff_t, 4> coeff(1, 2, 4, 1);
|
||||
Sizes<1, 2, 4, 1> coeffC;
|
||||
|
||||
VERIFY_IS_EQUAL(tensor.coeff(coeffC), tensor.coeff(coeff));
|
||||
VERIFY_IS_EQUAL(tensor.coeffRef(coeffC), tensor.coeffRef(coeff));
|
||||
}
|
||||
|
||||
|
||||
EIGEN_DECLARE_TEST(cxx11_tensor_custom_index) {
|
||||
test_map_as_index<ColMajor>();
|
||||
test_map_as_index<RowMajor>();
|
||||
|
||||
Reference in New Issue
Block a user