v0.14.0
test_T4_05.cpp
Go to the documentation of this file.
1 #include "../../../src/FTensor.hpp"
2 #include "../test_for_zero.hpp"
3 #include <iostream>
4 using namespace FTensor;
5 using namespace std;
6 
8  const Tensor2<double, 4, 3> &t2_4,
9  const Tensor2<double, 3, 4> &t2_5)
10 {
17 
18  for(int ii = 0; ii < 1; ++ii)
19  {
20  for(int jj = 0; jj < 2; ++jj)
21  {
22  for(int kk = 0; kk < 3; ++kk)
23  for(int mm = 0; mm < 3; ++mm)
24  {
25  test_for_zero((t4(i, j, k, l) * t2_4(l, m))(ii, jj, kk, mm)
26  - (t4(ii, jj, kk, 0) * t2_4(0, mm)
27  + t4(ii, jj, kk, 1) * t2_4(1, mm)
28  + t4(ii, jj, kk, 2) * t2_4(2, mm)
29  + t4(ii, jj, kk, 3) * t2_4(3, mm)),
30  "T4(i,j,k,l)*T2(l,m)(" + std::to_string(ii) + ","
31  + std::to_string(jj) + "," + std::to_string(kk)
32  + "," + std::to_string(mm) + ")");
33 
34  test_for_zero((t2_4(l, m) * t4(i, j, k, l))(ii, jj, kk, mm)
35  - (t4(ii, jj, kk, 0) * t2_4(0, mm)
36  + t4(ii, jj, kk, 1) * t2_4(1, mm)
37  + t4(ii, jj, kk, 2) * t2_4(2, mm)
38  + t4(ii, jj, kk, 3) * t2_4(3, mm)),
39  "T2(l,m)*T4(i,j,k,l)(" + std::to_string(ii) + ","
40  + std::to_string(jj) + "," + std::to_string(kk)
41  + "," + std::to_string(mm) + ")");
42 
43  test_for_zero((t4(i, j, k, l) * t2_5(m, l))(ii, jj, kk, mm)
44  - (t4(ii, jj, kk, 0) * t2_5(mm, 0)
45  + t4(ii, jj, kk, 1) * t2_5(mm, 1)
46  + t4(ii, jj, kk, 2) * t2_5(mm, 2)
47  + t4(ii, jj, kk, 3) * t2_5(mm, 3)),
48  "T4(i,j,k,l)*T2(m,l)(" + std::to_string(ii) + ","
49  + std::to_string(jj) + "," + std::to_string(kk)
50  + "," + std::to_string(mm) + ")");
51 
52  test_for_zero((t2_5(m, l) * t4(i, j, k, l))(ii, jj, kk, mm)
53  - (t4(ii, jj, kk, 0) * t2_5(mm, 0)
54  + t4(ii, jj, kk, 1) * t2_5(mm, 1)
55  + t4(ii, jj, kk, 2) * t2_5(mm, 2)
56  + t4(ii, jj, kk, 3) * t2_5(mm, 3)),
57  "T2(m,l)*T4(i,j,k,l)(" + std::to_string(ii) + ","
58  + std::to_string(jj) + "," + std::to_string(kk)
59  + "," + std::to_string(mm) + ")");
60  }
61  for(int ll = 0; ll < 4; ++ll)
62  for(int nn = 0; nn < 3; ++nn)
63  {
64  test_for_zero((t4(i, j, k, l) * t2_5(k, n))(ii, jj, ll, nn)
65  - (t4(ii, jj, 0, ll) * t2_5(0, nn)
66  + t4(ii, jj, 1, ll) * t2_5(1, nn)
67  + t4(ii, jj, 2, ll) * t2_5(2, nn)),
68  "T4(i,j,k,l)*T2(k,n)(" + std::to_string(ii) + ","
69  + std::to_string(jj) + "," + std::to_string(ll)
70  + "," + std::to_string(nn) + ")");
71  test_for_zero((t2_5(k, n) * t4(i, j, k, l))(ii, jj, ll, nn)
72  - (t4(ii, jj, 0, ll) * t2_5(0, nn)
73  + t4(ii, jj, 1, ll) * t2_5(1, nn)
74  + t4(ii, jj, 2, ll) * t2_5(2, nn)),
75  "T2(k,n)*T4(i,j,k,l)(" + std::to_string(ii) + ","
76  + std::to_string(jj) + "," + std::to_string(ll)
77  + "," + std::to_string(nn) + ")");
78  test_for_zero((t4(i, j, k, l) * t2_4(n, k))(ii, jj, ll, nn)
79  - (t4(ii, jj, 0, ll) * t2_4(nn, 0)
80  + t4(ii, jj, 1, ll) * t2_4(nn, 1)
81  + t4(ii, jj, 2, ll) * t2_4(nn, 2)),
82  "T4(i,j,k,l)*T2(n,k)(" + std::to_string(ii) + ","
83  + std::to_string(jj) + "," + std::to_string(ll)
84  + "," + std::to_string(nn) + ")");
85  test_for_zero((t2_4(n, k) * t4(i, j, k, l))(ii, jj, ll, nn)
86  - (t4(ii, jj, 0, ll) * t2_4(nn, 0)
87  + t4(ii, jj, 1, ll) * t2_4(nn, 1)
88  + t4(ii, jj, 2, ll) * t2_4(nn, 2)),
89  "T2(n,k)*T4(i,j,k,l)(" + std::to_string(ii) + ","
90  + std::to_string(jj) + "," + std::to_string(ll)
91  + "," + std::to_string(nn) + ")");
92  }
93  }
94  for(int kk = 0; kk < 3; ++kk)
95  for(int ll = 0; ll < 4; ++ll)
96  for(int mm = 0; mm < 3; ++mm)
97  {
98  test_for_zero((t4(i, j, k, l) * t2_4(j, m))(ii, kk, ll, mm)
99  - (t4(ii, 0, kk, ll) * t2_4(0, mm)
100  + t4(ii, 1, kk, ll) * t2_4(1, mm)),
101  "T4(i,j,k,l)*T2(j,m)(" + std::to_string(ii) + ","
102  + std::to_string(kk) + "," + std::to_string(ll)
103  + "," + std::to_string(mm) + ")");
104  test_for_zero((t2_4(j, m) * t4(i, j, k, l))(ii, kk, ll, mm)
105  - (t4(ii, 0, kk, ll) * t2_4(0, mm)
106  + t4(ii, 1, kk, ll) * t2_4(1, mm)),
107  "T2(j,m)*T4(i,j,k,l)(" + std::to_string(ii) + ","
108  + std::to_string(kk) + "," + std::to_string(ll)
109  + "," + std::to_string(mm) + ")");
110  test_for_zero((t4(i, j, k, l) * t2_4(m, j))(ii, kk, ll, mm)
111  - (t4(ii, 0, kk, ll) * t2_4(mm, 0)
112  + t4(ii, 1, kk, ll) * t2_4(mm, 1)),
113  "T4(i,j,k,l)*T2(m,j)(" + std::to_string(ii) + ","
114  + std::to_string(kk) + "," + std::to_string(ll)
115  + "," + std::to_string(mm) + ")");
116  test_for_zero((t2_4(m, j) * t4(i, j, k, l))(ii, kk, ll, mm)
117  - (t4(ii, 0, kk, ll) * t2_4(mm, 0)
118  + t4(ii, 1, kk, ll) * t2_4(mm, 1)),
119  "T2(m,j)*T4(i,j,k,l)(" + std::to_string(ii) + ","
120  + std::to_string(kk) + "," + std::to_string(ll)
121  + "," + std::to_string(mm) + ")");
122  }
123  }
124  for(int jj = 0; jj < 2; ++jj)
125  for(int kk = 0; kk < 3; ++kk)
126  for(int ll = 0; ll < 4; ++ll)
127  for(int mm = 0; mm < 3; ++mm)
128  {
129  test_for_zero((t4(i, j, k, l) * t2_4(i, m))(jj, kk, ll, mm)
130  - t4(0, jj, kk, ll) * t2_4(0, mm),
131  "T4(i,j,k,l)*T2(i,m)(" + std::to_string(jj) + ","
132  + std::to_string(kk) + "," + std::to_string(ll)
133  + "," + std::to_string(mm) + ")");
134  test_for_zero((t2_4(i, m) * t4(i, j, k, l))(jj, kk, ll, mm)
135  - t4(0, jj, kk, ll) * t2_4(0, mm),
136  "T2(i,m)*T4(i,j,k,l)(" + std::to_string(jj) + ","
137  + std::to_string(kk) + "," + std::to_string(ll)
138  + "," + std::to_string(mm) + ")");
139  test_for_zero((t4(i, j, k, l) * t2_4(m, i))(jj, kk, ll, mm)
140  - t4(0, jj, kk, ll) * t2_4(mm, 0),
141  "T4(i,j,k,l)*T2(m,i)(" + std::to_string(jj) + ","
142  + std::to_string(kk) + "," + std::to_string(ll)
143  + "," + std::to_string(mm) + ")");
144  test_for_zero((t2_4(m, i) * t4(i, j, k, l))(jj, kk, ll, mm)
145  - t4(0, jj, kk, ll) * t2_4(mm, 0),
146  "T2(m,i)*T4(i,j,k,l)(" + std::to_string(jj) + ","
147  + std::to_string(kk) + "," + std::to_string(ll)
148  + "," + std::to_string(mm) + ")");
149  }
150 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
test_T4_05
void test_T4_05(const Tensor4< double, 1, 2, 3, 4 > &t4, const Tensor2< double, 4, 3 > &t2_4, const Tensor2< double, 3, 4 > &t2_5)
Definition: test_T4_05.cpp:7
FTensor::Tensor2
Definition: Tensor2_value.hpp:16
test_for_zero
void test_for_zero(const T &t, const std::string &s)
Definition: test_for_zero.hpp:7
FTensor::Tensor4
Definition: Tensor4_value.hpp:18
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index
Definition: Index.hpp:23
convert.n
n
Definition: convert.py:82
std
Definition: enable_if.hpp:5
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21