function w = lusolZv(Z,v)

%        w = lusolZv(Z,v);
% takes an m-vector v and computes w = Z*v,
% where Z satisfies S'*Z = 0.
% If w = Z*v, we will have z = S'*w = 0.

% 08 Dec 2015: First working version of lusolZv.

r    = Z.lu.rank;
b    = [sparse(r,1); v];
if ~Z.trans
    p    = Z.lu.p;
    b(p) = b;
    w    = Z.lu.solveLt(b);
else
    q    = Z.lu.q;
    w    = Z.Utri\b;
    w(q) = w;
end
w    = Z.Rinv*w;