annotate +time/Magnus4.m @ 516:afff85574ddb feature/quantumTriangles

Changed the penalty on the first derivative penalty terms, did not solve the problem
author Ylva Rydin <ylva.rydin@telia.com>
date Fri, 07 Jul 2017 14:52:47 +0200
parents bc39bb984d88
children
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
513
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
11 matrixexp
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
12 tol
510
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
13 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
14
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
15
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
16 methods
513
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
17 function obj = Magnus4(D, k, t0, v0,matrixexp,tol)
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
18 default_arg('matrixexp','expm')
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
19 default_arg('tol',1e-6)
510
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
20 obj.D = D;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
21 obj.k = k;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
22 obj.t = t0;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
23 obj.v = v0;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
24 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
25 obj.n = 0;
513
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
26 obj.matrixexp = matrixexp;
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
27 obj.tol = tol;
510
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
28 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
29
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
30 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
31 v = obj.v;
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
32 t = obj.t;
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
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
35 function obj = step(obj)
513
bc39bb984d88 Added arnoldi krylov subspace approximation
Ylva Rydin <ylva.rydin@telia.com>
parents: 510
diff changeset
36 obj.v = time.expint.Magnus_4(obj.v,obj.D, obj.t, obj.k, obj.matrixexp, obj.tol);
510
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
37 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
38 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
39 end
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
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 methods (Static)
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
44 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
45 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
46 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
47 end
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
48
71908bbce2e1 tried to add 4th order magnus integrator which does not work
Ylva Rydin <ylva.rydin@telia.com>
parents:
diff changeset
49 end