1function test_failed = test_libltfat_dgtreal_long(varargin) 2test_failed = 0; 3 4fprintf(' =============== %s ================ \n',upper(mfilename)); 5 6definput.flags.complexity={'double','single'}; 7[flags]=ltfatarghelper({},definput,varargin); 8dataPtr = [flags.complexity, 'Ptr']; 9 10[~,~,enuminfo]=libltfatprotofile; 11phaseconv = enuminfo.ltfat_phaseconvention; 12 13fftwflags = struct('FFTW_MEASURE',0,'FFTW_ESTIMATE',64,'FFTW_PATIENT',32,'FFTW_DESTROY_INPUT',1,... 14 'FFTW_UNALIGNED',2,'FFTW_EXHAUSTIVE',8,'FFTW_PRESERVE_INPUT',16); 15 16Larr = [350 350 9 1]; 17aarr = [ 10 10 9 1]; 18Marr = [ 35 35 3 1]; 19Warr = [ 1 3 3 1]; 20 21for idx = 1:numel(Larr) 22 L = Larr(idx); 23 W = Warr(idx); 24 a = aarr(idx); 25 M = Marr(idx); 26 M2 = floor(M/2) + 1; 27 28 N = L/a; 29 30 g = randn(L,1,flags.complexity); 31 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 32 cout = complex2interleaved(c); 33 f = randn(L,W,flags.complexity); 34 35 fPtr = libpointer(dataPtr,f); 36 gPtr = libpointer(dataPtr,g); 37 coutPtr = libpointer(dataPtr,cout); 38 39 truec = dgtreal(f,g,a,M); 40 41 funname = makelibraryname('dgtreal_long',flags.complexity,0); 42 status = calllib('libltfat',funname,fPtr,gPtr,L,W,a,M,phaseconv.LTFAT_FREQINV,coutPtr); 43 44 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 45 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 46 fprintf(['DGTREAL FREQINV L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 47 48 truec = dgtreal(f,g,a,M,'timeinv'); 49 status = calllib('libltfat',funname,fPtr,gPtr,L,W,a,M,phaseconv.LTFAT_TIMEINV,coutPtr); 50 51 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 52 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 53 fprintf(['DGTREAL TIMEINV L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 54 55 % With plan 56 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 57 cout = complex2interleaved(c); 58 coutPtr = libpointer(dataPtr,cout); 59 60 plan = libpointer(); 61 funname = makelibraryname('dgtreal_long_init',flags.complexity,0); 62 statusInit = calllib('libltfat',funname,gPtr,L,W,a,M,fPtr,coutPtr,phaseconv.LTFAT_FREQINV,fftwflags.FFTW_MEASURE,plan); 63 64 funname = makelibraryname('dgtreal_long_execute',flags.complexity,0); 65 statusExecute = calllib('libltfat',funname,plan); 66 67 funname = makelibraryname('dgtreal_long_done',flags.complexity,0); 68 statusDone = calllib('libltfat',funname,plan); 69 70 truec = dgtreal(f,g,a,M); 71 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 72 [test_failed,fail]=ltfatdiditfail(res+statusInit,test_failed); 73 fprintf(['DGTREAL FREQINV WP L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 74 75 %%%%%% 76 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 77 cout = complex2interleaved(c); 78 coutPtr = libpointer(dataPtr,cout); 79 80 plan = libpointer(); 81 funname = makelibraryname('dgtreal_long_init',flags.complexity,0); 82 statusInit = calllib('libltfat',funname,gPtr,L,W,a,M,fPtr,coutPtr,phaseconv.LTFAT_TIMEINV,fftwflags.FFTW_MEASURE,plan); 83 84 funname = makelibraryname('dgtreal_long_execute',flags.complexity,0); 85 statusExecute = calllib('libltfat',funname,plan); 86 87 funname = makelibraryname('dgtreal_long_done',flags.complexity,0); 88 statusDone = calllib('libltfat',funname,plan); 89 90 truec = dgtreal(f,g,a,M,'timeinv'); 91 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 92 [test_failed,fail]=ltfatdiditfail(res+statusInit,test_failed); 93 fprintf(['DGTREAL TIMEINV WP L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 94 95 % With plan, new array 96 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 97 cout = complex2interleaved(c); 98 coutPtr = libpointer(dataPtr,cout); 99 100 plan = libpointer(); 101 nullPtr = libpointer(); 102 funname = makelibraryname('dgtreal_long_init',flags.complexity,0); 103 statusInit = calllib('libltfat',funname,gPtr,L,W,a,M,nullPtr,nullPtr,phaseconv.LTFAT_FREQINV,fftwflags.FFTW_ESTIMATE,plan); 104 105 funname = makelibraryname('dgtreal_long_execute_newarray',flags.complexity,0); 106 statusExecute = calllib('libltfat',funname,plan,fPtr,coutPtr); 107 108 funname = makelibraryname('dgtreal_long_done',flags.complexity,0); 109 statusDone = calllib('libltfat',funname,plan); 110 111 truec = dgtreal(f,g,a,M); 112 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 113 [test_failed,fail]=ltfatdiditfail(res+statusInit,test_failed); 114 fprintf(['DGTREAL FREQINV WP NA L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 115 116 %%%%%% 117 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 118 cout = complex2interleaved(c); 119 coutPtr = libpointer(dataPtr,cout); 120 121 plan = libpointer(); 122 funname = makelibraryname('dgtreal_long_init',flags.complexity,0); 123 statusInit = calllib('libltfat',funname,gPtr,L,W,a,M,nullPtr,nullPtr,phaseconv.LTFAT_TIMEINV,fftwflags.FFTW_ESTIMATE,plan); 124 125 funname = makelibraryname('dgtreal_long_execute_newarray',flags.complexity,0); 126 statusExecute = calllib('libltfat',funname,plan,fPtr,coutPtr); 127 128 funname = makelibraryname('dgtreal_long_done',flags.complexity,0); 129 statusDone = calllib('libltfat',funname,plan); 130 131 truec = dgtreal(f,g,a,M,'timeinv'); 132 res = norm(reshape(truec,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 133 [test_failed,fail]=ltfatdiditfail(res+statusInit,test_failed); 134 fprintf(['DGTREAL TIMEINV WP NA L:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 135end 136 137 138 139%-*- texinfo -*- 140%@deftypefn {Function} test_libltfat_dgtreal_long 141%@verbatim 142%@end verbatim 143%@strong{Url}: @url{http://ltfat.github.io/doc/libltfat/modules/libltfat/testing/mUnit/test_libltfat_dgtreal_long.html} 144%@end deftypefn 145 146% Copyright (C) 2005-2016 Peter L. Soendergaard <peter@sonderport.dk>. 147% This file is part of LTFAT version 2.3.1 148% 149% This program is free software: you can redistribute it and/or modify 150% it under the terms of the GNU General Public License as published by 151% the Free Software Foundation, either version 3 of the License, or 152% (at your option) any later version. 153% 154% This program is distributed in the hope that it will be useful, 155% but WITHOUT ANY WARRANTY; without even the implied warranty of 156% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 157% GNU General Public License for more details. 158% 159% You should have received a copy of the GNU General Public License 160% along with this program. If not, see <http://www.gnu.org/licenses/>. 161 162