1 #ifndef NPSTAT_SUMOFSQUARES_HH_
2 #define NPSTAT_SUMOFSQUARES_HH_
20 template<
typename Numeric>
21 typename PreciseType<Numeric>::type sumOfSquares(
22 const Numeric* data,
const unsigned long len)
24 typedef typename PreciseType<Numeric>::type Precise;
25 Precise sum = Precise();
29 for (
unsigned long i=0; i<len; ++i)
31 const Precise v =
static_cast<Precise
>(data[i]);
39 template<
typename Numeric>
40 inline double sumOfSquares2(
const Numeric* x,
const unsigned long xLen)
42 return sumOfSquares(x, xLen);
Compile-time deduction of an appropriate precise numeric type.
Definition: AbsArrayProjector.hh:14