LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
mexify.m
1% @brief MATLAB Coder script to generate MEX functions for cache_ module.
2%
3% This script generates MEX (MATLAB Executable) versions of cache_ functions
4% for improved performance. Cache functions compute hit/miss probabilities
5% and normalizing constants for cache replacement models.
6%
7% Skipped functions (Coder-incompatible):
8% cache_mva - State.cartesian() OOP dependency
9% cache_t_hlru - nested bisection helper (function handles)
10% cache_ttl_lrua - fsolve() + rng() + function handles
11% cache_rrm_meanfield - ode23s() script (not a function)
12%
13% See also CODER, CODER.CONFIG, CODER.TYPEOF, CODEGEN.
14
15%% Create configuration object of class 'coder.CodeConfig'.
16cfg = coder.config('mex','ecoder',false);
17cfg.GenerateReport = false;
18cfg.ReportPotentialDifferences = false;
19cfg.GenCodeOnly = false;
20
21%% Define common types
22scal_type = coder.typeof(0);
23vec_type = coder.typeof(0,[1 Inf],[0 1]);
24mat_type = coder.typeof(0,[Inf Inf],[1 1]);
25
26%% ===== Group: Normalizing constant computations =====
27
28% cache_erec(gamma, m) -> E
29codegen -config cfg cache_erec -args {vec_type, scal_type}
30
31% cache_is(gamma, m, samples) -> [E, lE]
32codegen -config cfg cache_is -args {vec_type, scal_type, scal_type}
33
34% cache_spm(gamma, m, xi0) -> [Z, lZ, xi]
35codegen -config cfg cache_spm -args {vec_type, scal_type, vec_type}
36
37%% ===== Group: Hit probability computations =====
38
39% cache_prob_erec - Skipped (cache_erec compile-time recursion exceeds codegen limit)
40% codegen -config cfg cache_prob_erec -args {vec_type, scal_type}
41
42% cache_prob_fpi(gamma, m) -> prob
43codegen -config cfg cache_prob_fpi -args {vec_type, scal_type}
44
45% cache_prob_spm - Skipped (calls cache_spm with reduced gamma, triggers cache_erec recursion limit)
46% codegen -config cfg cache_prob_spm -args {vec_type, scal_type, vec_type}
47
48% cache_prob_is - Skipped (calls cache_is which uses randperm, not codegen-compatible)
49% codegen -config cfg cache_prob_is -args {vec_type, scal_type, scal_type}
50
51%% ===== Group: Miss rate computations =====
52
53% cache_miss - Skipped (calls cache_erec directly, recursion limit)
54% codegen -config cfg cache_miss -args {vec_type, scal_type, vec_type}
55
56% cache_miss_fpi - Skipped (calls cache_miss -> cache_erec)
57% codegen -config cfg cache_miss_fpi -args {vec_type, scal_type, vec_type}
58
59% cache_miss_spm - Skipped (calls cache_miss -> cache_erec)
60% codegen -config cfg cache_miss_spm -args {vec_type, scal_type, vec_type}
61
62% cache_miss_is - Skipped (calls cache_miss -> cache_erec)
63% codegen -config cfg cache_miss_is -args {vec_type, scal_type, vec_type, scal_type}
64
65%% ===== Group: MVA miss computation =====
66
67% cache_mva_miss(p, m, R) -> [M, Mk]
68codegen -config cfg cache_mva_miss -args {vec_type, scal_type, mat_type}
69
70%% ===== Group: Parameter computation =====
71
72% cache_gamma_lp(lambda, R) -> [gamma, u, n, h]
73codegen -config cfg cache_gamma_lp -args {vec_type, mat_type}
74
75%% ===== Group: Fixed-point iterations =====
76
77% cache_xi_fp(gamma, m, xi) -> [xi, pi0, pij, it]
78codegen -config cfg cache_xi_fp -args {vec_type, scal_type, vec_type}
79
80% cache_xi_iter(gamma, m, tmax) -> z
81codegen -config cfg cache_xi_iter -args {vec_type, scal_type, scal_type}
82
83%% ===== Group: TTL approximations =====
84
85% cache_ttl_hlru - Skipped (nested bisection helper, not codegen-compatible)
86% codegen -config cfg cache_ttl_hlru -args {vec_type, scal_type}
87
88%% ===== Group: ODE helper =====
89
90% cache_rrm_meanfield_ode(t, x, lambda, m, n, h) -> dxdt
91codegen -config cfg cache_rrm_meanfield_ode -args {scal_type, vec_type, vec_type, scal_type, scal_type, scal_type}