diff --git a/Math/Functions/Algebra.php b/Math/Functions/Algebra.php index 2f651e0c9..83245672d 100644 --- a/Math/Functions/Algebra.php +++ b/Math/Functions/Algebra.php @@ -84,17 +84,6 @@ 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 { diff --git a/Math/Matrix/Matrix.php b/Math/Matrix/Matrix.php index 95b67cd4d..0522f96a5 100755 --- a/Math/Matrix/Matrix.php +++ b/Math/Matrix/Matrix.php @@ -699,48 +699,6 @@ class Matrix implements \ArrayAccess, \Iterator return $L->det(); } - /** - * Dot product - * - * @param self $B Matrix - * - * @return self - * - * @since 1.0.0 - */ - public function dot(self $B) : self - { - $value1 = $this->matrix; - $value2 = $B->toArray(); - - $m1 = \count($value1); - $n1 = \count($value1[0]); - - $m2 = \count($value2); - $n2 = \count($value2[0]); - - $result = null; - - if ($m2 !== $n1) { - throw new InvalidDimensionException($m2 . 'x' . $n2 . ' not compatible with ' . $m1 . 'x' . $n1); - } - - $result = [[]]; - for ($i = 0; $i < $m1; ++$i) { // Row of 1 - for ($c = 0; $c < $n2; ++$c) { // Column of 2 - $temp = 0; - - for ($j = 0; $j < $m2; ++$j) { // Row of 2 - $temp += $value1[$i][$j] * $value2[$j][$c]; - } - - $result[$i][$c] = $temp; - } - } - - return self::fromArray($result); - } - /** * Sum the elements in the matrix. * diff --git a/tests/Math/Matrix/MatrixTest.php b/tests/Math/Matrix/MatrixTest.php index 43b71e809..276867ec5 100755 --- a/tests/Math/Matrix/MatrixTest.php +++ b/tests/Math/Matrix/MatrixTest.php @@ -493,81 +493,6 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase $A->mult($B); } - /** - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testDotVectors() : void - { - $v1 = Vector::fromArray([1, 3, -5])->transpose(); - - self::assertEquals( - [[3]], - $v1->dot(Vector::fromArray([4, -2, -1]))->toArray() - ); - } - - /** - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testDotMatrices() : void - { - $m = Matrix::fromArray([ - [1, 2, 3], - [4, 5, 6], - ]); - - self::assertEquals( - [ - [58, 64], - [139, 154], - ], - $m->dot( - Matrix::fromArray([ - [7, 8], - [9, 10], - [11, 12], - ]) - )->toArray() - ); - } - - /** - * @covers phpOMS\Math\Matrix\Matrix - * @group framework - */ - public function testDotVectorMatrix() : void - { - $v = Vector::fromArray([3, 4])->transpose(); - - self::assertEquals( - [11, 39, 53], - $v->dot( - Matrix::fromArray([ - [1, 5, 7], - [2, 6, 8], - ]) - )->toVectorArray() - ); - } - - public function testDotMatrixVector() : void - { - $m = Matrix::fromArray([ - [1, 2], - [5, 6], - [7, 8], - ]); - - self::assertEquals( - [11, 39, 53], - $m->dot( - Vector::fromArray([3, 4]) - )->toVectorArray() - ); - } - public function testSumAll() : void { $m = Matrix::fromArray([ diff --git a/tests/Utils/Parser/Markdown/data/video.html b/tests/Utils/Parser/Markdown/data/video.html index e69de29bb..00eca47ef 100644 --- a/tests/Utils/Parser/Markdown/data/video.html +++ b/tests/Utils/Parser/Markdown/data/video.html @@ -0,0 +1 @@ +

[video src="https://www.youtube.com/watch?v=dQw4w9WgXcQ&ab_channel=RickAstley"]

\ No newline at end of file