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.
7 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
8 '%s has to be numeric', alpha_name);
11 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
12 '%s has to be numeric', A_name);
17 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
18 '%s has to be a real vector', alpha_name);
21 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
22 '%s has to be a real matrix', A_name);
26if (size(alpha,1) ~= 1)
27 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
28 '%s is not a row vector', alpha_name);
30if (size(A,1) ~= size(A,2))
31 error(
'MATLAB:Q_CT_PH_ParsePara:InvalidInput',...
32 '%s is not a square matrix', A_name);
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);
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);
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);
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);
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);
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);