Mercurial > repos > public > sbplib
changeset 426:29944ea7674b feature/quantumTriangles
Updated the Shrodinger scheme to the new operator syntax
author | Ylva Rydin <ylva.rydin@telia.com> |
---|---|
date | Wed, 25 Jan 2017 17:14:17 +0100 |
parents | 18525f1bb941 |
children | a613960a157b |
files | +scheme/Schrodinger.m |
diffstat | 1 files changed, 14 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
diff -r 18525f1bb941 -r 29944ea7674b +scheme/Schrodinger.m --- a/+scheme/Schrodinger.m Thu Jan 26 13:07:51 2017 +0000 +++ b/+scheme/Schrodinger.m Wed Jan 25 17:14:17 2017 +0100 @@ -23,25 +23,24 @@ % Solving SE in the form u_t = i*u_xx -i*V; function obj = Schrodinger(m,xlim,order,V) default_arg('V',0); - - [x, h] = util.get_grid(xlim{:},m); - - ops = sbp.Ordinary(m,h,order); - - obj.D2 = sparse(ops.derivatives.D2); - obj.H = sparse(ops.norms.H); - obj.Hi = sparse(ops.norms.HI); - obj.M = sparse(ops.norms.M); - obj.e_l = sparse(ops.boundary.e_1); - obj.e_r = sparse(ops.boundary.e_m); - obj.d1_l = sparse(ops.boundary.S_1); - obj.d1_r = sparse(ops.boundary.S_m); + ops = sbp.D2Standard(m,xlim,order); + + obj.x=ops.x; + obj.h=ops.h; + obj.D2 = ops.D2; + obj.H = ops.H; + obj.Hi = ops.HI; + obj.M = ops.M; + obj.e_l = ops.e_l; + obj.e_r = ops.e_r; + obj.d1_l = ops.d1_l; + obj.d1_r = ops.d1_r; if isa(V,'function_handle') - V_vec = V(x); + V_vec = V(obj.x); else - V_vec = x*0 + V; + V_vec = obj.x*0 + V; end V_mat = spdiags(V_vec,0,m,m); @@ -49,10 +48,7 @@ obj.D = 1i * obj.D2 - 1i * V_mat; obj.m = m; - obj.h = h; obj.order = order; - - obj.x = x; end