Based on the MASS kde2d() function, but heavily simplified; it's just tcrossprod() now.
kde2d_faster(dens.x, dens.y)
dens.x
: Contribution of all cells to densities of the x-axis grid points.dens.y
: Contribution of all cells to densities of the y-axis grid points.Useful links