def pinv_solve(self, B, arbitrary_matrix=None):
        from sympy.matrices import eye
        A = self
        A_pinv = self.pinv()
        if arbitrary_matrix is None:
            rows, cols = A.cols, B.cols
            w = symbols('w:{0}_:{1}'.format(rows, cols), cls=Dummy)
            arbitrary_matrix = self.__class__(cols, rows, w).T
        return A_pinv * B + (eye(A.cols) - A_pinv*A) * arbitrary_matrix
Solve Ax = B using the Moore-Penrose pseudoinverse.
dataset/ETHPy150Open sympy/sympy/sympy/matrices/matrices.py/MatrixBase.pinv_solve