4 % @brief Convolution Algorithm
for exact normalizing constant computation.
8function [Gn,lGn]=pfqn_ca(L,N,Z)
11 % @brief Convolution Algorithm
for exact normalizing constant computation.
12 % @fn pfqn_ca(L, N, Z)
13 % @param L Service demand matrix.
14 % @param N Population vector.
15 % @param Z Think time vector.
16 % @
return Gn Normalizing constant.
17 % @
return lGn Logarithm of the normalizing constant.
22 lGn = - sum(factln(N)) + sum(N.*log(sum(Z,1)));
40if nargin<3 || isempty(Z)
44G = ones(M+1,prod(N+1)); % stores G across recursion
50 G(m,idxn) = G(m-1,idxn); % norm constant with m-1 queues
54 idxn_1r = hashpop(n,N);
56 G(m,idxn) = G(m,idxn) + L(m-1,r)*G(m,idxn_1r);
66function idx=hashpop(n,N,R,prods)
67% IDX=HASHPOP(N,N,R,PRODS)
69% hash a population vector in n: 0<=n<=N
74 idx= idx + prod(N(1:r-1)+1)*n(r);
79 idx= idx + prods(r)*n(r);
84function [n]=pprod(n,N)
87% sequentially generate all vectors n: 0<=n<=N
89% n=pprod(n,N) - next state
103while s>0 && n(s)==N(s)