LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
CheckPHRepresentation.m
1% r = CheckPHRepresentation(alpha, A, prec)
2%
3% Checks if the given vector and matrix define a valid phase-
4% type representation.
5%
6% Parameters
7% ----------
8% alpha : matrix, shape (1,M)
9% Initial vector of the phase-type distribution to check
10% A : matrix, shape (M,M)
11% Transient generator of the phase-type distribution to
12% check
13% prec : double, optional
14% Numerical precision. The default value is 1e-14.
15%
16% Returns
17% -------
18% r : bool
19% True, if vector alpha is a probability vector and matrix
20% A is a transient generator, and they have the same size.
21
22function r = CheckPHRepresentation (alpha, A, prec)
23
24 global BuToolsVerbose;
25 global BuToolsCheckPrecision;
26 if isempty(BuToolsCheckPrecision)
27 BuToolsCheckPrecision = 1e-14;
28 end
29
30 if ~exist('prec','var')
31 prec = BuToolsCheckPrecision;
32 end
33
34 if length(alpha)~=size(A,1)
35 if BuToolsVerbose
36 fprintf ('CheckPHRepresentation:the vector and the matrix have different sizes!\n');
37 end
38 r = false;
39 return;
40 end
41
42 if ~CheckGenerator(A,true,prec) || ~CheckProbVector(alpha,true,prec)
43 r = false;
44 return;
45 end
46
47 r = true;
48end