use least squares only if matrix is not square