Class SquareMatrixSupport.ArrayRealSquareMatrix

  • All Implemented Interfaces:
    SquareMatrixSupport.RealSquareMatrix
    Enclosing class:
    SquareMatrixSupport

    private static class SquareMatrixSupport.ArrayRealSquareMatrix
    extends java.lang.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 double[] data
      Entries of the matrix.
      private int dim
      Dimension.
      private int exp
      Matrix scale.
      private static double SCALE_THRESHOLD
      The scaling threshold.
    • Constructor Summary

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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static void checkExponent​(int p)
      Check the exponent is not negative.
      int dimension()
      Gets the dimension for the rows and columns.
      double get​(int i, int j)
      Gets the value.
      private SquareMatrixSupport.RealSquareMatrix identity()
      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.
      SquareMatrixSupport.RealSquareMatrix power​(int n)
      Returns the result of multiplying this with itself n times.
      int scale()
      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 Detail

      • SCALE_THRESHOLD

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

        private final int dim
        Dimension.
      • data

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

        private final int exp
        Matrix scale.
    • Constructor Detail

      • ArrayRealSquareMatrix

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