35 std::array<real, N>
data{};
77 std::array<real, M * N>
data{};
90 static_assert(
M == N,
"identity() requires a square matrix");
99 for (
idx j = 0;
j < N; ++
j)
100 t(
j,
i) = (*this)(
i,
j);
109 for (
idx k = 0;
k < N; ++
k)
119 for (
idx j = 0;
j < N; ++
j)
120 y[
i] += (*
this)(
i,
j) * x[
j];
154 return {
a /
r,
b /
r};
constexpr SmallVec< N > operator*(real s, SmallVec< N > v) noexcept
constexpr SmallVec< N > operator+(SmallVec< N > a, const SmallVec< N > &b) noexcept
constexpr T ipow(T x) noexcept
Compute x^N at compile time via repeated squaring.
Givens plane rotation: G = [c, s; -s, c].
constexpr void apply(real &x, real &y) const noexcept
Apply G from the left: [x; y] <- G * [x; y].
constexpr void apply_t(real &x, real &y) const noexcept
Apply G^T (inverse rotation): [x; y] <- G^T * [x; y].
constexpr SmallMatrix< 2, 2 > as_matrix() const noexcept
Return the 2x2 rotation matrix.
static constexpr GivensRotation from(real a, real b) noexcept
Constexpr fixed-size row-major matrix (stack-allocated).
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
Matrix-vector product: (MxN) * (N) -> (M).
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
Matrix multiplication: (M x N) * (N x K) -> (M x K).
Constexpr fixed-size dense vector (stack-allocated).
static constexpr idx size() noexcept
constexpr real norm_sq() const noexcept
Sum of squares (avoid sqrt to stay constexpr in C++17).
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