diff --git a/p2/stats/stats.go b/p2/stats/stats.go index 8b1cd02..184a66e 100644 --- a/p2/stats/stats.go +++ b/p2/stats/stats.go @@ -29,8 +29,7 @@ func Autocorrelate(f []float64, maxShift float64) []float64 { r += f[i] * f[i+currentShift] } - // r = r * math.Pow(float64(fLen)-float64(currentShift), -1) - r *= float64(1 / (fLen - currentShift)) + r *= 1 / float64(fLen-currentShift) v = append(v, r) @@ -53,7 +52,7 @@ func AutocorrelateMP(f []float64, maxShift float64) []float64 { r += f[i] * f[i+currentShift] } - r *= math.Pow(float64(fLen)-float64(currentShift), -1) + r *= math.Pow(float64(fLen-currentShift), -1) v = append(v, r)