diff --git a/src/Phpml/Math/Product.php b/src/Phpml/Math/Product.php index 992eeaa..3772207 100644 --- a/src/Phpml/Math/Product.php +++ b/src/Phpml/Math/Product.php @@ -12,7 +12,7 @@ class Product * * @return mixed */ - public function scalar(array $a, array $b) + public static function scalar(array $a, array $b) { $product = 0; foreach ($a as $index => $value) { diff --git a/tests/Phpml/Math/ProductTest.php b/tests/Phpml/Math/ProductTest.php index d7aa015..ade9942 100644 --- a/tests/Phpml/Math/ProductTest.php +++ b/tests/Phpml/Math/ProductTest.php @@ -10,11 +10,9 @@ class ProductTest extends \PHPUnit_Framework_TestCase 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(8, $product->scalar([2], [4])); + $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(8, Product::scalar([2], [4])); } } \ No newline at end of file