centerColumns

Mean Centring of raw data.

  1. Slice!(RCI!T, 2) centerColumns(Slice!(const(T)*, 2, kind) matrix, Slice!(RCI!T) mean, MeanEstimator est)
  2. Slice!(RCI!T) centerColumns(Slice!(const(T)*) col, T mean, MeanEstimator est)
  3. Slice!(RCI!T) centerColumns(Slice!(RCI!T) col, T mean, MeanEstimator est)
  4. Slice!(RCI!T, 2) centerColumns(Slice!(RCI!T, 2, kind) matrix, Slice!(RCI!T) mean, MeanEstimator est)
    @safe pure nothrow @nogc
    Slice!(RCI!T, 2)
    centerColumns
    (
    T
    SliceKind kind
    )
    (
    auto ref const Slice!(RCI!T, 2, kind) matrix
    ,
    out Slice!(RCI!T) mean
    ,)

Parameters

matrix Slice!(RCI!T, 2, kind)

input M x N matrix

mean Slice!(RCI!T)

column means

est MeanEstimator

mean estimation method

Return Value

Type: Slice!(RCI!T, 2)

M x N matrix with each column translated by the column mean

Examples

import mir.ndslice;
import mir.math;

auto data = mininitRcslice!double(2,1);
data[] = [[1],
          [3]];
auto mean = mininitRcslice!double(1);
auto res = centerColumns(data, mean, MeanEstimator.average);
assert(mean[0] == 2);
assert(res == [[-1],[1]]);

Meta