Esempio n. 1
0
        public void Setup()
        {
            if (this._dataFewLow != null)
            {
                return;
            }

            Random rand = new Random(1234567);

            this._dataFewLow   = Enumerable.Range(0, _few).Select(x => (double)rand.Next(_few)).ToArray();
            this._dataManyLow  = Enumerable.Range(0, _many).Select(x => (double)rand.Next(_few)).ToArray();
            this._dataFewHigh  = Enumerable.Range(0, _few).Select(x => (double)rand.Next(_many)).ToArray();
            this._dataManyHigh = Enumerable.Range(0, _many).Select(x => (double)rand.Next(_many)).ToArray();

            this._dataFewLowL   = this._dataFewLow.Select(x => (long)x).ToArray();
            this._dataManyLowL  = this._dataManyLow.Select(x => (long)x).ToArray();
            this._dataFewHighL  = this._dataFewHigh.Select(x => (long)x).ToArray();
            this._dataManyHighL = this._dataManyHigh.Select(x => (long)x).ToArray();

            this._p2_95Fast = new PsquareSinglePercentileAlgorithmBuilder(95, Precision.LessPreciseAndFaster);
            this._p2_99Fast = new PsquareSinglePercentileAlgorithmBuilder(99, Precision.LessPreciseAndFaster);

            this._p2_95Normal = new PsquareSinglePercentileAlgorithmBuilder(95, Precision.Normal);
            this._p2_99Normal = new PsquareSinglePercentileAlgorithmBuilder(99, Precision.Normal);

            this._ckms_95lowPrec  = new ConstantErrorBasicCKMSBuilder(0.001, new double[] { 95 });
            this._ckms_95highPrec = new ConstantErrorBasicCKMSBuilder(0.000001, new double[] { 95 });

            this._hdr_low  = new IntHistogram(Int32.MaxValue / 2, 0);
            this._hdr_high = new IntHistogram(Int32.MaxValue, 0);

            this._tDigest = new TDigest();
        }
        public int P2()
        {
            int res = 0;

            for (int i = 0; i < _allocCount; i++)
            {
                var obj = new PsquareSinglePercentileAlgorithmBuilder(99, Precision.LessPreciseAndFaster);
                obj.AddValue(1d);
                obj.AddValue(2d);
                res += obj.GetHashCode();
            }

            return(res);
        }