GoYeppp is a bindings for Yeppp! high-performance SIMD-optimized mathematical library.
The Yeppp! library and pkgconfig.
Customize the pkgconfig config file (yeppp.pc), and then copy into the pkgconfig configurations directory (typically /usr/lib64/pkgconfig or /usr/lib/pkgconfig)
This package is "go-gettable", just do:
go get -u github.com/vpxyz/goyeppp/...
package main
import (
gy "github.com/vpxyz/goyeppp"
"log"
"math/rand"
)
func main() {
arraySize := 1024 * 1024 * 16
x := make([]gy.Yep64f, arraySize)
r := rand.New(rand.NewSource(5330))
for i := 0; i < arraySize; i++ {
x[i] = gy.Yep64f(r.Float64())
}
blockSize := 1024
blockLength := 0
_, _ = gy.Init()
var entropy gy.Yep64f
for i := 0; i < arraySize; i += blockSize {
blockLength = arraySize - i
if blockLength > blockSize {
blockLength = blockSize
}
logP, _ := gy.Log(x[i : i+blockLength])
dotProduct, _ := gy.DotProductV64fV64fS64f(x[i:i+blockLength], logP)
entropy -= dotProduct
}
_, _ = gy.Release()
log.Printf("Entropy: %f\n", entropy)
}