1classdef MAP < MarkovModulated
2 % Markovian Arrival Process
for correlated arrival modeling
4 % Models arrival streams with correlation and burstiness via D0 and D1 matrices.
6 % Copyright (c) 2012-2026, Imperial College London
11 function self = MAP(D0,D1)
12 % MAP Create a Markovian Arrival Process instance
14 % @brief Creates a MAP with specified D0 and D1 matrices
15 % @param D0 Generator matrix
for transitions without arrivals
16 % @param D1 Rate matrix
for transitions with arrivals
17 % @
return self MAP instance with specified matrices
19 self@MarkovModulated(
'MAP',2);
20 if nargin < 2 && iscell(D0)
25 setParam(self, 1,
'D0', D0);
26 setParam(self, 2,
'D1', D1);
27 self.process = {D0,D1};
28 if ~map_isfeasible(self.D)
29 line_warning(mfilename,'MAP
is infeasible.\n');
33 function n = getNumberOfPhases(self)
37 function Di = D(self, i, wantSparse)
43 % Return representation matrix, e.g., D0=MAP.D(0)
48 Di=self.getProcess{i+1};
57 Di=full(self.getProcess{i+1});
62 function meant = evalMeanT(self, t)
63 % MEANT = EVALMEANT(SELF,T)
65 meant = map_count_mean(self.D, t);
68 function vart = evalVarT(self, t)
69 % VART = EVALVART(SELF,T)
71 % Evaluate the variance-time curve at timescale t
72 vart = map_count_var(self.D, t);
75 function acf = evalACFT(self, lags, timescale)
76 % ACF = EVALACFT(self, lags)
78 % Evaluate the autocorrelation in counts at timescale t
80 acf = map_acfc(self.D, lags, timescale);
83 function acf = getACF(self, lags)
84 % ACF = GETACF(self, lags)
86 acf = map_acf(self.D,lags);
89 function [gamma2, gamma] = getACFDecay(self)
90 % [gamma2, gamma] = GETACFDECAY(self)
92 % gamma2: asymptotic decay rate of acf
93 % gamma: interpolated decay rate of acf
95 gamma2 = map_gamma2(self.D);
97 gamma = map_gamma(self.D);
101 function
id = getIDC(self, t) % index of dispersion
for counts
102 % IDC = GETIDC() % ASYMPTOTIC INDEX OF DISPERSION
105 id = map_idc(self.D);
107 id = map_count_var(self.D,t) / map_count_mean(self.D,t);
111 function lam = getRate(self)
114 lam = map_lambda(self.D);
117 function mapr = toTimeReversed(self)
118 mapr = MAP(map_timereverse(self.D));
121 function X = sample(self, n)
123 if nargin<2 %~exist('n','var'),
126 MAP = self.getProcess;
127 if map_isfeasible(MAP)
128 X = map_sample(MAP,n);
130 line_error(mfilename,'This process
is infeasible (negative rates).');
134 function self = setMean(self,MEAN)
135 % UPDATEMEAN(SELF,MEAN)
136 % Update parameters to match the given mean
137 newMAP = map_scale(self.D,MEAN);
138 self.params{1}.paramValue = newMAP{1};
139 self.params{2}.paramValue = newMAP{2};
142 function
bool = isImmediate(self)
143 bool = self.getMean < GlobalConstants.FineTol;
150 function
map = rand(order)
153 % Generate random MAP
using uniform random numbers
157 map = MAP(map_rand(order));
160 function
map = randn(order, mu, sigma)
161 % MAP = RANDN(ORDER, MU, SIGMA)
163 % Generate random MAP
using specified Gaussian parameter and
164 % taking the absolute value of the resulting values
165 map = MAP(map_randn(order, mu, sigma));