1% r = CheckMAPRepresentation(D0, D1, prec)
3% Checks
if the input matrixes define a continuous time MAP.
5% Matrices D0 and D1 must have the same size, D0 must be a
6% transient generator matrix, D1 has only non-negative
7% elements, and the rowsum of D0+D1
is 0 (up to the numerical
12% D0 : matrix, shape (M,M)
13% The D0 matrix of the MAP to check
14% D1 : matrix, shape (M,M)
15% The D1 matrix of the MAP to check
16% prec : double, optional
17% Numerical precision, the default value
is 1e-14
22% The result of the check
24function r = CheckMAPRepresentation (D0, D1, prec)
26 global BuToolsVerbose;
27 global BuToolsCheckPrecision;
28 if isempty(BuToolsCheckPrecision)
29 BuToolsCheckPrecision = 1e-12;
32 if ~exist(
'prec',
'var')
33 prec = BuToolsCheckPrecision;
36 if ~CheckGenerator(D0,1,prec)
43 fprintf ('CheckMAPRepresentation: D0 and D1 have different sizes!\n');
51 fprintf ('CheckMAPRepresentation: D1 has negative element (precision: %g)!\n', prec);
57 if any(abs(sum(D0+D1,2))>prec)
59 fprintf ('CheckMAPRepresentation: The rowsum of D0+D1
is not 0 (precision: %g)!\n', prec);