Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://github.com/qutip/QuantumToolbox.jl/tree/main)

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

## [v0.26.0]
Release date: 2025-02-09
Expand Down Expand Up @@ -118,3 +119,4 @@ Release date: 2024-11-13
[#388]: https://github.com/qutip/QuantumToolbox.jl/issues/388
[#389]: https://github.com/qutip/QuantumToolbox.jl/issues/389
[#392]: https://github.com/qutip/QuantumToolbox.jl/issues/392
[#393]: https://github.com/qutip/QuantumToolbox.jl/issues/393
12 changes: 8 additions & 4 deletions src/time_evolution/smesolve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export smesolveProblem, smesolveEnsembleProblem, smesolve
_smesolve_generate_state(u, dims) = QuantumObject(vec2mat(u), type = Operator, dims = dims)

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

_smesolve_ScalarOperator(op_vec) =
Expand Down Expand Up @@ -39,6 +39,7 @@ is the Lindblad superoperator, and

```math
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
```

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.

Expand Down Expand Up @@ -100,11 +101,12 @@ function smesolveProblem(
K = get_data(L_evo)

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

Expand Down Expand Up @@ -160,6 +162,7 @@ is the Lindblad superoperator, and

```math
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
```

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.

Expand Down Expand Up @@ -271,6 +274,7 @@ is the Lindblad superoperator, and

```math
\mathcal{H}[\hat{O}] \rho = \hat{O} \rho + \rho \hat{O}^\dagger - \mathrm{Tr}[\hat{O} \rho + \rho \hat{O}^\dagger] \rho,
```

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.

Expand Down
2 changes: 1 addition & 1 deletion test/core-test/time_evolution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
ntraj = 100,
progress_bar = Val(false),
)
@test allocs_tot < 2710000 # TODO: Fix this high number of allocations
@test allocs_tot < 2750000 # TODO: Fix this high number of allocations

allocs_tot = @allocations smesolve(
H,
Expand Down
Loading