Linear Maps¶
Linear and affine maps between manifolds.
A LinearMap is itself a Manifold whose points are the parameters of the map. The main concrete implementation is EmbeddedMap, which combines a MatrixRep (from matrix.py) with domain/codomain embeddings to handle the project-multiply-embed pipeline. BlockMap sums several such maps for heterogeneous block structure, and AffineMap adds a bias term.
Class Hierarchy¶
Linear Maps¶
- class LinearMap[source]¶
-
A linear transformation between manifolds, which is itself a manifold (its points are the map’s parameters).
The key pattern: a
LinearMapknows its domain, codomain, and how to apply itself, transpose itself, and compute outer products. Concrete implementations choose how to store and execute the map.Mathematically, a linear map \(L: V \to W\) satisfies \(L(\alpha x + \beta y) = \alpha L(x) + \beta L(y)\).
- abstract property dom_man: Domain¶
The domain manifold.
- abstract property cod_man: Codomain¶
The codomain manifold.
- abstractmethod outer_product(w_coords: Array, v_coords: Array) Array[source]¶
Outer product \(w \otimes v\), returned as map parameters.
- abstractmethod map_domain_embedding(f: Callable[[LinearEmbedding[Manifold, Domain]], LinearEmbedding[Manifold, NewDomain]]) LinearMap[NewDomain, Codomain][source]¶
Transform the domain embedding(s) using the given function.
This enables operations like tensoring with a new factor by wrapping the domain embedding in a more complex structure.
- abstractmethod map_codomain_embedding(f: Callable[[LinearEmbedding[Manifold, Codomain]], LinearEmbedding[Manifold, NewCodomain]]) LinearMap[Domain, NewCodomain][source]¶
Transform the codomain embedding(s) using the given function.
This enables operations like tensoring with a new factor by wrapping the codomain embedding in a more complex structure.
- transpose_apply(f_coords: Array, w_coords: Array) Array[source]¶
Apply the transpose: takes map parameters and a codomain point, returns a domain point.
- prepend_embedding(emb: LinearEmbedding[Domain, NewDomain]) LinearMap[NewDomain, Codomain][source]¶
Prepend an embedding to the domain.
- append_embedding(emb: LinearEmbedding[Codomain, NewCodomain]) LinearMap[Domain, NewCodomain][source]¶
Append an embedding to the codomain.
Affine Maps¶
- class AffineMap(map_man: LinearMap[Domain, Codomain], dom_man: Domain)[source]¶
Bases:
Pair[Codomain,LinearMap],GenericA linear map plus a bias: \(A(x) = L(x) + b\).
Stored as a
Pairof the bias \(b\) (on the codomain) and the linear map \(L\). This is the natural parameter space for exponential family likelihoods (bias = observable natural parameters, linear part = interaction).- dom_man: Domain¶
The domain of the affine map.
- property fst_man: Codomain¶
First component manifold.