create custom convolution function