Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::linear_algebra::Matrix2x2V< T > Struct Template Referenceexport

Value-level 2×2 matrix — the runtime companion to NTTP Matrix2x2. More...

Collaboration diagram for dedekind::linear_algebra::Matrix2x2V< T >:

Public Types

using scalar_type = T
using column_type = Vec2V<T>
using row_type = Covec2V<T>
using dimension_type = dedekind::sets::Finite

Public Member Functions

constexpr column_type column (std::size_t i) const
 The i-th column (0-based). Out-of-range yields the zero column.
constexpr row_type row (std::size_t i) const
 The i-th row (0-based). Out-of-range yields the zero row.
template<typename Idx>
requires dedekind::order::IsDirectedSet<Idx> && std::convertible_to<Idx, std::size_t>
constexpr row_type operator[] (Idx const &i) const
 Indexed projection: m[i] = row(i), so m[i][j] resolves to the textbook entry m_{ij} via the row's own eval counit. Out-of-range i yields the zero row (same semantics as row()). Categorical reading: the curried form of the binary CCC eval eval: (T^2)^{2} × 2 × 2 → T at the matrix-shape carrier. Idx is gated by dedekind::order::IsDirectedSet — same algebraic net-domain anchor as Vec2V::operator[].
template<std::integral U, U I>
requires (static_cast<std::size_t>(I) < row_count)
constexpr row_type operator[] (std::integral_constant< U, I >) const
 Halfspace-gated static-row overload (#372 slice b). When the row index is encoded at the type level via {std::integral_constant<U,I>} for any {std::integral U}, the row halfspace {[0, row_count)} is decided at compile time; out-of-range indices fail to instantiate. Composes with Covec2V's static operator[] for full type-level {m[i][j]} bounds checking. Subsumes the 𝔹-indexed face — {Matrix2x2V<T> ≅ 𝔹 × 𝔹 → T}: with Covec2V's bool overload, {m[B_row][B_col]} is fully 𝔹-typed.
constexpr Matrix2x2V transpose () const
 Matrix transpose: reflect across the main diagonal.

Public Attributes

T m11 {}
T m12 {}
T m21 {}
T m22 {}

Static Public Attributes

static constexpr std::size_t row_count = 2
static constexpr std::size_t column_count = 2

Friends

constexpr bool operator== (const Matrix2x2V &, const Matrix2x2V &)=default
constexpr Matrix2x2V operator+ (const Matrix2x2V &A, const Matrix2x2V &B)
constexpr Matrix2x2V operator- (const Matrix2x2V &A, const Matrix2x2V &B)
constexpr Matrix2x2V operator- (const Matrix2x2V &A)
constexpr Matrix2x2V operator* (const T &s, const Matrix2x2V &A)
constexpr Matrix2x2V operator* (const Matrix2x2V &A, const T &s)
constexpr Matrix2x2V operator* (const Matrix2x2V &A, const Matrix2x2V &B)

Detailed Description

template<typename T>
requires std::semiregular<T> && dedekind::algebra::HasRingOperators<T>
struct dedekind::linear_algebra::Matrix2x2V< T >

Value-level 2×2 matrix — the runtime companion to NTTP Matrix2x2.

— the runtime companion to the

NTTP carriers above. Entries are ordinary constexpr fields; equality is value equality. Matrix2x2V is the paper-facing target of the ℂ/𝔻 regular representations in :embeddings.

Stores entries as ordinary constexpr-friendly fields. Row-major layout:

[[ m11, m12 ],
 [ m21, m22 ]]

Satisfies IsMatrix<M> and IsMatrixOverFieldRingLike<M, T> from :contracts: exposes row_count/column_count, column_type/row_type, both decompositions (via column(i) / row(i)), and the full ring-plus- transpose surface. Columns are Vec2V<T> (a 2×1 matrix from :vec2); rows are Covec2V<T> (a 1×2 matrix).

Member Function Documentation

◆ operator[]()

template<typename T>
template<typename Idx>
requires dedekind::order::IsDirectedSet<Idx> && std::convertible_to<Idx, std::size_t>
row_type dedekind::linear_algebra::Matrix2x2V< T >::operator[] ( Idx const & i) const
inlineconstexpr

Indexed projection: m[i] = row(i), so m[i][j] resolves to the textbook entry m_{ij} via the row's own eval counit. Out-of-range i yields the zero row (same semantics as row()). Categorical reading: the curried form of the binary CCC eval eval: (T^2)^{2} × 2 × 2 → T at the matrix-shape carrier. Idx is gated by dedekind::order::IsDirectedSet — same algebraic net-domain anchor as Vec2V::operator[].

Note
The composed expression m[i][j] is safe as a value expression: m[i] returns a Covec2V<T> by value, and Covec2V::operator[] returns T by value (lifetime extension applies to the prvalue chain). Binding the intermediate m[i] to a reference and then indexing .operator[] is also safe (reference-bound temporary lives for the full statement).

The documentation for this struct was generated from the following file: