Example #1
0
static void fillStats(C1<Stat> &stats, const Interval &iv, const C2<Value> &vals)
{
    int i = 0, n = stats.size(), dt = iv.secs();
    typename C1<Stat>::iterator st = stats.begin();
    typename C2<Value>::const_iterator v1 = vals.begin(), v2 = vals.begin(); ++v2;
    while(v2 != vals.end() && st != stats.end())
    {
        Interval vi(v1->tm, v2->tm);//, ci(iv.t1 + i*dt/n, iv.t1 + (i + 1)*dt/n);
        uint t = iv.t1 + int((i + 0.5f)*dt/n);
        if(v2->value != v2->value) vi.t2 = vi.t1 + 1;
        if(vi.contains(t) && v1->value == v1->value)
        {
        	//typename C1<Stat>::iterator pst = st;
        	//if(pst != stats.begin()) (--pst)->add(v1->value);
        	st->add(v1->value);
        }
        if(t < vi.t2) ++st, ++i; else ++v1, ++v2;
    }
}
Example #2
0
File: copy.hpp Project: psiha/nt2
 inline void copy(C1 const& a, cuda_buffer<T> &b, cudaStream_t stream = 0)
 {
   b.resize(a.size());
   copy(a,b,nt2::host_{},nt2::device_{},stream);
 }
Example #3
0
	double impl(C1 const& estimates, C2 const& answers, bool is_sorted, F&& compare_func) const
	{
		return static_cast<double>(set_intersection_num(estimates, answers, is_sorted, std::forward<F>(compare_func))) / estimates.size();
	}