[c3bd51]: testing / test_frames.m  Maximize  Restore  History

Download this file

128 lines (96 with data), 3.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
function test_failed=test_frames
%TEST_FRAMES Test the frames methods
test_failed=0;
disp(' =============== TEST_FRAMES ================');
Fr=cell(1,26);
L=200;
Fr{1} = frame('dgt','gauss',10,20);
Fr{2} = frame('dgtreal','gauss',10,20);
Fr{3} = frame('dwilt','gauss',20);
Fr{4} = frame('wmdct','gauss',20);
Fr{5} = frame('gen',crand(200,300),20);
Fr{6} = frametight(frame('dgt','gauss',10,20));
Fr{7} = frametight(frame('dgtreal','gauss',10,20));
Fr{8} = frametight(frame('dwilt','gauss',20));
Fr{9} = frametight(frame('wmdct','gauss',20));
Fr{10} = frametight(frame('gen',crand(200,300),20));
Fr{11} = frame('dft');
Fr{12} = frame('dcti');
Fr{13} = frame('dctii');
Fr{14} = frame('dctiii');
Fr{15} = frame('dctiv');
Fr{16} = frame('dsti');
Fr{17} = frame('dstii');
Fr{18} = frame('dstiii');
Fr{19} = frame('dstiv');
gfilt={randn(30,1),randn(20,1),randn(15,1),randn(10,1)};
Fr{20} = frame('ufilterbank', gfilt,3,4);
Fr{21} = frame('ufilterbankreal',gfilt,3,4);
Fr{22} = frame('dgt','gauss',4,6,'lt',[1 2]);
Fr{23} = frame('identity');
Fr{24} = frame('fusion',[1 1],Fr{1},Fr{1});
%Fr{25} = frame('filterbank', gfilt,[4 3 2 2],4);
%Fr{26} = frame('filterbankreal', gfilt,[4 3 2 2],4);
f=randn(L,1);
for ii=1:numel(Fr)
F=Fr{ii};
if isempty(F)
continue;
end;
Fd=framedual(F);
c=frana(F,f);
r=frsyn(Fd,c);
res=norm(r(1:L)-f);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['FRAMES DUAL REC frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
F2=frameaccel(F,L);
F2d=frameaccel(Fd,L);
c=frana(F2,f);
r=frsyn(F2d,c);
res=norm(r(1:L)-f);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['FRAMES ACCEL DUAL REC frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
% Test that framebounds are able to run, not actual resting is done on
% the values.
[A,B]=framebounds(F,L);
%% Test iterative analysis and synthesis
r=frsyniter(F,c);
res=norm(r(1:L)-f);
[test_failed,fail]=ltfatdiditfail(res,test_failed,1e-6);
s=sprintf(['FRSYNITER frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
c2=franaiter(Fd,f);
res=norm(c2-c);
[test_failed,fail]=ltfatdiditfail(res,test_failed,1e-6);
s=sprintf(['FRANAITER frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
%% Test matrix representations
if (~F.realinput)
LL=framelength(F,L);
G=framematrix(F,LL);
res=norm(c-G'*postpad(f,LL));
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['FRAMES ANA MATRIX frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
res=norm(frsyn(F,c)-G*c);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf(['FRAMES SYN MATRIX frameno:%3i %s %0.5g %s'],ii,F.type,res,fail);
disp(s);
end;
%% Test the frame multipliers: test framemul, framemuladj and
%% framemulinv
if F.realinput
m=1+0.01*rand(size(c,1),1);
else
m=1+1i+0.01*crand(size(c,1),1);
end;
ff=framemul(f,F,Fd,m);
fr=iframemul(ff,F,Fd,m,'tol',1e-13);
res=norm(f-fr(1:L))/norm(f);
[test_failed,fail]=ltfatdiditfail(res,test_failed);
s=sprintf('FRAMEMUL INV frameno:%3i %s %0.5g %s',ii, ...
F.type,res,fail);
disp(s);
end;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks