10 template <
typename T, Index d0, Index d1, Index d2>
13 static const Index siz = d0 * d1 * d2;
14 static const Index stride0 = d1 * d2;
15 static const Index stride1 = d2;
16 static const Index stride2 = 1;
22 for (Index i = 0; i < siz; i++)
30 return data[i2 + d2 * (i1 + (d1 * i0))];
33 using M01 = Matrix<T, d0, d1, RowMajor>;
34 using M12 = Matrix<T, d1, d2, RowMajor>;
35 using M02 = Matrix<T, d0, d2, RowMajor>;
37 using Map01 = Map<M01, Unaligned, Stride<stride0, stride1>>;
38 using Map12 = Map<M12, Unaligned, Stride<stride1, stride2>>;
39 using Map02 = Map<M02, Unaligned, Stride<stride0, stride2>>;
44 return Map01(data + i2 * stride2);
50 return Map12(data + i0 * stride0);
56 return Map02(data + i1 * stride1);
62 DNDS_assert(Rmat.cols() == Rmat.rows() && Rmat.rows() == d0);
63 for (Index i2 = 0; i2 < d2; i2++)
66 m = Rmat.transpose() * m;
73 DNDS_assert(Rmat.cols() == Rmat.rows() && Rmat.rows() == d1);
74 for (Index i2 = 0; i2 < d2; i2++)
84 DNDS_assert(Rmat.cols() == Rmat.rows() && Rmat.rows() == d2);
85 for (Index i0 = 0; i0 < d0; i0++)
92 template <Index dout,
class Tmat>
95 DNDS_assert(Rmat.rows() == d0 && Rmat.cols() == dout);
97 for (Index i2 = 0; i2 < d2; i2++)
100 auto mout =
res.GetMap01(i2);
101 mout = Rmat.transpose() * m;
106 template <Index dout,
class Tmat>
109 DNDS_assert(Rmat.rows() == d1 && Rmat.cols() == dout);
112 for (Index i2 = 0; i2 < d2; i2++)
115 auto mout =
res.GetMap01(i2);
121 template <Index dout,
class Tmat>
124 DNDS_assert(Rmat.rows() == d2 && Rmat.cols() == dout);
126 for (Index i0 = 0; i0 < d0; i0++)
129 auto mout =
res.GetMap12(i0);
135 template <
typename T, Index d0, Index d1, Index d2>
139 for (Index i0 = 0; i0 < d0; i0++)
145 template <
typename T, Index d0, Index d1, Index d2>
149 for (Index i0 = 0; i0 < d0; i0++)
150 out << R.GetMap12(i0) <<
"\n\n";
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Map< M02, Unaligned, Stride< stride0, stride2 > > Map02
ETensorR3< T, d0, d1, dout > MatTransform2d(const Tmat &Rmat)
Matrix< T, d0, d1, RowMajor > M01
Matrix< T, d1, d2, RowMajor > M12
void MatTransform0(const Tmat &Rmat)
Matrix< T, d0, d2, RowMajor > M02
ETensorR3< T, d0, dout, d2 > MatTransform1d(const Tmat &Rmat)
Map< M01, Unaligned, Stride< stride0, stride1 > > Map01
T & operator()(Index i0, Index i1, Index i2)
void MatTransform1(const Tmat &Rmat)
void MatTransform2(const Tmat &Rmat)
ETensorR3< T, dout, d1, d2 > MatTransform0d(const Tmat &Rmat)
Map< M12, Unaligned, Stride< stride1, stride2 > > Map12
std::ostream & operator<<(std::ostream &out, ETensorR3< T, d0, d1, d2 > &R)