Proposal: Multidimensional opSlice solution
Fawzi Mohamed
fmohamed at mac.com
Tue Mar 9 05:27:13 PST 2010
On 2010-03-09 13:35:36 +0100, Fawzi Mohamed <fawzi at gmx.ch> said:
>
> On 9-mar-10, at 13:21, Andrei Alexandrescu wrote:
>
>> Norbert Nemec wrote:
>>> Multidimensional arrays are the essence of the interfaces of most
>>> numerical libraries. Having several incompatible standards is a major
>>> roadblock for acceptance in the numerical community.
>>
>> I'm not so sure about that. I was very enthusiastic about defining an
>> infrastructure of arbitary-dimensional arrays, and did a little
>> research about it. It turns out the applicability of N-dimensional
>> arrays falls off a cliff when N > 3. In turn, this is because high-
>> dimensional space are weird - an N-dimensional space is not just like
>> a 3-dimensional one, only with more dimensions; it's a downright weird
>> beast.
>
> yes and for dense storage, and may operations, the cost is exponential
> in N, so that one normally doesn't really want to go beyond 3. Still I
> did need up to 3, and well if you go with dense storage, up to 3 or up
> to N is more or less the same amount f code if you use templates...
>
> But for non dense storage it gets messy really quick because design
> choices really influence the api that one can use efficiently.
>
> Fawzi
By the way on the whole I think that D2.0 improves several things in
the language, there are some design choices that I don't share so much
(shared, increased use of thread local storage,...), but for sure it
will make library implementations of multidimensional array better:
* immutability can be put to good use for shape and strides,
* maybe a struct implementation might be usable together with a good
memory management (I have tried a couple of times to switch to a
structure, but the drawbacks were more that the wins in D1.0,
especially as you could not ensure deallocation of resources)
* the latest additions wrt. operator overloading are nice.
Now what is still missing for me is a good compiler for x86_64... :)
More information about the Digitalmars-d
mailing list