void IncrementalStatistics::add(Real value, Real valueWeight) {
     QL_REQUIRE(valueWeight >= 0.0, "negative weight (" << valueWeight
                                                        << ") not allowed");
     acc_(value, boost::accumulators::weight = valueWeight);
     if(value < 0.0)
         downsideAcc_(value, boost::accumulators::weight = valueWeight);
 }
Esempio n. 2
0
int main(int argc, char *argv[])
{
    unsigned char __attribute__ ((aligned (16) )) mask[] = {0, 0, 0, 0,  0, 0, 0, 0,  0, 1, 0, 0,  1, 0, 0, 1};
    unsigned char __attribute__ ((aligned (16) )) src[3*N];
    float __attribute__ ((aligned (16) )) dst[3*N];
    float __attribute__ ((aligned (16) )) exp[3*N];

    int i;

    /* initialize src and dst */
    for (i=0; i<3*N; i++) src[i] = (unsigned char)(i*3);
    for (i=0; i<3*N; i++) {dst[i] = i * 1.0f; exp[i] = dst[i];}

    acc_(src, exp, mask, N);
    acc_simd_(src, dst, mask, N);

    for (i=0; i<N; i++)
    {
        if ((dst[3*i] != exp[3*i]) || (dst[3*i+1] != exp[3*i+1]) || (dst[3*i+2] != exp[3*i+2]))
	  __builtin_abort ();
    }

    return 0;
}
Esempio n. 3
0
 /** Aquire a new sample and add this to the total sum */
 void sample()
 {
     LOG_TRACE("acquire sample");
     acc_(sample_());
 }
Esempio n. 4
0
	private: void do_collect(value_type obs, value_type /*ignored_weight*/)
	{
		acc_(obs);
	}
 void TimeAccumulator::registerTime(double time)
 {
   acc_(time);
 }
 void Counter::add(double v)
 {
   acc_(v);
 }
 /**
  * @brief Simple forward to the accessor
  * @param id The elment id of the element on which the vector is stored on
  * @return A vector as std::vector<double>
  */
 std::vector<double> get(std::size_t id) const
 {
   return acc_(viennagrid::elements<ElementTagT>(dev_.mesh())[id]);
 }
 void operator=(accessor_based_array_quantity_wrapper const & o)
 {
   this->set_name(o.name());
   dev_(o.dev_); acc_(o.acc_);
 }