1function test_failed = test_libltfat_dgtreal2dgt(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 10Larr = [350 350 9 1]; 11glarr = [ 20 10 9 1]; 12aarr = [ 10 10 9 1]; 13Marr = [ 35 35 3 1]; 14Warr = [ 1 3 3 1]; 15 16for idx = 1:numel(Larr) 17 L = Larr(idx); 18 W = Warr(idx); 19 a = aarr(idx); 20 M = Marr(idx); 21 M2 = floor(M/2) + 1; 22 gl = glarr(idx); 23 24 N = L/a; 25 26 g = randn(gl,1,flags.complexity); 27 c = cast(randn(M,N,W)+1i*randn(M,N,W),flags.complexity); 28 cout = complex2interleaved(c); 29 f = randn(L,W,flags.complexity); 30 31 cin = complex2interleaved(dgtreal(f,g,a,M)); 32 truecfull = dgt(f,g,a,M); 33 34 cinPtr = libpointer(dataPtr,cin); 35 coutPtr = libpointer(dataPtr,cout); 36 N = size(truecfull,2); 37 38 funname = makelibraryname('dgtreal2dgt',flags.complexity,1); 39 status = calllib('libltfat',funname, cinPtr, M,N*W, coutPtr); 40 41 res = norm(reshape(truecfull,M,N*W) - interleaved2complex(coutPtr.Value),'fro'); 42 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 43 fprintf(['dgtreal2dgt OP L:%3i, gl:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,gl,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 44 45 cintmp = dgtreal(f,g,a,M); 46 cin = complex2interleaved(postpad(cintmp(:),M*N*W,1)); 47 cinPtr = libpointer(dataPtr,cin); 48 49 funname = makelibraryname('dgtreal2dgt',flags.complexity,1); 50 status = calllib('libltfat',funname, cinPtr, M,N*W, cinPtr); 51 52 res = norm(reshape(truecfull,M,N*W) - reshape(interleaved2complex(cinPtr.Value),M,N*W),'fro'); 53 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 54 fprintf(['dgtreal2dgt IP L:%3i, gl:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,gl,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 55 56 57 %% 58 c = cast(randn(M2,N,W)+1i*randn(M2,N,W),flags.complexity); 59 cout = complex2interleaved(c); 60 61 cin = complex2interleaved(dgt(f,g,a,M)); 62 truecreal = dgtreal(f,g,a,M); 63 64 cinPtr = libpointer(dataPtr,cin); 65 coutPtr = libpointer(dataPtr,cout); 66 N = size(truecreal,2); 67 68 funname = makelibraryname('dgt2dgtreal',flags.complexity,1); 69 status = calllib('libltfat',funname, cinPtr, M,N*W, coutPtr); 70 71 res = norm(reshape(truecreal,M2,N*W) - interleaved2complex(coutPtr.Value),'fro'); 72 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 73 fprintf(['dgt2dgtreal OP L:%3i, gl:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,gl,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 74 75 cintmp = dgt(f,g,a,M); 76 cin = complex2interleaved(cintmp); 77 cinPtr = libpointer(dataPtr,cin); 78 79 funname = makelibraryname('dgt2dgtreal',flags.complexity,1); 80 status = calllib('libltfat',funname, cinPtr, M,N*W, cinPtr); 81 82 cinvalue = interleaved2complex(cinPtr.Value); 83 res = norm(reshape(truecreal,M2,N*W) - reshape(postpad(cinvalue(:),M2*N*W),M2,N*W),'fro'); 84 [test_failed,fail]=ltfatdiditfail(res+status,test_failed); 85 fprintf(['dgtreal2dgt IP L:%3i, gl:%3i, W:%3i, a:%3i, M:%3i %s %s %s\n'],L,gl,W,a,M,flags.complexity,ltfatstatusstring(status),fail); 86 87end 88 89 90 91%-*- texinfo -*- 92%@deftypefn {Function} test_libltfat_dgtreal2dgt 93%@verbatim 94%@end verbatim 95%@strong{Url}: @url{http://ltfat.github.io/doc/libltfat/modules/libltfat/testing/mUnit/test_libltfat_dgtreal2dgt.html} 96%@end deftypefn 97 98% Copyright (C) 2005-2016 Peter L. Soendergaard <peter@sonderport.dk>. 99% This file is part of LTFAT version 2.3.1 100% 101% This program is free software: you can redistribute it and/or modify 102% it under the terms of the GNU General Public License as published by 103% the Free Software Foundation, either version 3 of the License, or 104% (at your option) any later version. 105% 106% This program is distributed in the hope that it will be useful, 107% but WITHOUT ANY WARRANTY; without even the implied warranty of 108% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 109% GNU General Public License for more details. 110% 111% You should have received a copy of the GNU General Public License 112% along with this program. If not, see <http://www.gnu.org/licenses/>. 113 114