Mercurial > repos > public > sbplib
comparison +time/+expint/Magnus_mp.m @ 505:49bc2929dfb1 feature/quantumTriangles
Added the midpont magnus exponential integrator
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Thu, 18 May 2017 11:44:29 +0200 |
parents | |
children | 566304a5733e |
comparison
equal
deleted
inserted
replaced
504:7fe1782d5224 | 505:49bc2929dfb1 |
---|---|
1 % Takes one time step of size k using the magnus midpoinr | |
2 % starting from v_0 and where the function F(v,t) gives the | |
3 % time derivatives. | |
4 function v = Magnus_mp(v,D, t , k) | |
5 | |
6 if isa(D,'function_handle') | |
7 % v = krylov(k*D(t +k/2*t),v); | |
8 v = expm(k*D(t +k/2*t))*v; | |
9 else | |
10 %v = krylov(k*D,v); | |
11 v = expm(k*D)*v; | |
12 end | |
13 | |
14 end |