code: def svd(A, eps_or_k, rand=True):
      """
      Compute SVD of a matrix via an ID.
  
      An SVD of a matrix `A` is a factorization::
  
          A = numpy.dot(U, numpy.dot(numpy.diag(S), V.conj().T))
  
      where `U` and `V` have orthonormal columns and `S` is nonnegative.
  
      The SVD can be computed to any relative precision or rank (depending on the
      value of `eps_or_k`).
  
      See also :func:`interp_decomp` and :func:`id_to_svd`.
  
      ..  This function automatically detects the form of the input parameters and
          passes them to the appropriate backend. For details, see
          :func:`_backend.iddp_svd`, :func:`_backend.iddp_asvd`,
          :func:`_backend.iddp_rsvd`, :func:`_backend.iddr_svd`,
          :func:`_backend.iddr_asvd`, :func:`_backend.iddr_rsvd`,
          :func:`_backend.idzp_svd`, :func:`_backend.idzp_asvd`,
          :func:`_backend.idzp_rsvd`, :func:`_backend.idzr_svd`,
          :func:`_backend.idzr_asvd`, and :func:`_backend.idzr_rsvd`.
  
      Parameters
      ----------
      A : :class:`numpy.ndarray` or :class:`scipy.sparse.linalg.LinearOperator`
          Matrix to be factored, given as either a :class:`numpy.ndarray` or a
          :class:`scipy.sparse.linalg.LinearOperator` with the `matvec` and
          `rmatvec` methods (to apply the matrix and its adjoint).
      eps_or_k : float or int
          Relative error (if `eps_or_k < 1`) or rank (if `eps_or_k >= 1`) of
          approximation.
      rand : bool, optional
          Whether to use random sampling if `A` is of type :class:`numpy.ndarray`
          (randomized algorithms are always used if `A` is of type
          :class:`scipy.sparse.linalg.LinearOperator`).
  
      Returns
      -------
      U : :class:`numpy.ndarray`
          Left singular vectors.
      S : :class:`numpy.ndarray`
          Singular values.
      V : :class:`numpy.ndarray`
          Right singular vectors.
      """
      from scipy.sparse.linalg import LinearOperator
  
      real = _is_real(A)
  
      if isinstance(A, np.ndarray):
          if eps_or_k < 1:
              eps = eps_or_k
              if rand:
                  if real:
                      U, V, S = _backend.iddp_asvd(eps, A)
                  else:
                      if _IS_32BIT:
                          raise _32BIT_ERROR
                      U, V, S = _backend.idzp_asvd(eps, A)
              else:
                  if real:
                      U, V, S = _backend.iddp_svd(eps, A)
                  else:
                      U, V, S = _backend.idzp_svd(eps, A)
          else:
              k = int(eps_or_k)
              if k > min(A.shape):
                  raise ValueError(
                      f"Approximation rank {k} exceeds min(A.shape) = "
                      f" {min(A.shape)} "
                  )
              if rand:
                  if real:
                      U, V, S = _backend.iddr_asvd(A, k)
                  else:
                      if _IS_32BIT:
                          raise _32BIT_ERROR
                      U, V, S = _backend.idzr_asvd(A, k)
              else:
                  if real:
                      U, V, S = _backend.iddr_svd(A, k)
                  else:
                      U, V, S = _backend.idzr_svd(A, k)
      elif isinstance(A, LinearOperator):
          m, n = A.shape
  
          def matvec(x):
              return A.matvec(x)
  
          def matveca(x):
              return A.rmatvec(x)
  
          if eps_or_k < 1:
              eps = eps_or_k
              if real:
                  U, V, S = _backend.iddp_rsvd(
                      eps, m, n, matveca, matvec
                  )
              else:
                  if _IS_32BIT:
                      raise _32BIT_ERROR
                  U, V, S = _backend.idzp_rsvd(
                      eps, m, n, matveca, matvec
                  )
          else:
              k = int(eps_or_k)
              if real:
                  U, V, S = _backend.iddr_rsvd(m, n, matveca, matvec, k)
              else:
                  if _IS_32BIT:
                      raise _32BIT_ERROR
                  U, V, S = _backend.idzr_rsvd(m, n, matveca, matvec, k)
      else:
          raise _TYPE_ERROR
      return U, S, V
  
file_path: scipy/scipy/linalg/interpolative.py
imports: import scipy.linalg._interpolative_backend
  import numpy
  import sys
label_desc: Use image node_id 11 for calling a global function with example usage: svd(A, eps_or_k, rand) and returns: U,  S,  V, A, A