com.bergerkiller.bukkit.common.map.util

## Class MatrixMath

• ```public class MatrixMath
extends Object```
• ### Constructor Summary

Constructors
Constructor and Description
`MatrixMath()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static void` ```luBacksubstitution(double[] matrix1, int[] row_perm, double[] matrix2)```
Solves a set of linear equations.
`static boolean` ```luDecomposition(double[] matrix0, int[] row_perm)```
Given a 4x4 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself.
• ### Methods inherited from class java.lang.Object

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

• #### MatrixMath

`public MatrixMath()`
• ### Method Detail

• #### luDecomposition

```public static boolean luDecomposition(double[] matrix0,
int[] row_perm)```
Given a 4x4 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself. The input parameters are "matrix0" and "dimen". The array "matrix0" is also an output parameter. The vector "row_perm" is an output parameter that contains the row permutations resulting from partial pivoting. The output parameter "even_row_xchg" is 1 when the number of row exchanges is even, or -1 otherwise. Assumes data type is always double. This function is similar to luDecomposition, except that it is tuned specifically for 4x4 matrices.
Returns:
true if the matrix is nonsingular, or false otherwise.
• #### luBacksubstitution

```public static void luBacksubstitution(double[] matrix1,
int[] row_perm,
double[] matrix2)```
Solves a set of linear equations. The input parameters "matrix1", and "row_perm" come from luDecompostionD4x4 and do not change here. The parameter "matrix2" is a set of column vectors assembled into a 4x4 matrix of floating-point values. The procedure takes each column of "matrix2" in turn and treats it as the right-hand side of the matrix equation Ax = LUx = b. The solution vector replaces the original column of the matrix. If "matrix2" is the identity matrix, the procedure replaces its contents with the inverse of the matrix from which "matrix1" was originally derived.