So, I don't have a use case for this just yet, but I wrote up my simm in LaTeX, and then generalized that to p patterns, rather than just 2. It has the standard simm properties that if all patterns are the same it returns 1. If they are all "disjoint" then it returns 0. Values in between otherwise. ie, a well behaved similarity metric. I also have a rescaled version where the amplitude of the patterns don't matter, but the shape does.
Let's jump in. Here is the simm for p patterns:
full pdf is here. In the next post we implement the p-pattern simm, scaled and unscaled, in python.