SVD overloads the determinant function for Analysis objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: SVD overloads the determinant function for Analysis objects. CALL: u = svd (a,pl) INPUTS: a - input analysis object pl - a parameter list OTPUTS: like matlab fct PARAMETERS: 'option' - a string or value that can be submited i.e. 'econ' to produce economy size decomposition - options are the same as for the matlab function see help for data2D/applymethod for additional parameters The following call returns an info object for this method. >> info = ao.getInfo('svd') VERSION: $Id: svd.m,v 1.19 2008/09/05 11:15:19 ingo Exp $ HISTORY: 08-05-07A Monsky Creation. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % SVD overloads the determinant function for Analysis objects. 0002 % 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: SVD overloads the determinant function for Analysis objects. 0006 % 0007 % CALL: u = svd (a,pl) 0008 % 0009 % INPUTS: a - input analysis object 0010 % pl - a parameter list 0011 % 0012 % OTPUTS: like matlab fct 0013 % 0014 % PARAMETERS: 'option' - a string or value that can be submited i.e. 'econ' 0015 % to produce economy size decomposition 0016 % - options are the same as for the matlab function 0017 % 0018 % see help for data2D/applymethod for additional parameters 0019 % 0020 % The following call returns an info object for this method. 0021 % 0022 % >> info = ao.getInfo('svd') 0023 % 0024 % VERSION: $Id: svd.m,v 1.19 2008/09/05 11:15:19 ingo Exp $ 0025 % 0026 % HISTORY: 08-05-07A Monsky 0027 % Creation. 0028 % 0029 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0030 0031 0032 % FOR THESE OTHER OUTPUT OPTIONS WE CAN'T USE THE GENERIC APPLYMETHOD. IF 0033 % WE NEED THIS FUNCTIONALITY THEN WE SHOULD RECODE THIS INDIVIDUALLY. 0034 % [u, s] = svd (a,pl) 0035 % [u, s, v] = svd (a,pl) 0036 % [u, s, v] = svd (a) 0037 0038 0039 0040 function varargout = svd(varargin) 0041 0042 %% Check if this is a call for parameters 0043 if utils.helper.isinfocall(varargin{:}) 0044 varargout{1} = getInfo(varargin{3}); 0045 return 0046 end 0047 0048 % Collect input variable names 0049 in_names = cell(size(varargin)); 0050 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0051 0052 % Collect all AOs 0053 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0054 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0055 0056 % Decide on a deep copy or a modify 0057 bs = copy(as, nargout); 0058 0059 % Combine plists 0060 pl = combine(pl, getDefaultPlist); 0061 0062 %% go through analysis objects 0063 for j=1:numel(bs) 0064 if ~isa(bs(j).data, 'cdata') 0065 warning('!!! This methods works for cdata type AO only. Skipping AO %s', ao_invars{j}) 0066 else 0067 % Apply method to all AOs 0068 applymethod(bs(j), ao_invars(j), 'svd', pl, getDefaultPlist, getInfo); 0069 end 0070 end 0071 0072 % Set output 0073 if nargout > 0 0074 varargout{1} = bs; 0075 end 0076 end 0077 0078 %-------------------------------------------------------------------------- 0079 % Get Info Object 0080 %-------------------------------------------------------------------------- 0081 function ii = getInfo(varargin) 0082 if nargin == 1 && strcmpi(varargin{1}, 'None') 0083 sets = {}; 0084 pl = []; 0085 else 0086 sets = {'Default'}; 0087 pl = getDefaultPlist; 0088 end 0089 % Build info object 0090 ii = minfo(mfilename, 'ao', '', utils.const.categories.op, '$Id: svd.m,v 1.19 2008/09/05 11:15:19 ingo Exp $', sets, pl); 0091 end 0092 %-------------------------------------------------------------------------- 0093 % Get Default Plist 0094 %-------------------------------------------------------------------------- 0095 function pl = getDefaultPlist() 0096 pl = plist('option', ''); 0097 end 0098 0099 % END