diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml index 80d88b8ad3..3519d4edee 100644 --- a/.JuliaFormatter.toml +++ b/.JuliaFormatter.toml @@ -8,4 +8,4 @@ whitespace_in_kwargs = false remove_extra_newlines = true annotate_untyped_fields_with_any = false conditional_to_if = false -ignore = ["tutorials"] \ No newline at end of file +ignore = ["tutorials", ".git"] diff --git a/NEWS.md b/NEWS.md index 15944038b9..457e5bfb6a 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.10.12] - unreleased + +### Changed + +* Improved performance of selected `get_vector` and `get_coordinates` methods for complex `Euclidean` manifold. + ## [0.10.11] - 2025-01-02 ### Added diff --git a/Project.toml b/Project.toml index 05dbb931b3..7251b14a05 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.10.11" +version = "0.10.12" [deps] Einsum = "b7d42ee7-0b51-5a75-98ca-779d3107e4c0" diff --git a/src/manifolds/Euclidean.jl b/src/manifolds/Euclidean.jl index 6b0a0f45bc..d857325846 100644 --- a/src/manifolds/Euclidean.jl +++ b/src/manifolds/Euclidean.jl @@ -251,41 +251,39 @@ function get_coordinates_induced_basis!( X, ::InducedBasis{ℝ,TangentSpaceType,<:RetractionAtlas}, ) - S = representation_size(M) - PS = prod(S) - copyto!(c, reshape(X, PS)) + copyto!(c, vec(X)) return c end -function get_coordinates_orthonormal!(M::Euclidean{<:Any,ℂ}, c, ::Any, X, ::RealNumbers) - S = representation_size(M) - PS = prod(S) - c .= [reshape(real.(X), PS)..., reshape(imag(X), PS)...] +function get_coordinates_orthonormal!(::Euclidean{<:Any,ℂ}, c, ::Any, X, ::RealNumbers) + Xvec = vec(X) + d = div(length(c), 2) + view(c, 1:d) .= real.(Xvec) + view(c, (d + 1):(2d)) .= imag.(Xvec) return c end function get_coordinates_diagonalizing!( - M::Euclidean{<:Any,ℂ}, + ::Euclidean{<:Any,ℂ}, c, ::Any, X, ::DiagonalizingOrthonormalBasis{ℝ}, ) - S = representation_size(M) - PS = prod(S) - c .= [reshape(real.(X), PS)..., reshape(imag(X), PS)...] + Xvec = vec(X) + d = div(length(c), 2) + view(c, 1:d) .= real.(Xvec) + view(c, (d + 1):(2d)) .= imag.(Xvec) return c end function get_coordinates_diagonalizing!( - M::Euclidean{<:Any,𝔽}, + ::Euclidean{<:Any,𝔽}, c, p, X, ::DiagonalizingOrthonormalBasis{𝔽}, ) where {𝔽} - S = representation_size(M) - PS = prod(S) - copyto!(c, reshape(X, PS)) + copyto!(c, vec(X)) return c end @@ -377,7 +375,7 @@ end function get_vector_orthonormal!(M::Euclidean{<:Any,ℂ}, Y, ::Any, c, ::RealNumbers) S = representation_size(M) N = div(length(c), 2) - copyto!(Y, reshape(c[1:N] + im * c[(N + 1):end], S)) + copyto!(Y, reshape(c[1:N] .+ im .* c[(N + 1):end], S)) return Y end function get_vector_diagonalizing!( @@ -389,7 +387,7 @@ function get_vector_diagonalizing!( ) S = representation_size(M) N = div(length(c), 2) - copyto!(Y, reshape(c[1:N] + im * c[(N + 1):end], S)) + copyto!(Y, reshape(c[1:N] .+ im .* c[(N + 1):end], S)) return Y end