LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
cache_prob_spm.m
1%{ @file cache_prob_spm.m
2 % @brief Computes cache hit probabilities using saddle-point method
3 %
4 % @author LINE Development Team
5%}
6
7%{
8 % @brief Computes cache hit probabilities using saddle-point approximation
9 %
10 % @details
11 % This function computes cache hit probability distribution using the
12 % saddle-point method (SPM) for approximation.
13 %
14 % @par Syntax:
15 % @code
16 % prob = cache_prob_spm(gamma, m)
17 % prob = cache_prob_spm(gamma, m, lE)
18 % @endcode
19 %
20 % @par Parameters:
21 % <table>
22 % <tr><th>Name<th>Description
23 % <tr><td>gamma<td>Item popularity probabilities
24 % <tr><td>m<td>Cache capacity vector
25 % <tr><td>lE<td>(Optional) Pre-computed log of normalizing constant
26 % </table>
27 %
28 % @par Returns:
29 % <table>
30 % <tr><th>Name<th>Description
31 % <tr><td>prob<td>Cache hit probability distribution
32 % </table>
33%}
34function prob = cache_prob_spm(gamma,m, lE)
35[n,h]=size(gamma);
36if nargin < 3
37[~, lE] = cache_spm(gamma,m);
38end
39for i=1:n
40 for j=1:h
41 [~, lEi] = cache_spm(gamma(setdiff(1:n,i),:),oner(m,j));
42 prob(i,1+j) = m(j) * gamma(i,j) * exp(lEi-lE);
43 end
44 prob(i,1) = abs(1 - sum(prob(i,2:end)));
45end
46end