


NORM overloads the norm operator for Analysis Objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION:NORM overloads the norm operator for Analysis Objects.
CALL: 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
VERSION: $Id: norm.m,v 1.8 2007/06/22 08:32:49 ingo Exp $
The following call returns a parameter list object that contains the
default parameter values:
>> pl = norm(ao, 'Params')
HISTORY: 08-05-07 A Monsky
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 function varargout = norm(varargin) 0002 % NORM overloads the norm operator for Analysis Objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION:NORM overloads the norm operator for Analysis Objects. 0007 % 0008 % CALL: b = norm (a,pl) 0009 % b = norm (a) 0010 % 0011 % INPUTS: pl - a parameter list 0012 % a - input analysis object 0013 % 0014 % OUTPUTS: like matlab fct 0015 % 0016 % 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 0017 % options are the same as for the matlab function 0018 % 0019 % VERSION: $Id: norm.m,v 1.8 2007/06/22 08:32:49 ingo Exp $ 0020 % 0021 % The following call returns a parameter list object that contains the 0022 % default parameter values: 0023 % 0024 % >> pl = norm(ao, 'Params') 0025 % 0026 % HISTORY: 08-05-07 A Monsky 0027 % Creation 0028 % 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 %% Check if this is a call for parameters 0032 0033 if nargin == 2 0034 if isa(varargin{1}, 'ao') && ischar(varargin{2}) 0035 in = char(varargin{2}); 0036 if strcmp(in, 'Params') 0037 varargout{1} = getDefaultPL(); 0038 return 0039 end 0040 end 0041 end 0042 0043 % capture input variable names 0044 invars = {}; 0045 0046 ALGONAME = mfilename; 0047 VERSION = '$Id: norm.m,v 1.8 2007/06/22 08:32:49 ingo Exp $'; 0048 0049 as = []; 0050 ps = []; 0051 bs = []; 0052 0053 for j=1:nargin 0054 invars = [invars cellstr(inputname(j))]; 0055 if isa(varargin{j}, 'ao') 0056 as = [as varargin{j}]; 0057 end 0058 if isa(varargin{j}, 'plist') 0059 ps = [ps varargin{j}]; 0060 end 0061 end 0062 0063 %% go through analysis objects 0064 for j=1:nargin 0065 a = varargin{j}; 0066 if isa(a, 'ao') 0067 as = [as a]; 0068 elseif isa(a, 'plist') 0069 ps = [ps a]; 0070 % else 0071 % option = [option a]; 0072 end 0073 0074 end 0075 0076 % check plist 0077 if isempty(ps) 0078 pl = getDefaultPL(); 0079 else 0080 pl = combine(ps, getDefaultPL); 0081 end 0082 0083 0084 % go through analysis objects 0085 for j=1:length(as) 0086 a = as(j); 0087 0088 d = get(a, 'data'); 0089 dinfo = whos('d'); 0090 % Which data type do we have 0091 dtype = dinfo.class; 0092 switch dtype 0093 case 'cdata' 0094 disp('* NORM of cdata object'); 0095 % make a new cdata object 0096 [h, c] = single_operation(d, 'norm',pl); 0097 0098 % make output analysis object 0099 h = set(h, 'invars', [a.hist]); 0100 b = ao(c, h); 0101 b = set(b, 'name', sprintf('norm(%s)', char(invars{1}))); 0102 case {'tsdata','fsdata','xydata'} 0103 error('### this function works for cdata type AO only') 0104 otherwise 0105 error('### unknown data type.') 0106 0107 end 0108 0109 % add to output 0110 bs = [bs b]; 0111 end 0112 varargout{1} = bs; 0113 %% Get default params 0114 function plo = getDefaultPL() 0115 0116 disp('* creating default plist...'); 0117 plo = plist(); 0118 disp('* done.'); 0119 0120 0121 % END