Last active
August 29, 2015 14:23
-
-
Save amitjamadagni/30a975acd0722dfa6b87 to your computer and use it in GitHub Desktop.
Quantum Equation Addition : Expmv solver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################## | |
##### ##### | |
##### 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