Mercurial > hg > ltpda
comparison m-toolbox/classes/@ao/svd.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 % SVD overloads the svd (singular value decomposition) function for analysis objects. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: SVD overloads the singular value decomposition for analysis objects. | |
5 % | |
6 % CALL: u = svd(ao_in, pl) | |
7 % | |
8 % INPUTS: ao_in - input analysis object | |
9 % pl - a parameter list | |
10 % | |
11 % OUTPUTS: See MATLAB's svd | |
12 % | |
13 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'svd')">Parameters Description</a> | |
14 % | |
15 % VERSION: $Id: svd.m,v 1.39 2011/04/19 18:48:11 ingo Exp $ | |
16 % | |
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
18 | |
19 function varargout = svd(varargin) | |
20 | |
21 % Check if the method was called by another method | |
22 callerIsMethod = utils.helper.callerIsMethod; | |
23 | |
24 % Settings | |
25 operatorName = 'svd'; | |
26 dxFcn = []; | |
27 | |
28 if callerIsMethod | |
29 in_names = {}; | |
30 else | |
31 % Collect input variable names | |
32 in_names = cell(size(varargin)); | |
33 for ii = 1:nargin,in_names{ii} = inputname(ii);end | |
34 | |
35 % Check if this is a call for the minfo object | |
36 if utils.helper.isinfocall(varargin{:}) | |
37 varargout{1} = getInfo(varargin{3}); | |
38 return | |
39 end | |
40 | |
41 end | |
42 | |
43 % Here we are forced to collect objects so that we can check that each ao | |
44 % is the correct type and shape for doing det. | |
45 [as, dummy, rest] = utils.helper.collect_objects(varargin, 'ao', in_names); | |
46 | |
47 % Check for the correct data objects: Throw an error for data2D objects. | |
48 as.checkDataType('data2D'); | |
49 | |
50 copyObjects = nargout>0; | |
51 | |
52 % Apply method to all AOs | |
53 [out, pl] = ao.applymethod(copyObjects, callerIsMethod, in_names, operatorName, dxFcn, @getInfo, @getDefaultPlist, varargin{:}); | |
54 | |
55 % Clear errors | |
56 out.clearErrors(pl); | |
57 | |
58 % set outputs | |
59 varargout = utils.helper.setoutputs(nargout, out); | |
60 | |
61 end | |
62 | |
63 %-------------------------------------------------------------------------- | |
64 % Get Info Object | |
65 %-------------------------------------------------------------------------- | |
66 function ii = getInfo(varargin) | |
67 ii = minfo.getInfoAxis(mfilename, @getDefaultPlist, varargin); | |
68 end | |
69 | |
70 %-------------------------------------------------------------------------- | |
71 % Get Default Plist | |
72 %-------------------------------------------------------------------------- | |
73 | |
74 function plout = getDefaultPlist(set) | |
75 persistent pl; | |
76 persistent lastset; | |
77 if ~exist('pl', 'var') || isempty(pl) || ~strcmp(lastset, set) | |
78 pl = buildplist(set); | |
79 lastset = set; | |
80 end | |
81 plout = pl; | |
82 end | |
83 | |
84 function plout = buildplist(varargin) | |
85 plout = plist.getDefaultAxisPlist(varargin{:}); | |
86 | |
87 plout.remove('option'); | |
88 p = param({'option', ['A string or value that can be submitted, e.g. ''econ'''... | |
89 'to produce economy size decomposition.<br>'... | |
90 'Options are the same as for the matlab function.']}, paramValue.EMPTY_STRING); | |
91 plout.append(p); | |
92 end | |
93 |