Skip to content

Commit 2b6e0d6

Browse files
authored
Fix of erroneous definition of stochastic term in smesolve (#393)
2 parents 1a2479e + 210a78e commit 2b6e0d6

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)
99

1010
- Rename `sparse_to_dense` as `to_dense` and `dense_to_sparse` as `to_sparse`. ([#392])
11+
- Fix erroneous definition of the stochastic term in `smesolve`. ([#393])
1112

1213
## [v0.26.0]
1314
Release date: 2025-02-09
@@ -118,3 +119,4 @@ Release date: 2024-11-13
118119
[#388]: https://github.com/qutip/QuantumToolbox.jl/issues/388
119120
[#389]: https://github.com/qutip/QuantumToolbox.jl/issues/389
120121
[#392]: https://github.com/qutip/QuantumToolbox.jl/issues/392
122+
[#393]: https://github.com/qutip/QuantumToolbox.jl/issues/393

src/time_evolution/smesolve.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export smesolveProblem, smesolveEnsembleProblem, smesolve
33
_smesolve_generate_state(u, dims) = QuantumObject(vec2mat(u), type = Operator, dims = dims)
44

55
function _smesolve_update_coeff(u, p, t, op_vec)
6-
return real(dot(u, op_vec)) / 2 #this is Tr[Sn * ρ + ρ * Sn']
6+
return 2 * real(dot(op_vec, u)) #this is Tr[Sn * ρ + ρ * Sn']
77
end
88

99
_smesolve_ScalarOperator(op_vec) =
@@ -39,6 +39,7 @@ is the Lindblad superoperator, and
3939
4040
```math
4141
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
42+
```
4243
4344
Above, ``\hat{C}_n`` represent the operators related to pure dissipation, while ``\hat{S}_n`` are the measurement operators. The ``dW_n(t)`` term is the real Wiener increment associated to ``\hat{S}_n``. See [Wiseman2009Quantum](@cite) for more details.
4445
@@ -100,11 +101,12 @@ function smesolveProblem(
100101
K = get_data(L_evo)
101102

102103
Id = I(prod(dims))
104+
Id_op = IdentityOperator(prod(dims)^2)
103105
D_l = map(sc_ops_evo_data) do op
104-
# TODO: Implement the three-argument dot function for SciMLOperators.jl
105-
# Currently, we are assuming a time-independent MatrixOperator
106+
# TODO: # Currently, we are assuming a time-independent MatrixOperator
107+
# Also, the u state may become non-hermitian, so Tr[Sn * ρ + ρ * Sn'] != real(Tr[Sn * ρ]) / 2
106108
op_vec = mat2vec(adjoint(op.A))
107-
return _spre(op, Id) + _spost(op', Id) + _smesolve_ScalarOperator(op_vec) * IdentityOperator(prod(dims)^2)
109+
return _spre(op, Id) + _spost(op', Id) + _smesolve_ScalarOperator(op_vec) * Id_op
108110
end
109111
D = DiffusionOperator(D_l)
110112

@@ -160,6 +162,7 @@ is the Lindblad superoperator, and
160162
161163
```math
162164
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
165+
```
163166
164167
Above, ``\hat{C}_n`` represent the operators related to pure dissipation, while ``\hat{S}_n`` are the measurement operators. The ``dW_n(t)`` term is the real Wiener increment associated to ``\hat{S}_n``. See [Wiseman2009Quantum](@cite) for more details.
165168
@@ -271,6 +274,7 @@ is the Lindblad superoperator, and
271274
272275
```math
273276
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
277+
```
274278
275279
Above, ``\hat{C}_n`` represent the operators related to pure dissipation, while ``\hat{S}_n`` are the measurement operators. The ``dW_n(t)`` term is the real Wiener increment associated to ``\hat{S}_n``. See [Wiseman2009Quantum](@cite) for more details.
276280

test/core-test/time_evolution.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
ntraj = 100,
408408
progress_bar = Val(false),
409409
)
410-
@test allocs_tot < 2710000 # TODO: Fix this high number of allocations
410+
@test allocs_tot < 2750000 # TODO: Fix this high number of allocations
411411

412412
allocs_tot = @allocations smesolve(
413413
H,

0 commit comments

Comments
 (0)