From 9871850f0b07efe556befef9d55b6afd06b8caca Mon Sep 17 00:00:00 2001 From: Mateusz Baran Date: Fri, 17 Nov 2023 11:19:56 +0100 Subject: [PATCH] Improve random tangent generation on complex circle and rotation matrices --- NEWS.md | 6 ++++++ Project.toml | 2 +- src/manifolds/Circle.jl | 2 +- src/manifolds/Rotations.jl | 1 - 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index b7bf9f8f4c..e54201ab67 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.8] - 2023-11-17 + +### Fixed + +- Improved distribution of random vector generation for rotation matrices and complex circle. + ## [0.9.7] - 2023-11-14 ### Fixed diff --git a/Project.toml b/Project.toml index 50ae539bec..490fd5c2bf 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.7" +version = "0.9.8" [deps] Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" diff --git a/src/manifolds/Circle.jl b/src/manifolds/Circle.jl index 6ca9466aab..bacf0320a1 100644 --- a/src/manifolds/Circle.jl +++ b/src/manifolds/Circle.jl @@ -465,7 +465,7 @@ function Random.rand(rng::AbstractRNG, M::Circle{ℂ}; vector_at=nothing, σ::Re return sign(randn(rng, ComplexF64)) else # written like that to properly handle `vector_at` being a number or a one-element array - return map(p -> project(M, p, σ * rand(rng, typeof(p))), vector_at) + return map(p -> project(M, p, σ * randn(rng, complex(typeof(p)))), vector_at) end end diff --git a/src/manifolds/Rotations.jl b/src/manifolds/Rotations.jl index 89f87f326b..b262d0114b 100644 --- a/src/manifolds/Rotations.jl +++ b/src/manifolds/Rotations.jl @@ -330,7 +330,6 @@ function Random.rand!( (manifold_dimension(M) == 0) && return fill!(pX, 0) A = σ .* randn(rng, representation_size(M)) pX .= triu(A, 1) .- transpose(triu(A, 1)) - normalize!(pX) end return pX end