diff --git a/Project.toml b/Project.toml index 3829cf4838..c751d96dc4 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.8.71" +version = "0.8.72" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/manifolds/GeneralUnitaryMatrices.jl b/src/manifolds/GeneralUnitaryMatrices.jl index 1428ff9a63..494f3a485a 100644 --- a/src/manifolds/GeneralUnitaryMatrices.jl +++ b/src/manifolds/GeneralUnitaryMatrices.jl @@ -342,17 +342,22 @@ function get_coordinates_orthogonal(M::GeneralUnitaryMatrices{n,ℝ}, p, X, N) w return get_coordinates_orthogonal!(M, Y, p, X, N) end +function get_coordinates_orthogonal!(::GeneralUnitaryMatrices{1,ℝ}, Xⁱ, p, X, ::RealNumbers) + return Xⁱ +end function get_coordinates_orthogonal!(::GeneralUnitaryMatrices{2,ℝ}, Xⁱ, p, X, ::RealNumbers) Xⁱ[1] = X[2] return Xⁱ end function get_coordinates_orthogonal!( - ::GeneralUnitaryMatrices{n,ℝ}, + M::GeneralUnitaryMatrices{n,ℝ}, Xⁱ, p, X, ::RealNumbers, ) where {n} + @assert length(Xⁱ) == manifold_dimension(M) + @assert size(X) == (n, n) @inbounds begin Xⁱ[1] = X[3, 2] Xⁱ[2] = X[1, 3] @@ -414,6 +419,9 @@ function get_vector_orthogonal(::GeneralUnitaryMatrices{2,ℝ}, p::SMatrix, Xⁱ return @SMatrix [0 -Xⁱ[]; Xⁱ[] 0] end +function get_vector_orthogonal!(::GeneralUnitaryMatrices{1,ℝ}, X, p, Xⁱ, N::RealNumbers) + return X .= 0 +end function get_vector_orthogonal!(M::GeneralUnitaryMatrices{2,ℝ}, X, p, Xⁱ, N::RealNumbers) return get_vector_orthogonal!(M, X, p, Xⁱ[1], N) end @@ -526,6 +534,7 @@ Return the radius of injectivity on the [`Rotations`](@ref) manifold `M`, which > For a derivation of the injectivity radius, see [sethaxen.com/blog/2023/02/the-injectivity-radii-of-the-unitary-groups/](https://sethaxen.com/blog/2023/02/the-injectivity-radii-of-the-unitary-groups/). """ injectivity_radius(::GeneralUnitaryMatrices{n,ℝ}) where {n} = π * sqrt(2.0) +injectivity_radius(::GeneralUnitaryMatrices{1,ℝ}) = 0.0 # Resolve ambiguity on Rotations and Orthogonal function _injectivity_radius( @@ -537,6 +546,12 @@ end function _injectivity_radius(::GeneralUnitaryMatrices{n,ℝ}, ::PolarRetraction) where {n} return π / sqrt(2.0) end +function _injectivity_radius(::GeneralUnitaryMatrices{1,ℝ}, ::ExponentialRetraction) + return 0.0 +end +function _injectivity_radius(::GeneralUnitaryMatrices{1,ℝ}, ::PolarRetraction) + return 0.0 +end inner(::GeneralUnitaryMatrices, p, X, Y) = dot(X, Y) diff --git a/test/manifolds/rotations.jl b/test/manifolds/rotations.jl index 5c3ff11a88..25c0f62264 100644 --- a/test/manifolds/rotations.jl +++ b/test/manifolds/rotations.jl @@ -218,4 +218,22 @@ include("../utils.jl") PolarInverseRetraction(), ) end + + @testset "Rotations(1)" begin + M = Rotations(1) + p = fill(1.0, 1, 1) + X = get_vector(M, p, Float64[], DefaultOrthonormalBasis()) + @test X isa Matrix{Float64} + @test X == fill(0.0, 1, 1) + Xc = get_coordinates(M, p, X, DefaultOrthonormalBasis()) + @test length(Xc) == 0 + @test Xc isa Vector{Float64} + + @test injectivity_radius(M) == 0.0 + @test injectivity_radius(M, p) == 0.0 + @test injectivity_radius(M, ExponentialRetraction()) == 0.0 + @test injectivity_radius(M, p, ExponentialRetraction()) == 0.0 + @test injectivity_radius(M, PolarRetraction()) == 0.0 + @test injectivity_radius(M, p, PolarRetraction()) == 0.0 + end end