JuliaGeometry / Rotations.jl

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

Add support for `sqrt` etc. #234

Closed hyrodium closed 1 year ago

hyrodium commented 2 years ago
julia> using Rotations

julia> r = rand(QuatRotation)
3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(0.826859, 0.127988, -0.43058, 0.338415, true)):
 0.400152  -0.66986    -0.625432
 0.449424   0.738189   -0.503086
 0.798684  -0.0797729   0.596439

julia> sqrt(r)
3×3 StaticArrays.SizedMatrix{3, 3, Float64, 2, Matrix{Float64}} with indices SOneTo(3)×SOneTo(3):
 0.835825  -0.368581   -0.406871
 0.308248   0.928344   -0.207751
 0.454289   0.0482258   0.889548

julia> cbrt(r)
ERROR: MethodError: no method matching cbrt(::QuatRotation{Float64})
Closest candidates are:
  cbrt(::Union{Float32, Float64}) at ~/julia/julia-1.7.2/share/julia/base/special/cbrt.jl:142
  cbrt(::LinearAlgebra.UniformScaling) at ~/julia/julia-1.7.2/share/julia/stdlib/v1.7/LinearAlgebra/src/uniformscaling.jl:174
  cbrt(::DualNumbers.Dual) at ~/.julia/packages/DualNumbers/5knFX/src/dual.jl:311
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[9]:1