JuliaArrays / JuliaArrays/StaticArrays.jl
dropdims fails
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 844
- Forks
- 159
- Avg merge
- 3d 21h
- Merged PRs (30d)
- 3
Description
This would work if A were a normal matrix:
julia> A = @SMatrix randn(2,2)
2×2 SMatrix{2, 2, Float64, 4} with indices SOneTo(2)×SOneTo(2):
-0.663672 2.31438
0.166198 1.26303
julia> dropdims(mean(A; dims=2); dims=2)
ERROR: TypeError: in typeassert, expected Tuple{SOneTo{1}}, got a value of type Tuple{SOneTo{2}}
Stacktrace:
[1] _dropdims(A::SMatrix{2, 1, Float64, 2}, dims::Tuple{Int64})
@ Base ./abstractarraymath.jl:92
[2] _dropdims(A::SMatrix{2, 1, Float64, 2}, dim::Int64)
@ Base ./abstractarraymath.jl:94
[3] dropdims(A::SMatrix{2, 1, Float64, 2}; dims::Int64)
@ Base ./abstractarraymath.jl:82
[4] top-level scope
@ REPL[26]:1
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 issue in the Julia REPL using the shown @SMatrix randn(2,2) and dropdims(mean(A; dims=2); dims=2) call. Compare the result with a normal matrix and inspect the StaticArrays handling around dropdims; done means the call no longer raises the shown TypeError and returns the expected reduced array.
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
- Mostly clear
- Newbie friendliness
- 42/100