Text this: Stable and efficient computation of generalized polar decompositions