JuliaArrays / JuliaArrays/StaticArrays.jl
Failure to reinterpret SMatrix
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
Is this expected behavior? Tested on StaticArrays@v1.6.3.
using StaticArrays
# This gives a surprising error:
A = zeros(SMatrix{3,3,Float64}, 2, 3)
reinterpret(reshape, Float64, A) # ERROR: ArgumentError: cannot reinterpret `SMatrix{3, 3, Float64}` as `Float64`, type `SMatrix{3, 3, Float64}` is not a bits type
# However, it seems like `SMatrix{3, 3, Float64}` is indeed `isbits`
@assert isbits(A[1,1])
# And reinterpreting an `SVector` is fine
B = zeros(SVector{3,Float64}, 4)
reinterpret(reshape, Float64, B)
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
Start by reproducing the Julia snippets from the issue with StaticArrays@v1.6.3, comparing reinterpret behavior for SMatrix and SVector. Trace the entry point handling reinterpret of SMatrix values and determine the expected outcome; done when the discrepancy is resolved or its expected behavior is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100