Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sethaxen opened this issue Mar 23, 2021 · 1 comment

Comments

@sethaxen
Copy link
Contributor

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
@mateuszbaran
Copy link
Collaborator

#811 was an attempt do do something like that. It seems like constant propagation should be enough in simple cases. I guess for up to four matrices const prop should work? I'm not sure whether doing such a partial solution is even desirable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants