v0.14.0
Loading...
Searching...
No Matches
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
6namespace 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}
constexpr double a
T eval(const int N, const Number< Current_Dim > &) const
T eval(const int N, const Number< 1 > &) const
T eval(const int N, const Number< 1 > &) const
T eval(const int N, const Number< Current_Dim > &) const
T eval(const int N, const Number< Current_Dim > &) const
T eval(const int N, const Number< 1 > &) const
const double T
Tensors class implemented by Walter Landry.
Definition: FTensor.hpp:51
constexpr AssemblyType A
const int N
Definition: speed_test.cpp:3