byCoordinateValue

Returns unsorted forward range of (coordinate, value) pairs.

byCoordinateValue
(
size_t N
T
)
(
Slice!(FieldIterator!(SparseField!T), N) slice
)

Parameters

slice
Type: Slice!(FieldIterator!(SparseField!T), N)

sparse slice with pure structure. Any operations on structure of a slice are not allowed.

Examples

1 import mir.array.allocation: array;
2 import mir.ndslice.sorting: sort;
3 alias CV = CoordinateValue!(double, 2);
4 
5 auto slice = sparse!double(3, 3);
6 slice[] = [[0, 2, 1], [0, 0, 4], [6, 7, 0]];
7 assert(slice.byCoordinateValue.array.sort() == [
8     CV([0, 1], 2),
9     CV([0, 2], 1),
10     CV([1, 2], 4),
11     CV([2, 0], 6),
12     CV([2, 1], 7)]);

Meta