Skip to content

Transposing nx0 or 0xn SMartix yields empty Union as element type #786

Open
@janbruedigam

Description

@janbruedigam

I am having issues when transposing an SMatrix with a zero dimension. When transposing this matrix, the element type changes to Union{}. This happens with either one of the 2 dimension being zero, and also with other types (e.g. Int64).

This issue came up using v0.12.3 and v0.12.2. In v0.12.1 the element type stays the same, which I think is the expected and desired behavior.

Minimum (not) working example using v0.12.3 (and v0.12.2):

julia> using StaticArrays

julia> a = SMatrix{3,0,Float64,0}()
3×0 SArray{Tuple{3,0},Float64,2,0} with indices SOneTo(3)×SOneTo(0)

julia> a'
0×3 SArray{Tuple{0,3},Union{},2,0} with indices SOneTo(0)×SOneTo(3)

Working example using v0.12.1:

julia> using StaticArrays

julia> a = SMatrix{3,0,Float64,0}()
3×0 SArray{Tuple{3,0},Float64,2,0} with indices SOneTo(3)×SOneTo(0)

julia> a'
0×3 SArray{Tuple{0,3},Float64,2,0} with indices SOneTo(0)×SOneTo(3)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions