v0.14.0
Tensor3_contracted.hpp
Go to the documentation of this file.
1 /* A helper class that automatically returns the internal contraction
2  of a rank 3 tensor. */
3 
4 #pragma once
5 
6 namespace FTensor
7 {
8  /* Contracts second and third indices. */
9 
10  template <class A, class T, int Dim> class Tensor3_contracted_12
11  {
13 
14  template <int Current_Dim>
15  T eval(const int N, const Number<Current_Dim> &) const
16  {
17  return iterA(N, Current_Dim - 1, Current_Dim - 1)
19  }
20  T eval(const int N, const Number<1> &) const { return iterA(N, 0, 0); }
21 
22  public:
23  T operator()(const int N) const { return eval(N, Number<Dim>()); }
25  };
26 
27  /* Contracts first and third indices. */
28 
29  template <class A, class T, int Dim> class Tensor3_contracted_02
30  {
32 
33  template <int Current_Dim>
34  T eval(const int N, const Number<Current_Dim> &) const
35  {
36  return iterA(Current_Dim - 1, N, Current_Dim - 1)
38  }
39  T eval(const int N, const Number<1> &) const { return iterA(0, N, 0); }
40 
41  public:
42  T operator()(const int N) const { return eval(N, Number<Dim>()); }
44  };
45 
46  /* Contracts first and second indices. */
47 
48  template <class A, class T, int Dim> class Tensor3_contracted_01
49  {
51 
52  template <int Current_Dim>
53  T eval(const int N, const Number<Current_Dim> &) const
54  {
55  return iterA(Current_Dim - 1, Current_Dim - 1, N)
57  }
58  T eval(const int N, const Number<1> &) const { return iterA(0, 0, N); }
59 
60  public:
61  T operator()(const int N) const { return eval(N, Number<Dim>()); }
63  };
64 }
FTensor::Tensor3_contracted_12::operator()
T operator()(const int N) const
Definition: Tensor3_contracted.hpp:23
FTensor::Tensor3_contracted_12::eval
T eval(const int N, const Number< 1 > &) const
Definition: Tensor3_contracted.hpp:20
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor3_contracted_02::eval
T eval(const int N, const Number< Current_Dim > &) const
Definition: Tensor3_contracted.hpp:34
FTensor::Tensor3_contracted_12::eval
T eval(const int N, const Number< Current_Dim > &) const
Definition: Tensor3_contracted.hpp:15
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor3_contracted_12
Definition: Tensor3_contracted.hpp:10
FTensor::Tensor3_contracted_01::eval
T eval(const int N, const Number< Current_Dim > &) const
Definition: Tensor3_contracted.hpp:53
FTensor::Tensor3_contracted_01::operator()
T operator()(const int N) const
Definition: Tensor3_contracted.hpp:61
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor3_contracted_02::operator()
T operator()(const int N) const
Definition: Tensor3_contracted.hpp:42
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor3_contracted_02::iterA
A iterA
Definition: Tensor3_contracted.hpp:31
FTensor::Tensor3_contracted_01::iterA
A iterA
Definition: Tensor3_contracted.hpp:50
FTensor::Tensor3_contracted_01
Definition: Tensor3_contracted.hpp:48
N
const int N
Definition: speed_test.cpp:3
FTensor::Tensor3_contracted_02::Tensor3_contracted_02
Tensor3_contracted_02(const A &a)
Definition: Tensor3_contracted.hpp:43
FTensor::Tensor3_contracted_12::iterA
A iterA
Definition: Tensor3_contracted.hpp:12
FTensor::Tensor3_contracted_01::Tensor3_contracted_01
Tensor3_contracted_01(const A &a)
Definition: Tensor3_contracted.hpp:62
FTensor::Tensor3_contracted_02::eval
T eval(const int N, const Number< 1 > &) const
Definition: Tensor3_contracted.hpp:39
FTensor::Tensor3_contracted_02
Definition: Tensor3_contracted.hpp:29
FTensor::Tensor3_contracted_01::eval
T eval(const int N, const Number< 1 > &) const
Definition: Tensor3_contracted.hpp:58
FTensor::Tensor3_contracted_12::Tensor3_contracted_12
Tensor3_contracted_12(const A &a)
Definition: Tensor3_contracted.hpp:24