  The continuous-variable controlled-Z gate is a canonical two-mode gate for
universal continuous-variable quantum computation. It is considered as one of
the most fundamental continuous-variable quantum gates. Here we present a
scheme for realizing continuous-variable controlled-Z gate between two optical
beams using an atomic ensemble. The gate is performed by simply sending the two
beams propagating in two orthogonal directions twice through a spin-squeezed
atomic medium. Its fidelity can run up to one if the input atomic state is
infinitely squeezed. Considering the noise effects due to atomic decoherence
and light losses, we show that the observed fidelities of the scheme are still
quite high within presently available techniques.
