JuliaGeometry / Rotations.jl

Julia implementations for different rotation parameterizations
https://juliageometry.github.io/Rotations.jl
MIT License
180 stars 44 forks source link

Some `rand` methods produce error #205

Closed hyrodium closed 2 years ago

hyrodium commented 2 years ago
julia> rand(RotMatrix{3})
3×3 RotMatrix3{Float64} with indices SOneTo(3)×SOneTo(3):
 -0.203707   0.62082    0.757025
 -0.258638   0.711643  -0.6532
 -0.944251  -0.328857   0.015601

julia> rand(RotMatrix{2})
2×2 RotMatrix2{Float64} with indices SOneTo(2)×SOneTo(2):
  0.701313  0.712853
 -0.712853  0.701313

julia> rand(RotMatrix3{Float64})
3×3 RotMatrix3{Float64} with indices SOneTo(3)×SOneTo(3):
 0.310501  -0.483375  -0.818497
 0.373853   0.853765  -0.36238
 0.87397   -0.193479   0.445806

julia> rand(RotMatrix2{Float64})
ERROR: DimensionMismatch("No precise constructor for RotMatrix2{Float64} found. Length of input was 1.")
Stacktrace:
 [1] RotMatrix2{Float64}(x::Tuple{Tuple{Tuple{Tuple{Float64}}}})
   @ StaticArrays ~/.julia/dev/StaticArrays/src/convert.jl:1
 [2] StaticArray (repeats 4 times)
   @ ~/.julia/dev/StaticArrays/src/convert.jl:4 [inlined]
 [3] rand(rng::Random.MersenneTwister, #unused#::Random.SamplerType{RotMatrix2{Float64}})
   @ Rotations ~/.julia/dev/Rotations/src/core_types.jl:49
 [4] rand(rng::Random.MersenneTwister, ::Type{RotMatrix2{Float64}})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:256
 [5] rand(#unused#::Type{RotMatrix2{Float64}})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:259
 [6] top-level scope
   @ REPL[11]:1

julia> rand(RotMatrix3)
ERROR: DimensionMismatch("No precise constructor for RotMatrix3{T} where T found. Length of input was 9.")
Stacktrace:
 [1] (RotMatrix3{T} where T)(x::Tuple{Tuple{Tuple{NTuple{9, Float64}}}})
   @ StaticArrays ~/.julia/dev/StaticArrays/src/convert.jl:1
 [2] (RotMatrix3{T} where T)(x::Tuple{Tuple{NTuple{9, Float64}}}) (repeats 3 times)
   @ StaticArrays ~/.julia/dev/StaticArrays/src/convert.jl:4
 [3] StaticArray
   @ ~/.julia/dev/StaticArrays/src/convert.jl:5 [inlined]
 [4] rand(rng::Random.MersenneTwister, #unused#::Random.SamplerType{RotMatrix3{T} where T})
   @ Rotations ~/.julia/dev/Rotations/src/core_types.jl:62
 [5] rand(rng::Random.MersenneTwister, ::Type{RotMatrix3{T} where T})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:256
 [6] rand(#unused#::Type{RotMatrix3{T} where T})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:259
 [7] top-level scope
   @ REPL[12]:1

julia> rand(RotMatrix2)
ERROR: DimensionMismatch("No precise constructor for RotMatrix2{T} where T found. Length of input was 1.")
Stacktrace:
 [1] (RotMatrix2{T} where T)(x::Tuple{Tuple{Tuple{Tuple{Float64}}}})
   @ StaticArrays ~/.julia/dev/StaticArrays/src/convert.jl:1
 [2] StaticArray (repeats 4 times)
   @ ~/.julia/dev/StaticArrays/src/convert.jl:4 [inlined]
 [3] rand(rng::Random.MersenneTwister, #unused#::Random.SamplerType{RotMatrix2{T} where T})
   @ Rotations ~/.julia/dev/Rotations/src/core_types.jl:49
 [4] rand(rng::Random.MersenneTwister, ::Type{RotMatrix2{T} where T})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:256
 [5] rand(#unused#::Type{RotMatrix2{T} where T})
   @ Random /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.6/Random/src/Random.jl:259
 [6] top-level scope
   @ REPL[13]:1