Mercurial > repos > public > sbplib
comparison +time/+expint/Magnus_mp.m~ @ 707:0de70ec8bf60 feature/quantumTriangles
merge with feature/optim
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Fri, 10 Nov 2017 14:22:56 +0100 |
parents | 8434063ed162 |
children |
comparison
equal
deleted
inserted
replaced
696:7c16b5af8d98 | 707:0de70ec8bf60 |
---|---|
2 % starting from v_0 and where the function F(v,t) gives the | 2 % starting from v_0 and where the function F(v,t) gives the |
3 % time derivatives. | 3 % time derivatives. |
4 function v = Magnus_mp(v,D, t , k,matrixexp,tol) | 4 function v = Magnus_mp(v,D, t , k,matrixexp,tol) |
5 | 5 |
6 if isa(D,'function_handle') | 6 if isa(D,'function_handle') |
7 switch matrixexp | 7 Omega = D(t +k/2); |
8 case 'expm' | |
9 v = expm(k*D(t +k/2))*v; | |
10 case 'Arnol' | |
11 v = time.expint.expm_Arnoldi(-D(t +k/2),v,k,toler,100); | |
12 else | 8 else |
13 %v = krylov(k*D,v); | 9 Omega = D; |
14 % v = expm(k*D)*v; | |
15 end | 10 end |
16 | 11 |
12 switch matrixexp | |
13 case 'expm' | |
14 v = expm(k*Omega)*v; | |
15 case 'Arnoldi' | |
16 [v, i] = time.expint.expm_Arnoldi(-Omega,v,k,tol,1000); | |
17 otherwise | |
18 error('No such matrix exponential evaluation') | |
19 | |
17 end | 20 end |
21 end |