Skip to content

Commit

Permalink
Merge ab8e482 into b3d14c5
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer authored Sep 22, 2023
2 parents b3d14c5 + ab8e482 commit ba52e7a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ManifoldsBase"
uuid = "3362f125-f0bb-47a3-aa74-596ffd7ef2fb"
authors = ["Seth Axen <[email protected]>", "Mateusz Baran <[email protected]>", "Ronny Bergmann <[email protected]>", "Antoine Levitt <[email protected]>"]
version = "0.14.11"
version = "0.14.12"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
25 changes: 17 additions & 8 deletions src/ManifoldsBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -854,21 +854,30 @@ Optionally a random number generator `rng` to be used can be specified. An optio
"""
Random.rand(M::AbstractManifold)

function Random.rand(M::AbstractManifold, d::Integer; kwargs...)
return [rand(M; kwargs...) for _ in 1:d]
end
function Random.rand(rng::AbstractRNG, M::AbstractManifold, d::Integer; kwargs...)
return [rand(rng, M; kwargs...) for _ in 1:d]
end
function Random.rand(M::AbstractManifold; kwargs...)
p = allocate_result(M, rand)
rand!(M, p; kwargs...)
return p
function Random.rand(M::AbstractManifold; vector_at = nothing, kwargs...)
if vector_at === nothing
pX = allocate_result(M, rand)
else
pX = allocate_result(M, rand, vector_at)
end
rand!(M, pX; vector_at = vector_at, kwargs...)
return pX
end
function Random.rand(rng::AbstractRNG, M::AbstractManifold; kwargs...)
p = allocate_result(M, rand)
rand!(rng, M, p; kwargs...)
return p
function Random.rand(rng::AbstractRNG, M::AbstractManifold; vector_at = nothing, kwargs...)
if vector_at === nothing
pX = allocate_result(M, rand)
else
pX = allocate_result(M, rand, vector_at)
end
rand!(rng, M, pX; vector_at = vector_at, kwargs...)
return pX
end

@doc raw"""
Expand Down

0 comments on commit ba52e7a

Please sign in to comment.