v0.14.0
Loading...
Searching...
No Matches
test_Kroecker_Delta_01.cpp File Reference
#include "../../../src/FTensor.hpp"
#include "../test_for_zero.hpp"
#include <iostream>

Go to the source code of this file.

Functions

void test_Kornecker_Delta_01 ()
 

Function Documentation

◆ test_Kornecker_Delta_01()

void test_Kornecker_Delta_01 ( void )

Definition at line 7 of file test_Kroecker_Delta_01.cpp.

7 {
8
9 Index<'i', 2> i;
10 Index<'j', 2> j;
11
12 Index<'k', 3> k;
13 Index<'l', 3> l;
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
19 t_one2_symmetric(i, j) = t_one2(i, j) || t_one2(j, i);
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::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
Tensor2_symmetric_Expr< Kronecker_Delta_symmetric< T >, T, Dim, i, j > kronecker_delta_symmetric(const Index< i, Dim > &, const Index< j, Dim > &)
Tensor2_Expr< Kronecker_Delta< T >, T, Dim0, Dim1, i, j > kronecker_delta(const Index< i, Dim0 > &, const Index< j, Dim1 > &)
Rank 2.
void test_for_zero(const T &t, const std::string &s)