Mercurial > hg > ltpda
view m-toolbox/classes/@matrix/rdivide.m @ 32:e22b091498e4 database-connection-manager
Update makeToolbox
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% RDIVIDE implements division operator for matrix objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: RDIVIDE implements division operator for two matrix objects. % % CALL: obj = obj1./obj2 % obj = rdivide(obj1,obj2); % obj = rdivide(obj1,obj2,obj3) == rdivide(rdivide(obj1,obj2),obj3) % % REMARK: More than two inputs are handled with nested calls. % (This doesn't work at the moment. Do we need this?) % % <a href="matlab:utils.helper.displayMethodInfo('matrix', 'rdivide')">Parameters Description</a> % % VERSION: $Id: rdivide.m,v 1.8 2011/04/08 08:56:31 hewitson Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function varargout = rdivide(varargin) callerIsMethod = utils.helper.callerIsMethod; % Check if this is a call for parameters if utils.helper.isinfocall(varargin{:}) varargout{1} = getInfo(varargin{3}); return end if nargout == 0 error('### Division operator can not be used as a modifier.'); end op = 'rdivide'; opname = 'dividion'; opsym = './'; infoObj = getInfo('None'); % collect input variable names in_names = cell(size(varargin)); for ii = 1:nargin,if ~isa(varargin{ii}, 'plist'), in_names{ii} = inputname(ii); end, end % Collect all plists [pl, pl_invars, rest] = utils.helper.collect_objects(varargin(:), 'plist', in_names); % Combine default plist pl = combine(pl, getDefaultPlist()); mat = matrix.elementOp(callerIsMethod, op, opname, opsym, infoObj, pl, rest, in_names); %%%%%%%%%% Prepare output %%%%%%%%%% if nargout == numel(mat) for kk=1:numel(mat) varargout{kk} = mat(kk); end else varargout{1} = mat; end end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Local Functions % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getInfo % % DESCRIPTION: Get Info Object % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function ii = getInfo(varargin) if nargin == 1 && strcmpi(varargin{1}, 'None') sets = {}; pls = []; else sets = {'Default'}; pls = getDefaultPlist; end % Build info object ii = minfo(mfilename, 'matrix', 'ltpda', utils.const.categories.aop, '$Id: rdivide.m,v 1.8 2011/04/08 08:56:31 hewitson Exp $', sets, pls); ii.setArgsmin(2); ii.setModifier(false); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % FUNCTION: getDefaultPlist % % DESCRIPTION: Get Default Plist % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function plout = getDefaultPlist() persistent pl; if exist('pl', 'var')==0 || isempty(pl) pl = buildplist(); end plout = pl; end function pl = buildplist() pl = plist.EMPTY_PLIST; end