From 9e0d00dc7e6aa324220dbed6b4524f0ce89b0f9b Mon Sep 17 00:00:00 2001 From: Luc Maisonobe Date: Sun, 10 Feb 2008 16:23:59 +0000 Subject: [PATCH] removed the StatisticalMultivariateSummaryValues class git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@620288 13f79535-47bb-0310-9956-ffa450edef68 --- .../MultivariateSummaryStatistics.java | 15 +- .../StatisticalMultivariateSummaryValues.java | 215 ------------------ ...hronizedMultivariateSummaryStatistics.java | 7 - 3 files changed, 1 insertion(+), 236 deletions(-) delete mode 100644 src/java/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummaryValues.java diff --git a/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java b/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java index 3f9e95ce8..58b747171 100644 --- a/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java +++ b/src/java/org/apache/commons/math/stat/descriptive/MultivariateSummaryStatistics.java @@ -133,19 +133,6 @@ public class MultivariateSummaryStatistics /** Covariance statistic implementation - cannot be reset. */ private VectorialCovariance covarianceImpl; - /** - * Return a {@link StatisticalMultivariateSummary} instance reporting current - * statistics. - * - * @return Current values of statistics - */ - public StatisticalMultivariateSummary getSummary() { - return new StatisticalMultivariateSummaryValues(getDimension(), getMean(), - getCovariance(), getStandardDeviation(), - getN(), getMax(), getMin(), - getSum(), getSumSq(), getSumLog()); - } - /** * Add an n-tuple to the data * @@ -268,7 +255,7 @@ public class MultivariateSummaryStatistics /** * Returns the covariance matrix of the values that have been added. * - * @return the variance + * @return the covariance matrix */ public RealMatrix getCovariance() { return covarianceImpl.getResult(); diff --git a/src/java/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummaryValues.java b/src/java/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummaryValues.java deleted file mode 100644 index 4987b2a1a..000000000 --- a/src/java/org/apache/commons/math/stat/descriptive/StatisticalMultivariateSummaryValues.java +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.commons.math.stat.descriptive; - -import java.io.Serializable; - -import org.apache.commons.math.linear.RealMatrix; -import org.apache.commons.math.util.MathUtils; - -/** - * Value object representing the results of a statistical multivariate summary. - * - * @since 1.2 - * @version $Revision: 480440 $ $Date: 2006-11-29 08:14:12 +0100 (mer., 29 nov. 2006) $ - */ -public class StatisticalMultivariateSummaryValues - implements Serializable, StatisticalMultivariateSummary { - - /** Serialization id */ - private static final long serialVersionUID = 8152538650791979064L; - - /** Dimension of the data. */ - private final int k; - - /** The sample mean */ - private final double[] mean; - - /** The sample covariance */ - private final RealMatrix covariance; - - /** The sample standard deviation. */ - private double[] stdev; - - /** The number of observations in the sample */ - private final long n; - - /** The maximum value */ - private final double[] max; - - /** The minimum value */ - private final double[] min; - - /** The sum of the sample values */ - private final double[] sum; - - /** The sum of the squares of the sample values */ - private final double[] sumSq; - - /** The sum of the logarithms of the sample values */ - private final double[] sumLog; - - /** - * Constructor - * - * @param mean the sample mean - * @param covariance the sample covariance - * @param stdev the sample standard deviation - * @param k dimension of the data - * @param n the number of observations in the sample - * @param max the maximum value - * @param min the minimum value - * @param sum the sum of the values - * @param sumSq the sum of the squares of the values - * @param sumLog the sum of the logarithms of the values - */ - public StatisticalMultivariateSummaryValues(int k, double[] mean, - RealMatrix covariance, double[] stdev, - long n, double[] max, double[] min, - double[] sum, double[] sumSq, double[] sumLog) { - super(); - this.k = k; - this.mean = (double[]) mean.clone(); - this.covariance = covariance; - this.stdev = (double[]) stdev.clone(); - this.n = n; - this.max = (double[]) max.clone(); - this.min = (double[]) min.clone(); - this.sum = (double[]) sum.clone(); - this.sumSq = (double[]) sumSq.clone(); - this.sumLog = (double[]) sumLog.clone(); - } - - /** - * Returns the dimension of the data - * @return The dimension of the data - */ - public int getDimension() { - return k; - } - - /** - * @return Returns the max. - */ - public double[] getMax() { - return (double[]) max.clone(); - } - - /** - * @return Returns the mean. - */ - public double[] getMean() { - return (double[]) mean.clone(); - } - - /** - * @return Returns the min. - */ - public double[] getMin() { - return (double[]) min.clone(); - } - - /** - * @return Returns the number of values. - */ - public long getN() { - return n; - } - - /** - * @return Returns the sum. - */ - public double[] getSum() { - return (double[]) sum.clone(); - } - - /** - * @return Returns the sum of the squares. - */ - public double[] getSumSq() { - return (double[]) sumSq.clone(); - } - - /** - * @return Returns the sum of the logarithms. - */ - public double[] getSumLog() { - return (double[]) sumLog.clone(); - } - - /** - * @return Returns the standard deviation (roots of the diagonal elements) - */ - public double[] getStandardDeviation() { - return (double[]) stdev.clone(); - } - - /** - * @return Returns the covariance. - */ - public RealMatrix getCovariance() { - return covariance; - } - - /** - * Returns true iff object is a - * StatisticalSummaryValues instance and all statistics have - * the same values as this. - * - * @param object the object to test equality against. - * @return true if object equals this - */ - public boolean equals(Object object) { - if (object == this ) { - return true; - } - if (object instanceof StatisticalMultivariateSummaryValues == false) { - return false; - } - StatisticalMultivariateSummaryValues stat = (StatisticalMultivariateSummaryValues) object; - return ((stat.getDimension() == this.getDimension()) && - MathUtils.equals(stat.getMax(), this.getMax()) && - MathUtils.equals(stat.getMean(),this.getMean()) && - MathUtils.equals(stat.getMin(),this.getMin()) && - MathUtils.equals(stat.getN(), this.getN()) && - MathUtils.equals(stat.getSum(), this.getSum()) && - MathUtils.equals(stat.getSumSq(), this.getSumSq()) && - MathUtils.equals(stat.getSumLog(), this.getSumLog()) && - MathUtils.equals(stat.getStandardDeviation(), this.getStandardDeviation()) && - stat.getCovariance().equals(this.getCovariance())); - } - - /** - * Returns hash code based on values of statistics - * - * @return hash code - */ - public int hashCode() { - int result = getDimension(); - result = result * 31 + MathUtils.hash(getMax()); - result = result * 31 + MathUtils.hash(getMean()); - result = result * 31 + MathUtils.hash(getMin()); - result = result * 31 + MathUtils.hash(getN()); - result = result * 31 + MathUtils.hash(getSum()); - result = result * 31 + MathUtils.hash(getSumSq()); - result = result * 31 + MathUtils.hash(getSumLog()); - result = result * 31 + getCovariance().hashCode(); - result = result * 31 + MathUtils.hash(getStandardDeviation()); - return result; - } - -} diff --git a/src/java/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java b/src/java/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java index fd62a202c..51c385c76 100644 --- a/src/java/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java +++ b/src/java/org/apache/commons/math/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java @@ -48,13 +48,6 @@ public class SynchronizedMultivariateSummaryStatistics super(k, isCovarianceBiasCorrected); } - /** - * @see org.apache.commons.math.stat.descriptive.MultivariateSummary#getSummary() - */ - public synchronized StatisticalMultivariateSummary getSummary() { - return super.getSummary(); - } - /** * @see org.apache.commons.math.stat.descriptive.MultivariateSummary#addValue(double[]) */