0001
0002
0003
0004
0005
0006
0007 clear all;
0008 close all;
0009
0010
0011 L = 32
0012 P = 32
0013 R = 10.0
0014
0015
0016 flmn = zeros(P, L^2);
0017 flmn = rand(size(flmn)) + sqrt(-1)*rand(size(flmn));
0018 flmn = 2.*(flmn - (1+sqrt(-1))./2);
0019
0020
0021 f = flag_synthesis(flmn);
0022 flmn_rec = flag_analysis(f);
0023 flag_default_transform_error = max(max(abs(flmn-flmn_rec)))
0024
0025
0026 f = flag_synthesis(flmn, 'L', L, 'P', P);
0027 flmn_rec = flag_analysis(f, 'L', L, 'P', P);
0028 flag_custom_transform_error = max(max(abs(flmn-flmn_rec)))
0029
0030 nodes = slag_sampling(P, R);
0031
0032 f = flag_synthesis(flmn, 'L', L, 'P', P, 'Nodes', nodes);
0033 flmn_rec = flag_analysis(f, 'L', L, 'P', P, 'R', R);
0034 flag_grid_transform_error = max(max(abs(flmn-flmn_rec)))
0035
0036 nodes = slag_sampling(P, R);
0037
0038 f = flag_synthesis(flmn, 'R', R);
0039 flmn_rec = flag_analysis(f, 'R', R);
0040 flag_bound_transform_error = max(max(abs(flmn-flmn_rec)))
0041
0042
0043 for en = 1:P
0044 for el = 0:L-1
0045 ind = el*el + el + 1;
0046 flmn(en,ind) = real(flmn(en,ind));
0047 for m = 1:el
0048 ind_pm = el*el + el + m + 1;
0049 ind_nm = el*el + el - m + 1;
0050 flmn(en,ind_nm) = (-1)^m * conj(flmn(en,ind_pm));
0051 end
0052 end
0053 end
0054
0055 f = flag_synthesis(flmn, 'L', L, 'P', P, 'reality', true);
0056 flmn_rec = flag_analysis(f, 'L', L, 'P', P, 'reality', true);
0057 flag_real_transform_error = max(max(abs(flmn-flmn_rec)))
0058
0059
0060 fn = rand(1,P);
0061
0062
0063 [f, nodes] = slag_synthesis(fn);
0064 fn_rec = slag_analysis(f);
0065 slag_default_transform_error = max(max(abs(fn-fn_rec)))
0066
0067
0068 [f, nodes] = slag_synthesis(fn, 'P', P, 'R', R);
0069 fn_rec = slag_analysis(f, 'P', P, 'R', R);
0070 slag_custom_transform_error = max(max(abs(fn-fn_rec)))
0071
0072 nodes2 = slag_sampling(P, R);
0073 if (max(abs(nodes-nodes2))) ~= 0
0074 print('Problem with sampling scheme');
0075 end
0076 [f2, nodes] = slag_synthesis(fn, 'P', P, 'Nodes', nodes);
0077 if max(max(abs(f-f2))) ~= 0
0078 print('Problem with transform when nodes is specified');
0079 end
0080