  This paper is concerned with all tests for continuous-variable entanglement
that arise from linear combinations of second moments or variances of canonical
coordinates, as they are commonly used in experiments to detect entanglement.
All such tests for bi-partite and multi-partite entanglement correspond to
hyperplanes in the set of second moments. It is shown that all optimal tests,
those that are most robust against imperfections with respect to some figure of
merit for a given state, can be constructed from solutions to semi-definite
optimization problems. Moreover, we show that for each such test, referred to
as entanglement witness based on second moments, there is a one-to-one
correspondence between the witness and a stronger product criterion, which
amounts to a non-linear witness, based on the same measurements. This
generalizes the known product criteria. The presented tests are all applicable
also to non-Gaussian states. To provide a service to the community, we present
the documentation of two numerical routines, FULLYWIT and MULTIWIT, which have
been made publicly available.
