Another pass at fixing up references

This commit is contained in:
Jeff Moser
2010-09-30 08:25:31 -04:00
parent 5368f7528e
commit 803a0816a8
28 changed files with 168 additions and 103 deletions

View File

@ -15,7 +15,7 @@ function square($x)
return $x * $x;
}
function sum($itemsToSum, $funcName )
function sum(array $itemsToSum, $funcName )
{
$mappedItems = array_map($funcName, $itemsToSum);
return array_sum($mappedItems);

View File

@ -30,8 +30,25 @@ class GaussianDistribution
$this->_mean = $mean;
$this->_standardDeviation = $standardDeviation;
$this->_variance = square($standardDeviation);
$this->_precision = 1.0/$this->_variance;
$this->_precisionMean = $this->_precision*$this->_mean;
if($this->_variance != 0)
{
$this->_precision = 1.0/$this->_variance;
$this->_precisionMean = $this->_precision*$this->_mean;
}
else
{
$this->_precision = \INF;
if($this->_mean == 0)
{
$this->_precisionMean = 0;
}
else
{
$this->_precisionMean = \INF;
}
}
}
public function getMean()