This commit is contained in:
NunoSempere 2024-06-10 01:13:17 +02:00
parent b0f48286d5
commit 5b52cf3297

10
f.go
View File

@ -171,7 +171,7 @@ func multiplyAsSamples(dist1 Dist, dist2 Dist) Dist {
zs[i] = xs[i] * ys[i] zs[i] = xs[i] * ys[i]
} }
fmt.Printf("%v\n", zs) // fmt.Printf("%v\n", zs)
return FilledSamples{xs: zs} return FilledSamples{xs: zs}
} }
@ -239,7 +239,7 @@ func joinDists(old_dist Dist, new_dist Dist, op string) (Dist, error) {
} }
/* Pretty print distributions */ /* Pretty print distributions */
func prettyPrint90CI(low float64, high float64) { func prettyPrint2Floats(low float64, high float64) {
// fmt.Printf("=> %.1f %.1f\n", low, high) // fmt.Printf("=> %.1f %.1f\n", low, high)
switch { switch {
case math.Abs(low) >= 1_000_000_000_000: case math.Abs(low) >= 1_000_000_000_000:
@ -278,7 +278,7 @@ func prettyPrintDist(dist Dist) {
switch v := dist.(type) { switch v := dist.(type) {
case Lognormal: case Lognormal:
fmt.Printf("=> ") fmt.Printf("=> ")
prettyPrint90CI(v.low, v.high) prettyPrint2Floats(v.low, v.high)
case FilledSamples: case FilledSamples:
tmp_xs := make([]float64, N_SAMPLES) tmp_xs := make([]float64, N_SAMPLES)
copy(tmp_xs, v.xs) copy(tmp_xs, v.xs)
@ -289,10 +289,10 @@ func prettyPrintDist(dist Dist) {
low := tmp_xs[low_int] low := tmp_xs[low_int]
high_int := N_SAMPLES * 19 / 20 high_int := N_SAMPLES * 19 / 20
high := tmp_xs[high_int] high := tmp_xs[high_int]
prettyPrint90CI(low, high) prettyPrint2Floats(low, high)
case Beta: case Beta:
fmt.Printf("=> beta ") fmt.Printf("=> beta ")
prettyPrint90CI(v.a, v.b) prettyPrint2Floats(v.a, v.b)
default: default:
fmt.Printf("%v", v) fmt.Printf("%v", v)
} }