Skip to content

Instantly share code, notes, and snippets.

@amitjamadagni
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitjamadagni/30a975acd0722dfa6b87 to your computer and use it in GitHub Desktop.
Save amitjamadagni/30a975acd0722dfa6b87 to your computer and use it in GitHub Desktop.
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