Function for rolling minimum / maximum of a timeseries

Does anyone know if there is an efficient Pytensor/pymc implementation of a function to give the rolling minimum/maximum value of a timeseries for a given window length? I mean something reasonably efficient, and not just a ‘double loop’.

This kind of thing exists in Python/pandas and MATLAB - but I was wondering if there was a good Pytensor/pymc implementation anywhere? - I have ‘reinvented the wheel’ too many times by coding something and then discovering that a decent implementation already existed.

It looks like it should be possible to code something like the ‘ascending minima’ algorithm in Pytensor, with a bit of creativity … but I haven’t tried yet.

A