solution 1

if input matrix is not squared calculate pseudinverse