diff --git a/.github/workflows/ltfat_automated_test.yml b/.github/workflows/ltfat_automated_test.yml index a93c93d2..4cbb4072 100644 --- a/.github/workflows/ltfat_automated_test.yml +++ b/.github/workflows/ltfat_automated_test.yml @@ -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 diff --git a/gabor/gabconvexopt.m b/gabor/gabconvexopt.m index fe75a0c0..9b0e43bb 100644 --- a/gabor/gabconvexopt.m +++ b/gabor/gabconvexopt.m @@ -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); diff --git a/testing/test_gabfirdual.m b/testing/test_gabfirdual.m index 6fefa8f0..a1770315 100644 --- a/testing/test_gabfirdual.m +++ b/testing/test_gabfirdual.m @@ -13,8 +13,6 @@ disp('--- Used subroutines ---'); -warning('off','all'); - addpath([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']); if exist('init_unlocbox.m', 'file') init_unlocbox; @@ -119,6 +117,5 @@ end; -warning('on','all'); close_unlocbox; rmpath(([ltfatbasepath, 'thirdparty', filesep, 'unlocbox'])); diff --git a/testing/test_gabfirtight.m b/testing/test_gabfirtight.m index 3f69016c..0273d2c3 100644 --- a/testing/test_gabfirtight.m +++ b/testing/test_gabfirtight.m @@ -13,7 +13,6 @@ disp('--- Used subroutines ---'); -warning('off','all'); addpath([ltfatbasepath, 'thirdparty', filesep, 'unlocbox']); if exist('init_unlocbox.m', 'file') @@ -94,6 +93,5 @@ end; -warning('on','all'); close_unlocbox; rmpath(([ltfatbasepath, 'thirdparty', filesep, 'unlocbox'])); diff --git a/testing/test_gaboptdual.m b/testing/test_gaboptdual.m new file mode 100644 index 00000000..7bb2d408 --- /dev/null +++ b/testing/test_gaboptdual.m @@ -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'])); \ No newline at end of file