v0.14.0
Loading...
Searching...
No Matches
Tensor4_times_Tensor2_double.hpp
Go to the documentation of this file.
1#pragma once
2
3namespace FTensor
4{
5 // A(i,j,k,l) * B(m,n) double contraction
6 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
7 int Dim3, int Dim4, int Dim5, char i, char j, char k, char l,
8 char m, char n, int DimA, int DimB, int DimX, int DimY, char a,
9 char b, char x, char y>
11 {
14
15 public:
16 typename promote<T, U>::V operator()(const int N1, const int N2) const
17 {
18 typename promote<T, U>::V result(0);
19 for(int xx = 0; xx < DimX; ++xx)
20 for(int yy = 0; yy < DimY; ++yy)
21 {
22 // Permutation is where the indices get checked.
24 iterA, N1, N2, xx, yy)
26 }
27 return result;
28 }
29
33 : iterA(iter_a), iterB(iter_b)
34 {}
35 };
36
37 // A(i,j,k,l)*B(k,l)
38 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
39 int Dim3, char i, char j, char k, char l>
40 auto
43 {
44 using TensorExpr
45 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim2,
46 Dim3, i, j, k, l, k, l, Dim0, Dim1, Dim2,
47 Dim3, i, j, k, l>;
49 j>(TensorExpr(a, b));
50 }
51
52 // B(k,l)*A(i,j,k,l)
53 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
54 int Dim3, char i, char j, char k, char l>
55 auto
58 {
59 return a * b;
60 }
61
62 // A(i,j,k,l)*B(l,k)
63 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
64 int Dim3, char i, char j, char k, char l>
65 auto
68 {
69 using TensorExpr
70 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim3,
71 Dim2, i, j, k, l, l, k, Dim0, Dim1, Dim2,
72 Dim3, i, j, k, l>;
74 j>(TensorExpr(a, b));
75 }
76
77 // B(l,k)*A(i,j,k,l)
78 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
79 int Dim3, char i, char j, char k, char l>
80 auto
83 {
84 return a * b;
85 }
86
87 // A(i,j,k,l)*B(j,l)
88 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
89 int Dim3, char i, char j, char k, char l>
90 auto
93 {
94 using TensorExpr
95 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim1,
96 Dim3, i, j, k, l, j, l, Dim0, Dim2, Dim1,
97 Dim3, i, k, j, l>;
99 k>(TensorExpr(a, b));
100 }
101
102 // B(j,l)*A(i,j,k,l)
103 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
104 int Dim3, char i, char j, char k, char l>
105 auto
108 {
109 return a * b;
110 }
111
112 // A(i,j,k,l)*B(l,j)
113 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
114 int Dim3, char i, char j, char k, char l>
115 auto
118 {
119 using TensorExpr
120 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim3,
121 Dim1, i, j, k, l, l, j, Dim0, Dim2, Dim1,
122 Dim3, i, k, j, l>;
124 k>(TensorExpr(a, b));
125 }
126
127 // B(l,j)*A(i,j,k,l)
128 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
129 int Dim3, char i, char j, char k, char l>
130 auto
133 {
134 return a * b;
135 }
136
137 // A(i,j,k,l)*B(j,k)
138 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
139 int Dim3, char i, char j, char k, char l>
140 auto
143 {
144 using TensorExpr
145 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim1,
146 Dim2, i, j, k, l, j, k, Dim0, Dim3, Dim1,
147 Dim2, i, l, j, k>;
149 l>(TensorExpr(a, b));
150 }
151
152 // B(j,k)*A(i,j,k,l)
153 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
154 int Dim3, char i, char j, char k, char l>
155 auto
158 {
159 return a * b;
160 }
161
162 // A(i,j,k,l)*B(k,j)
163 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
164 int Dim3, char i, char j, char k, char l>
165 auto
168 {
169 using TensorExpr
170 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim2,
171 Dim1, i, j, k, l, k, j, Dim0, Dim3, Dim1,
172 Dim2, i, l, j, k>;
174 l>(TensorExpr(a, b));
175 }
176
177 // A(i,j,k,l)*B(k,j)
178 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
179 int Dim3, char i, char j, char k, char l>
180 auto
183 {
184 return a * b;
185 }
186
187 // A(i,j,k,l)*B(i,l)
188 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
189 int Dim3, char i, char j, char k, char l>
190 auto
193 {
194 using TensorExpr
195 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim0,
196 Dim3, i, j, k, l, i, l, Dim1, Dim2, Dim0,
197 Dim3, j, k, i, l>;
199 k>(TensorExpr(a, b));
200 }
201
202 // B(i,l)*A(i,j,k,l)
203 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
204 int Dim3, char i, char j, char k, char l>
205 auto
208 {
209 return a * b;
210 }
211
212 // A(i,j,k,l)*B(l,i)
213 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
214 int Dim3, char i, char j, char k, char l>
215 auto
218 {
219 using TensorExpr
220 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim3,
221 Dim0, i, j, k, l, l, i, Dim1, Dim2, Dim0,
222 Dim3, j, k, i, l>;
224 k>(TensorExpr(a, b));
225 }
226
227 // B(l,i)*A(i,j,k,l)
228 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
229 int Dim3, char i, char j, char k, char l>
230 auto
233 {
234 return a * b;
235 }
236
237 // A(i,j,k,l)*B(i,k)
238 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
239 int Dim3, char i, char j, char k, char l>
240 auto
243 {
244 using TensorExpr
245 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim0,
246 Dim2, i, j, k, l, i, k, Dim1, Dim3, Dim0,
247 Dim2, j, l, i, k>;
249 l>(TensorExpr(a, b));
250 }
251
252 // B(i,k)*A(i,j,k,l)
253 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
254 int Dim3, char i, char j, char k, char l>
255 auto
258 {
259 return a * b;
260 }
261
262 // A(i,j,k,l)*B(k,i)
263 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
264 int Dim3, char i, char j, char k, char l>
265 auto
268 {
269 using TensorExpr
270 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim2,
271 Dim0, i, j, k, l, k, i, Dim1, Dim3, Dim0,
272 Dim2, j, l, i, k>;
274 l>(TensorExpr(a, b));
275 }
276
277 // A(i,j,k,l)*B(k,i)
278 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
279 int Dim3, char i, char j, char k, char l>
280 auto
283 {
284 return a * b;
285 }
286
287 // A(i,j,k,l)*B(i,j)
288 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
289 int Dim3, char i, char j, char k, char l>
290 auto
293 {
294 using TensorExpr
295 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim0,
296 Dim1, i, j, k, l, i, j, Dim2, Dim3, Dim0,
297 Dim1, k, l, i, j>;
299 l>(TensorExpr(a, b));
300 }
301
302 // A(i,j,k,l)*B(i,j)
303 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
304 int Dim3, char i, char j, char k, char l>
305 auto
308 {
309 return a * b;
310 }
311
312 // A(i,j,k,l)*B(j,i)
313 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
314 int Dim3, char i, char j, char k, char l>
315 auto
318 {
319 using TensorExpr
320 = Tensor4_times_Tensor2_double<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim1,
321 Dim0, i, j, k, l, j, i, Dim2, Dim3, Dim0,
322 Dim1, k, l, i, j>;
324 l>(TensorExpr(a, b));
325 }
326
327 // A(i,j,k,l)*B(j,i)
328 template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
329 int Dim3, char i, char j, char k, char l>
330 auto
333 {
334 return a * b;
335 }
336}
static Number< 2 > N2
static Number< 1 > N1
constexpr double a
Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > iterA
Tensor2_Expr< B, U, Dim4, Dim5, m, n > iterB
Tensor4_times_Tensor2_double(const Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > &iter_a, const Tensor2_Expr< B, U, Dim4, Dim5, m, n > &iter_b)
promote< T, U >::V operator()(const int N1, const int N2) const
FTensor::Index< 'n', SPACE_DIM > n
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
U eval(const Tensor2_Expr< B, U, Dim0, Dim1, i, j > &rhs, const int N0, const int N1)
U eval(const Tensor4_Expr< B, U, Dim0, Dim1, Dim2, Dim3, i, j, k, l > &rhs, const int N0, const int N1, const int N2, const int N3)