Some minor documentation cleanup (e.g. converted C# comments to PHPDocumentor comments)

This commit is contained in:
Jeff Moser
2010-10-08 21:44:36 -04:00
parent f863e150d4
commit d2fc7dc5c7
22 changed files with 174 additions and 159 deletions

View File

@ -2,22 +2,30 @@
/**
* Basic math functions.
*
* PHP version 5
*
* @category Math
* @package PHPSkills
* @author Jeff Moser <jeff@moserware.com>
* @copyright 2010 Jeff Moser
*/
/**
* Squares the input (x^2 = x * x)
* @param number $x Value to square (x)
* @return number The squared value (x^2)
*/
function square($x)
{
return $x * $x;
}
function sum(array $itemsToSum, $funcName )
/**
* Sums the items in $itemsToSum
* @param array $itemsToSum The items to sum,
* @param callback $callback The function to apply to each array element before summing.
* @return number The sum.
*/
function sum(array $itemsToSum, $callback )
{
$mappedItems = array_map($funcName, $itemsToSum);
$mappedItems = array_map($callback, $itemsToSum);
return array_sum($mappedItems);
}

View File

@ -1,30 +1,27 @@
<?php
/**
* Computes Gaussian values.
*
* PHP version 5
*
* @category Math
* @package PHPSkills
* @author Jeff Moser <jeff@moserware.com>
* @copyright 2010 Jeff Moser
*/
namespace Moserware\Numerics;
require_once(dirname(__FILE__) . "/basicmath.php");
/**
* Computes Gaussian (bell curve) values.
*
* @package PHPSkills
* @author Jeff Moser <jeff@moserware.com>
* @copyright 2010 Jeff Moser
*/
class GaussianDistribution
{
private $_mean;
private $_standardDeviation;
// Precision and PrecisionMean are used because they make multiplying and dividing simpler
// precision and precisionMean are used because they make multiplying and dividing simpler
// (the the accompanying math paper for more details)
private $_precision;
private $_precisionMean;
private $_variance;
function __construct($mean = 0.0, $standardDeviation = 1.0)
{
$this->_mean = $mean;