org.apache.commons.math3.stat.descriptive.moment

## Class VectorialCovariance

- java.lang.Object
- - org.apache.commons.math3.stat.descriptive.moment.VectorialCovariance

- All Implemented Interfaces:
    Serializable

      public class VectorialCovariance
      extends Object
      implements Serializable

  Returns the covariance matrix of the available vectors.
  Since:
    1.2
  Version:
    $Id: VectorialCovariance.java 1416643 2012-12-03 19:37:14Z tn $
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `isBiasCorrected` Indicator for bias correction.
    `private long` | `n` Number of vectors in the sample.
    `private double[]` | `productsSums` Sums of products for each component.
    `private static long` | `serialVersionUID` Serializable version identifier
    `private double[]` | `sums` Sums for each component.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VectorialCovariance(int dimension, boolean isBiasCorrected)` Constructs a VectorialCovariance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Clears the internal state of the Statistic
    `boolean` | `equals(Object obj)`
    `long` | `getN()` Get the number of vectors in the sample.
    `RealMatrix` | `getResult()` Get the covariance matrix.
    `int` | `hashCode()`
    `void` | `increment(double[] v)` Add a new vector to the sample.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 dimension
        `isBiasCorrected` - if true, computed the unbiased sample covariance, otherwise computes the biased population covariance

  - ### Method Detail

    - #### increment

          public void increment(double[] v)
                         throws DimensionMismatchException

      Add 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:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

Copyright (c) 2003-2013 Apache Software Foundation