Skip to content

Commit b93f902

Browse files
Port remaining groups (part 2/3): Special Linear (#30)
* Initical commit. * Finish most functions on Special Linear * Fix / finish docs. * Fix rendering. --------- Co-authored-by: Mateusz Baran <[email protected]>
1 parent 4f20c1a commit b93f902

15 files changed

+242
-24
lines changed

NEWS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Everything denoted by “formerly” refers to the previous name in [`Manifolds.
1515
* `LieGroup` (formerly `GroupManifold`) as well as the concrete groups
1616
* `TranslationGroup`
1717
* `SpecialEuclideanGroup` (formerly `SpecialEuclidean`) including
18-
* `SpecialEuclideanMatrixPoint` and `SpecialEuclideanMatrixTangentVector` when representing thepoints as affine (abstract) matrices
19-
* `SpecialEuclideanProductPoint` and `SpecialEuclideanProductTangentVector` when representing them in a product structure, e.g. as an `ArrayPartition` from [`RecursiveArrayTools`](https://github.com/SciML/RecursiveArrayTools.jl).
18+
* `SpecialEuclideanMatrixPoint` and `SpecialEuclideanMatrixTangentVector` when representing the points as affine (abstract) matrices
19+
* `SpecialEuclideanProductPoint` and `SpecialEuclideanProductTangentVector` when representing them in a product structure, that is as an `ArrayPartition` from [`RecursiveArrayTools`](https://github.com/SciML/RecursiveArrayTools.jl).
2020
* neither of those types is necessary, besides for conversion between both. The product representation differs for the left and right semidirect product, while the affine matrix variant does not.
2121
* `SpecialOrthogonalGroup` (formerly `SpecialOrthogonal`)
2222
* `SpecialUnitaryGroup` (formerly `SpecialUnitary`)
@@ -30,6 +30,7 @@ Everything denoted by “formerly” refers to the previous name in [`Manifolds.
3030
* `PowerGroupOperation` to internally avoid ambiguities. Since the constructor always expects a Lie group, this is only necessary internally
3131
* `ProductLieGroup` (formerly `ProductGroup`)
3232
* `RightSemidirectProductLieGroup`
33+
* `SpecialLinearGroup` (formerly `SpecialLinear`)
3334
* `SymplecticGroup`
3435
* `` (alias for `RightSemidirectProductGroupOperation` when a `default_right_action(G,H)` is defined for the two groups)
3536
* a `ValidationLieGroup` verifying input and output of all interface functions, similar to the [`ValidationManifold`](https://juliamanifolds.github.io/ManifoldsBase.jl/stable/manifolds/#A-manifold-for-validation) which can also be used internally.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LieGroupsRecursiveArrayToolsExt = "RecursiveArrayTools"
2020
[compat]
2121
Aqua = "0.8"
2222
LinearAlgebra = "1.10"
23-
Manifolds = "0.10.13"
23+
Manifolds = "0.10.15"
2424
ManifoldsBase = "1"
2525
Quaternions = "0.7.6"
2626
Random = "1.10"

docs/make.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,14 @@ makedocs(;
146146
(tutorials_in_menu ? [tutorials_menu] : [])...,
147147
"Lie groups" => [
148148
"List of Lie groups" => "groups/index.md",
149-
"General Linear" => "groups/general_linear.md",
149+
"General linear group" => "groups/general_linear.md",
150150
"Heisenberg group" => "groups/heisenberg_group.md",
151151
"Orthogonal group" => "groups/orthogonal_group.md",
152152
"Power group" => "groups/power_group.md",
153153
"Product group" => "groups/product_group.md",
154154
"Semidirect product group" => "groups/semidirect_product_group.md",
155155
"Special Euclidean group" => "groups/special_euclidean_group.md",
156+
"Special linear" => "groups/special_linear.md",
156157
"Special orthogonal group" => "groups/special_orthogonal_group.md",
157158
"Special unitary group" => "groups/special_unitary_group.md",
158159
"Symplectic group" => "groups/symplectic_group.md",

docs/src/groups/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
| [`ProductLieGroup`](@ref) | [`ProductManifold`](@extref `ManifoldsBase.ProductManifold`) | [``](@ref ProductGroupOperation) | [`×`](@ref LinearAlgebra.cross(::AbstractGroupOperation...)) of two Lie groups is a constructor |
1212
| [`LeftSemidirectProductLieGroup`](@ref) | [`ProductManifold`](@extref `ManifoldsBase.ProductManifold`) | [``](@ref LeftSemidirectProductGroupOperation) | [``](@ref ⋉(L1::LieGroup, L2::LieGroup)) of 2 Lie groups is a constructor, similarly [``](@ref ⋊(L1::LieGroup, L2::LieGroup)) for the right variant |
1313
| [`SpecialEuclideanGroup`](@ref) | [`Rotations`](@extref `Manifolds.Rotations`)[``](@ref LeftSemidirectProductGroupOperation)[`Euclidean`](@extref `Manifolds.Rotations`) | [``](@ref LeftSemidirectProductGroupOperation) | Analogously you can also use a [``](@ref RightSemidirectProductGroupOperation) if you prefer tuples `(t,R)` having the rotation matrix in the second component |
14+
| [`SpecialLinearGroup`](@ref) | [`GeneralUnitaryMatrices`](@extref `Manifolds.GeneralUnitaryMatrices`) with determinant one | [`*`](@ref MatrixMultiplicationGroupOperation) | |
1415
| [`SpecialOrthogonalGroup`](@ref) | [`Rotations`](@extref `Manifolds.Rotations`) | [`*`](@ref MatrixMultiplicationGroupOperation) | |
1516
| [`SpecialUnitaryGroup`](@ref) | [`GeneralUnitaryMatrices`](@extref `Manifolds.GeneralUnitaryMatrices`) | [`*`](@ref MatrixMultiplicationGroupOperation) | |
1617
| [`SymplecticGroup`](@ref) | [`SymplecticMatrices`](@extref `Manifolds.SymplecticMatrices`) | [`*`](@ref MatrixMultiplicationGroupOperation) | |

docs/src/groups/special_linear.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# The special linear group
2+
3+
```@autodocs
4+
Modules = [LieGroups]
5+
Pages = ["groups/special_linear_group.jl"]
6+
Order = [:type, :function]
7+
```

src/LieGroups.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ include("groups/validation_group.jl")
4444
include("groups/translation_group.jl")
4545
include("groups/general_linear_group.jl")
4646
include("groups/heisenberg_group.jl")
47+
include("groups/special_linear_group.jl")
4748
include("groups/symplectic_group.jl")
4849

4950
# includes generic implementations for O(n), U(n), SO(n), SO(n), so we load this first
@@ -87,7 +88,8 @@ export InverseLeftGroupOperationAction, InverseRightGroupOperationAction
8788
export GeneralLinearGroup
8889
export HeisenbergGroup
8990
export OrthogonalGroup
90-
export SpecialEuclideanGroup, SpecialOrthogonalGroup, SpecialUnitaryGroup
91+
export SpecialEuclideanGroup, SpecialLinearGroup
92+
export SpecialOrthogonalGroup, SpecialUnitaryGroup
9193
export SymplecticGroup
9294
export TranslationGroup
9395
export UnitaryGroup

src/Lie_algebra/Lie_algebra_interface.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ _doc_hat = """
219219
hat(G::LieAlgebra, c, T::Type)
220220
hat!(G::LieAlgebra, X::T, c)
221221
222-
Compute the hat map ``(⋅)^̂ : $(_tex(:Cal, "V")) → 𝔤`` that maps a vector of coordinates ``$(_tex(:vec, "c"))$(_tex(:Cal, "V"))``,
222+
Compute the hat map ``(⋅)^{\\wedge}: $(_tex(:Cal, "V")) → 𝔤`` that maps a vector of coordinates ``$(_tex(:vec, "c"))$(_tex(:Cal, "V"))``,
223223
to a tangent vector ``X ∈ $(_math(:𝔤))``.
224224
The coefficients are given with respect to a specific basis to a tangent vector in the Lie algebra
225225
@@ -263,7 +263,7 @@ on the [`AbstractLieGroup`](@ref) of `𝔤`
263263
"""
264264
function ManifoldsBase.is_point(𝔤::LieAlgebra, X::T; kwargs...) where {T}
265265
return ManifoldsBase.is_vector(
266-
base_lie_group(𝔤), identity_element(base_lie_group(𝔤), T), X; kwargs...
266+
base_lie_group(𝔤), identity_element(base_lie_group(𝔤), T), X, false; kwargs...
267267
)
268268
end
269269

@@ -360,7 +360,7 @@ _doc_vee = """
360360
vee(𝔤::LieAlgebra, X)
361361
vee!(𝔤::LieAlgebra, c, X)
362362
363-
Compute the vee map ``(⋅)^∨: $(_math(:𝔤))$(_tex(:Cal, "V"))`` that maps a tangent vector `X`
363+
Compute the vee map ``(⋅){\\vee}: $(_math(:𝔤))$(_tex(:Cal, "V"))`` that maps a tangent vector `X`
364364
from the [`LieAlgebra`](@ref) $(_math(:𝔤)) to its coordinates with respect to the [`DefaultLieAlgebraOrthogonalBasis`](@ref) basis in the Lie algebra
365365
366366
```math

src/documentation_glossary.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,21 @@ define!(:Math, :se, _math(:se, :symbol))
171171
define!(:Math, :SE, :symbol, _tex(:rm, "SE"))
172172
define!(:Math, :SE, :description, "the special Euclidean group")
173173
define!(:Math, :SE, _math(:SE, :symbol))
174+
define!(:Math, :SL, :symbol, _tex(:rm, "SL"))
175+
define!(:Math, :SL, :description, "the special linear group")
176+
define!(:Math, :SL, _math(:SL, :symbol))
174177
define!(:Math, :SO, :symbol, _tex(:rm, "SO"))
175178
define!(:Math, :SO, :description, "the special orthogonal group")
176179
define!(:Math, :SO, _math(:SO, :symbol))
177-
define!(:Math, :so, :symbol, _tex(:frak, "so"))
178-
define!(:Math, :so, :description, "the Lie algebra of so special orthogonal group")
179-
define!(:Math, :so, _math(:so, :symbol))
180180
define!(:Math, :Sp, :symbol, _tex(:rm, "Sp"))
181181
define!(:Math, :Sp, :description, "the real symplectic group")
182182
define!(:Math, :Sp, _math(:Sp, :symbol))
183+
define!(:Math, :sl, :symbol, _tex(:frak, "sl"))
184+
define!(:Math, :sl, :description, "the Lie algebra of so special linear group")
185+
define!(:Math, :sl, _math(:sl, :symbol))
186+
define!(:Math, :so, :symbol, _tex(:frak, "so"))
187+
define!(:Math, :so, :description, "the Lie algebra of so special orthogonal group")
188+
define!(:Math, :so, _math(:so, :symbol))
183189
define!(:Math, :sp, :symbol, _tex(:frak, "sp"))
184190
define!(:Math, :sp, :description, "the Lie algebra of so special orthogonal group")
185191
define!(:Math, :sp, _math(:so, :symbol))

src/groups/special_linear_group.jl

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
@doc """
2+
SpecialLinear{𝔽,T}
3+
4+
The special linear group ``$(_math(:SL))(n,𝔽)`` is the group of all invertible matrices
5+
with unit determinant in ``𝔽^{n×n}`` and the [`MatrixMultiplicationGroupOperation`](@ref) as group operation.
6+
7+
The Lie algebra ``$(_math(:sl))(n, 𝔽) = T_e $(_math(:SL))(n,𝔽)`` is the set of all matrices in
8+
``𝔽^{n×n}`` with trace of zero. By default, tangent vectors ``X_p ∈ T_p $(_math(:SL))(n,𝔽)``
9+
for ``p ∈ $(_math(:SL))(n,𝔽)`` are represented with their corresponding Lie algebra vector
10+
``X_e = p^{-1}X_p ∈ 𝔰𝔩(n, 𝔽)``.
11+
12+
# Constructor
13+
14+
GeneralLinearGroup(n::Int, field=ℝ; kwargs...)
15+
16+
Generate the general linear group group on ``𝔽^{n×n}``.
17+
All keyword arguments in `kwargs...` are passed on to [`DeterminantOneMatrices`](@extref `Manifolds.DeterminantOneMatrices`).
18+
"""
19+
const SpecialLinearGroup{𝔽,T} = LieGroup{
20+
𝔽,MatrixMultiplicationGroupOperation,DeterminantOneMatrices{𝔽,T}
21+
}
22+
23+
function SpecialLinearGroup(n::Int, field=ManifoldsBase.ℝ; kwargs...)
24+
M = Manifolds.DeterminantOneMatrices(n, field; kwargs...)
25+
return SpecialLinearGroup{typeof(M).parameters...}(
26+
M, MatrixMultiplicationGroupOperation()
27+
)
28+
end
29+
30+
# TODO: document hat/vee with the corresponding formulae
31+
32+
function get_coordinates_lie!(
33+
::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup},
34+
c,
35+
X,
36+
::DefaultLieAlgebraOrthogonalBasis{ℝ},
37+
)
38+
c .= X[1:(end - 1)]
39+
return c
40+
end
41+
42+
function get_vector_lie!(
43+
𝔤::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup},
44+
X,
45+
c,
46+
::DefaultLieAlgebraOrthogonalBasis{ℝ},
47+
)
48+
X[1:(end - 1)] .= c
49+
X[end] = 0
50+
X[end] = -tr(X)
51+
return X
52+
end
53+
54+
_doc_hat_special_linear = """
55+
X = hat(𝔤::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, c)
56+
hat!(𝔤::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, X, c)
57+
58+
Compute the hat map ``(⋅)^{\\wedge} : ℝ^{n^2-1} → 𝔤`` that turns a vector of coordinates `c`
59+
into a tangent vector in the Lie algebra.
60+
61+
The formula on the Lie algebra ``𝔤`` of the [`SpecialLinearGroup`](@ref)`(n)` is given by
62+
reshaping ``c ∈ ℝ^{n^2-1}`` into an ``n``-by``n`` matrix ``X`` with the final entry `X[n,n]`
63+
initialised to zero and then set to the trace of this initial matrix.
64+
65+
This can be computed in-place of `X`.
66+
"""
67+
68+
@doc "$(_doc_hat_special_linear)"
69+
ManifoldsBase.hat(
70+
::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, c
71+
)
72+
73+
@doc "$(_doc_hat_special_linear)"
74+
ManifoldsBase.hat!(
75+
::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, X, c
76+
)
77+
78+
function Base.show(
79+
io::IO, ::SpecialLinearGroup{𝔽,ManifoldsBase.TypeParameter{Tuple{n}}}
80+
) where {𝔽,n}
81+
return print(io, "SpecialLinearGroup($n, $(𝔽))")
82+
end
83+
function Base.show(io::IO, G::SpecialLinearGroup{𝔽,Tuple{Int}}) where {𝔽}
84+
M = base_manifold(G)
85+
n = ManifoldsBase.get_parameter(M.size)[1]
86+
return print(io, "SpecialLinearGroup($n, $(𝔽); parameter=:field)")
87+
end
88+
89+
_doc_vee_special_linear = """
90+
c = vee(𝔤::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, X)
91+
vee!(𝔤::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, c, X)
92+
93+
Compute the vee map ``(⋅)^{\\vee}: $(_math(:𝔤)) → ℝ^{n^2-1}`` that maps a tangent vector
94+
from the Lie algebra to a vector of coordinates `c`.
95+
96+
The formula on the Lie algebra ``𝔤`` of the [`SpecialLinearGroup`](@ref)`(n)` is given by
97+
reshaping ``X ∈ ℝ^{n×n}`` into a vector and omitting the last entry, since that
98+
can be reconstructed by considering that ``X`` has to be of trace zero.
99+
100+
This can be computed in-place of `c`.
101+
"""
102+
103+
@doc "$(_doc_vee_special_linear)"
104+
ManifoldsBase.vee(
105+
::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, X
106+
)
107+
108+
@doc "$(_doc_vee_special_linear)"
109+
ManifoldsBase.vee!(
110+
::LieAlgebra{ℝ,MatrixMultiplicationGroupOperation,<:SpecialLinearGroup}, c, X
111+
)

src/groups/special_unitary_group.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ All keyword arguments in `kwargs...` are passed on to [`Rotations`](@extref `Man
1313
const SpecialUnitaryGroup{T} = LieGroup{
1414
ManifoldsBase.ℂ,
1515
MatrixMultiplicationGroupOperation,
16-
Manifolds.GeneralUnitaryMatrices{T,ℂ,Manifolds.DeterminantOneMatrices},
16+
Manifolds.GeneralUnitaryMatrices{T,ℂ,Manifolds.DeterminantOneMatrixType},
1717
}
1818

1919
function SpecialUnitaryGroup(n::Int; kwargs...)
2020
GU = Manifolds.GeneralUnitaryMatrices(
21-
n, ManifoldsBase.ℂ, Manifolds.DeterminantOneMatrices; kwargs...
21+
n, ManifoldsBase.ℂ, Manifolds.DeterminantOneMatrixType; kwargs...
2222
)
2323
return SpecialUnitaryGroup{typeof(GU).parameters[1]}(
2424
GU, MatrixMultiplicationGroupOperation()

0 commit comments

Comments
 (0)