Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
use Matrix\Matrix;
4
use Matrix\Decomposition\QR;
5
 
6
include __DIR__ . '/../vendor/autoload.php';
7
 
8
$grid = [
9
    [0, 1],
10
    [-1, 0],
11
];
12
 
13
$targetGrid = [
14
    [-1],
15
    [2],
16
];
17
 
18
$matrix = new Matrix($grid);
19
$target = new Matrix($targetGrid);
20
 
21
$decomposition = new QR($matrix);
22
 
23
$X = $decomposition->solve($target);
24
 
25
echo 'X', PHP_EOL;
26
var_export($X->toArray());
27
echo PHP_EOL;
28
 
29
$resolve = $matrix->multiply($X);
30
 
31
echo 'Resolve', PHP_EOL;
32
var_export($resolve->toArray());
33
echo PHP_EOL;