rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
test_lebesgue.m
Go to the documentation of this file.
1 function OK=test_lebesgue
2 % this is a script showing the ei_detailed construction for a function which
3 % empirically interpolated turns out to have the worst possible Lebesgue
4 % constant `\Lambda = \max_{x} \sum_{m=1}^M |\xi_m(x)| = 2^M - 1`
5 %
6 
7 maxfuncs = 10;
8 
9 model.gridtype = 'rectgrid';
10 model.xrange = [ 0, 1];
11 model.yrange = [ 0, 1];
12 model.xnumintervals = 100;
13 model.ynumintervals = 1;
14 model.verbose = 1;
15 
16 model_data.grid = construct_grid(model);
17 model_data.W = fv_inner_product_matrix(model, model_data);
18 
19 model.linfty_error_sequence_algorithm = @fv_linfty_error;
20 
21 U = zeros(model_data.grid.nelements, maxfuncs);
22 
23 U(1,:) = 1-100000*eps;
24 
25 for i=1:maxfuncs
26  U(1+2*i,i) = 1;
27  U(3+2*i:2:100,i) = -1;
28 end
29 
30 params.ei_Mmax = 3;
31 params.ei_stop_on_Mmax = 3;
32 params.ei_target_error = 'linfty-interpol';
33 params.compute_lebesgue = true;
34 
35 LU = U;
36 save(fullfile(rbmatlabtemp,'LUtmp'), 'LU');
37 
38 LU_fnames = {'LUtmp'};
39 
40 model.get_inner_product_matrix = @(model_data) model_data.W;
41 model.nt = maxfuncs-1;
42 
43 detailed_data = ei_detailed(model, model_data, LU_fnames, params);
44 
45 OK = (detailed_data.ei_info{1}.lebesgue == detailed_data.ei_info{1}.max_lebesgue);
46 
47 end