WATHEN
Assemble, Factor, Solve a Finite Element System
WATHEN
is a MATLAB library which
compares storage schemes (full, banded, sparse triplet, sparse) and
solution strategies (A\x, Linpack, conjugate gradient (CG))
for linear systems involving the Wathen matrix,
which can arise when solving a problem using the
finite element method (FEM).
The Wathen matrix is a typical example of a matrix that arises during
finite element computations. The parameters NX and NY specify how many
elements are to be set up in the X and Y directions. The number of
variables N is then
N = 3 NX NY + 2 NX + 2 NY + 1
and the full linear system will require N * N storage for the matrix.
However, the matrix is sparse, and a banded or sparse storage scheme
can be used to save storage. However, even if storage is saved, a
revised program may eat up too much time because MATLAB's sparse storage
scheme is not efficiently used by inserting nonzero elements one at a time.
Moreover, if banded storage is employed, the user must provide a
suitable fast solver. Simply "translating" a banded solver from another
language will probably not provide an efficient routine.
This library looks at how the complexity of the problem grows with
increasing NX and NY; how the computing time increases; how the
various full, banded and sparse approaches perform.
Licensing:
The computer code and data files made available on this web page
are distributed under
the GNU LGPL license.
Languages:
WATHEN is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
CG,
a MATLAB library which
implements a simple version of the conjugate gradient (CG) method
for solving a system of linear equations of the form A*x=b,
suitable for situations in which the matrix A is positive definite
(only real, positive eigenvalues) and symmetric.
LINPACK_D,
a MATLAB library which
factors and solves linear systems using double precision real arithmetic,
by Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart.
SPARSE,
MATLAB programs which
illustrate the use of MATLAB's sparse matrix utilities;
TEST_MAT,
a MATLAB library which
defines test matrices for which some of the determinant, eigenvalues,
inverse, null vectors, P*L*U factorization or linear system solution
are already known, including the Vandermonde and Wathen matrix.
Reference:

Nicholas Higham,
Algorithm 694:
A Collection of Test Matrices in MATLAB,
ACM Transactions on Mathematical Software,
Volume 17, Number 3, September 1991, pages 289305.

Andrew Wathen,
Realistic eigenvalue bounds for the Galerkin mass matrix,
IMA Journal of Numerical Analysis,
Volume 7, Number 4, October 1987, pages 449457.
Source Code:

bandwidth.m,
returns the lower, diagonal and upper bandwidths of a matrix.

cg_gb.m,
solves A*x=b using the conjugate gradient method, with A
a positive definite symmetric matrix using General Banded (GB) storage.

cg_ge.m,
solves A*x=b using the conjugate gradient method, with A
a positive definite symmetric matrix using general (GE) storage.

cg_sparse.m,
solves A*x=b using the conjugate gradient method, with A
a positive definite symmetric matrix using sparse storage.

cg_st.m,
solves A*x=b using the conjugate gradient method, with A
a positive definite symmetric matrix using sparse triplet (ST) storage.

daxpy.m,
adds a multiple of one vector to another.

dgbfa.m,
factors a banded matrix.

dgbsl.m,
solves a linear system whose matrix has been factored by dgbfa.

idamax.m,
returns the maximum element in an integer vector.

mv_gb.m,
multiplies a banded matrix times a vector.

mv_st.m,
multiplies a sparse triplet matrix times a vector.

r8_uniform_01.m,
returns a unit random R8.

r8mat_uniform_01.m,
returns a unit random R8MAT.

r8vec_print.m,
prints an R8VEC.

r8vec_uniform_01.m,
returns a unit random R8VEC.

st_to_ge.m,
converts a sparse triplet (ST) matrix to general (GE) format.

timestamp.m,
prints the YMDHMS date as a timestamp.

wathen_bandwidth.m,
returns the bandwidth of the Wathen matrix.

wathen_davis.m,
sets up the Wathen matrix using sparse storage,
as recommended by Tim Davis.

wathen_gb.m,
sets up the Wathen matrix using General Banded (GB) storage.

wathen_ge.m,
sets up the Wathen matrix using general (GE) storage.

wathen_order.m,
returns the number of unknowns associated with a given Wathen matrix.

wathen_sparse.m,
sets up the Wathen matrix using sparse storage.

wathen_st.m,
sets up the Wathen matrix using sparse triplet storage.

wathen_st_size.m,
returns the size of the Wathen matrix when using sparse triplet storage.
Examples and Tests:

wathen_test.m, calls all the tests;

wathen_test_output.txt,
the output file.

wathen_test01.m,
sets up and solves a system with wathen_ge();

wathen_test02.m,
sets up and solves a system with wathen_gb();

wathen_test03.m,
sets up and solves a system with wathen_sparse;

wathen_test04.m,
sets up and solves a system with wathen_davis;

wathen_test05.m,
reports the storage needed for the various formats;

wathen_test06.m,
times wathen_ge() for various problem sizes;

wathen_test07.m,
times wathen_banded for various problem sizes.

wathen_test08.m,
compares timings for GB, GE, sparse and davis on small problems;

wathen_test09.m,
compares timings for sparse and davis on larger problems;

wathen_test10.m,
uses wathen_ge() + cg_ge() for an iterative solution;

wathen_test11.m,
uses WATHEN_ST + CG_ST for an iterative solution;

wathen_test115.m,
uses WATHEN_BANDED + CG_BANDED for an iterative solution;

wathen_test12.m,
uses WATHEN_DAVIS + CG_SPARSE for an iterative solution;

wathen_test13.m,
uses spy() to display the sparsity of Wathen matrices
of various sizes;

wathen_spy.png,
spy plots for wathen(1,1) through wathen(6,6).
You can go up one level to
the MATLAB source codes.
Last modified on 05 June 2014