protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeMedian).Auto()) { long count = sourceIndices.indexCount; DataT[] d = new DataT[count]; int i = 0; foreach (var v in sourceColumn.VisitRows(sourceIndices)) { d[i] = v; ++i; } Array.Sort(d, Comparer.Ascending <DataT>()); DataT median; long mid = count / 2; if (count % 2 == 0) { median = math.Div(math.Add(d[mid - 1], d[mid]), math.Make(2)); } else { median = d[mid]; } return(median); } }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { DataT result = math.MinValue(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Max(result, v); } return(result); }
public void Merge(Column destColumn, long destRow, Column sourceColumn, ArrayRange sourceIndices) { ColumnTyped <DataT> destColumnT = (ColumnTyped <DataT>)destColumn; ColumnTyped <DataT> sourceColumnT = (ColumnTyped <DataT>)sourceColumn; if (destColumnT == null || sourceColumnT == null) { throw new System.Exception("Bad column type"); } GroupTyped(destColumnT, destRow, sourceColumnT, sourceIndices); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { DataT result = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Add(result, v); } result = math.Div(result, math.Make(sourceIndices.Count)); return(result); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeMax).Auto()) { DataT result = math.MinValue(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Max(result, v); } return(result); } }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeAverage).Auto()) { DataT result = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { result = math.Add(result, v); } result = math.Div(result, math.Make(sourceIndices.indexCount)); return(result); } }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { DataT result = math.Zero(); DataT z = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { if (math.Compare(v, z) >= 0) { result = math.Add(result, v); } } return(result); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { using (Profiling.GetMarker(Profiling.MarkerId.MergeSumPositive).Auto()) { DataT result = math.Zero(); DataT z = math.Zero(); foreach (var v in sourceColumn.VisitRows(sourceIndices)) { if (math.Compare(v, z) >= 0) { result = math.Add(result, v); } } return(result); } }
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); } }
protected abstract void GroupTyped(ColumnTyped <DataT> destColumn, long destRow, ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices);
protected override void GroupTyped(ColumnTyped <DataT> destColumn, long destRow, ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { destColumn.SetRowValue(destRow, (DataT)GroupTyped(sourceColumn, sourceIndices)); }
public override string GetRowValueString(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row) { return(sourceColumn.GetRowValueString(row)); }
void IIndexedColumn.Initialize(IndexedTable table, Column sourceColumn) { m_IndexedTable = table; m_SourceColumn = (ColumnTyped <DataT>)sourceColumn; }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { return(math.Make(sourceIndices.Count)); }
protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices) { return(sourceColumn.GetRowValue(sourceIndices[0])); }
public override DataT GetRowValue(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row) { return(sourceColumn.GetRowValue(row)); }
public override string GetRowValueString(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row, IDataFormatter formatter) { return(sourceColumn.GetRowValueString(row, formatter)); }
protected abstract IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices);