Skip to content

Commit

Permalink
Fix #665
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Oct 25, 2023
1 parent b0ab892 commit 1a02d4e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

## [0.9.1] - 2023-10-25

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/groups/GroupManifold.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))")
5 changes: 4 additions & 1 deletion src/groups/general_unitary_groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions src/groups/translation_group.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/groups/general_unitary_groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions test/groups/special_euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions test/groups/translation_group.jl
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a02d4e

Please sign in to comment.