-
Notifications
You must be signed in to change notification settings - Fork 149
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
Type changes from MArray to SArray upon using broadcast (vectorization) #403
Comments
MArray
to SArray
upon using broadcast (vectorization)
(Note: just a contributor). I think the current convention is to avoid allocation whenever possible. StaticArrays.jl/src/abstractarray.jl Lines 60 to 61 in 8e36860
Note that you can always do julia> a = @MMatrix randn(2, 2)
2×2 StaticArrays.MArray{Tuple{2,2},Float64,2,4}:
-0.266148 -0.146905
0.67229 1.57561
julia> sa = MMatrix{2, 2, Float64}()
2×2 StaticArrays.MArray{Tuple{2,2},Float64,2,4}:
1.4822e-323 6.9015e-310
6.9015e-310 0.0
julia> sa .= sin.(a)
2×2 StaticArrays.MArray{Tuple{2,2},Float64,2,4}:
-0.263017 -0.146378
0.622779 0.999988 There would not be an easy workaround like the one above if an |
See also #327 |
Was solved in #536, which I'm now fairly confident was the right choice :-) |
Why is
sa
of the typeSArray
whereasa
is of the typeMArray
?The text was updated successfully, but these errors were encountered: