comparison m-toolbox/classes/@ao/times.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 % TIMES implements multiplication operator for analysis objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: TIMES implements multiplication operator for two analysis objects.
5 %
6 % CALL:
7 % a = a1.*a2
8 % a = times(a1,a2);
9 % a = times(a1,a2,a3) == times(times(a1,a2),a3)
10 %
11 % More than two inputs are handled with nested calls.
12 %
13 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'times')">Parameters Description</a>
14 %
15 % VERSION: $Id: times.m,v 1.39 2011/04/08 08:56:17 hewitson Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function varargout = times(varargin)
20
21 % Settings
22 op = 'times';
23 opname = 'multiply';
24 opsym = '.*';
25
26 if nargout == 0
27 error('### A %s operator can not be used as a modifier.', opname);
28 end
29
30 callerIsMethod = utils.helper.callerIsMethod;
31
32 if callerIsMethod
33 aosNames = {};
34 else
35 % collect input variable names
36 for ii = 1:nargin,aosNames{ii} = inputname(ii);end
37 end
38
39 % apply operator
40 res = ao.elementOp(callerIsMethod, @getInfo, @getDefaultPlist, op, opname, opsym, aosNames, varargin(:));
41
42 % Set output
43 varargout = utils.helper.setoutputs(nargout, res);
44
45 end
46
47 %--------------------------------------------------------------------------
48 % Get Info Object
49 %--------------------------------------------------------------------------
50 function ii = getInfo(varargin)
51
52 if nargin == 1 && strcmpi(varargin{1}, 'None')
53 sets = {};
54 pls = [];
55 else
56 sets = {'Default'};
57 pls = getDefaultPlist;
58 end
59 % Build info object
60 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.aop, '$Id: times.m,v 1.39 2011/04/08 08:56:17 hewitson Exp $', sets, pls);
61 ii.setArgsmin(2);
62 end
63
64 %--------------------------------------------------------------------------
65 % Get Default Plist
66 %--------------------------------------------------------------------------
67 function plout = getDefaultPlist()
68 persistent pl;
69 if ~exist('pl', 'var') || isempty(pl)
70 pl = buildplist();
71 end
72 plout = pl;
73 end
74
75 function pl = buildplist()
76 pl = plist.EMPTY_PLIST;
77 end