diff --git a/NEWS.md b/NEWS.md index 84ca00e2f7..ecb9a0bfef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.9.2] - 2023-10-26 + +### Added + +- `rand(G; vector_at=Identity(G))` now works for translation, special orthogonal and special Euclidean groups `G` (issue [#665](https://github.com/JuliaManifolds/Manifolds.jl/issues/665)). + ## [0.9.1] - 2023-10-25 ### Added diff --git a/Project.toml b/Project.toml index 8f2d4c8e94..a0276cde46 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Manifolds" uuid = "1cead3c2-87b3-11e9-0ccd-23c62b72b94e" authors = ["Seth Axen ", "Mateusz Baran ", "Ronny Bergmann ", "Antoine Levitt "] -version = "0.9.1" +version = "0.9.2" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/groups/GroupManifold.jl b/src/groups/GroupManifold.jl index c8983731be..2698bc48e6 100644 --- a/src/groups/GroupManifold.jl +++ b/src/groups/GroupManifold.jl @@ -102,7 +102,7 @@ function is_vector( return false end end - return is_vector(G.manifold, identity_element(G), X, false, te; kwargs...) + return is_vector(G.manifold, identity_element(G), X, false; error=error, kwargs...) end Base.show(io::IO, G::GroupManifold) = print(io, "GroupManifold($(G.manifold), $(G.op))") diff --git a/src/groups/general_unitary_groups.jl b/src/groups/general_unitary_groups.jl index 40c56a179d..39faa74d03 100644 --- a/src/groups/general_unitary_groups.jl +++ b/src/groups/general_unitary_groups.jl @@ -34,13 +34,16 @@ function allocate_result( return allocate(X) end function allocate_result( - ::GeneralUnitaryMultiplicationGroup, + M::GeneralUnitaryMultiplicationGroup, ::typeof(log), ::Identity{MultiplicationOperation}, q, ) return allocate(q) end +function allocate_result(M::Rotations, ::typeof(rand), ::Identity{MultiplicationOperation}) + return similar(Matrix{Float64}, representation_size(M)...) +end decorated_manifold(G::GeneralUnitaryMultiplicationGroup) = G.manifold diff --git a/src/groups/translation_group.jl b/src/groups/translation_group.jl index cbc752acab..a52f9a1731 100644 --- a/src/groups/translation_group.jl +++ b/src/groups/translation_group.jl @@ -33,6 +33,10 @@ end end end +function allocate_result(M::Euclidean, ::typeof(rand), ::Identity{AdditionOperation}) + return similar(Array{Float64}, representation_size(M)...) +end + exp!(::TranslationGroup, q, ::Identity{AdditionOperation}, X) = copyto!(q, X) has_biinvariant_metric(::TranslationGroup) = true diff --git a/test/groups/general_unitary_groups.jl b/test/groups/general_unitary_groups.jl index a3829e2990..d393c07819 100644 --- a/test/groups/general_unitary_groups.jl +++ b/test/groups/general_unitary_groups.jl @@ -74,6 +74,9 @@ include("group_utils.jl") 0.4070678736115306 0.10586374034761421 -0.43156436122007846 0.0 ] @test volume_density(M, p, X) ≈ 0.710713830700454 + + # random Lie algebra element + @test is_vector(M, Identity(M), rand(M; vector_at=Identity(M))) end @testset "Unitary Group" begin diff --git a/test/groups/special_euclidean.jl b/test/groups/special_euclidean.jl index c4cd336dc0..0030a38b72 100644 --- a/test/groups/special_euclidean.jl +++ b/test/groups/special_euclidean.jl @@ -100,6 +100,8 @@ using Manifolds: @test w2mat ≈ affine_matrix(G, pts[1]) * screw_matrix(G, X_pts[1]) @test screw_matrix(G, w2mat) === w2mat + @test is_vector(G, Identity(G), rand(G; vector_at=Identity(G))) + test_group( G, pts, diff --git a/test/groups/translation_group.jl b/test/groups/translation_group.jl index 5c1b43d75c..e88704ff72 100644 --- a/test/groups/translation_group.jl +++ b/test/groups/translation_group.jl @@ -1,6 +1,8 @@ include("../utils.jl") include("group_utils.jl") +using Manifolds: LeftForwardAction, RightBackwardAction + @testset "Translation group" begin @testset "real" begin G = TranslationGroup(2, 3) @@ -42,6 +44,8 @@ include("group_utils.jl") test_vee_hat_from_identity=true, ) end + + @test is_vector(G, Identity(G), rand(G; vector_at=Identity(G))) end @testset "complex" begin