Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Quantum Equation Addition : Expmv solver
##################################################
##### #####
##### propexpmsolvers.jl #####
##### #####
##################################################
abstract QuExponential <: QuPropagatorMethod
immutable QuExpokit <: QuExponential
options::Dict{Symbol, Any}
end
QuExpokit() = QuExpokit(Dict())
immutable QuExpV <: QuExponential
options::Dict{Symbol, Any}
end
QuExpmV() = QuExpmV(Dict())
function propagate(prob::QuExpokit, eq::QuantumEquation, t, current_t, current_qustate)
dt = t - current_t
next_state = Expokit.expmv(dt, -im*coeffs(operator(eq)), coeffs(vec(current_qustate)), m = get(prob.options, :m, 30), tol = get(prob.options, :tol, 1e-7))
return QuArray(next_state)
end
function propagate(prob::QuExpmV, eq::QuantumEquation, t, current_t, current_qustate)
dt = t - current_t
next_state = ExpmV.expmv(dt, -im*coeffs(operator(eq)), coeffs(vec(current_qustate)), M = get(prob.options, :M, []), prec = get(prob.options, :prec, "double"),
shift = get(prob.options, :shift, false), full_term = get(prob.options, :full_term, false))
return QuArray(next_state)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment