  We present a new algorithm for stacking radio interferometric data in the
uv-domain. The performance of uv-stacking is compared to the stacking of fully
imaged data using simulated Atacama Large Millimeter/sub-millimeter Array
(ALMA) and the Karl G. Jansky Very Large Array (VLA) deep extragalactic
surveys. We find that image- and uv-stacking produce similar results, however,
uv-stacking is typically the more robust method. An advantage of the
uv-stacking algorithm is the availability of uv-data post stacking, which makes
it possible to identify and remove problematic baselines. For deep VLA surveys
uv-stacking yields a signal-to-noise ratio that is up to 20 per cent higher
than image-stacking. Furthermore, we have investigated stacking of resolved
sources with a simulated VLA data set where 1.5" (10-12 kpc at z ~ 1-4) sources
are stacked. We find that uv-stacking, where a model is fitted directly to the
visibilities, significantly improves the accuracy and robustness of the size
estimates. While scientific motivation for this work is studying faint, high-z
galaxies, the algorithm analysed here would also be applicable in other fields
of astronomy. Stacking of radio interferometric data is also expected to play a
big role for future surveys with telescopes such as LOFAR and Square Kilometre
Array (SKA).
