HFE
Class LUDecomposition4

java.lang.Object
  |
  +--HFE.LUDecomposition4
All Implemented Interfaces:
java.io.Serializable

public class LUDecomposition4
extends java.lang.Object
implements java.io.Serializable

This class encapsulates the operations for LUDecomposition for matrices over the finite field F_4).
The class provides only operations which are needed in the HFE package. The class is based upon the Jama package, which was produced by The MathWorks, Inc. and the National Institute of Standards and Technology. Jama can be downloaded from the NIST page http://math.nist.gov/javanumerics/jama/.

The explenation of LU decomposition is copied from there documentation:

For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U. If m < n, then L is m-by-m and U is m-by-n.

The LU decompostion with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if isNonsingular() returns false.

Version:
0.1
See Also:
Serialized Form

Field Summary
private  int[][] LU
          Array for internal storage of decomposition.
private  int m
          Row and column dimensions, and pivot sign.
private  int n
          Row and column dimensions, and pivot sign.
private  int[] piv
          Internal storage of pivot vector.
 
Constructor Summary
LUDecomposition4(Matrix4 A)
          LU Decomposition
 
Method Summary
 int det()
          Determinant
static java.lang.Object[] generateNonsingular(int size, java.util.Random rnd)
          Generates a random nonsingular matrix of the given size.
 boolean isNonsingular()
          Is the matrix nonsingular?
static void main(java.lang.String[] args)
          Tests everything in this class
 void solve(int[] b, int[] x)
          Solve A*x = b, i.e.
 Matrix4 solve(Matrix4 B)
          Solve A*X = B
static void testIt()
          Tests the functionality of the whole class.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

LU

private int[][] LU
Array for internal storage of decomposition.

m

private int m
Row and column dimensions, and pivot sign.

n

private int n
Row and column dimensions, and pivot sign.

piv

private int[] piv
Internal storage of pivot vector.
Constructor Detail

LUDecomposition4

public LUDecomposition4(Matrix4 A)
LU Decomposition
Parameters:
A - Rectangular matrix
Method Detail

generateNonsingular

public static java.lang.Object[] generateNonsingular(int size,
                                                     java.util.Random rnd)
Generates a random nonsingular matrix of the given size.
Parameters:
size - Number of rows/columns.
rnd - Random number generator.
Returns:
In position [0] of the array is the generated matrix, in position [1] its LU decomposition.

isNonsingular

public boolean isNonsingular()
Is the matrix nonsingular?
Returns:
true if U, and hence A, is nonsingular.

det

public int det()
Determinant
Returns:
det(A)

solve

public Matrix4 solve(Matrix4 B)
Solve A*X = B
Parameters:
B - A Matrix with as many rows as A and any number of columns.
Returns:
X so that L*U*X = B(piv,:)
Throws:
java.lang.IllegalArgumentException - Matrix row dimensions must agree.
java.lang.RuntimeException - Matrix is singular.

solve

public void solve(int[] b,
                  int[] x)
Solve A*x = b, i.e. computes x so that L*U*x = b(piv,:)
Parameters:
b - A vector with as many rows as A; it is treated to be a n*1 matrix.

testIt

public static void testIt()
Tests the functionality of the whole class. If there occurs any error it will be printed on stdout.

main

public static void main(java.lang.String[] args)
Tests everything in this class
See Also:
testIt()