v0.14.0
test_Kroecker_Delta_01.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 
11 
14 
15  FTensor::Tensor2<int, 2, 2> t_one2{1, 0, 0, 1};
16  FTensor::Tensor2<int, 3, 3> t_one3{1, 0, 0, 0, 1, 0, 0, 0, 1};
17 
18  FTensor::Tensor2_symmetric<int, 2> t_one2_symmetric;
19  t_one2_symmetric(i, j) = t_one2(i, j) || t_one2(j, i);
20  FTensor::Tensor2_symmetric<int, 3> t_one3_symmetric;
21  t_one3_symmetric(k, l) = t_one3(k, l) || t_one3(l, k);
22 
23  t_one2(i, j) -= kronecker_delta(i, j);
24  for (auto ii : {0, 1})
25  for (auto jj : {0, 1})
26  test_for_zero(t_one2(ii, jj), "kronecker_delta 2 by 2");
27 
28  t_one3(k, l) -= kronecker_delta(k, l);
29  for (auto ii : {0, 1, 2})
30  for (auto jj : {0, 1, 2})
31  test_for_zero(t_one3(ii, jj), "kronecker_delta 3 by 3");
32 
33  t_one2_symmetric(i, j) -= kronecker_delta_symmetric(i, j);
34  t_one2_symmetric(i, j) -= kronecker_delta_symmetric(j, i);
35  for (auto ii : {0, 1})
36  for (auto jj : {0, 1})
37  test_for_zero(t_one2_symmetric(ii, jj),
38  "kronecker_delta_symmetric 2 by 2");
39 
40  t_one3_symmetric(k, l) -= kronecker_delta_symmetric(k, l);
41  t_one3_symmetric(k, l) -= kronecker_delta_symmetric(l, k);
42  for (auto ii : {0, 1, 2})
43  for (auto jj : {0, 1, 2})
44  test_for_zero(t_one3_symmetric(ii, jj),
45  "kronecker_delta_symmetric 3 by 3");
46 }
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
test_Kornecker_Delta_01
void test_Kornecker_Delta_01()
Definition: test_Kroecker_Delta_01.cpp:7
FTensor::Tensor2_symmetric
Definition: Tensor2_symmetric_value.hpp:13
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
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Index< 'i', 2 >
FTensor::kronecker_delta_symmetric
Tensor2_symmetric_Expr< Kronecker_Delta_symmetric< T >, T, Dim, i, j > kronecker_delta_symmetric(const Index< i, Dim > &, const Index< j, Dim > &)
Definition: Kronecker_Delta.hpp:97
FTensor::kronecker_delta
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
Definition: Kronecker_Delta.hpp:81
std
Definition: enable_if.hpp:5
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21