JuliaGeometry / JuliaGeometry/Rotations.jl

Some `*` fails because of eltype

Open
#181 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Julia
Stars
188
Forks
45
PR merge metrics
No merged PRs in 30d

Description

Sample code to produce the issue

julia> r = AngleAxis(1,1,0,0)
3×3 AngleAxis{Int64} with indices SOneTo(3)×SOneTo(3)(1, 1, 0, 0):
 1.0  0.0        0.0
 0.0  0.540302  -0.841471
 0.0  0.841471   0.540302

julia> eltype(r)
Int64

julia> r*[1,2,3]
ERROR: InexactError: Int64(-1.44380834268741)
Stacktrace:
 [1] Int64
   @ ./float.jl:723 [inlined]
 [2] convert
   @ ./number.jl:7 [inlined]
 [3] macro expansion
   @ ~/.julia/packages/StaticArrays/vxjOO/src/util.jl:11 [inlined]
 [4] convert_ntuple
   @ ~/.julia/packages/StaticArrays/vxjOO/src/util.jl:7 [inlined]
 [5] StaticArrays.SVector{3, Int64}(x::Tuple{Float64, Float64, Float64})
   @ StaticArrays ~/.julia/packages/StaticArrays/vxjOO/src/SArray.jl:28
 [6] macro expansion
   @ ~/.julia/packages/StaticArrays/vxjOO/src/matrix_multiply.jl:85 [inlined]
 [7] _mul
   @ ~/.julia/packages/StaticArrays/vxjOO/src/matrix_multiply.jl:67 [inlined]
 [8] *(A::AngleAxis{Int64}, B::Vector{Int64})
   @ StaticArrays ~/.julia/packages/StaticArrays/vxjOO/src/matrix_multiply.jl:8
 [9] top-level scope
   @ REPL[12]:1

How to fix this

https://github.com/JuliaGeometry/Rotations.jl/pull/132 is related, but I think it's better to distinguish the type of parameters of rotation and the type of matrix.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the AngleAxis multiplication failure from the Julia sample and inspect the rotation multiplication and eltype behavior. Compare the related changes in JuliaGeometry/Rotations.jl#132, then verify that multiplication no longer attempts an invalid conversion while preserving the intended parameter and matrix element types.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.