1function test_failed=test_dgt_fb
2%-*- texinfo -*-
3%@deftypefn {Function} test_dgt_fb_alg
4%@verbatim
5%TEST_DGT_FB  Test the filter bank algorithms in DGT
6%
7%  This script runs a throrough test of the DGT routine,
8%  testing it on a range of input parameters.
9%
10%  The script test the filter bank algorithms in DGT, IDGT, GABDUAL and
11%  GABTIGHT by comparing with the full window case.
12%
13%  The computational backend is tested this way, but the
14%  interfaces is not.
15%@end verbatim
16%@strong{Url}: @url{http://ltfat.github.io/doc/testing/test_dgt_fb_alg.html}
17%@end deftypefn
18
19% Copyright (C) 2005-2016 Peter L. Soendergaard <peter@sonderport.dk>.
20% This file is part of LTFAT version 2.3.1
21%
22% This program is free software: you can redistribute it and/or modify
23% it under the terms of the GNU General Public License as published by
24% the Free Software Foundation, either version 3 of the License, or
25% (at your option) any later version.
26%
27% This program is distributed in the hope that it will be useful,
28% but WITHOUT ANY WARRANTY; without even the implied warranty of
29% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30% GNU General Public License for more details.
31%
32% You should have received a copy of the GNU General Public License
33% along with this program.  If not, see <http://www.gnu.org/licenses/>.
34
35Lr  = [24, 35, 35, 24,144,108,144,135,77,77];
36ar  = [ 6,  5,  5,  4,  9,  9, 12,  9, 7, 7];
37Mr  = [ 8,  7,  7,  6, 16, 12, 24,  9,11,11];
38glr = [16, 14, 21, 12, 48, 12, 24, 18,22,11];
39
40test_failed=0;
41
42disp(' ===============  TEST_DGT_FB_ALG ================');
43
44disp('--- Used subroutines ---');
45
46for ii=1:length(Lr);
47
48  L=Lr(ii);
49
50  M=Mr(ii);
51  a=ar(ii);
52  gl=glr(ii);
53
54  b=L/M;
55  N=L/a;
56
57
58  for rtype=1:2
59
60    if rtype==1
61      rname='REAL ';
62      g=tester_rand(gl,1);
63    else
64      rname='CMPLX';
65      g=tester_crand(gl,1);
66    end;
67
68    if rtype==1
69      rname='REAL ';
70      f=tester_rand(L,1);
71    else
72      rname='CMPLX';
73      f=tester_crand(L,1);
74    end;
75
76    cc = dgt(f,fir2long(g,L),a,M);
77
78    cc_ref = ref_dgt_6(f,g,a,M);
79
80    cdiff=cc-cc_ref;
81    res=norm(cdiff(:));
82
83    [test_failed,fail]=ltfatdiditfail(res,test_failed);
84    s=sprintf('REF  %s L:%3i a:%3i M:%3i gl:%3i %0.5g %s',rname,L,a,M,gl,res,fail);
85    disp(s)
86
87  end;
88
89end;
90
91
92
93