Skip to content

Commit

Permalink
Fix SPDs
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Sep 23, 2023
1 parent 5d4491c commit 05fcff8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/manifolds/PositiveNumbers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,7 @@ 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,
)
function Random.rand(rng::AbstractRNG, ::PositiveNumbers; σ=1.0, vector_at=nothing)
if vector_at === nothing
return exp(randn(rng) * σ)
else
Expand All @@ -312,7 +307,6 @@ function Random.rand(
return pX

Check warning on line 307 in src/manifolds/PositiveNumbers.jl

View check run for this annotation

Codecov / codecov/patch

src/manifolds/PositiveNumbers.jl#L307

Added line #L307 was not covered by tests
end


function Random.rand!(
rng::AbstractRNG,
::PositiveNumbers,
Expand Down
4 changes: 4 additions & 0 deletions src/manifolds/SymmetricPositiveDefinite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ Generate a random symmetric positive definite matrix on the
"""
rand(M::SymmetricPositiveDefinite; σ::Real=1)

function allocate_result(M::SymmetricPositiveDefinite, ::typeof(Random.rand), p::SPDPoint)
return zero_vector(M, p)
end

function Random.rand!(
rng::AbstractRNG,
M::SymmetricPositiveDefinite{N},
Expand Down

0 comments on commit 05fcff8

Please sign in to comment.