diff --git a/docs/make.jl b/docs/make.jl index 854f4a1..46b0e78 100755 --- a/docs/make.jl +++ b/docs/make.jl @@ -122,17 +122,17 @@ makedocs(; "Home" => "index.md", "About" => "about.md", (tutorials_in_menu ? [tutorials_menu] : [])..., + "Lie groups" => [ + "List of Lie Groups" => "groups/index.md", + "General Linear" => "groups/general_linear.md", + "Translation group" => "groups/translation.md", + ], "Interfaces" => [ "Lie group" => "interface/group.md", "Lie algebra" => "interface/algebra.md", "Group operation" => "interface/operations.md", "Group action" => "interface/actions.md", ], - "Lie groups" => [ - "List of Lie Groups" => "groups/index.md", - "General Linear" => "groups/general_linear.md", - "Translation group" => "groups/translation.md", - ], "Contributing to LieGroups.jl" => "contributing.md", "Notation" => "notation.md", "Changelog" => "news.md", diff --git a/src/documentation_glossary.jl b/src/documentation_glossary.jl index ff940bd..bde8c4c 100644 --- a/src/documentation_glossary.jl +++ b/src/documentation_glossary.jl @@ -51,6 +51,7 @@ end # LaTeX # Define LaTeX shortcuts _tex(args...; kwargs...) = glossary(:LaTeX, args...; kwargs...) +define!(:LaTeX, :big, raw"\big") define!(:LaTeX, :bigl, raw"\bigl") define!(:LaTeX, :bigr, raw"\bigr") define!(:LaTeX, :Big, raw"\Big") @@ -60,10 +61,28 @@ define!(:LaTeX, :def, raw"\coloneqq") define!(:LaTeX, :Cal, (letter) -> raw"\mathcal " * "$letter") define!(:LaTeX, :exp, raw"\exp") define!(:LaTeX, :Frak, (letter) -> raw"\mathfrak " * "$letter") +define!(:LaTeX, :l, "") # lazy fallback for sets +define!(:LaTeX, :r, "") # lazy fallback for sets define!(:LaTeX, :log, raw"\log") define!(:LaTeX, :qquad, raw"\qquad") define!(:LaTeX, :quad, raw"\quad") -define!(:LaTeX, :rm, (letter) -> raw"\mathrm " * "$letter") +define!(:LaTeX, :rm, (letter) -> raw"\mathrm" * "{$letter}") +define!( + :LaTeX, + :Set, + (content, size="") -> + _tex(Symbol("$(size)l")) * + raw"\{ " * + "$(content)" * + _tex(Symbol("$(size)r")) * + raw" \}", +) +define!( + :LaTeX, + :SetDef, + (elem, cond, size="") -> + _tex(:Set, elem * raw"\ " * _tex(Symbol("$(size)")) * raw"|\ " * "$(cond)", size), +) # # --- # Mathematics and semantic symbols diff --git a/src/group_operations/multiplication_operation.jl b/src/group_operations/multiplication_operation.jl index 5407da7..d1f2b53 100644 --- a/src/group_operations/multiplication_operation.jl +++ b/src/group_operations/multiplication_operation.jl @@ -13,3 +13,113 @@ abstract type AbstractMultiplicationGroupOperation <: AbstractGroupOperation end A grou poperation that is realised by a matrix multiplication. """ struct MatrixMultiplicationGroupOperation <: AbstractMultiplicationGroupOperation end + +Base.:*(e::Identity{AbstractMultiplicationGroupOperation}) = e +Base.:*(::Identity{AbstractMultiplicationGroupOperation}, p) = p +Base.:*(p, ::Identity{AbstractMultiplicationGroupOperation}) = p +function Base.:*( + e::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return e +end +function Base.:*( + ::Identity{AbstractMultiplicationGroupOperation}, e::Identity{AdditionGroupOperation} +) + return e +end +function Base.:*( + e::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return e +end + +Base.:/(p, ::Identity{AbstractMultiplicationGroupOperation}) = p +Base.:/(::Identity{AbstractMultiplicationGroupOperation}, p) = inv(p) +function Base.:/( + e::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return e +end + +Base.:\(p, ::Identity{AbstractMultiplicationGroupOperation}) = inv(p) +Base.:\(::Identity{AbstractMultiplicationGroupOperation}, p) = p +function Base.:\( + e::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return e +end + +Base.inv(e::Identity{AbstractMultiplicationGroupOperation}) = e + +LinearAlgebra.det(::Identity{AbstractMultiplicationGroupOperation}) = true +LinearAlgebra.adjoint(e::Identity{AbstractMultiplicationGroupOperation}) = e + +_doc_compose_mult = """ + compose(G::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, g, h) + compose!(G::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, k, g, h) + +Compute the group operation composition of `g` and `h` with respect to +an [`AbstractMultiplicationGroupOperation`](@ref) on `G`, which falls back to calling +`g*h`, where `*` is assumed to be overloaded accordingly. + +This can be computed in-place of `k`. +""" + +@doc "$(_doc_compose_mult)" +compose(::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, g, h) where {𝔽} + +@doc "$(_doc_compose_mult)" +compose!(::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, k, g, h) where {𝔽} + +function _compose!(::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, k, g, h) where {𝔽} + k .= g * h + return k +end + +_doc_identity_element_mult = """ + identity_element(G::LieGroup{𝔽,AbstractMultiplicationGroupOperation}) + identity_element!(G::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, e) + +Return the a point representation of the [`Identity`](@ref), +which for the [`AdditionGroupOperation`](@ref) is the one-element or identity array. +""" + +@doc "$(_doc_identity_element_mult)" +identity_element(::LieGroup{𝔽,AbstractMultiplicationGroupOperation}) where {𝔽} + +@doc "$(_doc_identity_element_mult)" +identity_element!(::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, e) where {𝔽} +function identity_element!( + ::LieGroup{𝔽,AbstractMultiplicationGroupOperation}, e::AbstractMatrix +) where {𝔽} + return copyto!(e, LinearAlgebra.I) +end + +LinearAlgebra.mul!(q, ::Identity{AbstractMultiplicationGroupOperation}, p) = copyto!(q, p) +LinearAlgebra.mul!(q, p, ::Identity{AbstractMultiplicationGroupOperation}) = copyto!(q, p) +function LinearAlgebra.mul!( + q::AbstractMatrix, + ::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return copyto!(q, I) +end +function LinearAlgebra.mul!( + q, + ::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return copyto!(q, one(q)) +end +function LinearAlgebra.mul!( + q::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, + ::Identity{AbstractMultiplicationGroupOperation}, +) + return q +end +Base.one(e::Identity{AbstractMultiplicationGroupOperation}) = e diff --git a/src/groups/general_linear_group.jl b/src/groups/general_linear_group.jl index 427e132..4e61fd7 100644 --- a/src/groups/general_linear_group.jl +++ b/src/groups/general_linear_group.jl @@ -1,8 +1,13 @@ -@doc raw""" +@doc """ GeneralLinearGroup{𝔽,T} -The general linear group ``\operatorname{GL}(n)`` is the set of all invertible matrices in ``𝔽^{n×n}`` +The general linear group ``$(_tex(:rm,"GL"))(n)`` is the set of all invertible matrices + +```math +$(_tex(:rm,"GL"))(n) = $(_tex(:SetDef, "g ∈ 𝔽^{n×n}", "$(_tex(:rm,"det"))(p) ≠ 0", "big")), +$(_tex(:qquad)) 𝔽 ∈ $(_tex(:Set, "ℝ, ℂ")), +``` equipped with the [`MatrixMultiplicationGroupOperation`](@ref) as the group operation. # Constructor @@ -13,9 +18,7 @@ Generate the general linear group group on ``𝔽^{n×n}``. All keyword arguments in `kwargs...` are passed on to [`InvertibleMatrices`](@extref `Manifolds.InvertibleMatrices`). """ const GeneralLinearGroup{𝔽,T} = LieGroup{ - 𝔽, - MatrixMultiplicationGroupOperation, - Manifolds.InvertibleMatrices{𝔽,T}, + 𝔽,MatrixMultiplicationGroupOperation,Manifolds.InvertibleMatrices{𝔽,T} } function GeneralLinearGroup(n::Int...; kwargs...)