LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
Q_DT_MMAPK_ParsePara.m
1function Q_DT_MMAPK_ParsePara(D0,D0_name,D,D_name)
2%Q_DT_MMAPK_ParsePara checks the validity of the input matrices D0, D as a
3%representation of a Discrete-Time MMAP[K]. D{i} holds the mxm matrix D_i.
4
5% check numeric
6if (~isnumeric(D0))
7 error('MATLAB:Q_DT_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_DT_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_DT_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_DT_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_DT_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_DT_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_DT_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_DT_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 nonnegativity
54if (min(min(D0)) < -10^(-14))
55 error('MATLAB:Q_DT_MMAPK_ParsePara:InvalidInput',...
56 'The matrix %s contains negative data', D0_name);
57end
58for i=1:K
59 if (min(min(D{i})) < -10^(-14))
60 error('MATLAB:Q_DT_MMAPK_ParsePara:InvalidInput',...
61 'The matrix %s_%d contains negative data',D_name,i);
62 end
63end
64
65% check (sub)stochasticity
66if (max(sum(D0,2)) > 1+10^(-14))
67 error('MATLAB:Q_DT_MMAPK_ParsePara:InvalidInput',...
68 'The matrix %s has to be substochastic', D0_name);
69end
70Dsum = D0;
71for i = 1:K
72 Dsum = Dsum + D{i};
73end
74if (max(sum(Dsum,2)) > 1+10^(-14))||(min(sum(Dsum,2)) < 1-10^(-14))
75 error('MATLAB:Q_DT_MMAPK_ParsePara:InvalidInput',...
76 'The matrix %s+%s_1+...+%s_K has to be stochastic', D0_name,D_name,D_name);
77end