added pinv and pdet