lime/oqs.py
def coherent_dm(N, alpha):
    """Density matrix representation of a coherent state.

    Constructed via outer product of :func:`qutip.states.coherent`

    Parameters
    ----------
    N : int
        Number of Fock states in Hilbert space.

    alpha : float/complex
        Eigenvalue for coherent state.

    offset : int (default 0)
        The lowest number state that is included in the finite number state
        representation of the state.

    method : string {'operator', 'analytic'}
        Method for generating coherent density matrix.

    Returns
    -------
    dm : qobj
        Density matrix representation of coherent state.

    Examples
    --------
    >>> coherent_dm(3,0.25j)
    Quantum object: dims = [[3], [3]], \
shape = [3, 3], type = oper, isHerm = True
    Qobj data =
    [[ 0.93941695+0.j          0.00000000-0.23480733j -0.04216943+0.j        ]
     [ 0.00000000+0.23480733j  0.05869011+0.j          0.00000000-0.01054025j]
     [-0.04216943+0.j          0.00000000+0.01054025j  0.00189294+0.j\
        ]]

    Notes
    -----
    Select method 'operator' (default) or 'analytic'. With the
    'operator' method, the coherent density matrix is generated by displacing
    the vacuum state using the displacement operator defined in the
    truncated Hilbert space of size 'N'. This method guarantees that the
    resulting density matrix is normalized. With 'analytic' method the coherent
    density matrix is generated using the analytical formula for the coherent
    state coefficients in the Fock basis. This method does not guarantee that
    the state is normalized if truncated to a small number of Fock states,
    but would in that case give more accurate coefficients.

    """
    #if method == "operator":
    psi = coherent(N, alpha)

    return ket2dm(psi)

    # elif method == "analytic":
    #     psi = coherent(N, alpha, offset=offset, method='analytic')
    #     return psi * psi.dag()

    # else:
    #     raise TypeError(
    #         "The method option can only take values 'operator' or 'analytic'")
Density matrix representation of a coherent state.

    Constructed via outer product of :func:`qutip.states.coherent`

    Parameters
    ----------
    N : int
        Number of Fock states in Hilbert space.

    alpha : float/complex
        Eigenvalue for coherent state.

    offset : int (default 0)
        The lowest number state that is included in the finite number state
        representation of the state.

    method : string {'operator', 'analytic'}
        Method for generating coherent density matrix.

    Returns
    -------
    dm : qobj
        Density matrix representation of coherent state.

    Examples
    --------
    >>> coherent_dm(3,0.25j)
    Quantum object: dims = [[3], [3]], \
shape = [3, 3], type = oper, isHerm = True
    Qobj data =
    [[ 0.93941695+0.j          0.00000000-0.23480733j -0.04216943+0.j        ]
     [ 0.00000000+0.23480733j  0.05869011+0.j          0.00000000-0.01054025j]
     [-0.04216943+0.j          0.00000000+0.01054025j  0.00189294+0.j\
        ]]

    Notes
    -----
    Select method 'operator' (default) or 'analytic'. With the
    'operator' method, the coherent density matrix is generated by displacing
    the vacuum state using the displacement operator defined in the
    truncated Hilbert space of size 'N'. This method guarantees that the
    resulting density matrix is normalized. With 'analytic' method the coherent
    density matrix is generated using the analytical formula for the coherent
    state coefficients in the Fock basis. This method does not guarantee that
    the state is normalized if truncated to a small number of Fock states,
    but would in that case give more accurate coefficients.

    
Density matrix representation of a coherent state.
Constructed via outer product of :func:`qutip.states.coherent`

Parameters

N : int
Number of Fock states in Hilbert space.

alpha : float/complex
Eigenvalue for coherent state.

offset : int (default 0)
The lowest number state that is included in the finite number state
representation of the state.

method : string {'operator', 'analytic'}
Method for generating coherent density matrix.

Returns

dm : qobj
Density matrix representation of coherent state.

Examples



Notes

Select method 'operator' (default) or 'analytic'. With the
'operator' method, the coherent density matrix is generated by displacing
the vacuum state using the displacement operator defined in the
truncated Hilbert space of size 'N'. This method guarantees that the
resulting density matrix is normalized. With 'analytic' method the coherent
density matrix is generated using the analytical formula for the coherent
state coefficients in the Fock basis. This method does not guarantee that
the state is normalized if truncated to a small number of Fock states,
but would in that case give more accurate coefficients.
Density matrix representation of a coherent state . Constructed via outer product of : func : ` qutip . states . coherent ` Parameters N : int Number of Fock states in Hilbert space . alpha : float / complex Eigenvalue for coherent state . offset : int ( default 0 ) The lowest number state that is included in the finite number state representation of the state . method : string { ' operator ' ' analytic ' } Method for generating coherent density matrix . Returns dm : qobj Density matrix representation of coherent state . Examples Notes Select method ' operator ' ( default ) or ' analytic ' . With the ' operator ' method the coherent density matrix is generated by displacing the vacuum state using the displacement operator defined in the truncated Hilbert space of size ' N ' . This method guarantees that the resulting density matrix is normalized . With ' analytic ' method the coherent density matrix is generated using the analytical formula for the coherent state coefficients in the Fock basis . This method does not guarantee that the state is normalized if truncated to a small number of Fock states but would in that case give more accurate coefficients .
def coherent_dm(N, alpha):
    psi = coherent(N, alpha)
    return ket2dm(psi)
def coherent_dm ( N , alpha ) : psi = coherent ( N , alpha ) return ket2dm ( psi )
Density matrix representation of a coherent state.
Density matrix representation of a coherent state .
"""Density matrix representation of a coherent state.

    Constructed via outer product of :func:`qutip.states.coherent`

    Parameters
    ----------
    N : int
        Number of Fock states in Hilbert space.

    alpha : float/complex
        Eigenvalue for coherent state.

    offset : int (default 0)
        The lowest number state that is included in the finite number state
        representation of the state.

    method : string {'operator', 'analytic'}
        Method for generating coherent density matrix.

    Returns
    -------
    dm : qobj
        Density matrix representation of coherent state.

    Examples
    --------
    >>> coherent_dm(3,0.25j)
    Quantum object: dims = [[3], [3]], \
shape = [3, 3], type = oper, isHerm = True
    Qobj data =
    [[ 0.93941695+0.j          0.00000000-0.23480733j -0.04216943+0.j        ]
     [ 0.00000000+0.23480733j  0.05869011+0.j          0.00000000-0.01054025j]
     [-0.04216943+0.j          0.00000000+0.01054025j  0.00189294+0.j\
        ]]

    Notes
    -----
    Select method 'operator' (default) or 'analytic'. With the
    'operator' method, the coherent density matrix is generated by displacing
    the vacuum state using the displacement operator defined in the
    truncated Hilbert space of size 'N'. This method guarantees that the
    resulting density matrix is normalized. With 'analytic' method the coherent
    density matrix is generated using the analytical formula for the coherent
    state coefficients in the Fock basis. This method does not guarantee that
    the state is normalized if truncated to a small number of Fock states,
    but would in that case give more accurate coefficients.

    """ #if method == "operator": # elif method == "analytic": #     psi = coherent(N, alpha, offset=offset, method='analytic') #     return psi * psi.dag() # else: #     raise TypeError( #         "The method option can only take values 'operator' or 'analytic'")
N
alpha