wrangle mixture syntax

This commit is contained in:
NunoSempere 2024-02-16 10:10:16 +01:00
parent 651ade8b47
commit 4544adb3d0
2 changed files with 15 additions and 1 deletions

View File

@ -1,5 +1,7 @@
- [x] Hello world program
- [x] Look into randomness sources in go
- rand/v2 api: <https://pkg.go.dev/math/rand/v2>
- [ ] Test with a million samples of a simple lognormal, just to get a sense of speed
- [x] Test with a million samples of a simple lognormal, just to get a sense of speed
- [ ] Add mixture distribution
- [ ] Look into go routines for filling up an array.
- [ ] Anonymous functions for nested: https://stackoverflow.com/questions/74523441/nested-functions-in-go

View File

@ -47,6 +47,12 @@ func sample_to(low float64, high float64) float64 {
return math.Exp(sample_normal_from_90_ci(loglow, loghigh))
}
type func64 func() float64
func sample_mixture(fs [](func(float64) float64), ps []float64) float64 {
return 1.0
}
func main() {
var n_samples int = 1000000
// var array_samples [n_samples]float64
@ -57,4 +63,10 @@ func main() {
avg = avg / float64(n_samples)
fmt.Printf("%v\n", avg)
f1 := func() float64 {
return sample_to(1, 10)
}
fs := [3](func64){f1, f1, f1}
// x := sample_mixture()
}