/*
* Estimate the variance. sigma_sq = 1/n (sumxsq - 1/n sumx^2) or
* 1/n sumxsq - mean^2.
*/
D1Matrix64F tmp = variance; // borrow as an intermediate array.
MatrixOps.elementSquare(mean, tmpArray);
CommonOps.scale(1.0 / numSamples, sumxsq, tmp);
CommonOps.sub(tmp, tmpArray, variance);