Class Matrices


  • public final class Matrices
    extends java.lang.Object
    This class consists exclusively of static matrix utility methods.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Matrices()
      Private constructor.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double checkDeterminantForInverse​(double det)
      Check that the given determinant is valid for use in calculating a matrix inverse.
      static double checkElementForInverse​(double element)
      Check that the given matrix element is valid for use in calculation of a matrix inverse, throwing an IllegalStateException if not.
      static double determinant​(double a00, double a01, double a10, double a11)
      Compute the determinant of the 2x2 matrix represented by the given values.
      static double determinant​(double a00, double a01, double a02, double a10, double a11, double a12, double a20, double a21, double a22)
      Compute the determinant of the 3x3 matrix represented by the given values.
      private static java.lang.IllegalStateException nonInvertibleTransform​(java.lang.String msg)
      Create an exception indicating that a matrix is not able to be inverted.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Matrices

        private Matrices()
        Private constructor.
    • Method Detail

      • determinant

        public static double determinant​(double a00,
                                         double a01,
                                         double a10,
                                         double a11)
        Compute the determinant of the 2x2 matrix represented by the given values. The values are listed in row-major order.
        Parameters:
        a00 - matrix entry a0,0
        a01 - matrix entry a0,1
        a10 - matrix entry a1,0
        a11 - matrix entry a1,1
        Returns:
        computed 2x2 matrix determinant
      • determinant

        public static double determinant​(double a00,
                                         double a01,
                                         double a02,
                                         double a10,
                                         double a11,
                                         double a12,
                                         double a20,
                                         double a21,
                                         double a22)
        Compute the determinant of the 3x3 matrix represented by the given values. The values are listed in row-major order.
        Parameters:
        a00 - matrix entry a0,0
        a01 - matrix entry a0,1
        a02 - matrix entry a0,2
        a10 - matrix entry a1,0
        a11 - matrix entry a1,1
        a12 - matrix entry a1,2
        a20 - matrix entry a2,0
        a21 - matrix entry a2,1
        a22 - matrix entry a2,2
        Returns:
        computed 3x3 matrix determinant
      • checkDeterminantForInverse

        public static double checkDeterminantForInverse​(double det)
        Check that the given determinant is valid for use in calculating a matrix inverse. An IllegalStateException is thrown if the determinant is NaN, infinite, or zero.
        Parameters:
        det - the determinant to check
        Returns:
        the checked determinant
        Throws:
        java.lang.IllegalStateException - if the matrix determinant value is NaN, infinite, or zero
      • checkElementForInverse

        public static double checkElementForInverse​(double element)
        Check that the given matrix element is valid for use in calculation of a matrix inverse, throwing an IllegalStateException if not.
        Parameters:
        element - matrix entry to check
        Returns:
        the checked element
        Throws:
        java.lang.IllegalStateException - if the element is not valid for use in calculating a matrix inverse, ie if it is NaN or infinite.
      • nonInvertibleTransform

        private static java.lang.IllegalStateException nonInvertibleTransform​(java.lang.String msg)
        Create an exception indicating that a matrix is not able to be inverted.
        Parameters:
        msg - message containing the specific reason that the matrix cannot be inverted
        Returns:
        IllegalStateException containing the given error message