v0.14.0
Functions
test_Kronecker_Delta.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 (void)
 
void test_Kornecker_Delta ()
 

Function Documentation

◆ test_Kornecker_Delta()

void test_Kornecker_Delta ( )

Definition at line 9 of file test_Kronecker_Delta.cpp.

◆ test_Kornecker_Delta_01()

void test_Kornecker_Delta_01 ( void  )

Definition at line 7 of file test_Kroecker_Delta_01.cpp.

7  {
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 }
test_Kornecker_Delta_01
void test_Kornecker_Delta_01(void)
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
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