Implemented are functions: - finding inverse of a matrix - solving linear equation systems using the Gauss-Elimination method - basic operations like matrix multiplication, addition and so on.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public short[][] | Returns: addition of matrix1 and matrix2; both having the dimensions n x nfirst summand matrix1, short[][] second summand matrix2)Adds the n x n matrices matrix1 and matrix2 |
| public short[] | Returns: addition of vector1 and vector2first summand, always of dim n vector1, short[] second summand, always of dim n vector2)Addition of two vectors |
| private void | |
| private void | computeZerosUnder(boolean
This parameter shows if the function is used by the
solveEquation-function or by the inverse-function and according
to this creates matrices of different sizes. usedForInverse)Elimination under the diagonal. |
| public short[][] | Returns: inverse matrix of the input matrix. If the matrix is singular, null is returned.the matrix which inverse matrix is needed coef)This function computes the inverse of a given matrix using the Gauss- Elimination method. |
| public short[][] | Returns: A = M1*M2-the 1st matrix M1, short[][] -the 2nd matrix M2)This function multiplies two given matrices. |
| public short[] | Returns: M1*mthe matrix to be multiplied M1, short[] the one-dimensional array to be multiplied m)This function multiplies a given matrix with a one-dimensional array. |
| public short[][] | Returns: matrix multiplied with scalargalois element to multiply matrix with scalar, short[][] 2-dim n x n matrix to be multiplied matrix)Multiplies matrix with scalar |
| public short[] | Returns: vector multiplied with scalargalois element to multiply vector with scalar, short[] vector to be multiplied vector)Multiplies vector with scalar |
| public short[][] | Returns: resulting n x n matrix of multiplicationcolumn vector, always n x 1 vector1, short[] row vector, always 1 x n vector2)Multiplication of column vector with row vector |
| public short[] | Returns: x the solution of the equation if it is solvable null otherwisethis matrix is the left part of the
equation (B in the equation above) B, short[] the right part of the equation
(b in the equation above) b)This function finds a solution of the equation Bx = b. |
| private void | substitute()
This function uses backward substitution to find x of the linear equation system (LES) B*x = b, where A a triangle-matrix is (contains only zeros under the diagonal) and b is a vector If the multiplicative inverse of 0 is needed, an exception is thrown. |
| ComputeInField | back to summary |
|---|---|
| public ComputeInField() Constructor with no parameters | |
| addSquareMatrix | back to summary |
|---|---|
| public short[][] addSquareMatrix(short[][] matrix1, short[][] matrix2) Adds the n x n matrices matrix1 and matrix2
| |
| addVect | back to summary |
|---|---|
| public short[] addVect(short[] vector1, short[] vector2) Addition of two vectors
| |
| computeZerosAbove | back to summary |
|---|---|
| private void computeZerosAbove() throws RuntimeException Elimination above the diagonal. This function changes a matrix so that it contains only zeros above the diagonal(Ai,i) using only Gauss-Elimination operations. It is used in the inverse-function The result is stored in the global matrix A
| |
| computeZerosUnder | back to summary |
|---|---|
| private void computeZerosUnder(boolean usedForInverse) throws RuntimeException Elimination under the diagonal. This function changes a matrix so that it contains only zeros under the diagonal(Ai,i) using only Gauss-Elimination operations. It is used in solveEquaton as well as in the function for finding an inverse of a matrix: inverse. Both of them use the Gauss-Elimination Method. The result is stored in the global matrix A
| |
| inverse | back to summary |
|---|---|
| public short[][] inverse(short[][] coef) This function computes the inverse of a given matrix using the Gauss- Elimination method. An exception is thrown if the matrix has no inverse
| |
| multiplyMatrix | back to summary |
|---|---|
| public short[][] multiplyMatrix(short[][] M1, short[][] M2) throws RuntimeException This function multiplies two given matrices. If the given matrices cannot be multiplied due to different sizes, an exception is thrown.
| |
| multiplyMatrix | back to summary |
|---|---|
| public short[] multiplyMatrix(short[][] M1, short[] m) throws RuntimeException This function multiplies a given matrix with a one-dimensional array. An exception is thrown, if the number of columns in the matrix and the number of rows in the one-dim. array differ.
| |
| multMatrix | back to summary |
|---|---|
| public short[][] multMatrix(short scalar, short[][] matrix) Multiplies matrix with scalar
| |
| multVect | back to summary |
|---|---|
| public short[] multVect(short scalar, short[] vector) Multiplies vector with scalar
| |
| multVects | back to summary |
|---|---|
| public short[][] multVects(short[] vector1, short[] vector2) Multiplication of column vector with row vector
| |
| solveEquation | back to summary |
|---|---|
| public short[] solveEquation(short[][] B, short[] b) This function finds a solution of the equation Bx = b. Exception is thrown if the linear equation system has no solution
| |
| substitute | back to summary |
|---|---|
| private void substitute() throws IllegalStateException This function uses backward substitution to find x of the linear equation system (LES) B*x = b, where A a triangle-matrix is (contains only zeros under the diagonal) and b is a vector If the multiplicative inverse of 0 is needed, an exception is thrown. In this case is the LES not solvable
| |