QVector<int> vector; const int size = vector.size(); double middle = 0.0; const auto end = vector.constEnd(); for (auto it = vector.constBegin(); it != end; ++it) middle += *it; middle /= vector.size(); for (int tau = tauMin; tau < tauMax; tau += step) { double y = 0; const auto iEnd = end - tau; for (auto it = vector.constBegin(); it != iEnd; ++it) y += ((*it) - middle) * ((*(it + tau)) - middle); y /= (size - tau - 1); result.append(QPointF(tau, y)); }
// это один результат for (auto it = vector.constBegin(); it != iEnd; ++it) y += ((*it) - middle) * ((*(it + tau)) - middle);
с = a + b; // хотя бы