void problem6() { const unsigned int NUM = 100; unsigned long difference = squared_sum(NUM) - summed_square(NUM); std::cout << "The difference between the sum of the squares of the first " << NUM << " natural numbers and the square of the sum is " << difference << std::endl; };
DoubleReal ElutionPeakDetection::computeMassTraceNoise(const MassTrace& tr) { // compute RMSE DoubleReal squared_sum(0.0); std::vector<DoubleReal> smooth_ints(tr.getSmoothedIntensities()); for (Size i = 0; i < smooth_ints.size(); ++i) { squared_sum += (tr[i].getIntensity() - smooth_ints[i])*(tr[i].getIntensity() - smooth_ints[i]); } DoubleReal rmse(0.0); if (smooth_ints.size() > 0) { rmse = std::sqrt(squared_sum/smooth_ints.size()); } return rmse; }