Class BigMatrixHelper
java.lang.Object
com.marginallyclever.convenience.helpers.BigMatrixHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double[][]createMatrix(int rows, int cols) static doubledeterminant(double[][] matrix) Method that calculates determinant of given matrixstatic double[][]invert(double[][] a) invert an N*N matrix.static double[]matrix4dToArray(javax.vecmath.Matrix4d m) Convert aMatrix4dto an array of doubles.static double[][]minor(double[][] matrix, int row, int column) Method that creates minor of given matrixstatic double[]multiply(double[][] a, double[] x) matrix-vector multiplication (y = A * x)static double[][]multiplyMatrices(double[][] x, double[][] y) Method that multiplies two matrices and returns the resultstatic voidprintMatrix(double[][] matrix) Method that prints matrixstatic double[][]transpose(double[][] matrix)
-
Constructor Details
-
BigMatrixHelper
public BigMatrixHelper()
-
-
Method Details
-
invert
public static double[][] invert(double[][] a) invert an N*N matrix. See ...- Parameters:
a- the matrix to invert.- Returns:
- the result.
-
transpose
public static double[][] transpose(double[][] matrix) -
determinant
public static double determinant(double[][] matrix) Method that calculates determinant of given matrix- Parameters:
matrix- matrix of which we need to know determinant- Returns:
- determinant of given matrix
-
minor
public static double[][] minor(double[][] matrix, int row, int column) Method that creates minor of given matrix- Parameters:
matrix- matrix of which we need to create minorrow- row of element to excludecolumn- column of element to exclude- Returns:
- minor of given matrix
-
multiplyMatrices
public static double[][] multiplyMatrices(double[][] x, double[][] y) Method that multiplies two matrices and returns the result- Parameters:
x- first matrixy- second matrix- Returns:
- result after multiplication
-
multiply
public static double[] multiply(double[][] a, double[] x) matrix-vector multiplication (y = A * x)- Parameters:
a- matrixx- vector- Returns:
- result of multiplication
-
printMatrix
public static void printMatrix(double[][] matrix) Method that prints matrix- Parameters:
matrix- matrix to print
-
createMatrix
public static double[][] createMatrix(int rows, int cols) -
matrix4dToArray
public static double[] matrix4dToArray(javax.vecmath.Matrix4d m) Convert aMatrix4dto an array of doubles.Matrix4dis row-major and OpenGL is column-major.- Parameters:
m- the matrix to convert- Returns:
- a double array of length 16
-