Home > classes > @ao > norm.m

norm

PURPOSE ^

NORM overloads the norm operator for Analysis Objects.

SYNOPSIS ^

function bs = norm(varargin)

DESCRIPTION ^

 NORM overloads the norm operator for Analysis Objects.
 >>  b = norm (a,pl)
 >>  b = norm (a)
 
 Inputs:
   pl   - a parameter list
   a    - input analysis object
 
 Outputs:
   like matlab fct

 Parameters:
  'option' - a string or value that can be submited  i.e. 'inf' for the infinity norm of the input ao, the largest row sum 
  options are the same as for the matlab function

 A Monsky 08-05-07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function bs = norm(varargin)
0002 % NORM overloads the norm operator for Analysis Objects.
0003 % >>  b = norm (a,pl)
0004 % >>  b = norm (a)
0005 %
0006 % Inputs:
0007 %   pl   - a parameter list
0008 %   a    - input analysis object
0009 %
0010 % Outputs:
0011 %   like matlab fct
0012 %
0013 % Parameters:
0014 %  'option' - a string or value that can be submited  i.e. 'inf' for the infinity norm of the input ao, the largest row sum
0015 %  options are the same as for the matlab function
0016 %
0017 % A Monsky 08-05-07
0018 %
0019 
0020 
0021 % capture input variable names
0022 invars = {};
0023 for j=1:nargin
0024   invars = [invars cellstr(inputname(j))];
0025 end
0026 
0027 ALGONAME = mfilename;
0028 VERSION  = '$Id: norm.html,v 1.1 2007/06/08 14:15:02 hewitson Exp $';
0029 
0030 as = [];
0031 ps = [];
0032 for j=1:nargin
0033     a = varargin{j};
0034     if isa(a, 'ao')
0035         as = [as a];
0036     elseif isa(a, 'plist')
0037         ps = [ps a];
0038 %     else
0039 %         option = [option a];
0040     end
0041     
0042 end
0043 
0044 %handle plist
0045 if ~isempty(ps)
0046     if isa(ps, 'plist')
0047         pl = combine(ps);
0048     end
0049 else
0050     pl = plist();
0051 end
0052 bs = [];
0053 % go through analysis objects
0054 for j=1:length(as)  
0055   a = as(j);
0056 
0057   d = get(a, 'data');
0058   dinfo = whos('d');
0059   % Which data type do we have
0060   dtype = dinfo.class;
0061   switch dtype
0062     case 'cdata'
0063       disp('* NORM of cdata object');
0064       % make a new cdata object
0065       [h, c] = single_operation(d, 'norm',pl);
0066       
0067       % make output analysis object
0068       h = set(h, 'invars', [a.hist]);
0069       b = ao(c, h);      
0070       b = set(b, 'name',  sprintf('norm(%s)', char(invars{1})));
0071     case 'tsdata' & 'fsdata' &  'xydata'
0072      error('### this function works for cdata type AO only')
0073     otherwise
0074      error('### unknown data type.')
0075 
0076   end
0077 
0078   % add to output
0079   bs = [bs b];
0080 end
0081 
0082 
0083 % END

Generated on Fri 08-Jun-2007 16:09:11 by m2html © 2003