function y = cinvx(d,ev)

% Solve the preconditioning (circulant) system Cy=d.
% d:  the right-hand side vector;
% ev: the eigenvalues of the circulant matrix C;
% y:  the output vector.

y= ifft(fft(d)./ev);
if norm(imag(y)) < 1.0e-14   % check if v is real
   y = real(y);
end
