mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 04:14:28 +00:00
Bunch of generic code standard items. Will need a cleanup.
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
/**
|
||||
@ -13,7 +15,8 @@ class BasicMath
|
||||
/**
|
||||
* Squares the input (x^2 = x * x)
|
||||
*
|
||||
* @param float $x Value to square (x)
|
||||
* @param float $x Value to square (x)
|
||||
*
|
||||
* @return float The squared value (x^2)
|
||||
*/
|
||||
public static function square($x): float
|
||||
@ -24,8 +27,9 @@ class BasicMath
|
||||
/**
|
||||
* Sums the items in $itemsToSum
|
||||
*
|
||||
* @param mixed[] $itemsToSum The items to sum,
|
||||
* @param \Closure $callback The function to apply to each array element before summing.
|
||||
* @param mixed[] $itemsToSum The items to sum,
|
||||
* @param \Closure $callback The function to apply to each array element before summing.
|
||||
*
|
||||
* @return float The sum.
|
||||
*/
|
||||
public static function sum(array $itemsToSum, \Closure $callback): float
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
/**
|
||||
@ -198,7 +200,8 @@ class GaussianDistribution implements \Stringable
|
||||
-1.523e-15,
|
||||
-9.4e-17,
|
||||
1.21e-16,
|
||||
-2.8e-17, ];
|
||||
-2.8e-17,
|
||||
];
|
||||
|
||||
$ncof = count($coefficients);
|
||||
$d = 0.0;
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
class IdentityMatrix extends DiagonalMatrix
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
// The whole purpose of this class is to make the code for the SkillCalculator(s)
|
||||
|
@ -1,12 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
class SquareMatrix extends Matrix
|
||||
{
|
||||
public function __construct(float|int ...$allValues)
|
||||
{
|
||||
$rows = (int) sqrt(count($allValues));
|
||||
$rows = (int)sqrt(count($allValues));
|
||||
$cols = $rows;
|
||||
|
||||
$matrixData = [];
|
||||
|
@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DNW\Skills\Numerics;
|
||||
|
||||
class Vector extends Matrix
|
||||
|
Reference in New Issue
Block a user