# MATINV is the jMap module of jLab.

``` MATINV  Fast inversion of arrays of small matrices.

MATINV is a low-level function called by POLYSMOOTH.

Let MAT be an array of K different M x M matrices A1,A2,...,AK.
INV=MATINV(MAT) then returns an array of N inverse matrices.

If MAT has dimensions K1 x K2 x .... M x M, then MATINV returns an
array of the same size containing the inverses of the M x M matrices.

For example, MAT could be 10 x 10 x 4 x 4, in which case the inverses
of one hundred 4 x 4 matrices are found.

MAT can have any dimensionality so long as the matrices to be inverted
occupy the last two dimensions.  The last dimension is interpreted as
"columns" and the second to last as "rows."

Note that MATINV only works matrices with M=2 through M=8.
____________________________________________________________

Algorithms

MATINV can use either of two different algorithms.  This is specified
with INV=MATINV(MAT,STR).

MATINV(MAT,'direct') uses algebraic expressions for 2 x 2 and 3 x 3
matrix inverses together with Boltz's block diagonal recursion formula.
For details, see the following links

http://mathworld.wolfram.com/MatrixInverse.html
http://en.wikipedia.org/wiki/Invertible_matrix.

MATINV(MAT,'loop') uses Matlab's INV function together with a
straightforward loop.

The direct algorithm, which is the default, can be much faster when
MAT is large and the dimension to be inverted is small.
____________________________________________________________