10template<
template<
typename>
typename CRTP,
typename T, std::size_t
N>
14 static constexpr std::size_t
n_dim = N;
17 T *
data(
void) {
return this->
m.data(); }
18 const T *
data(
void)
const {
return this->
m.data(); }
21 std::array<T, N * N>
m = {};
24template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
29 static_cast<void*
>(this->data() + i *
mat::n_dim));
32template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
36 return *
static_cast<const vec_type*
>(
37 static_cast<const void*
>(this->data() + i *
mat::n_dim));
40template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
43 for(std::size_t c = 0; c != N; ++c)
44 ret[c] = this->
m[N * c + i];
48template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
51 for(std::size_t r = 0; r != N; ++r)
52 ret[r] = this->
m[N * i + r];
56template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
60 return static_cast<const CRTP<T>&
>(m0).
m
61 ==
static_cast<const CRTP<T>&
>(m1).m;
64template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
67 for(std::size_t i = 0; i != N; ++i)
72template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
77 for(std::size_t c = 0; c != N; ++c)
78 for(std::size_t r = 0; r != N; ++r)
79 for(std::size_t i = 0; i != N; ++i)
80 ret[c][r] += m0[i][r] * m1[c][i];
84template<
template<
typename>
typename CRTP,
typename T, std::size_t N>
89 for(std::size_t i = 0; i != N; ++i) {
90 const auto x =
m.row(i) *
v;
91 ret[i] = std::reduce(
begin(x),
end(x));
end
Definition: entities.lua:9
constexpr int N
Definition: lua.cpp:9
user_type T
Definition: register_test.cpp:22
constexpr const R * begin(const T< R > &v)
Definition: vec.h:207
typename vec_type< T, N >::type vec_type_t
Definition: vec.h:19
constexpr bool operator==(const mat< CRTP, T, N > &m0, const mat< CRTP, T, N > &m1)
Definition: mat.h:57
constexpr CRTP< T > operator*(T s, const mat< CRTP, T, N > &m)
Definition: mat.h:65
v[1]
Definition: math.lua:19
vec_type_t< T, N > vec_type
Definition: mat.h:13
T * data(void)
Definition: mat.h:17
constexpr vec_type & operator[](std::size_t i)
Definition: mat.h:25
std::array< T, N *N > m
Definition: mat.h:21
constexpr const vec_type & operator[](std::size_t i) const
Definition: mat.h:33
constexpr vec_type row(std::size_t i) const
Definition: mat.h:41
const T * data(void) const
Definition: mat.h:18
T type
Definition: mat.h:12
static constexpr std::size_t n_dim
Definition: mat.h:14
constexpr vec_type col(std::size_t i) const
Definition: mat.h:49
std::chrono::seconds s
Definition: timing.cpp:6