Skip to content

Commit

Permalink
Starts a bit towards multiplication groups.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Oct 24, 2024
1 parent e276573 commit 1ca24a3
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 11 deletions.
10 changes: 5 additions & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
21 changes: 20 additions & 1 deletion src/documentation_glossary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
110 changes: 110 additions & 0 deletions src/group_operations/multiplication_operation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 8 additions & 5 deletions src/groups/general_linear_group.jl
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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...)
Expand Down

0 comments on commit 1ca24a3

Please sign in to comment.