Esempio n. 1
0
            protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
            {
                long count = sourceIndices.Count;

                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);
            }
Esempio n. 2
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);
            }
Esempio n. 3
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);
     }
 }
Esempio n. 4
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);
            }
Esempio n. 5
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);
                }
            }
Esempio n. 6
0
 protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     return(math.Make(sourceIndices.Count));
 }