public function __construct(array $D) { $this->m = count($D); $this->n = $this->m; $A = []; for ($i = 0; $i < $this->m; $i++) { for ($j = 0; $j < $this->m; $j++) { if ($i == $j) { $A[$i][$j] = $D[$i]; } else { $A[$i][$j] = 0; } } } $this->A = $A; }