Mercurial > repos > public > sbplib
changeset 502:2d5dea05456d feature/quantumTriangles
An attempt to add the exponential integrators
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Tue, 16 May 2017 08:57:54 +0200 |
parents | b7280c6c6b9a |
children | feebfca90080 |
files | +time/ExpInt.m |
diffstat | 1 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
diff -r b7280c6c6b9a -r 2d5dea05456d +time/ExpInt.m --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/+time/ExpInt.m Tue May 16 08:57:54 2017 +0200 @@ -0,0 +1,38 @@ +classdef ExpInt < time.Timestepper + properties + F + k + t + v + m + n + end + + + methods + % Timesteps v_t = F(v,t), using RK4 fromt t = t0 with timestep k and initial conditions v = v0 + function obj = ExpInt(F, k, t0, v0) + obj.F = F; + obj.k = k; + obj.t = t0; + obj.v = v0; + obj.m = length(v0); + obj.n = 0; + end + + function [v,t] = getV(obj) + v = obj.v; + t = obj.t; + end + + function obj = step(obj) + [t, res] = exp4(obj.F, [obj.t obj.t+obj.k], obj.v ); + obj.t = t(end); + obj.v = res(end,:)'; + obj.n = obj.n + 1; + end + end + + + +end \ No newline at end of file