LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_DT_MAP_ParsePara.m
1function Q_DT_MAP_ParsePara(C,C_name,D,D_name)
2%Q_DT_MAP_ParsePara checks the validity of the input matrices C, D as a
3%representation of a discrete-time MAP.
4
5% check numeric
6if (~isnumeric(C))
7 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
8 '%d has to be numeric',C_name);
9end
10if (~isnumeric(D))
11 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
12 '%s has to be numeric',D_name);
13end
14
15% check real
16if (~isreal(C))
17 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
18 '%s has to be a real matrix',C_name);
19end
20if (~isreal(D))
21 error('MATLAB:Q_DT_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_DT_MAP_ParsePara:InvalidInput',...
28 '%s is not a square matrix',C_name);
29end
30if (size(D,1) ~= size(D,2))
31 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
32 '%s is not a square matrix',D_name);
33end
34if (size(C,1) ~= size(D,1))
35 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
36 'The matrices %s and %s do not have the same dimension',C_name,D_name);
37end
38
39% check nonnegativity
40if (min(min(C)) < -10^(-14))
41 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
42 'The matrix %s contains negative data',C_name);
43end
44if (min(min(D)) < -10^(-14))
45 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
46 'The matrix %s contains negative data',D_name);
47end
48
49
50% check (sub)stochasticity
51if (max(sum(C,2)) > 1+10^(-14))
52 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
53 'The matrix %s has to be substochastic',C_name);
54end
55if (max(sum(C+D,2)) > 1+10^(-14))||(min(sum(C+D,2)) < 1-10^(-14))
56 error('MATLAB:Q_DT_MAP_ParsePara:InvalidInput',...
57 'The matrix %s+%s has to be stochastic',C_name+D_name);
58end