mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-12-02 09:58:24 +00:00
26 lines
379 B
PHP
26 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;
|
|
}
|
|
|
|
}
|