LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_CT_PH_ParsePara.m
1function Q_CT_PH_ParsePara(alpha,alpha_name,A,A_name)
2%Q_CT_PH_ParsePara checks the validity of the input parameters alpha, A as a
3%representation of a Continuous-Time PH distribution.
4
5% check numeric
6if (~isnumeric(alpha))
7 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
8 '%s has to be numeric', alpha_name);
9end
10if (~isnumeric(A))
11 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
12 '%s has to be numeric', A_name);
13end
14
15% check real
16if (~isreal(alpha))
17 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
18 '%s has to be a real vector', alpha_name);
19end
20if (~isreal(A))
21 error('MATLAB:Q_CT_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_CT_PH_ParsePara:InvalidInput',...
28 '%s is not a row vector', alpha_name);
29end
30if (size(A,1) ~= size(A,2))
31 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
32 '%s is not a square matrix', A_name);
33end
34if (size(alpha,2) ~= size(A,1))
35 error('MATLAB:Q_CT_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 of vector alpha
40if (min(alpha) < -10^(-14))
41 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
42 'The vector %s contains negative data', alpha_name);
43end
44% check negativity of the diagonal entries of A
45if (max(diag(A)) > -10^(-14))
46 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
47 'Some diagonal entries of matrix %s are not negative', A_name);
48end
49% check nonnegativity of the off-diagonal entries of A
50if (min(min(A-diag(diag(A)) )) < -10^(-14))
51 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
52 'Some off-diagonal entries of matrix %s are negative', A_name);
53end
54
55% check (sub)stochasticity
56if (sum(alpha,2) > 1+10^(-14))
57 error('MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
58 'The vector %s has to be (sub)stochastic', alpha_name);
59end
60
61% check negative row sum
62if (max(sum(A,2)) > 10^(-14))
63 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
64 'The matrix %s must have negative row sum', A_name);
65end