MCPcopy Create free account
hub / github.com/davisking/dlib / find_nn

Method find_nn

dlib/global_optimization/global_function_search.cpp:514–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512 // ------------------------------------------------------------------------------------
513
514 double funct_info::find_nn (
515 const std::vector<function_evaluation>& evals,
516 const matrix<double,0,1>& x
517 )
518 {
519 double best_y = 0;
520 double best_dist = std::numeric_limits<double>::infinity();
521 for (auto& v : evals)
522 {
523 double dist = length_squared(v.x-x);
524 if (dist < best_dist)
525 {
526 best_dist = dist;
527 best_y = v.y;
528 }
529 }
530 return best_y;
531 }
532
533 } // end namespace gopt_impl
534

Callers

nothing calls this directly

Calls 1

length_squaredFunction · 0.50

Tested by

no test coverage detected