v0.14.0
Loading...
Searching...
No Matches
Dg_times_Dg.hpp
Go to the documentation of this file.
1/* This file has all of the declarations for expressions like
2 Dg*Dg yielding a Tensor2 or Ddg. */
3
4#pragma once
5
6namespace FTensor
7{
8 /* A(i,j,k)*B(j,k,l) */
9
10 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
11 char j, char k, char l>
13 {
16
17 template <int Current_Dim0, int Current_Dim1>
18 typename promote<T, U>::V
19 eval(const int N1, const int N2, const Number<Current_Dim0> &,
20 const Number<Current_Dim1> &) const
21 {
22 return iterA(N1, Current_Dim0 - 1, Current_Dim1 - 1)
23 * iterB(Current_Dim0 - 1, Current_Dim1 - 1, N2)
26 }
27 template <int Current_Dim1>
28 typename promote<T, U>::V
29 eval(const int N1, const int N2, const Number<1> &,
30 const Number<Current_Dim1> &) const
31 {
32 return iterA(N1, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1, N2)
34 }
35 typename promote<T, U>::V eval(const int N1, const int N2,
36 const Number<1> &, const Number<1> &) const
37 {
38 return iterA(N1, 0, 0) * iterB(0, 0, N2);
39 }
40
41 public:
44 : iterA(a), iterB(b)
45 {}
46 typename promote<T, U>::V operator()(const int N1, const int N2) const
47 {
48 return eval(N1, N2, Number<Dim01>(), Number<Dim01>());
49 }
50 };
51
52 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
53 char j, char k, char l>
54 Tensor2_Expr<Dg_times_Dg_12_01<A, B, T, U, Dim01, Dim2, i, j, k, l>,
55 typename promote<T, U>::V, Dim01, Dim2, i, l>
58 {
61 l>(TensorExpr(a, b));
62 }
63
64 /* B(j,k,l)*A(i,j,k) */
65
66 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
67 char j, char k, char l>
68 Tensor2_Expr<Dg_times_Dg_12_01<A, B, T, U, Dim01, Dim2, i, j, k, l>,
69 typename promote<T, U>::V, Dim01, Dim2, i, l>
72 {
75 l>(TensorExpr(a, b));
76 }
77
78 /* A(i,j,k)*B(k,l,j) */
79
80 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
81 char j, char k, char l>
83 {
86
87 template <int Current_Dim0, int Current_Dim1>
88 typename promote<T, U>::V
89 eval(const int N1, const int N2, const Number<Current_Dim0> &,
90 const Number<Current_Dim1> &) const
91 {
92 return iterA(N1, Current_Dim0 - 1, Current_Dim1 - 1)
93 * iterB(Current_Dim1 - 1, N2, Current_Dim0 - 1)
96 }
97 template <int Current_Dim1>
98 typename promote<T, U>::V
99 eval(const int N1, const int N2, const Number<1> &,
100 const Number<Current_Dim1> &) const
101 {
102 return iterA(N1, 0, Current_Dim1 - 1) * iterB(Current_Dim1 - 1, N2, 0)
104 }
105 typename promote<T, U>::V eval(const int N1, const int N2,
106 const Number<1> &, const Number<1> &) const
107 {
108 return iterA(N1, 0, 0) * iterB(0, N2, 0);
109 }
110
111 public:
114 : iterA(a), iterB(b)
115 {}
116 typename promote<T, U>::V operator()(const int N1, const int N2) const
117 {
118 return eval(N1, N2, Number<Dim01>(), Number<Dim2>());
119 }
120 };
121
122 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
123 char j, char k, char l>
124 Tensor2_Expr<Dg_times_Dg_12_20<A, B, T, U, Dim01, Dim2, i, j, k, l>,
125 typename promote<T, U>::V, Dim01, Dim2, i, l>
128 {
131 l>(TensorExpr(a, b));
132 }
133
134 /* B(k,l,j)*A(i,j,k) */
135
136 template <class A, class B, class T, class U, int Dim01, int Dim2, char i,
137 char j, char k, char l>
138 Tensor2_Expr<Dg_times_Dg_12_20<A, B, T, U, Dim01, Dim2, i, j, k, l>,
139 typename promote<T, U>::V, Dim01, Dim2, i, l>
142 {
145 l>(TensorExpr(a, b));
146 }
147
148 /* A(i,j,k)*B(i,j,k) */
149
150 template <class A, class B, class T, class U, int Dim01, int Dim2, int Dim3,
151 char i, char j, char k, char l>
155
156 template <int Current_Dim0, int Current_Dim1>
157 typename promote<T, U>::V eval(const int N1, const int N2,
158 const Number<Current_Dim0> &,
159 const Number<Current_Dim1> &) const {
160 return iterA(Current_Dim0 - 1, Current_Dim1 - 1, N1) *
161 iterB(Current_Dim0 - 1, Current_Dim1 - 1, N2) +
163 }
164 template <int Current_Dim1>
165 typename promote<T, U>::V eval(const int N1, const int N2,
166 const Number<1> &,
167 const Number<Current_Dim1> &) const {
168 return iterA(0, Current_Dim1 - 1, N1) * iterB(0, Current_Dim1 - 1, N2) +
170 }
171 typename promote<T, U>::V eval(const int N1, const int N2,
172 const Number<1> &, const Number<1> &) const {
173 return iterA(0, 0, N1) * iterB(0, 0, N2);
174 }
175
176 public:
179 : iterA(a), iterB(b) {}
180 typename promote<T, U>::V operator()(const int N1, const int N2) const {
181 return eval(N1, N2, Number<Dim01>(), Number<Dim01>());
182 }
183 };
184
185 template <class A, class B, class T, class U, int Dim01, int Dim2, int Dim3,
186 char i, char j, char k, char l>
189 using TensorExpr =
192 l>(TensorExpr(a, b));
193 }
194
195 /* A(i,j,k)*B(l,m,k) -> Ddg */
196
197 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
198 char i, char j, char k, char l, char m>
200 {
203
204 template <int Current_Dim0>
205 typename promote<T, U>::V
206 eval(const int N1, const int N2, const int N3, const int N4,
207 const Number<Current_Dim0> &) const
208 {
209 return iterA(N1, N2, Current_Dim0 - 1) * iterB(N3, N4, Current_Dim0 - 1)
210 + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
211 }
212 typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
213 const int N4, const Number<1> &) const
214 {
215 return iterA(N1, N2, 0) * iterB(N3, N4, 0);
216 }
217
218 public:
221 : iterA(a), iterB(b)
222 {}
223 typename promote<T, U>::V
224 operator()(const int N1, const int N2, const int N3, const int N4) const
225 {
226 return eval(N1, N2, N3, N4, Number<Dim2>());
227 }
228 };
229
230 template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
231 char i, char j, char k, char l, char m>
232 Ddg_Expr<Dg_times_Dg_2<A, B, T, U, Dim01, Dim23, Dim2, i, j, k, l, m>,
233 typename promote<T, U>::V, Dim01, Dim23, i, j, l, m>
236 {
237 using TensorExpr
240 l, m>(TensorExpr(a, b));
241 }
242}
static Number< 2 > N2
static Number< 1 > N1
constexpr double a
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
promote< T, U >::V operator()(const int N1, const int N2) const
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Dg_Expr< B, U, Dim01, Dim3, i, j, l > iterB
Dg_times_Dg_01_01(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Dg_Expr< B, U, Dim01, Dim3, i, j, l > &b)
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
Dg_Expr< B, U, Dim01, Dim2, j, k, l > iterB
Definition: Dg_times_Dg.hpp:15
Dg_Expr< A, T, Dim01, Dim01, i, j, k > iterA
Definition: Dg_times_Dg.hpp:14
promote< T, U >::V operator()(const int N1, const int N2) const
Definition: Dg_times_Dg.hpp:46
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Dg_times_Dg.hpp:29
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Definition: Dg_times_Dg.hpp:35
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Dg_times_Dg.hpp:19
Dg_times_Dg_12_01(const Dg_Expr< A, T, Dim01, Dim01, i, j, k > &a, const Dg_Expr< B, U, Dim01, Dim2, j, k, l > &b)
Definition: Dg_times_Dg.hpp:42
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Dg_Expr< B, U, Dim2, Dim01, k, l, j > iterB
Definition: Dg_times_Dg.hpp:85
promote< T, U >::V operator()(const int N1, const int N2) const
Dg_times_Dg_12_20(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Dg_Expr< B, U, Dim2, Dim01, k, l, j > &b)
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
Definition: Dg_times_Dg.hpp:84
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Dg_times_Dg.hpp:89
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Dg_times_Dg.hpp:99
Dg_Expr< B, U, Dim23, Dim2, l, m, k > iterB
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &) const
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
Dg_times_Dg_2(const Dg_Expr< A, T, Dim01, Dim2, i, j, k > &a, const Dg_Expr< B, U, Dim23, Dim2, l, m, k > &b)
Dg_Expr< A, T, Dim01, Dim2, i, j, k > iterA
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
FTensor::Index< 'm', SPACE_DIM > m
FTensor::Index< 'i', SPACE_DIM > i
FTensor::Index< 'l', 3 > l
FTensor::Index< 'j', 3 > j
FTensor::Index< 'k', 3 > k
const double T
Tensors class implemented by Walter Landry.
Definition: FTensor.hpp:51
promote< T, U >::V operator*(const Ddg_Expr< A, T, Dim, Dim, i, j, k, l > &a, const Ddg_Expr< B, U, Dim, Dim, i, k, j, l > &b)
constexpr AssemblyType A