Dear Stan community,

first of all thanks for providing this amazing tool. I’ve been using Stan for some time now, but would not consider myself to be an expert. For one of the projects that I am working on, my measurement data is connected to latent parameters through a 2D convolution. I’d like to make this convolution a proper part of my Stan program (instead of pre-coding it as a matrix multiplication) to eventually make the convolution filter (or aspects of it, like the scale) part of the parameters.

So far I couldn’t find a fast convolution implementation in Stan and I imagine that coding a 2D convolution in the Stan language itself will be rather slow. Before I venture down this road I wanted to ask, whether 2D convolutions are available in the Stan language (perhaps in the C++ code? maybe even opencl?) and I just missed them. I found some discussion about including FFTs in Stan, but from what I can tell they have not been included in the modelling language yet?

Thank you!