![]() |
Gowdy solver
|
BandLUDecomposition implements a method for solving linear equations A * x = b
for a band-diagonal matrix A
using LU decomposition.
More...
#include <bandSol.h>
Public Member Functions | |
BandLUDecomposition (MatReal_I &A, const Int mm1, const Int mm2) | |
The constructor which does the LU decomposition. | |
MatReal & | getL () |
Gets the lower triangular matrix. | |
MatReal & | getU () |
Gets the upper triangular matrix. | |
void | solve (VecReal_I &b, VecReal_O &x) |
Given a right-hand side vector b[0..n-1] , solves the band-diagonal linear equation A * x = b . | |
Real | det () const |
Returns the determinant of the matrix A. | |
Static Public Member Functions | |
static void | sanityCheck () |
Performs a sanity check test with sample data. | |
Static Private Member Functions | |
static void | SWAP (Real &x, Real &y) |
Private Attributes | |
Int | nn |
The full matrix size. | |
Int | m1 |
The size of subdiagonal. | |
Int | m2 |
The size of superdiagonal. | |
MatReal | L |
The lower triangular matrix (stored compactly). | |
MatReal | U |
The upper triangular matrix (stored compactly). | |
VecInt | indx |
The row permutation index effected by the partial pivoting. | |
Real | d |
+/-1 whether the number of row interchanges was even or odd |
BandLUDecomposition implements a method for solving linear equations A * x = b
for a band-diagonal matrix A
using LU decomposition.
A
is band-diagonal with m1
rows below the diagonal and m2
rows above. The input vector is x[0..n-1]
and the output vector is b[0..n-1]
.
The LU factorization refers to the factorization of A
, with proper row and/or column orderings or permutations, into two factors -- a lower triangular matrix L
and an upper triangular matrix U
such that A = L U
.
The array A[0..n-1][0..m1+m2]
stores A
as follows: The diagonal elements are in A[0..n-1][m1]
. Subdiagonal elements are in A[j ..n-1][0..m1-1]
with j > 0
appropriate to the number of elements on each subdiagonal. Superdiagonal elements are in A[0..j ][m1+1..m1+m2]
with j < n-1
appropriate to the number of elements on each superdiagonal.
The implementation is based on the routines bandet1
and bansol1
in Wilkinson, J.H., and Reinsch, C. 1971, Linear Algebra, vol. II of Handbook for Automatic Computation (New York: Springer), Chapter I/6. The C++ code is based on bandec.h
[4], Section 2.4.2 Band-Diagonal Systems (pp. 58--61).
Real BandLUDecomposition::det | ( | ) | const [inline] |
MatReal& BandLUDecomposition::getL | ( | ) | [inline] |
MatReal& BandLUDecomposition::getU | ( | ) | [inline] |
static void BandLUDecomposition::SWAP | ( | Real & | x, |
Real & | y | ||
) | [inline, static, private] |
Definition at line 43 of file bandSol.h.
Referenced by BandLUDecomposition(), and solve().
{ Real temp = x; x = y; y = temp; }
Real BandLUDecomposition::d [private] |
+/-1
whether the number of row interchanges was even or odd
Definition at line 41 of file bandSol.h.
Referenced by BandLUDecomposition(), and det().
VecInt BandLUDecomposition::indx [private] |
The row permutation index effected by the partial pivoting.
Definition at line 40 of file bandSol.h.
Referenced by BandLUDecomposition(), and solve().
MatReal BandLUDecomposition::L [private] |
The lower triangular matrix (stored compactly).
Definition at line 38 of file bandSol.h.
Referenced by BandLUDecomposition(), getL(), and solve().
Int BandLUDecomposition::m1 [private] |
The size of subdiagonal.
Definition at line 36 of file bandSol.h.
Referenced by BandLUDecomposition(), and solve().
Int BandLUDecomposition::m2 [private] |
The size of superdiagonal.
Definition at line 37 of file bandSol.h.
Referenced by BandLUDecomposition(), and solve().
Int BandLUDecomposition::nn [private] |
The full matrix size.
Definition at line 35 of file bandSol.h.
Referenced by BandLUDecomposition(), det(), and solve().
MatReal BandLUDecomposition::U [private] |