v0.14.0
Tensor4_contracted.hpp
Go to the documentation of this file.
1 /* A helper class that automatically returns the internal contraction
2  of a rank 4 tensor. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  template <class A, class T, int Dim> class Tensor4_contracted_23
9  {
11 
12  public:
13  T operator()(const int N0, const int N1) const
14  {
15  T result(0);
16  for(int ii = 0; ii < Dim; ++ii)
17  {
18  result += iterA(N0, N1, ii, ii);
19  }
20  return result;
21  }
23  };
24 
25  template <class A, class T, int Dim> class Tensor4_contracted_13
26  {
28 
29  public:
30  T operator()(const int N0, const int N1) const
31  {
32  T result(0);
33  for(int ii = 0; ii < Dim; ++ii)
34  {
35  result += iterA(N0, ii, N1, ii);
36  }
37  return result;
38  }
40  };
41 
42  template <class A, class T, int Dim> class Tensor4_contracted_12
43  {
45 
46  public:
47  T operator()(const int N0, const int N1) const
48  {
49  T result(0);
50  for(int ii = 0; ii < Dim; ++ii)
51  {
52  result += iterA(N0, ii, ii, N1);
53  }
54  return result;
55  }
57  };
58 
59  template <class A, class T, int Dim> class Tensor4_contracted_03
60  {
62 
63  public:
64  T operator()(const int N0, const int N1) const
65  {
66  T result(0);
67  for(int ii = 0; ii < Dim; ++ii)
68  {
69  result += iterA(ii, N0, N1, ii);
70  }
71  return result;
72  }
74  };
75 
76  template <class A, class T, int Dim> class Tensor4_contracted_02
77  {
79 
80  public:
81  T operator()(const int N0, const int N1) const
82  {
83  T result(0);
84  for(int ii = 0; ii < Dim; ++ii)
85  {
86  result += iterA(ii, N0, ii, N1);
87  }
88  return result;
89  }
91  };
92 
93  template <class A, class T, int Dim> class Tensor4_contracted_01
94  {
96 
97  public:
98  T operator()(const int N0, const int N1) const
99  {
100  T result(0);
101  for(int ii = 0; ii < Dim; ++ii)
102  {
103  result += iterA(ii, ii, N0, N1);
104  }
105  return result;
106  }
108  };
109 }
FTensor::Tensor4_contracted_02::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:81
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor4_contracted_12::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:47
FTensor::Tensor4_contracted_12
Definition: Tensor4_contracted.hpp:42
FTensor::Tensor4_contracted_23::Tensor4_contracted_23
Tensor4_contracted_23(const A &a)
Definition: Tensor4_contracted.hpp:22
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor4_contracted_23
Definition: Tensor4_contracted.hpp:8
FTensor::Tensor4_contracted_13::iterA
A iterA
Definition: Tensor4_contracted.hpp:27
FTensor::Tensor4_contracted_23::iterA
A iterA
Definition: Tensor4_contracted.hpp:10
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor4_contracted_03
Definition: Tensor4_contracted.hpp:59
FTensor::Tensor4_contracted_01
Definition: Tensor4_contracted.hpp:93
FTensor::Tensor4_contracted_12::Tensor4_contracted_12
Tensor4_contracted_12(const A &a)
Definition: Tensor4_contracted.hpp:56
FTensor::Tensor4_contracted_12::iterA
A iterA
Definition: Tensor4_contracted.hpp:44
FTensor::Tensor4_contracted_13::Tensor4_contracted_13
Tensor4_contracted_13(const A &a)
Definition: Tensor4_contracted.hpp:39
FTensor::Tensor4_contracted_02::iterA
A iterA
Definition: Tensor4_contracted.hpp:78
FTensor::Tensor4_contracted_01::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:98
FTensor::Tensor4_contracted_03::Tensor4_contracted_03
Tensor4_contracted_03(const A &a)
Definition: Tensor4_contracted.hpp:73
FTensor::Tensor4_contracted_02
Definition: Tensor4_contracted.hpp:76
FTensor::Tensor4_contracted_03::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:64
FTensor::Tensor4_contracted_03::iterA
A iterA
Definition: Tensor4_contracted.hpp:61
FTensor::Tensor4_contracted_01::iterA
A iterA
Definition: Tensor4_contracted.hpp:95
FTensor::Tensor4_contracted_01::Tensor4_contracted_01
Tensor4_contracted_01(const A &a)
Definition: Tensor4_contracted.hpp:107
FTensor::Tensor4_contracted_13
Definition: Tensor4_contracted.hpp:25
FTensor::Tensor4_contracted_23::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:13
FTensor::Tensor4_contracted_13::operator()
T operator()(const int N0, const int N1) const
Definition: Tensor4_contracted.hpp:30
FTensor::Tensor4_contracted_02::Tensor4_contracted_02
Tensor4_contracted_02(const A &a)
Definition: Tensor4_contracted.hpp:90