Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into mbaran/cholesky-bases
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszbaran committed Jan 10, 2025
2 parents d2271c5 + ca9e634 commit 7937238
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .JuliaFormatter.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ whitespace_in_kwargs = false
remove_extra_newlines = true
annotate_untyped_fields_with_any = false
conditional_to_if = false
ignore = ["tutorials"]
ignore = ["tutorials", ".git"]
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ 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
## [0.10.12] - 2025-01-10

### Added

* Orthonormal bases for `CholeskySpace` and `LogCholesky` metric for `SymmetricPositiveDefinite`.
* `rand` for `CholeskySpace`.

### Changed

* Improved performance of selected `get_vector` and `get_coordinates` methods for complex `Euclidean` manifold.

## [0.10.11] - 2025-01-02

### Added
Expand Down
32 changes: 15 additions & 17 deletions src/manifolds/Euclidean.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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!(
Expand All @@ -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

Expand Down

0 comments on commit 7937238

Please sign in to comment.