I have a large n * n
sparse matrix called L. constant k is a given value. I am supposed to do this:
perform a sparse eigendecomposition of the Laplacian L that computes
only the eigenvectors associated with the k smallest-magnitude
eigenvalues.

How can I do this?
This is what I have tried:
d = diag(eigs(L,k,'smallestabs'));
And then I am supposed to do this:
Then project matrix V (vertex positions) onto the basis spanned by
these eigenvectors and reconstruct a filtered V called V_new (version
of the mesh).

P is not important here. I just want the new V based on the D matrix. Basically I want to calculate this:

I have tried this:
pd = padarray(diag(d),[n-k,n-k],0,'post');
V_new = V * pd * V'
But seems not to be working, because the resulting V_new is very different than V.
What is the right way to do this?
More answer...