Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
embeddings.cppm File Reference

Canonical regular representations ℂ ↪ M₂, 𝔻 ↪ M₂. More...

#include <concepts>
#include <functional>
import dedekind.numbers;
import dedekind.analysis;
import dedekind.linear_algebra:mat2x2;
import dedekind.algebra;
Include dependency graph for embeddings.cppm:

Classes

struct  dedekind::linear_algebra::detail::ComplexToMatrix2x2Hom
struct  dedekind::linear_algebra::detail::DualToMatrix2x2Hom
struct  dedekind::category::is_homomorphism< dedekind::linear_algebra::detail::ComplexToMatrix2x2Hom, dedekind::numbers::Complex< dedekind::linear_algebra::detail::Rat >, std::plus< dedekind::numbers::Complex< dedekind::linear_algebra::detail::Rat > >, std::plus< dedekind::linear_algebra::Matrix2x2V< dedekind::linear_algebra::detail::Rat > > >
struct  dedekind::category::is_homomorphism< dedekind::linear_algebra::detail::ComplexToMatrix2x2Hom, dedekind::numbers::Complex< dedekind::linear_algebra::detail::Rat >, std::multiplies< dedekind::numbers::Complex< dedekind::linear_algebra::detail::Rat > >, std::multiplies< dedekind::linear_algebra::Matrix2x2V< dedekind::linear_algebra::detail::Rat > > >
struct  dedekind::category::is_homomorphism< dedekind::linear_algebra::detail::DualToMatrix2x2Hom, dedekind::analysis::Dual< dedekind::linear_algebra::detail::Rat >, std::plus< dedekind::analysis::Dual< dedekind::linear_algebra::detail::Rat > >, std::plus< dedekind::linear_algebra::Matrix2x2V< dedekind::linear_algebra::detail::Rat > > >
struct  dedekind::category::is_homomorphism< dedekind::linear_algebra::detail::DualToMatrix2x2Hom, dedekind::analysis::Dual< dedekind::linear_algebra::detail::Rat >, std::multiplies< dedekind::analysis::Dual< dedekind::linear_algebra::detail::Rat > >, std::multiplies< dedekind::linear_algebra::Matrix2x2V< dedekind::linear_algebra::detail::Rat > > >
class  dedekind::linear_algebra::Dual< F >
 Represents f(x) + f'(x)ε. More...
class  dedekind::linear_algebra::Complex< R >

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}}

Detailed Description

Canonical regular representations ℂ ↪ M₂, 𝔻 ↪ M₂.

@partition :embeddings

embeddings__Overview

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

Note
"Tout est nombre." — Pythagoras (attrib., via Aristotle, Metaphysics A.5) [Trans: "All is number."]

Function Documentation

◆ as_matrix2x2() [1/2]

Matrix2x2V< T > dedekind::linear_algebra::as_matrix2x2 ( const Complex< T > & z)
constexprexport

Regular representation of ℂ inside M₂(T): a + b·i ↦ [[a, -b], [b, a]].

embeddings__Canonical_Embedding_ℂ_↪_M₂

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.

Template Parameters
TA carrier supporting +, - (unary and binary), and * in the sense of IsComplexScalar.

◆ as_matrix2x2() [2/2]

template<typename T>
requires std::semiregular<T> && dedekind::algebra::HasRingOperators<T>
Matrix2x2V< T > dedekind::linear_algebra::as_matrix2x2 ( const Dual< T > & d)
constexprexport

Regular representation of 𝔻 inside M₂(T): a + b·ε ↦ [[a, b], [0, a]].

embeddings__Canonical_Embedding_𝔻_↪_M₂

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.

Template Parameters
TA carrier with ring-like arithmetic compatible with Dual<T>.

◆ complex_from_matrix2x2()

Complex< T > dedekind::linear_algebra::complex_from_matrix2x2 ( const Matrix2x2V< T > & M)
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.

◆ dual_from_matrix2x2()

template<typename T>
requires std::semiregular<T> && dedekind::algebra::HasRingOperators<T>
Dual< T > dedekind::linear_algebra::dual_from_matrix2x2 ( const Matrix2x2V< T > & M)
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.