Being an ardent fan of numpy, I was pleased to discover that a library for golang was in progress. I wrote a small test program, based heavily on the documentation, that looks like the following:
package main
import (
"fmt"
"math"
"gonum.org/v1/gonum/stat"
)
func main() {
xs := []float64 {
23.32, 44.32, 100.12, 191.90,
23.22, 90.21, 12.22, 191.21,
1.21, 12.21, 34.23, 91.02,
}
variance := stat.Variance(xs)
fmt.Printf("Data: %v
", xs)
stddev := math.Sqrt(variance)
fmt.Printf("Standard deviation: %d
", stddev)
}
When I attempted to build the program, I noticed the following compiler error:
C:\>go build hello.go
# command-line-arguments
.hello.go:19:30: not enough arguments in call to stat.Variance
have ([]float64)
want ([]float64, []float64)
Any advice would be most appreciated.
Thank you.