Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/inv.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 % INV overloads the inverse function for asnalysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: INV overloads the inverse function for analysis objects. | |
5 % | |
6 % CALL: a = inv(a1) % only with data = cdata | |
7 % | |
8 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'inv')">Parameters Description</a> | |
9 % | |
10 % VERSION: $Id: inv.m,v 1.43 2011/04/19 18:48:11 ingo Exp $ | |
11 % | |
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
13 | |
14 function varargout = inv(varargin) | |
15 | |
16 % Check if the method was called by another method | |
17 callerIsMethod = utils.helper.callerIsMethod; | |
18 | |
19 % Settings | |
20 operatorName = 'inv'; | |
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 inv. | |
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 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin); | |
70 end | |
71 | |
72 %-------------------------------------------------------------------------- | |
73 % Get Default Plist | |
74 %-------------------------------------------------------------------------- | |
75 | |
76 function plout = getDefaultPlist(set) | |
77 persistent pl; | |
78 persistent lastset; | |
79 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set) | |
80 pl = buildplist(set); | |
81 lastset = set; | |
82 end | |
83 plout = pl; | |
84 end | |
85 | |
86 function plout = buildplist(varargin) | |
87 plout = plist.getDefaultAxisPlist(varargin{:}); | |
88 end | |
89 |