fm_qinv function

Sparse partial inverse