Example #1
0
        /// <summary>
        /// assertion: isBasicParametersValid == false
        ///
        /// </summary>
        protected void UpdateIncrementalStats()
        {
            // prepare arguments
            double[] arguments = new double[4];
            arguments[0] = base.Min;
            arguments[1] = base.Max;
            arguments[2] = base.Sum;
            arguments[3] = base.SumOfSquares;

            Descriptive.IncrementalUpdate(this.Elements, this.Size, this.Elements.Size - 1, ref arguments);

            // store the new parameters back
            base.Min          = arguments[0];
            base.Max          = arguments[1];
            base.Sum          = arguments[2];
            base.SumOfSquares = arguments[3];

            this.isIncrementalStatValid = true;
            //this.Size = this.Elements.Count; // next time we don't need to redo the stuff we have just done..
        }
Example #2
0
        public override void AddAllOfFromTo(DoubleArrayList list, int from, int to)
        {
            //if (this.arguments == null) setUpCache();
            lock (arguments) {
                // prepare arguments
                arguments[0] = this.min;
                arguments[1] = this.max;
                arguments[2] = this.sum;
                arguments[3] = this.sum_xx;

                Descriptive.IncrementalUpdate(list, from, to, ref arguments);

                // store the new parameters back
                this.min    = arguments[0];
                this.max    = arguments[1];
                this.sum    = arguments[2];
                this.sum_xx = arguments[3];

                this.size += to - from + 1;
            }
        }