Visual intuition · graduate-level mathematics

A space
of subspaces.

The Grassmannian turns a line, a plane, or a learned subspace into a single geometric point. Change its basis; keep its identity.

FIVE LIVE LABS · REAL & AFFINE GEOMETRY
INCLUDING LUSK & HOW’S DATA-ASSOCIATION METHOD
Two different orthonormal bases drawn within the same plane through the origin.
01 / Subspaces02 / Angles03 / Motion04 / Learning05 / Data associationSources
01 / What is a point?

The plane is the object. A basis is its coordinate system.

We write Gr(k,n) for the set of k-dimensional linear subspaces of ℝⁿ, with 0 < k < n. All these subspaces contain the origin. Our notation puts the subspace dimension first; some references use Gr(n,k).

Many matrices, one point

\[Q\in\mathbb R^{n\times k},\quad Q^\top Q=I_k\]
\[[Q]=\{QO:O\in O(k)\}\]

Columns of Q form an orthonormal basis. Multiplying by an orthogonal O rotates or reflects that basis without changing its span. The quotient identifies all such matrices.

A unique projector

\[P=QQ^\top,\qquad P^2=P=P^\top\]
\[(QO)(QO)^\top=QQ^\top\]

P is the orthogonal projector onto the subspace. For a vector x, Px is its least-squares projection. The trace of P equals k.

The Stiefel manifold St(k,n) keeps the particular ordered orthonormal frame Q. The Grassmannian removes its k(k−1)/2 internal rotational degrees of freedom:

\[\mathrm{Gr}(k,n)=\mathrm{St}(k,n)/O(k),\qquad \dim\mathrm{Gr}(k,n)=k(n-k).\]
LAB 01 / BASIS INVARIANCEOpen full lab ↗

Gr(1,3) is the real projective plane: a unit vector and its negative define the same line. It is not the sphere itself. Gr(2,3) can similarly be represented by a plane normal with n and −n identified. An offset plane belongs to the affine Grassmannian.

02 / Comparing subspaces

Principal angles remove the choice of basis.

Subtracting two basis matrices measures their coordinate choices as well as their geometry. Instead, compare how well their directions align.

\[Q^\top Y=U\operatorname{diag}(\cos\theta_1,\ldots,\cos\theta_k)V^\top,\quad 0\leq\theta_1\leq\cdots\leq\theta_k\leq\pi/2.\]

The first angle finds the best-aligned pair of unit vectors, one from each subspace. Subsequent pairs are constrained to be orthogonal to the previously chosen directions. Singular values make the result invariant to independent basis rotations.

Intrinsic geodesic distance

\[d_g([Q],[Y])=\sqrt{\sum_i\theta_i^2}.\]

Use angles in radians. This is the shortest path length for the canonical Grassmann metric, whose horizontal tangent inner product is the Frobenius inner product.

Projection distance

\[d_p=\frac{\|QQ^\top-YY^\top\|_F}{\sqrt{2}}=\sqrt{\sum_i\sin^2\theta_i}.\]

A distance in projector coordinates. It approximates dg for small angles but is not the same global quantity. We name the normalization explicitly because “chordal” conventions vary.

LAB 02 / TWO PRINCIPAL ANGLESOpen full lab ↗

Why use Gr(2,4) here? Two planes in ℝ³ intersect in at least a line, so their first principal angle is always zero. Four dimensions allow both angles to vary independently.

03 / Moving on the manifold

A tangent changes the subspace, then a curve stays on it.

Horizontal tangent

\[Q^\top\Delta=0,\qquad\Pi_Q(Z)=(I-QQ^\top)Z.\]

QΩ with skew-symmetric Ω rotates the basis inside its current subspace. A horizontal Δ moves toward the orthogonal complement and represents a tangent to the quotient.

Metric convention

\[g_Q(\Delta_1,\Delta_2)=\operatorname{tr}(\Delta_1^\top\Delta_2).\]

In projector coordinates the corresponding metric is one half of the Frobenius inner product. Keeping this factor is what makes the geodesic distance equal to ‖θ‖₂.

For a compact SVD Δ = UΣVᵀ of rank r, the exponential map has an orthonormal representative

\[Q(t)=Q+QV\big(\cos(t\Sigma)-I_r\big)V^\top+U\sin(t\Sigma)V^\top.\]

It starts at Q with velocity Δ. Sines and cosines rotate each active direction toward the orthogonal complement. The curve remains defined beyond the shortest-path interval; the distance from the start need not then equal its traveled length.

LAB 03 / GEODESIC INTERPOLATIONOpen full lab ↗

A local logarithm

When QᵀY is invertible, form

\[Z=(I-QQ^\top)Y(Q^\top Y)^{-1}=U\Sigma V^\top.\]
\[\operatorname{Log}_{[Q]}[Y]=U\arctan(\Sigma)V^\top.\]

This is a horizontal representative. At a principal angle of π/2 the inverse fails and a shortest logarithm is not unique. Near this boundary, use numerically robust algorithms from the handbook.

A practical retraction

\[R_Q(\Delta)=\operatorname{qf}(Q+\Delta).\]

QR orthonormalization provides a cheaper local approximation with the correct first-order behavior. It represents a subspace regardless of QR column signs. A retraction is generally not the exact exponential map.

04 / An optimization problem

PCA learns a subspace, not a particular basis.

For centered data with covariance C, the best rank-k orthogonal reconstruction maximizes captured variance.

