Jason,

please have a look at https://github.com/JuliaLang/julia/issues/5857 for 
related discussion.

In short: I think the code would be more readable if there would be 
FixedSize arrays and ImmutableArrays.jl even provides them up to a certain 
dimension. The important part is that the FixedSize array has the same 
memory footprint as your Nxm array so that one can reinterpret the one into 
the other (without any extra allocation) ImmutableArrays.jl allows this but 
it would be nicer if regular tuples would also allow this.

Cheers

Tobi

Am Samstag, 9. August 2014 22:12:58 UTC+2 schrieb Tim Holy:
>
> I think a point type would be nice, but I think tuples are going to need a 
> little more work before that will be as efficient as you'd like. For now 
> I'd 
> recommend the 2d Array. 
>
> --Tim 
>
> On Saturday, August 09, 2014 12:57:22 PM Jason Merrill wrote: 
> > I'm working on some algorithms that operate on a point set in N 
> dimensions, 
> > and I'm most interested in small N. 
> > 
> > My first thought was to represent the points by a 1D array of some kind 
> of 
> > Point type, with Point just being a type alias of NTuple{N, T}, or 
> > something morally equivalent. But now that I'm writing the code, it 
> seems 
> > like it is currently a lot easier express simple computations (e.g. 
> finding 
> > the bounding box) with a plain old 2D array. I looked around at what 
> other 
> > people are doing, and noticed that Distance at least uses an Nxm array 
> to 
> > represent m points in N dimensions. 
> > 
> > I see that Base "graphics.jl" defines Vec2 and a Point type for 2D 
> > geometry, with a bounding box method and rotations, but the machinery 
> there 
> > isn't developed very far yet, and doesn't try to extend to 3D or higher 
> at 
> > all. 
> > 
> > So I guess I'm wondering if Nxm arrays are the obvious right way to go, 
> or 
> > if there's something to be gained from a Point type and it's just that 
> no 
> > one has put together the relevant machinery yet. 
>
>

Reply via email to