protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { DataT count = math.Make(sourceIndices.Count); DataT avg = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { avg = math.Add(avg, v); } avg = math.Div(avg, count); DataT dev = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { dev = math.Add(dev, math.SubAbs(avg, v)); } dev = math.Div(dev, count); return(dev); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeDeviation).Auto()) { DataT count = math.Make(sourceIndices.indexCount); DataT avg = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { avg = math.Add(avg, v); } avg = math.Div(avg, count); DataT dev = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { dev = math.Add(dev, math.SubAbs(avg, v)); } dev = math.Div(dev, count); return(dev); } }