Rotations
The manifold $\mathrm{SO}(n)$ of orthogonal matrices with determinant $+1$ in $β^{n Γ n}$, i.e.
\[\mathrm{SO}(n) = \bigl\{R β β^{n Γ n} \big| R R^{\mathrm{T}} = R^{\mathrm{T}}R = I_n, \det(R) = 1 \bigr\}\]
The Lie group $\mathrm{SO}(n)$ is a subgroup of the orthogonal group $\mathrm{O}(n)$ and also known as the special orthogonal group or the set of rotations group. See also SpecialOrthogonal
, which is this manifold equipped with the group operation.
The tangent space to a point $p β \mathrm{SO}(n)$ is given by
\[T_p\mathrm{SO}(n) = \{X : X=pY,\qquad Y=-Y^{\mathrm{T}}\},\]
i.e. all vectors that are a product of a skew symmetric matrix multiplied with $p$.
Since the orthogonal matrices $\mathrm{SO}(n)$ are a Lie group, tangent vectors can also be represented by elements of the corresponding Lie algebra, which is the tangent space at the identity element. In the notation above, this means we just store the component $Y$ of $X$.
This convention allows for more efficient operations on tangent vectors. Tangent spaces at different points are different vector spaces.
Let $L_R: \mathrm{SO}(n) β \mathrm{SO}(n)$ where $R β \mathrm{SO}(n)$ be the left-multiplication by $R$, that is $L_R(S) = RS$. The tangent space at rotation $R$, $T_R \mathrm{SO}(n)$, is related to the tangent space at the identity rotation $I_n$ by the differential of $L_R$ at identity, $(\mathrm{d}L_R)_{I_n} : T_{I_n} \mathrm{SO}(n) β T_R \mathrm{SO}(n)$. To convert the tangent vector representation at the identity rotation $X β T_{I_n} \mathrm{SO}(n)$ (i.e., the default) to the matrix representation of the corresponding tangent vector $Y$ at a rotation $R$ use the embed
which implements the following multiplication: $Y = RX β T_R \mathrm{SO}(n)$. You can compare the functions log
and exp
to see how it works in practice.
Several common functions are also implemented together with orthogonal and unitary matrices.
Manifolds.NormalRotationDistribution
β TypeNormalRotationDistribution(M::Rotations, d::Distribution, x::TResult)
Distribution that returns a random point on the manifold Rotations
M
. Random point is generated using base distribution d
and the type of the result is adjusted to TResult
.
See normal_rotation_distribution
for details.
Manifolds.Rotations
β TypeRotations{N} <: AbstractManifold{β}
The manifold of rotation matrices of sice $n Γ n$, i.e. real-valued orthogonal matrices with determinant $+1$.
Constructor
Rotations(n)
Generate the manifold of $n Γ n$ rotation matrices.
ManifoldDiff.riemannian_Hessian
β Methodriemannian_Hessian(M::Rotations, p, G, H, X)
The Riemannian Hessian can be computed by adopting Eq. (5.6) [Ngu23], so very similar to the Stiefel manifold. The only difference is, that here the tangent vectors are stored in the Lie algebra, i.e. the update direction is actually $pX$ instead of just $X$ (in Stiefel). and that means the inverse has to be appliead to the (Euclidean) Hessian to map it into the Lie algebra.
Manifolds.angles_4d_skew_sym_matrix
β Methodangles_4d_skew_sym_matrix(A)
The Lie algebra of Rotations(4)
in $β^{4 Γ 4}$, $π°π¬(4)$, consists of $4 Γ 4$ skew-symmetric matrices. The unique imaginary components of their eigenvalues are the angles of the two plane rotations. This function computes these more efficiently than eigvals
.
By convention, the returned values are sorted in decreasing order (corresponding to the same ordering of angles as cos_angles_4d_rotation_matrix
).
Manifolds.normal_rotation_distribution
β Methodnormal_rotation_distribution(M::Rotations, p, Ο::Real)
Return a random point on the manifold Rotations
M
by generating a (Gaussian) random orthogonal matrix with determinant $+1$. Let
\[QR = A\]
be the QR decomposition of a random matrix $A$, then the formula reads
\[p = QD\]
where $D$ is a diagonal matrix with the signs of the diagonal entries of $R$, i.e.
\[D_{ij}=\begin{cases} \operatorname{sgn}(R_{ij}) & \text{if} \; i=j \\ 0 & \, \text{otherwise} \end{cases}.\]
It can happen that the matrix gets -1 as a determinant. In this case, the first and second columns are swapped.
The argument p
is used to determine the type of returned points.
ManifoldsBase.Weingarten
β MethodWeingarten(M::Rotations, p, X, V)
Compute the Weingarten map $\mathcal W_p$ at p
on the Stiefel
M
with respect to the tangent vector $X \in T_p\mathcal M$ and the normal vector $V \in N_p\mathcal M$.
The formula is due to [AMT13] given by
\[\mathcal W_p(X,V) = -\frac{1}{2}p\bigl(V^{\mathrm{T}}X - X^\mathrm{T}V\bigr)\]
ManifoldsBase.injectivity_radius
β Methodinjectivity_radius(M::Rotations, ::PolarRetraction)
Return the radius of injectivity for the PolarRetraction
on the Rotations
M
which is $\frac{Ο}{\sqrt{2}}$.
ManifoldsBase.inverse_retract
β Methodinverse_retract(M, p, q, ::PolarInverseRetraction)
Compute a vector from the tangent space $T_p\mathrm{SO}(n)$ of the point p
on the Rotations
manifold M
with which the point q
can be reached by the PolarRetraction
from the point p
after time 1.
The formula reads
\[\operatorname{retr}^{-1}_p(q) = -\frac{1}{2}(p^{\mathrm{T}}qs - (p^{\mathrm{T}}qs)^{\mathrm{T}})\]
where $s$ is the solution to the Sylvester equation
\[p^{\mathrm{T}}qs + s(p^{\mathrm{T}}q)^{\mathrm{T}} + 2I_n = 0.\]
ManifoldsBase.inverse_retract
β Methodinverse_retract(M::Rotations, p, q, ::QRInverseRetraction)
Compute a vector from the tangent space $T_p\mathrm{SO}(n)$ of the point p
on the Rotations
manifold M
with which the point q
can be reached by the QRRetraction
from the point q
after time 1.
ManifoldsBase.parallel_transport_direction
β Methodparallel_transport_direction(M::Rotations, p, X, d)
Compute parallel transport of vector X
tangent at p
on the Rotations
manifold in the direction d
. The formula, provided in [Ren11], reads:
\[\mathcal P_{q\gets p}X = q^\mathrm{T}p \operatorname{Exp}(d/2) X \operatorname{Exp}(d/2)\]
where $q=\exp_p d$.
The formula simplifies to identity for 2-D rotations.
ManifoldsBase.project
β Methodproject(M::Rotations, p; check_det = true)
Project p
to the nearest point on manifold M
.
Given the singular value decomposition $p = U Ξ£ V^\mathrm{T}$, with the singular values sorted in descending order, the projection is
\[\operatorname{proj}_{\mathrm{SO}(n)}(p) = U\operatorname{diag}\left[1,1,β¦,\det(U V^\mathrm{T})\right] V^\mathrm{T}\]
The diagonal matrix ensures that the determinant of the result is $+1$. If p
is expected to be almost special orthogonal, then you may avoid this check with check_det = false
.
ManifoldsBase.zero_vector
β Methodzero_vector(M::Rotations, p)
Return the zero tangent vector from the tangent space art p
on the Rotations
as an element of the Lie group, i.e. the zero matrix.
Literature
- [AMT13]
-
P. -.-A. Absil, R. Mahony and J. Trumpf. An Extrinsic Look at the Riemannian Hessian. In: Geometric Science of Information, editors, Frank Nielsen and FrΓ©dΓ©ric Barbaresco, 361β368. Springer Berlin Heidelberg (2013).
- [Ngu23]
-
D. Nguyen. Operator-Valued Formulas for Riemannian Gradient and Hessian and Families of Tractable Metrics in Riemannian Optimization. Journal of Optimization Theory and Applications 198, 135β164 (2023), arXiv:2009.10159.
- [Ren11]
-
Q. Rentmeesters. A gradient method for geodesic data fitting on some symmetric Riemannian manifolds. In: IEEE Conference on Decision and Control and European Control Conference, 7141β7146 (2011).