diff --git a/Project.toml b/Project.toml index a566d92328..186ffd15cd 100644 --- a/Project.toml +++ b/Project.toml @@ -50,7 +50,7 @@ Graphs = "1.4" HybridArrays = "0.4" Kronecker = "0.4, 0.5" ManifoldDiff = "0.3.6" -ManifoldsBase = "0.14.11" +ManifoldsBase = "0.14.12" MatrixEquations = "2.2" OrdinaryDiffEq = "6.31" Plots = "1" diff --git a/src/manifolds/PositiveNumbers.jl b/src/manifolds/PositiveNumbers.jl index da9ceadc73..780d9f2c4f 100644 --- a/src/manifolds/PositiveNumbers.jl +++ b/src/manifolds/PositiveNumbers.jl @@ -294,6 +294,25 @@ function parallel_transport_to!(::PositiveNumbers, Y, p, X, q) return (Y .= X .* q ./ p) end +function Random.rand(M::PositiveNumbers; kwargs...) + return rand(Random.default_rng(), M; kwargs...) +end + +function Random.rand( + rng::AbstractRNG, + ::PositiveNumbers; + σ=1.0, + vector_at=nothing, +) + if vector_at === nothing + return exp(randn(rng) * σ) + else + return vector_at * randn(rng) * σ + end + return pX +end + + function Random.rand!( rng::AbstractRNG, ::PositiveNumbers,