function f = ErrorTest( D, beta )
% ErrorTest tests orthogonality of a sequence or biorthogonality of two sequences.
% 
% Usage:    errortest( D, beta );
%           errortest( Q );
%
% Inputs:
%   D       sequence of vectors 
%   beta    (optional) biorthogonal sequence  
%
% Output:
%   f       orthogonality of D or biorthogonality D w.r.t beta

% See   http://www.ncrg.aston.ac.uk/Projects/HNLApprox/
%       http://www.nonlinear-approx.info/

name='ErrorTest';  
  
if nargin==1   
  % orthogonality
  PP=D'*D;f=norm(eye(size(PP))-PP);
  fprintf('Orthogonality:   %g \n',f);
elseif nargin==2
  % biorthogonality
  PP=beta'*D;f=norm(eye(size(PP))-PP);
  fprintf('Biorthogonality: %g \n',f);
else fprintf('%s: Wrong number of arguments',name);  
end  


%Copyright (C) 2006 Miroslav ANDRLE and Laura REBOLLO-NEIRA
%
%This program is free software; you can redistribute it and/or modify it under the terms 
%of the GNU General Public License as published by the Free Software Foundation; either 
%version 2 of the License, or (at your option) any later version.
%
%This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
%without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%See the GNU General Public License for more details.
%
%You should have received a copy of the GNU General Public License along with this program;
%if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
%Boston, MA  02110-1301, USA.
