private function computeCovariance()
{
$factorCallable = $this->coVarianceFactor;
$this->factor = $factorCallable();
// Cache covariance and inverse covariance of the data
if (null === $this->_dataInvCov) {
// original used the numpy.cov function.
$this->_dataCovariance = pow(Statistics::stdev($this->dataset, true), 2);
//$this->_dataInvCov = 1/ linalg.inv($this->_dataCovariance)
$this->_dataInvCov = 1 / $this->_dataCovariance;
}
$this->covariance = $this->_dataCovariance * pow($this->factor, 2);
$this->invCov = $this->_dataInvCov / pow($this->factor, 2);
$this->normFactor = sqrt(2 * M_PI * $this->covariance) * count($this->dataset);
}