JuliaArrays / JuliaArrays/StaticArrays.jl
Error when using `svd` on a matrix
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
Hi,
I'm seeing the following error on my laptop (versioninfo below):
julia> using StaticArrays
julia> A = @SMatrix rand(3,3)
julia> StaticArrays.svd(A)
ERROR: MethodError: no method matching unsafe_convert(::Type{Ptr{Int32}}, ::Base.RefValue{Int64})
Closest candidates are:
unsafe_convert(::Type{Ptr{T}}, ::SubArray{T, N, P, <:Tuple{Vararg{Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8, AbstractRange{<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}}}}}}) where {T, N, P}
@ Base subarray.jl:471
unsafe_convert(::Type{Ptr{T}}, ::SubArray{T, N, P, <:Tuple{Vararg{Union{AbstractRange{<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}}, Base.ReshapedArray{T, N, A, Tuple{}} where {T, N, A<:AbstractUnitRange}, Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8}}}}) where {T, N, P}
@ Base reshapedarray.jl:310
unsafe_convert(::Type{T}, ::T) where T<:Ptr
@ Base essentials.jl:547
...
Stacktrace:
[1] _svd(A::SMatrix{3, 3, Float64, 9}, full::Val{false})
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/blas.jl:108
[2] svd(A::SMatrix{3, 3, Float64, 9})
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/svd.jl:36
[3] top-level scope
@ REPL[11]:1
I am wondering if this could be related to https://github.com/JuliaArrays/StaticArrays.jl/pull/1259.
It does work if I pin the version to StaticArrays@1.9.4
Version info:
julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b36 (2024-08-27 14:19 UTC)
Build Info:
Built by Homebrew (v1.10.5)
Note: This is an unofficial build, please report bugs to the project
responsible for this build and not to the Julia project unless you can
reproduce the issue using official builds available at https://julialang.org/downloads
Platform Info:
OS: macOS (arm64-apple-darwin23.4.0)
CPU: 8 × Apple M2
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)
Cc. @ronisbr & @thchr.
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 reported Julia 1.10.5 example using StaticArrays.svd on the 3×3 SMatrix. Start at src/blas.jl:108 and src/svd.jl:36, then compare behavior with StaticArrays 1.9.4 and the referenced pull request. Done means the example runs successfully without the unsafe_convert MethodError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100