\[\min_{[Q]\in\mathrm{Gr}(k,n)}f(Q)=-\operatorname{tr}(Q^\top CQ),\quad \operatorname{grad}f(Q)=-2(I-QQ^\top)CQ.\]

The objective is unchanged under Q → QO. Project the Euclidean gradient to the horizontal tangent, take a step, then retract. Our lab uses backtracking to require sufficient improvement. The leading k-dimensional eigenspace gives an independent reference solution.

LAB 04 / PCA ON Gr(2,3)Open full lab ↗

A repeated eigenvalue within the selected subspace does not destroy uniqueness of that subspace. What matters is the boundary gap λk > λk+1. The same geometric viewpoint appears in subspace tracking, reduced models, and signal processing.

For complex signal subspaces, replace Qᵀ by Qᴴ and O(k) by U(k). The complex Grassmannian has complex dimension k(n−k), or real dimension 2k(n−k). All five labs on this page use real matrices.

05 / The requested paper

Global data association with lines and planes.

Lusk & How (2022), “Global Data Association for SLAM with 3D Grassmannian Manifold Objects”, builds a consistency graph from affine objects in two lidar scans. The association step needs no initial relative-pose guess.

From linear to affine

\[\mathcal A=b+\operatorname{span}(A),\quad b_\perp=(I-AA^\top)b.\]

A 3-D line uses k = 1; a plane uses k = 2. Translation along the object does not create a new affine subspace. Its dimension is (k+1)(n−k).

\[Y=\begin{bmatrix}A & b_\perp/\sqrt{1+\|b_\perp\|^2}\\0 & 1/\sqrt{1+\|b_\perp\|^2}\end{bmatrix}.\]

These orthonormal coordinates embed Graff(k,3) into Gr(k+1,4). Our coordinates are made dimensionless by dividing positions by a length scale ρ.

Shift before embedding

Directly applying the embedding depends on the global origin. For a pair, the paper first shifts both stored affine anchors by −b₁:

\[\widetilde b_1=0,\qquad\widetilde b_2=(b_2-b_1)/\rho.\]

Only then compute the perpendicular displacement and the embedding. Under a shared rigid transform, this relative displacement rotates but the translation cancels. Compare the same ordered pair in both scans.

Lab experiment: change the translation, then switch between shifted and raw affine descriptors.

  1. Generate candidates. A vertex represents Aᵢ ↔ Bⱼ. Only same-type matches are candidates: lines match lines and planes match planes.
  2. Compare pairs inside each scan. For candidates u = (i,j) and v = (p,q), compute c = |d(Aᵢ,Aₚ) − d(Bⱼ,Bq)|. These within-scan pairs may mix a line and a plane.
  3. Score compatibility. Keep an edge if c < ε, with weight exp(−c²/(2σ²)). Reusing either source or target object makes an edge forbidden. Set the diagonal to one.
  4. Select a consistent set. Maximize uᵀMu/uᵀu over nonempty binary selections with no forbidden pairs. Weighted density can favor a smaller, stronger clique over a larger, weaker one.
  5. Estimate the transform. The paper then aligns matched lines and planes by least squares. This final registration stage is outside this association lab.
LAB 05 / AFFINE GRASSMANNIAN ASSOCIATIONOpen full lab ↗

For mixed object dimensions, the paper uses the norm of the min(k₁+1,k₂+1) principal angles. It can be zero for containment between different dimensions; it is not a separating metric on their union. Same-type candidate matching and mixed-type pairwise consistency are different operations.

What the demo implements

The affine embedding, pair shift and scale, consistency weights, one-to-one exclusions, and discrete density objective follow equations (2)–(5), (8)–(9), and Proposition 1 of the supplied paper. Every feasible clique is enumerated on this small graph, including nonmaximal cliques. The paper uses the scalable CLIPPER relaxation. This browser experiment uses synthetic objects and transformed anchors, without lidar segmentation, pose estimation, or a KITTI benchmark. Ground-truth identities are used only for reporting recovery, never for scoring or selection.

Our scene uses ρ = 3 m, ε = 0.16 rad and σ = 0.05 rad. The paper reports ρ = 40 m, ε = 0.2 and σ = 0.02 for its KITTI experiments. Anchor perturbations and direction noise are explicit controls; the drawing shows finite windows of infinite objects. Different extracted patches may produce different anchors, so the controlled rigid-transform test is distinct from end-to-end lidar performance.

Primary sources & reproducibility

Continue from the mathematics to the algorithms.

Bendokat, Zimmermann & Absil. A Grassmann Manifold Handbook: Basic Geometry and Computational Aspects. Quotient and projector geometry, canonical metric, exponential, logarithm and cut locus. We use Gr(k,n); the handbook uses Gr(n,k).

Edelman, Arias & Smith (1998). The Geometry of Algorithms with Orthogonality Constraints. Grassmann gradients and geodesics (§2.5), distance conventions (§4.5), and eigenspace optimization.

Lusk & How (2022). Global Data Association for SLAM with 3D Grassmannian Manifold Objects. The supplied paper, especially §II-A, §III, Proposition 1 and Appendix A. The authors’ CLIPPER implementation.

The mathematical engines are model.mjs and association.mjs. Numerical checks cover basis invariance, analytic angles, geodesic derivatives, PCA finite differences and convergence, affine translation invariance, and exact graph selection. Run node --test grassmannian/tests/*.test.mjs from the site checkout.