simplify division code

This commit is contained in:
NunoSempere 2024-09-15 16:34:30 -04:00
parent 6686e4f919
commit b01337378a

View File

@ -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,13 +263,10 @@ 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