Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

LA::LU Class Reference

Performs a LU-decomposition of a matrix. More...

#include <LA_Lu_decomp.h>

Collaboration diagram for LA::LU:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LU (const Matrix &M)
 Constructs the LU-decomposition of a the passed matrix.

bool singular () const
 True if the matrix is singular.

double det () const
 Returns the determinant of the matrix.

Vector solve (const Vector &b) const
 Solves the equation Ax=b.

Matrix inverse () const
 Calculates the inverse of the matrix.


Private Member Functions

 LU (const LU &lu)
LUoperator= (const LU &lu)
Vector permute_copy (const Vector &A, const std::vector< int > &piv) const

Private Attributes

Matrix LU_
int m
int n
int pivsign
std::vector< int > piv

Detailed Description

Performs a LU-decomposition of a matrix.

Adapted from Template Numerical Toolkit (TNT) (http://math.nist.gov/tnt/)

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.

Author:
Stefan Uhrig

Definition at line 35 of file LA_Lu_decomp.h.


Constructor & Destructor Documentation

LA::LU::LU const Matrix M  ) 
 

Constructs the LU-decomposition of a the passed matrix.

Parameters:
M Matrix to decompose.

Definition at line 11 of file LA_Lu_decomp.cpp.

References LU_, m, piv, and pivsign.

LA::LU::LU const LU lu  )  [inline, private]
 

Definition at line 45 of file LA_Lu_decomp.h.


Member Function Documentation

LU& LA::LU::operator= const LU lu  )  [inline, private]
 

Definition at line 46 of file LA_Lu_decomp.h.

bool LA::LU::singular  )  const
 

True if the matrix is singular.

Returns:
True if the matrix is singular.

Definition at line 85 of file LA_Lu_decomp.cpp.

References LU_.

Referenced by solve().

double LA::LU::det  )  const
 

Returns the determinant of the matrix.

Returns:
The determinant of the matrix.

Definition at line 95 of file LA_Lu_decomp.cpp.

References LU_, m, and pivsign.

Referenced by LA::Matrix::det().

Vector LA::LU::solve const Vector b  )  const
 

Solves the equation Ax=b.

Parameters:
b A vector.
Returns:
The solution vector x.

Definition at line 106 of file LA_Lu_decomp.cpp.

References LA::Vector::dim(), LU_, m, permute_copy(), piv, and singular().

Referenced by inverse(), and LA::Matrix::solve().

Here is the call graph for this function:

Matrix LA::LU::inverse  )  const
 

Calculates the inverse of the matrix.

Returns:
The inverse of the matrix.

Definition at line 132 of file LA_Lu_decomp.cpp.

References m, LA::Matrix::set_column(), and solve().

Referenced by LA::Matrix::invert().

Here is the call graph for this function:

Vector LA::LU::permute_copy const Vector A,
const std::vector< int > &  piv
const [private]
 

Definition at line 146 of file LA_Lu_decomp.cpp.

References LA::Vector::dim().

Referenced by solve().

Here is the call graph for this function:


Member Data Documentation

Matrix LA::LU::LU_ [private]
 

Definition at line 78 of file LA_Lu_decomp.h.

Referenced by det(), LU(), singular(), and solve().

int LA::LU::m [private]
 

Definition at line 79 of file LA_Lu_decomp.h.

Referenced by det(), inverse(), LU(), and solve().

int LA::LU::n [private]
 

Definition at line 79 of file LA_Lu_decomp.h.

int LA::LU::pivsign [private]
 

Definition at line 80 of file LA_Lu_decomp.h.

Referenced by det(), and LU().

std::vector<int> LA::LU::piv [private]
 

Definition at line 81 of file LA_Lu_decomp.h.

Referenced by LU(), and solve().


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:24:08 2006 for GT2005 by doxygen 1.3.6