The pinv computation is done using pre-allocated variables, cleaned the interface