1% r = CheckMGRepresentation(alpha, A, prec)
3% Checks
if the given vector and matrix define a valid matrix-
4% geometric representation.
8% alpha : matrix, shape (1,M)
9% Initial vector of the matrix-geometric distribution
11% A : matrix, shape (M,M)
12% Matrix parameter of the matrix-geometric distribution
14% prec : double, optional
15% Numerical precision. The
default value
is 1e-14.
20% True,
if the matrix
is a square matrix, the vector and
21% the matrix have the same size, the dominant eigenvalue
22%
is positive, less than 1 and real.
26% This procedure does not check the positivity of the density!
27% The discrete counterpart of
'CheckMEPositiveDensity' does
28% not exist yet (research
is needed).
30function r = CheckMGRepresentation(alpha, A, prec)
33 global BuToolsCheckPrecision;
34 if isempty(BuToolsCheckPrecision)
35 BuToolsCheckPrecision = 1e-14;
38 if ~exist(
'prec',
'var')
39 prec = BuToolsCheckPrecision;
42 if size(A,1) ~= size(A,2)
44 fprintf('CheckMGRepresentation: The matrix
is not a quadratic matrix!\n');
50 if size(alpha,2) ~= size(A,1)
52 fprintf('CheckMGRepresentation: The vector and the matrix have different sizes!\n');
58 if sum(alpha)<-prec || sum(alpha)>1+prec
60 fprintf ('CheckMGRepresentation: The sum of the vector elements
is less than zero or greater than one (precision: %g)!\n',prec);
71 fprintf('CheckMGRepresentation: The largest eigenvalue of the matrix
is complex!\n');
79 fprintf('CheckMGRepresentation: The largest eigenvalue of the matrix
is greater than 1 (precision: %g)!\n',prec);
85 if sum(abs(ev(1:end))==abs(maxev)) > 1
87 fprintf('CheckMGRepresentation Warning: There are more than one eigenvalue with the same absolute value as the largest eigenvalue!\n');