MCPcopy Create free account
hub / github.com/CoolProp/CoolProp / path_A

Function path_A

src/Tests/CoolProp-Tests-TermCacheProfile.cpp:136–144  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
136double 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

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected