simplify division code
This commit is contained in:
parent
6686e4f919
commit
b01337378a
11
fermi.go
11
fermi.go
|
@ -250,8 +250,6 @@ func divideDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
||||||
return nil, errors.New("Error: division by zero scalar")
|
return nil, errors.New("Error: division by zero scalar")
|
||||||
}
|
}
|
||||||
return multiplyLogDists(o, Lognormal{low: 1.0 / float64(n), high: 1.0 / float64(n)}), nil
|
return multiplyLogDists(o, Lognormal{low: 1.0 / float64(n), high: 1.0 / float64(n)}), nil
|
||||||
default:
|
|
||||||
return operateDistsAsSamples(old_dist, new_dist, "/")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case Scalar:
|
case Scalar:
|
||||||
|
@ -265,14 +263,11 @@ func divideDists(old_dist Dist, new_dist Dist) (Dist, error) {
|
||||||
return nil, errors.New("Error: division by zero scalar")
|
return nil, errors.New("Error: division by zero scalar")
|
||||||
}
|
}
|
||||||
return Scalar(float64(o) / float64(n)), nil
|
return Scalar(float64(o) / float64(n)), nil
|
||||||
default:
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return operateDistsAsSamples(old_dist, new_dist, "/")
|
return operateDistsAsSamples(old_dist, new_dist, "/")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
default:
|
|
||||||
return operateDistsAsSamples(old_dist, new_dist, "/")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generic distribution operations
|
// Generic distribution operations
|
||||||
func operateDists(old_dist Dist, new_dist Dist, op string) (Dist, error) {
|
func operateDists(old_dist Dist, new_dist Dist, op string) (Dist, error) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user