ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Jay Norwood via Digitalmars-d-learn
I cut this median template from Jack Stouffer's article and was attempting to use it in a parallel function. As shown, it builds and execute correctly, but it failed to compile if I attempting to use medians[i] = median(vec,slb[task]); in place of the medians[i] = median(vec,dbuf[j .. k]);

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Sunday, 10 January 2016 at 22:00:20 UTC, Jay Norwood wrote: I cut this median template from Jack Stouffer's article and was attempting to use it in a parallel function. As shown, it builds and execute correctly, but it failed to compile if I attempting to use medians[i] = median(vec,slb[t

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 10 January 2016 at 22:23:18 UTC, Ilya Yaroshenko wrote: Could you please provide full code and error (git gists)? -- Ilya ok, thanks. I'm building with DMD32 D Compiler v2.069.2 on Win32. The dub.json is included. https://gist.github.com/jnorwood/affd05b69795c20989a3

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Sunday, 10 January 2016 at 23:24:24 UTC, Jay Norwood wrote: On Sunday, 10 January 2016 at 22:23:18 UTC, Ilya Yaroshenko wrote: Could you please provide full code and error (git gists)? -- Ilya ok, thanks. I'm building with DMD32 D Compiler v2.069.2 on Win32. The dub.json is included.

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Sunday, 10 January 2016 at 23:24:24 UTC, Jay Norwood wrote: On Sunday, 10 January 2016 at 22:23:18 UTC, Ilya Yaroshenko wrote: Could you please provide full code and error (git gists)? -- Ilya ok, thanks. I'm building with DMD32 D Compiler v2.069.2 on Win32. The dub.json is included.

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Jay Norwood via Digitalmars-d-learn
On Sunday, 10 January 2016 at 23:31:47 UTC, Ilya Yaroshenko wrote: Just use normal arrays for buffer (median accepts array on second argument for optimisation reasons). ok, I think I see. I created a slice(numTasks, bigd) over an allocated double[] dbuf, but slb[task] will be returning some s

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Monday, 11 January 2016 at 00:39:04 UTC, Jay Norwood wrote: On Sunday, 10 January 2016 at 23:31:47 UTC, Ilya Yaroshenko wrote: Just use normal arrays for buffer (median accepts array on second argument for optimisation reasons). ok, I think I see. I created a slice(numTasks, bigd) over an

Re: ndslice, using a slice in place of T[] in template parameters

2016-01-10 Thread Jay Norwood via Digitalmars-d-learn
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? http