PHP 7.4.33
Preview: test.php Size: 486 B
/var/www/multi-event-cfp.bitkit.dk/httpdocs/vendor/markbaker/matrix/examples/test.php
<?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;

Directory Contents

Dirs: 0 × Files: 1
Name Size Perms Modified Actions
486 B lrw-rw-r-- 2021-07-01 19:01:15
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).