void mean_quartic_displacement<dimension, float_type>::operator() ( sample_type const& first , sample_type const& second , accumulator<result_type>& result ) { accumulator<result_type> acc; typename sample_type::array_type::const_iterator r1, r2, end = first.data().end(); for (r1 = first.data().begin(), r2 = second.data().begin(); r1 != end; ++r1, ++r2) { // accumulate quartic displacement acc(correlate_function_type()(*r1, *r2)); } result(acc); }
sample_type projection_point(sample_type &u,sample_type &v, sample_type &p) { // the length of the segment trajcomp::default_element_distance_squared<sample_type> d2; double l = d2(u,v); if (fabs(l) < 1E-12) return u; double t = 0; for (size_t i=0; i < u.size(); i++) t += ((v[i]-u[i])*(p[i]-u[i])); t/=l; sample_type proj; for (size_t i=0; i < u.size(); i++) //proj.push_back(v[i]+t*(u[i]-v[i])); proj.push_back(u[i]+t*(v[i]-u[i])); return proj; }
static std::size_t wrap_nparticle(sample_type const& self) { return self.data().size(); }