public function toMatrix($rebase = true)
    {
        $mArr = [];
        foreach ($this as $vector) {
            $mArr[$vector->getY()][$vector->getX()] = $vector->getValue();
        }

        if ($rebase) {
            return new Matrix($this->rebase($mArr));
        } else {
            return new Matrix($mArr);
        }
    }