wathen, a Python code 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 + 1and 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 code 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.
The computer code and data files made available on this web page are distributed under the GNU LGPL license.
wathen is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.
jacobi, a Python code which implements the Jacobi iteration for solving symmetric positive definite (SPD) systems of linear equations.
r8lib, a Python code which contains many utility routines using double precision real (R8) arithmetic.