amari-functional
Functional analysis on multivector spaces - Hilbert spaces, linear operators, spectral theory, and Sobolev spaces for Clifford algebras.
Overview
amari-functional provides the mathematical foundations of functional analysis applied to Clifford algebra-valued function spaces. The crate implements the complete hierarchy from vector spaces to Hilbert spaces, bounded linear operators with spectral decomposition, and Sobolev spaces for weak derivatives.
Features
- Space Hierarchy: VectorSpace → NormedSpace → BanachSpace → InnerProductSpace → HilbertSpace
- Finite-Dimensional Hilbert Spaces: Cl(P,Q,R) as 2^(P+Q+R)-dimensional Hilbert spaces
- L² Function Spaces: Square-integrable multivector-valued functions
- Linear Operators: Bounded, compact, self-adjoint, and Fredholm operators
- Matrix Operators: Explicit matrix representations with composition and norms
- Spectral Theory: Eigenvalue computation, spectral decomposition, functional calculus
- Eigenvalue Algorithms: Power method, inverse iteration, Jacobi algorithm
- Sobolev Spaces: H^k spaces with weak derivatives and Poincaré inequalities
- Phantom Types: Compile-time verification of operator properties
- Formal Verification: Optional Creusot contracts for theorem verification
Installation
Add to your Cargo.toml:
[]
= "0.14"
Feature Flags
[]
# Default features
= "0.14"
# With parallel computation (Rayon)
= { = "0.14", = ["parallel"] }
# With formal verification (Creusot)
= { = "0.14", = ["formal-verification"] }
Quick Start
Hilbert Space Operations
use ;
// Create the Hilbert space Cl(2,0,0) ≅ ℝ⁴
let space: = new;
// Create elements: 1 + 2e₁ and 3e₂ + 4e₁₂
let x = space.from_coefficients.unwrap;
let y = space.from_coefficients.unwrap;
// Inner product (these are orthogonal)
let ip = space.inner_product;
assert!;
// Norm and distance
let norm_x = space.norm;
let dist = space.distance;
// Orthogonal projection
let proj = space.project;
// Gram-Schmidt orthonormalization
let basis = space.basis;
let orthonormal = space.gram_schmidt;
Matrix Operators
use ;
use Multivector;
// Identity operator
let id: = identity;
// Diagonal operator
let diag = diagonal.unwrap;
// Apply to a vector
let x = from_slice;
let result = diag.apply.unwrap;
// result = [4, 3, 2, 1]
// Operator composition
let composed = diag.multiply.unwrap;
// Operator norm ||T||
let norm = diag.operator_norm;
// Check symmetry (self-adjointness)
assert!;
Spectral Decomposition
use MatrixOperator;
use ;
// Create a symmetric positive-definite matrix
let matrix = diagonal.unwrap;
// Compute spectral decomposition: T = Σᵢ λᵢ Pᵢ
let decomp = spectral_decompose.unwrap;
// Get eigenvalues
let eigenvalues = decomp.eigenvalues;
// [4.0, 3.0, 2.0, 1.0]
// Spectral properties
let radius = decomp.spectral_radius; // 4.0
let cond = decomp.condition_number; // Some(4.0)
let pos_def = decomp.is_positive_definite; // true
// Functional calculus: apply f(T) = √T
let x = from_slice;
let sqrt_Tx = decomp.apply_function;
// √T · e₀ = 2 · e₀
Eigenvalue Algorithms
use MatrixOperator;
use ;
let matrix = diagonal.unwrap;
// Power method: find dominant eigenvalue
let dominant = power_method.unwrap;
// dominant.eigenvalue.value ≈ 4.0
// Inverse iteration: find eigenvalue near a shift
let near_2 = inverse_iteration.unwrap;
// near_2.eigenvalue.value ≈ 2.0
// Jacobi algorithm: all eigenvalues
let all_eigs = compute_eigenvalues.unwrap;
// [4.0, 3.0, 2.0, 1.0]
Sobolev Spaces
use ;
use Domain;
use Multivector;
use Arc;
// Create H¹([0,1], Cl(2,0,0))
let h1: = unit_interval.with_quadrature_points;
// Define f(x) = x with f'(x) = 1
let f: = new;
// Compute H¹ norm: ||f||²_{H¹} = ||f||²_{L²} + ||f'||²_{L²}
let h1_norm = h1.hk_norm;
// ≈ √(1/3 + 1) = √(4/3) ≈ 1.155
// H¹ seminorm: |f|_{H¹} = ||f'||_{L²}
let seminorm = h1.hk_seminorm;
// ≈ 1.0
// Poincaré constant for [0,1]: C = 1/π
let domain = interval;
let poincare = poincare_constant_estimate;
// ≈ 0.318
L² Function Spaces
use ;
use Multivector;
// Create L²([0,1], Cl(2,0,0))
let l2: = unit_interval;
// Define f(x) = x · e₀
let f = new;
// Define g(x) = (1-x) · e₀
let g = new;
// L² norm: ||f||² = ∫₀¹ x² dx = 1/3
let norm = l2.norm;
// ≈ √(1/3) ≈ 0.577
// L² inner product: ⟨f,g⟩ = ∫₀¹ x(1-x) dx = 1/6
let ip = l2.inner_product;
// ≈ 0.167
Mathematical Background
Space Hierarchy
The crate implements the standard functional analysis hierarchy:
VectorSpace - Linear structure with addition and scalar multiplication
↓
NormedSpace - Adds norm ||·|| satisfying triangle inequality
↓
BanachSpace - Complete normed space (Cauchy sequences converge)
↓
InnerProductSpace - Adds inner product ⟨·,·⟩ with ||x||² = ⟨x,x⟩
↓
HilbertSpace - Complete inner product space
Clifford Algebra Hilbert Spaces
The Clifford algebra Cl(P,Q,R) is a 2^(P+Q+R)-dimensional real vector space equipped with the standard L² inner product on coefficients:
⟨x, y⟩ = Σᵢ xᵢ yᵢ
This makes Cl(P,Q,R) into a finite-dimensional Hilbert space isomorphic to ℝ(2(P+Q+R)).
Spectral Theorem
For a self-adjoint (symmetric) operator T on a finite-dimensional Hilbert space:
T = Σᵢ λᵢ Pᵢ
where λᵢ are real eigenvalues and Pᵢ are orthogonal projections onto eigenspaces.
Functional Calculus
For any function f: ℝ → ℝ, the operator f(T) is defined via spectral decomposition:
f(T) = Σᵢ f(λᵢ) Pᵢ
This enables computing matrix exponentials, square roots, logarithms, etc.
Sobolev Spaces
The Sobolev space W{k,p}(Ω, V) consists of functions f: Ω → V with weak derivatives up to order k in Lp. For p = 2, these are Hilbert spaces (H^k) with inner product:
⟨f, g⟩{H^k} = Σ{|α| ≤ k} ∫_Ω ⟨Dα f, Dα g⟩ dx
Poincaré Inequality
For functions with zero boundary conditions on a bounded domain Ω:
||f||{L²} ≤ C ||∇f||{L²}
The Poincaré constant C depends on the domain geometry (C = diam(Ω)/π for intervals).
Modules
| Module | Description |
|---|---|
space |
Vector spaces, normed spaces, Banach spaces, Hilbert spaces |
space::hilbert |
MultivectorHilbertSpace for finite-dimensional spaces |
space::multivector_l2 |
L² spaces of multivector-valued functions |
operator |
Linear operator traits and implementations |
operator::matrix |
Matrix representation of bounded operators |
operator::compact |
Compact and Fredholm operators |
spectral |
Eigenvalue algorithms and spectral decomposition |
sobolev |
Sobolev spaces H^k with weak derivatives |
phantom |
Compile-time property markers for operators |
error |
Error types for functional analysis operations |
Phantom Types
The crate uses phantom types for compile-time verification of operator properties:
use ;
// Type aliases for common operator types
use ;
Applications
Quantum Mechanics
use MatrixOperator;
use spectral_decompose;
use ;
// Hamiltonian with energy levels 0, 1, 2, 3
let hamiltonian = diagonal.unwrap;
// Spectral decomposition for energy eigenstates
let spectral = spectral_decompose.unwrap;
// Initial superposition state
let space = new;
let psi = space.normalize.unwrap;
// Expected energy ⟨ψ|H|ψ⟩
let h_psi = hamiltonian.apply.unwrap;
let expected_energy = space.inner_product;
// Time evolution: |ψ(t)⟩ = e^{-iHt}|ψ(0)⟩
let t = 1.0;
let evolved = spectral.apply_function;
Numerical PDEs
Sobolev spaces provide the natural setting for weak solutions to PDEs:
use ;
use Domain;
// H¹₀(Ω) for variational formulations
let h1 = new;
// Poincaré inequality: ||u||_{L²} ≤ C ||∇u||_{L²}
let domain = interval;
let poincare = poincare_constant_estimate;
// Energy norm for elliptic problems
// ||u||_a² = ∫ a(x)|∇u|² dx
Signal Processing
Hilbert space projections for signal approximation:
use ;
let space = new;
// Signal in the Hilbert space
let signal = space.from_coefficients.unwrap;
// Basis for approximation subspace
let e0 = space.basis_vector.unwrap;
let e1 = space.basis_vector.unwrap;
// Best approximation in subspace
let approx = space.best_approximation;
// Projection onto span{e₀, e₁}
Machine Learning
Kernel methods and reproducing kernel Hilbert spaces:
use MatrixOperator;
use spectral_decompose;
// Kernel matrix (Gram matrix)
let kernel = diagonal.unwrap;
// Spectral decomposition for kernel PCA
let decomp = spectral_decompose.unwrap;
// Leading eigenvalues capture most variance
let eigenvalues = decomp.eigenvalues;
let total_variance: f64 = eigenvalues.iter.map.sum;
let top_2_variance: f64 = eigenvalues.iter.take.map.sum;
let explained_ratio = top_2_variance / total_variance;
Error Handling
The crate provides comprehensive error types:
use ;
// Dimension mismatch
let err = dimension_mismatch;
// Convergence failure
let err = convergence_error;
// Invalid parameters
let err = invalid_parameters;
// Singular operator
let err = singular_operator;
Performance
- Finite-dimensional operations: O(n²) for matrix-vector, O(n³) for eigenvalue computation
- Numerical integration: Configurable quadrature points for accuracy/speed tradeoff
- Parallel support: Enable
parallelfeature for Rayon-based parallelism
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Part of Amari
This crate is part of the Amari mathematical computing library, providing:
- amari-core: Clifford algebra fundamentals
- amari-measure: Measure theory and integration
- amari-calculus: Differential geometry and manifolds
- amari-functional: Functional analysis (this crate)
- amari-info-geom: Information geometry
- And many more...
References
- Reed, M. & Simon, B. Methods of Modern Mathematical Physics (1980)
- Conway, J.B. A Course in Functional Analysis (1990)
- Hestenes, D. & Sobczyk, G. Clifford Algebra to Geometric Calculus (1984)
- Adams, R.A. Sobolev Spaces (1975)