QuantumOptics.jl icon indicating copy to clipboard operation
QuantumOptics.jl copied to clipboard

Out-of-place functions in semiclassical solvers

Open apkille opened this issue 6 months ago • 2 comments

According to the docs (https://docs.qojulia.org/semiclassical/), to run a semiclassical solver, say semiclassical.schroedinger_dynamic, one has to define the following functions:

function fquantum_schroedinger(t, ψ, u)
  # update H (Hamiltonian) according to dependencies on
  # classical variables u and quantum state ψ
  return H
end
function fclassical!(du, u, ψ, t)
  # update du (vector of derivatives of classical variables)
  # according to dependencies on classical variables
  # u and quantum state ψ
  # -- no return statement!
end

So we have to define an out-of-place function for the hamiltonian, and an in-place function for classical data. Is there any particular reason why fquantum_schroedinger has to be out-of-place? It is clunky that both functions cannot be in-place and less memory efficient.

apkille avatar Jul 31 '24 02:07 apkille