1function Q_CT_MAP_ParsePara(C,C_name,D,D_name)
2%Q_CT_MAP_ParsePara checks the validity of the input matrices C, D as a
3%representation of a continuous-time MAP.
7 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
8 '%d has to be numeric',C_name);
11 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
12 '%s has to be numeric',D_name);
17 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
18 '%s has to be a real matrix',C_name);
21 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
22 '%s has to be a real matrix',D_name);
26if (size(C,1) ~= size(C,2))
27 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
28 '%s is not a square matrix',C_name);
30if (size(D,1) ~= size(D,2))
31 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
32 '%s is not a square matrix',D_name);
34if (size(C,1) ~= size(D,1))
35 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
36 'The matrices %s and %s do not have the same dimension',C_name,D_name);
39% check negativity of the diagonal entries of C
40if (max(diag(C)) > -10^(-14))
41 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
42 'Some diagonal entries of matrix %s are not negative',C_name);
44% check nonnegativity of the off-diagonal entries of C
45if (min(min(C-diag(diag(C)) )) < -10^(-14))
46 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
47 'Some off-diagonal entries of matrix %s are negative',C_name);
49% check nonnegativity of D
50if (min(min(D)) < -10^(-14))
51 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
52 'The matrix %s contains negative data',D_name);
56if (max(sum(C+D,2)) > 10^(-14)) || (min(sum(C+D,2)) < -10^(-14))
57 error(
'MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
58 'The matrix %s+%s must have zero row sum',C_name,D_name);