mx.nd.linalg.inverse

Description

Compute the inverse of a matrix. Input is a tensor A of dimension n >= 2.

If n=2, A is a square matrix. We compute:

out = A-1

If n>2, inverse is performed separately on the trailing two dimensions for all inputs (batch mode).

Note

The operator supports float32 and float64 data types only.

Example:

Single matrix inverse
A = [[1., 4.], [2., 3.]]
inverse(A) = [[-0.6, 0.8], [0.4, -0.2]]

Batch matrix inverse
A = [[[1., 4.], [2., 3.]],
[[1., 3.], [2., 4.]]]
inverse(A) = [[[-0.6, 0.8], [0.4, -0.2]],
[[-2., 1.5], [1., -0.5]]]

Arguments

Argument

Description

A

NDArray-or-Symbol.

Tensor of square matrix