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 = {
|
module Environment = {
|
||||||
let defaultXYPointLength = 1000
|
let defaultXYPointLength = 1000
|
||||||
let defaultSampleCount = 10000
|
let defaultSampleCount = 1000
|
||||||
let enrichmentFactor = 10
|
let enrichmentFactor = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,6 +468,9 @@ module PointwiseCombination = {
|
||||||
}
|
}
|
||||||
|
|
||||||
let getInBetween = (x1: float, x2: float): array<float> => {
|
let getInBetween = (x1: float, x2: float): array<float> => {
|
||||||
|
switch x1 -. x2 > 2.0 *. MagicNumbers.Epsilon.seven {
|
||||||
|
| false => [x1]
|
||||||
|
| true => {
|
||||||
let newPointsArray = Belt.Array.makeBy(points - 1, i => i)
|
let newPointsArray = Belt.Array.makeBy(points - 1, i => i)
|
||||||
// don't repeat the x2 point, it will be gotten in the next iteration.
|
// don't repeat the x2 point, it will be gotten in the next iteration.
|
||||||
let result = Js.Array.mapi((pos, i) =>
|
let result = Js.Array.mapi((pos, i) =>
|
||||||
|
@ -476,11 +479,14 @@ module PointwiseCombination = {
|
||||||
| _ =>
|
| _ =>
|
||||||
x1 *.
|
x1 *.
|
||||||
(Belt.Float.fromInt(points) -. Belt.Float.fromInt(pos)) /.
|
(Belt.Float.fromInt(points) -. Belt.Float.fromInt(pos)) /.
|
||||||
Belt.Float.fromInt(points) +. x2 *. Belt.Float.fromInt(pos) /. Belt.Float.fromInt(points)
|
Belt.Float.fromInt(points) +.
|
||||||
|
x2 *. Belt.Float.fromInt(pos) /. Belt.Float.fromInt(points)
|
||||||
}
|
}
|
||||||
, newPointsArray)
|
, newPointsArray)
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
let newXsUnflattened = Js.Array.mapi((x, i) =>
|
let newXsUnflattened = Js.Array.mapi((x, i) =>
|
||||||
switch i < length - 2 {
|
switch i < length - 2 {
|
||||||
| true => getInBetween(x, t.xs[i + 1])
|
| true => getInBetween(x, t.xs[i + 1])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user