LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_CT_MAP_ParsePara.m
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.
4
5% check numeric
6if (~isnumeric(C))
7 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
8 '%d has to be numeric',C_name);
9end
10if (~isnumeric(D))
11 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
12 '%s has to be numeric',D_name);
13end
14
15% check real
16if (~isreal(C))
17 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
18 '%s has to be a real matrix',C_name);
19end
20if (~isreal(D))
21 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
22 '%s has to be a real matrix',D_name);
23end
24
25% check dimension
26if (size(C,1) ~= size(C,2))
27 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
28 '%s is not a square matrix',C_name);
29end
30if (size(D,1) ~= size(D,2))
31 error('MATLAB:Q_CT_MAP_ParsePara:InvalidInput',...
32 '%s is not a square matrix',D_name);
33end
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);
37end
38
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);
43end
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);
48end
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);
53end
54
55% check zero row sum
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);
59end