You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a "structure of arrays" layout of memory. For example we would store two coordinates (1,2,3) and (4,5,6) as
julia> c =Coords([1,4],[2,5],[3,6])
3-element Coords{Int64} with indices SOneTo(3):
[1, 4]
[2, 5]
[3, 6]
Now say we'd like to get the first coordinate alone, as a vector/Svector. We would do:
julia>map(t->t[1], c)
ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Vector{Int64}
Closest candidates are:convert(::Type{Array{T, N}}, ::SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N}
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/SizedArray.jl:88convert(::Type{Array{T, N}}, ::SizedArray{S, T, N, M, TData}where {M, TData<:AbstractArray{T, M}}) where {T, S, N}
@ StaticArrays ~/.julia/packages/StaticArrays/MSJcA/src/SizedArray.jl:82convert(::Type{T}, ::AbstractArray) where T<:Array
@ Base array.jl:665...
Throws an error. However, this works completely fine for regular vectors:
Consider the struct
This is a "structure of arrays" layout of memory. For example we would store two coordinates (1,2,3) and (4,5,6) as
Now say we'd like to get the first coordinate alone, as a vector/Svector. We would do:
Throws an error. However, this works completely fine for regular vectors:
The text was updated successfully, but these errors were encountered: