as a matrix rather than C-array. I also fixed a bug which showed up when using non-square filters. The bug would cause the edges of the output image to be incorrect.