LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
CheckDMMAPRepresentation.m
1% r = CheckDMMAPRepresentation(D, prec)
2%
3% Checks if the input matrixes define a discrete time MMAP.
4%
5% All matrices D0...DK must have the same size, D0 must be a
6% transient probability matrix, D1 has only non-negative
7% elements, and the rowsum of D0+D1+...+DK is 1 (up to the
8% numerical precision).
9%
10% Parameters
11% ----------
12% D : list/cell of matrices, length(K)
13% The D0...DK matrices of the DMMAP to check
14%
15% Returns
16% -------
17% r : bool
18% The result of the check
19
20function r = CheckDMMAPRepresentation(D,prec)
21% CheckDMMAPRepresentation [ (vector of D0, D1 .. DM), prec[10^-14] ] :
22% Checks if the input matrixes define a discrete time MMAP: D0 and
23% the sum of D1..DM define a DMAP. 'prec' is the numerical precision.
24
25 global BuToolsVerbose;
26 global BuToolsCheckPrecision;
27 if isempty(BuToolsCheckPrecision)
28 BuToolsCheckPrecision = 1e-12;
29 end
30
31 if ~exist('prec','var')
32 prec = BuToolsCheckPrecision;
33 end
34
35 if min(min(cell2mat(D(2:end)))) < -prec
36 if BuToolsVerbose
37 fprintf ('CheckDMMAPRepresentation: One of the matrices D1 ... DM has a negative element!\n');
38 end
39 r=0;
40 return;
41 end
42
43 r = CheckDMAPRepresentation(D{1},SumMatrixList(D(2:end)),prec);
44
45end