public rowMultiply ( integer $mᵢ, integer $k ) : |
||
$mᵢ | integer | Row to multiply |
$k | integer | Multiplier |
return |
public function rowMultiply(int $mᵢ, int $k) : Matrix
{
if ($mᵢ >= $this->m) {
throw new Exception\MatrixException('Row to multiply does not exist');
}
if ($k == 0) {
throw new Exception\BadParameterException('Multiplication factor k must not be 0');
}
$n = $this->n;
$R = $this->A;
for ($j = 0; $j < $n; $j++) {
$R[$mᵢ][$j] *= $k;
}
return MatrixFactory::create($R);
}