/// <summary>
        /// Computes the deviations from the receiver's measures to another bin's measures.
        /// </summary>
        /// <param name="other">the other bin to compare with</param>
        /// <returns>a summary of the deviations.</returns>
        public override String CompareWith(AbstractBin1D other)
        {
            StringBuilder buf = new StringBuilder(base.CompareWith(other));

            if (other is MightyStaticBin1D)
            {
                MightyStaticBin1D m = (MightyStaticBin1D)other;
                if (HasSumOfLogarithms && m.HasSumOfLogarithms)
                {
                    buf.Append("geometric mean: " + RelError(GeometricMean(), m.GeometricMean()) + " %\n");
                }
                if (HasSumOfInversions && m.HasSumOfInversions)
                {
                    buf.Append("harmonic mean: " + RelError(HarmonicMean(), m.HarmonicMean()) + " %\n");
                }
                if (HasSumOfPowers(3) && m.HasSumOfPowers(3))
                {
                    buf.Append("skew: " + RelError(Skew(), m.Skew()) + " %\n");
                }
                if (HasSumOfPowers(4) && m.HasSumOfPowers(4))
                {
                    buf.Append("kurtosis: " + RelError(Kurtosis(), m.Kurtosis()) + " %\n");
                }
                buf.Append("\n");
            }
            return(buf.ToString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns whether two bins are equal;
        /// They are equal if the other object is of the same class or a subclass of this class and both have the same size, minimum, maximum, sum and <see cref="SumOfSquares"/>.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override Boolean Equals(Object obj)
        {
            if (!(obj is AbstractBin1D))
            {
                return(false);
            }
            AbstractBin1D other = (AbstractBin1D)obj;

            return(Size == other.Size && Min == other.Min && Max == other.Max &&
                   Sum == other.Sum && SumOfSquares == other.SumOfSquares);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Computes the deviations from the receiver's measures to another bin's measures.
        /// </summary>
        /// <param name="other">the other bin to compare with</param>
        /// <returns>a summary of the deviations.</returns>
        public virtual String CompareWith(AbstractBin1D other)
        {
            StringBuilder buf = new StringBuilder();

            buf.Append("\nDifferences [percent]");
            buf.Append("\nSize: " + RelError(Size, other.Size) + " %");
            buf.Append("\nSum: " + RelError(Sum, other.Sum) + " %");
            buf.Append("\nSumOfSquares: " + RelError(SumOfSquares, other.SumOfSquares) + " %");
            buf.Append("\nMin: " + RelError(Min, other.Min) + " %");
            buf.Append("\nMax: " + RelError(Max, other.Max) + " %");
            buf.Append("\nMean: " + RelError(Mean(), other.Mean()) + " %");
            buf.Append("\nRMS: " + RelError(Rms(), other.Rms()) + " %");
            buf.Append("\nVariance: " + RelError(Variance(), other.Variance()) + " %");
            buf.Append("\nStandard deviation: " + RelError(StandardDeviation(), other.StandardDeviation()) + " %");
            buf.Append("\nStandard error: " + RelError(StandardError(), other.StandardError()) + " %");
            buf.Append("\n");
            return(buf.ToString());
        }