I have a matrix M which is the transpose of the Laplacian of a graph and a vector d that may or may not be in the range of M. I want to compute pinv(M)*d.

I assumed that qr(M)\d does what I want, however it does it only when M is represented by a full matrix, see my previous question. If M is represented by a sparse matrix, it gives a solution but not the least norm one.