% Test the Best Approximation of Matrices by Frame Mulitpliers
% Script-File
%
% This simple script tests the best approximation by frame multipliers
% using a frame multiplier as target system.
%
% The tensor products are forming 'very likely' a Riesz sequence, as they
% form a sequence of M vectors in M^2 dimensions.
% Therefore the best approximation of a frame multiplier is resulting in 
% the same symbol again. (As the coefficients are unique.) Check the Riesz
% sequence property by looking at the condition number of the Gram matrix.
% 
% date: 10/03/2005 - 22/10/2007
%
% Author:  XXL .. Peter Balazs, contact: a8927259@unet.univie.ac.at
%
% Literature : [1] P. Balazs; Gabor frame multipliers with application to
%                  psychoacoustical masking (Ph.D. thesis) 
%              [2] P. Balazs; Hilbert- Schmidt Operators and Frames -
%                  Classification, Best Approximation by Multipliers and 
%                  Algorithms; 
%                  International Journal of Wavelets, Multiresolution and
%                  Information Processing}, to appear, 
%                  http://arxiv.org/abs/math.FA/0611634
%
% see also TestGabMulAppIrr2.m, GMAPPirr.m, testwavelet.m, waveletmat.m
%
% Copyright :  (c) Acoustics Research Institute, Austrian Academy of
%              Science, http://www.kfs.oeaw.ac.at

dim = 3;
M = 5;
Ds = randframe(dim,M);
Da = randframe(dim,M);

sym = randc(5,1);
T = Ds*diag(sym)*(Da'); % frame multiplier

[T_appr sym_appr] = ApprFramMult(T,Da,Ds);

Gram = (Ds'*Ds).*((Da'*Da).');
cG = cond(Gram);
if cG ~= NaN 
    disp(sprintf('The tensor products form a Riesz sequence. (Condition number of Gram matrix: %g)',cG)); 
else
    disp('No Riesz sequence!!!!');
end
disp(sprintf('The difference of the original and approximated symbol in norm is %g.',norm(sym_appr-sym)));
