gallery

Collection of named test matrices.

Category: Mathematics > Elementary Math

Syntax

A = gallery(matname, params)

Builds the test matrix called matname, using the parameters that family needs.

Description

The gallery gathers matrices chosen to stress numerical algorithms: some are ill conditioned ('moler', 'lotkin'), some have a known inverse or eigenvalues ('minij', 'tridiag', 'kms'), some are sparse-friendly ('tridiag', 'jordbloc'). They are used to test solvers and to give examples with known properties.

gallery('tridiag', n) gives the second-difference matrix with 2 on the diagonal and -1 beside it, and gallery('tridiag', n, c, d, e) sets the sub-diagonal, diagonal and super-diagonal values.

Input arguments

matname
Name of the matrix family, such as 'minij', 'tridiag', 'lehmer', 'moler', 'circul' or 'frank'.
params
Size and other parameters of the family. For most families the first one is the order n.

Output arguments

A
The requested matrix.

Example

Two test matrices

gallery('minij', 4)
gallery('tridiag', 4)
Output
ans = 4×4

     1     1     1     1
     1     2     2     2
     1     2     3     3
     1     2     3     4
ans = 4×4

     2    -1     0     0
    -1     2    -1     0
     0    -1     2    -1
     0     0    -1     2

Notes

MatLivre implements the deterministic families only. The families that fill the matrix with random data, such as 'integerdata', 'normaldata' and 'uniformdata', and some others like 'toeppd', report that they are not supported.

See also

hilb magic pascal hankel rosser