Home > classes > @ao > applyoperator.m

applyoperator

PURPOSE ^

APPLYOPERATOR to the analysis object

SYNOPSIS ^

function res = applyoperator(as, ao_invars, op, opsym, pl, info)

DESCRIPTION ^

 APPLYOPERATOR to the analysis object
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: APPLYOPERATOR to the analysis object
              Private AO function that applies the given operator to
              the given AOs. This is called by all the simple methods like
              plus, minus, mtimes etc.

 CALL:        as = applyoperator(as, ao_invars, op, opsym, pl, info)

 VERSION:     $Id: applyoperator.m,v 1.12 2008/08/25 20:33:22 hewitson Exp $

 HISTORY:     11-06-2008 Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % APPLYOPERATOR to the analysis object
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: APPLYOPERATOR to the analysis object
0005 %              Private AO function that applies the given operator to
0006 %              the given AOs. This is called by all the simple methods like
0007 %              plus, minus, mtimes etc.
0008 %
0009 % CALL:        as = applyoperator(as, ao_invars, op, opsym, pl, info)
0010 %
0011 % VERSION:     $Id: applyoperator.m,v 1.12 2008/08/25 20:33:22 hewitson Exp $
0012 %
0013 % HISTORY:     11-06-2008 Hewitson
0014 %                 Creation
0015 %
0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0017 
0018 function res = applyoperator(as, ao_invars, op, opsym, pl, info)
0019 
0020   %% Initialise the result to the first input object
0021   res = as(1);
0022 
0023   %% go through the remaining analysis objects
0024   for j=2:numel(as)
0025 
0026     % Message
0027     utils.helper.msg(2, 'applying %s to %s and %s', op, res.name, as(j).name);
0028 
0029     % Compute operator of data
0030     res.data = applyoperator(res.data, as(j).data, pl, plist('op', op));
0031     
0032     % append history
0033     res.addHistory(info, pl, [{res.name} ao_invars(j)], [res.hist as(j).hist]);
0034 
0035     % Set new AO name
0036     if  (length(opsym) == 2 && opsym(1) == '.') || ...
0037         (length(opsym) == 1)
0038       res.setName(['(' res.name ')' opsym '(' ao_invars{j} ')'], 'internal');
0039     else
0040       res.setName([opsym '(' res.name ',' ao_invars{j} ')'], 'internal');
0041     end
0042 
0043     % Set units
0044     app_axis = pl.find('axis');
0045     if isempty(app_axis), app_axis = 'Y'; end
0046     if ~isempty(find('X'==app_axis, 1))
0047       res.setXunits(feval(op, res.data.xunits, as(j).data.xunits), 'internal');
0048     end
0049     if ~isempty(find('Y'==app_axis, 1))
0050       res.setYunits(feval(op, res.data.yunits, as(j).data.yunits), 'internal');
0051     end
0052 
0053   end
0054 
0055 end
0056

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003