0001 function varargout = det(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 VERSION = '$Id: det.m,v 1.15 2007/12/24 19:48:38 hewitson Exp $';
0023 bs = [];
0024
0025
0026 if nargin == 2
0027 if isa(varargin{1}, 'ao') && ischar(varargin{2})
0028 in = char(varargin{2});
0029 if strcmp(in, 'Params')
0030 varargout{1} = getDefaultPL();
0031 return
0032 elseif strcmp(in, 'Version')
0033 varargout{1} = VERSION;
0034 return
0035 end
0036 end
0037 end
0038
0039
0040 in_names = {};
0041 for ii = 1:nargin
0042 in_names{end+1} = inputname(ii);
0043 end
0044
0045 [as, ps, invars] = collect_inputs(varargin, in_names);
0046
0047
0048 if isempty(ps)
0049 pl = getDefaultPL();
0050 else
0051 pl = combine(ps, getDefaultPL);
0052 end
0053
0054
0055 for j=1:numel(as)
0056 a = as(j);
0057
0058 d = get(a, 'data');
0059 dinfo = whos('d');
0060
0061 dtype = dinfo.class;
0062
0063 switch dtype
0064 case 'cdata'
0065
0066
0067 if size(d.y,1) == size(d.y,2)
0068 [h, c] = single_operation(d, 'det', pl);
0069 else
0070 error('### The value (y) of data must be a square matrix.')
0071 end
0072
0073
0074 h = set(h, 'inhists', [a.hist]);
0075
0076
0077 h = set(h, 'invars', cellstr(invars{j}));
0078
0079 b = ao(c, h);
0080 b = setnh(b, 'name', sprintf('det(%s)', char(invars{j})));
0081 case {'tsdata','fsdata','xydata'}
0082 error('### this function works for cdata type AO only')
0083 otherwise
0084 error('### unknown data type.')
0085 end
0086
0087
0088 bs = [bs b];
0089 end
0090
0091 bs = reshape(bs, size(as));
0092 varargout{1} = bs;
0093
0094
0095 function plo = getDefaultPL()
0096
0097 plo = plist();
0098
0099
0100