Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Attempt at integrating ODE.jl
using QuBase
using ODE
immutable QuODE45 <: QuPropagatorMethod
end
function propagate(prob::QuODE45, op, t, current_t, current_qustate)
next_state = ODE.ode45((t,y)->coeffs(op)*y, coeffs(current_qustate), [current_t, t], points=:specified)[2][2]
return QuArray(next_state)
end
# Example :
t = [0.:0.1:2*pi]
qv = normalize!(QuArray([0.5+0.1im, 0.2+0.2im]))
qode = QuPropagator(sigmax, qv, t, QuODE45())
star_ode = start(qode)
qq = next(qode, star_ode)
println(qq)
((0.1,2-element QuVector in FiniteBasis{Orthonormal}:
...coefficients: Array{Complex{Float64},1}
Complex{Float64}[0.8961408762348902 + 0.2067137046977604im,0.43060586530225986 + 0.3618920416753039im]),QuPropagatorState(2-element QuVector in FiniteBasis{Orthonormal}:
...coefficients: Array{Complex{Float64},1}
Complex{Float64}[0.8961408762348902 + 0.2067137046977604im,0.43060586530225986 + 0.3618920416753039im],0.1,3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment