fix: Attain parity with previous implementation
This is achieved by not adding more points in between i the points are already pretty close
This commit is contained in:
parent
599c14b32c
commit
5c9f57a24a
|
@ -11,7 +11,7 @@ module Epsilon = {
|
|||
|
||||
module Environment = {
|
||||
let defaultXYPointLength = 1000
|
||||
let defaultSampleCount = 10000
|
||||
let defaultSampleCount = 1000
|
||||
let enrichmentFactor = 10
|
||||
}
|
||||
|
||||
|
|
|
@ -468,18 +468,24 @@ module PointwiseCombination = {
|
|||
}
|
||||
|
||||
let getInBetween = (x1: float, x2: float): array<float> => {
|
||||
let newPointsArray = Belt.Array.makeBy(points - 1, i => i)
|
||||
// don't repeat the x2 point, it will be gotten in the next iteration.
|
||||
let result = Js.Array.mapi((pos, i) =>
|
||||
switch i {
|
||||
| 0 => x1
|
||||
| _ =>
|
||||
x1 *.
|
||||
(Belt.Float.fromInt(points) -. Belt.Float.fromInt(pos)) /.
|
||||
Belt.Float.fromInt(points) +. x2 *. Belt.Float.fromInt(pos) /. Belt.Float.fromInt(points)
|
||||
switch x1 -. x2 > 2.0 *. MagicNumbers.Epsilon.seven {
|
||||
| false => [x1]
|
||||
| true => {
|
||||
let newPointsArray = Belt.Array.makeBy(points - 1, i => i)
|
||||
// don't repeat the x2 point, it will be gotten in the next iteration.
|
||||
let result = Js.Array.mapi((pos, i) =>
|
||||
switch i {
|
||||
| 0 => x1
|
||||
| _ =>
|
||||
x1 *.
|
||||
(Belt.Float.fromInt(points) -. Belt.Float.fromInt(pos)) /.
|
||||
Belt.Float.fromInt(points) +.
|
||||
x2 *. Belt.Float.fromInt(pos) /. Belt.Float.fromInt(points)
|
||||
}
|
||||
, newPointsArray)
|
||||
result
|
||||
}
|
||||
, newPointsArray)
|
||||
result
|
||||
}
|
||||
}
|
||||
let newXsUnflattened = Js.Array.mapi((x, i) =>
|
||||
switch i < length - 2 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user