numericalMethods.algebra.linear.decompose
Class PLR

java.lang.Object
  |
  +--numericalMethods.algebra.linear.decompose.PLR

public class PLR
extends java.lang.Object

Computes for a square matrix A the matrices P, L and R complying PA=LR. The algorithm used is the Gauss algorithm with pivoting.

Advantages
Fast
Few additional resources
Gives determinant
Disadvantages
No control on condition of triangular matrices

This algorithm is implemented for both real and complex valued equation systems. And each method is again available in two version.

One version is an optimized version that consumes as few resources as possible.

The other version is an easy to use version that takes care of for example not changing any arguments where not expected. But this version can sometimes be very resource consuming!

Method versions for PA=LR:

optimizedeasy to use
real valued decompose(p,A) decompose(P,A,L,R)
complex valued decompose(p,A) decompose(P,A,L,R)
This class does not check any arguments for validity!
For identical arguments results are undefined!

See Also:
numericalMethods.algebra.linear.decompose

Constructor Summary
PLR()
           
 
Method Summary
static double decompose(int[][] P, double[][] A, double[][] L, double[][] R)
          Decomposes a real matrix.
static double[] decompose(int[][] P, double[][] A_re, double[][] A_im, double[][] L_re, double[][] L_im, double[][] R_re, double[][] R_im)
          Decomposes a complex matrix.
static double decompose(int[] p, double[][] A)
          Decomposes a real matrix.
static double[] decompose(int[] p, double[][] A_re, double[][] A_im)
          Decomposes a complex matrix.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PLR

public PLR()
Method Detail

decompose

public static double decompose(int[] p,
                               double[][] A)
Decomposes a real matrix.

The left and right triangular matrices are stored merged into the original matrix. The diagonal belongs to the right triangular matrix because the diagonal elements of the left triangular matrix are per definition equal to one. For unmerging them see the methods in Unmerge.triangular.

The permutation is stored in an index vector and can be used like this:

(PA)ijA[p[i]][j]

Parameters:
p - An index vector for taking the permutation.
A - The matrix to decompose and afterwards the merged left and right triangular matrix.
Returns:
The determinant of the matrix.
See Also:
Unmerge.triangular

decompose

public static double decompose(int[][] P,
                               double[][] A,
                               double[][] L,
                               double[][] R)
Decomposes a real matrix.

Parameters:
P - A matrix taking the permutation matrix.
A - The matrix to decompose.
L - A matrix taking the left triangular matrix.
R - A matrix taking the right triangular matrix.
Returns:
The determinant of the matrix.
See Also:
Unmerge.triangular

decompose

public static double[] decompose(int[] p,
                                 double[][] A_re,
                                 double[][] A_im)
Decomposes a complex matrix.

The left and right triangular matrices are stored merged into the original matrix. The diagonal belongs to the right triangular matrix because the diagonal elements of the left triangular matrix are per definition equal to one. For unmerging them see the methods in Unmerge.triangular.

The permutation is stored in an index vector and can be used like this:

(PA)ijA[p[i]][j]

Parameters:
p - An index vector for taking the permutation.
A_re - The real part of the matrix to decompose and afterwards the real parts of the merged left and right triangular matrix.
A_im - The imaginary part of the matrix to decompose and afterwards the imaginary parts of the merged left and right triangular matrix.
Returns:
The determinant of the matrix.
See Also:
Unmerge.triangular

decompose

public static double[] decompose(int[][] P,
                                 double[][] A_re,
                                 double[][] A_im,
                                 double[][] L_re,
                                 double[][] L_im,
                                 double[][] R_re,
                                 double[][] R_im)
Decomposes a complex matrix.

Parameters:
P - A matrix taking the permutation matrix.
A_re - The real part of the matrix to decompose.
A_im - The imaginary part of the matrix to decompose.
L_re - A matrix taking the real part of the left triangular matrix.
L_im - A matrix taking the imaginary part of the left triangular matrix.
R_re - A matrix taking the real part of the right triangular matrix.
R_im - A matrix taking the imaginary part of the right triangular matrix.
Returns:
The determinant of the matrix.
See Also:
Unmerge.triangular