mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-13 15:18:41 +00:00
fix tests
This commit is contained in:
parent
cd36282b4f
commit
95eb37853e
|
|
@ -714,10 +714,10 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
$value2 = $B->toArray();
|
$value2 = $B->toArray();
|
||||||
|
|
||||||
$m1 = \count($value1);
|
$m1 = \count($value1);
|
||||||
$n1 = ($isMatrix1 = \is_array($value1[0])) ? \count($value1[0]) : 1;
|
$n1 = ($isMatrix1 = !($this instanceof Vector)) ? \count($value1[0]) : 1;
|
||||||
|
|
||||||
$m2 = \count($value2);
|
$m2 = \count($value2);
|
||||||
$n2 = ($isMatrix2 = \is_array($value2[0])) ? \count($value2[0]) : 1;
|
$n2 = ($isMatrix2 = !($B instanceof Vector)) ? \count($value2[0]) : 1;
|
||||||
|
|
||||||
$result = null;
|
$result = null;
|
||||||
|
|
||||||
|
|
@ -908,6 +908,8 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
/**
|
/**
|
||||||
* Calculate e^M
|
* Calculate e^M
|
||||||
*
|
*
|
||||||
|
* The algorithm uses a taylor series.
|
||||||
|
*
|
||||||
* @param int $iterations Iterations for approximation
|
* @param int $iterations Iterations for approximation
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ final class ImageUtils
|
||||||
//$color1 = \imagecolorat($src1, $i, $j);
|
//$color1 = \imagecolorat($src1, $i, $j);
|
||||||
$color2 = \imagecolorat($src2, $i, $j);
|
$color2 = \imagecolorat($src2, $i, $j);
|
||||||
|
|
||||||
if (\abs($color1Avg - $color2Avg) / $color1Avg > 0.05 && $color1Avg > 0 && $color2Avg > 0) {
|
if ($color1Avg > 0 && \abs($color1Avg - $color2Avg) / $color1Avg > 0.05 && $color2Avg > 0) {
|
||||||
++$difference;
|
++$difference;
|
||||||
|
|
||||||
if ($diff === 0) {
|
if ($diff === 0) {
|
||||||
|
|
|
||||||
|
|
@ -498,8 +498,8 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase
|
||||||
$v1 = Vector::fromArray([1, 3, -5])->transpose();
|
$v1 = Vector::fromArray([1, 3, -5])->transpose();
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
3,
|
[[3]],
|
||||||
$v1->dot(Vector::fromArray([4, -2, -1]))
|
$v1->dot(Vector::fromArray([4, -2, -1]))->toArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -580,7 +580,7 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[12, 15, 18],
|
[12, 15, 18],
|
||||||
$m->sum(0)
|
$m->sum(0)->toVectorArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -594,7 +594,7 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[6, 15, 24],
|
[6, 15, 24],
|
||||||
$m->sum(1)
|
$m->sum(1)->toVectorArray()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -614,7 +614,7 @@ final class MatrixTest extends \PHPUnit\Framework\TestCase
|
||||||
[0, 0, -8],
|
[0, 0, -8],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
self::assertFalse($m->isDiagonal());
|
self::assertTrue($m->isDiagonal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPow() : void
|
public function testPow() : void
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user