stats: correct slices init

This commit is contained in:
leo 2023-02-25 13:20:57 +01:00
parent 01cdd03dac
commit cc8ede3772
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -19,7 +19,7 @@ func Variance(f []float64) float64 {
func Autocorrelate(f []float64, maxShift float64) []float64 {
fLen := len(f)
m := float64(fLen) * maxShift
v := make([]float64, int(m), int(m)*4)
v := make([]float64, 0, int(m)*4)
currentShift := 0
for m >= float64(currentShift) {
@ -43,7 +43,7 @@ func Autocorrelate(f []float64, maxShift float64) []float64 {
func AutocorrelateMP(f []float64, maxShift float64) []float64 {
fLen := len(f)
m := float64(fLen) * maxShift
v := make([]float64, int(m), 10)
v := make([]float64, 0, int(m)*4)
currentShift := 0
for m >= float64(currentShift) {