


torch.dist(A @ Ainv, torch.eye(4))
      tensor(1.1921e-07)



  >>> A = torch.randn(2, 3, 4, 4)  # Batch of matrices
  >>> Ainv = torch.linalg.inv(A)
  >>> torch.dist(A @ Ainv, torch.eye(4))
  tensor(1.9073e-06)

  >>> A = torch.randn(4, 4, dtype=torch.complex128)  # Complex matrix
  >>> Ainv = torch.linalg.inv(A)
  >>> torch.dist(A @ Ainv, torch.eye(4))
  tensor(7.5107e-16, dtype=torch.float64)
