|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Canonical regular representations ℂ ↪ M₂, 𝔻 ↪ M₂. More...
#include <concepts>#include <functional>import dedekind.numbers;import dedekind.analysis;import dedekind.linear_algebra:mat2x2;import dedekind.algebra;
Namespaces | |
| namespace | dedekind::linear_algebra::detail |
| namespace | dedekind::category |
Typedefs | |
| using | dedekind::linear_algebra::detail::Rat = dedekind::numbers::Rational<dedekind::numbers::default_integer> |
Functions | |
| template<typename T> requires dedekind::numbers::IsComplexScalar<T> && dedekind::algebra::HasRingOperators<T> | |
| constexpr Matrix2x2V< T > | dedekind::linear_algebra::as_matrix2x2 (const Complex< T > &z) |
| Regular representation of ℂ inside M₂(T): a + b·i ↦ [[a, -b], [b, a]]. | |
| template<typename T> requires dedekind::numbers::IsComplexScalar<T> && dedekind::algebra::HasRingOperators<T> | |
| constexpr Complex< T > | dedekind::linear_algebra::complex_from_matrix2x2 (const Matrix2x2V< T > &M) |
| Left inverse of as_matrix2x2 on matrices of complex form. | |
| template<typename T> requires std::semiregular<T> && dedekind::algebra::HasRingOperators<T> | |
| constexpr Matrix2x2V< T > | dedekind::linear_algebra::as_matrix2x2 (const Dual< T > &d) |
| Regular representation of 𝔻 inside M₂(T): a + b·ε ↦ [[a, b], [0, a]]. | |
| template<typename T> requires std::semiregular<T> && dedekind::algebra::HasRingOperators<T> | |
| constexpr Dual< T > | dedekind::linear_algebra::dual_from_matrix2x2 (const Matrix2x2V< T > &M) |
| Left inverse of as_matrix2x2 on matrices of dual form. | |
Variables | |
| constexpr Complex< Rat > | dedekind::linear_algebra::detail::z_probe {Rat{1L}, Rat{2L}} |
| constexpr Complex< Rat > | dedekind::linear_algebra::detail::w_probe {Rat{3L}, Rat{-5L}} |
| constexpr Dual< Rat > | dedekind::linear_algebra::detail::d_probe {Rat{2L}, Rat{3L}} |
| constexpr Dual< Rat > | dedekind::linear_algebra::detail::e_probe {Rat{-1L}, Rat{5L}} |
| constexpr Dual< Rat > | dedekind::linear_algebra::detail::eps_q {Rat{0L}, Rat{1L}} |
Canonical regular representations ℂ ↪ M₂, 𝔻 ↪ M₂.
@partition :embeddings
Two faithful ring homomorphisms, both spelled over the same 2×2 carrier Matrix2x2V<T> from :matrix:
ℂ ↪ M₂(T): a + b·i ↦ [[ a, -b ], [ b, a ]]
𝔻 ↪ M₂(T): a + b·ε ↦ [[ a, b ], [ 0, a ]]
The complex embedding is the classical regular representation of ℂ as rotation-and-scaling matrices; the dual embedding is the upper-triangular regular representation of 𝔻 = T[ε]/(ε²), with the nilpotent ε ↦ strict upper-triangular block.
Paper-facing carrier is T = Rational<long> (ℚ as an exact proxy for ℝ per the #364 / #366 narrowing). The two embeddings are witnessed by static_asserts that each map preserves the additive and multiplicative units and commutes with + and ·.
Wikipedia: Regular representation, Dual numbers, Automatic differentiation
|
constexprexport |
Regular representation of ℂ inside M₂(T): a + b·i ↦ [[a, -b], [b, a]].
An injective ring homomorphism: preserves +, ·, 0, and 1. The image is exactly the subring of rotation-and-scaling 2×2 matrices — matrices commuting with the canonical J = [[0, -1], [1, 0]] and closed under matrix addition and multiplication. Over T = Rational<Z> the map is exact and invertible on its image via complex_from_matrix2x2.
| T | A carrier supporting +, - (unary and binary), and * in the sense of IsComplexScalar. |
|
constexprexport |
Regular representation of 𝔻 inside M₂(T): a + b·ε ↦ [[a, b], [0, a]].
An injective ring homomorphism from the dual numbers 𝔻 = T[ε]/(ε²) into upper-triangular 2×2 matrices with equal diagonal. The nilpotent relation ε² = 0 lifts exactly to [[0, 1], [0, 0]]² = [[0, 0], [0, 0]]. Preserves +, ·, 0, and 1; witnessed below.
Forward-mode automatic differentiation (already reified on Dual<F>) is structurally the action of this embedding: applying a polynomial to Dual equals applying the polynomial to its matrix image.
| T | A carrier with ring-like arithmetic compatible with Dual<T>. |
|
constexprexport |
Left inverse of as_matrix2x2 on matrices of complex form.
Recovers (a, b) from [[a, -b], [b, a]] by reading the first column. complex_from_matrix2x2(as_matrix2x2(z)) == z for every z; the opposite direction is only true when M is in the image of ℂ ↪ M₂(T). The caller is responsible for that precondition.
|
constexprexport |
Left inverse of as_matrix2x2 on matrices of dual form.
Recovers (a, b) from [[a, b], [0, a]]. Precondition: M is in the image of 𝔻 ↪ M₂(T) — i.e. m11 == m22 and m21 == 0. Not enforced; see the complex_from_matrix2x2 note.