本文整理匯總了Python中qutip.odedata.Odedata.se方法的典型用法代碼示例。如果您正苦於以下問題:Python Odedata.se方法的具體用法?Python Odedata.se怎麽用?Python Odedata.se使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類qutip.odedata.Odedata
的用法示例。
在下文中一共展示了Odedata.se方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: smepdpsolve_generic
# 需要導入模塊: from qutip.odedata import Odedata [as 別名]
# 或者: from qutip.odedata.Odedata import se [as 別名]
def smepdpsolve_generic(ssdata, options, progress_bar):
"""
For internal use.
.. note::
Experimental.
"""
if debug:
print(inspect.stack()[0][3])
N_store = len(ssdata.tlist)
N_substeps = ssdata.nsubsteps
N = N_store * N_substeps
dt = (ssdata.tlist[1] - ssdata.tlist[0]) / N_substeps
NT = ssdata.ntraj
data = Odedata()
data.solver = "smepdpsolve"
data.times = ssdata.tlist
data.expect = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.jump_times = []
data.jump_op_idx = []
# Liouvillian for the deterministic part.
# needs to be modified for TD systems
L = liouvillian_fast(ssdata.H, ssdata.c_ops)
progress_bar.start(ssdata.ntraj)
for n in range(ssdata.ntraj):
progress_bar.update(n)
rho_t = mat2vec(ssdata.rho0.full()).ravel()
states_list, jump_times, jump_op_idx = \
_smepdpsolve_single_trajectory(data, L, dt, ssdata.tlist,
N_store, N_substeps,
rho_t, ssdata.c_ops, ssdata.e_ops)
data.states.append(states_list)
data.jump_times.append(jump_times)
data.jump_op_idx.append(jump_op_idx)
progress_bar.finished()
# average density matrices
if options.average_states and np.any(data.states):
data.states = [sum(state_list).unit() for state_list in data.states]
# average
data.expect = data.expect / ssdata.ntraj
# standard error
if NT > 1:
data.se = (data.ss - NT * (data.expect ** 2)) / (NT * (NT - 1))
else:
data.se = None
return data
示例2: sepdpsolve_generic
# 需要導入模塊: from qutip.odedata import Odedata [as 別名]
# 或者: from qutip.odedata.Odedata import se [as 別名]
def sepdpsolve_generic(ssdata, options, progress_bar):
"""
For internal use.
.. note::
Experimental.
"""
if debug:
print(inspect.stack()[0][3])
N_store = len(ssdata.tlist)
N_substeps = ssdata.nsubsteps
N = N_store * N_substeps
dt = (ssdata.tlist[1] - ssdata.tlist[0]) / N_substeps
NT = ssdata.ntraj
data = Odedata()
data.solver = "sepdpsolve"
data.times = ssdata.tlist
data.expect = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.ss = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.jump_times = []
data.jump_op_idx = []
# effective hamiltonian for deterministic part
Heff = ssdata.H
for c in ssdata.c_ops:
Heff += -0.5j * c.dag() * c
progress_bar.start(ssdata.ntraj)
for n in range(ssdata.ntraj):
progress_bar.update(n)
psi_t = ssdata.psi0.full().ravel()
states_list, jump_times, jump_op_idx = \
_sepdpsolve_single_trajectory(Heff, dt, ssdata.tlist,
N_store, N_substeps,
psi_t, ssdata.c_ops, ssdata.e_ops,
data)
data.states.append(states_list)
data.jump_times.append(jump_times)
data.jump_op_idx.append(jump_op_idx)
progress_bar.finished()
# average density matrices
if options.average_states and np.any(data.states):
data.states = [sum(state_list).unit() for state_list in data.states]
# average
data.expect = data.expect / NT
# standard error
if NT > 1:
data.se = (data.ss - NT * (data.expect ** 2)) / (NT * (NT - 1))
else:
data.se = None
# convert complex data to real if hermitian
data.expect = [np.real(data.expect[n,:]) if e.isherm else data.expect[n,:]
for n, e in enumerate(ssdata.e_ops)]
return data
示例3: smesolve_generic
# 需要導入模塊: from qutip.odedata import Odedata [as 別名]
# 或者: from qutip.odedata.Odedata import se [as 別名]
def smesolve_generic(ssdata, options, progress_bar):
"""
internal
.. note::
Experimental.
"""
if debug:
print(inspect.stack()[0][3])
N_store = len(ssdata.tlist)
N_substeps = ssdata.nsubsteps
N = N_store * N_substeps
dt = (ssdata.tlist[1] - ssdata.tlist[0]) / N_substeps
NT = ssdata.ntraj
data = Odedata()
data.solver = "smesolve"
data.times = ssdata.tlist
data.expect = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.ss = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.noise = []
data.measurement = []
# pre-compute suporoperator operator combinations that are commonly needed
# when evaluating the RHS of stochastic master equations
A_ops = []
for c_idx, c in enumerate(ssdata.sc_ops):
n = c.dag() * c
A_ops.append([spre(c).data, spost(c).data,
spre(c.dag()).data, spost(c.dag()).data,
spre(n).data, spost(n).data,
(spre(c) * spost(c.dag())).data,
lindblad_dissipator(c, data_only=True)])
s_e_ops = [spre(e) for e in ssdata.e_ops]
# Liouvillian for the deterministic part.
# needs to be modified for TD systems
L = liouvillian_fast(ssdata.H, ssdata.c_ops)
progress_bar.start(ssdata.ntraj)
for n in range(ssdata.ntraj):
progress_bar.update(n)
rho_t = mat2vec(ssdata.state0.full()).ravel()
noise = ssdata.noise[n] if ssdata.noise else None
states_list, dW, m = _smesolve_single_trajectory(
L, dt, ssdata.tlist, N_store, N_substeps,
rho_t, A_ops, s_e_ops, data, ssdata.rhs,
ssdata.d1, ssdata.d2, ssdata.d2_len, ssdata.homogeneous,
ssdata.distribution, ssdata.args,
store_measurement=ssdata.store_measurement,
store_states=ssdata.store_states, noise=noise)
data.states.append(states_list)
data.noise.append(dW)
data.measurement.append(m)
progress_bar.finished()
# average density matrices
if options.average_states and np.any(data.states):
data.states = [sum(state_list).unit() for state_list in data.states]
# average
data.expect = data.expect / NT
# standard error
if NT > 1:
data.se = (data.ss - NT * (data.expect ** 2)) / (NT * (NT - 1))
else:
data.se = None
# convert complex data to real if hermitian
data.expect = [np.real(data.expect[n,:]) if e.isherm else data.expect[n,:]
for n, e in enumerate(ssdata.e_ops)]
return data
示例4: ssesolve_generic
# 需要導入模塊: from qutip.odedata import Odedata [as 別名]
# 或者: from qutip.odedata.Odedata import se [as 別名]
def ssesolve_generic(ssdata, options, progress_bar):
"""
internal
.. note::
Experimental.
"""
if debug:
print(inspect.stack()[0][3])
N_store = len(ssdata.tlist)
N_substeps = ssdata.nsubsteps
N = N_store * N_substeps
dt = (ssdata.tlist[1] - ssdata.tlist[0]) / N_substeps
NT = ssdata.ntraj
data = Odedata()
data.solver = "ssesolve"
data.times = ssdata.tlist
data.expect = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.ss = np.zeros((len(ssdata.e_ops), N_store), dtype=complex)
data.noise = []
data.measurement = []
# pre-compute collapse operator combinations that are commonly needed
# when evaluating the RHS of stochastic Schrodinger equations
A_ops = []
for c_idx, c in enumerate(ssdata.sc_ops):
A_ops.append([c.data,
(c + c.dag()).data,
(c - c.dag()).data,
(c.dag() * c).data])
progress_bar.start(ssdata.ntraj)
for n in range(ssdata.ntraj):
progress_bar.update(n)
psi_t = ssdata.state0.full().ravel()
noise = ssdata.noise[n] if ssdata.noise else None
states_list, dW, m = _ssesolve_single_trajectory(
ssdata.H, dt, ssdata.tlist, N_store, N_substeps, psi_t, A_ops,
ssdata.e_ops, data, ssdata.rhs_func, ssdata.d1, ssdata.d2,
ssdata.d2_len, ssdata.homogeneous, ssdata.distribution, ssdata.args,
store_measurement=ssdata.store_measurement, noise=noise)
data.states.append(states_list)
data.noise.append(dW)
data.measurement.append(m)
progress_bar.finished()
# average density matrices
if options.average_states and np.any(data.states):
data.states = [sum(state_list).unit() for state_list in data.states]
# average
data.expect = data.expect / NT
# standard error
if NT > 1:
data.se = (data.ss - NT * (data.expect ** 2)) / (NT * (NT - 1))
else:
data.se = None
# convert complex data to real if hermitian
data.expect = [np.real(data.expect[n,:]) if e.isherm else data.expect[n,:]
for n, e in enumerate(ssdata.e_ops)]
return data