annotate +time/Magnus4.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 71908bbce2e1
children bc39bb984d88
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
510
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
1 classdef Magnus4 < time.Timestepper
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
2 properties
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
3 D
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
4 S
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
5 F
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
6 k
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
7 t
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
8 v
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
9 m
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
10 n
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
11 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
12
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
13
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
14 methods
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
15 function obj = Magnus4(D, k, t0, v0)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
16 obj.D = D;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
17 obj.k = k;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
18 obj.t = t0;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
19 obj.v = v0;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
20 obj.m = length(v0);
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
21 obj.n = 0;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
22 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
23
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
24 function [v,t] = getV(obj)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
25 v = obj.v;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
26 t = obj.t;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
27 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
28
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
29 function obj = step(obj)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
30 obj.v = time.expint.Magnus_4(obj.v,obj.D, obj.t, obj.k);
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
31 obj.t = obj.t + obj.k;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
32 obj.n = obj.n + 1;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
33 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
34 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
35
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
36
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
37 methods (Static)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
38 function k = getTimeStep(lambda)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
39 k = rk4.get_rk4_time_step(lambda);
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
40 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
41 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
42
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
43 end