Template squared difference metric over two types.

This allows the two input types to be different.