1function d = dmap_dist(DMAPA,DMAPB,L,alA,alB)
2% d=dmap_dist(DMAPA,DMAPB,L,alA,alB) - Squared L2 distance between the
3% lag-L joint PMFs of two discrete-time MAPs.
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.
10% Discrete-time extension by QORE Lab (https:
13% DMAPA: first D-MAP in the form of {D0,D1}
14% DMAPB: second D-MAP in the form of {D0,D1}
15% L: number of lags (L=1 for lag-1 joint PMF distance)
16% alA,alB: (optional) stationary vectors at arrival epochs
19% d: squared L2 distance
21NA = size(DMAPA{1},1); NB = size(DMAPB{1},1);
22if nargin<5, alB=dtmc_solve(inv(eye(NB)-DMAPB{1})*DMAPB{2}); end
23if nargin<4, alA=dtmc_solve(inv(eye(NA)-DMAPA{1})*DMAPA{2}); end
24d = dmap_exp_mul_int(DMAPA,DMAPA,L+1,alA,alA) ...
25 - 2*dmap_exp_mul_int(DMAPA,DMAPB,L+1,alA,alB) ...
26 + dmap_exp_mul_int(DMAPB,DMAPB,L+1,alB,alB);