def pinv(self):
        A = self
        AH = self.H
        # Trivial case: pseudoinverse of all-zero matrix is its transpose.
        if A.is_zero:
            return AH
        try:
            if self.rows >= self.cols:
                return (AH * A).inv() * AH
            else:
                return AH * (A * AH).inv()
        except ValueError:
            # Matrix is not full rank, so A*AH cannot be inverted.
            raise NotImplementedError('Rank-deficient matrices are not yet '
                                      'supported.')
Calculate the Moore-Penrose pseudoinverse of the matrix.
dataset/ETHPy150Open sympy/sympy/sympy/matrices/matrices.py/MatrixBase.pinv