DIP80: phobos additions

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 10:02:03 PDT 2015


On Tuesday, 9 June 2015 at 16:08:40 UTC, Andrei Alexandrescu 
wrote:
> On 6/9/15 1:50 AM, John Colvin wrote:
>> On Tuesday, 9 June 2015 at 06:59:07 UTC, Andrei Alexandrescu 
>> wrote:
>>> (a) Provide standard data layouts in std.array for the 
>>> typical shapes
>>> supported by linear algebra libs: row major, column major, 
>>> alongside
>>> with striding primitives.
>>
>> I don't think this is quite the right approach. 
>> Multidimensional arrays
>> and matrices are about accessing and iteration over data, not 
>> data
>> structures themselves. The standard layouts are common special 
>> cases.
>
> I see. So what would be the primitives necessary? Strides (in 
> the form of e.g. special ranges)? What are the things that 
> would make a library vendor or user go, "OK, now I know what 
> steps to take to use my code with D"?
>

N-dimensional slices can be expressed as N slices and N shifts.
Where shift equals count of elements in source range  between 
front elements of neighboring sub-slices on corresponding 
slice-level.

private struct Slice(size_t N, Range)
{
     size_t[2][N] slices;
     size_t[N] shifts;
     Range range;
}


More information about the Digitalmars-d mailing list