docs: def mse(x, xhat):
      """ Calcualte mse between vector or matrix x and xhat """
      buf_ = x - xhat
      np.square(buf_, out=buf_)  # square in-place
      sum_ = np.sum(buf_)
      sum_ /= x.size  # divide in-place
      return sum_