Home > classes > @ao > diag.m

diag

PURPOSE ^

DIAG overloads the diagonal operator for Analysis Objects.

SYNOPSIS ^

function varargout = diag(varargin)

DESCRIPTION ^

 DIAG overloads the diagonal operator for Analysis Objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: DIAG overloads the diagonal operator for Analysis Objects.

 CALL:        b = diag (a)    % only with data = cdata
              b = diag (a, pl)

 INPUTS:      a  -  input analysis object
              pl - parameter list

 OUTPUTS:     b  - output analysis object

 PARAMETERS:  see help for data2D/applymethod for additional parameters

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

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

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

 HISTORY:     08-05-07 A Monsky
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % DIAG overloads the diagonal operator for Analysis Objects.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: DIAG overloads the diagonal operator for Analysis Objects.
0005 %
0006 % CALL:        b = diag (a)    % only with data = cdata
0007 %              b = diag (a, pl)
0008 %
0009 % INPUTS:      a  -  input analysis object
0010 %              pl - parameter list
0011 %
0012 % OUTPUTS:     b  - output analysis object
0013 %
0014 % PARAMETERS:  see help for data2D/applymethod for additional parameters
0015 %
0016 % M-FILE INFO: Get information about this methods by calling
0017 %              >> ao.getInfo('diag')
0018 %
0019 %              Get information about a specified set-plist by calling:
0020 %              >> ao.getInfo('diag', 'None')
0021 %
0022 % VERSION:     $Id: diag.m,v 1.25 2008/09/05 11:15:19 ingo Exp $
0023 %
0024 % HISTORY:     08-05-07 A Monsky
0025 %                 Creation
0026 %
0027 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0028 
0029 function varargout = diag(varargin)
0030 
0031   % Check if this is a call for parameters
0032   if utils.helper.isinfocall(varargin{:})
0033     varargout{1} = getInfo(varargin{3});
0034     return
0035   end
0036 
0037   import utils.const.*
0038   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0039   
0040   % Collect input variable names
0041   in_names = cell(size(varargin));
0042   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0043 
0044   % Collect all AOs
0045   [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0046   pl              = utils.helper.collect_objects(varargin(:), 'plist', in_names);
0047 
0048   % Decide on a deep copy or a modify
0049   bs = copy(as, nargout);
0050 
0051   % Combine plists
0052   pl = combine(pl, getDefaultPlist);
0053 
0054   %% go through analysis objects
0055   for j=1:numel(bs)
0056     if ~isa(bs(j).data, 'cdata')
0057       warning('!!! This methods works for cdata type AO only. Skipping AO %s', ao_invars{j})
0058     else
0059       % Apply method to all AOs
0060       applymethod(bs(j), ao_invars(j), 'diag', pl, getDefaultPlist, getInfo);
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: diag.m,v 1.25 2008/09/05 11:15:19 ingo Exp $', sets, pl);
0083 end
0084 
0085 %--------------------------------------------------------------------------
0086 % Get Default Plist
0087 %--------------------------------------------------------------------------
0088 function pl = getDefaultPlist()
0089   pl = plist('option', 0);
0090 end
0091

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