Minor document formatting

This commit is contained in:
Ozzie Gooen 2020-07-08 10:37:39 +01:00
parent 2ddf0c02cb
commit da52444e8e
2 changed files with 11 additions and 6 deletions

View File

@ -7,6 +7,7 @@ let toShape = (sampleCount: int, node: node) => {
switch (renderResult) {
| Ok(`RenderedDist(rs)) =>
// todo: Why is this here? It converts a mixed shape to a mixed shape.
let continuous = Distributions.Shape.T.toContinuous(rs);
let discrete = Distributions.Shape.T.toDiscrete(rs);
let shape = MixedShapeBuilder.buildSimple(~continuous, ~discrete);

View File

@ -121,7 +121,8 @@ module Truncate = {
let trySimplification = (leftCutoff, rightCutoff, t): simplificationResult => {
switch (leftCutoff, rightCutoff, t) {
| (None, None, t) => `Solution(t)
| (Some(lc), Some(rc), t) when lc > rc => `Error("Left truncation bound must be smaller than right bound.")
| (Some(lc), Some(rc), t) when lc > rc =>
`Error("Left truncation bound must be smaller than right bound.")
| (lc, rc, `SymbolicDist(`Uniform(u))) =>
// just create a new Uniform distribution
let nu: SymbolicTypes.uniform = u;
@ -157,10 +158,13 @@ module Truncate = {
: result(node, string) => {
t
|> trySimplification(leftCutoff, rightCutoff)
|> fun
| `Solution(t) => Ok(t)
| `Error(e) => Error(e)
| `NoSolution => truncateAsShape(toLeaf, renderParams, leftCutoff, rightCutoff, t);
|> (
fun
| `Solution(t) => Ok(t)
| `Error(e) => Error(e)
| `NoSolution =>
truncateAsShape(toLeaf, renderParams, leftCutoff, rightCutoff, t)
);
};
};
@ -169,7 +173,7 @@ module Normalize = {
(toLeaf, renderParams, t: node): result(node, string) => {
switch (t) {
| `RenderedDist(s) =>
Ok(`RenderedDist(Distributions.Shape.T.normalize(s)));
Ok(`RenderedDist(Distributions.Shape.T.normalize(s)))
| `SymbolicDist(_) => Ok(t)
| _ =>
t