Class VectorialCovariance
- java.lang.Object
-
- org.apache.commons.math3.stat.descriptive.moment.VectorialCovariance
-
- All Implemented Interfaces:
java.io.Serializable
public class VectorialCovariance extends java.lang.Object implements java.io.SerializableReturns the covariance matrix of the available vectors.- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisBiasCorrectedIndicator for bias correction.private longnNumber of vectors in the sample.private double[]productsSumsSums of products for each component.private static longserialVersionUIDSerializable version identifierprivate double[]sumsSums for each component.
-
Constructor Summary
Constructors Constructor Description VectorialCovariance(int dimension, boolean isBiasCorrected)Constructs a VectorialCovariance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clears the internal state of the Statisticbooleanequals(java.lang.Object obj)longgetN()Get the number of vectors in the sample.RealMatrixgetResult()Get the covariance matrix.inthashCode()voidincrement(double[] v)Add a new vector to the sample.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serializable version identifier- See Also:
- Constant Field Values
-
sums
private final double[] sums
Sums for each component.
-
productsSums
private final double[] productsSums
Sums of products for each component.
-
isBiasCorrected
private final boolean isBiasCorrected
Indicator for bias correction.
-
n
private long n
Number of vectors in the sample.
-
-
Constructor Detail
-
VectorialCovariance
public VectorialCovariance(int dimension, boolean isBiasCorrected)Constructs a VectorialCovariance.- Parameters:
dimension- vectors dimensionisBiasCorrected- if true, computed the unbiased sample covariance, otherwise computes the biased population covariance
-
-
Method Detail
-
increment
public void increment(double[] v) throws DimensionMismatchExceptionAdd a new vector to the sample.- Parameters:
v- vector to add- Throws:
DimensionMismatchException- if the vector does not have the right dimension
-
getResult
public RealMatrix getResult()
Get the covariance matrix.- Returns:
- covariance matrix
-
getN
public long getN()
Get the number of vectors in the sample.- Returns:
- number of vectors in the sample
-
clear
public void clear()
Clears the internal state of the Statistic
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-