v0.14.0
Tensor3_times_Tensor2_symmetric.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Tensor3*Tensor2_symmetric and Tensor2_symmetric*Tensor3, yielding a
3  Tensor1. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j,k)*B(j,k)->Tensor1 */
10 
11  template <class A, class B, class T, class U, int Dim0, int Dim, char i,
12  char j, char k>
14  {
17 
18  template <int Current_Dim0, int Current_Dim1>
19  typename promote<T, U>::V eval(const int N1, 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)
25  }
26  template <int Current_Dim1>
27  typename promote<T, U>::V
28  eval(const int N1, const Number<1> &, const Number<Current_Dim1> &) const
29  {
30  return iterA(N1, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1)
32  }
33  typename promote<T, U>::V
34  eval(const int N1, const Number<1> &, const Number<1> &) const
35  {
36  return iterA(N1, 0, 0) * iterB(0, 0);
37  }
38 
39  public:
43  : iterA(a), iterB(b)
44  {}
45  typename promote<T, U>::V operator()(const int N1) const
46  {
47  return eval(N1, Number<Dim>(), Number<Dim>());
48  }
49  };
50 
51  template <class A, class B, class T, class U, int Dim0, int Dim, char i,
52  char j, char k>
54  Tensor3_times_Tensor2_symmetric_12<A, B, T, U, Dim0, Dim, i, j, k>,
55  typename promote<T, U>::V, Dim0, i>
58  {
59  using TensorExpr
62  TensorExpr(a, b));
63  }
64 
65  /* B(j,k)*A(i,j,k)->Tensor1 */
66 
67  template <class A, class B, class T, class U, int Dim0, int Dim, char i,
68  char j, char k>
70  Tensor3_times_Tensor2_symmetric_12<A, B, T, U, Dim0, Dim, i, j, k>,
71  typename promote<T, U>::V, Dim0, i>
74  {
75  using TensorExpr
78  TensorExpr(a, b));
79  }
80 
81  /* A(j,i,k)*B(j,k)->Tensor1 */
82 
83  template <class A, class B, class T, class U, int Dim1, int Dim, char i,
84  char j, char k>
86  {
89 
90  template <int Current_Dim0, int Current_Dim1>
91  typename promote<T, U>::V eval(const int N1, const Number<Current_Dim0> &,
92  const Number<Current_Dim1> &) const
93  {
94  return iterA(Current_Dim0 - 1, N1, Current_Dim1 - 1)
95  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
97  }
98  template <int Current_Dim1>
99  typename promote<T, U>::V
100  eval(const int N1, const Number<1> &, const Number<Current_Dim1> &) const
101  {
102  return iterA(0, N1, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1)
104  }
105  typename promote<T, U>::V
106  eval(const int N1, const Number<1> &, const Number<1> &) const
107  {
108  return iterA(0, N1, 0) * iterB(0, 0);
109  }
110 
111  public:
115  : iterA(a), iterB(b)
116  {}
117  typename promote<T, U>::V operator()(const int N1) const
118  {
119  return eval(N1, Number<Dim>(), Number<Dim>());
120  }
121  };
122 
123  template <class A, class B, class T, class U, int Dim1, int Dim, char i,
124  char j, char k>
125  Tensor1_Expr<
126  Tensor3_times_Tensor2_symmetric_02<A, B, T, U, Dim1, Dim, i, j, k>,
127  typename promote<T, U>::V, Dim1, i>
130  {
131  using TensorExpr
134  TensorExpr(a, b));
135  }
136 
137  /* B(j,k)*A(j,i,k)->Tensor1 */
138 
139  template <class A, class B, class T, class U, int Dim1, int Dim, char i,
140  char j, char k>
141  Tensor1_Expr<
142  Tensor3_times_Tensor2_symmetric_02<A, B, T, U, Dim1, Dim, i, j, k>,
143  typename promote<T, U>::V, Dim1, i>
146  {
147  using TensorExpr
150  TensorExpr(a, b));
151  }
152 
153  /* A(j,k,i)*B(j,k)->Tensor1 */
154 
155  template <class A, class B, class T, class U, int Dim2, int Dim, char i,
156  char j, char k>
158  {
161 
162  template <int Current_Dim0, int Current_Dim1>
163  typename promote<T, U>::V eval(const int N1, const Number<Current_Dim0> &,
164  const Number<Current_Dim1> &) const
165  {
166  return iterA(Current_Dim0 - 1, Current_Dim1 - 1, N1)
167  * iterB(Current_Dim0 - 1, Current_Dim1 - 1)
169  }
170  template <int Current_Dim1>
171  typename promote<T, U>::V
172  eval(const int N1, const Number<1> &, const Number<Current_Dim1> &) const
173  {
174  return iterA(0, Current_Dim1 - 1, N1) * iterB(0, Current_Dim1 - 1)
176  }
177  typename promote<T, U>::V
178  eval(const int N1, const Number<1> &, const Number<1> &) const
179  {
180  return iterA(0, 0, N1) * iterB(0, 0);
181  }
182 
183  public:
187  : iterA(a), iterB(b)
188  {}
189  typename promote<T, U>::V operator()(const int N1) const
190  {
191  return eval(N1, Number<Dim>(), Number<Dim>());
192  }
193  };
194 
195  template <class A, class B, class T, class U, int Dim2, int Dim, char i,
196  char j, char k>
197  Tensor1_Expr<
198  Tensor3_times_Tensor2_symmetric_01<A, B, T, U, Dim2, Dim, i, j, k>,
199  typename promote<T, U>::V, Dim2, i>
202  {
203  using TensorExpr
206  TensorExpr(a, b));
207  }
208 
209  /* B(j,k)*A(j,k,i)->Tensor1 */
210 
211  template <class A, class B, class T, class U, int Dim2, int Dim, char i,
212  char j, char k>
213  Tensor1_Expr<
214  Tensor3_times_Tensor2_symmetric_01<A, B, T, U, Dim2, Dim, i, j, k>,
215  typename promote<T, U>::V, Dim2, i>
218  {
219  using TensorExpr
222  TensorExpr(a, b));
223  }
224 
225  /* A(i,j,k)*B(j,l)->Tensor3 */
226 
227  template <class A, class B, class T, class U, int Dim0, int Dim, int Dim2,
228  char i, char j, char k, char l>
232 
233  template <int Current_Dim>
234  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
235  const Number<Current_Dim> &) const {
236  return iterA(N1, Current_Dim - 1, N2)
237  * iterB(Current_Dim - 1, N3)
238  + eval(N1, N2, N3, Number<Current_Dim - 1>());
239  }
240  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
241  const Number<1> &) const {
242  return iterA(N1, 0, N2) * iterB(0, N3);
243  }
244 
245  public:
249  : iterA(a), iterB(b)
250  {}
251  typename promote<T, U>::V operator()(const int N1, const int N2,
252  const int N3) const {
253  return eval(N1, N3, N2, Number<Dim>());
254  }
255  };
256 
257  template <class A, class B, class T, class U, int Dim0, int Dim, int Dim2,
258  char i, char j, char k, char l>
259  Tensor3_Expr<Tensor3_times_Tensor2_symmetric_1<A, B, T, U, Dim0, Dim, Dim2, i,
260  j, k, l>,
261  typename promote<T, U>::V, Dim0, Dim, Dim2, i, l, k>
264  using TensorExpr = Tensor3_times_Tensor2_symmetric_1<A, B, T, U, Dim0, Dim,
265  Dim2, i, j, k, l>;
267  i, l, k>(TensorExpr(a, b));
268  }
269 
270  /* B(j,l)*A(i,j,k)->Tensor3 */
271 
272  template <class A, class B, class T, class U, int Dim0, int Dim, int Dim2,
273  char i, char j, char k, char l>
274  Tensor3_Expr<Tensor3_times_Tensor2_symmetric_1<A, B, T, U, Dim0, Dim, Dim2, i,
275  j, k, l>,
276  typename promote<T, U>::V, Dim0, Dim, Dim2, i, l, k>
279  using TensorExpr = Tensor3_times_Tensor2_symmetric_1<A, B, T, U, Dim0, Dim,
280  Dim2, i, j, k, l>;
282  i, l, k>(TensorExpr(a, b));
283  }
284 
285  /* A(i,j,k)*B(i,l)->Tensor3 */
286 
287  template <class A, class B, class T, class U, int Dim, int Dim1, int Dim2,
288  char i, char j, char k, char l>
292 
293  template <int Current_Dim>
294  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
295  const Number<Current_Dim> &) const {
296  return iterA(Current_Dim - 1, N1, N2)
297  * iterB(Current_Dim - 1, N3)
298  + eval(N1, N2, N3, Number<Current_Dim - 1>());
299  }
300  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
301  const Number<1> &) const {
302  return iterA(0, N1, N2) * iterB(0, N3);
303  }
304 
305  public:
309  : iterA(a), iterB(b)
310  {}
311  typename promote<T, U>::V operator()(const int N1, const int N2,
312  const int N3) const {
313  return eval(N2, N3, N1, Number<Dim>());
314  }
315  };
316 
317  template <class A, class B, class T, class U, int Dim, int Dim1, int Dim2,
318  char i, char j, char k, char l>
319  Tensor3_Expr<Tensor3_times_Tensor2_symmetric_0<A, B, T, U, Dim, Dim1, Dim2, i,
320  j, k, l>,
321  typename promote<T, U>::V, Dim, Dim1, Dim2, l, j, k>
324  using TensorExpr = Tensor3_times_Tensor2_symmetric_0<A, B, T, U, Dim, Dim1,
325  Dim2, i, j, k, l>;
327  l, j, k>(TensorExpr(a, b));
328  }
329 
330  /* B(i,l) * A(i,j,k)->Tensor3 */
331 
332  template <class A, class B, class T, class U, int Dim, int Dim1, int Dim2,
333  char i, char j, char k, char l>
334  Tensor3_Expr<Tensor3_times_Tensor2_symmetric_0<A, B, T, U, Dim, Dim1, Dim2, i,
335  j, k, l>,
336  typename promote<T, U>::V, Dim, Dim1, Dim2, l, j, k>
339  using TensorExpr = Tensor3_times_Tensor2_symmetric_0<A, B, T, U, Dim, Dim1,
340  Dim2, i, j, k, l>;
342  l, j, k>(TensorExpr(a, b));
343  }
344 
345 }
FTensor::Tensor3_times_Tensor2_symmetric_12::Tensor3_times_Tensor2_symmetric_12
Tensor3_times_Tensor2_symmetric_12(const Tensor3_Expr< A, T, Dim0, Dim, Dim, i, j, k > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, k > &b)
Definition: Tensor3_times_Tensor2_symmetric.hpp:40
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::operator*
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)
Definition: Ddg_times_Ddg.hpp:79
FTensor::Tensor3_times_Tensor2_symmetric_02::Tensor3_times_Tensor2_symmetric_02
Tensor3_times_Tensor2_symmetric_02(const Tensor3_Expr< A, T, Dim, Dim1, Dim, j, i, k > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, k > &b)
Definition: Tensor3_times_Tensor2_symmetric.hpp:112
FTensor::Tensor3_times_Tensor2_symmetric_0
Definition: Tensor3_times_Tensor2_symmetric.hpp:289
FTensor::Tensor2_symmetric_Expr< B, U, Dim, j, k >
FTensor::Tensor3_times_Tensor2_symmetric_1::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:240
FTensor::Tensor3_times_Tensor2_symmetric_02::operator()
promote< T, U >::V operator()(const int N1) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:117
FTensor::Tensor3_times_Tensor2_symmetric_0::iterA
Tensor3_Expr< A, T, Dim, Dim1, Dim2, i, j, k > iterA
Definition: Tensor3_times_Tensor2_symmetric.hpp:290
FTensor::Tensor3_times_Tensor2_symmetric_01::iterA
Tensor3_Expr< A, T, Dim, Dim, Dim2, j, k, i > iterA
Definition: Tensor3_times_Tensor2_symmetric.hpp:159
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor3_times_Tensor2_symmetric_1::iterA
Tensor3_Expr< A, T, Dim0, Dim, Dim2, i, j, k > iterA
Definition: Tensor3_times_Tensor2_symmetric.hpp:230
FTensor::Tensor3_times_Tensor2_symmetric_1::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:234
FTensor::Tensor3_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:163
FTensor::Tensor3_times_Tensor2_symmetric_01
Definition: Tensor3_times_Tensor2_symmetric.hpp:157
FTensor::Tensor3_times_Tensor2_symmetric_0::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:311
FTensor::Tensor3_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:172
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor3_times_Tensor2_symmetric_0::Tensor3_times_Tensor2_symmetric_0
Tensor3_times_Tensor2_symmetric_0(const Tensor3_Expr< A, T, Dim, Dim1, Dim2, i, j, k > &a, const Tensor2_symmetric_Expr< B, U, Dim, i, l > &b)
Definition: Tensor3_times_Tensor2_symmetric.hpp:306
FTensor::Tensor1_Expr
Definition: Tensor1_Expr.hpp:27
FTensor::Tensor3_times_Tensor2_symmetric_01::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< 1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:178
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::Tensor3_times_Tensor2_symmetric_02::iterA
Tensor3_Expr< A, T, Dim, Dim1, Dim, j, i, k > iterA
Definition: Tensor3_times_Tensor2_symmetric.hpp:87
FTensor::Tensor3_times_Tensor2_symmetric_1
Definition: Tensor3_times_Tensor2_symmetric.hpp:229
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor3_times_Tensor2_symmetric_02
Definition: Tensor3_times_Tensor2_symmetric.hpp:85
FTensor::Tensor3_times_Tensor2_symmetric_12::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:28
FTensor::Tensor3_times_Tensor2_symmetric_0::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:300
FTensor::Tensor3_Expr< A, T, Dim0, Dim, Dim, i, j, k >
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor3_times_Tensor2_symmetric_0::iterB
Tensor2_symmetric_Expr< B, U, Dim, i, l > iterB
Definition: Tensor3_times_Tensor2_symmetric.hpp:291
FTensor::Tensor3_times_Tensor2_symmetric_12::eval
promote< T, U >::V eval(const int N1, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:19
FTensor::Tensor3_times_Tensor2_symmetric_01::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, k > iterB
Definition: Tensor3_times_Tensor2_symmetric.hpp:160
FTensor::Tensor3_times_Tensor2_symmetric_02::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, k > iterB
Definition: Tensor3_times_Tensor2_symmetric.hpp:88
FTensor::Tensor3_times_Tensor2_symmetric_01::Tensor3_times_Tensor2_symmetric_01
Tensor3_times_Tensor2_symmetric_01(const Tensor3_Expr< A, T, Dim, Dim, Dim2, j, k, i > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, k > &b)
Definition: Tensor3_times_Tensor2_symmetric.hpp:184
Tensor1_Expr
Definition: single.cpp:11
FTensor::Tensor3_times_Tensor2_symmetric_12::operator()
promote< T, U >::V operator()(const int N1) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:45
FTensor::Tensor3_times_Tensor2_symmetric_12::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< 1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:34
FTensor::Tensor3_times_Tensor2_symmetric_1::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:251
FTensor::Tensor3_times_Tensor2_symmetric_12
Definition: Tensor3_times_Tensor2_symmetric.hpp:13
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor3_times_Tensor2_symmetric_1::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, l > iterB
Definition: Tensor3_times_Tensor2_symmetric.hpp:231
FTensor::Tensor3_times_Tensor2_symmetric_02::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< 1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:106
FTensor::Tensor3_times_Tensor2_symmetric_01::operator()
promote< T, U >::V operator()(const int N1) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:189
FTensor::Tensor3_times_Tensor2_symmetric_02::eval
promote< T, U >::V eval(const int N1, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:100
FTensor::Tensor3_times_Tensor2_symmetric_12::iterB
Tensor2_symmetric_Expr< B, U, Dim, j, k > iterB
Definition: Tensor3_times_Tensor2_symmetric.hpp:16
FTensor::Tensor3_times_Tensor2_symmetric_1::Tensor3_times_Tensor2_symmetric_1
Tensor3_times_Tensor2_symmetric_1(const Tensor3_Expr< A, T, Dim0, Dim, Dim2, i, j, k > &a, const Tensor2_symmetric_Expr< B, U, Dim, j, l > &b)
Definition: Tensor3_times_Tensor2_symmetric.hpp:246
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Tensor3_times_Tensor2_symmetric_0::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:294
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FTensor::Tensor3_times_Tensor2_symmetric_02::eval
promote< T, U >::V eval(const int N1, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Tensor3_times_Tensor2_symmetric.hpp:91
FTensor::Tensor3_times_Tensor2_symmetric_12::iterA
Tensor3_Expr< A, T, Dim0, Dim, Dim, i, j, k > iterA
Definition: Tensor3_times_Tensor2_symmetric.hpp:15