docs: def inv(a):
      """ Inverse of matrix ``a``.
  
      Args:
          a: Two-dimensional, square matrix/array of numbers
              and/or :class:`gvar.GVar`\s.
  
      Returns:
          The inverse of matrix ``a``.
  
      Raises:
          ValueError: If matrix is not square and two-dimensional.
      """
      amean = gvar.mean(a)
      if amean.ndim != 2 or amean.shape[0] != amean.shape[1]:
          raise ValueError('bad matrix shape: ' + str(a.shape))
      da = a - amean
      ainv = numpy.linalg.inv(amean)
      return ainv - ainv.dot(da.dot(ainv))