Linear space computation of the similarity distance between two temporal values.
Only two rows of the full matrix are used.