From a4f7d2e527398d78e77c149012b577a0fcbbde26 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 22 Oct 2023 13:55:10 +0000 Subject: [PATCH] test fixes --- DataStorage/Database/Query/Grammar/MysqlGrammar.php | 2 +- Math/Functions/Algebra.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/DataStorage/Database/Query/Grammar/MysqlGrammar.php b/DataStorage/Database/Query/Grammar/MysqlGrammar.php index 6d315d094..40e19d083 100755 --- a/DataStorage/Database/Query/Grammar/MysqlGrammar.php +++ b/DataStorage/Database/Query/Grammar/MysqlGrammar.php @@ -60,6 +60,6 @@ class MysqlGrammar extends Grammar $expression = '*'; } - return 'SELECT ' . $expression . ' ' . $this->compileFrom($query, $query->from) . ' ' . $this->compileWheres($query, $query->wheres) . ' ORDER BY \rand() ' . $this->compileLimit($query, $query->limit ?? 1); + return 'SELECT ' . $expression . ' ' . $this->compileFrom($query, $query->from) . ' ' . $this->compileWheres($query, $query->wheres) . ' ORDER BY RAND() ' . $this->compileLimit($query, $query->limit ?? 1); } } diff --git a/Math/Functions/Algebra.php b/Math/Functions/Algebra.php index 83245672d..2f651e0c9 100644 --- a/Math/Functions/Algebra.php +++ b/Math/Functions/Algebra.php @@ -84,6 +84,17 @@ final class Algebra $temp += $value1[$i][$c] * $value2[$c]; } + $result[$i] = $temp; + } + } elseif (!$isMatrix1 && $isMatrix2) { + $result = []; + for ($i = 0; $i < $m1; ++$i) { // Row of 1 + $temp = 0; + + for ($c = 0; $c < $m2; ++$c) { // Row of 2 + $temp += $value2[$i][$c] * $value1[$c]; + } + $result[$i] = $temp; } } else {