use generalized inverse, as Albert suggested