public class ComputeInField
extends java.lang.Object
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.
| Constructor and Description |
|---|
ComputeInField()
Constructor with no parameters
|
| Modifier and Type | Method and Description |
|---|---|
short[][] |
addSquareMatrix(short[][] matrix1,
short[][] matrix2)
Adds the n x n matrices matrix1 and matrix2
|
short[] |
addVect(short[] vector1,
short[] vector2)
Addition of two vectors
|
short[][] |
inverse(short[][] coef)
This function computes the inverse of a given matrix using the Gauss-
Elimination method.
|
short[] |
multiplyMatrix(short[][] M1,
short[] m)
This function multiplies a given matrix with a one-dimensional array.
|
short[][] |
multiplyMatrix(short[][] M1,
short[][] M2)
This function multiplies two given matrices.
|
short[][] |
multMatrix(short scalar,
short[][] matrix)
Multiplies matrix with scalar
|
short[] |
multVect(short scalar,
short[] vector)
Multiplies vector with scalar
|
short[][] |
multVects(short[] vector1,
short[] vector2)
Multiplication of column vector with row vector
|
short[] |
solveEquation(short[][] B,
short[] b)
This function finds a solution of the equation Bx = b.
|
public short[] solveEquation(short[][] B,
short[] b)
B - this matrix is the left part of the
equation (B in the equation above)b - the right part of the equation
(b in the equation above)java.lang.RuntimeException - if LES is not solvablepublic short[][] inverse(short[][] coef)
An exception is thrown if the matrix has no inverse
coef - the matrix which inverse matrix is neededjava.lang.RuntimeException - if the given matrix is not invertiblepublic short[][] multiplyMatrix(short[][] M1,
short[][] M2)
throws java.lang.RuntimeException
M1 - -the 1st matrixM2 - -the 2nd matrixjava.lang.RuntimeException - in case the given matrices cannot be multiplied
due to different dimensions.public short[] multiplyMatrix(short[][] M1,
short[] m)
throws java.lang.RuntimeException
An exception is thrown, if the number of columns in the matrix and the number of rows in the one-dim. array differ.
M1 - the matrix to be multipliedm - the one-dimensional array to be multipliedjava.lang.RuntimeException - in case of dimension inconsistencypublic short[] addVect(short[] vector1,
short[] vector2)
vector1 - first summand, always of dim nvector2 - second summand, always of dim njava.lang.RuntimeException - in case the addition is impossible
due to inconsistency in the dimensionspublic short[][] multVects(short[] vector1,
short[] vector2)
vector1 - column vector, always n x 1vector2 - row vector, always 1 x njava.lang.RuntimeException - in case the multiplication is impossible due to
inconsistency in the dimensionspublic short[] multVect(short scalar,
short[] vector)
scalar - galois element to multiply vector withvector - vector to be multipliedpublic short[][] multMatrix(short scalar,
short[][] matrix)
scalar - galois element to multiply matrix withmatrix - 2-dim n x n matrix to be multipliedpublic short[][] addSquareMatrix(short[][] matrix1,
short[][] matrix2)
matrix1 - first summandmatrix2 - second summandjava.lang.RuntimeException - in case the addition is not possible because of
different dimensions of the matrices