Recently added ndslice API

Ilya Yaroshenko via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Sat Mar 11 02:53:35 PST 2017


11 ndslice and ndField constructors was added since ndslice API 
had been reworked. All of them do not perform any memory 
allocations.

mir.ndslice.slice:

- slicedNdField - Creates full featured n-dimensional ndslice 
over an ndField. ndField is a simple user-defined 
multidimensional view that may have only
`auto ref opIndex(size_t[N] indexes...)` primitive.

mir.ndslice.topology:

- cartesian - Multidimensional Cartesian product

- kronecker - Multidimensional Kronecker product

- bitwise - Bitwise slice over an unsigned integral slice. (used 
in tamediadigital/lincount)

- bitpack - Bitpack slice over an unsigned integral slice. (used 
in tamediadigital/hll-d)

- indexed - Multidimensional std.range.indexed analog for 
ndslice. It works like map, e.g. indexes may have any type that 
can be accepted by source's `opIndex` API.

- linspace - Multidimensional evenly spaced numbers over 
specified intervals. It is numpy and matlab analog. linspace does 
not have floating-point related std.range.iota bug (Issue 6531).

mir.ndslice.concatenation (new):

- concatenation, Creates a concatenated view of multiple slices.

- pad, Pads with a constant value.

- padEdge, Pads with the edge values of slice.

- padSymmetric, Pads with the reflection of the slice mirrored 
along the edge of the slice.

- padWrap - Pads with the wrap of the slice along the axis. The 
first values are used to pad the end and the end values are used 
to pad the beginning.

Github:
https://github.com/libmir/mir-algorithm
API:
http://docs.algorithm.dlang.io/
Know bugs:
- `mir.ndslice.topology.map` may not work with LDC because it has 
deprecated DMD FE.

Best regards,
Ilya


More information about the Digitalmars-d-announce mailing list