コード例 #1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            GeneralizedParetoDistribution other = (GeneralizedParetoDistribution)obj;

            if (System.BitConverter.DoubleToInt64Bits(_ksi) != Double.doubleToLongBits(other._ksi))
            {
                return(false);
            }
            if (System.BitConverter.DoubleToInt64Bits(_mu) != Double.doubleToLongBits(other._mu))
            {
                return(false);
            }
            return(System.BitConverter.DoubleToInt64Bits(_sigma) == Double.doubleToLongBits(other._sigma));
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSupport()
        public virtual void testSupport()
        {
            ProbabilityDistribution <double> dist = new GeneralizedParetoDistribution(MU, SIGMA, KSI, ENGINE);

            assertLimit(dist, MU - EPS);
            assertEquals(dist.getCDF(MU + EPS), 0, EPS);
            assertEquals(dist.getCDF(LARGE_X), 1, EPS);
            dist = new GeneralizedParetoDistribution(MU, SIGMA, -KSI);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final double limit = MU + SIGMA / KSI;
            double limit = MU + SIGMA / KSI;

            assertLimit(dist, MU - EPS);
            assertLimit(dist, limit + EPS);
            assertEquals(dist.getCDF(MU + EPS), 0, EPS);
            assertEquals(dist.getCDF(limit - 1e-15), 1, EPS);
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testObject()
        public virtual void testObject()
        {
            assertEquals(KSI, DIST.Ksi, 0);
            assertEquals(MU, DIST.Mu, 0);
            assertEquals(SIGMA, DIST.Sigma, 0);
            GeneralizedParetoDistribution other = new GeneralizedParetoDistribution(MU, SIGMA, KSI, ENGINE);

            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new GeneralizedParetoDistribution(MU, SIGMA, KSI);
            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new GeneralizedParetoDistribution(MU + 1, SIGMA, KSI);
            assertFalse(other.Equals(DIST));
            other = new GeneralizedParetoDistribution(MU, SIGMA + 1, KSI);
            assertFalse(other.Equals(DIST));
            other = new GeneralizedParetoDistribution(MU, SIGMA, KSI + 1);
            assertFalse(other.Equals(DIST));
        }