changed pinv for sustitution
enhanced efficiency of ourQR