% Test for ApprFramMult.m in the Gabor case
% see ApprFramMult.m for more information
load colormapsw_xxl; %optimized colormapr for printing
n = 32;
g = gaussnk(n); 
%gamma = hanning(n/2).';
gamma = hamming(n/2);
gamma= [gamma(1:n/4) zeros(1,n/2) gamma((n/4+1):(n/2))];
% Gauss function. Algorithm can be found in NuHAG Gabmin Toolbox
G = gabbasp(g,2,2);
Ga = gabbasp(gamma,2,2);
% Gabor Synthesis Operator (from the right!). 
% Algorithm can be found in NuHAG Gabmin Toolbox
Id = eye(n);
[IA1 coeff1] = ApprFramMult(Id,G.',Ga.');
figure(1);surf(abs(IA1));colormap(cmap);
S = G'*G;
e = eig(S);
disp(sprintf(...  % continued on the next line for printout
    '(g,2,2) : Lower Frame Bound : A = %g Upper Frame Bound: B = %g',...
    min(e),max(e)));
Sa = Ga'*Ga;
e = eig(Sa);
disp(sprintf(...  % continued on the next line for printout
    '(gamma,2,2) : Lower Frame Bound for g : A = %g Upper Frame Bound: B = %g',...
    min(e),max(e)));

G = gabbasp(g,4,4);
Ga = gabbasp(gamma,4,4);
[IA2 coeff2] = ApprFramMult(Id,G.',Ga.');
figure(2);surf(abs(IA2));colormap(cmap);
S = G'*G;
e = eig(S);
disp(sprintf(...
    '(g,4,4) : Lower Frame Bound : A = %g Upper Frame Bound: B = %g',...
    min(e),max(e)));
G = gabbasp(g,4,8);
Ga = gabbasp(gamma,4,8);
[IA3 coeff3] = ApprFramMult(Id,G.',Ga.');
figure(3);surf(abs(IA3));colormap(cmap);
S = G'*G;
e = eig(S);
disp(sprintf(...
    '(g,4,8) : Lower Frame Bound : A = %g Upper Frame Bound: B = %g',...
    min(e),max(e)));
G = gabbasp(g,8,8);
Ga = gabbasp(gamma,8,8);
Id = eye(n);
[IA4 coeff4] = ApprFramMult(Id,G.',Ga.');
figure(4);surf(abs(IA4));colormap(cmap);
S = G'*G;
e = eig(S);
disp(sprintf(...
    '(g,8,8) : Lower Frame Bound : A = %g Upper Frame Bound: B = %g',...
    min(e),max(e)));
G = gabbasp(g,16,16);
Ga = gabbasp(gamma,16,16);
[IA5 coeff5] = ApprFramMult(Id,G.',Ga.');
figure(5);surf(abs(IA5));colormap(cmap);
S = G'*G;
e = eig(S);
disp(sprintf(...
    '(g,16,16) : Lower Frame Bound : A = %g Upper Frame Bound: B = %g'...
    ,min(e),max(e)));
