-
Notifications
You must be signed in to change notification settings - Fork 150
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
Handling hvcat #1262
Comments
Here's some more detail: julia> @code_lowered [t t]
CodeInfo(
1 ─ nothing
│ %2 = StaticArrays.Size(a)
│ %3 = StaticArrays.Size(b)
│ %4 = StaticArrays._hcat(%2, %3, a, b)
└── return %4
)
julia> @code_lowered [t;t]
CodeInfo(
1 ─ nothing
│ %2 = StaticArrays.Size(a)
│ %3 = StaticArrays.Size(b)
│ %4 = StaticArrays._vcat(%2, %3, a, b)
└── return %4
)
julia> @code_lowered [t t; t t]
CodeInfo(
1 ─ %1 = Base.typed_hvcat
│ %2 = Core.tuple($(Expr(:static_parameter, 1)), rows)
│ %3 = Core._apply_iterate(Base.iterate, %1, %2, xs)
└── return %3
) |
This can be worked around by forcing the julia> [[t t];[t t]]
4×4 SMatrix{4, 4, Float64, 16} with indices SOneTo(4)×SOneTo(4):
0.723556 -0.644347 0.723556 -0.644347
-0.031864 -1.14712 -0.031864 -1.14712
0.723556 -0.644347 0.723556 -0.644347
-0.031864 -1.14712 -0.031864 -1.14712 |
Note also: julia> f(t) = [t t; t t]
f (generic function with 1 method)
julia> @code_lowered f(t)
CodeInfo(
1 ─ %1 = Core.tuple(2, 2)
│ %2 = Base.hvcat(%1, t, t, t, t)
└── return %2
) We need to statically know |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this example, the concatenated
[t t]
correctly returns aSMatrix
. However,returns a raw
Matrix
instead. It seemshvcat
is not correctly overloaded.The text was updated successfully, but these errors were encountered: