5 #include "../Tensor3.hpp"
9 template <
class T,
int Tensor_Dim01,
int Tensor_Dim2>
class Dg
11 T
data[(Tensor_Dim01 * (Tensor_Dim01 + 1)) / 2][Tensor_Dim2];
16 static_assert(
sizeof...(
d) ==
sizeof(
data) /
sizeof(T),
17 "Incorrect number of Arguments. Constructor should "
18 "initialize the entire Tensor");
29 if(N1 >= Tensor_Dim01 || N1 < 0 || N2 >= Tensor_Dim01 || N2 < 0
30 || N3 >= Tensor_Dim2 || N3 < 0)
33 s <<
"Bad index in Dg<T," << Tensor_Dim01 <<
"," << Tensor_Dim2
34 <<
">.operator(" << N1 <<
"," << N2 <<
"," << N3 <<
")"
36 throw std::out_of_range(s.str());
39 return N1 > N2 ?
data[N1 + (N2 * (2 * Tensor_Dim01 - N2 - 1)) / 2][N3]
40 :
data[N2 + (N1 * (2 * Tensor_Dim01 - N1 - 1)) / 2][N3];
43 T
operator()(
const int N1,
const int N2,
const int N3)
const
46 if(N1 >= Tensor_Dim01 || N1 < 0 || N2 >= Tensor_Dim01 || N2 < 0
47 || N3 >= Tensor_Dim2 || N3 < 0)
50 s <<
"Bad index in Dg<T," << Tensor_Dim01 <<
"," << Tensor_Dim2
51 <<
">.operator(" << N1 <<
"," << N2 <<
"," << N3 <<
") const"
53 throw std::out_of_range(s.str());
56 return N1 > N2 ?
data[N1 + (N2 * (2 * Tensor_Dim01 - N2 - 1)) / 2][N3]
57 :
data[N2 + (N1 * (2 * Tensor_Dim01 - N1 - 1)) / 2][N3];
63 template <
char i,
char j,
char k,
int Dim01,
int Dim2>
65 (Tensor_Dim01 >= Dim01 && Tensor_Dim2 >= Dim2),
74 template <
char i,
char j,
char k,
int Dim01,
int Dim2>
75 typename std::enable_if<(Tensor_Dim01 >= Dim01 && Tensor_Dim2 >= Dim2),
91 template <
char i,
char j,
int Dim>
93 (Tensor_Dim01 >= Dim && Tensor_Dim2 >= Dim),
107 template <
char i,
char j,
int Dim>
109 (Tensor_Dim01 >= Dim && Tensor_Dim2 >= Dim),
123 template <
char i,
char j,
int Dim01,
int Dim2>
125 (Tensor_Dim01 >= Dim01 && Tensor_Dim2 >= Dim2),
145 template <
char i,
char j,
int N,
int Dim1,
int Dim2>
147 (Tensor_Dim01 >
N && Tensor_Dim01 >= Dim1 && Tensor_Dim2 >= Dim2),
157 template <
char i,
char j,
int N,
int Dim1,
int Dim2>
159 (Tensor_Dim01 >
N && Tensor_Dim01 >= Dim1 && Tensor_Dim2 >= Dim2),
161 T, Dim1, Dim2,
i,
j>>::
type
172 template <
char i,
char j,
int N,
int Dim0,
int Dim2>
174 (Tensor_Dim01 >= Dim0 && Tensor_Dim01 >
N && Tensor_Dim2 >= Dim2),
184 template <
char i,
char j,
int N,
int Dim0,
int Dim2>
186 (Tensor_Dim01 >= Dim0 && Tensor_Dim01 >
N && Tensor_Dim2 >= Dim2),
188 T, Dim0, Dim2,
i,
j>>::
type
199 template <
char i,
char j,
int N,
int Dim>
201 (Tensor_Dim01 >= Dim && Tensor_Dim2 >
N),
212 template <
char i,
char j,
int N,
int Dim>
214 (Tensor_Dim01 >= Dim && Tensor_Dim2 >
N),
233 template <
char i,
int N1,
int N2,
int Dim>
235 (Tensor_Dim01 >= Dim && Tensor_Dim01 > N1 && Tensor_Dim2 > N2),
245 template <
char i,
int N1,
int N2,
int Dim>
247 (Tensor_Dim01 >= Dim && Tensor_Dim01 > N1 && Tensor_Dim2 > N2),
263 template <
char i,
int N0,
int N2,
int Dim>
265 (Tensor_Dim01 > N0 && Tensor_Dim01 >= Dim && Tensor_Dim2 > N2),
275 template <
char i,
int N0,
int N2,
int Dim>
277 (Tensor_Dim01 > N0 && Tensor_Dim01 >= Dim && Tensor_Dim2 > N2),
291 template <
char i,
int N0,
int N1,
int Dim>
293 (Tensor_Dim01 > N0 && Tensor_Dim01 > N1 && Tensor_Dim2 >= Dim),
303 template <
char i,
int N0,
int N1,
int Dim>
305 (Tensor_Dim01 > N0 && Tensor_Dim01 > N1 && Tensor_Dim2 >= Dim),
323 template <
char i,
char j,
int Dim1,
int Dim2>
325 (Tensor_Dim01 >= Dim1 && Tensor_Dim2 >= Dim2),
333 TensorExpr(*
this,
N));
338 template <
char i,
char j,
int Dim0,
int Dim2>
340 (Tensor_Dim01 >= Dim0 && Tensor_Dim2 >= Dim2),
348 TensorExpr(*
this,
N));
353 template <
char i,
char j,
int Dim>
355 (Tensor_Dim01 >= Dim),
364 TensorExpr(*
this,
N));
372 template <
char i,
int Dim>
374 (Tensor_Dim01 >= Dim),
388 template <
char i,
int Dim>
390 (Tensor_Dim01 >= Dim),
402 template <
char i,
int Dim>
404 (Tensor_Dim2 >= Dim),