LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_CT_MMAPK_ParsePara.m
1function Q_CT_MMAPK_ParsePara(D0,D0_name,D,D_name)
2%Q_CT_MMAPK_ParsePara checks the validity of the input matrices D0, D as a
3%representation of a Continuous-Time MMAP[K]. D{i} holds the mxm matrix D_i.
4
5% check numeric
6if (~isnumeric(D0))
7 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
8 '%s has to be numeric',D0_name);
9end
10K=size(D,2);
11for i=1:K
12 if (~isnumeric(D{i}))
13 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
14 '%s_%d has to be numeric',D_name, i);
15 end
16end
17
18% check real
19if (~isreal(D0))
20 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
21 '%s has to be a real matrix',D0_name);
22end
23for i=1:K
24 if (~isreal(D{i}))
25 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
26 '%s_%d has to be a real matrix',D_name,i);
27 end
28end
29
30% check dimension
31if (size(D0,1) ~= size(D0,2))
32 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
33 '%s is not a square matrix',D0_name);
34end
35for i=1:K
36 if (size(D{i},1) ~= size(D{i},2))
37 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
38 '%s_%d is not a square matrices',D_name,i);
39 end
40end
41
42if (size(D0,1) ~= size(D{1},1))
43 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
44 'The matrices %s and %s_1 do not have the same dimension',D0_name,D_name);
45end
46for i=1:K-1
47 if (size(D{i},1) ~= size(D{i+1},1))
48 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
49 'The matrices %s_%d and %s_d do not have the same dimension',D_name,i,D_name,i+1);
50 end
51end
52
53% check negativity of the diagonal entries of D0
54if (max(diag(D0)) > 10^(-14))
55 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
56 'Some diagonal entries of the matrix %s are not negative',D0_name);
57end
58% check nonnegativity of the off-diagonal entries of D0
59if (min(min(D0-diag(diag(D0)) )) < -10^(-14))
60 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
61 'Some off-diagonal entries of the matrix %s are negative',D0_name);
62end
63% check nonnegativity of matrices D{i}
64for i=1:K
65 if (min(min(D{i})) < -10^(-14))
66 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
67 'The matrix %s_%d contains negative data',D_name,i);
68 end
69end
70% check zero row sum
71Dsum = D0;
72for i = 1:K
73 Dsum = Dsum + D{i};
74end
75if (max(sum(Dsum,2)) > 10^(-14)) || (min(sum(Dsum,2)) < -10^(-14))
76 error('MATLAB:Q_CT_MMAPK_ParsePara:InvalidInput',...
77 'The matrix %s+%s_1+...+%s_K must have zero row sum',D0_name,D_name,D_name);
78end