(self, i, j)
Swap, in place, columns i and j.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix
        >>> S = SparseMatrix.eye(3); S[2, 1] = 2
        >>> S.row_swap(1, 0); S
        Matrix([
        [0, 1, 0],
        [1, 0, 0],
        [0, 2, 1]])
Swap, in place, columns i and j.
Swap in place columns i and j .
def row_swap(self, i, j):
        """Swap, in place, columns i and j.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix
        >>> S = SparseMatrix.eye(3); S[2, 1] = 2
        >>> S.row_swap(1, 0); S
        Matrix([
        [0, 1, 0],
        [1, 0, 0],
        [0, 2, 1]])
        """
        if i > j:
            i, j = j, i
        rows = self.row_list()
        temp = []
        for ii, jj, v in rows:
            if ii == i:
                self._smat.pop((ii, jj))
                temp.append((jj, v))
            elif ii == j:
                self._smat.pop((ii, jj))
                self._smat[i, jj] = v
            elif ii > j:
                break
        for k, v in temp:
            self._smat[j, k] = v
def row_swap ( self , i , j ) : if i > j : i , j = j , i rows = self . row_list ( ) temp = [ ] for ii , jj , v in rows : if ii == i : self . _smat . pop ( ( ii , jj ) ) temp . append ( ( jj , v ) ) elif ii == j : self . _smat . pop ( ( ii , jj ) ) self . _smat [ i , jj ] = v elif ii > j : break for k , v in temp : self . _smat [ j , k ] = v