comparison m-toolbox/classes/@smodel/conj.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 % CONJ gives the complex conjugate of the input smodels
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: CONJ gives the complex conjugate of the input smodels
5 %
6 % CALL: mdl = conj(mdl)
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('smodel', 'conj')">Parameters Description</a>
9 %
10 % VERSION: $Id: conj.m,v 1.8 2011/04/08 08:56:28 hewitson Exp $
11 %
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
14 function varargout = conj(varargin)
15
16 %%% Check if this is a call for parameters
17 if utils.helper.isinfocall(varargin{:})
18 varargout{1} = getInfo(varargin{3});
19 return
20 end
21
22 % Collect input variable names
23 in_names = cell(size(varargin));
24 for ii = 1:nargin,in_names{ii} = inputname(ii);end
25
26 % Collect all AOs and plists
27 [mdl, mdl_invars] = utils.helper.collect_objects(varargin(:), 'smodel', in_names);
28 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names);
29
30 % combine plists
31 pl = combine(pl, getDefaultPlist());
32
33 % decide to make a copy or not
34 cmdl = copy(mdl, nargout);
35
36 % [rw,cl] = size(cmdl);
37
38 for jj = 1:numel(cmdl)
39 cmdl(jj).expr = msym(['conj(' cmdl(jj).expr.s ')']);
40 cmdl(jj).name = ['conj(' cmdl(jj).name ')'];
41 cmdl(jj).params = mdl(jj).params;
42 cmdl(jj).values = mdl(jj).values;
43 cmdl(jj).xvar = mdl(jj).xvar;
44 cmdl(jj).xvals = mdl(jj).xvals;
45 cmdl(jj).xunits = mdl(jj).xunits;
46 cmdl(jj).yunits = mdl(jj).yunits;
47
48 % add history
49 cmdl(jj).addHistory(getInfo('None'), pl, mdl_invars(jj), mdl(jj).hist);
50 end
51
52 % Set outputs
53 varargout{1} = cmdl;
54 end
55
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 % Local Functions %
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %
62 % FUNCTION: getInfo
63 %
64 % DESCRIPTION: Get Info Object
65 %
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67
68 function ii = getInfo(varargin)
69 if nargin == 1 && strcmpi(varargin{1}, 'None')
70 sets = {};
71 pl = [];
72 else
73 sets = {'Default'};
74 pl = getDefaultPlist;
75 end
76 % Build info object
77 ii = minfo(mfilename, 'smodel', 'ltpda', utils.const.categories.aop, '$Id: conj.m,v 1.8 2011/04/08 08:56:28 hewitson Exp $', sets, pl);
78 ii.setModifier(true);
79 end
80
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %
83 % FUNCTION: getDefaultPlist
84 %
85 % DESCRIPTION: Get Default Plist
86 %
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89 function plout = getDefaultPlist()
90 persistent pl;
91 if exist('pl', 'var')==0 || isempty(pl)
92 pl = buildplist();
93 end
94 plout = pl;
95 end
96
97 function pl = buildplist()
98 pl = plist.EMPTY_PLIST;
99 end
100