Continuous Spaces¶
Continuous topological spaces and their properties.
spaces
¶
Continuous measurable spaces for the hybrid architecture.
Continuous space objects serve as domains and codomains for continuous
morphisms. They complement quivers.core.objects (FinSet etc.) used
by discrete morphisms.
The space family is a sum type:
Euclidean— :math:\mathbb{R}^dwith optional boundsSimplex— probability simplex overdcomponentsPositiveReals— :math:(0, \infty)^dProductSpace— cartesian product of continuous spaces
UnitInterval is a convenience factory for [0, 1]^d.
ContinuousSpace
¶
Bases: TaggedUnion
Continuous measurable space (Euclidean, Simplex, PositiveReals, Product).
Variants expose name: str and dim: int either as fields (the
atomic variants) or as derived properties (ProductSpace),
plus a contains predicate over the support.
contains
¶
contains(x: Tensor) -> Tensor
Check whether points lie in the support.
Source code in src/quivers/continuous/spaces.py
43 44 45 | |
sample_uniform
¶
sample_uniform(n: int) -> Tensor
Sample n points uniformly from the space.
Source code in src/quivers/continuous/spaces.py
47 48 49 50 51 | |
Euclidean
¶
Simplex
¶
Bases: ContinuousSpace
The probability simplex :math:\{x \in \mathbb{R}^d : x_i \geq 0, \sum x_i = 1\}.
PositiveReals
¶
CholeskyFactor
¶
Bases: ContinuousSpace
The manifold of :math:K \times K lower-triangular Cholesky factors.
Each element is a lower-triangular matrix :math:L whose rows
have unit norm: :math:L_{ii}^2 + \sum_{j<i} L_{ij}^2 = 1 for
every :math:i. The product :math:L L^T is then a
correlation matrix. The standard parameterization places
:math:L on a :math:K(K-1)/2-dimensional manifold.
Carrier represented as a flat :math:K \times K array
(row-major); the on-manifold constraint is enforced by the
sampling family
(quivers.continuous.families.LKJCorrelationFactor)
and not by the type itself.
ProductSpace
¶
Bases: ContinuousSpace
Cartesian product of continuous spaces (and discrete objects).
Components may be a mix of ContinuousSpace variants and
quivers.core.objects.SetObject variants — programs whose
domain or codomain combines discrete and continuous variables produce
such a ProductSpace at compile time. Nested products are flattened
on construction; name and dim are derived from
components (for SetObject components, dim falls back
to len(component.shape)).
Sphere
¶
Bases: ContinuousSpace
The unit sphere :math:S^{N-1} = \{x \in \mathbb{R}^N : \|x\|_2 = 1\}.
Ambient dimension is dim = N; the manifold dimension is N - 1.
Carrier represented as an (N,) tensor; the unit-norm constraint
is enforced by the sampling family (e.g. von Mises-Fisher),
not by the type itself.
Ball
¶
Bases: ContinuousSpace
The closed ball :math:\{x \in \mathbb{R}^N : \|x\|_2 \le r\}.
Carrier represented as an (N,) tensor. The radius field
fixes r; the default r = 1 produces the unit ball.
Covariance
¶
Bases: ContinuousSpace
The cone of :math:D \times D symmetric positive-definite matrices.
Used as the codomain of Wishart-shaped families. Carrier
represented as a flat (D*D,) tensor (row-major); the
positivity constraint is enforced by the sampling family.
Correlation
¶
Bases: ContinuousSpace
The manifold of :math:D \times D correlation matrices.
A correlation matrix is symmetric positive-definite with unit
diagonal: :math:R_{ii} = 1 and :math:R \succ 0. Used as the
codomain of LKJ correlation priors. Carrier represented as a
flat (D*D,) tensor.
Orthogonal
¶
Bases: ContinuousSpace
The orthogonal group :math:O(D) = \{Q \in \mathbb{R}^{D \times D} : Q^T Q = I\}.
Carrier represented as a flat (D*D,) tensor. The orthogonality
constraint is enforced by the sampling family; sample_uniform
produces Haar-distributed elements via QR decomposition of a
standard Gaussian (the Mezzadri construction).
Stiefel
¶
Bases: ContinuousSpace
The Stiefel manifold :math:V_K(\mathbb{R}^N) = \{X \in \mathbb{R}^{N \times K} : X^T X = I_K\}.
Generalises Orthogonal to rectangular orthonormal-column
matrices. rows is :math:N, cols is :math:K; require
:math:K \le N. The base dim field is :math:N, kept
for the standard event_shape = (dim,) contract; the actual
carrier is flat with shape (N*K,).
LowerTriangular
¶
Bases: ContinuousSpace
The space of :math:D \times D lower-triangular matrices.
The carrier holds a flat (D*D,) tensor; the structural zero
constraint on the strictly upper-triangular entries is enforced
by the sampling family / parameterization. Used as a
parameterization carrier for Cholesky-style decompositions
when no diagonal-sign constraint is required.
Diagonal
¶
Bases: ContinuousSpace
The space of :math:D \times D diagonal matrices.
Identified with :math:\mathbb{R}^D via the natural diagonal
embedding; the carrier holds a flat (D,) tensor of diagonal
entries. Used as the codomain of independent-variance
parameterizations where each component carries its own scalar
variance.
UnitInterval
¶
UnitInterval(name: str, dim: int = 1) -> Euclidean
Create a :math:[0, 1]^d bounded Euclidean space.
Source code in src/quivers/continuous/spaces.py
99 100 101 | |