`All Packages  Class Hierarchy  This Package  Previous  Next  Index`

# Class jnt.linear_algebra.LU

```java.lang.Object
|
+----jnt.linear_algebra.LU
```

public class LU
extends Object
LU matrix factorization. (Based on TNT implementation.) Decomposes a matrix A into a triangular lower triangular factor (L) and an upper triangular factor (U) such that A = L*U. By convnetion, the main diagonal of L consists of 1's so that L and U can be stored compactly in a NxN matrix.

LU(double[][])
Initalize LU factorization from matrix.
factor(double[][], int[])
LU factorization (in place).
getLU()
Returns a copy of the compact LU factorization.
getPivot()
Returns a copy of the pivot vector.
solve(double[])
Solve a linear system, with given factorization.
solve(double[][], int[], double[])
Solve a linear system, using a prefactored matrix in LU form.
LU
``` public LU(double A[][])
```
Initalize LU factorization from matrix.

Parameters:
A - (in) the matrix to associate with this factorization.
getLU
``` public double[][] getLU()
```
Returns a copy of the compact LU factorization. (useful mainly for debugging.)

Returns:
the compact LU factorization. The U factor is stored in the upper triangular portion, and the L factor is stored in the lower triangular portion. The main diagonal of L consists (by convention) of ones, and is not explicitly stored.
getPivot
``` public int[] getPivot()
```
Returns a copy of the pivot vector.

Returns:
the pivot vector used in obtaining the LU factorzation. Subsequent solutions must permute the right-hand side by this vector.
solve
``` public double[] solve(double b[])
```
Solve a linear system, with given factorization.

Parameters:
b - (in) the right-hand side.
Returns:
solution vector.
factor
``` public static int factor(double A[][],
int pivot[])
```
LU factorization (in place).

Parameters:
A - (in/out) On input, the matrix to be factored. On output, the compact LU factorization.
pivit - (out) The pivot vector records the reordering of the rows of A during factorization.
Returns:
0, if OK, nozero value, othewise.
solve
``` public static void solve(double LU[][],
int pvt[],
double b[])
```
Solve a linear system, using a prefactored matrix in LU form.

Parameters:
LU - (in) the factored matrix in LU form.
pivot - (in) the pivot vector which lists the reordering used during the factorization stage.
b - (in/out) On input, the right-hand side. On output, the solution vector.

`All Packages  Class Hierarchy  This Package  Previous  Next  Index`