Ejemplo n.º 1
0
 def _rhs(t, rho, L_list):
     # _rhs being a staticmethod enables the propagator to be pickled (for
     # parallelization)
     out = np.zeros(rho.shape[0], dtype=complex)
     L = L_list[0][0]
     L_coeff = L_list[0][1]
     spmvpy_csr(L.data, L.indices, L.indptr, rho, L_coeff, out)
     for n in range(1, len(L_list)):
         L = L_list[n][0]
         L_coeff = L_list[n][1]
         spmvpy_csr(L.data, L.indices, L.indptr, rho, L_coeff, out)
     return out
Ejemplo n.º 2
0
def psi_list_td_with_state(t, psi, H_list_and_args):

    H_list = H_list_and_args[0]
    args = H_list_and_args[1]

    H = H_list[0][0]
    H_td = H_list[0][1]
    out = np.zeros(psi.shape[0], dtype=complex)
    spmvpy_csr(H.data, H.indices, H.indptr, psi, H_td(t, args), out)
    for n in range(1, len(H_list)):
        #
        # args[n][0] = the sparse data for a Qobj in operator form
        # args[n][1] = function callback giving the coefficient
        #
        H = H_list[n][0]
        H_td = H_list[n][1]
        spmvpy_csr(H.data, H.indices, H.indptr, psi, H_td(t, args), out)

    return out
Ejemplo n.º 3
0
def psi_list_td_with_state(t, psi, L_List_and_args):

    L_List = L_List_and_args[0]
    args = L_List_and_args[1]

    L = L_List[0][0]
    tdfunc = L_List[0][1]
    out = np.zeros(psi.shape[0],dtype=complex)
    spmvpy_csr(L.data, L.indices, L.indptr, psi, tdfunc(t, psi, args), out)
    for n in range(1, len(L_List)):
        #
        # args[n][0] = the sparse data for a Qobj in operator form
        # args[n][1] = function callback giving the coefficient
        #
        L = L_List[n][0]
        tdfunc = L_List[n][1]
        spmvpy_csr(L.data, L.indices, L.indptr, psi, tdfunc(t, psi, args), out)

    return out
Ejemplo n.º 4
0
def psi_list_td(t, psi, H_list_and_args):

    H_list = H_list_and_args[0]
    args = H_list_and_args[1]

    H = H_list[0][0]
    H_td = H_list[0][1]
    out = np.zeros(psi.shape[0],dtype=complex)
    spmvpy_csr(H.data, H.indices, H.indptr, psi, H_td(t, args), out)
    for n in range(1, len(H_list)):
        #
        # args[n][0] = the sparse data for a Qobj in operator form
        # args[n][1] = function callback giving the coefficient
        #
        H = H_list[n][0]
        H_td = H_list[n][1]
        spmvpy_csr(H.data, H.indices, H.indptr, psi, H_td(t, args), out)

    return out
Ejemplo n.º 5
0
def drho_list_td(t, rho, L_list, args):
    out = np.zeros(rho.shape[0], dtype=complex)
    L = L_list[0][0]
    L_td = L_list[0][1]
    spmvpy_csr(L.data, L.indices, L.indptr, rho, L_td(t, args), out)
    for n in range(1, len(L_list)):
        #
        # L_args[n][0] = the sparse data for a Qobj in super-operator form
        # L_args[n][1] = function callback giving the coefficient
        #
        L = L_list[n][0]
        L_td = L_list[n][1]
        if L_list[n][2]:
            spmvpy_csr(L.data, L.indices, L.indptr, rho, L_td(t, args)**2, out)
        else:
            spmvpy_csr(L.data, L.indices, L.indptr, rho, L_td(t, args), out)
    return out
Ejemplo n.º 6
0
def drho_list_td(t, rho, L_list, args):
    out = np.zeros(rho.shape[0],dtype=complex)
    L = L_list[0][0]
    L_td = L_list[0][1]
    spmvpy_csr(L.data, L.indices, L.indptr,
                rho, L_td(t, args), out)
    for n in range(1, len(L_list)):
        #
        # L_args[n][0] = the sparse data for a Qobj in super-operator form
        # L_args[n][1] = function callback giving the coefficient
        #
        L = L_list[n][0]
        L_td = L_list[n][1]
        if L_list[n][2]:
            spmvpy_csr(L.data, L.indices, L.indptr,
                        rho, L_td(t, args)**2, out)
        else:
            spmvpy_csr(L.data, L.indices, L.indptr,
                        rho, L_td(t, args), out)
    return out