Class SquareMatrixSupport.ArrayRealSquareMatrix

java.lang.Object
org.apache.commons.statistics.inference.SquareMatrixSupport.ArrayRealSquareMatrix
All Implemented Interfaces:
SquareMatrixSupport.RealSquareMatrix
Enclosing class:
SquareMatrixSupport

private static class SquareMatrixSupport.ArrayRealSquareMatrix extends Object implements SquareMatrixSupport.RealSquareMatrix
Implementation of SquareMatrixSupport.RealSquareMatrix using a double[] array to store entries. Values are addressed using i*dim + j where dim is the square dimension.

Scaling is supported using the central element [m][m] where m = dimension/2. Scaling is only implemented post-multiplication to protect against overflow during repeat multiplication operations.

Note: The scaling is implemented to support computation of Kolmogorov's distribution as described in:

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double[]
    Entries of the matrix.
    private final int
    Dimension.
    private final int
    Matrix scale.
    private static final double
    The scaling threshold.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArrayRealSquareMatrix(int dimension, double[] data, int scale)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    Check the exponent is not negative.
    int
    Gets the dimension for the rows and columns.
    double
    get(int i, int j)
    Gets the value.
    Creates the identity matrix I with the same dimension as this.
    private static int
    multiply(double[] a, int sa, double[] b, int sb, double[] col, double[] out)
    Returns the result of postmultiplying a by b.
    power(int n)
    Returns the result of multiplying this with itself n times.
    int
    Gets the scale of the matrix values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • SCALE_THRESHOLD

      private static final double SCALE_THRESHOLD
      The scaling threshold. Marsaglia used 1e140. This uses 2^400 ~ 2.58e120
      See Also:
    • dim

      private final int dim
      Dimension.
    • data

      private final double[] data
      Entries of the matrix.
    • exp

      private final int exp
      Matrix scale.
  • Constructor Details

    • ArrayRealSquareMatrix

      ArrayRealSquareMatrix(int dimension, double[] data, int scale)
      Parameters:
      dimension - Matrix dimension.
      data - Matrix data.
      scale - Matrix scale.
  • Method Details