public function inverse() {
        $determinant = $this->determinant();
        if ($determinant == 0) { // If 0, there is no inverse.
            return;
        }

        $adj = $this->getAdjoinMatrix();
        for ($i=0; $i<static::ROWS; $i++) {
            $sign = ($i%2 === 1) ? -1 : 1;
            for ($j=0; $j<static::COLUMNS; $j++) {
                $adj[$i][$j] = $sign * $adj[$i][$j];
                $sign        = -$sign;
            }
        }

        $this->copy($adj);
        $this->transpose();
        $div = 1 / $determinant;
        $this->mul($div);
    }