Skip to content

Commit

Permalink
Fix the tuple unpacking for now
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhbell committed Aug 19, 2024
1 parent 92f9960 commit f74c747
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/teqp/algorithms/pure_param_optimization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ class PureParameterOptimizer{

template<typename T>
auto cost_function(const T& x) const{
auto [model, helpers] = prepare(x);
const auto [_model, _helpers] = prepare(x);
const auto& model = _model;
const auto& helpers = _helpers;
double cost = 0.0;
for (const auto& contrib : contributions){
cost += std::visit([&model](const auto& c){ return c.calculate_contribution(model); }, contrib);
Expand All @@ -226,7 +228,9 @@ class PureParameterOptimizer{
template<typename T>
auto cost_function_threaded(const T& x, std::size_t Nthreads) {
boost::asio::thread_pool pool{Nthreads}; // Nthreads in the pool
const auto [model, helpers] = prepare(x);
const auto [_model, _helpers] = prepare(x);
const auto& model = _model;
const auto& helpers = _helpers;
std::valarray<double> buffer(contributions.size());
std::size_t i = 0;
for (const auto& contrib : contributions){
Expand Down

0 comments on commit f74c747

Please sign in to comment.