|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
Finite-dim linear maps with algebraic witnesses. More...
#include <array>#include <concepts>#include <cstddef>#include <initializer_list>#include <utility>import dedekind.geometry:affine;import dedekind.category;import dedekind.algebra;
Classes | |
| class | dedekind::geometry::LinearMap< F, Rows, Cols > |
| A dense compile-time-sized linear map F^Cols -> F^Rows. More... | |
| class | dedekind::geometry::DifferentiableMap< F, DomainDim, CodomainDim, ValueFn, JacobianFn > |
| A finite-dimensional map paired with a user-supplied Jacobian witness. More... | |
| struct | dedekind::geometry::TangentBundlePoint< F, N > |
| A point in the tangent bundle T(F^N) = F^N × F^N. More... | |
| struct | dedekind::geometry::CotangentBundlePoint< F, N > |
| A point in the cotangent bundle T*(F^N) = F^N × (F^N)*. More... | |
Concepts | |
| concept | dedekind::geometry::IsMatrixScalar |
| A scalar type that can serve as coefficients in a LinearMap. | |
| concept | dedekind::geometry::HasMatrixScalarEmbedding |
| Floating carrier that is admissible as a matrix scalar by policy. | |
| concept | dedekind::geometry::HasJacobianAt |
| Map-like object exposing a finite-dimensional LinearMap Jacobian. | |
| concept | dedekind::geometry::IsLinearMapModule |
| Verify that LinearMap<F, R, C> behaves as a module over scalar F. | |
Macros | |
| #define | DEDEKIND_ENABLE_DOUBLE_REAL_PROXY 0 |
Typedefs | |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| using | dedekind::geometry::Matrix = LinearMap<F, Rows, Cols> |
| template<IsMatrixScalar F, std::size_t N> | |
| using | dedekind::geometry::Covector = LinearMap<F, 1, N> |
| Covector: a linear functional F^N -> F, represented as a row vector. | |
| template<std::size_t Rows, std::size_t Cols> | |
| using | dedekind::geometry::RealMatrix = LinearMap<double, Rows, Cols> |
| RealMatrix: machine-real matrix alias behind explicit opt-in. | |
| template<IsMatrixScalar F, std::size_t N> | |
| using | dedekind::geometry::TangentVector = Vector<F, N> |
| TangentVector at a point in F^N. | |
| template<IsMatrixScalar F, std::size_t N> | |
| using | dedekind::geometry::CotangentVector = Covector<F, N> |
| CotangentVector at a point in F^N. | |
Functions | |
| template<typename F> requires std::floating_point<F> && IsMatrixScalar<F> | |
| constexpr F | dedekind::geometry::embed_matrix_scalar (F value) noexcept |
| Explicit embedding witness from floating carriers into matrix scalars. | |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator+ (const LinearMap< F, Rows, Cols > &a, const LinearMap< F, Rows, Cols > &b) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator- (const LinearMap< F, Rows, Cols > &a, const LinearMap< F, Rows, Cols > &b) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator- (const LinearMap< F, Rows, Cols > &a) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator* (const F &scalar, const LinearMap< F, Rows, Cols > &a) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator* (const LinearMap< F, Rows, Cols > &a, const F &scalar) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr Vector< F, Rows > | dedekind::geometry::operator* (const LinearMap< F, Rows, Cols > &a, const Vector< F, Cols > &v) |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Inner, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::operator* (const LinearMap< F, Rows, Inner > &a, const LinearMap< F, Inner, Cols > &b) |
| template<IsMatrixScalar F, std::size_t N> | |
| constexpr LinearMap< F, N, N > | dedekind::geometry::identity_linear_map () |
| template<IsMatrixScalar F, std::size_t Rows, std::size_t Cols> | |
| constexpr LinearMap< F, Rows, Cols > | dedekind::geometry::zero_linear_map () |
| template<IsMatrixScalar F, std::size_t DomainDim, std::size_t CodomainDim, typename ValueFn, typename JacobianFn> | |
| constexpr auto | dedekind::geometry::make_differentiable_map (ValueFn value, JacobianFn jacobian) |
| Construct a finite-dimensional differentiable map from primal and Jacobian callables. | |
| template<HasJacobianAt Map> | |
| constexpr auto | dedekind::geometry::jacobian_at (const Map &map, const typename Map::Domain &x) -> typename Map::Jacobian |
| Return the Jacobian of a finite-dimensional differentiable map. | |
| template<HasJacobianAt Map> | |
| constexpr auto | dedekind::geometry::frechet_derivative_at (const Map &map, const typename Map::Domain &x) -> typename Map::Jacobian |
| Return the Fr\'echet derivative of a finite-dimensional map. | |
|
template<HasJacobianAt Map> requires (Map::codomain_dimension == 1) && std::same_as< typename Map::Jacobian, Covector<typename Map::scalar_type, Map::domain_dimension>> | |
| constexpr Covector< typename Map::scalar_type, Map::domain_dimension > | dedekind::geometry::differential_at (const Map &map, const typename Map::Domain &x) |
| Return the scalar-valued differential as a covector. | |
| template<IsMatrixScalar F, std::size_t M, std::size_t N> | |
| constexpr LinearMap< F, M, N > | dedekind::geometry::outer (const Vector< F, M > &u, const Vector< F, N > &v) |
| Outer product u ⊗ v : F^N -> F^M. | |
Finite-dim linear maps with algebraic witnesses.
@partition :linear_map
LinearMap<F, R, C> represents a finite-dimensional linear map F^C -> F^R and serves as an algebraic carrier for the theory of modules and vector spaces.
Algebraic Status:
The structure ensures that both external operations (scalar action) and internal operations (matrix addition) satisfy the Linear Action Axioms:
The current LinearMap<F, R, C> is a dense matrix implementation with compile-time fixed dimensions. This design is appropriate for:
For other use cases, the architecture supports extensions:
The semimodule axioms are independent of storage representation, so any alternative matrix type implementing the same arithmetic operations will automatically satisfy the same algebraic structure (if F is a semiring).
DifferentiableMap, the Jacobian from dual propagation.
|
export |
CotangentVector at a point in F^N.
The cotangent space T*_p(F^N) ≅ (F^N)* is the dual of the tangent space. In the finite-dimensional flat case this is canonically represented as a row vector (Covector), i.e. a LinearMap<F, 1, N>.
FIXME(https://github.com/vincentk/dedekind/issues/185): Replace the extensional dimension parameter with a first-class dimension witness once the flat geometry carrier is widened accordingly.
|
export |
Covector: a linear functional F^N -> F, represented as a row vector.
Core Algebraic Theorem: LinearMap<F, R, C> is always a Semimodule over the scalar semiring F.
This means:
Refinements for Special Scalar Types:
Note on Matrix Multiplication (Non-Commutativity): Square matrices M^{n×n} form a ring under matrix addition and composition, but this ring is NON-COMMUTATIVE. However, the semimodule structure of arbitrary matrices is unaffected by composition, since composition only applies to square matrices and acts as an additional binary operation.
A covector (dual vector / linear functional) is canonically a LinearMap<F, 1, N>: it maps a column vector to a length-1 column vector whose single entry is the inner product of the row with the argument.
Covectors form the dual module Hom_F(V, F), where V = F^N. When F is a field, the dual module is isomorphic to V itself.
FIXME(https://github.com/vincentk/dedekind/issues/185): Generalize this alias from the current extensional finite-dimensional carrier to a first-class dimension/cardinality witness once the geometry layer is lifted beyond LinearMap<F, 1, N>.
|
export |
RealMatrix: machine-real matrix alias behind explicit opt-in.
The following type aliases provide semantic naming for matrices over specific algebraic structures. Each specialization documents the algebraic guarantees of the linear map as a module/vector space.
Provided Alias:
All specializations are Semimodules at minimum (over the semiring formed by their scalar type). When the scalar forms a ring or field, the matrix carries the corresponding module or vector space structure.
Additional aliases (for complex/rational carriers) are planned and should be introduced only once their scalar/vector contracts are implemented in this partition.
Policy: This alias is only available when DEDEKIND_ENABLE_DOUBLE_REAL_PROXY=1 is set at build time.
Algebraic Interpretation: treated as vector-space-like under the active numeric policy (not as a strict field proof).
Satisfies the linear action laws operationally:
This alias is the explicit machine-real lift into the current finite matrix carrier. It remains intentionally extensional for this PR.
FIXME(https://github.com/vincentk/dedekind/issues/185): Generalize the geometry layer from fixed extensional dimensions to first-class dimension witnesses where the surrounding carrier supports it.
For square matrices (R == C), composition forms a non-commutative ring.
|
export |
TangentVector at a point in F^N.
For the flat manifold F^N, the tangent space T_p(F^N) ≅ F^N for every base-point p. The alias makes the geometric role explicit without introducing any new data.
TangentVector is the fibre element (a single tangent vector), not a tangent-bundle carrier on its own — the latter is a (point, tangent vector) pair, captured by TangentBundlePoint below at the geometric level and by IsTangentBundle in :tangent at the algebraic-ring level. Dual<F> in dedekind.analysis:dual is the canonical IsTangentBundle witness; forward-mode AD on Dual<F> is arithmetic in the tangent-bundle ring T(Spec F).
|
constexprexportnoexcept |
Explicit embedding witness from floating carriers into matrix scalars.
This is the policy gate for admitting machine floating carriers into the matrix layer. In particular, double is only embeddable when DEDEKIND_ENABLE_DOUBLE_REAL_PROXY=1.
|
constexprexport |
Return the Fr\'echet derivative of a finite-dimensional map.
In the current finite-dimensional slice, this coincides with the Jacobian.
|
constexprexport |
Outer product u ⊗ v : F^N -> F^M.
Constructs the rank-1 linear map whose (i,j) coefficient is u[i]*v[j]. Applied to a vector w, it yields dot(v,w) * u (the dyadic product).
Algebraic Properties: