qiskit/tools/qi/qi.py
def entropy(state):
    """
    Compute the von-Neumann entropy of a quantum state.

    Args:
        state (array_like): a density matrix or state vector.

    Returns:
        float: The von-Neumann entropy S(rho).
    """

    rho = np.array(state)
    if rho.ndim == 1:
        return 0
    evals = np.maximum(np.linalg.eigvalsh(state), 0.)
    return shannon_entropy(evals, base=np.e)
def entropy(state):
    rho = np.array(state)
    if rho.ndim == 1:
        return 0
    evals = np.maximum(np.linalg.eigvalsh(state), 0.)
    return shannon_entropy(evals, base=np.e)
def entropy ( state ) : rho = np . array ( state ) if rho . ndim == 1 : return 0 evals = np . maximum ( np . linalg . eigvalsh ( state ) , 0. ) return shannon_entropy ( evals , base = np . e )
Compute the von-Neumann entropy of a quantum state.

    Args:
        state (array_like): a density matrix or state vector.

    Returns:
        float: The von-Neumann entropy S(rho).
Compute the von - Neumann entropy of a quantum state .