@@ -4,7 +4,7 @@ This is a submodule of $(MREF mir,ndslice).
44The module contains $(LREF _chunks) routine.
55$(LREF Chunks) structure is multidimensional random access range with slicing.
66
7- $(SUBREF slice, slicedNdField) can be used to construct ndslice view on top of $(LREF Chunks).
7+ $(SUBREF slice, slicedField), $(SUBREF slice, slicedNdField) can be used to construct ndslice view on top of $(LREF Chunks).
88
99License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
1010Copyright: Copyright © 2016-, Ilya Yaroshenko
@@ -174,7 +174,6 @@ unittest
174174 static assert (isRandomAccessRange! (typeof (ch)));
175175}
176176
177-
178177// / 1Dx2D
179178unittest
180179{
@@ -205,6 +204,23 @@ unittest
205204 static assert (isRandomAccessRange! (typeof (ch)));
206205}
207206
207+ // conversion to ndslice
208+ unittest
209+ {
210+ import mir.ndslice.slice : slicedField;
211+ import mir.ndslice.chunks: chunks;
212+ import mir.ndslice.topology: iota, map;
213+ import mir.math.sum: sum;
214+
215+ // 0 1 2 3 4 5 6 7 8 9 10
216+ auto sl = iota(11 );
217+ // 0 1 2 | 3 4 5 | 6 7 8 | 9 10
218+ auto ch = sl.chunks(3 );
219+ // 3 | 12 | 21 | 19
220+ auto s = ch.slicedField.map! sum;
221+ assert (s == [3 , 12 , 21 , 19 ]);
222+ }
223+
208224/+ +
209225+/
210226struct Chunks (size_t [] dimensions, SliceKind kind, size_t [] packs, Iterator)
0 commit comments