copapy.inv#

copapy.inv(a, pivot=True)#

Inverse of a square matrix (like numpy.linalg.inv).

The inverse is the solution of a x = identity computed by solve: by the array stencil or by the unrolled elimination, selected like in solve. A singular matrix results in inf or nan values. To solve a linear system solve is more accurate and requires fewer operations than a multiplication with the inverse.

Parameters:
  • a (tensor[Any]) – Square matrix (2D tensor)

  • pivot (bool) – Partial pivoting for the unrolled elimination, see solve

Return type:

tensor[float]

Returns:

Inverse of a as tensor