ndslice, using a slice in place of T[] in template parameters
Jay Norwood via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jan 10 19:44:16 PST 2016
On Monday, 11 January 2016 at 00:50:37 UTC, Ilya Yaroshenko wrote:
> I will add such function. But it is not safe to do so (Slice
> can have strides not equal to 1). So it is like a hack (&ret[0,
> 0, 0])[0 .. ret.elementsCount]).
>
> Have you made comparison between my and yours parallel versions?
> https://github.com/9il/examples/blob/parallel/image_processing/median-filter/source/app.d
> -- Ilya
Thanks. No, I haven't studied it previously, but I see how you
used the 'hack' in your code, and it works out to the statement
below in my case.
medians[i] = median(vec, (&slb[task,0])[0 .. bigd]);
which compiled. It ran in the faster time without the .array
copying.
parallel time medians msec:87
That 'hack' seems to be related to the third from below.
https://dlang.org/spec/arrays.html
b = a;
b = a[];
b = a[0 .. a.length];
More information about the Digitalmars-d-learn
mailing list