wathen_matrix, a MATLAB 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 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.
The information on this web page is distributed under the MIT license.
wathen_matrix is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.
cg, a MATLAB code 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.
chebyshev_matrix, a MATLAB code which defines the Chebyshev differentiation matrix, by Lloyd Trefethen.
jordan_matrix, a MATLAB code which returns a random matrix in Jordan canonical form.
levenshtein_matrix, a MATLAB code which returns the Levenshtein distance matrix defined by two strings.
linpack_d, a MATLAB code which factors and solves linear systems using double precision real arithmetic, by Jack Dongarra, Jim Bunch, Cleve Moler, Pete Stewart.
magic_matrix, a MATLAB code which computes a magic matrix, for any odd order n, such that all rows and columns have the same sum.
monopoly_matrix, a MATLAB code which computes the adjacency and transition matrices for the game of Monopoly.
plasma_matrix, a MATLAB code which sets up a matrix associated with a problem in plasma physics.
risk_matrix, a MATLAB code which computes the transition and adjacency matrix for the game of RISK.
snakes_matrix, a MATLAB code which computes the transition matrix for Snakes and Ladders.
sparse_test, a MATLAB code which illustrates the use of MATLAB's sparse matrix utilities;
tennis_matrix, a MATLAB code which computes the transition matrix for a game of tennis, which has 17 distinct states.
test_matrix, a MATLAB code which defines test matrices for which the condition number, determinant, eigenvalues, eigenvectors, inverse, null vectors, P*L*U factorization or linear system solution are known. Examples include the Fibonacci, Hilbert, Redheffer, Vandermonde, Wathen and Wilkinson matrices.
usa_matrix, a MATLAB code which defines the adjacency matrix for US states, using a variety of matrix formats.
web_matrix, a MATLAB code which stores sample matrices describing a web page network. These matrices are typically very sparse, and the examples here are stored using the sparse triplet (ST) format. They can be used to demonstrate pagerank and other graph algorithms.
wishart_matrix, a MATLAB code which produces sample matrices from the Wishart or Bartlett distributions, useful for sampling random covariance matrices.