Closed juliohm closed 10 months ago
Base.inv
is an inverse operation about the binary operator *
, and InverseFunctions.inverse
is an inverse operation about the binary operator ∘
(\circle
).
The current usage in this package inv(::Rotation)
is related to *
, so we don't have to switch to InverseFunctions.inverse
.
julia> using Rotations
julia> r = QuatRotation(2,1,0,0)
3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(0.894427, 0.447214, 0.0, 0.0)):
1.0 0.0 0.0
0.0 0.6 -0.8
0.0 0.8 0.6
julia> r * inv(r)
3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(1.0, 0.0, 0.0, 0.0)):
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
It makes sense if we think of rotations as matrix multiplication always. Feel free to close the issue if inv is intended.
Em ter., 7 de nov. de 2023 00:09, Yuto Horikawa @.***> escreveu:
Base.inv is an inverse operation about the binary operator *, and InverseFunctions.inverse is an inverse operation about the binary operator ∘ (\circle).
The current usage in this package inv(::Rotation) is related to *, so we don't have to switch to InverseFunctions.inverse.
julia> using Rotations
julia> r = QuatRotation(2,1,0,0)3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(0.894427, 0.447214, 0.0, 0.0)): 1.0 0.0 0.0 0.0 0.6 -0.8 0.0 0.8 0.6
julia> r * inv(r)3×3 QuatRotation{Float64} with indices SOneTo(3)×SOneTo(3)(QuaternionF64(1.0, 0.0, 0.0, 0.0)): 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0
— Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/Rotations.jl/issues/274#issuecomment-1797419931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3KC5EYZG7DRF26DBC3YDGQ6ZAVCNFSM6AAAAAA7AB3RHSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOJXGQYTSOJTGE . You are receiving this because you authored the thread.Message ID: @.***>
Apparently
Base.inv
is only intended for multiplicative inverses:We recently learned about InverseFunctions.jl, which introduces a
inverse
function for inverse functions. Rotations.jl could use the same function or add an internal nameinverse
that is not exported by default.We are fixing all our packages to avoid the misuse of
Base.inv
.