public function augment(Matrix $B) : Matrix { if ($B->getM() !== $this->m) { throw new Exception\MatrixException('Matrices to augment do not have the same number of rows'); } $m = $this->m; $A = $this->A; $B = $B->getMatrix(); $⟮A∣B⟯ = []; for ($i = 0; $i < $m; $i++) { $⟮A∣B⟯[$i] = array_merge($A[$i], $B[$i]); } return MatrixFactory::create($⟮A∣B⟯); }