|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Full-rank 2×2 matrix with entries as non-type template parameters. More...
Public Types | |
| using | Domain = T |
| using | inverse_type = Invertible2x2<T, d / det, -b / det, -c / det, a / det> |
| Closed-form inverse via Cramer's rule. | |
Public Member Functions | |
| template<T a2, T b2, T c2, T d2> | |
| constexpr auto | operator* (Invertible2x2< T, a2, b2, c2, d2 >) const |
| Matrix-matrix composition at the type level: (A · B). | |
| template<T x, T y> | |
| constexpr auto | operator* (Vec2< T, x, y >) const |
| Left action on Vec2: the compile-time analogue of GL_2(T) × T² → T². | |
| constexpr auto | inverse () const |
| template<T a2, T b2, T c2, T d2> | |
| constexpr bool | operator== (Invertible2x2< T, a2, b2, c2, d2 >) const |
| Componentwise equality. | |
Static Public Attributes | |
| static constexpr T | m11 = a |
| static constexpr T | m12 = b |
| static constexpr T | m21 = c |
| static constexpr T | m22 = d |
| static constexpr T | det = a * d - b * c |
Full-rank 2×2 matrix with entries as non-type template parameters.
block-Schur invertibility program (#366). Entries live in the type.
Entry layout:
M = [[ a, b ],
[ c, d ]]
det(M) = a·d − b·c (non-zero; enforced at instantiation)
The type carries the entries structurally, so M * M.inverse() is a compile-time expression whose result type IS the identity matrix when the inverse is exact over T (always true for T = Rational<Z>).
| T | Structural (C++20 NTTP-compatible) carrier type with ring-like arithmetic. Rational<Z> over any IsInteger Z is the canonical choice for the paper-facing ℚ proof. |
| a,b,c,d | Entries as NTTPs of type T. |
| using dedekind::linear_algebra::Invertible2x2< T, a, b, c, d >::inverse_type = Invertible2x2<T, d / det, -b / det, -c / det, a / det> |
Closed-form inverse via Cramer's rule.
M^{-1} = (1 / det(M)) · [[ d, -b ], [-c, a ]]
Exact over T = Rational<Z> (any integer Z) and over integer matrices whose determinant is ±1. For carriers where the division is not exact (e.g. int with |det| > 1) this expression loses information silently; use Rational<Z> for the paper-facing existential proof.
|
inlineconstexpr |
Matrix-matrix composition at the type level: (A · B).
The result is Invertible2x2<T, …> whose entries are the NTTP-evaluated products-and-sums of the operands'. Invertibility is preserved: the product of two invertible matrices is invertible, and the result type's own static_assert re-checks this as a belt-and-braces guard against carriers where a determinant might underflow.
|
inlineconstexpr |
|
inlineconstexpr |
Componentwise equality.
Because entries are NTTPs, this is a strictly type-level comparison — distinct matrices have distinct types, and the equality is decided at instantiation.