Skip to content

Commit

Permalink
Merge branch 'gabconvexopt' of https://github.com/ltfat/ltfat into ga…
Browse files Browse the repository at this point in the history
…bconvexopt
  • Loading branch information
allthatsounds committed Oct 13, 2023
2 parents 3325246 + 26db00c commit 510ae06
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ltfat_automated_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Update submodules
run: git submodule update --init
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v1
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion gabor/gabconvexopt.m
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@
paramPOCS.tol=20*eps;
paramPOCS.maxit=5000;
paramPOCS.verbose=flags.do_print+flags.do_debug;
paramPOCS.abs_tol=1;
%paramPOCS.abs_tol=1;
g5.prox = @(x,T) pocs(x,G,paramPOCS);
% g5.prox = @(x,T) ppxa(x,G,paramPOCS);
% g5.prox = @(x,T) douglas_rachford(x,g2,g4,paramPOCS);
Expand Down
3 changes: 0 additions & 3 deletions testing/test_gabfirdual.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

disp('--- Used subroutines ---');

warning('off','all');

addpath([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']);
if exist('init_unlocbox.m', 'file')
init_unlocbox;
Expand Down Expand Up @@ -119,6 +117,5 @@

end;

warning('on','all');
close_unlocbox;
rmpath(([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']));
2 changes: 0 additions & 2 deletions testing/test_gabfirtight.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

disp('--- Used subroutines ---');

warning('off','all');

addpath([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']);
if exist('init_unlocbox.m', 'file')
Expand Down Expand Up @@ -94,6 +93,5 @@

end;

warning('on','all');
close_unlocbox;
rmpath(([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']));
127 changes: 127 additions & 0 deletions testing/test_gaboptdual.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
function test_failed=test_gaboptdual
%TEST_GABFIRDUAL Test GABOPTDUAL


Lr=[24,16,144,144];
ar=[ 4, 4, 8, 12];
Mr=[ 12, 16, 72, 48];

test_failed=0;
tolerance=1e-5;

disp(' =============== TEST_GABOPTDUAL ================');

disp('--- Used subroutines ---');

addpath([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']);
if exist('init_unlocbox.m', 'file')
init_unlocbox;
else
disp('unlocbox not found. please initialize git submodule via git submodule update --init.')
end

for ii=1:length(Lr);

L=Lr(ii);

M=Mr(ii);
a=ar(ii);
b=L/M;
N=L/a;
c=gcd(a,M);
d=gcd(b,N);
p=a/c;
q=M/c;


for rtype=1:2

if rtype==1
rname='REAL ';
g=tester_rand(L,1);
else
rname='CMPLX';
g=tester_crand(L,1);
end;

global LTFAT_TEST_TYPE;
if strcmpi(LTFAT_TEST_TYPE,'single')
C = gabframebounds(g,a,M);
while C>1e3
% warning(sprintf(['The frame is too badly conditioned '...
% 'for single precision. Cond. num. %d. '...
% ' Trying again.'],C));

if rtype==1
rname='REAL ';
g=tester_rand(L,1);
else
rname='CMPLX';
g=tester_crand(L,1);
end;
C = gabframebounds(g,a,M);
end
end


gd=gaboptdual(g,a,M);

for W=1:3

if rtype==1
f=tester_rand(L,W);
else
f=tester_crand(L,W);
end;

%--- Test if the window is indeed a dual window-------------

[~,o2]=gabdualnorm(g,gd,a,M);
[test_failed,fail]=ltfatdiditfail(o2,test_failed);
s=sprintf(['DUAL %s L:%3i W:%2i a:%3i b:%3i c:%3i d:%3i p:%3i q:%3i ' ...
'%0.5g %s'],rname,L,W,a,b,c,d,p,q,o2,fail);
disp(s)

% --- Test reconstruction of IDGT using the dual window. ---
cc=dgt(f,g,a,M);
r=idgt(cc,gd,a);
res=norm(f-r,'fro');
[test_failed,fail]=ltfatdiditfail(res,test_failed, tolerance);
s=sprintf(['REC %s L:%3i W:%2i a:%3i b:%3i c:%3i d:%3i p:%3i q:%3i ' ...
'%0.5g %s'],rname,L,W,a,b,c,d,p,q,res,fail);
disp(s)


% Test the real valued transform
if rtype==1

% --- Reference test ---
ccreal=dgtreal(f,g,a,M);
M2=floor(M/2)+1;

cdiff=cc(1:M2,:,:)-ccreal;
res=norm(cdiff(:));
[test_failed,fail]=ltfatdiditfail(res,test_failed, tolerance);
s=sprintf(['REFREAL L:%3i W:%2i a:%3i b:%3i c:%3i d:%3i p:%3i ' ...
'q:%3i %0.5g %s'],L,W,a,b,c,d,p,q,res,fail);
disp(s);

% --- Reconstruction test ---

rreal=idgtreal(ccreal,real(gd),a,M);

res=norm(f-rreal,'fro');
[test_failed,fail]=ltfatdiditfail(res,test_failed, tolerance);
s=sprintf(['RECREAL L:%3i W:%2i a:%3i b:%3i c:%3i d:%3i p:%3i ' ...
'q:%3i %0.5g %s'],L,W,a,b,c,d,p,q,res,fail);
disp(s)

end;
end;

end;

end;

close_unlocbox;
rmpath(([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']));

0 comments on commit 510ae06

Please sign in to comment.