Skip to content

Make hvcat for StaticArray and UniformScaling inputs produce a StaticArray #888

Open
@sethaxen

Description

@sethaxen

hcat and vcat seem to be specialized for StaticArray blocks, but hvcat does not seem to be specialized. Examples

julia> using StaticArrays

julia> A, B = @SMatrix(randn(2, 2)), @SMatrix(randn(2, 2));

julia> [A B] # fine
2×4 SMatrix{2, 4, Float64, 8} with indices SOneTo(2)×SOneTo(4):
  1.26449    0.426149  -1.15767    0.218855
 -0.816403  -0.241287  -0.663465  -0.367645

julia> [A; B] # fine
4×2 SMatrix{4, 2, Float64, 8} with indices SOneTo(4)×SOneTo(2):
  1.26449    0.426149
 -0.816403  -0.241287
 -1.15767    0.218855
 -0.663465  -0.367645

julia> [A B; A B] # Matrix
4×4 Matrix{Float64}:
  1.26449    0.426149  -1.15767    0.218855
 -0.816403  -0.241287  -0.663465  -0.367645
  1.26449    0.426149  -1.15767    0.218855
 -0.816403  -0.241287  -0.663465  -0.367645

julia> [A B; I] # Matrix
6×4 Matrix{Float64}:
  1.26449    0.426149  -1.15767    0.218855
 -0.816403  -0.241287  -0.663465  -0.367645
  1.0        0.0        0.0        0.0
  0.0        1.0        0.0        0.0
  0.0        0.0        1.0        0.0
  0.0        0.0        0.0        1.0

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