% Invert the singular directions which are large than thresh * max singular val
function z = partial_inv(U, D, V, y, thresh)
q = diag(D);
qmax = max(q);
qs = q(diag(D) > (thresh * qmax));
m = length(qs)
qinv = 1.0./q;
z = V(:,1:m) * diag(qinv(1:m)) * U(:,1:m)' * y;