comparison m-toolbox/classes/@matrix/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 implements conj operator for matrix objects.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: conj implements conj operator for a matrix object.
5 %
6 % CALL: obj = conj(obj);
7 %
8 % <a href="matlab:utils.helper.displayMethodInfo('matrix', 'conj')">Parameters Description</a>
9 %
10 % VERSION: $Id: conj.m,v 1.6 2011/04/08 08:56:31 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
25 in_names{ii} = inputname(ii);
26 end
27
28 % Collect all matrices and plists
29 [as, matrix_invars, rest] = utils.helper.collect_objects(varargin(:), 'matrix', in_names);
30 [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names);
31
32 % Combine plists
33 usepl = parse(pl, getDefaultPlist());
34
35 % decide to do a deep copy
36 bs = copy(as,nargout);
37
38 % run over input objects
39 for jj =1:numel(bs)
40 % get elements
41 obj = bs(jj).objs;
42
43 % do conj
44 obj = conj(obj);
45
46 % get new matrix
47 for ii=1:numel(bs(jj).objs)
48 bs(jj).objs(ii) = obj(ii);
49 end
50 % set Name
51 bs(jj).name = sprintf('conj(%s)',as(jj).name);
52 % add history
53 bs(jj).addHistory(getInfo('None'), usepl, [matrix_invars(:)], [as(jj).hist]);
54 end
55 varargout{1} = bs;
56
57
58 end
59
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 % Local Functions %
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 %
66 % FUNCTION: getInfo
67 %
68 % DESCRIPTION: Get Info Object
69 %
70 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71
72 function ii = getInfo(varargin)
73
74 if nargin == 1 && strcmpi(varargin{1}, 'None')
75 sets = {};
76 pls = [];
77 else
78 sets = {'Default'};
79 pls = getDefaultPlist;
80 end
81 % Build info object
82 ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: conj.m,v 1.6 2011/04/08 08:56:31 hewitson Exp $', sets, pls);
83
84 end
85
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 %
88 % FUNCTION: getDefaultPlist
89 %
90 % DESCRIPTION: Get Default Plist
91 %
92 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
93
94 function plout = getDefaultPlist()
95 persistent pl;
96 if exist('pl', 'var')==0 || isempty(pl)
97 pl = buildplist();
98 end
99 plout = pl;
100 end
101
102 function pl = buildplist()
103 pl = plist.EMPTY_PLIST;
104 end