Rectangular multidimensional arrays for D

Stefan Frijters sfrijters at gmail.com
Tue Oct 8 10:26:44 PDT 2013


On Tuesday, 8 October 2013 at 14:41:47 UTC, Denis Shelomovskij 
wrote:
> I accidentally discovered Andrei wrote [1] multidimensional 
> array implementation is needed. If it really is, I will work to 
> revise the API and prepare my implementation [2] for review if 
> nobody is doing it already.
>
> Also as Kenji's "multidimensional indexing and slicing" pull 
> [3] still not merged the only way is to use hacks like this:
> ---
> // first two rows and three columns of the second matrix
> array2d = matrices[1, R[0 .. 2], R[0 .. 3]];
> ---
>
> [1] http://forum.dlang.org/post/kivkp0$csp$1@digitalmars.com
> [2] 
> http://denis-sh.bitbucket.org/unstandard/unstd.multidimensionalarray.html
> [3] https://github.com/D-Programming-Language/dmd/pull/443
>
>
> --- Previous related topics ---
>
> At least the ones I participated in:
>
> * October 09, 2011: Kenji Hara proposes "Matrix-type-friendly 
> syntax and more". His dmd pull #443 still isn't merged.
>     http://forum.dlang.org/thread/j6sp68$2a7k$1@digitalmars.com
>     https://github.com/D-Programming-Language/dmd/pull/443
>
> * October 25, 2011: Original "Multidimensional arrays for D" 
> post. No response from Phobos developers.
>     http://forum.dlang.org/thread/j864es$2gi0$1@digitalmars.com
>
> * June 17, 2012: A request for "template that can simulate a 
> rectangular array".
>     http://forum.dlang.org/thread
>
> * June 30, 2012: A request for "fixed size multidimensional 
> array at runtime".
>     
> http://forum.dlang.org/thread/ldjzfqvnjltbbiovqdmy@forum.dlang.org

I don't normally post here a lot (though I'm a regular reader), 
but I wanted to say I for one would really appreciate an official 
solution for proper rectangular arrays. A bit of background: I'm 
a numerical physicist focusing on the lattice Boltzmann 
method[1], where most physical quantities live on a (3D) lattice. 
Currently I'm using a Fortran code with is very feature-rich, but 
has grown organically over a decade or so and the features have 
come at the cost of maintainability and performance. As I'm very 
much interested in the D language (though I cannot devote much 
time to it at the moment) I've had plans of writing my own 
smaller D code which would contain the features I need. It would 
be nice to be able to use Phobos for my 3D array needs. Slicing 
will also be much valued to make it easier to communicate 
sections of the lattice through MPI. I would aim to undertake 
this project after I've finished my PhD thesis, in ~2 months. I 
don't assume an official Phobos version would be available at 
that time, but even having a good idea of the API that is being 
aimed for would save me a lot of time I think.

Cheers,

Stefan

[1] http://en.wikipedia.org/wiki/Lattice_Boltzmann_methods


More information about the Digitalmars-d mailing list