def svd(A, eps_or_k, rand=True):
    '\n    Compute SVD of a matrix via an ID.\n\n    An SVD of a matrix `A` is a factorization::\n\n        A = numpy.dot(U, numpy.dot(numpy.diag(S), V.conj().T))\n\n    where `U` and `V` have orthonormal columns and `S` is nonnegative.\n\n    The SVD can be computed to any relative precision or rank (depending on the\n    value of `eps_or_k`).\n\n    See also :func:`interp_decomp` and :func:`id_to_svd`.\n\n    ..  This function automatically detects the form of the input parameters and\n        passes them to the appropriate backend. For details, see\n        :func:`_backend.iddp_svd`, :func:`_backend.iddp_asvd`,\n        :func:`_backend.iddp_rsvd`, :func:`_backend.iddr_svd`,\n        :func:`_backend.iddr_asvd`, :func:`_backend.iddr_rsvd`,\n        :func:`_backend.idzp_svd`, :func:`_backend.idzp_asvd`,\n        :func:`_backend.idzp_rsvd`, :func:`_backend.idzr_svd`,\n        :func:`_backend.idzr_asvd`, and :func:`_backend.idzr_rsvd`.\n\n    Parameters\n    ----------\n    A : :class:`numpy.ndarray` or :class:`scipy.sparse.linalg.LinearOperator`\n        Matrix to be factored, given as either a :class:`numpy.ndarray` or a\n        :class:`scipy.sparse.linalg.LinearOperator` with the `matvec` and\n        `rmatvec` methods (to apply the matrix and its adjoint).\n    eps_or_k : float or int\n        Relative error (if `eps_or_k < 1`) or rank (if `eps_or_k >= 1`) of\n        approximation.\n    rand : bool, optional\n        Whether to use random sampling if `A` is of type :class:`numpy.ndarray`\n        (randomized algorithms are always used if `A` is of type\n        :class:`scipy.sparse.linalg.LinearOperator`).\n\n    Returns\n    -------\n    U : :class:`numpy.ndarray`\n        Left singular vectors.\n    S : :class:`numpy.ndarray`\n        Singular values.\n    V : :class:`numpy.ndarray`\n        Right singular vectors.\n    '
    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)
            elif 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(('Approximation rank %s exceeds min(A.shape) =  %s ' % (k, 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)
            elif 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
        matvec = (lambda x: A.matvec(x))
        matveca = (lambda x: 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)
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.
def svd(A, eps_or_k, rand=True):
    '\n    Compute SVD of a matrix via an ID.\n\n    An SVD of a matrix `A` is a factorization::\n\n        A = numpy.dot(U, numpy.dot(numpy.diag(S), V.conj().T))\n\n    where `U` and `V` have orthonormal columns and `S` is nonnegative.\n\n    The SVD can be computed to any relative precision or rank (depending on the\n    value of `eps_or_k`).\n\n    See also :func:`interp_decomp` and :func:`id_to_svd`.\n\n    ..  This function automatically detects the form of the input parameters and\n        passes them to the appropriate backend. For details, see\n        :func:`_backend.iddp_svd`, :func:`_backend.iddp_asvd`,\n        :func:`_backend.iddp_rsvd`, :func:`_backend.iddr_svd`,\n        :func:`_backend.iddr_asvd`, :func:`_backend.iddr_rsvd`,\n        :func:`_backend.idzp_svd`, :func:`_backend.idzp_asvd`,\n        :func:`_backend.idzp_rsvd`, :func:`_backend.idzr_svd`,\n        :func:`_backend.idzr_asvd`, and :func:`_backend.idzr_rsvd`.\n\n    Parameters\n    ----------\n    A : :class:`numpy.ndarray` or :class:`scipy.sparse.linalg.LinearOperator`\n        Matrix to be factored, given as either a :class:`numpy.ndarray` or a\n        :class:`scipy.sparse.linalg.LinearOperator` with the `matvec` and\n        `rmatvec` methods (to apply the matrix and its adjoint).\n    eps_or_k : float or int\n        Relative error (if `eps_or_k < 1`) or rank (if `eps_or_k >= 1`) of\n        approximation.\n    rand : bool, optional\n        Whether to use random sampling if `A` is of type :class:`numpy.ndarray`\n        (randomized algorithms are always used if `A` is of type\n        :class:`scipy.sparse.linalg.LinearOperator`).\n\n    Returns\n    -------\n    U : :class:`numpy.ndarray`\n        Left singular vectors.\n    S : :class:`numpy.ndarray`\n        Singular values.\n    V : :class:`numpy.ndarray`\n        Right singular vectors.\n    '
    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)
            elif 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(('Approximation rank %s exceeds min(A.shape) =  %s ' % (k, 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)
            elif 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
        matvec = (lambda x: A.matvec(x))
        matveca = (lambda x: 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)