v0.8.23
Ddg_times_Tensor2.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Ddg*Tensor2 and Tensor2*Ddg, yielding a
3  Tensor2_symmetric. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j,k,l)*B(k,l) */
10 
11  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
12  char j, char k, char l>
14  {
17 
18  template <int Current_Dim0, int Current_Dim1>
19  typename promote<T, U>::V
20  eval(const int N1, const int N2, const Number<Current_Dim0> &,
21  const Number<Current_Dim1> &) const
22  {
23  return iterA(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1)
24  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
25  + eval(N1, N2, Number<Current_Dim0 - 1>(),
27  }
28  template <int Current_Dim1>
29  typename promote<T, U>::V
30  eval(const int N1, const int N2, const Number<1> &,
31  const Number<Current_Dim1> &) const
32  {
33  return iterA(N1, N2, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1)
35  }
36  typename promote<T, U>::V eval(const int N1, const int N2,
37  const Number<1> &, const Number<1> &) const
38  {
39  return iterA(N1, N2, 0, 0) * iterB(0, 0);
40  }
41 
42  public:
45  : iterA(a), iterB(b)
46  {}
47  typename promote<T, U>::V operator()(const int N1, const int N2) const
48  {
49  return eval(N1, N2, Number<Dim23>(), Number<Dim23>());
50  }
51  };
52 
53  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
54  char j, char k, char l>
55  Tensor2_symmetric_Expr<
56  Ddg_times_Tensor2_23<A, B, T, U, Dim01, Dim23, i, j, k, l>,
57  typename promote<T, U>::V, Dim01, i, j>
60  {
61  using TensorExpr
64  i, j>(TensorExpr(a, b));
65  }
66 
67  /* B(k,l)*A(i,j,k,l) */
68 
69  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
70  char j, char k, char l>
71  Tensor2_symmetric_Expr<
72  Ddg_times_Tensor2_23<A, B, T, U, Dim01, Dim23, i, j, k, l>,
73  typename promote<T, U>::V, Dim01, i, j>
76  {
77  using TensorExpr
80  i, j>(TensorExpr(a, b));
81  }
82 
83  /* A(i,j,k,l)*B(l,k) */
84 
85  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
86  char j, char k, char l>
88  {
91 
92  template <int Current_Dim0, int Current_Dim1>
93  typename promote<T, U>::V
94  eval(const int N1, const int N2, const Number<Current_Dim0> &,
95  const Number<Current_Dim1> &) const
96  {
97  return iterA(N1, N2, Current_Dim0 - 1, Current_Dim1 - 1)
98  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
99  + eval(N1, N2, Number<Current_Dim0 - 1>(),
101  }
102  template <int Current_Dim1>
103  typename promote<T, U>::V
104  eval(const int N1, const int N2, const Number<1> &,
105  const Number<Current_Dim1> &) const
106  {
107  return iterA(N1, N2, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1)
109  }
110  typename promote<T, U>::V eval(const int N1, const int N2,
111  const Number<1> &, const Number<1> &) const
112  {
113  return iterA(N1, N2, 0, 0) * iterB(0, 0);
114  }
115 
116  public:
119  : iterA(a), iterB(b)
120  {}
121  typename promote<T, U>::V operator()(const int N1, const int N2) const
122  {
123  return eval(N1, N2, Number<Dim23>(), Number<Dim23>());
124  }
125  };
126 
127  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
128  char j, char k, char l>
129  Tensor2_symmetric_Expr<
130  Ddg_times_Tensor2_32<A, B, T, U, Dim01, Dim23, i, j, k, l>,
131  typename promote<T, U>::V, Dim01, i, j>
134  {
135  using TensorExpr
138  i, j>(TensorExpr(a, b));
139  }
140 
141  /* B(l,k)*A(i,j,k,l) */
142 
143  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
144  char j, char k, char l>
145  Tensor2_symmetric_Expr<
146  Ddg_times_Tensor2_32<A, B, T, U, Dim01, Dim23, i, j, k, l>,
147  typename promote<T, U>::V, Dim01, i, j>
150  {
151  using TensorExpr
154  i, j>(TensorExpr(a, b));
155  }
156 
157  /* This operatores will yield tensor 2 */
158 
159  /* A(i,j,k,l)*B(j,l) */
160 
161  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
162  char j, char k, char l>
164  {
167 
168  template <int Current_Dim0, int Current_Dim1>
169  typename promote<T, U>::V
170  eval(const int N1, const int N2, const Number<Current_Dim0> &,
171  const Number<Current_Dim1> &) const
172  {
173  return iterA(N1, Current_Dim0 - 1, N2, Current_Dim1 - 1) *
174  iterB(Current_Dim0 - 1, Current_Dim1 - 1) +
176  }
177  template <int Current_Dim1>
178  typename promote<T, U>::V
179  eval(const int N1, const int N2, const Number<1> &,
180  const Number<Current_Dim1> &) const
181  {
182  return iterA(N1, 0, N2, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1) +
184  }
185  typename promote<T, U>::V eval(const int N1, const int N2,
186  const Number<1> &, const Number<1> &) const
187  {
188  return iterA(N1, 0, N2, 0) * iterB(0, 0);
189  }
190 
191  public:
194  : iterA(a), iterB(b)
195  {}
196  typename promote<T, U>::V operator()(const int N1, const int N2) const
197  {
198  return eval(N1, N2, Number<Dim01>(), Number<Dim23>());
199  }
200  };
201 
202  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
203  char j, char k, char l>
204  Tensor2_Expr<
205  Ddg_times_Tensor2_13<A, B, T, U, Dim01, Dim23, i, j, k, l>,
206  typename promote<T, U>::V, Dim01, Dim23, i, k>
209  {
210  using TensorExpr
213  k>(TensorExpr(a, b));
214  }
215 
216  /* B(j,l)*A(i,j,k,l) */
217 
218  template <class A, class B, class T, class U, int Dim01, int Dim23, char i,
219  char j, char k, char l>
220  Tensor2_Expr<Ddg_times_Tensor2_13<A, B, T, U, Dim01, Dim23, i, j, k, l>,
221  typename promote<T, U>::V, Dim01, Dim23, i, k>
224  using TensorExpr
227  k>(TensorExpr(a, b));
228  }
229 
230  /* This file has all of the declarations for expressions like
231  Ddg*Tensor2 and Tensor2*Ddg, yielding a
232  Tensor4. */
233 
234  // FIXME: That should create T4 with first two indices symmetric two other
235  // not. At this point will not create ideal code.
236  // TODO: Not all possible permutations are included.
237  // TODO: Check dimensions could be errors
238 
239  /* A(i,j,k,l)*B(l,m) */
240 
241  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
242  char i, char j, char k, char l, char m>
244  {
247 
248  template <int Current_Dim0>
249  typename promote<T, U>::V
250  eval(const int N1, const int N2, const int N3, const int N4,
251  const Number<Current_Dim0> &) const
252  {
253  return iterA(N1, N2, N3, Current_Dim0 - 1) * iterB(Current_Dim0 - 1, N4)
254  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
255  }
256  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
257  const int N4, const Number<1> &) const
258  {
259  return iterA(N1, N2, N3, 0) * iterB(0, N4);
260  }
261 
262  public:
265  : iterA(a), iterB(b)
266  {}
267  typename promote<T, U>::V
268  operator()(const int N1, const int N2, const int N3, const int N4) const
269  {
270  return eval(N1, N2, N3, N4, Number<Dim23>());
271  }
272  };
273 
274  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
275  char i, char j, char k, char l, char m>
276  inline const Tensor4_Expr<
277  const Ddg_times_Tensor2_3_1<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
278  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, k, m>
281  {
282  typedef const Ddg_times_Tensor2_3_1<A, B, T, U, Dim01, Dim23, Dim4, i, j,
283  k, l, m>
284  TensorExpr;
286  Dim23, Dim4, i, j, k, m>(TensorExpr(a, b));
287  }
288 
289  /* B(l,m)*A(i,j,k,l) */
290 
291  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
292  char i, char j, char k, char l, char m>
293  inline const Tensor4_Expr<
294  const Ddg_times_Tensor2_3_1<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
295  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, k, m>
298  {
299  typedef const Ddg_times_Tensor2_3_1<A, B, T, U, Dim01, Dim23, Dim4, i, j,
300  k, l, m>
301  TensorExpr;
303  Dim23, Dim4, i, j, k, m>(TensorExpr(a, b));
304  }
305 
306  /* A(i,j,k,l)*B(m,l) */
307 
308  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
309  char i, char j, char k, char l, char m>
311  {
314 
315  template <int Current_Dim0>
316  typename promote<T, U>::V
317  eval(const int N1, const int N2, const int N3, const int N4,
318  const Number<Current_Dim0> &) const
319  {
320  return iterA(N1, N2, N3, Current_Dim0 - 1) * iterB(N4, Current_Dim0 - 1)
321  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
322  }
323  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
324  const int N4, const Number<1> &) const
325  {
326  return iterA(N1, N2, N3, 0) * iterB(N4, 0);
327  }
328 
329  public:
332  : iterA(a), iterB(b)
333  {}
334  typename promote<T, U>::V
335  operator()(const int N1, const int N2, const int N3, const int N4) const
336  {
337  return eval(N1, N2, N3, N4, Number<Dim23>());
338  }
339  };
340 
341  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
342  char i, char j, char k, char l, char m>
343  inline const Tensor4_Expr<
344  const Ddg_times_Tensor2_3_0<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
345  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, k, m>
348  {
349  typedef const Ddg_times_Tensor2_3_0<A, B, T, U, Dim01, Dim23, Dim4, i, j,
350  k, l, m>
351  TensorExpr;
353  Dim23, Dim4, i, j, k, m>(TensorExpr(a, b));
354  }
355 
356  /* B(m,l)*A(i,j,k,l) */
357 
358  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
359  char i, char j, char k, char l, char m>
360  inline const Tensor4_Expr<
361  const Ddg_times_Tensor2_3_0<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
362  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, k, m>
365  {
366  typedef const Ddg_times_Tensor2_3_0<A, B, T, U, Dim01, Dim23, Dim4, i, j,
367  k, l, m>
368  TensorExpr;
370  Dim23, Dim4, i, j, k, m>(TensorExpr(a, b));
371  }
372 
373  /* A(i,j,k,l)*B(m,k) */
374 
375  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
376  char i, char j, char k, char l, char m>
378  {
381 
382  template <int Current_Dim0>
383  typename promote<T, U>::V
384  eval(const int N1, const int N2, const int N3, const int N4,
385  const Number<Current_Dim0> &) const
386  {
387  return iterA(N1, N2, Current_Dim0 - 1, N4) * iterB(N3, Current_Dim0 - 1)
388  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
389  }
390  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
391  const int N4, const Number<1> &) const
392  {
393  return iterA(N1, N2, 0, N4) * iterB(N3, 0);
394  }
395 
396  public:
399  : iterA(a), iterB(b)
400  {}
401  typename promote<T, U>::V
402  operator()(const int N1, const int N2, const int N3, const int N4) const
403  {
404  return eval(N1, N2, N3, N4, Number<Dim23>());
405  }
406  };
407 
408  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
409  char i, char j, char k, char l, char m>
410  inline const Tensor4_Expr<
411  const Ddg_times_Tensor2_2_0<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
412  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, m, l>
415  {
416  typedef const Ddg_times_Tensor2_2_0<A, B, T, U, Dim01, Dim23, Dim4, i, j,
417  k, l, m>
418  TensorExpr;
420  Dim23, Dim4, i, j, m, l>(TensorExpr(a, b));
421  }
422 
423  /* B(m,k)*A(i,j,k,l) */
424 
425  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
426  char i, char j, char k, char l, char m>
427  inline const Tensor4_Expr<
428  const Ddg_times_Tensor2_2_0<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
429  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, m, l>
432  {
433  typedef const Ddg_times_Tensor2_2_0<A, B, T, U, Dim01, Dim23, Dim4, i, j,
434  k, l, m>
435  TensorExpr;
437  Dim23, Dim4, i, j, m, l>(TensorExpr(a, b));
438  }
439 
440  /* A(i,j,k,l)*B(k,m) */
441 
442  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
443  char i, char j, char k, char l, char m>
445  {
448 
449  template <int Current_Dim0>
450  typename promote<T, U>::V
451  eval(const int N1, const int N2, const int N3, const int N4,
452  const Number<Current_Dim0> &) const
453  {
454  return iterA(N1, N2, Current_Dim0 - 1, N4) * iterB(Current_Dim0 - 1, N3)
455  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
456  }
457  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
458  const int N4, const Number<1> &) const
459  {
460  return iterA(N1, N2, 0, N4) * iterB(0, N3);
461  }
462 
463  public:
466  : iterA(a), iterB(b)
467  {}
468  typename promote<T, U>::V
469  operator()(const int N1, const int N2, const int N3, const int N4) const
470  {
471  return eval(N1, N2, N3, N4, Number<Dim23>());
472  }
473  };
474 
475  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
476  char i, char j, char k, char l, char m>
477  inline const Tensor4_Expr<
478  const Ddg_times_Tensor2_2_1<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
479  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, m, l>
482  {
483  typedef const Ddg_times_Tensor2_2_1<A, B, T, U, Dim01, Dim23, Dim4, i, j,
484  k, l, m>
485  TensorExpr;
487  Dim23, Dim4, i, j, m, l>(TensorExpr(a, b));
488  }
489 
490  /* B(k,m)*A(i,j,k,l) */
491 
492  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim4,
493  char i, char j, char k, char l, char m>
494  inline const Tensor4_Expr<
495  const Ddg_times_Tensor2_2_1<A, B, T, U, Dim01, Dim23, Dim4, i, j, k, l, m>,
496  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim4, i, j, m, l>
499  {
500  typedef const Ddg_times_Tensor2_2_1<A, B, T, U, Dim01, Dim23, Dim4, i, j,
501  k, l, m>
502  TensorExpr;
504  Dim23, Dim4, i, j, m, l>(TensorExpr(a, b));
505  }
506 
507  /* A(i,j,k,l)*B(j,m) */
508 
509  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
510  char i, char j, char k, char l, char m>
512  {
515 
516  template <int Current_Dim0>
517  typename promote<T, U>::V
518  eval(const int N1, const int N2, const int N3, const int N4,
519  const Number<Current_Dim0> &) const
520  {
521  return iterA(N1, Current_Dim0 - 1, N3, N4) * iterB(Current_Dim0 - 1, N2)
522  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
523  }
524  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
525  const int N4, const Number<1> &) const
526  {
527  return iterA(N1, 0, N3, N4) * iterB(0, N2);
528  }
529 
530  public:
533  : iterA(a), iterB(b)
534  {}
535  typename promote<T, U>::V
536  operator()(const int N1, const int N2, const int N3, const int N4) const
537  {
538  return eval(N1, N2, N3, N4, Number<Dim01>());
539  }
540  };
541 
542  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
543  char i, char j, char k, char l, char m>
544  inline const Tensor4_Expr<
545  const Ddg_times_Tensor2_1_0<A, B, T, U, Dim01, Dim23, Dim2, i, j, k, l, m>,
546  typename promote<T, U>::V, Dim01, Dim2, Dim23, Dim23, i, m, k, l>
549  {
550  typedef const Ddg_times_Tensor2_1_0<A, B, T, U, Dim01, Dim23, Dim2, i, j,
551  k, l, m>
552  TensorExpr;
554  Dim23, Dim2, i, m, k, l>(TensorExpr(a, b));
555  }
556 
557  /* B(j,m)*A(i,j,k,l) */
558 
559  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
560  char i, char j, char k, char l, char m>
561  inline const Tensor4_Expr<
562  const Ddg_times_Tensor2_1_0<A, B, T, U, Dim01, Dim23, Dim2, i, j, k, l, m>,
563  typename promote<T, U>::V, Dim01, Dim2, Dim23, Dim23, i, m, k, l>
566  {
567  typedef const Ddg_times_Tensor2_1_0<A, B, T, U, Dim01, Dim23, Dim2, i, j,
568  k, l, m>
569  TensorExpr;
571  Dim23, Dim2, i, m, k, l>(TensorExpr(a, b));
572  }
573 
574  /* A(i,j,k,l)*B(m,j) */
575 
576  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
577  char i, char j, char k, char l, char m>
579  {
582 
583  template <int Current_Dim0>
584  typename promote<T, U>::V
585  eval(const int N1, const int N2, const int N3, const int N4,
586  const Number<Current_Dim0> &) const
587  {
588  return iterA(N1, Current_Dim0 - 1, N3, N4) * iterB(N2, Current_Dim0 - 1)
589  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
590  }
591  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
592  const int N4, const Number<1> &) const
593  {
594  return iterA(N1, 0, N3, N4) * iterB(N2, 0);
595  }
596 
597  public:
600  : iterA(a), iterB(b)
601  {}
602  typename promote<T, U>::V
603  operator()(const int N1, const int N2, const int N3, const int N4) const
604  {
605  return eval(N1, N2, N3, N4, Number<Dim01>());
606  }
607  };
608 
609  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
610  char i, char j, char k, char l, char m>
611  inline const Tensor4_Expr<
612  const Ddg_times_Tensor2_1_1<A, B, T, U, Dim01, Dim23, Dim2, i, j, k, l, m>,
613  typename promote<T, U>::V, Dim01, Dim2, Dim23, Dim23, i, m, k, l>
616  {
617  typedef const Ddg_times_Tensor2_1_1<A, B, T, U, Dim01, Dim23, Dim2, i, j,
618  k, l, m>
619  TensorExpr;
621  Dim23, Dim23, i, m, k, l>(TensorExpr(a, b));
622  }
623 
624  /* B(m,j)*A(i,j,k,l) */
625 
626  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim2,
627  char i, char j, char k, char l, char m>
628  inline const Tensor4_Expr<
629  const Ddg_times_Tensor2_1_1<A, B, T, U, Dim01, Dim23, Dim2, i, j, k, l, m>,
630  typename promote<T, U>::V, Dim01, Dim2, Dim23, Dim23, i, m, k, l>
633  {
634  typedef const Ddg_times_Tensor2_1_1<A, B, T, U, Dim01, Dim23, Dim2, i, j,
635  k, l, m>
636  TensorExpr;
638  Dim23, Dim2, i, m, k, l>(TensorExpr(a, b));
639  }
640 
641  /* A(i,j,k,l)*B(i,m) */
642 
643  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
644  char i, char j, char k, char l, char m>
646  {
649 
650  template <int Current_Dim0>
651  typename promote<T, U>::V
652  eval(const int N1, const int N2, const int N3, const int N4,
653  const Number<Current_Dim0> &) const
654  {
655  return iterA(Current_Dim0 - 1, N2, N3, N4) * iterB(Current_Dim0 - 1, N1)
656  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
657  }
658  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
659  const int N4, const Number<1> &) const
660  {
661  return iterA(0, N2, N3, N4) * iterB(0, N1);
662  }
663 
664  public:
667  : iterA(a), iterB(b)
668  {}
669  typename promote<T, U>::V
670  operator()(const int N1, const int N2, const int N3, const int N4) const
671  {
672  return eval(N1, N2, N3, N4, Number<Dim01>());
673  }
674  };
675 
676  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
677  char i, char j, char k, char l, char m>
678  inline const Tensor4_Expr<
679  const Ddg_times_Tensor2_0_0<A, B, T, U, Dim01, Dim23, Dim1, i, j, k, l, m>,
680  typename promote<T, U>::V, Dim1, Dim01, Dim23, Dim23, m, j, k, l>
683  {
684  typedef const Ddg_times_Tensor2_0_0<A, B, T, U, Dim01, Dim23, Dim1, i, j,
685  k, l, m>
686  TensorExpr;
688  Dim23, Dim23, m, j, k, l>(TensorExpr(a, b));
689  }
690 
691  /* B(i,m)*A(i,j,k,l) */
692 
693  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
694  char i, char j, char k, char l, char m>
695  inline const Tensor4_Expr<
696  const Ddg_times_Tensor2_0_0<A, B, T, U, Dim01, Dim23, Dim1, i, j, k, l, m>,
697  typename promote<T, U>::V, Dim01, Dim01, Dim23, Dim1, m, j, k, l>
700  {
701  typedef const Ddg_times_Tensor2_0_0<A, B, T, U, Dim01, Dim23, Dim1, i, j,
702  k, l, m>
703  TensorExpr;
705  Dim23, Dim23, m, j, k, l>(TensorExpr(a, b));
706  }
707 
708  /* A(i,j,k,l)*B(m,i) */
709 
710  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
711  char i, char j, char k, char l, char m>
713  {
716 
717  template <int Current_Dim0>
718  typename promote<T, U>::V
719  eval(const int N1, const int N2, const int N3, const int N4,
720  const Number<Current_Dim0> &) const
721  {
722  return iterA(Current_Dim0 - 1, N2, N3, N4) * iterB(N1, Current_Dim0 - 1)
723  + eval(N1, N2, N3, N4, Number<Current_Dim0 - 1>());
724  }
725  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
726  const int N4, const Number<1> &) const
727  {
728  return iterA(0, N2, N3, N4) * iterB(N1, 0);
729  }
730 
731  public:
734  : iterA(a), iterB(b)
735  {}
736  typename promote<T, U>::V
737  operator()(const int N1, const int N2, const int N3, const int N4) const
738  {
739  return eval(N1, N2, N3, N4, Number<Dim01>());
740  }
741  };
742 
743  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
744  char i, char j, char k, char l, char m>
745  inline const Tensor4_Expr<
746  const Ddg_times_Tensor2_0_1<A, B, T, U, Dim01, Dim23, Dim1, i, j, k, l, m>,
747  typename promote<T, U>::V, Dim1, Dim01, Dim23, Dim23, m, j, k, l>
750  {
751  typedef const Ddg_times_Tensor2_0_1<A, B, T, U, Dim01, Dim23, Dim1, i, j,
752  k, l, m>
753  TensorExpr;
755  Dim23, Dim1, m, j, k, l>(TensorExpr(a, b));
756  }
757 
758  /* B(i,m)*A(i,j,k,l) */
759 
760  template <class A, class B, class T, class U, int Dim01, int Dim23, int Dim1,
761  char i, char j, char k, char l, char m>
762  inline const Tensor4_Expr<
763  const Ddg_times_Tensor2_0_1<A, B, T, U, Dim01, Dim23, Dim1, i, j, k, l, m>,
764  typename promote<T, U>::V, Dim1, Dim01, Dim23, Dim23, m, j, k, l>
767  {
768  typedef const Ddg_times_Tensor2_0_1<A, B, T, U, Dim01, Dim23, Dim1, i, j,
769  k, l, m>
770  TensorExpr;
772  Dim23, Dim23, m, j, k, l>(TensorExpr(a, b));
773  }
774 }
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &) const
Ddg_times_Tensor2_1_1(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim01, Dim2, m, j > &b)
const Tensor2_Expr< B, U, Dim4, Dim23, m, l > iterB
promote< T, U >::V operator()(const int N1, const int N2) const
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
Ddg_times_Tensor2_2_0(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim4, Dim23, m, k > &b)
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
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
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Ddg_times_Tensor2_1_0(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim01, Dim2, j, m > &b)
Ddg_times_Tensor2_32(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim23, Dim23, l, k > &b)
const Tensor2_Expr< B, U, Dim23, Dim4, l, m > iterB
const Tensor2_Expr< B, U, Dim01, Dim2, m, j > iterB
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &) const
const Tensor2_Expr< B, U, Dim01, Dim2, j, m > 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 operator()(const int N1, const int N2, const int N3, const int N4) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
Ddg_times_Tensor2_0_1(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim01, Dim1, m, i > &b)
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Ddg_times_Tensor2_2_1(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim4, Dim23, k, m > &b)
promote< T, U >::V operator()(const int N1, const int N2) const
Ddg_times_Tensor2_3_1(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim23, Dim4, l, m > &b)
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Tensor2_Expr< B, U, Dim23, Dim23, l, k > iterB
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
promote< T, U >::V operator()(const int N1, const int N2) const
Fully Antisymmetric Levi-Civita Tensor.
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 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)
const Tensor2_Expr< B, U, Dim4, Dim23, k, m > iterB
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
const Tensor2_Expr< B, U, Dim4, Dim23, m, k > iterB
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Tensor2_Expr< B, U, Dim01, Dim23, j, l > 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 operator()(const int N1, const int N2, const int N3, const int N4) const
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
Ddg_times_Tensor2_3_0(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim4, Dim23, m, l > &b)
const Tensor2_Expr< B, U, Dim01, Dim1, m, i > iterB
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< Current_Dim1 > &) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Ddg_times_Tensor2_23(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim23, Dim23, k, l > &b)
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
const Tensor2_Expr< B, U, Dim01, Dim1, i, m > iterB
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
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
Tensor2_Expr< B, U, Dim23, Dim23, k, l > iterB
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
Ddg_times_Tensor2_13(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim01, Dim23, j, l > &b)
Ddg_times_Tensor2_0_0(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Tensor2_Expr< B, U, Dim01, Dim1, i, m > &b)
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< 1 > &) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
promote< T, U >::V eval(const int N1, const int N2, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA
promote< T, U >::V eval(const int N1, const int N2, const int N3, const int N4, const Number< Current_Dim0 > &) const
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
promote< T, U >::V eval(const int N1, const int N2, const Number< 1 > &, const Number< 1 > &) const
promote< T, U >::V operator()(const int N1, const int N2, const int N3, const int N4) const
Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > iterA