Path A: independently evaluate exp(l_i * log_delta) and exp(m_i * log_tau) for every term, the way the live all() does today. Returns a sink to defeat DCE.
| 134 | // Path A: independently evaluate exp(l_i * log_delta) and exp(m_i * log_tau) for |
| 135 | // every term, the way the live all() does today. Returns a sink to defeat DCE. |
| 136 | double path_A(const std::vector<double>& ls, const std::vector<double>& ms, double log_delta, double log_tau) { |
| 137 | double acc = 0.0; |
| 138 | const std::size_t Nl = ls.size(), Nm = ms.size(); |
| 139 | for (std::size_t i = 0; i < Nl; ++i) |
| 140 | acc += std::exp(ls[i] * log_delta); |
| 141 | for (std::size_t i = 0; i < Nm; ++i) |
| 142 | acc += std::exp(ms[i] * log_tau); |
| 143 | return acc; |
| 144 | } |
| 145 | |
| 146 | // Path B: precompute one exp() per unique exponent, then do a small linear-search |
| 147 | // lookup per term to fetch the cached value. Realistic for the typical case where |
no test coverage detected