3535 Base. @nexprs $ N i -> begin
3636 mul! (@view (v[:, i]), L. ops[i], u)
3737 end
38- v
38+ return v
3939 end
4040end
4141
4242# TODO : Implement the three-argument dot function for SciMLOperators.jl
4343# Currently, we are assuming a time-independent MatrixOperator
4444function _ssesolve_update_coeff (u, p, t, op)
45+ normalize! (u)
4546 return real (dot (u, op. A, u)) # this is en/2: <Sn + Sn'>/2 = Re<Sn>
4647end
4748
@@ -104,23 +105,23 @@ _ScalarOperator_e2_2(op, f = +) =
104105Generate the SDEProblem for the Stochastic Schrödinger time evolution of a quantum system. This is defined by the following stochastic differential equation:
105106
106107```math
107- d|\p si(t)\r angle = -i K |\p si(t)\r angle dt + \s um_n M_n |\p si(t)\r angle dW_n(t)
108+ d|\p si(t)\r angle = -i \h at{K} |\p si(t)\r angle dt + \s um_n \h at{M}_n |\p si(t)\r angle dW_n(t)
108109```
109110
110111where
111112
112113```math
113- K = \h at{H} + i \s um_n \l eft(\f rac{e_j} C_n - \f rac{1}{2} \s um_{j} C_n ^\d agger C_n - \f rac{e_j ^2}{8}\r ight),
114+ \h at{K} = \h at{H} + i \s um_n \l eft(\f rac{e_n}{2} \h at{C}_n - \f rac{1}{2} \h at{C}_n ^\d agger \h at{C}_n - \f rac{e_n ^2}{8}\r ight),
114115```
115116```math
116- M_n = C_n - \f rac{e_n}{2},
117+ \h at{M}_n = \h at{C}_n - \f rac{e_n}{2},
117118```
118119and
119120```math
120- e_n = \l angle C_n + C_n ^\d agger \r angle.
121+ e_n = \l angle \h at{C}_n + \h at{C}_n ^\d agger \r angle.
121122```
122123
123- Above, `C_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `C_n `.
124+ Above, `\h at{C}_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `\h at{C}_n `.
124125
125126# Arguments
126127
@@ -193,13 +194,14 @@ function ssesolveProblem(
193194 saveat = is_empty_e_ops ? tlist : [tlist[end ]]
194195 default_values = (DEFAULT_SDE_SOLVER_OPTIONS... , saveat = saveat)
195196 kwargs2 = merge (default_values, kwargs)
196- kwargs3 = _generate_se_me_kwargs (e_ops, makeVal (progress_bar), tlist, kwargs2, SaveFuncSESolve)
197+ kwargs3 = _generate_se_me_kwargs (e_ops, makeVal (progress_bar), tlist, kwargs2, SaveFuncSSESolve)
198+ kwargs4 = _ssesolve_add_normalize_cb (kwargs3)
197199
198200 tspan = (tlist[1 ], tlist[end ])
199201 noise =
200202 RealWienerProcess! (tlist[1 ], zeros (length (sc_ops)), zeros (length (sc_ops)), save_everystep = false , rng = rng)
201203 noise_rate_prototype = similar (ψ0, length (ψ0), length (sc_ops))
202- return SDEProblem {true} (K, D, ψ0, tspan, p; noise_rate_prototype = noise_rate_prototype, noise = noise, kwargs3 ... )
204+ return SDEProblem {true} (K, D, ψ0, tspan, p; noise_rate_prototype = noise_rate_prototype, noise = noise, kwargs4 ... )
203205end
204206
205207@doc raw """
@@ -222,23 +224,23 @@ end
222224Generate the SDE EnsembleProblem for the Stochastic Schrödinger time evolution of a quantum system. This is defined by the following stochastic differential equation:
223225
224226```math
225- d|\p si(t)\r angle = -i K |\p si(t)\r angle dt + \s um_n M_n |\p si(t)\r angle dW_n(t)
227+ d|\p si(t)\r angle = -i \h at{K} |\p si(t)\r angle dt + \s um_n \h at{M}_n |\p si(t)\r angle dW_n(t)
226228```
227229
228230where
229231
230232```math
231- K = \h at{H} + i \s um_n \l eft(\f rac{e_j} C_n - \f rac{1}{2} \s um_{j} C_n ^\d agger C_n - \f rac{e_j ^2}{8}\r ight),
233+ \h at{K} = \h at{H} + i \s um_n \l eft(\f rac{e_n}{2} \h at{C}_n - \f rac{1}{2} \h at{C}_n ^\d agger \h at{C}_n - \f rac{e_n ^2}{8}\r ight),
232234```
233235```math
234- M_n = C_n - \f rac{e_n}{2},
236+ \h at{M}_n = \h at{C}_n - \f rac{e_n}{2},
235237```
236238and
237239```math
238- e_n = \l angle C_n + C_n ^\d agger \r angle.
240+ e_n = \l angle \h at{C}_n + \h at{C}_n ^\d agger \r angle.
239241```
240242
241- Above, `C_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `C_n `.
243+ Above, `\h at{C}_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `\h at{C}_n `.
242244
243245# Arguments
244246
@@ -345,23 +347,23 @@ Stochastic Schrödinger equation evolution of a quantum system given the system
345347The stochastic evolution of the state ``|\p si(t)\r angle`` is defined by:
346348
347349```math
348- d|\p si(t)\r angle = -i K |\p si(t)\r angle dt + \s um_n M_n |\p si(t)\r angle dW_n(t)
350+ d|\p si(t)\r angle = -i \h at{K} |\p si(t)\r angle dt + \s um_n \h at{M}_n |\p si(t)\r angle dW_n(t)
349351```
350352
351353where
352354
353355```math
354- K = \h at{H} + i \s um_n \l eft(\f rac{e_j} C_n - \f rac{1}{2} \s um_{j} C_n ^\d agger C_n - \f rac{e_j ^2}{8}\r ight),
356+ \h at{K} = \h at{H} + i \s um_n \l eft(\f rac{e_n}{2} \h at{C}_n - \f rac{1}{2} \h at{C}_n ^\d agger \h at{C}_n - \f rac{e_n ^2}{8}\r ight),
355357```
356358```math
357- M_n = C_n - \f rac{e_n}{2},
359+ \h at{M}_n = \h at{C}_n - \f rac{e_n}{2},
358360```
359361and
360362```math
361- e_n = \l angle C_n + C_n ^\d agger \r angle.
363+ e_n = \l angle \h at{C}_n + \h at{C}_n ^\d agger \r angle.
362364```
363365
364- Above, `C_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `C_n `.
366+ Above, `\h at{C}_n ` is the `n`-th collapse operator and `dW_j(t)` is the real Wiener increment associated to `\h at{C}_n `.
365367
366368
367369# Arguments
0 commit comments