9 template <
class T,
int Tensor_Dim0,
int Tensor_Dim12>
class Christof
11 T
data[Tensor_Dim0][(Tensor_Dim12 * (Tensor_Dim12 + 1)) / 2];
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_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0
30 || N3 >= Tensor_Dim12 || N3 < 0)
33 s <<
"Bad index in Christof<T," << Tensor_Dim0 <<
"," << Tensor_Dim12
34 <<
">.operator(" << N1 <<
"," << N2 <<
"," << N3 <<
")"
36 throw std::out_of_range(s.str());
39 return N2 > N3 ?
data[N1][N2 + (N3 * (2 * Tensor_Dim12 - N3 - 1)) / 2]
40 :
data[N1][N3 + (N2 * (2 * Tensor_Dim12 - N2 - 1)) / 2];
43 T
operator()(
const int N1,
const int N2,
const int N3)
const
46 if(N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim12 || N2 < 0
47 || N3 >= Tensor_Dim12 || N3 < 0)
50 s <<
"Bad index in Christof<T," << Tensor_Dim0 <<
"," << Tensor_Dim12
51 <<
">.operator(" << N1 <<
"," << N2 <<
"," << N3 <<
") const"
53 throw std::out_of_range(s.str());
56 return N2 > N3 ?
data[N1][N2 + (N3 * (2 * Tensor_Dim12 - N3 - 1)) / 2]
57 :
data[N1][N3 + (N2 * (2 * Tensor_Dim12 - N2 - 1)) / 2];
65 template <
char i,
char j,
char k,
int Dim0,
int Dim12>
66 typename std::enable_if<(Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim12),
76 template <
char i,
char j,
char k,
int Dim0,
int Dim12>
77 typename std::enable_if<(Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim12),
84 Dim0,
i,
j,
k>(*this);
94 template <
char i,
int N1,
int N2,
int Dim>
96 (Tensor_Dim0 >= Dim && Tensor_Dim12 > N1 && Tensor_Dim12 > N2),
107 template <
char i,
int N1,
int N2,
int Dim>
109 (Tensor_Dim0 >= Dim && Tensor_Dim12 > N1 && Tensor_Dim12 > N2),
127 template <
char i,
char j,
int Dim0,
int Dim12>
129 (Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim12),
142 template <
char i,
char j,
int Dim>
144 (Tensor_Dim0 >= Dim && Tensor_Dim12 >= Dim),
168 template <
char i,
char j,
int Dim>
170 (Tensor_Dim0 >= Dim && Tensor_Dim12 >= Dim),
197 template <
char i,
char j,
int Dim0,
int Dim12>
199 (Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim12),
212 template <
char i,
char j,
int Dim>
214 (Tensor_Dim0 >= Dim && Tensor_Dim12 >= Dim),
237 template <
char i,
char j,
int Dim>
239 (Tensor_Dim0 >= Dim && Tensor_Dim12 >= Dim),
265 template <
char i,
char j,
int N,
int Dim12>
267 (Tensor_Dim0 >
N && Tensor_Dim12 >= Dim12),
283 template <
char i,
char j,
int Dim12>
285 (Tensor_Dim12 >= Dim12),
294 TensorExpr(*
this,
N));
301 template <
char i,
char j,
int Dim0,
int Dim2>
303 (Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim2),
305 T, Dim0, Dim2,
i,
j>>::
type
311 TensorExpr(*
this,
N));
314 template <
char i,
char j,
int Dim0,
int Dim2>
316 (Tensor_Dim0 >= Dim0 && Tensor_Dim12 >= Dim2),
318 T, Dim0, Dim2,
i,
j>>::
type
324 TensorExpr(*
this,
N));