template arguments to pass to mir.math.sum (to compute the mean of the slice)
Center vector
import mir.ndslice.slice : sliced; static immutable x = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25, 2.0, 7.5, 5.0, 1.0, 1.5, 0.0]; static immutable result = [-2.4375, -1.4375, -0.9375, -0.4375, 1.0625, 1.8125, -0.4375, 5.0625, 2.5625, -1.4375, -0.9375, -2.4375]; assert(x.sliced.center == result.sliced);
Center matrix
import mir.ndslice.slice : sliced; static immutable x = [0.0, 1.0, 1.5, 2.0, 3.5, 4.25, 2.0, 7.5, 5.0, 1.0, 1.5, 0.0]; static immutable result = [-2.4375, -1.4375, -0.9375, -0.4375, 1.0625, 1.8125, -0.4375, 5.0625, 2.5625, -1.4375, -0.9375, -2.4375]; assert(x.sliced(2, 6).center == result.sliced(2, 6));
$(MATHREF sum, sum)
Lazily centers a slice.