Lazy concatenation and padding utilities

Ilya Yaroshenko via Digitalmars-d digitalmars-d at puremagic.com
Thu Mar 9 05:46:57 PST 2017


On Thursday, 9 March 2017 at 08:59:28 UTC, Ilya Yaroshenko wrote:
> Hello
>
> Ndslice got [1] lazy multidimensional concatenation and padding 
> utilities:
>  1. stack
>  2. pad
>  2. padEdge
>  3. padSymmetric
>  4. padWrap
>
>
> `stack` can be used for ndslices instead of `chain`.
>
> ---
> import mir.ndslice.allocation: slice;
> import mir.ndslice.stack: stack;
>
> auto d = stack(a, b, c).slice;
> ---
>
> ndslice allocation and assign utilities are optimised to work 
> with stacks. For example the code above is significantly faster 
> then
>
> ---
> import std.array: array;
> import std.range: chain;
>
> auto d = chain(a, b, c).array;
> ---
>
> because `slice` uses external iteration for `Stack` data 
> structure.
>
> [1] http://docs.algorithm.dlang.io/latest/mir_ndslice_stack.html
>
> Best regards,
> Ilya

`stack` was renamed to `concatenation` to much numpy and Matlab


More information about the Digitalmars-d mailing list