code: def _vector_close(vec1, vec2, eps=_EPS):
      r
      # NOTE: This relies on ``vec1`` and ``vec2`` being one-dimensional
      #       vectors so NumPy doesn't try to use a matrix norm.
      size1 = np.linalg.norm(vec1, ord=2)
      size2 = np.linalg.norm(vec2, ord=2)
      if size1 == 0:
          return size2 <= eps
  
      elif size2 == 0:
          return size1 <= eps
  
      else:
          upper_bound = eps * min(size1, size2)
          return np.linalg.norm(vec1 - vec2, ord=2) <= upper_bound
docs: r"""Checks that two vectors are equal to some threshold.
  
      Does so by computing :math:`s_1 = \|v_1\|_2` and
      :math:`s_2 = \|v_2\|_2` and then checking if
  
      .. math::
  
         \|v_1 - v_2\|_2 \leq \varepsilon \min(s_1, s_2)
  
      where :math:`\varepsilon = 2^{-40} \approx 10^{-12}` is a fixed
      threshold. In the rare case that one of ``vec1`` or ``vec2`` is
      the zero vector (i.e. when :math:`\min(s_1, s_2) = 0`) instead
      checks that the other vector is close enough to zero:
  
      .. math::
  
         \|v_1\|_2 = 0 \Longrightarrow \|v_2\|_2 \leq \varepsilon
  
      .. note::
  
         This function assumes that both vectors have finite values,
         i.e. that no NaN or infinite numbers occur. NumPy provides
         :func:`np.allclose` for coverage of **all** cases.
  
      .. note::
  
         There is also a Fortran implementation of this function, which
         will be used if it can be built.
  
      Args:
          vec1 (numpy.ndarray): First vector (1D) for comparison.
          vec2 (numpy.ndarray): Second vector (1D) for comparison.
          eps (float): Error threshold. Defaults to :math:`2^{-40}`.
  
      Returns:
          bool: Flag indicating if they are close to precision.