mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-01-10 09:02:15 +00:00
make scalar function static
This commit is contained in:
parent
34281e40ee
commit
b30f4cbf11
@ -12,7 +12,7 @@ class Product
|
|||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function scalar(array $a, array $b)
|
public static function scalar(array $a, array $b)
|
||||||
{
|
{
|
||||||
$product = 0;
|
$product = 0;
|
||||||
foreach ($a as $index => $value) {
|
foreach ($a as $index => $value) {
|
||||||
|
@ -10,11 +10,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testScalarProduct()
|
public function testScalarProduct()
|
||||||
{
|
{
|
||||||
$product = new Product();
|
$this->assertEquals(10, Product::scalar([2, 3], [-1, 4]));
|
||||||
|
$this->assertEquals(-0.1, Product::scalar([1, 4, 1], [-2, 0.5, -0.1]));
|
||||||
$this->assertEquals(10, $product->scalar([2, 3], [-1, 4]));
|
$this->assertEquals(8, Product::scalar([2], [4]));
|
||||||
$this->assertEquals(-0.1, $product->scalar([1, 4, 1], [-2, 0.5, -0.1]));
|
|
||||||
$this->assertEquals(8, $product->scalar([2], [4]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user