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.RotationsType
Rotations{T} <: AbstractManifold{ℝ}

The manifold of rotation matrices of size $n×n$, i.e. real-valued orthogonal matrices with determinant $+1$.

Constructor

Rotations(n::Int; parameter::Symbol=:type)

Generate the manifold of $n×n$ rotation matrices.

source
ManifoldDiff.riemannian_HessianMethod
riemannian_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.

source
Manifolds.angles_4d_skew_sym_matrixMethod
angles_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).

source
Manifolds.normal_rotation_distributionMethod
normal_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.

source
ManifoldsBase.WeingartenMethod
Weingarten(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)\]

source
ManifoldsBase.inverse_retractMethod
inverse_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.$

source
ManifoldsBase.inverse_retractMethod
inverse_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.

source
ManifoldsBase.parallel_transport_directionMethod
parallel_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.

source
ManifoldsBase.projectMethod
project(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.

source
ManifoldsBase.sectional_curvature_maxMethod
sectional_curvature_max(::Rotations)

Sectional curvature of Rotations M is equal to 0 for Rotations(1) and Rotations(2), less than or equal to 1/8 for Rotations(3) and less than or equal to 1/4 for higher-dimensional rotations manifolds.

For reference, see [Ge14], Lemma 2.5 and [CE08], Corollary 3.19.

source
ManifoldsBase.zero_vectorMethod
zero_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.

source

Literature

[AMT13]
P. -.-A. Absil, R. Mahony and J. Trumpf. An Extrinsic Look at the Riemannian Hessian. In: Geometric Science of Information, edited by F. Nielsen and F. Barbaresco (Springer Berlin Heidelberg, 2013); pp. 361–368.
[CE08]
J. Cheeger and D. G. Ebin. Comparison Theorems in Riemannian Geometry (American Mathematical Society, Providence, R.I, 2008).
[Ge14]
[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 (2011); pp. 7141–7146.