Skip to content

Commit 9294916

Browse files
committed
update comments suggested by @c42f
1 parent fef8c8c commit 9294916

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rand.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function Random.rand(rng::AbstractRNG, ::Random.SamplerType{R}) where R <: Union{<:Rotation{2},<:RotMatrix{2}}
2-
# Union{<:Rotation{2},<:RotMatrix{2}} seems able to be replaced with Rotation{2},
3-
# but it avoids the method for general dimensional RotMatrix.
2+
# We use the awkward Union{<:Rotation{2},<:RotMatrix{2}} here rather than `Rotation{2}`
3+
# to make this efficient 2D method more specific than the method for general `RotMatrix`.
44
T = eltype(R)
55
if T == Any
66
T = Float64
@@ -13,8 +13,8 @@ end
1313
# The unit sphere in R⁴ parameterizes quaternion rotations according to the
1414
# Haar measure of SO(3) - see e.g. http://math.stackexchange.com/questions/184086/uniform-distributions-on-the-space-of-rotations-in-3d
1515
function Random.rand(rng::AbstractRNG, ::Random.SamplerType{R}) where R <: Union{<:Rotation{3},<:RotMatrix{3}}
16-
# Union{<:Rotation{3},<:RotMatrix{3}} seems able to be replaced with Rotation{3},
17-
# but it avoids the method for general dimensional RotMatrix.
16+
# We use the awkward Union{<:Rotation{2},<:RotMatrix{2}} here rather than `Rotation{2}`
17+
# to make this efficient 3D method more specific than the method for general `RotMatrix`.
1818
T = eltype(R)
1919
if T == Any
2020
T = Float64

0 commit comments

Comments
 (0)