public function set($row, $col, $data)
    {
        if ($row < 0 || $row > $this->rows()) {
            throw new VerticeOutOfBoundsException('row', $row);
        }
        if ($col < 0 || $col > $this->columns()) {
            throw new VerticeOutOfBoundsException('col', $col);
        }
        if ($row == 0 && $col == 0) {
            throw new VerticeOutOfBoundsException('row & col', 0);
        }

        if (($row == 0 || $col == 0) && !$data instanceof Matrix) {
            throw new MatrixException('$data for set method must be a matrix');
        }

        if ($row == 0 && $col > 0) {
            if (!$data->is('columnvector')) {
                throw new MatrixException('$data for set method must be a column vector');
            }
            $dArr = $data->toArray();
            $col --;
            $nRows = $this->rows();
            for ($n = 0; $n < $nRows; $n ++) {
                $this->data[$n][$col] = $dArr[$n][0];
            }
            return $this;
        }

        if ($col == 0 && $row > 0) {
            if (!$data->is('rowvector')) {
                throw new MatrixException('$data for set method must be a row vector');
            }
            $dArr = $data->toArray();
            $row --;
            $nCols = $this->columns();
            for ($m = 0; $m < $nCols; $m ++) {
                $this->data[$row][$m] = $dArr[0][$m];
            }
            return $this;
        }

        $this->data[$row-1][$col-1] = $data;

        return $this;
    }