-
Notifications
You must be signed in to change notification settings - Fork 11
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 this work for FixedSizeArrays and scalars [WIP] #3
base: master
Are you sure you want to change the base?
Conversation
Would you prefer this to stay in FixedSizeArrays, or did you not have time to review yet? Best, |
I'm okay with a constructor that takes a type and some AbstractArrays and constructs a StructOfArrays. I'm not as big of a fan of integrating the scalar thing here, although with the aforementioned constructor you could pass a type like ScalarRepeat (but with a size and <: AbstractArray) and it ought to work. As far as the FixedSizeArray thing goes, do you need the special case? Couldn't you nest two StructsOfArrays, e.g.: immutable TupleStruct
x::Tuple{Int,Int}
end
julia> StructOfArrays{TupleStruct,1,Tuple{StructOfArrays{Tuple{Int,Int},1,Tuple{Vector{Int},Vector{Int}}}}}((StructOfArrays{Tuple{Int,Int},1,Tuple{Vector{Int},Vector{Int}}}(([1:2;], [2:3;])),))
2-element StructsOfArrays.StructOfArrays{TupleStruct,1,Tuple{StructsOfArrays.StructOfArrays{Tuple{Int64,Int64},1,Tuple{Array{Int64,1},Array{Int64,1}}}}}:
TupleStruct((1,2))
TupleStruct((2,3)) Of course with the new constructor this would be less verbose. |
What I pushed now is not the smartest solution, but it enables my use cases... Best, |
is this PR relevant now that FixedSizeArrays has been deprecated? |
I need this a lot of times and made some less generic types for my own usage in GLVisualize. (Allowing particles, colors, etc, to come in different memory layouts and still being able to calculate e.g. boundingboxes for them).
I'm not sure if this is in the broader interest, especially with scalars mixed in. This could easily go into FixedSizeArrays as well,
I plan to support even more complex constructs like,
StructOfArrays(::Vec3f0, Vector{Vec2f0}, Vector{Float32})
, orStructOfArrays(::Vec3f0, SomeFloatIterator, Vector{Float32}, Vector{Float32})
.WIP because this is the initial sketch to make it work and I'm not too sure about the direction yet ;)