def reshape(self, rows, cols):
        """Reshape matrix while retaining original size.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix
        >>> S = SparseMatrix(4, 2, range(8))
        >>> S.reshape(2, 4)
        Matrix([
        [0, 1, 2, 3],
        [4, 5, 6, 7]])

        """
        if len(self) != rows*cols:
            raise ValueError((rows, cols) % "Invalid reshape parameters %d %d")
        smat = {}
        for k, v in self._smat.items():
            i, j = k
            n = i*self.cols + j
            ii, jj = divmod(n, cols)
            smat[(ii, jj)] = self._smat[(i, j)]
        return self._new(rows, cols, smat)
dataset/ETHPy150Open sympy/sympy/sympy/matrices/sparse.py/SparseMatrix.reshape/swapped operands of `%`