26 #ifndef MLN_FUN_X2P_CLOSEST_POINT_HH
27 # define MLN_FUN_X2P_CLOSEST_POINT_HH
29 # include <mln/algebra/vec.hh>
30 # include <mln/norm/l2.hh>
31 # include <mln/core/site_set/p_array.hh>
32 # include <mln/core/site_set/box.hh>
47 typedef algebra::vec<P::dim, float> input;
58 operator () (
const input& Ck)
const
62 algebra::vec<P::dim,float> Cki = Ck;
63 algebra::vec<P::dim,float> best_x = convert::to< algebra::vec<P::dim,float> >(X[0]);
64 float best_d = norm::l2(Cki - best_x);
65 for (
unsigned j = 1; j < X.
nsites(); ++j)
67 algebra::vec<P::dim,float> Xj = convert::to< algebra::vec<P::dim,float> >(X[j]);
68 float d = norm::l2(Cki - Xj);
75 return convert::to<P>(best_x);
78 const box<P>& domain()
const
87 mutable unsigned log_functor_call;
96 #endif // ! MLN_FUN_X2P_CLOSEST_POINT_HH