Global Tangent Spaces
In GeometricOptimizers standard neural network optimizers are generalized to homogeneous spaces by leveraging the special structure of the tangent spaces of this class of manifolds. When we introduced homogeneous spaces we already talked about that every tangent space to a homogeneous space $T_Y\mathcal{M}$ is of the form:
\[ T_Y\mathcal{M} = \mathfrak{g} \cdot Y := \{AY: A\in{}\mathfrak{g}\}.\]
We then have a decomposition of $\mathfrak{g}$ into a vertical part $\mathfrak{g}^{\mathrm{ver}, Y}$ and a horizontal part $\mathfrak{g}^{\mathrm{hor}, Y}$ and the horizontal part is isomorphic to $T_Y\mathcal{M}$ via:
\[ \mathfrak{g}^{\mathrm{hor}, Y} = \{\Omega(\Delta): \Delta\in{}T_Y\mathcal{M} \}.\]
We now identify a special element $E \in \mathcal{M}$ and designate the horizontal component $\mathfrak{g}^{\mathrm{hor}, E}$ as our global tangent space. We will refer to this global tangent space by $\mathfrak{g}^\mathrm{hor}$. We can now find a transformation from any $\mathfrak{g}^{\mathrm{hor}, Y}$ to $\mathfrak{g}^\mathrm{hor}$ and vice-versa (these spaces are isomorphic). If the metric on $G$ is bi-invariant, as the canonical metric on $SO(N)$ is, this transformation is a conjugation:
Let the metric on $G$ be bi-invariant, and let $A\in{}G$ an element such that $AE = Y$. Then we have
\[A^{-1}\cdot\mathfrak{g}^{\mathrm{hor},Y}\cdot{}A = \mathfrak{g}^\mathrm{hor},\]
i.e. for every element $B\in\mathfrak{g}^\mathrm{hor}$ we can find a $B^Y \in \mathfrak{g}^{\mathrm{hor},Y}$ s.t. $B = A^{-1}B^YA$ (and vice-versa). The map $B^Y\mapsto{}A^{-1}B^YA$ is an isometry.
Proof
For $V\in\mathfrak{g}$ we have $AVA^{-1}Y = AVE$, so $V\mapsto{}AVA^{-1}$ maps $\mathfrak{g}^{\mathrm{ver},E}$ onto $\mathfrak{g}^{\mathrm{ver},Y}$. Because the metric is bi-invariant, its inner product on $\mathfrak{g}$ is invariant under $V\mapsto{}AVA^{-1}$, so this map also sends the orthogonal complement $\mathfrak{g}^\mathrm{hor}$ of $\mathfrak{g}^{\mathrm{ver},E}$ onto the orthogonal complement $\mathfrak{g}^{\mathrm{hor},Y}$ of $\mathfrak{g}^{\mathrm{ver},Y}$. Its inverse is the map of the theorem.
Without bi-invariance the conjugation of an element of $\mathfrak{g}^{\mathrm{hor},Y}$ in general has a vertical part, so the statement above fails (an example is the symplectic Stiefel manifold with its Riemannian metric). The two spaces are still isomorphic for every complement of the vertical space, if the vertical part is removed:
Let $\mathfrak{g}^{\mathrm{hor},Y}$ be any complement of $\mathfrak{g}^{\mathrm{ver},Y}$, $\mathfrak{g}^\mathrm{hor}$ any complement of $\mathfrak{g}^{\mathrm{ver},E}$, and $A\in{}G$ an element such that $AE = Y$. Then
\[\mathfrak{g}^{\mathrm{hor},Y}\to\mathfrak{g}^\mathrm{hor}, \quad B^Y\mapsto\mathrm{pr}_{\mathfrak{g}^\mathrm{hor}}(A^{-1}B^YA),\]
where $\mathrm{pr}_{\mathfrak{g}^\mathrm{hor}}$ is the projection along $\mathfrak{g}^{\mathrm{ver},E}$, is an isomorphism. Its image $B$ satisfies $ABE = B^YY$, and when the metric is bi-invariant and $\mathfrak{g}^{\mathrm{hor},Y}$ and $\mathfrak{g}^\mathrm{hor}$ are the orthogonal complements of the vertical spaces, it is the conjugation of the theorem above.
Proof
Write $A^{-1}B^YA = V + B$ with $V\in\mathfrak{g}^{\mathrm{ver},E}$ and $B\in\mathfrak{g}^\mathrm{hor}$. Then $ABE = A(V + B)E = B^YAE = B^YY$. If $B = 0$, then $B^YY = 0$, so $B^Y$ is vertical and horizontal at $Y$, and $B^Y = 0$. The map is therefore injective, and the two spaces have the same dimension as $T_Y\mathcal{M}$. Under the hypotheses of the first theorem $A^{-1}B^YA\in\mathfrak{g}^\mathrm{hor}$, so $V = 0$.
The isomorphism of the second theorem is not an isometry in general: it carries the inner product of $\mathfrak{g}^{\mathrm{hor},Y}$ to an inner product on $\mathfrak{g}^\mathrm{hor}$ that can depend on $A$.
We should note that we have written all Lie group and Lie algebra actions as simple matrix multiplications, like $AE = Y$. For some Lie groups and Lie algebras, as the Lie group of isomorphisms on some domain $\mathcal{D}$, this notation may not be appropriate [9]. These Lie groups are however not relevant for what we use in GeometricOptimizers and we will stick to regular matrix notation.
Global Sections
Note that the theorem above requires us to find an element $A\in{}G$ such that $AE = Y$. We will call such a mapping $\lambda:\mathcal{M}\to{}G$ a global section[1].
We call a mapping $\lambda$ from a homogeneous space $\mathcal{M}$ to its associated Lie group $G$ a global section if $\forall{}Y\in\mathcal{M}$ it satisfies:
\[\lambda(Y)E = Y,\]
where $E$ is the distinct element of the homogeneous space.
Note that in general global sections are not unique because the rank of $G$ is in general greater than that of $\mathcal{M}$.
The Four Global Tangent Spaces
The sections below introduce $\mathfrak{g}^\mathrm{hor}$ for each manifold in the same five steps:
- Group and distinct element: the Lie group $G$ that acts transitively, and the element $E$ (always built from
StiefelProjection). - Vertical space: the Lie algebra of the stabilizer of $E$, on which the action at $E$ vanishes.
- Horizontal space: the complement of the vertical space that serves as $\mathfrak{g}^\mathrm{hor}$, how it is chosen, and the lift type that stores it.
- Section: what
global_sectioncompletes $Y$ with, and the inverse $\lambda(Y)^{-1}$. global_rep: the blocks of $\lambda(Y)^{-1}\Omega(Y, \Delta)\lambda(Y)$, computed from $\Delta$ without forming $\Omega$.
| manifold | group $G$ | $\mathfrak{g}^\mathrm{hor}$ | chosen as the complement | section $\lambda(Y)$ | $\lambda(Y)^{-1}$ | lift type |
|---|---|---|---|---|---|---|
StiefelManifold | $O(N)$ | $\begin{pmatrix} A & -B^T \\ B & \mathbb{O} \end{pmatrix}$, $A$ skew | orthogonal in $\frac{1}{2}\mathrm{tr}(X^TY)$ | $[Y\ \ Y_\perp]$ | $\lambda(Y)^T$ | StiefelLieAlgHorMatrix |
GrassmannManifold | $O(N)$ | $\begin{pmatrix} \mathbb{O} & -B^T \\ B & \mathbb{O} \end{pmatrix}$ | orthogonal in $\frac{1}{2}\mathrm{tr}(X^TY)$ | $[Y\ \ Y_\perp]$ | $\lambda(Y)^T$ | GrassmannLieAlgHorMatrix |
SymplecticStiefelManifold | $Sp(2N)$ | $\begin{pmatrix} \mathcal{A} & -\mathcal{B}^+ \\ \mathcal{B} & \mathbb{O} \end{pmatrix}$, $\mathcal{A}$ Hamiltonian | orthogonal in the pseudo-metric $h$ | $[U\ \ U^s]$ | $\bar{\mathbb{J}}^T\lambda(U)^T\mathbb{J}_{2N}$ | SymplecticLieAlgHorMatrix |
BiorthogonalManifold | $GL(N)$ | $\begin{pmatrix} A & C \\ B & \mathbb{O} \end{pmatrix}$ | the matrices that vanish where the vertical ones do not | $[\Phi\ \ K]$ | $[\Psi\ \ \tilde{K}]^T$ | BiorthogonalLieAlgHorMatrix |
In all four, $\mathfrak{g}^\mathrm{hor}$ is the same subspace of the Lie algebra at every point, which is what makes it a global tangent space, and it is invariant under the stabilizer of $E$.
The Global Tangent Space for the Stiefel Manifold
- Group and distinct element. $O(N)$ acts on $St(n, N)$ by $Y\mapsto{}QY$, and $E$ is the first $n$ columns of $\mathbb{I}_N$. For $n < N$ the subgroup $SO(N)$ acts transitively as well; for $n = N$ it does not, because $St(N, N) = O(N)$ has two components.
- Vertical space. $X\in\mathfrak{so}(N)$ with $XE = \mathbb{O}$ has its first $n$ columns, and by skew-symmetry its first $n$ rows, equal to zero: $\mathfrak{g}^\mathrm{ver} = \{\mathrm{diag}(\mathbb{O}, C) : C\in\mathfrak{so}(N-n)\}$, the Lie algebra of the stabilizer $\mathrm{diag}(\mathbb{I}_n, SO(N-n))$.
- Horizontal space. The orthogonal complement in the canonical inner product $\frac{1}{2}\mathrm{tr}(X^TY)$, the matrices $\begin{pmatrix} A & -B^T \\ B & \mathbb{O} \end{pmatrix}$ with $A\in\mathfrak{so}(n)$;
StiefelLieAlgHorMatrixstores $(A, B)$. - Section. $\lambda(Y) = [Y\ \ Y_\perp]$ with $Y_\perp$ an orthonormal basis of the orthogonal complement of the columns of $Y$; $\lambda(Y)^{-1} = \lambda(Y)^T$.
global_rep. $A = \mathrm{skew}(Y^T\Delta)$ and $B = Y_\perp^T\Delta$.
The rest of this section works through these steps in code. We pick as distinct element $E$ (which build by calling StiefelProjection):
\[E = \begin{bmatrix} \mathbb{I}_n \\ \mathbb{O} \end{bmatrix}\in{}St(n, N).\]
Based on this, elements of the vector space $\mathfrak{g}^{\mathrm{hor}, E} =: \mathfrak{g}^{\mathrm{hor}}$ are:
\[\bar{B} = \begin{pmatrix} A & -B^T \\ B & \mathbb{O} \end{pmatrix},\]
where $A$ is a skew-symmetric matrix of size $n\times{}n$ and $B$ is an arbitrary matrix of size $(N - n)\times{}n$. Arrays of type $\mathfrak{g}^{\mathrm{hor}, E} \equiv \mathfrak{g}^\mathrm{hor}$ are implemented in GeometricOptimizers under the name StiefelLieAlgHorMatrix.
We can call this with e.g. a skew-symmetric matrix $A$ and an arbitrary matrix $B$:
N, n = 5, 2
A = rand(SkewSymMatrix, n)2×2 SkewSymMatrix{Float64, Vector{Float64}}:
0.0 -0.112538
0.112538 0.0B = rand(N - n, n)3×2 Matrix{Float64}:
0.689246 0.633745
0.900147 0.878978
0.995838 0.490398The constructor is then called as follows:
B̄ = StiefelLieAlgHorMatrix(A, B, N, n)5×5 StiefelLieAlgHorMatrix{Float64, SkewSymMatrix{Float64, Vector{Float64}}, Matrix{Float64}}:
0.0 -0.112538 -0.689246 -0.900147 -0.995838
0.112538 0.0 -0.633745 -0.878978 -0.490398
0.689246 0.633745 0.0 0.0 0.0
0.900147 0.878978 0.0 0.0 0.0
0.995838 0.490398 0.0 0.0 0.0We can also call it with a matrix of shape $N\times{}N$:
B̄₂ = Matrix(B̄) # note that this does not have any special structure
StiefelLieAlgHorMatrix(B̄₂, n)5×5 StiefelLieAlgHorMatrix{Float64, SkewSymMatrix{Float64, Vector{Float64}}, SubArray{Float64, 2, Matrix{Float64}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false}}:
0.0 -0.112538 -0.689246 -0.900147 -0.995838
0.112538 0.0 -0.633745 -0.878978 -0.490398
0.689246 0.633745 0.0 0.0 0.0
0.900147 0.878978 0.0 0.0 0.0
0.995838 0.490398 0.0 0.0 0.0Or we can call it on $T_E\mathcal{M}\subset\mathbb{R}^{N\times{}n},$ i.e. a matrix of shape $N\times{}n$:
E = StiefelProjection(N, n)5×2 StiefelProjection{Float64, Matrix{Float64}}:
1.0 0.0
0.0 1.0
0.0 0.0
0.0 0.0
0.0 0.0B̄₃ = B̄ * E
StiefelLieAlgHorMatrix(B̄₃, n)5×5 StiefelLieAlgHorMatrix{Float64, SkewSymMatrix{Float64, Vector{Float64}}, SubArray{Float64, 2, Matrix{Float64}, Tuple{UnitRange{Int64}, UnitRange{Int64}}, false}}:
0.0 -0.112538 -0.689246 -0.900147 -0.995838
0.112538 0.0 -0.633745 -0.878978 -0.490398
0.689246 0.633745 0.0 0.0 0.0
0.900147 0.878978 0.0 0.0 0.0
0.995838 0.490398 0.0 0.0 0.0We now demonstrate how to map from an element of $\mathfrak{g}^{\mathrm{hor}, Y}$ to an element of $\mathfrak{g}^\mathrm{hor}$:
using GeometricOptimizers: Ω
Y = rand(StiefelManifold, N, n)
Δ = rgrad(Y, rand(N, n))
ΩΔ = Ω(Y, Δ)
λY = GlobalSection(Y)
λY_mat = Matrix(λY)
round.(λY_mat' * ΩΔ * λY_mat; digits = 3)5×5 Matrix{Float64}:
0.0 0.511 -0.221 0.292 -0.436
-0.511 0.0 0.058 1.09 -0.026
0.221 -0.058 0.0 -0.0 0.0
-0.292 -1.09 0.0 0.0 0.0
0.436 0.026 -0.0 -0.0 -0.0Performing this computation directly is computationally very inefficient however and the user is strongly discouraged to call Matrix on an instance of GlobalSection. The better option is calling global_rep:
_round(global_rep(λY, Δ); digits = 3)5×5 StiefelLieAlgHorMatrix{Float64, SkewSymMatrix{Float64, Vector{Float64}}, Matrix{Float64}}:
0.0 0.511 -0.221 0.292 -0.436
-0.511 0.0 0.058 1.09 -0.026
0.221 -0.058 0.0 0.0 0.0
-0.292 -1.09 0.0 0.0 0.0
0.436 0.026 0.0 0.0 0.0Internally GlobalSection calls the function GeometricOptimizers.global_section which does the following for the Stiefel manifold:
A = randn(N, N - n) # or the gpu equivalent
A = A - Y * (Y' * A)
B = A / maximum(abs, A) # so that the Gram matrix cannot overflow
Q = B / cholesky(Symmetric(B'B)).U # first pass
λ = Q / cholesky(Symmetric(Q'Q)).U # second pass; see below
Y⟂ = _cholesky_qr2(λ - Y * (Y' * λ)) # the same projection and orthonormalization once moreSo we draw $(N - n)$ new columns randomly, subtract the part that is spanned by the columns of $Y$ and then orthonormalize the resulting matrix. The result is a matrix of $(N - n)$ columns that is orthogonal to $Y$ and is typically referred to as $Y_\perp$ [6, 10, 11]. We can easily check that this $Y_\perp$ is indeed orthogonal to $Y$.
The last line is there because of rounding. The first projection leaves a rounding error in the span of $Y$, and the orthonormalization multiplies it by the condition number of the projected draw, which is large now and then; in Float32 the worst of a few thousand draws has $\|Y^T\lambda\|$ of order $10^{-2}$. $\lambda$ is orthonormal, so projecting and orthonormalizing it again amplifies nothing, and $Y_\perp$ is orthogonal to $Y$ to rounding. The proof below is in exact arithmetic, where one pass is enough.
The orthonormalization is CholeskyQR2 (the Cholesky step shown twice above) and not LinearAlgebra.qr. qr is the textbook answer, but it is a host factorization for several of the backends supported here: Metal implements no qr for its array type at all, so a qr here would put GlobalSection and therefore Optimizer out of reach on such a device. CholeskyQR2 is expressible in matrix products, reductions and triangular solves alone, so it runs wherever the point already is, and its $\|Q^TQ - \mathbb{I}\|$ is measured smaller than the host Householder QR's at every size tried. What the two give differs by the sign of each column, because CholeskyQR2's $R$ has a positive diagonal and Householder's need not.
The price is that forming $A^TA$ squares the condition number, and $A$ above is square inside the complement of $Y$. In Float32 that breaks the factorization down on about one draw in a hundred and twenty. Such a draw is replaced rather than repaired, because it is Gaussian noise and carries no information; this is what GeometricOptimizers.orthonormal_columns does. A replacement fails at a somewhat higher rate again, so the redraw is bounded and raises rather than returning a result it did not produce cleanly.
On a device, CholeskyQR2 keeps the point there; it is not the faster route. scripts/orthonormalization_device_cost.jl measures it on an M4 Max with Julia 1.13.1, Metal 1.11.1 and the development version of GeometricOptimizers after 0.8.0, in Float32, at the $N\times(N-3)$ shape that global_section uses: a cold session, one warm-up, the median of five runs, Metal.synchronize() in the timed region, and the host on one BLAS thread.
| $N$ | CholeskyQR2 on Metal | host qr! | download, host qr!, upload |
|---|---|---|---|
| 20 | 7.3 ms | 46 μs | 0.60 ms |
| 400 | 29 ms | 12 ms | 19 ms |
At these sizes the device time is mostly launch and synchronisation latency. The second pass is necessary: on Metal in Float32 at the same shape, $\|Q^TQ - \mathbb{I}\|$ after one pass is $9.7\times10^{-6}$ at $N = 20$ and $1.9\times10^{-3}$ at $N = 400$, against $7.1\times10^{-7}$ and $7.7\times10^{-6}$ after the second.
The matrix $Y_\perp$ constructed with the algorithm above satisfies
\[Y^TY_\perp = \mathbb{O}_{n\times{}n},\]
and
\[(Y_\perp)^TY_\perp = \mathbb{I}_n,\]
i.e. all the columns in the big matrix $[Y, Y_\perp]\in\mathbb{R}^{N\times{}N}$ are mutually orthonormal and it therefore is an element of $SO(N)$.
Proof
The orthonormalization writes the drawn matrix as $QR$, with $Q$ orthonormal and $R$ upper triangular; for CholeskyQR2 $R$ is the product of the two Cholesky factors, and a product of upper triangular matrices is upper triangular. The second property is then trivially satisfied because $Q$ is orthonormal. For the first property note that $Y^TQR = \mathbb{O}$ is zero because we have subtracted the $Y$ component from the matrix $QR$. The matrix $R\in\mathbb{R}^{(N-n)\times{}(N-n)}$ further has the property $[R]_{ij} = 0$ for $i > j$ and we have that
\[(Y^TQ)R = [r_{11}(Y^TQ)_{1\bullet}, r_{12}(Y^TQ)_{1\bullet} + r_{22}(Y^TQ)_{2\bullet}, \ldots, \sum_{i=1}^{N-n}r_{i(N-n)}(Y^TQ)_{i\bullet}].\]
Now all the coefficients $r_{ii}$ are non-zero because the matrix we factorized has full rank, and for CholeskyQR2 they are in addition positive, which is what makes $Q$ unique where a Householder $QR$ leaves the sign of each column free. We can see that if $(Y^TQ)R$ is zero $Y^TQ$ also has to be zero.
The function global_rep furthermore makes use of the following:
\[ \mathtt{global\_rep}(Y) = \lambda(Y)^T\Omega(Y,\Delta)\lambda(Y) = EY^T\Delta{}E^T + \begin{bmatrix} \mathbb{O} \\ \bar{\lambda}^T\Delta{}E^T \end{bmatrix} - \begin{bmatrix} \mathbb{O} & E\Delta^T\bar{\lambda} \end{bmatrix},\]
where $\lambda(Y) = [Y, \bar{\lambda}].$
Proof
We derive the expression above:
\[\begin{aligned} \lambda(Y)^T\Omega(Y,\Delta)\lambda(Y) & = \lambda(Y)^T[(\mathbb{I} - \frac{1}{2}YY^T)\Delta{}Y^T - Y\Delta^T(\mathbb{I} - \frac{1}{2}YY^T)]\lambda(Y) \\ & = \lambda(Y)^T[(\mathbb{I} - \frac{1}{2}YY^T)\Delta{}E^T - Y\Delta^T(\lambda(Y) - \frac{1}{2}YE^T)] \\ & = \lambda(Y)^T\Delta{}E^T - \frac{1}{2}EY^T\Delta{}E^T - E\Delta^T\lambda(Y) + \frac{1}{2}E\Delta^TYE^T \\ & = \begin{bmatrix} Y^T\Delta{}E^T \\ \bar{\lambda}\Delta{}E^T \end{bmatrix} - \frac{1}{2}EY^T\Delta{}E - \begin{bmatrix} E\Delta^TY & E\Delta^T\bar{\lambda} \end{bmatrix} + \frac{1}{2}E\Delta^TYE^T \\ & = \begin{bmatrix} Y^T\Delta{}E^T \\ \bar{\lambda}\Delta{}E^T \end{bmatrix} + E\Delta^TYE^T - \begin{bmatrix}E\Delta^TY & E\Delta^T\bar{\lambda} \end{bmatrix} \\ & = EY^T\Delta{}E^T + E\Delta^TYE^T - E\Delta^TYE^T + \begin{bmatrix} \mathbb{O} \\ \bar{\lambda}\Delta{}E^T \end{bmatrix} - \begin{bmatrix} \mathbb{O} & E\Delta^T\bar{\lambda} \end{bmatrix} \\ & = EY^T\Delta{}E^T + \begin{bmatrix} \mathbb{O}_{n\times{}N} \\ \bar{\lambda}\Delta{}E^T \end{bmatrix} - \begin{bmatrix} \mathbb{O}_{N\times{}n} & E\Delta^T\bar{\lambda} \end{bmatrix}, \end{aligned}\]
which proofs our assertion.
This expression of global_rep means we only need $Y^T\Delta$ and $\bar{\lambda}^T\Delta$ and this is what is used internally.
We now discuss the global tangent space for the Grassmann manifold. This is similar to the Stiefel case.
The Global Tangent Space for the Grassmann Manifold
- Group and distinct element. $O(N)$ acts on $Gr(n, N)$ by $\mathrm{span}(Y)\mapsto\mathrm{span}(QY)$, and the distinct element is $\mathcal{E} = \mathrm{span}(E)$.
- Vertical space. The stabilizer of $\mathcal{E}$ is $S(O(n)\times{}O(N-n))$, so $\mathfrak{g}^\mathrm{ver} = \{\mathrm{diag}(A, C) : A\in\mathfrak{so}(n), C\in\mathfrak{so}(N-n)\}$.
- Horizontal space. The orthogonal complement in $\frac{1}{2}\mathrm{tr}(X^TY)$, the matrices $\begin{pmatrix} \mathbb{O} & -B^T \\ B & \mathbb{O} \end{pmatrix}$;
GrassmannLieAlgHorMatrixstores $B$. - Section. As for the Stiefel manifold, $\lambda(Y) = [Y\ \ Y_\perp]$ for the orthonormal representative $Y$, and $\lambda(Y)^{-1} = \lambda(Y)^T$.
global_rep. $B = Y_\perp^T\Delta$.
In the case of the Grassmann manifold we construct the global tangent space with respect to the distinct element $\mathcal{E}=\mathrm{span}(E)\in{}Gr(n,N)$, where $E$ is again the same matrix.
The tangent tangent space $T_\mathcal{E}Gr(n,N)$ can be represented through matrices:
\[\begin{pmatrix} 0 & \cdots & 0 \\ \cdots & \cdots & \cdots \\ 0 & \cdots & 0 \\ b_{11} & \cdots & b_{1n} \\ \cdots & \cdots & \cdots \\ b_{(N-n)1} & \cdots & b_{(N-n)n} \end{pmatrix}.\]
This representation is based on the identification $T_\mathcal{E}Gr(n,N)\to{}T_E\mathcal{S}_E$ that was discussed in the section on the Grassmann manifold[2]. We use the following notation:
\[\mathfrak{g}^\mathrm{hor} = \mathfrak{g}^{\mathrm{hor},\mathcal{E}} = \left\{\begin{pmatrix} 0 & -B^T \\ B & 0 \end{pmatrix}: \text{$B\in\mathbb{R}^{(N-n)\times{}n}$ is arbitrary}\right\}.\]
This is equivalent to the horizontal component of $\mathfrak{g}$ for the Stiefel manifold for the case when $A$ is zero. This is a reflection of the rotational invariance of the Grassmann manifold: the skew-symmetric matrices $A$ are connected to the group of rotations $O(n)$ which is factored out in the Grassmann manifold $Gr(n,N)\simeq{}St(n,N)/O(n)$. In GeometricOptimizers we thus treat the Grassmann manifold as being embedded in the Stiefel manifold. In [11] viewing the Grassmann manifold as a quotient space of the Stiefel manifold is important for "feasibility" in "practical computations".
The Global Tangent Space for the Symplectic Stiefel Manifold
- Group and distinct element. $Sp(2N)$ acts on $Sp(2n, 2N)$ by $U\mapsto{}MU$, and $E$ is the first $2n$ columns of the identity in the basis of the section below.
- Vertical space. In that basis, $\mathfrak{g}^\mathrm{ver} = \{\mathrm{diag}(\mathbb{O}, \mathcal{C}) : \mathcal{C}\in\mathfrak{sp}(2N-2n)\}$, the Lie algebra of the stabilizer $\mathrm{diag}(\mathbb{I}_{2n}, Sp(2N-2n))$.
- Horizontal space. The complement with respect to the bi-invariant pseudo-Riemannian metric $h$, the matrices $\begin{pmatrix} \mathcal{A} & -\mathcal{B}^+ \\ \mathcal{B} & \mathbb{O} \end{pmatrix}$ with $\mathcal{A}\in\mathfrak{sp}(2n)$;
SymplecticLieAlgHorMatrixstores $\mathcal{A}$ and $\mathcal{B}$. - Section. $\lambda(U) = [U\ \ U^s]$ with $U^s$ a symplectic completion; $\lambda(U)^{-1} = \bar{\mathbb{J}}^T\lambda(U)^T\mathbb{J}_{2N}$, the symplectic inverse.
global_rep. $\mathcal{A} = U^+\Delta$ and $\mathcal{B} = (U^s)^+\Delta$.
The SymplecticStiefelManifold $Sp(2n, 2N) = \{U\in\mathbb{R}^{2N\times2n} : U^T\mathbb{J}_{2N}U = \mathbb{J}_{2n}\}$ is a homogeneous space of the symplectic group $Sp(2N)$, and [12] give it the same structure as the Stiefel manifold: a projection $M\mapsto{}ME$ from the group, a vertical space, and, below their (3.4), a horizontal space that is the same subspace of the Lie algebra $\mathfrak{sp}(2N)$ at every point. It is the complement of the vertical space with respect to the bi-invariant pseudo-Riemannian metric $h$ of their (2.1). The horizontal space (3.13) of their Riemannian metric $g$, the one metric implements, depends on the point, so only the first gives a global tangent space.
The section is stored as for the Stiefel manifold, $\lambda(U) = [U\ \ U^s]$ with the point first, so $E$ is the first $2n$ columns. $U^s$ is a symplectic completion: $U^T\mathbb{J}_{2N}U^s = \mathbb{O}$ and $(U^s)^T\mathbb{J}_{2N}U^s = \mathbb{J}_{2N-2n}$. In this basis the Poisson tensor is $\bar{\mathbb{J}} = \mathrm{diag}(\mathbb{J}_{2n}, \mathbb{J}_{2N-2n})$, $\lambda(U)^T\mathbb{J}_{2N}\lambda(U) = \bar{\mathbb{J}}$, and the horizontal space below (3.4) of [12] reads
\[\mathfrak{g}^\mathrm{hor} = \left\{\begin{pmatrix} \mathcal{A} & -\mathcal{B}^+ \\ \mathcal{B} & \mathbb{O} \end{pmatrix}: \mathcal{A}\in\mathfrak{sp}(2n), \mathcal{B}\in\mathbb{R}^{(2N-2n)\times2n}\right\}, \qquad \mathcal{B}^+ = \mathbb{J}_{2n}^T\mathcal{B}^T\mathbb{J}_{2N-2n}.\]
This is the Stiefel case with the transpose replaced by the symplectic adjoint, and it is what SymplecticLieAlgHorMatrix stores. An element $\Omega$ satisfies $\Omega^T\bar{\mathbb{J}} + \bar{\mathbb{J}}\Omega = \mathbb{O}$, so its Cayley transform and its exponential preserve $\bar{\mathbb{J}}$, $\lambda(U)R$ is a section again for every retraction $R$ of it, and $\lambda(U)RE$ is a point of the manifold.
The tangent space at $U$ is $\{\Delta : U^+\Delta\in\mathfrak{sp}(2n)\}$ with the symplectic inverse $U^+ = \mathbb{J}_{2n}^TU^T\mathbb{J}_{2N}$. A horizontal element is determined by its first $2n$ columns, and those of $\lambda(U)^{-1}\Omega(U,\Delta)\lambda(U)$ are $\lambda(U)^{-1}\Delta$, with $\Omega$ the horizontal lift GeometricOptimizers.Ω of (3.7) of [12]. So global_rep needs only
\[\mathcal{A} = U^+\Delta, \qquad \mathcal{B} = (U^s)^+\Delta.\]
This is the isomorphism of the second theorem at the top of this page, whatever horizontal space at $U$ one starts from: the element $B$ of $\mathfrak{g}^\mathrm{hor}$ with $\lambda(U)BE = \Delta$ is unique, so the vertical part of $\lambda(U)^{-1}Z\lambda(U)$ is removed for the lift $Z$ of (3.15) of [12], whose horizontal space is that of metric, as it is for $\Omega$ of (3.7), for which that part is zero. The first theorem, the conjugation, does not apply to the lift of (3.15): $Sp(2N)$ has no bi-invariant Riemannian metric (see below), and at a generic point the conjugate of that lift has a vertical part.
Two things differ from the Stiefel case.
The first is the completion. The symplectic group is not compact, so a completion can be arbitrarily badly conditioned, and the coordinates of the lift, in which Adam and the quasi-Newton methods take their steps, are only as good as it. global_section therefore takes an orthonormal basis $Q$ of the symplectic complement of $U$ and brings the skew-symmetric $Q^T\mathbb{J}_{2N}Q$ to its normal form with the eigenvectors of a Hermitian matrix, which rescales each column and keeps them orthogonal. Its condition number has not exceeded that of $U$ on any point tried, and it is orthonormal where $U$ is orthosymplectic.
On $SO(N)$ every section is orthogonal, so its condition number is one. $Sp(2N)$ is not compact, and for $n < N$ neither is the stabilizer $Sp(2N-2n)$ of a point (at $n = N$ the stabilizer is trivial and $\lambda(U) = U$ is unique). For $n < N$, two sections at one point differ by $h = \mathrm{diag}(\mathbb{I}, S)$ with $S\in{}Sp(2N-2n)$. Already $S = \mathrm{diag}(t\mathbb{I}, t^{-1}\mathbb{I})$ has condition number $t^2$, so the sections over one point have no bound on their conditioning. This enters in three places:
- The coordinates of the lift. $h$ sends $(\mathcal{A}, \mathcal{B})$ to $(\mathcal{A}, S^{-1}\mathcal{B})$. Everything held in these coordinates changes with the section. Where an operation is not equivariant under this map, the step changes too: the entrywise moments of
Adamare such an operation. The secant pairs and $Q$ ofBFGSandDFPchange with the coordinates, but their step does not, because $Q$ starts at the inverse of the metric and the update is the same in every linear coordinate system.GeometricOptimizers.step_αmaxreads the spectral radius of the lift, which $h^{-1}Bh$ keeps. The coordinate step lengthrxₐofGeometricOptimizers.OptimizerStatuschanges, and no step reads it. - Rounding.
apply_section,global_repand the section update multiply by $\lambda(U)$ or its inverse $\bar{\mathbb{J}}^T\lambda(U)^T\mathbb{J}_{2N}$, so their rounding error grows with the condition number of the section. This holds also for fixed-stepGradientMethodandMomentumMethod, whose iterates do not depend on the section in exact arithmetic. - The transported section. The optimizers carry the section along their path and never reset it to
global_section, so its conditioning drifts from that of a fresh one.
The manifold itself is unbounded too: an iterate can leave every bounded set, which a Stiefel or Grassmann iterate cannot. For $n < N$ no choice of metric removes any of this, since no positive-definite inner product on $\mathfrak{g}^\mathrm{hor}$ is invariant under the stabilizer (below).
On the $10\times4$ eigenvalue problem of the tests, the transported section goes from condition number 1.35 to 3.4–3.6 in the first 5000 steps of every method and then stays there. A fresh section of the final point has 2.83. With a noisy gradient $2(M + \sigma(G + G^T)/2)U$, $G$ Gaussian, over $10^5$ steps of size $10^{-2}$:
Adamends at 4.31 against a fresh 2.78 ($\sigma = 1$), and at 6.15 against 5.28 ($\sigma = 10$).GradientMethoddiverges. Before its last step at $\sigma = 1$ (step 7106), $\|U\| = 1.3\cdot10^{25}$, $\mathrm{cond}(U) = 2.1\cdot10^{10}$, and the section's condition number is $3.7\cdot10^{63}$. At a fixed step size it can also diverge without noise from a sufficiently ill-conditioned start, because the Riemannian gradient ofmetricscales as $O(\|U\|^3)$ along hyperbolic directions.
A reset of the section to global_section, with the caches carried over by $\mathcal{B}\mapsto{}S\mathcal{B}$, would bound the drift, but the optimizers do not do it. Issue #189 discusses this.
The second is the gradient. For the Stiefel manifold the inner product of two lifts, as GeometricOptimizers._dot takes it on their stored entries, is the canonical metric, so the lift of the Riemannian gradient pairs with the lift of a direction as the derivative of the loss along it. The metric of SymplecticStiefelManifold is only right-invariant, so no inner product on $\mathfrak{g}^\mathrm{hor}$ reproduces it at every point, and this identity fails. Two lifts therefore take separate roles.
For $n < N$, no other Riemannian metric can be reproduced that way either. Two sections at one point differ by $h = \mathrm{diag}(\mathbb{I}, S)$ with $S\in{}Sp(2N-2n)$, which sends $(\mathcal{A}, \mathcal{B})$ to $(\mathcal{A}, S^{-1}\mathcal{B})$. An inner product that gave the same value through every section would be invariant under this map. With $S = \mathrm{diag}(t\mathbb{I}, t^{-1}\mathbb{I})$ and a $\mathcal{B}$ that is zero below its first $N - n$ rows, $S^{-1}\mathcal{B} = \mathcal{B}/t$, so its quadratic form $q$ satisfies $q(\mathcal{B}) = q(\mathcal{B})/t^2$ for every $t$, and $q(\mathcal{B}) = 0$. The obstruction is the non-compact stabilizer of the point, not the metric chosen on $Sp(2N)$ (at $n = N$ the stabilizer is trivial, $\lambda(U) = U$ is unique, and $\frac{1}{2}\mathrm{tr}(\mathcal{A}^T\mathcal{A})$ defines a left-invariant Riemannian metric on $Sp(2N)$). The same argument shows that $Sp(2N)$ has no bi-invariant Riemannian metric, which would need an inner product on $\mathfrak{sp}(2N)$ invariant under $X\mapsto{}MXM^{-1}$ for every $M\in{}Sp(2N)$. Take $M = \exp(tD)$ with $D = \mathrm{diag}(\mathbb{I}_N, -\mathbb{I}_N)\in\mathfrak{sp}(2N)$, so $M = \mathrm{diag}(e^t\mathbb{I}_N, e^{-t}\mathbb{I}_N)$, and $X = \begin{pmatrix}\mathbb{O} & K\\ \mathbb{O} & \mathbb{O}\end{pmatrix}$ with $K = K^T\neq\mathbb{O}$, which is in $\mathfrak{sp}(2N)$. Then $MXM^{-1} = e^{2t}X$, so an invariant quadratic form $q$ satisfies $q(X) = e^{4t}q(X)$ for every $t$, and $q(X) = 0$. $\mathfrak{sp}(2N)$ is simple, so the forms on it that are invariant under the whole group are the multiples of the trace form, and these are indefinite: the trace form gives the pseudo-Riemannian metric (3.8) of [12], whose horizontal space is the $\mathfrak{g}^\mathrm{hor}$ above. scripts/symplectic_metric_invariance.jl checks these statements without the package.
The line search, BFGS and DFP pair a gradient with a direction, and they use the lift GeometricOptimizers.gradient_rep! gives: the derivative of the loss with respect to the stored entries of a lift at the section. With it the slope of a line search is the derivative of its merit, and the secant pairs of the quasi-Newton methods are in the coordinates their $Q$ lives in. That lift is $MB$, where $B$ is global_rep of the Riemannian gradient and $M$ the Gram matrix of metric in the stored entries at the section (GeometricOptimizers._metric_apply!). The quasi-Newton methods therefore start $Q$ at $M^{-1}$ (GeometricOptimizers._metric_inverse!) and put it back there on a restart, so that their first direction, the direction after a restart, and the substitute for a direction that does not descend are $-B$: the same lift and the same tangent vector as for GradientMethod, for every section. On the Stiefel and Grassmann manifolds $M$ is the identity.
GradientMethod, MomentumMethod and Adam build their direction from the gradient itself, and it is global_rep of the Riemannian gradient of metric. Its tangent vector $\lambda(U)BE$ does not depend on the section, and neither does the retraction $\lambda(U)\exp(tB)E$ of a horizontal lift: a change $\lambda\mapsto\lambda h$ with $h = \mathrm{diag}(\mathbb{I}, S)$ sends $B$ to $h^{-1}Bh$, and $\lambda h\exp(th^{-1}Bh)E = \lambda\exp(tB)E$. The path of GradientMethod and MomentumMethod, at a fixed step size and under a line search, is therefore a property of the point and the metric alone, because GeometricOptimizers.step_αmax reads the spectral radius of $B$ (but Adam takes entrywise second moments on $\mathcal{B}$). That retraction is $\exp(t\Omega(U,\Delta))U$, the geodesic (3.9) of the pseudo-Riemannian metric (3.8) (Proposition 3.7 of [12]; Proposition 3.8 evaluates it without a section, as (3.11)), and not the geodesic (3.18) of metric: the two curves agree to first order in $t$ and differ at second order. So it is a retraction for metric, not its exponential map. Both Nomizu's canonical connection of the second kind $\nabla^{(0)}$ (which needs no metric, only a horizontal space stabilized by the isotropy subgroup, Lemma 3.4 of [12], and carries torsion $T(X, Y) = -[X, Y]_{\mathfrak{g}^\mathrm{hor}}$ on horizontal vectors) and the canonical connection of the first kind $\nabla^{(1/2)}$ (the torsion-free Levi-Civita connection of the pseudo-Riemannian metric (3.8)) have $\exp(t\Omega(U,\Delta))U$ as their geodesic [13, 14], while it is $\nabla^{(0)}$ whose parallel transport along $\exp(t\Omega(U,\Delta))U$ is $\Delta_2\mapsto\exp(t\Omega(U,\Delta))\Delta_2 = \lambda(U)\exp(tB)B_2E$ — exactly what the optimizers do when they keep a cache $B_2\in\mathfrak{g}^\mathrm{hor}$ fixed while the section moves to $\lambda(U)\exp(tB)$, as in Parallel Transport for the Stiefel manifold. So retraction and $\nabla^{(0)}$-transport form one consistent pair, and the metric enters only through the gradient. The geodesic (3.18) of metric forms another pair, with the parallel transport of the Levi-Civita connection of metric, and it costs more. With $C = \lambda(U)^{-1}Z\lambda(U)$, where $Z$ is the lift of (3.15), and $P = \lambda(U)^T\lambda(U)$, (3.18) reads $\lambda(U)\exp(t(C - P^{-1}C^TP))\exp(tP^{-1}C^TP)E$. Although (3.19) of [12], their Proposition 3.13, evaluates that same geodesic directly from $(U, \Delta)$ without a section, through one $8n\times8n$ and one $4n\times4n$ matrix exponential, inside the global-tangent-space framework $C$ is not in $\mathfrak{g}^\mathrm{hor}$ and $P$ depends on the section, so the retraction is no longer a map on $\mathfrak{g}^\mathrm{hor}$ alone and transporting a cache cannot keep $B_2$ fixed: keeping $B_2$ fixed while the section follows the horizontal lift of (3.18) changes its norm in metric and does not carry the initial velocity to the velocity of (3.18), so the cache has to be recomputed in every step. #188 tracks this pair as an option. The steepest descent of $\frac{1}{2}\mathrm{tr}(X^TY)$ on the dense lifts at the section is not offered: by the statement above, for $n < N$ that form defines no metric on the manifold, so its step would be steepest descent at one section of the fibre over the point, not at the point, and it would change with a change of the section that leaves the point where it is. In the coordinates of global_section the metric is block-diagonal in $(\mathcal{A}, \mathcal{B})$ at every point, and at an orthosymplectic point it is exactly $\frac{1}{2}\mathrm{tr}(\mathcal{A}^T\mathcal{A}) + \mathrm{tr}(\mathcal{B}^T\mathcal{B})$, the only place where the two descents agree. scripts/symplectic_gradient_options.jl measures these statements.
The Global Tangent Space for the Biorthogonal Manifold
- Group and distinct element. $GL(N)$ acts on the
BiorthogonalManifold$\mathcal{B}(n, N) = \{(\Phi, \Psi)\in\mathbb{R}^{N\times{}n}\times\mathbb{R}^{N\times{}n} : \Psi^T\Phi = \mathbb{I}_n\}$ by $g\cdot(\Phi, \Psi) = (g\Phi, g^{-T}\Psi)$, and the distinct element is $(E, E)$. - Vertical space. An $X\in\mathfrak{gl}(N)$ acts by $X\cdot(\Phi, \Psi) = (X\Phi, -X^T\Psi)$, at $(E, E)$ through its first $n$ columns and its first $n$ rows. Both vanish exactly on $\mathfrak{g}^\mathrm{ver} = \{\mathrm{diag}(\mathbb{O}, D) : D\in\mathfrak{gl}(N-n)\}$, the Lie algebra of the stabilizer $\mathrm{diag}(\mathbb{I}_n, GL(N-n))$.
- Horizontal space. The matrices that vanish in the lower right block, $\begin{pmatrix} A & C \\ B & \mathbb{O} \end{pmatrix}$ with $A$, $B$ and $C$ arbitrary;
BiorthogonalLieAlgHorMatrixstores $(A, B, C)$. - Section. $\lambda(Y) = [\Phi\ \ K]$ with $K$ an orthonormal basis of the kernel of $\Psi^T$, and $\lambda(Y)^{-T} = [\Psi\ \ \tilde{K}]$ with $\tilde{K} = (\mathbb{I}_N - \Psi\Phi^T)K$.
global_rep. $A = \Psi^T\Delta_\Phi$, $B = \tilde{K}^T\Delta_\Phi$ and $C = -\Delta_\Psi^TK$.
The manifold, its metric and its gradient are on the page The Biorthogonal Manifold; the steps are worked through here.
The horizontal space. No metric is needed to choose it: $\mathfrak{gl}(N) = \mathfrak{g}^\mathrm{hor}\oplus\mathfrak{g}^\mathrm{ver}$ is a direct sum, and $X\mapsto(XE, -X^TE)$ is a linear isomorphism from $\mathfrak{g}^\mathrm{hor}$ onto $T_{(E, E)}\mathcal{B}(n, N)$: $XE$ gives $A$ and $B$, and $-X^TE$ gives $-A^T$ and $-C^T$. The dimension is $n^2 + 2(N-n)n = 2Nn - n^2 = \dim\mathcal{B}(n, N)$. For $h = \mathrm{diag}(\mathbb{I}_n, S)$ in the stabilizer,
\[h\begin{pmatrix} A & C \\ B & \mathbb{O} \end{pmatrix}h^{-1} = \begin{pmatrix} A & CS^{-1} \\ SB & \mathbb{O} \end{pmatrix},\]
so the space is invariant under the stabilizer, as in the other three cases. This lift is the StiefelLieAlgHorMatrix without the two constraints of $\mathfrak{so}(N)$: $A$ need not be skew-symmetric, and $C$ need not be $-B^T$. Under $X\mapsto\mathrm{diag}(X, -X^T)$, $\mathfrak{gl}(N)\subset\mathfrak{sp}(2N)$, and in the column order $[\Phi\ \ \Psi\ \ K\ \ \tilde{K}]$ the lift is the SymplecticLieAlgHorMatrix with $A_1 = A$, $B_1 = C_1 = \mathbb{O}$ and $\mathcal{B} = \mathrm{diag}(B, -C^T)$.
The section. The group does not act by orthogonal matrices, so $\lambda(Y)^{-1}$ is not $\lambda(Y)^T$, and the second half of a pair moves by the inverse transpose of what moves the first. global_section therefore returns $[K\ \ \tilde{K}]$, the completions of the frame and of the dual frame, and a GlobalSection stores both. $[\Phi\ \ K]$ is invertible because $\Phi a + Kb = 0$ gives $a = \Psi^T(\Phi a + Kb) = 0$ and then $b = 0$, and $\tilde{K}^T\Phi = \mathbb{O}$ and $\tilde{K}^TK = \mathbb{I}_{N-n}$ are $\lambda(Y)^{-1}\lambda(Y) = \mathbb{I}_N$. At a Stiefel point $\Phi = \Psi$ the dual completion is $\tilde{K} = K$ and the section is the Stiefel one.
global_rep. A lift $X$ represents the tangent vector $\lambda(Y)X\cdot(E, E) = (\Phi A + KB,\ -(\Psi A^T + \tilde{K}C^T))$, and global_rep inverts this map, which gives the blocks of step 5. $A$ is also $-\Delta_\Psi^T\Phi$ on the tangent space $\{(\Delta_\Phi, \Delta_\Psi) : \Psi^T\Delta_\Phi + \Delta_\Psi^T\Phi = \mathbb{O}\}$, and the code takes the mean of the two. The element $\lambda(Y)X\lambda(Y)^{-1}$ of $\mathfrak{gl}(N)$ at $Y$ does not depend on the section; it is the horizontal lift GeometricOptimizers.Ω
\[\Omega(Y, \Delta) = \Delta_\Phi\Psi^T - \Phi\Delta_\Psi^T(\mathbb{I}_N - \Phi\Psi^T),\]
which at a Stiefel point and a tangent vector $(\Delta, \Delta)$ is the canonical lift of the Stiefel manifold. GeometricOptimizers.gradient_rep!, the derivative of the loss with respect to the stored blocks, has the frame and the dual frame exchanged: $A = \Phi^T\Delta_\Phi - \Delta_\Psi^T\Psi$, $B = K^T\Delta_\Phi$ and $C = -\Delta_\Psi^T\tilde{K}$.
Library functions
AbstractLieAlgHorMatrix, StiefelLieAlgHorMatrix, GrassmannLieAlgHorMatrix, SymplecticLieAlgHorMatrix, BiorthogonalLieAlgHorMatrix, StiefelProjection, GlobalSection, global_section, global_rep and apply_section. Their docstrings are on the reference page, where every docstring in the package is rendered once; the names above link to them.
GeometricMachineLearning re-exports all of these, so a neural network built there is optimized with exactly the machinery described above.
References
- [6]
- P.-A. Absil, R. Mahony and R. Sepulchre. Riemannian geometry of Grassmann manifolds with a view on algorithmic computation. Acta Applicandae Mathematica 80, 199–220 (2004).
- [10]
- P.-A. Absil, R. Mahony and R. Sepulchre. Optimization algorithms on matrix manifolds (Princeton University Press, Princeton, New Jersey, 2008).
- [11]
- T. Bendokat, R. Zimmermann and P.-A. Absil. A Grassmann manifold handbook: Basic geometry and computational aspects, arXiv preprint arXiv:2011.13699 (2020).
- [12]
- T. Bendokat and R. Zimmermann. The real symplectic Stiefel and Grassmann manifolds: metrics, geodesics and applications, arXiv preprint arXiv:2108.12447 (2021).
- [15]
- B. Brantner. Generalizing Adam To Manifolds For Efficiently Training Transformers, arXiv preprint arXiv:2305.16901 (2023).
- [43]
- T. Frankel. The geometry of physics: an introduction (Cambridge university press, Cambridge, UK, 2011).
- [13]
- K. Nomizu. Invariant affine connections on homogeneous spaces. American Journal of Mathematics 76, 33–65 (1954).
- [14]
- M. Schlarb. Covariant Derivatives on Homogeneous Spaces: Horizontal Lifts and Parallel Transport. The Journal of Geometric Analysis 34, 1–43 (2024).
- 1Global sections are also crucial for parallel transport in
GeometricOptimizers. A global section is first updated, i.e. $\Lambda^{(t)} \gets \mathrm{update}(\Lambda^{(t-1)});$ and on the basis of this we then update the element of the manifold $Y\in\mathcal{M}$ and the tangent vector $\Delta\in{}T\mathcal{M}$. - 2We derived the following expression for the Riemannian gradient of the Grassmann manifold: $\mathrm{grad}_\mathcal{Y}^{Gr}L = \nabla_Y{}L - YY^T\nabla_YL$. The tangent space to the element $\mathcal{E}$ can thus be written as $\bar{B} - EE^T\bar{B}$ where $B\in\mathbb{R}^{N\times{}n}$ and the matrices in this tangent space have the desired form.