linear_algebra
Class Triangular

java.lang.Object
  |
  +--linear_algebra.Triangular

public class Triangular
extends java.lang.Object

This class contains:

  1. methods to solve Ly = b and Ux = y where L is a full rank lower triangular matrix and U is a full rank upper triangular matrix.
  2. methods to invert upper and lower triangular full rank matrices.

This class was written by a statistician rather than a numerical analyst. When public domain Java numerical analysis routines become available from numerical analysts (e.g., the people who produce LAPACK), then the code produced by the numerical analysts should be used.

Meanwhile, if you have suggestions for improving this code, please contact Steve Verrill at steve@ws10.fpl.fs.fed.us.


Constructor Summary
Triangular()
           
 
Method Summary
 void invertLower(double[][] l, int n)
          This method obtains the inverse of a lower triangular n by n matrix L.
 void invertUpper(double[][] u, int n)
          This method obtains the inverse of an upper triangular n by n matrix U.
 void solveLower(double[][] l, double[] y, double[] b, int n)
           This method obtains the solution, y, of the equation Ly = b where L is a known full rank lower triangular n by n matrix, and b is a known vector of length n.
 void solveUpper(double[][] u, double[] x, double[] y, int n)
          This method obtains the solution, x, of the equation Ux = y where U is a known full rank upper triangular n by n matrix, and y is a known vector of length n.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Triangular

public Triangular()
Method Detail

solveLower

public void solveLower(double[][] l,
                       double[] y,
                       double[] b,
                       int n)
                throws NotFullRankException

This method obtains the solution, y, of the equation Ly = b where L is a known full rank lower triangular n by n matrix, and b is a known vector of length n.

Parameters:
y - The solution vector.
b - The right hand side of the equation.
n - The order of l, y, and b.
Throws:
NotFullRankException - if one or more of the diagonal elements of l[ ][ ] is zero.

solveUpper

public void solveUpper(double[][] u,
                       double[] x,
                       double[] y,
                       int n)
                throws NotFullRankException
This method obtains the solution, x, of the equation Ux = y where U is a known full rank upper triangular n by n matrix, and y is a known vector of length n.

Parameters:
x - The solution vector.
y - The right hand side of the equation.
n - The order of u, x, and y.
Throws:
NotFullRankException - if one or more of the diagonal elements of u[ ][ ] is zero.

invertLower

public void invertLower(double[][] l,
                        int n)
                 throws NotFullRankException
This method obtains the inverse of a lower triangular n by n matrix L. L must have non-zero diagonal elements. On exit L is replaced by its inverse.

Parameters:
n - The order of l.
Throws:
NotFullRankException - if one or more of the diagonal elements of l[ ][ ] is zero.

invertUpper

public void invertUpper(double[][] u,
                        int n)
                 throws NotFullRankException
This method obtains the inverse of an upper triangular n by n matrix U. U must have non-zero diagonal elements. On exit U is replaced by its inverse.

Parameters:
n - The order of u.
Throws:
NotFullRankException - if one or more of the diagonal elements of u[ ][ ] is zero.