Hi Steve,
you can have an array of tuples but they are (currently) not layed out
continuously in memory. However, I remember a comment of Keno Fischer that
he wants to change this in the future. This would give us stack allocated
fixed-size vectors. Search for "fixed-size arrays" on the Julia issue
tracker for more information.
For now there is the ImmutableArrays.jl package which has fixed-size arrays
that can be put in an array and reinterpreted, i.e. Array{Vec3{Float64},1}
can be reinterpreted to Array{Float64,2} with the appropriate sizes.
Cheers,
Tobi
P.S.: Yes its him :-)
Am Freitag, 13. Juni 2014 20:29:01 UTC+2 schrieb [email protected]:
>
> Thanks to Tim Holy and Steven Johnson for answering my question. With
> regard to tuples, my question was stated ambiguously; what I was actually
> wondering was whether you could make an array of tuples, and, if so,
> whether they would be stored sequentially or with pointers. However, it
> sounds like an array of tuples is inadvisable in any case.
>
> -- Steve Vavasis
>
> P.S. Are you the same Steven Johnson who co-wrote FFTW? If so, I think I
> met you years ago at Cornell.
>
>
> On Thursday, June 12, 2014 8:15:52 PM UTC+3, [email protected] wrote:
>>
>> Dear Julia colleagues,
>>
>> I heard about Julia on Tuesday from Alan Edelman at a meeting in Belgium,
>> and I am possibly interested in developing software in Julia, specifically,
>> finite element mesh generation. I've read the documentation and have a few
>> beginner questions that I hope this newsgroup can answer easily. For the
>> sake of threading, I'm splitting my questions over this and my next three
>> postings. Thank you very much in advance for your help.
>>
>> Questions about immutable:
>>
>> It is important for efficiency that I have the possibility of laying out
>> arrays of structs in memory one after the other (i.e., without a level of
>> indirection for each item in the array).
>>
>> My reading of the documentation suggests that indeed the structs will be
>> laid out in consecutive memory locations provided the struct is declared
>> 'immutable'. Is this correct?
>>
>> Why is the example of rational numbers in the docs not declared
>> immutable? If it is not declared immutable, does this mean that an array
>> of rational numbers is actually an array of pointers to rational numbers?
>>
>> Are tuples stored via pointers or as consecutive structs? The docs don't
>> seem to say.
>>
>> How can I determine on-the-fly whether my array is composed of structs or
>> pointers? I suppose that it is possible with timing tests, but is there a
>> more direct way to check?
>>
>> Thanks,
>> Steve Vavasis
>>
>>