code: def rrs(ax, b):
      r
  
      nrm = np.linalg.norm(b.ravel())
      if nrm == 0.0:
          return 1.0
      else:
          return np.linalg.norm((ax - b).ravel()) / nrm
docs: r"""
      Compute relative residual :math:`\|\mathbf{b} - A \mathbf{x}\|_2 /
      \|\mathbf{b}\|_2` of the solution to a linear equation :math:`A \mathbf{x}
      = \mathbf{b}`. Returns 1.0 if :math:`\mathbf{b} = 0`.
  
      Parameters
      ----------
      ax : array_like
        Linear component :math:`A \mathbf{x}` of equation
      b : array_like
        Constant component :math:`\mathbf{b}` of equation
  
      Returns
      -------
      x : float
        Relative residual