LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_DT_PH_ParsePara.m
1function Q_DT_PH_ParsePara2(alpha,alpha_name,A,A_name)
2%Q_DT_PH_ParsePara checks the validity of the input parameters alpha, A as a
3%representation of a Discrete-Time PH distribution.
4
5% check numeric
6if (~isnumeric(alpha))
7 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
8 '%s has to be numeric', alpha_name);
9end
10if (~isnumeric(A))
11 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
12 '%s has to be numeric', A_name);
13end
14
15% check real
16if (~isreal(alpha))
17 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
18 '%s has to be a real vector', alpha_name);
19end
20if (~isreal(A))
21 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
22 '%s has to be a real matrix', A_name);
23end
24
25% check dimension
26if (size(alpha,1) ~= 1)
27 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
28 '%s is not a row vector', alpha_name);
29end
30if (size(A,1) ~= size(A,2))
31 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
32 '%s is not a square matrix', A_name);
33end
34if (size(alpha,2) ~= size(A,1))
35 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
36 'The vector %s and the matrix %s do not have the same number of columns', alpha_name, A_name);
37end
38
39% check nonnegativity
40if (min(alpha) < -10^(-14))
41 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
42 'The vector %s contains negative data', alpha_name);
43end
44if (min(min(A)) < -10^(-14))
45 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
46 'The matrix %s contains negative data', A_name);
47end
48
49% check (sub)stochasticity
50if (sum(alpha,2) > 1+10^(-14))
51 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
52 'The vector %s has to be (sub)stochastic', alpha_name);
53end
54if (max(sum(A,2)) > 1+10^(-14))||(min(sum(A,2)) > 1-10^(-14))
55 error('MATLAB:Q_DT_PH_ParsePara:InvalidInput',...
56 'The matrix %s has to be substochastic', A_name);
57end