From 75f86a29bab36bc4ef144a03ea179be76fb2c3e5 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 26 Oct 2017 18:54:46 +0200 Subject: [PATCH] Fix #128 --- Math/Matrix/QRDecomposition.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Math/Matrix/QRDecomposition.php b/Math/Matrix/QRDecomposition.php index fb735ad08..bdbb71e84 100644 --- a/Math/Matrix/QRDecomposition.php +++ b/Math/Matrix/QRDecomposition.php @@ -81,6 +81,8 @@ class QRDecomposition public function getH() { + $H = [[]]; + for ($i = 0; $i < $this->m; ++$i) { for ($j = 0; $j < $this->n; ++$j) { if ($i >= $j) { @@ -99,6 +101,8 @@ class QRDecomposition public function getR() { + $R = [[]]; + for ($i = 0; $i < $this->n; ++$i) { for ($j = 0; $j < $this->n; ++$j) { if ($i < $j) { @@ -119,10 +123,13 @@ class QRDecomposition public function getQ() { + $Q = [[]]; + for ($k = $this->n-1; $k >= 0; --$k) { for ($i = 0; $i < $this->m; ++$i) { $Q[$i][$k] = 0.0; - } + } + $Q[$k][$k] = 1.0; for ($j = $k; $j < $this->n; ++$j) { if ($this->QR[$k][$k] != 0) {