sum of squares for simdist