The spectral convolution is used to generalize the shared peaks count and offer a more
robust measure of spectral similarity. For example, if one of our spectra derives from a
peptide that is found internally to the peptide for the second spectrum, then the peptides
are structurally similar, but the shared peaks count will be very small because the graph of one
spectrum will appear shifted with respect to the other spectrum.

To identify this shift value, we use the spectral convolution. If $S_1$ and $S_2$ are multisets
representing two simplified spectra (i.e., containing ion masses only), then the Minkowski
difference $S_1 \ominus S_2$ is called the spectral convolution of $S_1$ and $S_2$. In this
notation, the shared peaks count is represented by $(S_2 \ominus S_1)(0)$,
and the best shift value aligning the "peaks" of the two mass spectra
is the value $x$ for which $(S_2 \ominus S_1)(x)$ is maximized.