comparison diracDiscr.m @ 1246:25efceb0c392 feature/dirac_discr

Apply some nitpicking
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 20 Nov 2019 21:02:06 +0100
parents 0a1c64d3c717
children 60c875c18de3
comparison
equal deleted inserted replaced
1245:0a1c64d3c717 1246:25efceb0c392
1 1 % n-dimensional delta function
2 % g: cartesian grid
3 % x_s: source point coordinate vector, e.g. [x; y] or [x; y; z].
4 % m_order: Number of moment conditions
5 % s_order: Number of smoothness conditions
6 % H: cell array of 1D norm matrices
2 function d = diracDiscr(g, x_s, m_order, s_order, H) 7 function d = diracDiscr(g, x_s, m_order, s_order, H)
3 % n-dimensional delta function
4 % g: cartesian grid
5 % x_s: source point coordinate vector, e.g. [x; y] or [x; y; z].
6 % m_order: Number of moment conditions
7 % s_order: Number of smoothness conditions
8 % H: cell array of 1D norm matrices
9 assertType(g, 'grid.Cartesian'); 8 assertType(g, 'grid.Cartesian');
9
10 dim = g.d; 10 dim = g.d;
11 d_1D = cell(dim,1); 11 d_1D = cell(dim,1);
12 12
13 % Allow for non-cell input in 1D 13 % Allow for non-cell input in 1D
14 if dim == 1 14 if dim == 1
23 for i = dim-1: -1: 1 23 for i = dim-1: -1: 1
24 % Perform outer product, transpose, and then turn into column vector 24 % Perform outer product, transpose, and then turn into column vector
25 d = (d_1D{i}*d')'; 25 d = (d_1D{i}*d')';
26 d = d(:); 26 d = d(:);
27 end 27 end
28
29 end 28 end
30 29
31 30
32 % Helper function for 1D delta functions 31 % Helper function for 1D delta functions
33 function ret = diracDiscr1D(x_s, x, m_order, s_order, H) 32 function ret = diracDiscr1D(x_s, x, m_order, s_order, H)