Generalized Inverses and Applications to Neural Networks and Quantum Information