Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/eig.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % EIG overloads the eigenvalues/eigenvectors function for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: EIG overloads the eigenvalues/eigenvectors function for analysis objects. | |
5 % | |
6 % CALL: e = eig (a,pl) % only with data = cdata | |
7 % | |
8 % INPUTS: pl - a parameter list | |
9 % a - input analysis object | |
10 % | |
11 % OUTPUTS: like matlab function | |
12 % | |
13 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'eig')">Parameters Description</a> | |
14 % | |
15 % REMARKS: See help for data2D/applymethod for additional parameters. | |
16 % | |
17 % VERSION: $Id: eig.m,v 1.46 2011/04/17 10:28:38 hewitson Exp $ | |
18 % | |
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
20 | |
21 function varargout = eig(varargin) | |
22 | |
23 % Check if the method was called by another method | |
24 callerIsMethod = utils.helper.callerIsMethod; | |
25 | |
26 % Settings | |
27 operatorName = 'eig'; | |
28 dxFcn = []; | |
29 | |
30 if callerIsMethod | |
31 in_names = {}; | |
32 else | |
33 % Collect input variable names | |
34 in_names = cell(size(varargin)); | |
35 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
36 | |
37 % Check if this is a call for the minfo object | |
38 if utils.helper.isinfocall(varargin{:}) | |
39 varargout{1} = getInfo(varargin{3}); | |
40 return | |
41 end | |
42 | |
43 end | |
44 | |
45 % Here we are forced to collect objects so that we can check that each ao | |
46 % is the correct type and shape for doing det. | |
47 [as, dummy, rest] = utils.helper.collect_objects(varargin, 'ao', in_names); | |
48 | |
49 % Check for the correct data objects: Throw an error for data2D objects. | |
50 as.checkDataType('data2D'); | |
51 | |
52 % Check that the data of the AOs is a square matrix | |
53 for ii=1:numel(as) | |
54 if size(as(ii).data.y,1) ~= size(as(ii).data.y,2) | |
55 error('### The y data must be a square matrix.') | |
56 end | |
57 end | |
58 | |
59 copyObjects = nargout>0; | |
60 | |
61 % Apply method to all AOs | |
62 [out, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:}); | |
63 | |
64 % Clear errors | |
65 out.clearErrors(pl); | |
66 | |
67 % set outputs | |
68 varargout = utils.helper.setoutputs(nargout, out); | |
69 | |
70 end | |
71 | |
72 %-------------------------------------------------------------------------- | |
73 % Get Info Object | |
74 %-------------------------------------------------------------------------- | |
75 function ii = getInfo(varargin) | |
76 | |
77 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin); | |
78 end | |
79 | |
80 %-------------------------------------------------------------------------- | |
81 % Get Default Plist | |
82 %-------------------------------------------------------------------------- | |
83 | |
84 function plout = getDefaultPlist(varargin) | |
85 plout = plist.getDefaultAxisPlist(varargin{:}); | |
86 | |
87 plout.remove('option'); | |
88 p = param({'option', ['A string or value (e.g. ''nobalance'') that can<br>' ... | |
89 'specified to disable balancing. See MATLAB''s <a href="matlab:doc(''eig'')">eig</a> for details.']}, ... | |
90 {1, {'', 'nobalance'}, paramValue.OPTIONAL}); | |
91 plout.append(p); | |
92 end | |
93 |