JuliaArrays / JuliaArrays/StaticArrays.jl
eigen fails for the identity matrix with StaticArray int type
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
My version is Julia 1.6.2.
using LinearAlgebra
using StaticArrays
m3 = SMatrix{3,3}(1I)
eigen(m3)
MethodError: no method matching precision(::Type{Int64})
Closest candidates are:
precision(::Type{Float16}) at float.jl:599
precision(::Type{Float32}) at float.jl:600
precision(::Type{Float64}) at float.jl:601
Stacktrace:
[1] _eig
@ ~/.julia/packages/StaticArrays/vxjOO/src/eigen.jl:314 [inlined]
[2] _eig
@ ~/.julia/packages/StaticArrays/vxjOO/src/eigen.jl:134 [inlined]
[3] #eigen#629
@ ~/.julia/packages/StaticArrays/vxjOO/src/eigen.jl:418 [inlined]
[4] eigen(A::SMatrix{3, 3, Int64, 9})
@ StaticArrays ~/.julia/packages/StaticArrays/vxjOO/src/eigen.jl:418
[5] top-level scope
@ In[39]:1
[6] eval
@ ./boot.jl:360 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116
I tested with
m3 = [1 0 0; 0 1 0; 0 0 1]
m2 = SMatrix{2,2}(1I)
m3 = SMatrix{3,3}{Float64}(1I)]
m4 = SMatrix{4,4}(1I)
They all worked.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the SMatrix identity example, then start in src/eigen.jl around the _eig implementation at the reported line. Trace how the integer element type reaches the precision call and verify that eigen works for the identity matrix with an integer StaticArray, while the existing Float64 and other size cases continue to work.
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
- Clearly specified
- Newbie friendliness
- 52/100