Computing autocorrelation/autocovariance in Stan

Yes. The context is periodic models where there are two classes of model configurations that I think are competing: High estimated signal-to-noise-ratio with accurate estimates of the frequency and phase of the periodic signal, versus low estimated signal-to-noise-ratio with arbitrary estimates of the frequency and phase. It occurred to me today that the residuals in the latter should retain high autocorrelation, so explicitly modelling the autocorrelation of the residuals as samples from a population with a true correlation of zero should change the geometry of the parameter space to eliminate this spurious mode.