|
| v0.14.0
|
Go to the documentation of this file.
7 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1>
8 class Tensor2<T *, Tensor_Dim0, Tensor_Dim1> {
12 mutable T *restrict data[Tensor_Dim0][Tensor_Dim1];
18 Tensor2(T *d00, T *d01, T *d10, T *d11,
const int i) : inc(
i) {
20 data, d00, d01, d10, d11);
22 Tensor2(T *d00, T *d01, T *d10, T *d11, T *d20, T *d21,
const int i)
25 data, d00, d01, d10, d11, d20, d21);
27 Tensor2(T *d00, T *d01, T *d02, T *d10, T *d11, T *d12, T *d20, T *d21,
31 data, d00, d01, d02, d10, d11, d12, d20, d21, d22);
33 Tensor2(T *d00, T *d01, T *d02, T *d03, T *d10, T *d11, T *d12, T *d13,
34 T *d20, T *d21, T *d22, T *d23, T *d30, T *d31, T *d32, T *d33,
38 data, d00, d01, d02, d03, d10, d11, d12, d13, d20, d21, d22, d23, d30,
43 template <
class...
U>
Tensor2(
U *...
d) : data{
d...}, inc(1) {}
46 Tensor2(std::array<U *, Tensor_Dim0 * Tensor_Dim1> &
a,
const int i = 1)
49 for (
int i = 0;
i != Tensor_Dim0; ++
i) {
50 for (
int j = 0;
j != Tensor_Dim1; ++
j, ++
k) {
65 if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
67 s <<
"Bad index in Tensor2<T*," << Tensor_Dim0 <<
"," << Tensor_Dim1
68 <<
">.operator(" << N1 <<
"," << N2 <<
")" << std::endl;
69 throw std::out_of_range(s.str());
77 if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
79 s <<
"Bad index in Tensor2<T*," << Tensor_Dim0 <<
"," << Tensor_Dim1
80 <<
">.operator(" << N1 <<
"," << N2 <<
") const" << std::endl;
81 throw std::out_of_range(s.str());
87 T *
ptr(
const int N1,
const int N2)
const {
89 if (N1 >= Tensor_Dim0 || N1 < 0 || N2 >= Tensor_Dim1 || N2 < 0) {
91 s <<
"Bad index in Tensor2<T*," << Tensor_Dim0 <<
"," << Tensor_Dim1
92 <<
">.ptr(" << N1 <<
"," << N2 <<
")" << std::endl;
93 throw std::out_of_range(s.str());
104 template <
char i,
char j,
int Dim0,
int Dim1>
111 template <
char i,
char j,
int Dim0,
int Dim1>
126 template <
char i,
int Dim,
int N>
136 template <
char i,
int Dim,
int N>
146 template <
char i,
int Dim,
int N>
156 template <
char i,
int Dim,
int N>
170 for (
int i = 0;
i < Tensor_Dim0; ++
i)
171 for (
int j = 0;
j < Tensor_Dim1; ++
j)
181 template <
char i,
int Dim>
186 template <
char i,
int Dim>
209 template <
class T,
int Tensor_Dim0,
int Tensor_Dim1,
int I>
215 template <
class...
U>
221 Tensor2(std::array<U *, Tensor_Dim0 * Tensor_Dim1> &
a)
222 :
Tensor2<T *, Tensor_Dim0, Tensor_Dim1>(
a) {}
228 for (
int i = 0;
i < Tensor_Dim0; ++
i)
229 for (
int j = 0;
j < Tensor_Dim1; ++
j)
Tensor2_Expr< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > operator()(const Index< i, Dim0 >, const Index< j, Dim1 > index2)
Tensor2_Expr< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, Dim0, Dim1, i, j > operator()(const Index< i, Dim0 >, const Index< j, Dim1 > index2) const
Tensor2(std::array< U *, Tensor_Dim0 *Tensor_Dim1 > &a)
const Tensor2 & operator++() const
Tensor2(T *d00, T *d01, T *d10, T *d11, const int i)
Tensor2(T *d00, T *d01, T *d02, T *d10, T *d11, T *d12, T *d20, T *d21, T *d22, const int i)
Tensor2(std::array< U *, Tensor_Dim0 *Tensor_Dim1 > &a, const int i=1)
Tensor1_Expr< const Tensor2_number_0< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator()(const Number< N >, const Index< i, Dim >) const
const Tensor1_Expr< const dTensor0< T, Dim, i >, typename promote< T, double >::V, Dim, i > d(const Tensor0< T * > &a, const Index< i, Dim > index, const Tensor1< int, Dim > &d_ijk, const Tensor1< double, Dim > &d_xyz)
T operator()(const Index< i, Dim >, const Index< i, Dim > index2) const
constexpr IntegrationType I
T internal_contract(Number< N >) const
T operator()(const int N1, const int N2) const
Tensor2(T *d00, T *d01, T *d02, T *d03, T *d10, T *d11, T *d12, T *d13, T *d20, T *d21, T *d22, T *d23, T *d30, T *d31, T *d32, T *d33, const int i)
T operator()(const Index< i, Dim >, const Index< i, Dim > index2)
T * ptr(const int N1, const int N2) const
Tensor2(T *d00, T *d01, T *d10, T *d11, T *d20, T *d21, const int i)
Tensor1_Expr< const Tensor2_number_1< const Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator()(const Index< i, Dim >, const Number< N >) const
FTensor::Index< 'i', SPACE_DIM > i
T internal_contract(Number< 1 >) const
Tensor1_Expr< Tensor2_number_rhs_1< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator()(const Index< i, Dim >, const Number< N >)
Tensor1_Expr< Tensor2_number_rhs_0< Tensor2< T *, Tensor_Dim0, Tensor_Dim1 >, T, N >, T, Dim, i > operator()(const Number< N >, const Index< i, Dim >)
FTensor::Index< 'j', 3 > j
T & operator()(const int N1, const int N2)
FTensor::Index< 'k', 3 > k
const Tensor2 & operator++() const