Mercurial > hg > ltpda
comparison m-toolbox/classes/@smodel/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 evaluates the determinant of smodel objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: DET evaluates the determinant of smodel objects. | |
5 % | |
6 % CALL: obj = det(mdl) | |
7 % obj = mdl.det() | |
8 % | |
9 % <a href="matlab:utils.helper.displayMethodInfo('smodel', 'det')">Parameters Description</a> | |
10 % | |
11 % VERSION: $Id: det.m,v 1.10 2011/04/08 08:56:28 hewitson Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 function varargout = det(varargin) | |
16 | |
17 % Settings | |
18 operatorName = 'det'; | |
19 | |
20 % Check if this is a call for parameters | |
21 if utils.helper.isinfocall(varargin{:}) | |
22 varargout{1} = getInfo(varargin{3}); | |
23 return | |
24 end | |
25 | |
26 % Check if the method was called by another method | |
27 callerIsMethod = utils.helper.callerIsMethod; | |
28 | |
29 % Collect input variable names | |
30 in_names = cell(size(varargin)); | |
31 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
32 | |
33 % Collect all smodels and plists | |
34 [as, smodel_invars, rest] = utils.helper.collect_objects(varargin(:), 'smodel', in_names); | |
35 pl = utils.helper.collect_objects(varargin(:), 'plist'); | |
36 | |
37 % Decide on a deep copy or a modify | |
38 mdls = copy(as, nargout); | |
39 | |
40 % Combine plists | |
41 pl = parse(pl, getDefaultPlist()); | |
42 | |
43 % Apply the operator | |
44 mdls.op(operatorName); | |
45 | |
46 if ~callerIsMethod | |
47 % Add history | |
48 mdls.addHistory(getInfo('None'), pl, smodel_invars, [mdls(:).hist]); | |
49 | |
50 % Set name | |
51 mdls.name = [operatorName '(' mdls.name ')']; | |
52 end | |
53 | |
54 % Set output | |
55 varargout{1} = mdls; | |
56 | |
57 end | |
58 | |
59 %-------------------------------------------------------------------------- | |
60 % Get Info Object | |
61 %-------------------------------------------------------------------------- | |
62 function ii = getInfo(varargin) | |
63 | |
64 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
65 sets = {}; | |
66 pls = []; | |
67 else | |
68 sets = {'Default'}; | |
69 pls = getDefaultPlist(); | |
70 end | |
71 % Build info object | |
72 ii = minfo(mfilename, 'smodel', 'ltpda', utils.const.categories.op, '$Id: det.m,v 1.10 2011/04/08 08:56:28 hewitson Exp $', sets, pls); | |
73 ii.setArgsmin(1); | |
74 end | |
75 | |
76 %-------------------------------------------------------------------------- | |
77 % Get Default Plist | |
78 %-------------------------------------------------------------------------- | |
79 function plout = getDefaultPlist() | |
80 persistent pl; | |
81 if ~exist('pl', 'var') || isempty(pl) | |
82 pl = buildplist(); | |
83 end | |
84 plout = pl; | |
85 end | |
86 | |
87 function pl = buildplist() | |
88 pl = plist.EMPTY_PLIST; | |
89 end |