Home > src > main > matlab > flag_fulltest.m

flag_fulltest

PURPOSE ^

flag_fulltest - Run all tests

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 flag_fulltest - Run all tests

 FLAG package to perform 3D Fourier-Laguerre Analysis
 Copyright (C) 2012  Boris Leistedt & Jason McEwen
 See LICENSE.txt for license details

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % flag_fulltest - Run all tests
0002 %
0003 % FLAG package to perform 3D Fourier-Laguerre Analysis
0004 % Copyright (C) 2012  Boris Leistedt & Jason McEwen
0005 % See LICENSE.txt for license details
0006 
0007 clear all;
0008 close all;
0009 
0010 % Main parameters
0011 L = 32
0012 P = 32
0013 R = 10.0    
0014 
0015 % Generate random 3D FLAG decomposition
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 % Test exactness for default FLAG transform
0021 f = flag_synthesis(flmn);
0022 flmn_rec = flag_analysis(f);
0023 flag_default_transform_error = max(max(abs(flmn-flmn_rec)))
0024 
0025 % Test exactness for complex FLAG transform
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 % Test exactness for complex FLAG transform on the same grid
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 % Test exactness for complex FLAG transform on the same grid
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 % Impose reality on flms.
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 % Test exactness of real FLAG transform
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 % Generate random 1D SLAG decomposition
0060 fn = rand(1,P);
0061 
0062 % Test exactness of SLAG transform
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 % Test exactness of SLAG transform
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

Generated on Wed 14-Nov-2012 17:56:30 by m2html © 2005