NORM overloads the norm operator for Analysis Objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: NORM overloads the norm operator for Analysis Objects. CALL: b = norm (a,pl) % only with data = cdata 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 see help for data2D/applymethod for additional parameters M-FILE INFO: Get information about this methods by calling >> ao.getInfo('norm') Get information about a specified set-plist by calling: >> ao.getInfo('norm', 'None') VERSION: $Id: norm.m,v 1.22 2008/09/05 11:15:19 ingo Exp $ HISTORY: 08-05-07 A Monsky Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % NORM overloads the norm operator for Analysis Objects. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: NORM overloads the norm operator for Analysis Objects. 0005 % 0006 % CALL: b = norm (a,pl) % only with data = cdata 0007 % b = norm (a) 0008 % 0009 % INPUTS: pl - a parameter list 0010 % a - input analysis object 0011 % 0012 % OUTPUTS: like matlab fct 0013 % 0014 % Parameters: 'option' - a string or value that can be submited i.e. 'inf' for 0015 % the infinity norm of the input ao, the largest row sum 0016 % options are the same as for the matlab function 0017 % 0018 % see help for data2D/applymethod for additional parameters 0019 % 0020 % M-FILE INFO: Get information about this methods by calling 0021 % >> ao.getInfo('norm') 0022 % 0023 % Get information about a specified set-plist by calling: 0024 % >> ao.getInfo('norm', 'None') 0025 % 0026 % VERSION: $Id: norm.m,v 1.22 2008/09/05 11:15:19 ingo Exp $ 0027 % 0028 % HISTORY: 08-05-07 A Monsky 0029 % Creation 0030 % 0031 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0032 0033 function varargout = norm(varargin) 0034 0035 % Check if this is a call for parameters 0036 if utils.helper.isinfocall(varargin{:}) 0037 varargout{1} = getInfo(varargin{3}); 0038 return 0039 end 0040 0041 import utils.const.* 0042 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0043 0044 % Collect input variable names 0045 in_names = cell(size(varargin)); 0046 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0047 0048 % Collect all AOs and plists 0049 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0050 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0051 0052 % Decide on a deep copy or a modify 0053 bs = copy(as, nargout); 0054 0055 % Combine plists 0056 pl = combine(pl, getDefaultPlist); 0057 0058 % go through analysis objects 0059 for j=1:numel(bs) 0060 switch class(bs(j).data) 0061 case 'cdata' 0062 % Apply norm method to data 0063 applymethod(bs(j), ao_invars(j), 'norm', pl, getDefaultPlist, getInfo); 0064 otherwise 0065 error('### this function works for cdata type AO only') 0066 end 0067 end 0068 0069 % Set output 0070 if nargout > 0 0071 varargout{1} = bs; 0072 end 0073 end 0074 0075 %-------------------------------------------------------------------------- 0076 % Get Info Object 0077 %-------------------------------------------------------------------------- 0078 function ii = getInfo(varargin) 0079 if nargin == 1 && strcmpi(varargin{1}, 'None') 0080 sets = {}; 0081 pl = []; 0082 else 0083 sets = {'Default'}; 0084 pl = getDefaultPlist; 0085 end 0086 % Build info object 0087 ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: norm.m,v 1.22 2008/09/05 11:15:19 ingo Exp $', sets, pl); 0088 end 0089 0090 %-------------------------------------------------------------------------- 0091 % Get Default Plist 0092 %-------------------------------------------------------------------------- 0093 function pl = getDefaultPlist() 0094 pl = plist('option', ''); 0095 end 0096 % END