Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

make this work for FixedSizeArrays and scalars [WIP]#3

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
SimonDanisch wants to merge4 commits intoJuliaArrays:master
base:master
Choose a base branch
Loading
fromSimonDanisch:sd/fsa_structs

Conversation

@SimonDanisch
Copy link
Member

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 ;)

@SimonDanisch
Copy link
MemberAuthor

Would you prefer this to stay in FixedSizeArrays, or did you not have time to review yet?
I can definitely leave it somewhere else until it's a little more thought out!

Best,
Simon

@simonster
Copy link
Collaborator

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}endjulia> 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.

@SimonDanisch
Copy link
MemberAuthor

What I pushed now is not the smartest solution, but it enables my use cases...
It implements that you can use arbitrary structs and arbitrary abstract arrays, and it will work as long as the flattened element types match.
Setindex is not implemented yet, as I wanted to know your opinion first.
I want to be able to mix arrays which provide more than one field with arrays for only one field.
But maybe I could combine what you propose and improve my current solution with nesting StructsOfArrays...

Best,
Simon

@bjarthur
Copy link

is this PR relevant now that FixedSizeArrays has been deprecated?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@SimonDanisch@simonster@bjarthur

[8]ページ先頭

©2009-2025 Movatter.jp