mirror of
https://github.com/furyfire/trueskill.git
synced 2025-07-10 22:12:07 +02:00
Cleanup in src/, adding namespaces, removing php closing tag and general code cleanup
This commit is contained in:
22
src/Numerics/SquareMatrix.php
Normal file
22
src/Numerics/SquareMatrix.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php namespace Moserware\Skills\Numerics;
|
||||
|
||||
class SquareMatrix extends Matrix
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$allValues = func_get_args();
|
||||
$rows = (int)sqrt(count($allValues));
|
||||
$cols = $rows;
|
||||
|
||||
$matrixData = array();
|
||||
$allValuesIndex = 0;
|
||||
|
||||
for ($currentRow = 0; $currentRow < $rows; $currentRow++) {
|
||||
for ($currentColumn = 0; $currentColumn < $cols; $currentColumn++) {
|
||||
$matrixData[$currentRow][$currentColumn] = $allValues[$allValuesIndex++];
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct($rows, $cols, $matrixData);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user