view +time/+expint/Magnus_mp.m @ 507:1341e8580d64 feature/quantumTriangles

Start over with the non-symmetric shrodnger to ceep track of changes.
author Ylva Rydin <ylva.rydin@telia.com>
date Mon, 29 May 2017 14:07:55 +0200
parents 49bc2929dfb1
children 566304a5733e
line wrap: on
line source

% Takes one time step of size k using the magnus midpoinr
% starting from v_0 and where the function F(v,t) gives the
% time derivatives.
function v = Magnus_mp(v,D, t , k)

if isa(D,'function_handle')
   % v = krylov(k*D(t +k/2*t),v);
   v = expm(k*D(t +k/2*t))*v;
else
   %v = krylov(k*D,v);
   v = expm(k*D)*v;
end

end