This commit is contained in:
Ozzie Gooen 2022-04-27 15:21:27 -04:00
parent dfa404f0d0
commit b2189777d5

View File

@ -163,13 +163,17 @@ module AlgebraicCombination = {
*/ */
let getLogarithmInputError = (t1: t, t2: t, ~toPointSetFn: toPointSetFn): option<error> => { let getLogarithmInputError = (t1: t, t2: t, ~toPointSetFn: toPointSetFn): option<error> => {
let firstOperandIsGreaterThanZero = let firstOperandIsGreaterThanZero =
toFloatOperation(t1, ~toPointSetFn, ~distToFloatOperation=#Cdf(MagicNumbers.Epsilon.ten)) |> E.R.fmap(r => toFloatOperation(
r > 0. t1,
) ~toPointSetFn,
~distToFloatOperation=#Cdf(MagicNumbers.Epsilon.ten),
) |> E.R.fmap(r => r > 0.)
let secondOperandIsGreaterThanZero = let secondOperandIsGreaterThanZero =
toFloatOperation(t2, ~toPointSetFn, ~distToFloatOperation=#Cdf(MagicNumbers.Epsilon.ten)) |> E.R.fmap(r => toFloatOperation(
r > 0. t2,
) ~toPointSetFn,
~distToFloatOperation=#Cdf(MagicNumbers.Epsilon.ten),
) |> E.R.fmap(r => r > 0.)
let items = E.A.R.firstErrorOrOpen([ let items = E.A.R.firstErrorOrOpen([
firstOperandIsGreaterThanZero, firstOperandIsGreaterThanZero,
secondOperandIsGreaterThanZero, secondOperandIsGreaterThanZero,
@ -253,7 +257,8 @@ module AlgebraicCombination = {
#AsSymbolic #AsSymbolic
| #NoSolution => | #NoSolution =>
if Operation.Convolution.canDoAlgebraicOperation(arithmeticOperation) { if Operation.Convolution.canDoAlgebraicOperation(arithmeticOperation) {
expectedConvolutionCost(t1) * expectedConvolutionCost(t2) > MagicNumbers.OpCost.monteCarloCost expectedConvolutionCost(t1) * expectedConvolutionCost(t2) >
MagicNumbers.OpCost.monteCarloCost
? #AsMonteCarlo ? #AsMonteCarlo
: #AsConvolution : #AsConvolution
} else { } else {