mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
fix tests
This commit is contained in:
parent
7a086fea93
commit
8b3daf3c8d
|
|
@ -884,10 +884,16 @@ class Matrix implements \ArrayAccess, \Iterator
|
|||
}
|
||||
|
||||
return $matrix;
|
||||
} else {
|
||||
// @todo: implement
|
||||
throw new \Exception('Not yet implemented');
|
||||
}
|
||||
|
||||
$eig = new EigenvalueDecomposition($this);
|
||||
|
||||
$d = $eig->getD();
|
||||
for ($i = 0; $d->getM(); ++$i) {
|
||||
$d->matrix[$i][$i] = \pow($d->matrix[$i][$i], $exponent);
|
||||
}
|
||||
|
||||
return $eig->getV()->mult($d)->mult($eig->getV()->inverse());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -646,9 +646,25 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase
|
|||
[80.25, 96.75, 113.25],
|
||||
[120.75, 146.25, 171.75],
|
||||
],
|
||||
$m->pow(2.5)->toArray(),
|
||||
$m->pow(2)->toArray(),
|
||||
0.1
|
||||
);
|
||||
|
||||
$m = Matrix::fromArray([
|
||||
[1, 1, 1],
|
||||
[1, 2, 3],
|
||||
[1, 3, 6],
|
||||
]);
|
||||
|
||||
self::assertEqualsWithDelta(
|
||||
[
|
||||
[0.8901, 0.5882, 0.3684],
|
||||
[0.5882, 1.2035, 1.3799],
|
||||
[0.3684, 1.3799, 3.1167],
|
||||
],
|
||||
$m->pow(2 / 3)->toArray(),
|
||||
0.01
|
||||
);
|
||||
}
|
||||
|
||||
public function testExp() : void
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user