A gain matrix decomposition and some of its applications