LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
dmap_dist_lag1.m
1function d = dmap_dist_lag1(DMAPA,DMAPB,alA,alB)
2% d=dmap_dist_lag1(DMAPA,DMAPB,alA,alB) - Lag-1 joint PMF L2 distance
3% via Kronecker/Lyapunov formulation. Equivalent to dmap_dist(DMAPA,DMAPB,1).
4%
5% Reference (continuous-time formulation):
6% G. Horvath, "Measuring the distance between MAPs and some
7% applications," in Proc. ASMTA 2015, LNCS 9081, pp. 95-109.
8% https://link.springer.com/chapter/10.1007/978-3-319-18579-8_8
9%
10% Discrete-time extension by QORE Lab (https://qore.doc.ic.ac.uk/)
11%
12% Input:
13% DMAPA: first D-MAP in the form of {D0,D1}
14% DMAPB: second D-MAP in the form of {D0,D1}
15% alA,alB: (optional) stationary vectors at arrival epochs
16%
17% Output:
18% d: squared L2 distance of lag-1 joint PMFs
19
20D0A=DMAPA{1}; D1A=DMAPA{2};
21D0B=DMAPB{1}; D1B=DMAPB{2};
22NA = size(D0A,1); NB = size(D0B,1);
23if nargin<4, alB=dtmc_solve(inv(eye(NB)-D0B)*D1B); end
24if nargin<3, alA=dtmc_solve(inv(eye(NA)-D0A)*D1A); end
25
26a = sum(eye(NA)-D0A, 2);
27b = sum(eye(NB)-D0B, 2);
28
29Z_AB = dlyap(D0A', D0B, alA'*alB);
30Z_AA = dlyap(D0A', D0A, alA'*alA);
31Z_BB = dlyap(D0B', D0B, alB'*alB);
32
33X_AB = dlyap(D0A, D0B', a*b');
34X_AA = dlyap(D0A, D0A', a*a');
35X_BB = dlyap(D0B, D0B', b*b');
36
37vD1A = reshape(D1A, numel(D1A), 1);
38vD1B = reshape(D1B, numel(D1B), 1);
39
40d = vD1B'*kron(X_BB,Z_BB)*vD1B + vD1A'*kron(X_AA,Z_AA)*vD1A ...
41 - 2*vD1A'*kron(X_AB,Z_AB)*vD1B;
42end