mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 12:24:28 +00:00
Some minor documentation cleanup (e.g. converted C# comments to PHPDocumentor comments)
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user