fix beta multiplication error
This commit is contained in:
parent
5e0020a112
commit
0c03b7e6bf
9
fermi.go
9
fermi.go
|
@ -244,10 +244,6 @@ func multiplyLogDists(l1 Lognormal, l2 Lognormal) Lognormal {
|
|||
|
||||
}
|
||||
|
||||
func multiplyBetaDists(beta1 Beta, beta2 Beta) Beta {
|
||||
return Beta{a: beta1.a + beta2.a, b: beta1.b + beta2.b}
|
||||
}
|
||||
|
||||
func multiplyLogDistAndScalar(l Lognormal, s Scalar) (Dist, error) {
|
||||
if s == 0.0 {
|
||||
return Scalar(0.0), nil
|
||||
|
@ -285,11 +281,6 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
|||
return Scalar(float64(o) * float64(n)), nil
|
||||
}
|
||||
}
|
||||
case Beta:
|
||||
switch n := new_dist.(type) {
|
||||
case Beta:
|
||||
return multiplyBetaDists(o, n), nil
|
||||
}
|
||||
}
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
|
|
|
@ -173,10 +173,6 @@ func multiplyLogDists(l1 Lognormal, l2 Lognormal) Lognormal {
|
|||
|
||||
}
|
||||
|
||||
func multiplyBetaDists(beta1 Beta, beta2 Beta) Beta {
|
||||
return Beta{a: beta1.a + beta2.a, b: beta1.b + beta2.b}
|
||||
}
|
||||
|
||||
func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
||||
|
||||
switch o := old_dist.(type) {
|
||||
|
@ -205,16 +201,8 @@ func multiplyDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
|||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
}
|
||||
case Beta:
|
||||
switch n := new_dist.(type) {
|
||||
case Beta:
|
||||
return multiplyBetaDists(o, n), nil
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
default:
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
return operateDistsAsSamples(old_dist, new_dist, "*")
|
||||
}
|
||||
|
||||
func divideDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user