13 std::array<real, N>
data{};
17 static constexpr idx size() noexcept {
return N; }
20 for (
idx i = 0; i < N; ++i) {
27 for (
idx i = 0; i < N; ++i) {
34 for (
idx i = 0; i < N; ++i) {
42 for (
idx i = 0; i < N; ++i) {
43 s +=
data[i] * o.data[i];
63 std::array<real, M * N>
data{};
68 return data[i * N + j];
71 static constexpr idx rows() noexcept {
return M; }
72 static constexpr idx cols() noexcept {
return N; }
79 static_assert(M == N,
"identity() requires a square matrix");
81 for (
idx i = 0; i < M; ++i) {
89 for (
idx i = 0; i < M; ++i) {
90 for (
idx j = 0; j < N; ++j) {
91 t(j, i) = (*this)(i, j);
100 for (
idx i = 0; i < M; ++i) {
101 for (
idx k = 0; k < N; ++k) {
102 for (
idx j = 0; j < K; ++j) {
103 C(i, j) += (*this)(i, k) * B(k, j);
112 for (
idx i = 0; i < M; ++i) {
113 for (
idx j = 0; j < N; ++j) {
114 y[i] += (*this)(i, j) * x[j];
121 for (
idx k = 0; k < M * N; ++k) {
128 for (
idx k = 0; k < M * N; ++k) {
144 const real r = std::sqrt(a * a + b * b);
145 return {a / r, b / r};
149 const real tmp =
c * x +
s * y;
155 const real tmp =
c * x -
s * y;
constexpr SmallVec< N > operator*(real s, SmallVec< N > v) noexcept
constexpr SmallVec< N > operator+(SmallVec< N > a, const SmallVec< N > &b) noexcept
constexpr void apply(real &x, real &y) const noexcept
constexpr void apply_t(real &x, real &y) const noexcept
constexpr SmallMatrix< 2, 2 > matrix() const noexcept
static constexpr GivensRotation from(real a, real b) noexcept
Construct .
static constexpr SmallMatrix identity() noexcept
static constexpr idx cols() noexcept
constexpr SmallMatrix & operator+=(const SmallMatrix &o) noexcept
constexpr SmallMatrix< N, M > transposed() const noexcept
static constexpr SmallMatrix zeros() noexcept
constexpr real & operator()(idx i, idx j) noexcept
constexpr SmallVec< M > operator*(const SmallVec< N > &x) const noexcept
constexpr void fill(real v) noexcept
static constexpr idx rows() noexcept
constexpr SmallMatrix & operator*=(real s) noexcept
std::array< real, M *N > data
constexpr const real & operator()(idx i, idx j) const noexcept
constexpr SmallMatrix< M, K > operator*(const SmallMatrix< N, K > &B) const noexcept
static constexpr idx size() noexcept
constexpr real norm_sq() const noexcept
constexpr SmallVec & operator+=(const SmallVec &o) noexcept
constexpr real dot(const SmallVec &o) const noexcept
constexpr SmallVec & operator-=(const SmallVec &o) noexcept
constexpr const real & operator[](idx i) const noexcept
constexpr real & operator[](idx i) noexcept
std::array< real, N > data
constexpr SmallVec & operator*=(real s) noexcept