Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
8e7ffcb
Initial sketch of type
kellertuer Jul 22, 2021
677a7f0
Refactor Part I: remove make_identity, identity and identity! (also i…
kellertuer Jul 22, 2021
c5f3280
Finish reduction of Identity to a plain non-parametric type.
kellertuer Jul 23, 2021
4e67bf3
runs formatter.
kellertuer Jul 23, 2021
e4ccf43
Further fixes, excluding parameters in identity construction.
kellertuer Jul 23, 2021
860adfc
further work on allocation.
kellertuer Jul 23, 2021
7b838bb
Introduce identity, identity! and is_identity
kellertuer Jul 25, 2021
cc5d949
refactor identity to be parametrised by AbstractGroupOperation
kellertuer Jul 25, 2021
8c3f8cd
fix a few renaming issues and ambiguities.
kellertuer Jul 25, 2021
4e0879f
change some old ooccurences ot get_point/get_point! to the new identi…
kellertuer Jul 25, 2021
c82e681
reduce ambiguities.
kellertuer Jul 25, 2021
6ee0e57
add another special case.
kellertuer Jul 25, 2021
0d18fdb
Fix two further errors.
kellertuer Jul 25, 2021
b79384a
removing some ambiguities
mateuszbaran Jul 26, 2021
7a2d769
export adapted to new names.
kellertuer Jul 26, 2021
ece25db
a bunch of improvements
mateuszbaran Jul 26, 2021
6c10e55
Trying to fix things made more things error :/ and we have a problem …
kellertuer Jul 27, 2021
85e931b
Forgot to run formatter.
kellertuer Jul 27, 2021
56ec32c
Runs formatter again after updating formatter locally...
kellertuer Jul 27, 2021
fdbc608
Runs formatter again, after I do not know what now changed.
kellertuer Jul 27, 2021
1aaca22
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 27, 2021
431f71e
fixes mul!
kellertuer Jul 27, 2021
adc304b
Fixes a few tests.
kellertuer Jul 28, 2021
f7495ce
Formatter -.- ...
kellertuer Jul 28, 2021
cf0988a
rename group_exp/log to log/exp_lie
kellertuer Jul 28, 2021
e7cb6ca
introduce get coordinates and vectors on the Lie algebra with a diffe…
kellertuer Jul 28, 2021
4207ee5
runs formatter.
kellertuer Jul 28, 2021
1240b5e
tests are shorter with the new method since one can not call get_vect…
kellertuer Jul 28, 2021
17a0f72
introduce hat/vee on group manifolds, reintroduce transpose
kellertuer Jul 28, 2021
9f511e8
Fix ValidationGroup
kellertuer Jul 28, 2021
81efabb
fixes another metric test.
kellertuer Jul 28, 2021
432bb08
fixes a few more fixes.
kellertuer Jul 29, 2021
9303ed3
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 29, 2021
3575c1c
Fix special orthogonal (after JuliaManifolds/ManifoldsBase.jl#81 is f…
kellertuer Jul 29, 2021
c476a58
Fix special Euclidean.
kellertuer Jul 29, 2021
2609aad
runs formatter.
kellertuer Jul 29, 2021
f32a3ec
Fix metric (by avoiding allocation of concrete identity)
kellertuer Jul 29, 2021
407e638
resolves further errors in product group
kellertuer Jul 29, 2021
11ff63b
Fix two further tests and a docstring
kellertuer Jul 29, 2021
f5b986f
minor fixes to product_group.jl
mateuszbaran Jul 29, 2021
1a9d82e
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 29, 2021
793cffe
fix an error the merge introduced.
kellertuer Jul 29, 2021
6dbf449
Adapt product manifold to the more strict log_lie (only working on Pr…
kellertuer Jul 29, 2021
777ba69
use the right copyto! internally. Maybe this also fixes copyto togeth…
kellertuer Jul 29, 2021
3ce5c46
it seems that copyto! with a group does not always work.
kellertuer Jul 29, 2021
9348fa0
better imports.
kellertuer Jul 29, 2021
894e5ea
switch to group copies to be more flexible.
kellertuer Jul 29, 2021
9ba25be
fix the inner `log_lie!`call.
kellertuer Jul 30, 2021
ba364eb
bump dependenciess & version
kellertuer Jul 30, 2021
d877317
a test for `is_point` and identity element
mateuszbaran Jul 30, 2021
4eeb7e5
One more test and docstring updates
mateuszbaran Jul 30, 2021
b383500
Apply suggestions from code review
kellertuer Jul 30, 2021
ed53c17
Update docs/src/manifolds/group.md
kellertuer Jul 30, 2021
b84a3bf
Update docs/src/manifolds/group.md
kellertuer Jul 30, 2021
d3eba66
parametrizing some Identity types
mateuszbaran Jul 30, 2021
7aa7a5c
Merge branch 'kellertuer/refactor-identity-type' of https://github.co…
mateuszbaran Jul 30, 2021
5896129
readd identity_element but remove the nonmutating variants from the d…
kellertuer Jul 30, 2021
0ae475c
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 30, 2021
b8e11ba
a few more identity type parameters
mateuszbaran Jul 30, 2021
02801a6
formatting
mateuszbaran Jul 30, 2021
ba78f4d
Merge branch 'kellertuer/refactor-identity-type' of https://github.co…
mateuszbaran Jul 30, 2021
badac33
disambiguation
mateuszbaran Jul 30, 2021
2a31b14
a bit more testing
mateuszbaran Jul 30, 2021
a23dfeb
group isapprox cleanup
mateuszbaran Jul 30, 2021
3577cab
fix docs.
kellertuer Jul 30, 2021
d403a8f
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 30, 2021
4dd7172
fixing some Identity bugs
mateuszbaran Jul 30, 2021
ca9c1fc
more tests
mateuszbaran Jul 30, 2021
e130a00
More product manifold identity tests.
kellertuer Jul 30, 2021
2b6e881
remove an ambiguous function, that is now implemented a level higher.
kellertuer Jul 31, 2021
97e76ac
Merge branch 'kellertuer/refactor-identity-type' of github.com:JuliaM…
kellertuer Jul 31, 2021
162b754
add a case that I thought was covered for the abstract case, but it w…
kellertuer Jul 31, 2021
8423fbd
Fix another special case that I thought was handled already a level h…
kellertuer Jul 31, 2021
c847477
Merge branch 'master' into kellertuer/refactor-identity-type
kellertuer Jul 31, 2021
fdbd03e
removes a few unreached functions and increases coverage for the rest.
kellertuer Jul 31, 2021
b57b8c5
Fix a typo.
kellertuer Aug 1, 2021
553ea13
one more test
mateuszbaran Aug 1, 2021
a255de0
forwarding of `identity_element`
mateuszbaran Aug 1, 2021
3620105
remove a case that is already handles in 266+
kellertuer Aug 1, 2021
c49a725
increase test coverage.
kellertuer Aug 1, 2021
57ed3e6
delete exp_lie and log_lie for special orthogonal since these are alr…
kellertuer Aug 1, 2021
e6934d9
resolving ambiguities
mateuszbaran Aug 1, 2021
b3bb593
increase test coverage.
kellertuer Aug 2, 2021
fe9c539
Set exp_lie and log_lie to parent on group manifolds (they are transp…
kellertuer Aug 3, 2021
b33932a
remove some overspecific parents – and an unnecessary special dispatc…
kellertuer Aug 3, 2021
d035d0c
add a test for mul! with an AbstractManifoldPoint that has a `one` op…
kellertuer Aug 3, 2021
e7d6f69
fewer isapprox ambiguities
mateuszbaran Aug 3, 2021
fb85f04
formatting
mateuszbaran Aug 3, 2021
dd5e1c1
trying to make SE(n) tests less random
mateuszbaran Aug 3, 2021
a7fb773
testing some utilities
mateuszbaran Aug 3, 2021
be37661
Comment out all VisualRegression tests, might still code cover plot r…
kellertuer Aug 4, 2021
2c32608
Remove VisualRegressiontests for now.
kellertuer Aug 4, 2021
1f9a429
my bad.
kellertuer Aug 4, 2021
313d357
Loosen compat for plots.
kellertuer Aug 4, 2021
8449100
bump documenter to run on Julia 1.6
kellertuer Aug 4, 2021
5f3602d
...
kellertuer Aug 4, 2021
725aa48
Update docs/Project.toml
kellertuer Aug 4, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: 1.5
version: 1.6
- uses: julia-actions/julia-docdeploy@v1
env:
PYTHON: ""
Expand Down
8 changes: 4 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Manifolds"
uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e"
authors = ["Seth Axen <seth.axen@gmail.com>", "Mateusz Baran <mateuszbaran89@gmail.com>", "Ronny Bergmann <manopt@ronnybergmann.net>", "Antoine Levitt <antoine.levitt@gmail.com>"]
version = "0.5.13"
version = "0.6.0"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down Expand Up @@ -32,8 +32,8 @@ FiniteDifferences = "0.12"
HybridArrays = "0.4"
Kronecker = "0.4"
LightGraphs = "1"
ManifoldsBase = "0.12.1"
Plots = "~1.6, =1.10.5"
ManifoldsBase = "0.12.4"
Plots = "1"
RecipesBase = "1.1"
Requires = "0.5, 1"
SimpleWeightedGraphs = "1"
Expand Down Expand Up @@ -62,4 +62,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"

[targets]
test = ["Test", "Colors", "DoubleFloats", "FiniteDiff", "ForwardDiff", "Gtk", "ImageIO", "ImageMagick", "OrdinaryDiffEq", "NLsolve", "Plots", "PyPlot", "Quaternions", "QuartzImageIO", "RecipesBase", "ReverseDiff", "VisualRegressionTests"]
test = ["Test", "Colors", "DoubleFloats", "FiniteDiff", "ForwardDiff", "Gtk", "ImageIO", "ImageMagick", "OrdinaryDiffEq", "NLsolve", "Plots", "PyPlot", "Quaternions", "QuartzImageIO", "RecipesBase", "ReverseDiff"]
6 changes: 3 additions & 3 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Documenter = "0.24, 0.25, 0.26"
Documenter = "0.24, 0.25, 0.26, 0.27"
HybridArrays = "0.4"
ManifoldsBase = "0.12"
Plots = "= 1.10.5"
ManifoldsBase = "0.12.4"
Plots = "1"
PyPlot = "2.9"
StaticArrays = "1.0"
3 changes: 2 additions & 1 deletion docs/src/manifolds/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ Depth = 3

The following operations are available for group manifolds:

* [`identity`](@ref): get the identity of the group.
* [`Identity`](@ref): an allocation-free representation of the identity element of the group.
* [`inv`](@ref): get the inverse of a given element.
* [`compose`](@ref): compose two given elements of a group.
* [`identity_element`](@ref) get the identity element of the group, in the representation used by other points from the group.

Comment thread
kellertuer marked this conversation as resolved.
### Group manifold

Expand Down
48 changes: 35 additions & 13 deletions src/Manifolds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ import ManifoldsBase:
check_point,
check_point__transparent,
check_vector,
copy,
copyto!,
decorated_manifold,
decorator_transparent_dispatch,
default_decorator_dispatch,
distance,
dual_basis,
embed,
embed!,
exp,
exp!,
exp!__intransparent,
get_basis,
Expand All @@ -32,6 +35,8 @@ import ManifoldsBase:
get_vector!,
get_vectors,
gram_schmidt,
hat,
hat!,
injectivity_radius,
inner,
inner__intransparent,
Expand All @@ -58,12 +63,25 @@ import ManifoldsBase:
vector_transport_direction!,
vector_transport_to,
vector_transport_to!,
vee,
vee!,
zero_vector,
zero_vector!,
CotangentSpace,
TangentSpace
import Base:
copyto!, convert, foreach, in, isapprox, isempty, length, ndims, showerror, size
copyto!,
convert,
foreach,
identity,
in,
isapprox,
isempty,
length,
ndims,
showerror,
size,
transpose

using Base.Iterators: repeated
using Distributions
Expand Down Expand Up @@ -146,8 +164,6 @@ include("riemannian_diff.jl")
include("manifolds/ConnectionManifold.jl")
include("manifolds/MetricManifold.jl")
include("manifolds/VectorBundle.jl")

# It's included early to ensure visibility of `Identity`
include("groups/group.jl")

# Features I: Which are extended on Meta Manifolds
Expand Down Expand Up @@ -228,7 +244,7 @@ include("groups/connections.jl")
include("groups/metric.jl")
include("groups/group_action.jl")
include("groups/group_operation_action.jl")
include("groups/array_manifold.jl")
include("groups/validation_group.jl")
include("groups/product_group.jl")
include("groups/semidirect_product_group.jl")

Expand Down Expand Up @@ -468,6 +484,8 @@ export ×,
get_embedding,
hat,
hat!,
identity_element,
identity_element!,
induced_basis,
incident_log,
injectivity_radius,
Expand All @@ -476,10 +494,11 @@ export ×,
inverse_retract,
inverse_retract!,
isapprox,
is_group_decorator,
is_decorator_transparent,
is_default_metric,
is_default_decorator,
is_default_metric,
is_group_decorator,
is_identity,
is_point,
is_vector,
isapprox,
Expand Down Expand Up @@ -578,15 +597,17 @@ export adjoint_action,
compose,
compose!,
direction,
exp_lie,
exp_lie!,
g_manifold,
group_exp,
group_exp!,
group_log,
group_log!,
get_coordinates_lie,
get_coordinates_lie!,
get_vector_lie,
get_vector_lie!,
has_biinvariant_metric,
has_invariant_metric,
identity,
identity!,
identity_element,
identity_element!,
inv,
inv!,
invariant_metric_dispatch,
Expand All @@ -600,7 +621,8 @@ export adjoint_action,
inverse_translate_diff!,
lie_bracket,
lie_bracket!,
make_identity,
log_lie,
log_lie!,
optimal_alignment,
optimal_alignment!,
screw_matrix,
Expand Down
28 changes: 13 additions & 15 deletions src/groups/circle_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@ adjoint_action(::CircleGroup, p, X) = X

adjoint_action!(::CircleGroup, Y, p, X) = copyto!(Y, X)

function compose(G::CircleGroup, p::AbstractVector, q::AbstractVector)
function _compose(G::CircleGroup, p::AbstractVector, q::AbstractVector)
return map(compose, repeated(G), p, q)
end

compose!(G::CircleGroup, x, p, q) = copyto!(x, compose(G, p, q))
_compose!(G::CircleGroup, x, p, q) = copyto!(x, compose(G, p, q))

Base.identity(::CircleGroup, p::AbstractVector) = map(one, p)
Base.identity(G::GT, e::Identity{GT}) where {GT<:CircleGroup} = e

identity!(::CircleGroup, q::AbstractVector, p) = copyto!(q, 1)
identity!(::GT, q::AbstractVector, ::Identity{GT}) where {GT<:CircleGroup} = copyto!(q, 1)
identity_element(G::CircleGroup) = 1.0
identity_element(::CircleGroup, p::Number) = one(p)
identity_element(::CircleGroup, p::AbstractArray) = map(i -> one(eltype(p)), p)

Base.inv(G::CircleGroup, p::AbstractVector) = map(inv, repeated(G), p)
Base.inv(G::GT, e::Identity{GT}) where {GT<:CircleGroup} = e

function inverse_translate(
::CircleGroup,
Expand All @@ -56,35 +53,36 @@ lie_bracket!(::CircleGroup, Z, X, Y) = fill!(Z, 0)

translate_diff(::GT, p, q, X, ::ActionDirection) where {GT<:CircleGroup} = map(*, p, X)
function translate_diff(
::GT,
::Identity{GT},
::CircleGroup,
::Identity{MultiplicationOperation},
q,
X,
::ActionDirection,
) where {GT<:CircleGroup}
)
return X
end

function translate_diff!(G::CircleGroup, Y, p, q, X, conv::ActionDirection)
return copyto!(Y, translate_diff(G, p, q, X, conv))
end

function group_exp(G::CircleGroup, X)
function exp_lie(::CircleGroup, X)
return map(X) do imθ
θ = imag(imθ)
sinθ, cosθ = sincos(θ)
return Complex(cosθ, sinθ)
end
end

group_exp!(G::CircleGroup, q, X) = (q .= group_exp(G, X))
exp_lie!(G::CircleGroup, q, X) = (q .= exp_lie(G, X))

function group_log(G::CircleGroup, q)
function log_lie(::CircleGroup, q)
return map(q) do z
cosθ, sinθ = reim(z)
θ = atan(sinθ, cosθ)
return θ * im
end
end
log_lie(::CircleGroup, e::Identity{MultiplicationOperation}) = 0.0 * im

group_log!(G::CircleGroup, X::AbstractVector, q::AbstractVector) = (X .= group_log(G, q))
_log_lie!(G::CircleGroup, X, q) = (X .= log_lie(G, q))
10 changes: 5 additions & 5 deletions src/groups/connections.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function exp!(
X,
) where {𝔽}
Y = inverse_translate_diff(M.manifold, q, p, X)
return compose!(M.manifold, q, p, group_exp(M.manifold, Y))
return compose!(M.manifold, q, p, exp_lie(M.manifold, Y))
end

"""
Expand All @@ -87,8 +87,8 @@ function log!(
q,
) where {𝔽}
pinvq = compose(M.manifold, inv(M.manifold, p), q)
group_log!(M.manifold, Y, pinvq)
return translate_diff!(M.manifold, Y, p, Identity(M.manifold, p), Y)
log_lie!(M.manifold, Y, pinvq)
return translate_diff!(M.manifold, Y, p, Identity(M.manifold), Y)
end

"""
Expand Down Expand Up @@ -156,7 +156,7 @@ function vector_transport_direction!(
d,
::ParallelTransport,
)
dexp_half = group_exp(M.manifold, d / 2)
dexp_half = exp_lie(M.manifold, d / 2)
translate_diff!(M.manifold, Y, dexp_half, p, X, RightAction())
return translate_diff!(M.manifold, Y, dexp_half, p, Y, LeftAction())
end
Expand All @@ -177,6 +177,6 @@ function vector_transport_to!(
q,
m::ParallelTransport,
)
d = group_log(M.manifold, q)
d = log_lie(M.manifold, q)
return vector_transport_direction!(M, Y, p, X, d, m)
end
22 changes: 12 additions & 10 deletions src/groups/general_linear.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ function check_point(G::GeneralLinear, p; kwargs...)
end
return nothing
end
check_point(::GT, ::Identity{GT}; kwargs...) where {GT<:GeneralLinear} = nothing
function check_point(G::GeneralLinear, e::Identity; kwargs...)
return DomainError(e, "The identity element $(e) does not belong to $(G).")
check_point(::GeneralLinear, ::Identity{MultiplicationOperation}) = nothing
function check_point(
G::GeneralLinear,
e::Identity{O};
kwargs...,
) where {O<:AbstractGroupOperation}
return invoke(check_point, Tuple{AbstractGroupManifold,typeof(e)}, G, e; kwargs...)
end

function check_vector(G::GeneralLinear, p, X; kwargs...)
Expand Down Expand Up @@ -146,13 +150,13 @@ function get_vector!(
return copyto!(X, Xⁱ)
end

function group_exp!(::GeneralLinear{1}, q, X)
function exp_lie!(::GeneralLinear{1}, q, X)
q[1] = exp(X[1])
return q
end
group_exp!(::GeneralLinear{2}, q, X) = copyto!(q, exp(SizedMatrix{2,2}(X)))
exp_lie!(::GeneralLinear{2}, q, X) = copyto!(q, exp(SizedMatrix{2,2}(X)))

function group_log!(::GeneralLinear{1}, X::AbstractMatrix, p::AbstractMatrix)
function _log_lie!(::GeneralLinear{1}, X, p)
X[1] = log(p[1])
return X
end
Expand Down Expand Up @@ -198,7 +202,6 @@ log(::GeneralLinear, p, q)
function log!(G::GeneralLinear{n,𝔽}, X, p, q) where {n,𝔽}
pinvq = inverse_translate(G, p, q, LeftAction())
𝔽 === ℝ && det(pinvq) ≤ 0 && throw(OutOfInjectivityRadiusError())
e = Identity(G, pinvq)
if isnormal(pinvq; atol=sqrt(eps(real(eltype(pinvq)))))
log_safe!(X, pinvq)
else
Expand All @@ -207,13 +210,12 @@ function log!(G::GeneralLinear{n,𝔽}, X, p, q) where {n,𝔽}
Gᵣ = GeneralLinear(real_dimension(𝔽) * n, ℝ)
pinvqᵣ = realify(pinvq, 𝔽)
Xᵣ = realify(X, 𝔽)
eᵣ = Identity(Gᵣ, pinvqᵣ)
log_safe!(Xᵣ, _project_Un_S⁺(pinvqᵣ))
inverse_retraction = NLsolveInverseRetraction(ExponentialRetraction(), Xᵣ)
inverse_retract!(Gᵣ, Xᵣ, eᵣ, pinvqᵣ, inverse_retraction)
inverse_retract!(Gᵣ, Xᵣ, Identity(G), pinvqᵣ, inverse_retraction)
unrealify!(X, Xᵣ, 𝔽, n)
end
translate_diff!(G, X, p, e, X, LeftAction())
translate_diff!(G, X, p, Identity(G), X, LeftAction())
return X
end
function log!(::GeneralLinear{1}, X, p, q)
Expand Down
Loading