Pole expansion and selected inversion