コード例 #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);
            }
コード例 #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);
                }
                return(result);
            }
コード例 #3
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);
            }
コード例 #4
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);
                }
            }
コード例 #5
0
 protected override IComparable GroupTyped(ColumnTyped <DataT> sourceColumn, ArrayRange sourceIndices)
 {
     using (Profiling.GetMarker(Profiling.MarkerId.MergeSum).Auto())
     {
         DataT result = math.Zero();
         foreach (var v in sourceColumn.VisitRows(sourceIndices))
         {
             result = math.Add(result, v);
         }
         return(result);
     }
 }
コード例 #6
0
 public static Numeric <T> operator +(Numeric <T> a, Numeric <T> b)
 => Implementation.Add(a, b);
コード例 #7
0
        protected void kf_bfly2(Array <kiss_fft_cpx <kiss_fft_scalar> > Fout, int fstride, int m)
        {
            Array <kiss_fft_cpx <kiss_fft_scalar> > Fout2;
            Array <kiss_fft_cpx <kiss_fft_scalar> > tw1 = new Array <kiss_fft_cpx <kiss_fft_scalar> >(Twiddles);
            kiss_fft_cpx <kiss_fft_scalar>          t;

            Fout2 = Fout + m;
            do
            {
                Fout[0]  = A.FixDivide(Fout[0], 2);
                Fout2[0] = A.FixDivide(Fout2[0], 2);

                t        = A.Multiply(Fout2[0], tw1[0]);
                tw1     += fstride;
                Fout2[0] = A.Subtract(Fout[0], t);
                Fout[0]  = A.Add(Fout[0], t);
                ++Fout2;
                ++Fout;
            } while (--m != 0);
        }