Proposal: Multidimensional opSlice solution

%fil fil at somewhere.com
Tue Jan 18 06:53:38 PST 2011


Hi All,

I'm still learning D(2) and was toying around with creating a matrix class and wanting to overload opSlice for this purpose. As I can only find very limited documentation on multidimensional arrays in the TDPL book (to my big suprise given the D should be an attractive language for numerical coding), I stumbled accross this post looking elsewhere.
What was the result of this discussion in the end? Are there plans to allow opslice to work for multidimensional arrays or will this be done in Phobos?

Many thanks and sorry to bring us such an old post.

fil


Norbert Nemec Wrote:

> Don wrote:
> > Multidimensional slices normally result in appallingly inefficient use 
> > of caches.
> 
> Indeed, cache usage is a challenge. My general approach would be fairly 
> conservative: give the user full control over memory layout, but do this 
> as comfortably as possible. Provide good performance for straightforward 
> code but allow the user to tweak the details to improve performance
> 
> A library function that takes several arrays as input and output should 
> allow arbitrary memory layouts, but it should also specify which memory 
> layout is most efficient.
> 
> In any case, I think that the expressiveness of multidimensional slices 
> is worth having them even if the performance is not optimal in every 
> case with the first generation of libraries.



More information about the Digitalmars-d mailing list