v0.8.23
Tensor3_minus_Tensor3.hpp
Go to the documentation of this file.
1 /* Subtracts a Tensor3 from a Tensor3, yielding a Tensor3. */
2 
3 #pragma once
4 
5 namespace FTensor
6 {
7  /* Base Template */
8  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
9  int Dim2_0, int Dim0_1, int Dim1_1, int Dim2_1, char i0, char j0,
10  char k0, char i1, char j1, char k1>
12  {};
13 
14  /* A(i,j,k)-B(i,j,k)->Tensor3 */
15 
16  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
17  char i, char j, char k>
18  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim1, Dim2,
19  i, j, k, i, j, k>
20  {
23 
24  public:
25  typename promote<T, U>::V
26  operator()(const int N1, const int N2, const int N3) const
27  {
28  return iterA(N1, N2, N3) - iterB(N1, N2, N3);
29  }
30 
34  : iterA(a), iterB(b)
35  {}
36  };
37 
38  /* A(i,j,k)-B(i,k,j)->Tensor3 */
39 
40  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
41  char i, char j, char k>
42  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim0, Dim2, Dim1,
43  i, j, k, i, k, j>
44  {
47 
48  public:
49  typename promote<T, U>::V
50  operator()(const int N1, const int N2, const int N3) const
51  {
52  return iterA(N1, N2, N3) - iterB(N1, N3, N2);
53  }
54 
58  : iterA(a), iterB(b)
59  {}
60  };
61 
62  /* A(i,j,k)-B(j,i,k)->Tensor3 */
63 
64  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
65  char i, char j, char k>
66  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim0, Dim2,
67  i, j, k, j, i, k>
68  {
71 
72  public:
73  typename promote<T, U>::V
74  operator()(const int N1, const int N2, const int N3) const
75  {
76  return iterA(N1, N2, N3) - iterB(N2, N1, N3);
77  }
78 
82  : iterA(a), iterB(b)
83  {}
84  };
85 
86  /* A(i,j,k)-B(j,k,i)->Tensor3 */
87 
88  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
89  char i, char j, char k>
90  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim1, Dim2, Dim0,
91  i, j, k, j, k, i>
92  {
95 
96  public:
97  typename promote<T, U>::V
98  operator()(const int N1, const int N2, const int N3) const
99  {
100  return iterA(N1, N2, N3) - iterB(N2, N3, N1);
101  }
102 
106  : iterA(a), iterB(b)
107  {}
108  };
109 
110  /* A(i,j,k)-B(k,i,j)->Tensor3 */
111 
112  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
113  char i, char j, char k>
114  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim0, Dim1,
115  i, j, k, k, i, j>
116  {
119 
120  public:
121  typename promote<T, U>::V
122  operator()(const int N1, const int N2, const int N3) const
123  {
124  return iterA(N1, N2, N3) - iterB(N3, N1, N2);
125  }
126 
130  : iterA(a), iterB(b)
131  {}
132  };
133 
134  /* A(i,j,k)-B(k,j,i)->Tensor3 */
135 
136  template <class A, class B, class T, class U, int Dim0, int Dim1, int Dim2,
137  char i, char j, char k>
138  class Tensor3_minus_Tensor3<A, B, T, U, Dim0, Dim1, Dim2, Dim2, Dim1, Dim0,
139  i, j, k, k, j, i>
140  {
143 
144  public:
145  typename promote<T, U>::V
146  operator()(const int N1, const int N2, const int N3) const
147  {
148  return iterA(N1, N2, N3) - iterB(N3, N2, N1);
149  }
150 
154  : iterA(a), iterB(b)
155  {}
156  };
157 
158  template <class A, class B, class T, class U, int Dim0_0, int Dim1_0,
159  int Dim2_0, int Dim0_1, int Dim1_1, int Dim2_1, char i0, char j0,
160  char k0, char i1, char j1, char k1>
161  Tensor3_Expr<Tensor3_minus_Tensor3<A, B, T, U, Dim0_0, Dim1_0, Dim2_0, Dim0_1,
162  Dim1_1, Dim2_1, i0, j0, k0, i1, j1, k1>,
163  typename promote<T, U>::V, Dim0_0, Dim1_0, Dim2_0, i0, j0, k0>
166  {
167  using TensorExpr
168  = Tensor3_minus_Tensor3<A, B, T, U, Dim0_0, Dim1_0, Dim2_0, Dim0_1,
169  Dim1_1, Dim2_1, i0, j0, k0, i1, j1, k1>;
170  static_assert(
171  !std::is_empty<TensorExpr>::value,
172  "Indexes or Dimensions are not compatible with the - operator");
174  Dim2_0, i0, j0, k0>(TensorExpr(a, b));
175  }
176 }
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim2, Dim1, Dim0, k, j, i > &b)
Fully Antisymmetric Levi-Civita Tensor.
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim2, Dim0, Dim1, k, i, j > &b)
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim1, Dim2, Dim0, j, k, i > &b)
Ddg_Expr< Ddg_minus_Ddg< A, B, T, U, Dim01, Dim23, i, j, k, l >, typename promote< T, U >::V, Dim01, Dim23, i, j, k, l > operator-(const Ddg_Expr< A, T, Dim01, Dim23, i, j, k, l > &a, const Ddg_Expr< B, U, Dim01, Dim23, i, j, k, l > &b)
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim0, Dim2, Dim1, i, k, j > &b)
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim1, Dim0, Dim2, j, i, k > &b)
Tensor3_minus_Tensor3(const Tensor3_Expr< A, T, Dim0, Dim1, Dim2, i, j, k > &a, const Tensor3_Expr< B, U, Dim0, Dim1, Dim2, i, j, k > &b)