For a square matrix $M$, the group inverse of $M$, denoted by $M^\#$, is the unique matrix $X$ such that $MXM=M$, $XMX=X$ and $MX=XM$.
Given an $n \times n$ matrix $M$, let $I_n$ denote the identity matrix of size $n$ and $J_{n\times n}$ denote the $n\times n$ matrix with all entries equal to one. How to compute $(M+aI_n-\frac{a}{b}J_{n\times n})^\#$?
For example, if $b=n$, then $(M+aI_n-\frac{a}{n}J_{n\times n})^\#=(M+aI_n)^{-1}-\frac{1}{an}J_{n\times n}$. What about $b\neq n$?
Thanks a lot.