removed the StatisticalMultivariateSummaryValues class

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@620288 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2008-02-10 16:23:59 +00:00
parent e671f72818
commit 9e0d00dc7e
3 changed files with 1 additions and 236 deletions

View File

@ -133,19 +133,6 @@ public class MultivariateSummaryStatistics
/** Covariance statistic implementation - cannot be reset. */ /** Covariance statistic implementation - cannot be reset. */
private VectorialCovariance covarianceImpl; 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 * 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. * Returns the covariance matrix of the values that have been added.
* *
* @return the variance * @return the covariance matrix
*/ */
public RealMatrix getCovariance() { public RealMatrix getCovariance() {
return covarianceImpl.getResult(); return covarianceImpl.getResult();

View File

@ -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 <code>object</code> is a
* <code>StatisticalSummaryValues</code> 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;
}
}

View File

@ -48,13 +48,6 @@ public class SynchronizedMultivariateSummaryStatistics
super(k, isCovarianceBiasCorrected); 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[]) * @see org.apache.commons.math.stat.descriptive.MultivariateSummary#addValue(double[])
*/ */