This commit is contained in:
Dennis Eichhorn 2017-10-26 18:54:46 +02:00
parent f1e6e7a63b
commit 75f86a29ba

View File

@ -81,6 +81,8 @@ class QRDecomposition
public function getH() public function getH()
{ {
$H = [[]];
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i >= $j) { if ($i >= $j) {
@ -99,6 +101,8 @@ class QRDecomposition
public function getR() public function getR()
{ {
$R = [[]];
for ($i = 0; $i < $this->n; ++$i) { for ($i = 0; $i < $this->n; ++$i) {
for ($j = 0; $j < $this->n; ++$j) { for ($j = 0; $j < $this->n; ++$j) {
if ($i < $j) { if ($i < $j) {
@ -119,10 +123,13 @@ class QRDecomposition
public function getQ() public function getQ()
{ {
$Q = [[]];
for ($k = $this->n-1; $k >= 0; --$k) { for ($k = $this->n-1; $k >= 0; --$k) {
for ($i = 0; $i < $this->m; ++$i) { for ($i = 0; $i < $this->m; ++$i) {
$Q[$i][$k] = 0.0; $Q[$i][$k] = 0.0;
} }
$Q[$k][$k] = 1.0; $Q[$k][$k] = 1.0;
for ($j = $k; $j < $this->n; ++$j) { for ($j = $k; $j < $this->n; ++$j) {
if ($this->QR[$k][$k] != 0) { if ($this->QR[$k][$k] != 0) {