1function d = map_dist_acf(MAPA,MAPB,alA,alB)
2% d=map_dist_acf(MAPA,MAPB,alA,alB) - Squared L2 distance between the
3% autocorrelation functions of two MAPs.
6% G. Horvath,
"Measuring the distance between MAPs and some
7% applications," in Proc. ASMTA 2015, LNCS 9081, pp. 95-109.
11% MAPA: first MAP in the form of {D0,D1}
12% MAPB: second MAP in the form of {D0,D1}
13% alA,alB: (optional) stationary vectors at arrival epochs
16% d: squared L2 distance of autocorrelation functions
18A0=MAPA{1}; B0=MAPB{1};
19if nargin<4, alB=map_pie(MAPB); end
20if nargin<3, alA=map_pie(MAPA); end
22momA = map_moment(MAPA, [1 2]);
23momB = map_moment(MAPB, [1 2]);
24mA = momA(1); mB = momB(1);
28d = (map_geo_mul_sum(MAPA,MAPA,alA,alA) - momA(2)^2/4) / varA^2 ...
29 - 2*(map_geo_mul_sum(MAPA,MAPB,alA,alB) - momA(2)*momB(2)/4) / varA / varB ...
30 + (map_geo_mul_sum(MAPB,MAPB,alB,alB) - momB(2)^2/4) / varB^2;