slice

Slices the result of an operation.

slice
(
,
size_t[] start
,
size_t[] stop
,
string mod = __MODULE__
,
size_t line = __LINE__
)

Parameters

input
Type: Operation

The operation that should be sliced.

start
Type: size_t[]

The starting indices for each dimension.

stop
Type: size_t[]

The stopping indices for each dimension.

Return Value

Type: Operation

The new Operation.

Examples

1 import dopt.core : evaluate;
2 
3 auto s1 = int32([3, 3], [
4     1, 2, 3,
5     4, 5, 6,
6     7, 8, 9
7 ]).slice([1, 1], [3, 3]);
8 
9 assert(s1.evaluate().as!int == [
10     5, 6,
11     8, 9
12 ]);

Meta