v0.14.0
Tensor4_times_Tensor3_double.hpp
Go to the documentation of this file.
1 /* This file has all of the declarations for expressions like
2  Tensor4*Tensor3 and Tensor3*Tensor4, yielding a
3  Tensor3. */
4 
5 #pragma once
6 
7 namespace FTensor
8 {
9  /* A(i,j,k,l)*B(k,l,m) */
10 
11  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
12  int Dim3, int Dim4, char i, char j, char k, char l, char m>
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 int N3, 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, N3)
25  + eval(N1, N2, N3, 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 int N3, const Number<1> &,
31  const Number<Current_Dim1> &) const
32  {
33  return iterA(N1, N2, 0, Current_Dim1 - 1) * iterB(0, Current_Dim1 - 1, N3)
34  + eval(N1, N2, N3, Number<Dim2>(), Number<Current_Dim1 - 1>());
35  }
36  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
37  const Number<1> &, const Number<1> &) const
38  {
39  return iterA(N1, N2, 0, 0) * iterB(0, 0, N3);
40  }
41 
42  public:
43  typename promote<T, U>::V operator()(const int N1, const int N2,
44  const int N3) const {
45  return eval(N1, N2, N3, Number<Dim2>(), Number<Dim3>());
46  }
47 
51  : iterA(a), iterB(b)
52  {}
53  };
54 
55  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
56  int Dim3, int Dim4, char i, char j, char k, char l, char m>
57  inline Tensor3_Expr<
58  const Tensor4_times_Tensor3_23<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim4,
59  i, j, k, l, m>,
60  typename promote<T, U>::V, Dim0, Dim1, Dim4, i, j, m>
63  typedef const Tensor4_times_Tensor3_23<A, B, T, U, Dim0, Dim1, Dim2, Dim3,
64  Dim4, i, j, k, l, m>
65  TensorExpr;
67  i, j, m>(TensorExpr(a, b));
68  }
69 
70  /* B(k,l, m)*A(i,j,k,l) */
71 
72  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
73  int Dim3, int Dim4, char i, char j, char k, char l, char m>
74  inline Tensor3_Expr<
75  const Tensor4_times_Tensor3_23<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim4,
76  i, j, k, l, m>,
77  typename promote<T, U>::V, Dim0, Dim1, Dim4, i, j, m>
80  typedef const Tensor4_times_Tensor3_23<A, B, T, U, Dim0, Dim1, Dim2, Dim3,
81  Dim4, i, j, k, l, m>
82  TensorExpr;
84  i, j, m>(TensorExpr(a, b));
85  }
86 
87  /* A(i, j, k, l) * B(m, k, j) */
88 
89  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
90  int Dim3, int Dim4, char i, char j, char k, char l, char m>
94 
95  template <int Current_Dim0, int Current_Dim1>
96  typename promote<T, U>::V
97  eval(const int N1, const int N2, const int N3, const Number<Current_Dim0> &,
98  const Number<Current_Dim1> &) const
99  {
100  return iterA(N1, Current_Dim0 - 1, Current_Dim1 - 1, N2)
101  * iterB(N3, Current_Dim1 - 1, Current_Dim0 - 1)
102  + eval(N1, N2, N3, Number<Current_Dim0 - 1>(),
104  }
105  template <int Current_Dim1>
106  typename promote<T, U>::V
107  eval(const int N1, const int N2, const int N3, const Number<1> &,
108  const Number<Current_Dim1> &) const
109  {
110  return iterA(N1, 0, Current_Dim1 - 1, N2) *
111  iterB(N3, Current_Dim1 - 1, 0) +
112  eval(N1, N2, N3, Number<Dim1>(), Number<Current_Dim1 - 1>());
113  }
114  typename promote<T, U>::V eval(const int N1, const int N2, const int N3,
115  const Number<1> &, const Number<1> &) const
116  {
117  return iterA(N1, 0, 0, N2) * iterB(N3, 0, 0);
118  }
119 
120  public:
121  typename promote<T, U>::V operator()(const int N1, const int N2,
122  const int N3) const {
123  return eval(N1, N2, N3, Number<Dim1>(), Number<Dim2>());
124  }
125 
129  : iterA(a), iterB(b)
130  {}
131  };
132 
133  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
134  int Dim3, int Dim4, char i, char j, char k, char l, char m>
135  inline Tensor3_Expr<
136  const Tensor4_times_Tensor3_12_21<A, B, T, U, Dim0, Dim1, Dim2, Dim3, Dim4,
137  i, j, k, l, m>,
138  typename promote<T, U>::V, Dim0, Dim3, Dim4, i, l, m>
141  typedef const Tensor4_times_Tensor3_12_21<A, B, T, U, Dim0, Dim1, Dim2,
142  Dim3, Dim4, i, j, k, l, m>
143  TensorExpr;
145  i, l, m>(TensorExpr(a, b));
146  }
147 
148  /* B(m, k, j) * A(i, j, k, l) */
149 
150  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
151  int Dim3, int Dim4, char i, char j, char k, char l, char m>
152  inline Tensor3_Expr<
153  const Tensor4_times_Tensor3_12_21<A, B, T, U, Dim0, Dim1, Dim2, Dim3,
154  Dim4, i, j, k, l, m>,
155  typename promote<T, U>::V, Dim0, Dim3, Dim4, i, l, m>
159  typedef const Tensor4_times_Tensor3_12_21<A, B, T, U, Dim0, Dim1, Dim2,
160  Dim3, Dim4, i, j, k, l, m>
161  TensorExpr;
163  i, l, m>(TensorExpr(a, b));
164  }
165 
166  } // namespace FTensor
FTensor
JSON compatible output.
Definition: Christof_constructor.hpp:6
FTensor::Tensor4_times_Tensor3_12_21::iterA
const Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > iterA
Definition: Tensor4_times_Tensor3_double.hpp:92
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::Tensor4_times_Tensor3_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< 1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:36
FTensor::Tensor4_times_Tensor3_23::iterA
const Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > iterA
Definition: Tensor4_times_Tensor3_double.hpp:15
A
constexpr AssemblyType A
Definition: operators_tests.cpp:30
FTensor::Tensor4_times_Tensor3_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:30
FTensor::Tensor4_times_Tensor3_23::Tensor4_times_Tensor3_23
Tensor4_times_Tensor3_23(const Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > &a, const Tensor3_Expr< B, U, Dim2, Dim3, Dim4, k, l, m > &b)
Definition: Tensor4_times_Tensor3_double.hpp:48
FTensor::Tensor4_times_Tensor3_12_21
Definition: Tensor4_times_Tensor3_double.hpp:91
FTensor::Tensor4_times_Tensor3_12_21::Tensor4_times_Tensor3_12_21
Tensor4_times_Tensor3_12_21(const Tensor4_Expr< A, T, Dim0, Dim1, Dim2, Dim3, i, j, k, l > &a, const Tensor3_Expr< B, U, Dim4, Dim2, Dim1, m, k, j > &b)
Definition: Tensor4_times_Tensor3_double.hpp:126
FTensor::Tensor4_times_Tensor3_12_21::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor4_times_Tensor3_double.hpp:121
FTensor::Tensor4_Expr
Definition: Tensor4_Expr.hpp:25
FTensor::Number
Definition: Number.hpp:11
FTensor::Tensor4_times_Tensor3_23::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:20
a
constexpr double a
Definition: approx_sphere.cpp:30
FTensor::promote::V
T1 V
Definition: promote.hpp:17
FTensor::Tensor4_times_Tensor3_12_21::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< Current_Dim0 > &, const Number< Current_Dim1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:97
FTensor::Tensor4_times_Tensor3_23
Definition: Tensor4_times_Tensor3_double.hpp:13
FTensor::Tensor3_Expr< B, U, Dim2, Dim3, Dim4, k, l, m >
i
FTensor::Index< 'i', SPACE_DIM > i
Definition: hcurl_divergence_operator_2d.cpp:27
FTensor::Tensor4_times_Tensor3_12_21::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< Current_Dim1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:107
FTensor::Tensor4_times_Tensor3_12_21::iterB
const Tensor3_Expr< B, U, Dim4, Dim2, Dim1, m, k, j > iterB
Definition: Tensor4_times_Tensor3_double.hpp:93
j
FTensor::Index< 'j', 3 > j
Definition: matrix_function.cpp:19
FTensor::Tensor4_times_Tensor3_23::iterB
const Tensor3_Expr< B, U, Dim2, Dim3, Dim4, k, l, m > iterB
Definition: Tensor4_times_Tensor3_double.hpp:16
m
FTensor::Index< 'm', 3 > m
Definition: shallow_wave.cpp:80
k
FTensor::Index< 'k', 3 > k
Definition: matrix_function.cpp:20
FTensor::Tensor4_times_Tensor3_23::operator()
promote< T, U >::V operator()(const int N1, const int N2, const int N3) const
Definition: Tensor4_times_Tensor3_double.hpp:43
EshelbianPlasticity::U
@ U
Definition: EshelbianContact.cpp:197
l
FTensor::Index< 'l', 3 > l
Definition: matrix_function.cpp:21
FTensor::Tensor4_times_Tensor3_12_21::eval
promote< T, U >::V eval(const int N1, const int N2, const int N3, const Number< 1 > &, const Number< 1 > &) const
Definition: Tensor4_times_Tensor3_double.hpp:114