Home > classes > @ao > sqrt.m

sqrt

PURPOSE ^

SQRT computes the square root of the data in the AO.

SYNOPSIS ^

function varargout = sqrt(varargin)

DESCRIPTION ^

 SQRT computes the square root of the data in the AO.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: SQRT computes the square root of the data in the AO.

 CALL:        ao_out = sqrt(ao_in);
              ao_out = sqrt(ao_in, pl);

 PARAMETERS:  see help for data2D/applymethod for additional parameters

 M-FILE INFO: Get information about this methods by calling
              >> ao.getInfo('sqrt')

              Get information about a specified set-plist by calling:
              >> ao.getInfo('sqrt', 'None')

 VERSION:     $Id: sqrt.m,v 1.24 2008/09/05 11:15:19 ingo Exp $

 HISTORY:     12-03-07 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % SQRT computes the square root of the data in the AO.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: SQRT computes the square root of the data in the AO.
0005 %
0006 % CALL:        ao_out = sqrt(ao_in);
0007 %              ao_out = sqrt(ao_in, pl);
0008 %
0009 % PARAMETERS:  see help for data2D/applymethod for additional parameters
0010 %
0011 % M-FILE INFO: Get information about this methods by calling
0012 %              >> ao.getInfo('sqrt')
0013 %
0014 %              Get information about a specified set-plist by calling:
0015 %              >> ao.getInfo('sqrt', 'None')
0016 %
0017 % VERSION:     $Id: sqrt.m,v 1.24 2008/09/05 11:15:19 ingo Exp $
0018 %
0019 % HISTORY:     12-03-07 M Hewitson
0020 %                 Creation
0021 %
0022 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0023 
0024 function varargout = sqrt(varargin)
0025 
0026   import utils.const.*
0027 
0028   % Check if this is a call for parameters
0029   if utils.helper.isinfocall(varargin{:})
0030     varargout{1} = getInfo(varargin{3});
0031     return
0032   end
0033 
0034   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0035 
0036   % Collect input variable names
0037   in_names = cell(size(varargin));
0038   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0039 
0040   % Collect all AOs
0041   [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0042   pl              = utils.helper.collect_objects(varargin(:), 'plist', in_names);
0043 
0044   % Get default parameters
0045   pl = combine(pl, getDefaultPlist);
0046   
0047   % Decide on a deep copy or a modify
0048   bs = copy(as, nargout);
0049 
0050   % Apply method to all AOs
0051   applymethod(bs, ao_invars, 'sqrt', pl, getDefaultPlist, getInfo);
0052 
0053   % Set units
0054   for ii =1:numel(bs)
0055     app_axis = pl.find('axis');
0056     if ~isempty(find('X'==upper(app_axis), 1))
0057       bs(ii).setXunits(feval('sqrt', bs(ii).data.xunits), 'internal');
0058     end
0059     if ~isempty(find('Y'==upper(app_axis), 1))
0060       bs(ii).setYunits(feval('sqrt', bs(ii).data.yunits), 'internal');
0061     end
0062   end
0063 
0064   % Set output
0065   if nargout > 0
0066     varargout{1} = bs;
0067   end
0068 end
0069 
0070 %--------------------------------------------------------------------------
0071 % Get Info Object
0072 %--------------------------------------------------------------------------
0073 function ii = getInfo(varargin)
0074   if nargin == 1 && strcmpi(varargin{1}, 'None')
0075     sets = {};
0076     pl   = [];
0077   else
0078     sets = {'Default'};
0079     pl   = getDefaultPlist;
0080   end
0081   % Build info object
0082   ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: sqrt.m,v 1.24 2008/09/05 11:15:19 ingo Exp $', sets, pl);
0083 end
0084 
0085 %--------------------------------------------------------------------------
0086 % Get Default Plist
0087 %--------------------------------------------------------------------------
0088 function pl_default = getDefaultPlist()
0089 
0090   pl_default = plist('axis',  'y');
0091 end
0092 
0093 % END

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003