view m-toolbox/classes/@ao/eig.m @ 33:5e7477b94d94 database-connection-manager

Add known repositories list to LTPDAPreferences
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% EIG overloads the eigenvalues/eigenvectors function for analysis objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: EIG overloads the eigenvalues/eigenvectors function for analysis objects.
%
% CALL:        e = eig (a,pl)    % only with data = cdata
%
% INPUTS:      pl   - a parameter list
%              a    - input analysis object
%
% OUTPUTS:     like matlab function
%
% <a href="matlab:utils.helper.displayMethodInfo('ao', 'eig')">Parameters Description</a>
%
% REMARKS:     See help for data2D/applymethod for additional parameters.
%
% VERSION:     $Id: eig.m,v 1.46 2011/04/17 10:28:38 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = eig(varargin)
  
  % Check if the method was called by another method
  callerIsMethod = utils.helper.callerIsMethod;
  
  % Settings
  operatorName = 'eig';
  dxFcn = [];
  
  if callerIsMethod
    in_names = {};
  else
    % Collect input variable names
    in_names = cell(size(varargin));
    for ii = 1:nargin,in_names{ii} = inputname(ii);end
    
    % Check if this is a call for the minfo object
    if utils.helper.isinfocall(varargin{:})
      varargout{1} = getInfo(varargin{3});
      return
    end
    
  end
  
  % Here we are forced to collect objects so that we can check that each ao
  % is the correct type and shape for doing det.
  [as, dummy, rest] = utils.helper.collect_objects(varargin, 'ao', in_names);
  
  % Check for the correct data objects: Throw an error for data2D objects.
  as.checkDataType('data2D');
  
  % Check that the data of the AOs is a square matrix
  for ii=1:numel(as)
    if size(as(ii).data.y,1) ~= size(as(ii).data.y,2)
      error('### The y data must be a square matrix.')
    end
  end
  
  copyObjects = nargout>0;
  
  % Apply method to all AOs
  [out, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
  
  % Clear errors
  out.clearErrors(pl);
  
  % set outputs
  varargout = utils.helper.setoutputs(nargout, out); 
  
end

%--------------------------------------------------------------------------
% Get Info Object
%--------------------------------------------------------------------------
function ii = getInfo(varargin)
  
  ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
end

%--------------------------------------------------------------------------
% Get Default Plist
%--------------------------------------------------------------------------

function plout = getDefaultPlist(varargin)
  plout = plist.getDefaultAxisPlist(varargin{:});
  
  plout.remove('option');
  p = param({'option', ['A string or value (e.g. ''nobalance'') that can<br>' ...
    'specified to disable balancing. See MATLAB''s <a href="matlab:doc(''eig'')">eig</a> for details.']}, ...
    {1, {'', 'nobalance'}, paramValue.OPTIONAL});
  plout.append(p);
end