view +time/+expint/Magnus_mp.m @ 512:4ef2d2a493f1 feature/quantumTriangles

add H_xyz to hypsyst to compute H-norm
author Ylva Rydin <ylva.rydin@telia.com>
date Mon, 26 Jun 2017 19:23:19 +0200
parents 566304a5733e
children bc39bb984d88
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))*v;
      toler = 10^(-5);
   expm_Arnoldi(-D,v,k,toler,100)
else
   %v = krylov(k*D,v);
   % v = expm(k*D)*v;
end

end