## Ž Matrix inverse

One-argument form See also two-argument form Matrix division

Produces the inverse of the matrix in the right-hand argument. The right argument must be a simple numeric array. The inverse of a matrix is itself a matrix. It is constructed so that, if matrix-multiplied by the original matrix, it gives the identity matrix, that is the matrix analogue of unity. In matrix algebra, an inverse is usually found only for a square matrix. APL further defines a matrix inverse for a matrix with more rows than columns. In this case the shape of the inverse is the reverse of the shape of the matrix being inverted, and the expression:

                 (ŽY)+.×Y

still gives the identity matrix. The result of the inverse is the left inverse.

                 TABLE
           7  9  8
           3  4  5
           6  2  1
                 6  2 • Ž TABLE
           ¯.11   .12   .23
            .47  ¯.72  ¯.19
           ¯.32   .70   .02

Matrix multiplication is carried out by the inner product operation +.× (see Inner product).

                 (Ž2 2½5 1 0 1)+.×2 2½5 1 0 1
           1 0                           (A matrix multiplied by its inverse gives
           0 1                            the unit matrix)

If the right argument to Ž is a scalar, the result is the reciprocal of the argument.

                 Ž2
           0.5

If the matrix is singular (i.e. does not have an inverse), a DOMAIN ERROR will be reported. Note that matrix inversion is subject to accuracy limitations imposed by the representation of floating-point numbers and the algorithm used to calculate the result. In particular, matrices which are nearly singular may give results of limited accuracy, and small changes to the input can produce very big changes to the output.

Topic: APLX Help : Help on APL language : APL Primitives : Ž Matrix inverse

[ Previous | Next | Contents | Index ]