JuliaArrays / JuliaArrays/StaticArrayInterface.jl

Size of StaticArray type

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

Nobody has claimed this yet.

Dominant language
Julia
Stars
14
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Using ArrayInterface v5.05 and StaticArrays v1.42:

julia> import ArrayInterface as Arr

julia> using StaticArrays

julia> Arr.known_size(SArray{Tuple{2,3}})
(6,)

julia> Arr.size(StaticArray{Tuple{2,3}})
(static(6),)

Are those the intended results? I expected (2, 3) and (static(2), static(3)), respectively. (Though, things work fine for instances of StaticArrays.)

I think what is happening is that IteratorSize(::Type{<:StaticArray}) is defaulting to HasLength() while it might better off be HasShape{N}(), so the wrong method gets called at some point. If that's the case, perhaps its also worth opening a bug report on StaticArrays.

Also, should ArrayInterface.size produce an error if given a Type as an argument? What should be the behavior if one of the dimensions is unknown?

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 Julia examples using ArrayInterface.known_size, ArrayInterface.size, StaticArray, and StaticArrays, then inspect the IteratorSize-related dispatch involved in those entry points. Done means the expected behavior for type-level dimensions and unknown dimensions is decided, documented by regression tests, and any needed StaticArrays report is filed.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.