Example #1
0
        public void Test01()
        {
            var rqq = new Rqq(new double[] { 0, 0, 0, 0, 0, 100, 100, 100, 100 });

            DumpRqqTree(rqq);
            var probabilities = Enumerable.Range(0, 10).Select(x => (Probability)(x * 1.0 / 9.0)).ToArray();

            foreach (var probability in probabilities)
            {
                Assert.Equal(0, rqq.GetQuantile(0, 4, probability));
                Assert.Equal(100, rqq.GetQuantile(5, 8, probability));
            }
        }
            public double GetDistance(int tau0, int tau1, int tau2)
            {
                if (tau0 == tau1 || tau1 == tau2)
                {
                    return(0);
                }

                for (int i = 0; i < QuantileCount; i++)
                {
                    quantileLeft[i]  = rqq.GetQuantile(tau0, tau1 - 1, Probabilities[i]);
                    quantileRight[i] = rqq.GetQuantile(tau1, tau2 - 1, Probabilities[i]);
                }

                return(CalcDistance(quantileLeft, quantileRight));
            }