|
1 #ifndef NPSTAT_COORDANDWEIGHT_HH_
2 #define NPSTAT_COORDANDWEIGHT_HH_
23 template< typename Numeric>
24 inline void coordAndWeight( const Numeric& r,
31 template< typename Num1, typename Num2>
32 inline void coordAndWeight( const std::pair<Num1, Num2>& r,
39 template< typename Numeric>
43 : value( static_cast<Numeric >(x)) {}
47 template< typename Num1, typename Num2>
52 std::pair<Num1, Num2> value;
55 template< typename Numeric>
59 : value(vec.size()) {}
63 template< typename Num1, typename Num2>
66 inline SampleWeight( const std::vector<std::pair<Num1, Num2> >& vec)
68 long double sum = 0.0L;
69 const unsigned long sz = vec.size();
70 for ( unsigned long i=0; i<sz; ++i)
71 sum += static_cast<long double>(vec[i].second);
77 template< typename Numeric>
81 : value(vec.size()) {}
85 template< typename Num1, typename Num2>
90 long double sum = 0.0L;
91 const unsigned long sz = vec.size();
92 for ( unsigned long i=0; i<sz; ++i)
94 const long double w = static_cast<long double>(vec[i].second);
102 template< typename Numeric>
105 inline static void set(Numeric* , const double* ,
106 const unsigned long )
108 throw std::runtime_error( "In npstat::Private::SetPairSeconds::set: "
109 "array to set is not of pair type");
113 template< typename Num1, typename Num2>
116 inline static void set(std::pair<Num1,Num2>* arr, const double* weights,
117 const unsigned long nWeights)
123 for ( unsigned long i=0; i<nWeights; ++i, ++arr)
124 arr->second = *weights++;
Definition: AbsArrayProjector.hh:14
Definition: coordAndWeight.hh:79
Definition: coordAndWeight.hh:57
Definition: coordAndWeight.hh:104
Definition: coordAndWeight.hh:41
|