Moved pinv implementation to optimizers.py