示例#1
0
 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);
     }
 }
示例#2
0
            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);
            }
示例#3
0
            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);
            }
示例#4
0
            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);
            }
示例#5
0
 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);
     }
 }
示例#6
0
 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);
     }
 }
示例#7
0
            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);
            }
示例#8
0
 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);
     }
 }
示例#9
0
            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);
            }
示例#10
0
            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);
                }
            }
示例#11
0
 protected abstract void GroupTyped(ColumnTyped <DataT> destColumn, long destRow, ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices);
示例#12
0
 protected override void GroupTyped(ColumnTyped <DataT> destColumn, long destRow, ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     destColumn.SetRowValue(destRow, (DataT)GroupTyped(sourceColumn, sourceIndices));
 }
示例#13
0
 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;
 }
示例#15
0
 protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     return(math.Make(sourceIndices.Count));
 }
示例#16
0
 protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     return(sourceColumn.GetRowValue(sourceIndices[0]));
 }
示例#17
0
 public override DataT GetRowValue(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row)
 {
     return(sourceColumn.GetRowValue(row));
 }
示例#18
0
 public override string GetRowValueString(DataT mergedValue, ColumnTyped <DataT> sourceColumn, long row, IDataFormatter formatter)
 {
     return(sourceColumn.GetRowValueString(row, formatter));
 }
示例#19
0
 protected abstract IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices);