kernel density smoothing algorithm