Class Matrices
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.internal.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 anIllegalStateException
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.
-
-
-
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 entrya0,0
a01
- matrix entrya0,1
a10
- matrix entrya1,0
a11
- matrix entrya1,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 entrya0,0
a01
- matrix entrya0,1
a02
- matrix entrya0,2
a10
- matrix entrya1,0
a11
- matrix entrya1,1
a12
- matrix entrya1,2
a20
- matrix entrya2,0
a21
- matrix entrya2,1
a22
- matrix entrya2,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. AnIllegalStateException
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 anIllegalStateException
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
-
-