Skip to content

Size of StaticArray type #3

@nchisholm

Description

@nchisholm

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions