comparison m-toolbox/classes/@ao/det.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 % DET overloads the determinant function for analysis objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: DET overloads the determinant function for analysis objects.
5 %
6 % CALL: a = det(a1) % only with cdata AOs
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'det')">Parameters Description</a>
9 %
10 % VERSION: $Id: det.m,v 1.41 2011/04/19 18:48:11 ingo Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function varargout = det(varargin)
15
16 % Check if the method was called by another method
17 callerIsMethod = utils.helper.callerIsMethod;
18
19 % Settings
20 operatorName = 'det';
21 dxFcn = [];
22
23 if callerIsMethod
24 in_names = {};
25 else
26 % Collect input variable names
27 in_names = cell(size(varargin));
28 for ii = 1:nargin,in_names{ii} = inputname(ii);end
29
30 % Check if this is a call for the minfo object
31 if utils.helper.isinfocall(varargin{:})
32 varargout{1} = getInfo(varargin{3});
33 return
34 end
35
36 end
37
38 % Here we are forced to collect objects so that we can check that each ao
39 % is the correct type and shape for doing det.
40 [as, dummy, rest] = utils.helper.collect_objects(varargin, 'ao', in_names);
41
42 % Check for the correct data objects: Throw an error for data2D objects.
43 as.checkDataType('data2D');
44
45 % Check that the data of the AOs is a square matrix
46 for ii=1:numel(as)
47 if size(as(ii).data.y,1) ~= size(as(ii).data.y,2)
48 error('### The y data must be a square matrix.')
49 end
50 end
51
52 copyObjects = nargout>0;
53
54 % Apply method to all AOs
55 [out, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:});
56
57 % Clear errors
58 out.clearErrors(pl);
59
60 % set outputs
61 varargout = utils.helper.setoutputs(nargout, out);
62
63 end
64
65 %--------------------------------------------------------------------------
66 % Get Info Object
67 %--------------------------------------------------------------------------
68 function ii = getInfo(varargin)
69
70 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin);
71 end
72
73 %--------------------------------------------------------------------------
74 % Get Default Plist
75 %--------------------------------------------------------------------------
76
77 function plout = getDefaultPlist(set)
78 persistent pl;
79 persistent lastset;
80 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set)
81 pl = buildplist(set);
82 lastset = set;
83 end
84 plout = pl;
85 end
86
87 function plout = buildplist(varargin)
88 plout = plist.getDefaultAxisPlist(varargin{:});
89 end
90