diff +time/+expint/Magnus_mp.m~ @ 513:bc39bb984d88 feature/quantumTriangles

Added arnoldi krylov subspace approximation
author Ylva Rydin <ylva.rydin@telia.com>
date Mon, 26 Jun 2017 20:15:54 +0200
parents
children 8434063ed162
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/+time/+expint/Magnus_mp.m~	Mon Jun 26 20:15:54 2017 +0200
@@ -0,0 +1,17 @@
+% 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,matrixexp,tol)
+
+if isa(D,'function_handle')
+ switch matrixexp
+     case 'expm'
+        v = expm(k*D(t +k/2))*v;
+     case 'Arnol'
+    v = time.expint.expm_Arnoldi(-D(t +k/2),v,k,toler,100);
+else
+   %v = krylov(k*D,v);
+   % v = expm(k*D)*v;
+end
+
+end
\ No newline at end of file