LanguageDetector\Sort\PageRank::subs PHP Method

subs() final protected method

Array subtraction
final protected subs ( array $a, array $b ) : array
$a array
$b array
return array
    protected final function subs($a, $b)
    {
        $array = array();
        if (count($a) != count($a)) {
            throw new \Exception("Array shape mismatch");
        }
        foreach ($a as $index => $value) {
            if (!isset($b[$index])) {
                throw new \Exception("Array shape mismatch");
            }
            $array[$index] = $value - $b[$index];
        }
        return $array;
    }