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

hcat(A, B) is SArray, but [ A ;; B] is not #1275

Open
dev10110 opened this issue Sep 11, 2024 · 0 comments
Open

hcat(A, B) is SArray, but [ A ;; B] is not #1275

dev10110 opened this issue Sep 11, 2024 · 0 comments

Comments

@dev10110
Copy link

Hi,

consider this MWE:

using LinearAlgebra, StaticArrays

A = @SMatrix randn(3, 4)
B = @SMatrix randn(3, 2)

as expected,

hcat(A, B)  #returns 3×6 SMatrix{3, 6, Float64, 18}

but

[ A ;; B]  # returns 3×6 Matrix{Float64}

If we compare this to vcat,

A = @SMatrix randn(3, 4)
B = @SMatrix randn(2, 4)
vcat(A, B) # returns 5×4 SMatrix{5, 4, Float64, 20} (as expected)
[ A ; B] # returns 5×4 SMatrix{5, 4, Float64, 20} (as expected)

So somehow, the array concatenation works for vcat but not for hcat.

Is this expected behavior?

@dev10110 dev10110 changed the title hcat(A, B) is SArray, but [ A ;; B is not hcat(A, B) is SArray, but [ A ;; B] is not Sep 11, 2024
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

1 participant