1function lst = aoi_lst_ph(alpha, T)
2%AOI_LST_PH Laplace-Stieltjes transform
for phase-type distribution
4% lst = aoi_lst_ph(alpha, T)
6% Returns a function handle
for the LST of a phase-type (PH) distribution
7% with initial probability vector alpha and sub-generator matrix T.
10% alpha (row vector): Initial probability vector (1 x n)
11% T (matrix): Sub-generator matrix (n x n)
14% lst (function_handle): LST function @(s) alpha * inv(s*I - T) * (-T*e)
16% The LST of PH(alpha, T)
is: H*(s) = alpha * (s*I - T)^{-1} * t
17% where t = -T * ones(n,1)
is the exit rate vector.
19% For numerical stability, we use: H*(s) = alpha * ((s*I - T) \ t)
21% See also: aoi_lst_exp, aoi_lst_erlang, aoi_lst_det
23% Copyright (c) 2012-2026, Imperial College London
27alpha = alpha(:)'; % Ensure row vector
30if size(T, 1) ~= n || size(T, 2) ~= n
31 line_error(mfilename, 'T must be %d x %d to match alpha', n, n);
40% Return function handle
41lst = @(s) ph_lst_eval(s, alpha, T, t, I);
45function val = ph_lst_eval(s, alpha, T, t, I)
46%PH_LST_EVAL Evaluate PH LST at point(s) s
49 val = alpha * ((s * I - T) \ t);
54 val(i) = alpha * ((s(i) * I - T) \ t);