checkDistribution

PURPOSE ^

identify input distribution

SYNOPSIS ^

function result = checkDistribution(dis, type)

DESCRIPTION ^

 identify input distribution

 Syntax: result = identifyDistribution(dis)

 A logical array is returned that contains true if the distribution is
   continuous (first element), discrete (second) or reduced (third).

 In the form identifyDistribution(dis, type) only the specific type is
   returned: disC (continuous), disD (discrete), disR (reduced).

 see also: obtainDistributioncontinuous, discretizeDistribution,
   reduceDistribution

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function result = checkDistribution(dis, type)
0002 % identify input distribution
0003 %
0004 % Syntax: result = identifyDistribution(dis)
0005 %
0006 % A logical array is returned that contains true if the distribution is
0007 %   continuous (first element), discrete (second) or reduced (third).
0008 %
0009 % In the form identifyDistribution(dis, type) only the specific type is
0010 %   returned: disC (continuous), disD (discrete), disR (reduced).
0011 %
0012 % see also: obtainDistributioncontinuous, discretizeDistribution,
0013 %   reduceDistribution
0014 
0015 % The elk-library: convex geometry applied to crystallization modeling.
0016 %   Copyright (C) 2013 Alexander Reinhold
0017 %
0018 % This program is free software: you can redistribute it and/or modify it
0019 %   under the terms of the GNU General Public License as published by the
0020 %   Free Software Foundation, either version 3 of the License, or (at your
0021 %   option) any later version.
0022 %
0023 % This program is distributed in the hope that it will be useful, but
0024 %   WITHOUT ANY WARRANTY; without even the implied warranty of
0025 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0026 %   General Public License for more details.
0027 %
0028 % You should have received a copy of the GNU General Public License along
0029 %   with this program.  If not, see <http://www.gnu.org/licenses/>.
0030 
0031 
0032 %% Input handling
0033 if ~exist('type', 'var')
0034     type = '';
0035 end
0036 
0037 %% conditions
0038 % required fields for distribution
0039 isDis = all(isfield(dis, {'name', 'nDim'}));
0040 
0041 % seperate types
0042 isDisC = all(isfield(dis, {'fhandle', 'parContinuous'}));
0043 isDisD = all(isfield(dis, {'positionMatrix', 'valueVector', ...
0044     'probabilityVector', 'parDiscrete'}));
0045 isDisR = all(isfield(dis, {'positionMatrix', 'valueVector', ...
0046     'parReduce'}));
0047 
0048 %% assign result
0049 switch lower(type)
0050     case ''
0051         result = isDis & [isDis isDisD isDisR];
0052     case 'disc'
0053         result = isDis && isDisC;
0054     case 'disd'
0055         result = isDis && isDisD;
0056     case 'disr'
0057         result = isDis && isDisR;
0058 end

Generated on Sat 18-Jul-2015 16:45:31 by m2html © 2005