Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /home/dnlcambodia/www/dnl_dashboard/Export/vendor/markbaker/matrix/examples/ |
<?php use Matrix\Matrix; use Matrix\Decomposition\QR; include __DIR__ . '/../vendor/autoload.php'; $grid = [ [0, 1], [-1, 0], ]; $targetGrid = [ [-1], [2], ]; $matrix = new Matrix($grid); $target = new Matrix($targetGrid); $decomposition = new QR($matrix); $X = $decomposition->solve($target); echo 'X', PHP_EOL; var_export($X->toArray()); echo PHP_EOL; $resolve = $matrix->multiply($X); echo 'Resolve', PHP_EOL; var_export($resolve->toArray()); echo PHP_EOL;