mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-17 10:45:10 +00:00
25 lines
379 B
PHP
25 lines
379 B
PHP
<?php
|
|
|
|
declare (strict_types = 1);
|
|
|
|
namespace Phpml\Math;
|
|
|
|
class Product
|
|
{
|
|
/**
|
|
* @param array $a
|
|
* @param array $b
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public static function scalar(array $a, array $b)
|
|
{
|
|
$product = 0;
|
|
foreach ($a as $index => $value) {
|
|
$product += $value * $b[$index];
|
|
}
|
|
|
|
return $product;
|
|
}
|
|
}
|