Gowdy solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
BandLUDecomposition Class Reference

BandLUDecomposition implements a method for solving linear equations A * x = b for a band-diagonal matrix A using LU decomposition. More...

#include <bandSol.h>

Collaboration diagram for BandLUDecomposition:

Public Member Functions

 BandLUDecomposition (MatReal_I &A, const Int mm1, const Int mm2)
 The constructor which does the LU decomposition.
MatRealgetL ()
 Gets the lower triangular matrix.
MatRealgetU ()
 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

Detailed Description

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).

Definition at line 33 of file bandSol.h.


Member Function Documentation

Real BandLUDecomposition::det ( ) const [inline]

Returns the determinant of the matrix A.

Definition at line 79 of file bandSol.h.

References d, nn, and U.

    {
        Real dd = d;
        for( Int i = 0; i < nn; ++i ) {
            dd *= U[i][0];
        }
        return dd;
    }

Gets the lower triangular matrix.

Definition at line 58 of file bandSol.h.

References L.

                     {
        return L;
    }

Gets the upper triangular matrix.

Definition at line 64 of file bandSol.h.

References U.

                     {
        return U;
    }
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;
    }

Field Documentation

+/-1 whether the number of row interchanges was even or odd

Definition at line 41 of file bandSol.h.

Referenced by BandLUDecomposition(), and det().

The row permutation index effected by the partial pivoting.

Definition at line 40 of file bandSol.h.

Referenced by BandLUDecomposition(), and solve().

The lower triangular matrix (stored compactly).

Definition at line 38 of file bandSol.h.

Referenced by BandLUDecomposition(), getL(), and solve().

The size of subdiagonal.

Definition at line 36 of file bandSol.h.

Referenced by BandLUDecomposition(), and solve().

The size of superdiagonal.

Definition at line 37 of file bandSol.h.

Referenced by BandLUDecomposition(), and solve().

The full matrix size.

Definition at line 35 of file bandSol.h.

Referenced by BandLUDecomposition(), det(), and solve().

The upper triangular matrix (stored compactly).

Definition at line 39 of file bandSol.h.

Referenced by BandLUDecomposition(), det(), getU(), and solve().


The documentation for this class was generated from the following file: