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);
22c=zeros(1,1+S);
23w=zeros(1,1+S);
24for i=0:S
25 c(1+i)=2*(S-i)+M;
26 w(1+i)=2^-(2*S)*(-1)^i*c(1+i)^(2*S+1)/factorial(i)/factorial(i+c(1+i));
27 [s,bvec,SD,D]=sprod(M,S-i); bvec=bvec';
28 while bvec(1)>=0
29 H(1+i) = H(1+i) + prod((((2*bvec+1)/c(1+i))*L).^N);
30 [s,bvec]=sprod(s,SD,D); bvec=bvec';
31 end
32 G = G + w(1+i)*H(1+i);
33end
34G=G*factorial(sum(N)+M-1)/prod(factorial(N));
35end