コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="first"></param>
        /// <param name="second"></param>
        /// <param name="percentile">desiered percental rank (in range 0...1)</param>
        /// <remarks>Set <cref="percentile"/> with less to <c="0"/> to elliminate selection by percentile rank.</remarks>
        private double Accordance(RecordsNodesCircularList <TPosition> first, RecordsNodesCircularList <TPosition> second, double percentile)
        {
            double res = 0;

            if (!IsCorrelated)
            {
                throw new Exception("Accodance terminated! Launch 'Correlate(...)' method first and then try again. CAUSE: Records collactions are NOT correlated yet.");
            }

            RecordNode <Record <TPosition> > itrtrFirst  = first.Head;
            RecordNode <Record <TPosition> > itrtrSecond = second.Head;

            Delta <TPosition>         delta        = null;
            List <Delta <TPosition> > deltas       = null;
            List <Delta <TPosition> > deltasSorted = null;

            do
            {
                delta = new Delta <TPosition>(itrtrFirst, itrtrSecond);

                if (deltas == null)
                {
                    deltas = new List <Delta <TPosition> >();
                }
                deltas.Add(delta);

                if (deltasSorted == null)
                {
                    deltasSorted = new List <Delta <TPosition> >();
                }
                deltasSorted.Add(delta);

                itrtrFirst  = itrtrFirst.Next;
                itrtrSecond = itrtrSecond.Next;
            }while (itrtrFirst != first.Head);

            if (PercentRank(deltasSorted))
            {
                int endIndx = deltasSorted.Count;

                if (percentile >= 0)
                {
                    int i = 0;
                    for (; i < endIndx && deltasSorted.ElementAt(i).PercentRank.HasValue&& deltasSorted.ElementAt(i).PercentRank.Value < percentile; i++)
                    {
                    }
                    endIndx = i;
                }
                res = deltasSorted.StandardDeviation(0, endIndx);
            }
            return(res);
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public double?GetProduct(RecordNode <T> other)
 {
     return((Data as IProduct <T>)?.GetProduct(other.Data));
 }
コード例 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="first"></param>
 /// <param name="second"></param>
 public Delta(RecordNode <Record <TPosition> > first, RecordNode <Record <TPosition> > second)
 {
     First  = first;
     Second = second;
 }