LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
pfqn_grnmol.m
1%{
2%{
3 % @file pfqn_grnmol.m
4 % @brief Normalizing constant using Grundmann-Moeller quadrature.
5%}
6%}
7
8%{
9%{
10 % @brief Normalizing constant using Grundmann-Moeller quadrature.
11 % @fn pfqn_grnmol(L, N)
12 % @param L Service demand matrix.
13 % @param N Population vector.
14 % @return G Normalizing constant.
15%}
16%}
17function G=pfqn_grnmol(L,N)
18[M,R]=size(L);
19G=0;
20S=ceil(sum(N)-1)/2;
21H=zeros(1+S,1);
22for i=0:S
23 c(1+i)=2*(S-i)+M;
24 w(1+i)=2^-(2*S)*(-1)^i*c(1+i)^(2*S+1)/factorial(i)/factorial(i+c(1+i));
25 [s,bvec,SD,D]=sprod(M,S-i); bvec=bvec';
26 while bvec(1)>=0
27 H(1+i) = H(1+i) + prod((((2*bvec+1)/c(1+i))*L).^N);
28 [s,bvec]=sprod(s,SD,D); bvec=bvec';
29 end
30 G = G + w(1+i)*H(1+i);
31end
32G=G*factorial(sum(N)+M-1)/prod(factorial(N));
33end