Java源码示例:org.apache.commons.math3.stat.descriptive.rank.Min

示例1
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例2
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例3
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例4
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例5
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例6
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例7
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例8
/**
 * Construct a MultivariateSummaryStatistics instance
 * @param k dimension of the data
 * @param isCovarianceBiasCorrected if true, the unbiased sample
 * covariance is computed, otherwise the biased population covariance
 * is computed
 */
public MultivariateSummaryStatistics(int k, boolean isCovarianceBiasCorrected) {
    this.k = k;

    sumImpl     = new StorelessUnivariateStatistic[k];
    sumSqImpl   = new StorelessUnivariateStatistic[k];
    minImpl     = new StorelessUnivariateStatistic[k];
    maxImpl     = new StorelessUnivariateStatistic[k];
    sumLogImpl  = new StorelessUnivariateStatistic[k];
    geoMeanImpl = new StorelessUnivariateStatistic[k];
    meanImpl    = new StorelessUnivariateStatistic[k];

    for (int i = 0; i < k; ++i) {
        sumImpl[i]     = new Sum();
        sumSqImpl[i]   = new SumOfSquares();
        minImpl[i]     = new Min();
        maxImpl[i]     = new Max();
        sumLogImpl[i]  = new SumOfLogs();
        geoMeanImpl[i] = new GeometricMean();
        meanImpl[i]    = new Mean();
    }

    covarianceImpl =
        new VectorialCovariance(k, isCovarianceBiasCorrected);

}
 
示例9
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例10
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例11
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例12
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例13
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例14
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例15
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例16
@Test
public void testSummaryConsistency() {
    final DescriptiveStatistics dstats = new DescriptiveStatistics();
    final SummaryStatistics sstats = new SummaryStatistics();
    final int windowSize = 5;
    dstats.setWindowSize(windowSize);
    final double tol = 1E-12;
    for (int i = 0; i < 20; i++) {
        dstats.addValue(i);
        sstats.clear();
        double[] values = dstats.getValues();
        for (int j = 0; j < values.length; j++) {
            sstats.addValue(values[j]);
        }
        TestUtils.assertEquals(dstats.getMean(), sstats.getMean(), tol);
        TestUtils.assertEquals(new Mean().evaluate(values), dstats.getMean(), tol);
        TestUtils.assertEquals(dstats.getMax(), sstats.getMax(), tol);
        TestUtils.assertEquals(new Max().evaluate(values), dstats.getMax(), tol);
        TestUtils.assertEquals(dstats.getGeometricMean(), sstats.getGeometricMean(), tol);
        TestUtils.assertEquals(new GeometricMean().evaluate(values), dstats.getGeometricMean(), tol);
        TestUtils.assertEquals(dstats.getMin(), sstats.getMin(), tol);
        TestUtils.assertEquals(new Min().evaluate(values), dstats.getMin(), tol);
        TestUtils.assertEquals(dstats.getStandardDeviation(), sstats.getStandardDeviation(), tol);
        TestUtils.assertEquals(dstats.getVariance(), sstats.getVariance(), tol);
        TestUtils.assertEquals(new Variance().evaluate(values), dstats.getVariance(), tol);
        TestUtils.assertEquals(dstats.getSum(), sstats.getSum(), tol);
        TestUtils.assertEquals(new Sum().evaluate(values), dstats.getSum(), tol);
        TestUtils.assertEquals(dstats.getSumsq(), sstats.getSumsq(), tol);
        TestUtils.assertEquals(new SumOfSquares().evaluate(values), dstats.getSumsq(), tol);
        TestUtils.assertEquals(dstats.getPopulationVariance(), sstats.getPopulationVariance(), tol);
        TestUtils.assertEquals(new Variance(false).evaluate(values), dstats.getPopulationVariance(), tol);
    }
}
 
示例17
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例18
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例19
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例20
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例21
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例22
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例23
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例24
/**
 * Copies source to dest.
 * <p>Neither source nor dest can be null.</p>
 *
 * @param source SummaryStatistics to copy
 * @param dest SummaryStatistics to copy to
 * @throws NullArgumentException if either source or dest is null
 */
public static void copy(SummaryStatistics source, SummaryStatistics dest)
    throws NullArgumentException {
    MathUtils.checkNotNull(source);
    MathUtils.checkNotNull(dest);
    dest.maxImpl = source.maxImpl.copy();
    dest.minImpl = source.minImpl.copy();
    dest.sumImpl = source.sumImpl.copy();
    dest.sumLogImpl = source.sumLogImpl.copy();
    dest.sumsqImpl = source.sumsqImpl.copy();
    dest.secondMoment = source.secondMoment.copy();
    dest.n = source.n;

    // Keep commons-math supplied statistics with embedded moments in synch
    if (source.getVarianceImpl() instanceof Variance) {
        dest.varianceImpl = new Variance(dest.secondMoment);
    } else {
        dest.varianceImpl = source.varianceImpl.copy();
    }
    if (source.meanImpl instanceof Mean) {
        dest.meanImpl = new Mean(dest.secondMoment);
    } else {
        dest.meanImpl = source.meanImpl.copy();
    }
    if (source.getGeoMeanImpl() instanceof GeometricMean) {
        dest.geoMeanImpl = new GeometricMean((SumOfLogs) dest.sumLogImpl);
    } else {
        dest.geoMeanImpl = source.geoMeanImpl.copy();
    }

    // Make sure that if stat == statImpl in source, same
    // holds in dest; otherwise copy stat
    if (source.geoMean == source.geoMeanImpl) {
        dest.geoMean = (GeometricMean) dest.geoMeanImpl;
    } else {
        GeometricMean.copy(source.geoMean, dest.geoMean);
    }
    if (source.max == source.maxImpl) {
        dest.max = (Max) dest.maxImpl;
    } else {
        Max.copy(source.max, dest.max);
    }
    if (source.mean == source.meanImpl) {
        dest.mean = (Mean) dest.meanImpl;
    } else {
        Mean.copy(source.mean, dest.mean);
    }
    if (source.min == source.minImpl) {
        dest.min = (Min) dest.minImpl;
    } else {
        Min.copy(source.min, dest.min);
    }
    if (source.sum == source.sumImpl) {
        dest.sum = (Sum) dest.sumImpl;
    } else {
        Sum.copy(source.sum, dest.sum);
    }
    if (source.variance == source.varianceImpl) {
        dest.variance = (Variance) dest.varianceImpl;
    } else {
        Variance.copy(source.variance, dest.variance);
    }
    if (source.sumLog == source.sumLogImpl) {
        dest.sumLog = (SumOfLogs) dest.sumLogImpl;
    } else {
        SumOfLogs.copy(source.sumLog, dest.sumLog);
    }
    if (source.sumsq == source.sumsqImpl) {
        dest.sumsq = (SumOfSquares) dest.sumsqImpl;
    } else {
        SumOfSquares.copy(source.sumsq, dest.sumsq);
    }
}
 
示例25
@Override
public Min createStatistic(){
	return new Min();
}
 
示例26
public RunningStatistics() {
  this.mean = new Mean();
  this.min = new Min();
  this.max = new Max();
}