Skip to content

Commit

Permalink
adds doc strings to the generic addition operations (part I)
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Oct 14, 2024
1 parent a64134c commit 1f0d40e
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions src/group_operations/addition.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,44 @@ Base.:-(e::Identity{AdditionGroupOperation}, ::Identity{AdditionGroupOperation})
Base.:-(::Identity{AdditionGroupOperation}, g) = -g
Base.:-(g, ::Identity{AdditionGroupOperation}) = g

_doc_compose_add = """
compose(G::LieGroup{𝔽,AdditionGroupOperation}, g, h)
compose!(G::LieGroup{𝔽,AdditionGroupOperation}, k, g, h)
Copmute the group operation composition of `g` and `h` with respect to
the [`AdditionGroupOperation`](@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_add)"
compose(::LieGroup{𝔽,AdditionGroupOperation}, g, h) where {𝔽}

@doc "$(_doc_compose_add)"
compose!(::LieGroup{𝔽,AdditionGroupOperation}, k, g, h) where {𝔽}

function _compose!(G::LieGroup{𝔽,AdditionGroupOperation}, k, g, h) where {𝔽}
ManifoldsBase.copyto!(G, k, g + h)
return k
end

_doc_exp_add = """
exp(G::LieGroup{𝔽,AdditionGroupOperation}, e::Identity{AdditionGroupOperation}, X, t=1)
exp!(G::LieGroup{𝔽,AdditionGroupOperation}, g, e::Identity{AdditionGroupOperation}, X, t)
Compute the Lie group exponential on a [`LieGroup`](@ref) with an [`AdditionGroupOperation`](@ref).
This can be computed in-place of `g`.
Since `e` is just the zero-element with respect to the corresponding `+`, the formula reads ``g=0+X=X``.
"""
"""

@doc "$(_doc_exp_add)"
Base.exp(
::LieGroup{𝔽,AdditionGroupOperation}, ::Identity{AdditionGroupOperation}, X
::LieGroup{𝔽,AdditionGroupOperation}, ::Identity{AdditionGroupOperation}, X, t
) where {𝔽}

@doc "$(_doc_exp_add)"
function ManifoldsBase.exp!(
G::LieGroup{𝔽,AdditionGroupOperation},
g,
Expand All @@ -50,14 +77,24 @@ function inv!(G::LieGroup{𝔽,AdditionGroupOperation}, h, g) where {𝔽}
return copyto!(G, h, -g)
end

_doc_log_add = """
log(G::LieGroup{𝔽,AdditionGroupOperation}, e::Identity{AdditionGroupOperation}, g)
log!(G::LieGroup{𝔽,AdditionGroupOperation}, X, e::Identity{AdditionGroupOperation}, g)
Compute the Lie group logarithm on a [`LieGroup`](@ref) with an [`AdditionGroupOperation`](@ref).
This can be computed in-place of `X`.
Since `e` is just the zero-element with respect to the corresponding `+`, the formula reads ``X=g-0=g``.
"""
"""

@doc "$(_doc_log_add)"
ManifoldsBase.log(
G::LieGroup{𝔽,AdditionGroupOperation}, ::Identity{AdditionGroupOperation}, q
) where {𝔽}

@doc "$(_doc_log_add)"
function ManifoldsBase.log!(
G::LieGroup{𝔽,AdditionGroupOperation}, X, ::Identity{AdditionGroupOperation}, q
G::LieGroup{𝔽,AdditionGroupOperation}, X, ::Identity{AdditionGroupOperation}, g
) where {𝔽}
return copyto!(G, X, q)
return copyto!(G, X, g)
end

0 comments on commit 1f0d40e

Please sign in to comment.