26 #ifndef MLN_REGISTRATION_INTERNAL_RMS_HH
27 # define MLN_REGISTRATION_INTERNAL_RMS_HH
29 # include <mln/norm/l2.hh>
30 # include <mln/core/site_set/p_array.hh>
35 namespace registration
41 template <
typename P,
typename M,
typename T>
42 float rms(
const p_array<P>& a1,
44 const unsigned length,
48 # ifndef MLN_INCLUDE_ONLY
51 template <
typename P,
typename M,
typename T>
52 float rms(
const p_array<P>& a,
58 for (
unsigned i = 0; i < a.nsites(); ++i)
60 algebra::vec<P::dim,float> a2f = convert::to< algebra::vec<P::dim,float> >(a[i]);
61 algebra::vec<P::dim,float> a1f =
62 convert::to< algebra::vec<P::dim,float> > \
63 (map(q1(
convert::to< algebra::vec<P::dim,float> >(a[i]))));
65 f += norm::l2(a1f - q2(a2f));
67 return f / a.nsites();
71 # endif // ! MLN_INCLUDE_ONLY
80 #endif // ! MLN_REGISTRATION_INTERNAL_RMS_HH