fix autocorrelation: convert divisor to float64
both for Autocorrelate and AutocorrelateMP, even though for the latter the change only covers converting the divisor expression as a whole, instead of individual elements separately.
This commit is contained in:
parent
4bf633dc5b
commit
37f15b9fa6
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user